query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
sequencelengths
0
101
negative_scores
sequencelengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
autofocus on minute text; fetch draft
def mounted() @draft = '' jQuery('#draft-minute-form').on 'shown.bs.modal' do retrieve "draft/#{Agenda.title.gsub('-', '_')}", :text do |draft| document.getElementById("draft-minute-text").focus() @disabled = false @draft = draft jQuery('#draft-minute-text').animate(scrollTop: 0) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def beginning_minute=(string)\n frm.select(:id=>\"release_minute\").select(string)\n end", "def fill_in_date_time(field, with:)\n # date time picker can't be found by label\n # so we need to find it by input id\n input_id = page.find('label', text: field)['for']\n input = find_field(input_id)\n input.set(with)\n input.send_keys(:enter)\n end", "def select_minute(datetime, options = T.unsafe(nil), html_options = T.unsafe(nil)); end", "def parse_time\n # add a default time for a task.\n length_of_task = Time.now + 15.minutes\n\n # splits the entered text.\n sentence = body.split ' '\n esc_code = sentence.first\n\n # determines if the word is long enough.\n # if it was long enough, split the word into the necessary code.\n if esc_code.length >= 2\n esc_code_prefix = esc_code[0]\n esc_code_suffix = esc_code[1..-1]\n end\n\n # checks for valid escape sequence to parse.\n if esc_code_prefix == \"+\" and esc_code_suffix.match /\\d/\n # set time specified by user.\n length_of_task = Time.now + (esc_code_suffix.to_i * 60)\n # remove the escape code from the string.\n sentences = body.split ' ', 2\n self.body = sentences[1]\n end\n\n # set the completed at time field.\n self.completed_at = length_of_task\n \n end", "def ending_minute=(string)\n frm.select(:id=>\"retract_minute\").select(string)\n end", "def show\n @begin = @timed_form.begin\n @countdown_remaining = @timed_form.begin\n \n a = @begin.split(\":\")\n @minutes = a[0].to_i\n @seconds= a[1].to_i\n @time_seconds = -(@minutes * 60 + @seconds) + 600\n @time_format = Time.at(@time_seconds).utc.strftime(\"%M:%S\")\n end", "def focus\r\n end", "def beginning_hour=(string)\n frm.select(:id=>\"release_hour\").select(string)\n end", "def timebox(text='text', height=0, width=0, time=Time.now)\n command = %(--timebox \"#{text}\" #{height.to_i} #{width.to_i} #{time.hour} #{time.min} #{time.sec})\n call_and_capture command do |value|\n Time.parse value\n end\n end", "def ask_time\n # twelve\n end", "def select_beginning\n range = @content_field.textRangeFromPosition @content_field.beginningOfDocument, toPosition:@content_field.beginningOfDocument\n @content_field.setSelectedTextRange range\n end", "def picker_minute_interval\n screenshot_and_raise \"there is no minute in date mode\" if picker_is_in_date_mode\n screenshot_and_raise \"nyi\" if picker_is_in_countdown_mode\n res = query(\"datePicker\", :minuteInterval)\n screenshot_and_raise \"expected to see a date picker\" if res.empty?\n @picker_minute_interval = res.first\nend", "def focus_on_edit_line\n id_field.show\n id_field.focus\n end", "def autocomplete_work_break\r\n prepare_values\r\n @break_time = params[:bt]\r\n #validate before save\r\n validate_date(@this_date_str)\r\n \r\n if (@error_message == nil)\r\n @old_hours = (@this_work.work_hours==nil) ? \"\" : @this_work.work_hours\r\n break_time(@break_time)\r\n end\r\n render(:layout=>false)\r\n end", "def test04_EditEvent_time_date\n\t\t@date = \"#{next_year}-01-12\"\n\t\t@time = \"2:30 PM\"\n\t\tlogin $user_1_email, $master_password\n\t\t$browser.goto($patch_new_event)\n\t\tcreate_event \"Event for Edit Date/Time #{random}\"\n\t\t\n\t\t$post_edit_post.click\n\t\t$post_event_calendar_start_text.when_present.set(@date) \n \t\tsleep 2\n \t\t$post_event_time_start_field.when_present.click\n \t\t$post_event_select_time.when_present.select(@time)\n\t\t$post_now_event.fire_event(\"onclick\")\n\t\t\n\t\t$browser.text.include? @date\n\t\t$browser.text.include? @time\n\tend", "def time_to_show\n \n end", "def preview_text(_maxlength = nil)\n return \"\" unless value\n\n ::I18n.l(value, format: :\"alchemy.ingredient_date\")\n end", "def input_mtime(page)\n @input_mtime\n end", "def beginning_of_minute\n change(sec: 0)\n end", "def beginning_of_minute\n change(sec: 0)\n end", "def opening_hour\n 11 # 11am\n end", "def rcp_delay;catdet.text_field(:id, 'powerUpDelay');end", "def preview_text(_maxlength = nil)\n return \"\" if date.blank?\n\n ::I18n.l(date, format: :'alchemy.essence_date')\n end", "def focus!\n self.update_attribute :focus, 1\n end", "def redisplay_delay\r\n 20\r\n end", "def set_focus\n\t\[email protected]\n\tend", "def date_and_time(rule_name, info)\n\n # Get to the advanced page.\n self.goto_advanced(rule_name, info)\n \n # Get to the \"Date and Time\" page.\n begin\n @ff.link(:text, 'Date and Time').click\n self.msg(rule_name, :info, 'Date and Time', 'Reached page \\'Date and Time\\'.')\n rescue\n self.msg(rule_name, :error, 'Date and Time', 'Did not reach \\'Date and Time\\' page')\n return\n end\n \n # Check the key.\n if ( info.has_key?('section') &&\n info.has_key?('subsection') ) then\n # Right,go on.\n else\n self.msg(rule_name,:error,'date_and_time','Some key NOT found.')\n return\n end\n \n # Clock Set Add by Robin 2009.4.17\n if info.has_key?('action') \n case info['action']\n when 'Clock SET'\n @ff.link(:text, 'Clock Set').click\n # hour\n if info.key?('hour') \n @ff.text_field(:name, 'hour').value=(info['hour'])\n self.msg(rule_name, :info, 'date_and_time()->hour', 'hour= '+info['hour'])\n else\n self.msg(rule_name, :info, 'date_and_time()->hour', 'No hour key found')\n end\n # minute\n if info.key?('minute') \n @ff.text_field(:name, 'min').value=(info['minute'])\n self.msg(rule_name, :info, 'date_and_time()->minute', 'minute= '+info['minute'])\n else\n self.msg(rule_name, :info, 'date_and_time()->minute', 'No minute key found')\n end\n # sec\n if info.key?('sec') \n @ff.text_field(:name, 'sec').value=(info['sec'])\n self.msg(rule_name, :info, 'date_and_time()->sec', 'sec= '+info['sec'])\n else\n self.msg(rule_name, :info, 'date_and_time()->sec', 'No sec key found')\n end\n # year\n if info.key?('year')\n @ff.select_list(:id, 'year').select_value(info['year']) \n self.msg(rule_name, :info, 'date_and_time()->year', \"year = \"+info['year'])\n else\n self.msg(rule_name, :info, 'date_and_time()->year', 'year undefined')\n end\n # month\n if info.key?('month')\n case info['month']\n when 'Jan'\n @ff.select_list(:id, 'month').select_value('0') \n self.msg(rule_name, :info, 'date_and_time()->month', \"month = \"+info['month'])\n when 'Feb'\n @ff.select_list(:id, 'month').select_value('1') \n self.msg(rule_name, :info, 'date_and_time()->month', \"month = \"+info['month'])\n when 'Mar'\n @ff.select_list(:id, 'month').select_value('2') \n self.msg(rule_name, :info, 'date_and_time()->month', \"month = \"+info['month'])\n when 'Apr'\n @ff.select_list(:id, 'month').select_value('3') \n self.msg(rule_name, :info, 'date_and_time()->month', \"month = \"+info['month'])\n when 'May'\n @ff.select_list(:id, 'month').select_value('4') \n self.msg(rule_name, :info, 'date_and_time()->month', \"month = \"+info['month'])\n when 'Jun'\n @ff.select_list(:id, 'month').select_value('5') \n self.msg(rule_name, :info, 'date_and_time()->month', \"month = \"+info['month'])\n when 'Jul'\n @ff.select_list(:id, 'month').select_value('6') \n self.msg(rule_name, :info, 'date_and_time()->month', \"month = \"+info['month'])\n when 'Aug'\n @ff.select_list(:id, 'month').select_value('7') \n self.msg(rule_name, :info, 'date_and_time()->month', \"month = \"+info['month'])\n when 'Sep'\n @ff.select_list(:id, 'month').select_value('8') \n self.msg(rule_name, :info, 'date_and_time()->month', \"month = \"+info['month'])\n when 'Oct'\n @ff.select_list(:id, 'month').select_value('9') \n self.msg(rule_name, :info, 'date_and_time()->month', \"month = \"+info['month'])\n when 'Nov'\n @ff.select_list(:id, 'month').select_value('10') \n self.msg(rule_name, :info, 'date_and_time()->month', \"month = \"+info['month'])\n when 'Dec'\n @ff.select_list(:id, 'month').select_value('11') \n self.msg(rule_name, :info, 'date_and_time()->month', \"month = \"+info['month'])\n else\n self.msg(rule_name, :info, 'date_and_time()->month', 'month undefined')\n end\n end\n # day\n if info.key?('day')\n @ff.select_list(:id, 'day').select_value(info['day']) \n self.msg(rule_name, :info, 'date_and_time()->day', \"day = \"+info['day'])\n else\n self.msg(rule_name, :info, 'date_and_time()->day', 'day undefined')\n end\n # click 'Apply' button to complete setup\n @ff.link(:text, 'Apply').click\n\tif not @ff.text.include?('Input Errors') then\n\t self.msg(rule_name,:info,'Set Time','SUCCESS')\n else\n\t @ff.tables.each do |t|\n\t\tif ( (t.text.include? 'value') and (not t.text.include? 'Input Errors')) then\n\t\t t.each do |row|\n\t\t\tif row.text.include? 'value' then\n\t\t\t self.msg(rule_name,:error,row[1].to_s.gsub(':',''),row[2]);\n\t\t\tend\n\t\t end\n\t\tend\n\t end\n end\n\treturn\n else\n self.msg(rule_name,:error,'Date and Time','Did NOT find the value in \\'action\\'.')\n return \n end # end of case \n end # end of if \n \n # \"Time Zone\"\n if info.has_key?('Time Zone')\n \n case info['Time Zone']\n \n when 'Other'\n \n # Set \"Other\"\n @ff.select_list(:name,'time_zone').select_value(\"\")\n self.msg(rule_name,:info,'Time Zone',info['Time Zone'])\n \n when 'Alaska_Time'\n \n # Set \"Alaska_Time\"\n @ff.select_list(:name,'time_zone').select_value(\"Alaska_Time\")\n self.msg(rule_name,:info,'Time Zone',info['Time Zone'])\n \n when 'Central_Time'\n \n # Set \"Central_Time\"\n @ff.select_list(:name,'time_zone').select_value(\"Central_Time\")\n self.msg(rule_name,:info,'Time Zone',info['Time Zone']) \n \n when 'Eastern_Time'\n \n # Set \"Eastern_Time\"\n @ff.select_list(:name,'time_zone').select_value(\"Eastern_Time\")\n self.msg(rule_name,:info,'Time Zone',info['Time Zone']) \n \n when 'Greenwich_Mean_Time'\n \n # Set \"Greenwich_Mean_Time\"\n @ff.select_list(:name,'time_zone').select_value(\"Greenwich_Mean_Time\")\n self.msg(rule_name,:info,'Time Zone',info['Time Zone']) \n \n when 'Hawaii_Time'\n \n # Set \"Hawaii_Time\"\n @ff.select_list(:name,'time_zone').select_value(\"Hawaii_Time\")\n self.msg(rule_name,:info,'Time Zone',info['Time Zone']) \n \n when 'Mountain_Time'\n \n # Set \"Mountain_Time\"\n @ff.select_list(:name,'time_zone').select_value(\"Mountain_Time\")\n self.msg(rule_name,:info,'Time Zone',info['Time Zone']) \n \n when 'Pacific_Time'\n \n # Set \"Pacific_Time\"\n @ff.select_list(:name,'time_zone').select_value(\"Pacific_Time\")\n self.msg(rule_name,:info,'Time Zone',info['Time Zone']) \n \n else\n \n # Wrong here\n self.msg(rule_name,:error,'Date and Time','Did NOT find the value in \\'Time Zone\\'.')\n return\n \n end # end of case\n \n end # end of if \n \n # \"GMT Offset\"\n if info.has_key?('GMT Offset')\n \n # Is there?\n if not @ff.text.include?'GMT Offset'\n # Error here.\n self.msg(rule_name,:error,'Date and Time','No option \\'GMT Offset\\'.')\n return\n end\n \n # Set \"GMT Offset\"\n @ff.text_field(:name,'gmt_offset').set(info['GMT Offset'])\n self.msg(rule_name,:info,'GMT Offset',info['GMT Offset'])\n \n end\n \n # \"Daylight Enable\"\n if info.has_key?('Daylight Enable')\n \n case info['Daylight Enable']\n \n when 'on'\n \n # Set \"Daylight Enable\"\n @ff.checkbox(:name,'is_dl_sav').set\n self.msg(rule_name,:info,'Daylight Enable',info['Daylight Enable'])\n \n when 'off'\n \n # Clear \"Daylight Enable\"\n @ff.checkbox(:name,'is_dl_sav').clear\n self.msg(rule_name,:info,'Daylight Enable',info['Daylight Enable'])\n \n else\n \n # Wrong here\n self.msg(rule_name,:error,'date_and_time','Did NOT find the value in \\'Daylight Enable\\'.')\n return\n \n end # end of case\n \n end # end of if \n\n # \"Start Month\"\n if info.has_key?('Start Month')\n \n case info['Start Month']\n \n when 'Jan'\n \n # Set \"Start Month\"\n @ff.select_list(:name,'dst_mon_start').select_value(\"0\")\n self.msg(rule_name,:info,'Start Month',info['Start Month'])\n \n when 'Feb'\n \n # Set \"Start Month\"\n @ff.select_list(:name,'dst_mon_start').select_value(\"1\")\n self.msg(rule_name,:info,'Start Month',info['Start Month'])\n \n when 'Mar'\n \n # Set \"Start Month\"\n @ff.select_list(:name,'dst_mon_start').select_value(\"2\")\n self.msg(rule_name,:info,'Start Month',info['Start Month'])\n \n when 'Apr'\n \n # Set \"Start Month\"\n @ff.select_list(:name,'dst_mon_start').select_value(\"3\")\n self.msg(rule_name,:info,'Start Month',info['Start Month'])\n \n when 'May'\n \n # Set \"Start Month\"\n @ff.select_list(:name,'dst_mon_start').select_value(\"4\")\n self.msg(rule_name,:info,'Start Month',info['Start Month'])\n \n when 'Jun'\n \n # Set \"Start Month\"\n @ff.select_list(:name,'dst_mon_start').select_value(\"5\")\n self.msg(rule_name,:info,'Start Month',info['Start Month'])\n \n when 'Jul'\n \n # Set \"Start Month\"\n @ff.select_list(:name,'dst_mon_start').select_value(\"6\")\n self.msg(rule_name,:info,'Start Month',info['Start Month'])\n \n when 'Aug'\n \n # Set \"Start Month\"\n @ff.select_list(:name,'dst_mon_start').select_value(\"7\")\n self.msg(rule_name,:info,'Start Month',info['Start Month'])\n \n when 'Sep'\n \n # Set \"Start Month\"\n @ff.select_list(:name,'dst_mon_start').select_value(\"8\")\n self.msg(rule_name,:info,'Start Month',info['Start Month'])\n \n when 'Oct'\n \n # Set \"Start Month\"\n @ff.select_list(:name,'dst_mon_start').select_value(\"9\")\n self.msg(rule_name,:info,'Start Month',info['Start Month'])\n \n when 'Nov'\n \n # Set \"Start Month\"\n @ff.select_list(:name,'dst_mon_start').select_value(\"10\")\n self.msg(rule_name,:info,'Start Month',info['Start Month'])\n \n when 'Dec'\n \n # Set \"Start Month\"\n @ff.select_list(:name,'dst_mon_start').select_value(\"11\")\n self.msg(rule_name,:info,'Start Month',info['Start Month']) \n \n else\n \n # Wrong here\n self.msg(rule_name,:error,'','Did NOT find the value in \\'Start Month\\'.')\n return\n \n end # end of case\n \n end # end of if \n\n # \"Start Date\"\n if info.has_key?('Start Date')\n \n case info['Start Date']\n \n when '1'\n @ff.select_list(:name,'dst_day_start').select_value(\"1\")\n when '2'\n @ff.select_list(:name,'dst_day_start').select_value(\"2\")\n when '3'\n @ff.select_list(:name,'dst_day_start').select_value(\"3\")\n when '4'\n @ff.select_list(:name,'dst_day_start').select_value(\"4\")\n when '5'\n @ff.select_list(:name,'dst_day_start').select_value(\"5\")\n when '6'\n @ff.select_list(:name,'dst_day_start').select_value(\"6\")\n when '7'\n @ff.select_list(:name,'dst_day_start').select_value(\"7\")\n when '8'\n @ff.select_list(:name,'dst_day_start').select_value(\"8\")\n when '9'\n @ff.select_list(:name,'dst_day_start').select_value(\"9\")\n when '10'\n @ff.select_list(:name,'dst_day_start').select_value(\"10\")\n when '11'\n @ff.select_list(:name,'dst_day_start').select_value(\"11\")\n when '12'\n @ff.select_list(:name,'dst_day_start').select_value(\"12\")\n when '13'\n @ff.select_list(:name,'dst_day_start').select_value(\"13\")\n when '14'\n @ff.select_list(:name,'dst_day_start').select_value(\"14\")\n when '15'\n @ff.select_list(:name,'dst_day_start').select_value(\"15\")\n when '16'\n @ff.select_list(:name,'dst_day_start').select_value(\"16\")\n when '17'\n @ff.select_list(:name,'dst_day_start').select_value(\"17\")\n when '18'\n @ff.select_list(:name,'dst_day_start').select_value(\"18\")\n when '19'\n @ff.select_list(:name,'dst_day_start').select_value(\"19\")\n when '20'\n @ff.select_list(:name,'dst_day_start').select_value(\"20\")\n when '21'\n @ff.select_list(:name,'dst_day_start').select_value(\"21\")\n when '22'\n @ff.select_list(:name,'dst_day_start').select_value(\"22\")\n when '23'\n @ff.select_list(:name,'dst_day_start').select_value(\"23\")\n when '24'\n @ff.select_list(:name,'dst_day_start').select_value(\"24\")\n when '25'\n @ff.select_list(:name,'dst_day_start').select_value(\"25\")\n when '26'\n @ff.select_list(:name,'dst_day_start').select_value(\"26\")\n when '27'\n @ff.select_list(:name,'dst_day_start').select_value(\"27\") \n when '28'\n @ff.select_list(:name,'dst_day_start').select_value(\"28\")\n when '29'\n @ff.select_list(:name,'dst_day_start').select_value(\"29\")\n when '30'\n @ff.select_list(:name,'dst_day_start').select_value(\"30\")\n when '31'\n @ff.select_list(:name,'dst_day_start').select_value(\"31\") \n \n else\n \n # Wrong here\n self.msg(rule_name,:error,'','Did NOT find the value in \\'Start Date\\'.')\n return\n \n end # end of case\n \n self.msg(rule_name,:info,'Start Date',info['Start Date'])\n \n end # end of if \n\n # \"Start Hour\"\n if info.has_key?('Start Hour')\n \n # Set\n @ff.text_field(:name,'dst_hour_start').set(info['Start Hour'])\n self.msg(rule_name,:info,'Start Hour',info['Start Hour'])\n \n end \n \n # \"Start Minute\"\n if info.has_key?('Start Minute')\n \n # Set\n @ff.text_field(:name,'dst_min_start').set(info['Start Minute'])\n self.msg(rule_name,:info,'Start Minute',info['Start Minute'])\n \n end \n \n # \"End Month\"\n if info.has_key?('End Month')\n \n case info['End Month']\n \n when 'Jan'\n \n # Set \"End Month\"\n @ff.select_list(:name,'dst_mon_end').select_value(\"0\")\n self.msg(rule_name,:info,'End Month',info['End Month'])\n \n when 'Feb'\n \n # Set \"End Month\"\n @ff.select_list(:name,'dst_mon_end').select_value(\"1\")\n self.msg(rule_name,:info,'End Month',info['End Month'])\n \n when 'Mar'\n \n # Set \"End Month\"\n @ff.select_list(:name,'dst_mon_end').select_value(\"2\")\n self.msg(rule_name,:info,'End Month',info['End Month'])\n \n when 'Apr'\n \n # Set \"End Month\"\n @ff.select_list(:name,'dst_mon_end').select_value(\"3\")\n self.msg(rule_name,:info,'End Month',info['End Month'])\n \n when 'May'\n \n # Set \"End Month\"\n @ff.select_list(:name,'dst_mon_end').select_value(\"4\")\n self.msg(rule_name,:info,'End Month',info['End Month'])\n \n when 'Jun'\n \n # Set \"End Month\"\n @ff.select_list(:name,'dst_mon_end').select_value(\"5\")\n self.msg(rule_name,:info,'End Month',info['End Month'])\n \n when 'Jul'\n \n # Set \"End Month\"\n @ff.select_list(:name,'dst_mon_end').select_value(\"6\")\n self.msg(rule_name,:info,'End Month',info['End Month'])\n \n when 'Aug'\n \n # Set \"End Month\"\n @ff.select_list(:name,'dst_mon_end').select_value(\"7\")\n self.msg(rule_name,:info,'End Month',info['End Month'])\n \n when 'Sep'\n \n # Set \"End Month\"\n @ff.select_list(:name,'dst_mon_end').select_value(\"8\")\n self.msg(rule_name,:info,'End Month',info['End Month'])\n \n when 'Oct'\n \n # Set \"End Month\"\n @ff.select_list(:name,'dst_mon_end').select_value(\"9\")\n self.msg(rule_name,:info,'End Month',info['End Month'])\n \n when 'Nov'\n \n # Set \"End Month\"\n @ff.select_list(:name,'dst_mon_end').select_value(\"10\")\n self.msg(rule_name,:info,'End Month',info['End Month'])\n \n when 'Dec'\n \n # Set \"End Month\"\n @ff.select_list(:name,'dst_mon_end').select_value(\"11\")\n self.msg(rule_name,:info,'End Month',info['End Month']) \n \n else\n \n # Wrong here\n self.msg(rule_name,:error,'','Did NOT find the value in \\'End Month\\'.')\n return\n \n end # end of case\n \n end # end of if \n\n # \"End Date\"\n if info.has_key?('End Date')\n \n case info['End Date']\n \n when '1'\n @ff.select_list(:name,'dst_day_end').select_value(\"1\")\n when '2'\n @ff.select_list(:name,'dst_day_end').select_value(\"2\")\n when '3'\n @ff.select_list(:name,'dst_day_end').select_value(\"3\")\n when '4'\n @ff.select_list(:name,'dst_day_end').select_value(\"4\")\n when '5'\n @ff.select_list(:name,'dst_day_end').select_value(\"5\")\n when '6'\n @ff.select_list(:name,'dst_day_end').select_value(\"6\")\n when '7'\n @ff.select_list(:name,'dst_day_end').select_value(\"7\")\n when '8'\n @ff.select_list(:name,'dst_day_end').select_value(\"8\")\n when '9'\n @ff.select_list(:name,'dst_day_end').select_value(\"9\")\n when '10'\n @ff.select_list(:name,'dst_day_end').select_value(\"10\")\n when '11'\n @ff.select_list(:name,'dst_day_end').select_value(\"11\")\n when '12'\n @ff.select_list(:name,'dst_day_end').select_value(\"12\")\n when '13'\n @ff.select_list(:name,'dst_day_end').select_value(\"13\")\n when '14'\n @ff.select_list(:name,'dst_day_end').select_value(\"14\")\n when '15'\n @ff.select_list(:name,'dst_day_end').select_value(\"15\")\n when '16'\n @ff.select_list(:name,'dst_day_end').select_value(\"16\")\n when '17'\n @ff.select_list(:name,'dst_day_end').select_value(\"17\")\n when '18'\n @ff.select_list(:name,'dst_day_end').select_value(\"18\")\n when '19'\n @ff.select_list(:name,'dst_day_end').select_value(\"19\")\n when '20'\n @ff.select_list(:name,'dst_day_end').select_value(\"20\")\n when '21'\n @ff.select_list(:name,'dst_day_end').select_value(\"21\")\n when '22'\n @ff.select_list(:name,'dst_day_end').select_value(\"22\")\n when '23'\n @ff.select_list(:name,'dst_day_end').select_value(\"23\")\n when '24'\n @ff.select_list(:name,'dst_day_end').select_value(\"24\")\n when '25'\n @ff.select_list(:name,'dst_day_end').select_value(\"25\")\n when '26'\n @ff.select_list(:name,'dst_day_end').select_value(\"26\")\n when '27'\n @ff.select_list(:name,'dst_day_end').select_value(\"27\") \n when '28'\n @ff.select_list(:name,'dst_day_end').select_value(\"28\")\n when '29'\n @ff.select_list(:name,'dst_day_end').select_value(\"29\")\n when '30'\n @ff.select_list(:name,'dst_day_end').select_value(\"30\")\n when '31'\n @ff.select_list(:name,'dst_day_end').select_value(\"31\") \n \n else\n \n # Wrong here\n self.msg(rule_name,:error,'','Did NOT find the value in \\'End Date\\'.')\n return\n \n end # end of case\n \n self.msg(rule_name,:info,'End Date',info['End Date'])\n \n end # end of if \n\n # \"End Hour\"\n if info.has_key?('End Hour')\n \n # Set\n @ff.text_field(:name,'dst_hour_end').set(info['End Hour'])\n self.msg(rule_name,:info,'End Hour',info['End Hour'])\n \n end \n \n # \"End Minute\"\n if info.has_key?('End Minute')\n \n # Set\n @ff.text_field(:name,'dst_min_end').set(info['End Minute'])\n self.msg(rule_name,:info,'End Minute',info['End Minute'])\n \n end \n \n # \"Offset\"\n if info.has_key?('Offset')\n \n # Set\n @ff.text_field(:name,'dst_offset').set(info['Offset'])\n self.msg(rule_name,:info,'Offset',info['Offset'])\n \n end \n \n # \"Automatic Enabled\"\n if info.has_key?('Automatic Enabled')\n \n case info['Automatic Enabled']\n \n when 'on'\n \n # Set \"Automatic Enabled\"\n @ff.checkbox(:name,'is_tod_enabled').set\n self.msg(rule_name,:info,'Automatic Enabled',info['Automatic Enabled'])\n \n when 'off'\n \n # Clear \"Automatic Enabled\"\n @ff.checkbox(:name,'is_tod_enabled').clear\n self.msg(rule_name,:info,'Automatic Enabled',info['Automatic Enabled'])\n \n else\n \n # Wrong here\n self.msg(rule_name,:error,'Date and Time','Did NOT find the value in \\'Automatic Enabled\\'.')\n return\n \n end # end of case\n \n end # end of if \n\n # \"Time Of Day\"\n if info.has_key?('Time Of Day')\n \n case info['Time Of Day']\n \n when 'on'\n \n # Set \"Time Of Day\"\n @ff.radio(:id,'tod_prot_type_1').set\n self.msg(rule_name,:info,'Time Of Day',info['Time Of Day'])\n \n when 'off'\n \n # Clear \"Time Of Day\"\n @ff.radio(:id,'tod_prot_type_1').clear\n self.msg(rule_name,:info,'Time Of Day',info['Time Of Day'])\n \n else\n \n # Wrong here\n self.msg(rule_name,:error,'Date and Time','Did NOT find the value in \\'Time Of Day\\'.')\n return\n \n end # end of case\n \n end # end of if \n \n # \"Network Time Protocol\"\n if info.has_key?('Network Time Protocol')\n \n case info['Network Time Protocol']\n \n when 'on'\n \n # Set \"Network Time Protocol\"\n @ff.radio(:id,'tod_prot_type_2').set\n self.msg(rule_name,:info,'Network Time Protocol',info['Network Time Protocol'])\n \n when 'off'\n \n # Clear \"Network Time Protocol\"\n @ff.radio(:id,'tod_prot_type_2').clear\n self.msg(rule_name,:info,'Network Time Protocol',info['Network Time Protocol'])\n \n else\n \n # Wrong here\n self.msg(rule_name,:error,'Date and Time','Did NOT find the value in \\'Network Time Protocol\\'.')\n return\n \n end # end of case\n \n end # end of if \n\n # \"Update Every\"\n if info.has_key?('Update Every')\n \n #\n @ff.text_field(:name,'tod_update_period').set(info['Update Every'])\n self.msg(rule_name,:info,'Update Every',info['Update Every'])\n \n end \n \n # \"Sync Now\"\n if info.has_key?('Sync Now')\n \n case info['Sync Now']\n \n when 'on'\n \n # Set \"Sync Now\"\n @ff.link(:text,'Sync Now').click\n @ff.wait\n self.msg(rule_name,:info,'Sync Now',info['Sync Now'])\n \n when 'off'\n \n # Clear \"Sync Now\"\n # Do nothing here.\n self.msg(rule_name,:info,'Sync Now',info['Sync Now'])\n \n else\n \n # Wrong here\n self.msg(rule_name,:error,'Date and Time','Did NOT find the value in \\'Sync Now\\'.')\n return\n \n end # end of case\n \n end # end of if \n \n if info.has_key?('Remove Time Server')\n\[email protected] do |l|\n\t if ( l.href.to_s.include? 'remove_time_server') then\n\t\[email protected](:href,l.href.to_s).click\n\t end\n\tend\n end\n if info.has_key?('Add Time Server')\n\[email protected](:href,'javascript:mimic_button(\\'add_time_server: ...\\', 1)').click\n\[email protected]_field(:name,'tod_server').value = info['Add Time Server']\n\[email protected](:text,'Apply').click\n end\n \n if info.has_key?('Add Multi Time Servers')\n \tfor i in 0...info['Add Multi Time Servers'].to_i\n\t @ff.link(:href,'javascript:mimic_button(\\'add_time_server: ...\\', 1)').click\n\t @ff.text_field(:name,'tod_server').value = \"ntp.testurl\" + i.to_s + \".com\"\n\t @ff.link(:text,'Apply').click\n\tend\n end\n\n \n if info.has_key?('Read Sync Status')\n\[email protected] do |t|\n\t if ( (t.text.include? 'Status') and (t.text.include? 'Time Server') and (t.row_count > 5)) then\n\t\tt.each do |row|\n\t\t if row.text.include? 'Status' then\n\t\t\tself.msg(rule_name,:info,row[1].to_s.gsub(':',''),row[2])\t\n\t\t end\n\t\tend\n\t end\n\tend\n end\n\n # Apply for the change\n @ff.link(:text,'Apply').click\n \n # Output the result\n if not @ff.text.include?('Input Errors') then\n\tself.msg(rule_name,:info,'Date and Time','SUCCESS')\n else\n\[email protected] do |t|\n\t if ( (t.text.include? 'value') and (not t.text.include? 'Input Errors')) then\n\t\tt.each do |row|\n\t\t if row.text.include? 'value' then\n\t\t\tself.msg(rule_name,:error,row[1].to_s.gsub(':',''),row[2])\n\t\t end\n\t\tend\n\t end\n\tend\n end\n \n end", "def begin_mission_text\n typing_tabbed(\"txt/caveats.txt\")\n tab; \"We recommend avoiding the latter\".typing; \"...\".typing(0.75)\n line; line; sleep 2\n\n tab; \"We'll reach the LZ in just a moment\".typing; line\n tab; \"Godspeed, Agent #{codename}. We're counting on you...\".typing; line\n\n press_enter { %Q(Press 'ENTER' to begin your mission and start the timer.) }\n end", "def draft_time_off=(value)\n @draft_time_off = value\n end", "def start_time_input_parser\n\tparams[:micropost][:time] = parse_start_time(params[:micropost][:time])\n end", "def my_datetime_input_html(fragment,strfformat)\n template.send(\n :text_field_tag,\n '%s[%s_%s]' % [object_name, method, fragment.to_s],\n (value.respond_to? :strftime) ? value.strftime(strfformat) : value,\n input_html_options.merge(\n :id => fragment_id(fragment), \n :class => [\"input-small\", \"%s_picker\" % fragment.to_s].join(' '))\n )\n end", "def display_time\n @display_time || start_time\n end", "def draft_time_off\n return @draft_time_off\n end", "def get_later\n if @history.empty?\n # If there is no history, clear the current input.\n # If there is no input, return so that we don't refresh the text unnecessarily.\n return if self.text.empty?\n self.text = \"\"\n elsif @history_index < @history.length-1\n # Change the text accordingly\n @history_index += 1\n self.text = @history[@history_index]\n @helper.cursor = self.text.scan(/./m).length\n else\n # If we're reached the earliest item in history, clear the current input.\n @history_index = @history.length\n self.text = \"\"\n end\n self.refresh\n end", "def active_parse_and_set_split_time(time)\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n result = Native.RunEditor_active_parse_and_set_split_time(@handle.ptr, time)\n result\n end", "def time(text)\n if time?(text)\n Nickel.parse(text).occurrences[0].start_time.to_time\n else\n clean_text = clear_text(text)\n if time?(clean_text)\n Nickel.parse(clean_text).occurrences[0].start_time.to_time\n end\n end\n end", "def focus_change; change_for :focus; end", "def open_value\n \"from:#{later_than_midnight_today}\"\n end", "def show_time\n\n end", "def date_field_with_time_allowing_blank(date, object_name, method, options={})\n hash = { :date => '', :time => '' } \n \n\thash = separate_date_time(date) if date != nil\n\t\n date_part = date_field(object_name, method+'_date', :size => 15, :value => hash[:date])\n time_part = text_field object_name, method+'_time', :size => 4, :value => hash[:time]\n \n return date_part+'&nbsp;' + time_part\n end", "def short_display_time\n\t\tself.timestamp.strftime(\"%b %d %-l:%M %p\") + (self.is_full? ? \" (Waitlist)\" : \"\")\n\tend", "def change_time(hike_instance)\n system 'clear'\n puts \"-----MY HIKES-----\"\n hours = @prompt.ask(\"Enter time in hours: \", required: true, convert: :int) {|input| input.in('0-24')}\n minutes = 61\n while minutes > 60 || minutes < 0\n minutes = @prompt.ask(\"Enter time in minutes: \", required: true, convert: :int) {|input| input.in('0-60')}\n end\n hike_instance.time_hiked = (hours * 3600) + (minutes * 60)\n hike_instance.save\n puts \"New time saved.\"\n @prompt.keypress(\"Press any key to continue\")\n end", "def job_time(value)\n @form['581'] = value\n end", "def starts\n form_print(starts_at)\n end", "def starts\n form_print(starts_at)\n end", "def draft_message; draft.complete_message if draft; end", "def minutes(title)\n \"https://whimsy.apache.org/board/minutes/#{title.gsub(/\\W/, '_')}\"\n end", "def focused_control\n Window.functions[__method__] ||= AU3_Function.new(\"ControlGetFocus\", 'SSPI')\n buffer = \" \" * AutoItX3::BUFFER_SIZE\n buffer.wide!\n Window.functions[__method__].call(@title.wide, @text.wide, buffer, AutoItX3::BUFFER_SIZE - 1)\n AutoItX3::Control.new(@title, @text, buffer.normal.strip)\n end", "def mounted()\n document.getElementById('fullname').focus()\n end", "def mounted()\n document.getElementById('fullname').focus()\n end", "def checktitle(browser)\n puts \"Inside checktitle\"\n browser.text_field(:class,'customize-control-title')\n sleep (3)\n \nend", "def save_draft\n @page.find(input_elements[:draft]).click\n end", "def first_textfield\n ele_by_json _textfield_visible\n end", "def beginning_of_hour\n change(min: 0)\n end", "def beginning_of_hour\n change(min: 0)\n end", "def obtain\n return default unless prompt\n\n time = label ? obtain_with_label : default\n @value = @formatter.call time\n value\n end", "def show\n if @widgetStart.nil?\n @widgetStart = 1.month.ago.strftime(\"%d/%m/%Y\")\n @widgetEnd = Date.today.strftime(\"%d/%m/%Y\")\n @period = 30\n end\n end", "def enter_date_completed(test_data)\n hide_notifications_bar\n wait_for_element_and_type(date_completed_input, test_data[UseOfCollections::DATE_COMPLETED.name])\n hit_enter\n end", "def show_focus\n show_focus_on_row(@oldwinrow, @oldprow, false)\n show_focus_on_row(@winrow, @prow, true)\n # printstr @form.window, 23, 10, @prow\n end", "def resume_full_automation_mode_time\n data[:resume_full_automation_mode_time]\n end", "def picker_minimum_date_time\n res = query(\"datePicker\", :minimumDate)\n screenshot_and_raise \"expected to see a date picker\" if res.empty?\n res.first != nil ? DateTime.parse(res.first) : nil\nend", "def enable_input_box\n summary_widget.hide\n hc_pomodoro_input_box.setHidden(false)\n hc_pomodoro_input_box.text = @pomodori_controller.last_tags.join(\" \") + \" \"\n end", "def Edit_TakeFocus(hwndCtl) send_edit_message(hwndCtl, :TAKEFOCUS) end", "def start_formatted\n display_time read_attribute(:start)\n end", "def atime() end", "def atime() end", "def tock\n @minute += 1\n end", "def get_next_activity\n next_activity_input = InputGlade.new(\"glade/ChangeActivity.glade\", nil, \"TimeWatch\")\n Gtk.main\n next_activity_input.activity\nend", "def load_timelet(name)\n find_field('name', with: name).find(:xpath, \"../../a\").click\n end", "def opening_hour\n 11\n end", "def minute\n set_function_and_argument(:minute, nil)\n end", "def show\n @question = Question.find(params[:id])\n @question.start_time = Time.now\n @question.save\n\n end", "def later\n @later = @doc.xpath(\"//div[@id='nextHourClear']\").text.strip\n end", "def test_scm_st_012\n printf \"\\n Test 012\"\n open_periodical_analysis_setting_tab\n assert is_text_present($display_scm[\"interval_field\"])\n assert is_text_present($display_scm[\"interval_rule\"])\n assert is_element_present($display_scm_xpath[\"interval_field\"])\n assert_equal \"*/30 * * * *\",get_value($display_scm_xpath[\"interval_field\"])\n logout\n end", "def date_field_with_time(actual_date, object_name, method, options={})\n actual_date = Time.now if actual_date == nil\n if actual_date != nil\n hash = separate_date_time(actual_date)\n date_part = date_field(object_name, method+'_date', :size => 15, :value => hash[:date])\n time_part = text_field object_name, method+'_time', :size => 4,:value => hash[:time]\n else\n date_part= \"* SHOULD BE DATE STUFF HERE * \"\n time_part= \"* SHOULD BE TIME STUFF HERE * \"\n end\n return date_part+'&nbsp;' + time_part\n end", "def briefing\n \"#{date.min} #{date.hour} #{date.day} #{date.month} 0 #{ab_command}\"\n end", "def pbTextEntry(helptext,minlength,maxlength,variableNumber)\n $game_variables[variableNumber] = pbEnterText(helptext,minlength,maxlength)\n $game_map.need_refresh = true if $game_map\nend", "def reporthelp_start_time( form )\n return form.calendar_date_select(\n :range_start,\n {\n :embedded => false,\n :year_range => Timesheet.used_range()\n }\n )\n end", "def half_refresh\n contents.clear_rect(24, 0, contents_width - 24, line_height)\n draw_text(24, 0, contents_width - 24, line_height, $game_system.playtime_s, 2)\n end", "def time_span_field_for(occurrence)\n text_field_tag \"occurrence_#{occurrence.id}[time_span]\", nil,\n \t\t\t\t\t\t\t\t\t :id \t\t\t\t\t\t \t\t\t=> \"occurrence_#{occurrence.id}_time_span\",\n\t\t\t\t\t\t\t\t\t :class \t\t\t\t \t\t\t=> 'occurrence_time_span',\n \t\t\t\t\t\t\t\t\t 'data-ajax-url' \t\t \t=> course_length_path,\n\t\t\t\t\t\t\t\t\t 'data-update-target' => \"#occurrence_#{occurrence.id}_time_span_length\" \n end", "def preview_text(foo=nil)\n\t\t\treturn \"\" if date.blank?\n\t\t\t::I18n.l(date, :format => :date)\n\t\tend", "def earliest_interview_timeblock_start\n interview_timeblocks.find(:first, :order => 'start_time').start_time\n end", "def datetime_select(method, options = {}, html_options = {})\n existing_time = @object.send(method) \n formatted_time = existing_time.to_time.strftime(\"%F %I:%M %p\") if existing_time.present?\n @template.content_tag(:div, :class => \"input-group\") do \n text_field(method, :value => formatted_time, :class => \"form-control datetimepicker\", :\"data-date-format\" => \"YYYY-MM-DD hh:mm A\") +\n @template.content_tag(:span, @template.content_tag(:span, \"\", :class => \"glyphicon glyphicon-calendar\") ,:class => \"input-group-addon\")\n end\n end", "def format\n puts \"-\" * 60\n end", "def applicationDidFinishLaunching(notification)\n @timeTextField = timeTextField\n @timeStepper = timeStepper\n end", "def prep_time_passed\n return \"7:34\"\n end", "def first_textfield\n js = textfield_js 'r = r.length > 0 ? $(r[0]) : r;'\n execute_script(js).first\n end", "def editable?\n ((Time.now - self.created_at ) / 1.minute).round < MINUTES_UNTIL_UNEDITABLE\n end", "def start_time\n return \"1530\";\n end", "def min\n @min ||= time_parts[1]\n end", "def enter_date_requested(test_data)\n hide_notifications_bar\n wait_for_element_and_type(date_requested_input, test_data[UseOfCollections::DATE_REQUESTED.name])\n hit_enter\n end", "def comment_in_first_box=(comment)\n frm.text_field(:name=>\"editTotalResults:totalScoreTable:0:_id345\").value=comment\n end", "def textFieldStarted(tf)\n tf.text = \"\"\n end", "def start_form_column(column, options)\n text_field :record, :start, options.merge({:class => \"date_picker\"})\n end", "def rl_forced_update_display()\r\n if (@visible_line)\r\n @visible_line.gsub!(/[^\\x00]/,0.chr)\r\n end\r\n rl_on_new_line()\r\n @forced_display=true if !@forced_display\r\n send(@rl_redisplay_function)\r\n 0\r\n end", "def change_appt(appt) \n time = @prompt.ask(\"Plase Enter The New Date and Time -> Ex. 12/12/12 AT 12:00 PM\")\n appt.update(time: time)\n end", "def change_appt(appt) \n time = @prompt.ask(\"Plase Enter The New Date and Time -> Ex. 12/12/12 AT 12:00 PM\")\n appt.update(time: time)\n end", "def start_time\n start_time_config.pattern_matches[:time]\n end", "def autofill\n all_project_time_ids = @project.project_times.where(is_date: false).pluck(:id)\n\n all_project_time_ids.each do |project_time_id|\n ranking = Ranking.find_by(participant_id: @participant.id, project_time_id: project_time_id)\n if ranking\n ranking.update(rank: 3)\n else\n Ranking.create(participant_id: @participant.id, project_time_id: project_time_id, rank: rand(1..3))\n end\n end\n participant = Participant.find_by(id: @participant.id)\n participant.update(last_responded: Time.now.getutc)\n redirect_to display_project_participants_path(@participant.project_id)\n end", "def opening(day)\n Time.now.utc.midnight\n .advance(seconds: opening_second(day)).strftime('%H:%M')\n end" ]
[ "0.57386553", "0.5310579", "0.5194729", "0.509426", "0.5073351", "0.5069829", "0.50524896", "0.5026007", "0.50083077", "0.4998745", "0.49654967", "0.49612442", "0.49606293", "0.49588794", "0.49526522", "0.4944988", "0.49101463", "0.4887629", "0.4876456", "0.4876456", "0.48532495", "0.48453993", "0.48377645", "0.48346183", "0.48261318", "0.4824671", "0.48120895", "0.48114", "0.4758632", "0.47472572", "0.474059", "0.47351775", "0.4711164", "0.47065502", "0.4703873", "0.47014695", "0.4697665", "0.46919245", "0.46907082", "0.46864322", "0.46854302", "0.468437", "0.46660426", "0.4665414", "0.4665414", "0.46588433", "0.4655851", "0.4651365", "0.46428517", "0.46428517", "0.46423984", "0.4639308", "0.4628629", "0.4628016", "0.4628016", "0.46163172", "0.46136525", "0.46120998", "0.46061367", "0.46031266", "0.4602714", "0.4600051", "0.45996818", "0.45994747", "0.45984796", "0.45984796", "0.4597154", "0.45918825", "0.45882154", "0.4587011", "0.45817876", "0.45787328", "0.45725924", "0.45723668", "0.4566633", "0.45660317", "0.4562264", "0.45599207", "0.45540074", "0.45524225", "0.45503393", "0.4539336", "0.4538795", "0.45237103", "0.45228925", "0.45009425", "0.4489588", "0.44889358", "0.4482993", "0.44828635", "0.44806886", "0.44789302", "0.44783303", "0.44760504", "0.447245", "0.44656545", "0.44606915", "0.44584408", "0.4458317", "0.44569907" ]
0.5791769
0
Return true if the value is in the tree, return false otherwise.
def search(find_val) false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def contains? (value)\n return false if @size == 0\n if @root.value == value\n \t\treturn true\n \tend\n \[email protected]_node\n while(node!=nil)\n if node.value == value\n \treturn true\n end\n node=node.next_node\n end\n return false\n end", "def include?(value)\n return false if root.nil?\n !!root.search_for(value)\n end", "def contains(value)\n current = self\n while !current.nil?\n if current.value > value\n current = current.left\n elsif current.value < value\n current = current.right\n else\n return true\n end\n end\n return false\n end", "def include?(value)\n return false if empty?\n splay(value)\n @root.value == value\n end", "def contains?(given_value)\n self.traverse_list do |node|\n if node.value == given_value\n return true\n else\n return false\n end\n end\n end", "def contains?(value)\n current_node = @head\n until current_node.nil?\n return true if current_node.value == value\n\n current_node = current_node.next_node\n end\n false\n end", "def contains?(value)\n node = @head\n until node.nil?\n return true if node.value == value \n node = node.link\n end\n false\n end", "def is_in(target_value, bst = empty_tree)\n if isEmpty?(bst)\n return false\n elsif bst.root.value == target_value\n return true\n elsif target_value < bst.root.value\n is_in(target_value, bst.left)\n else\n is_in(target_value, bst.right)\n end\nend", "def contains?(value)\n node = list\n while node != nil\n return true if node.value == value\n node = node.nextNode\n end\n return false\n end", "def contains?(value)\n current_node = @head\n while current_node.next != nil do\n current_node = current_node.next\n return true if current_node.data == value\n end\n return false\n end", "def contains?(value, node = @head)\n return false if node.nil?\n return true if node.value == value\n\n contains?(value, node.next_node)\n end", "def contains?(val)\n node = @head\n while !(node.nil?)\n return true if node.value == val\n node = node.next_node\n end\n return false\n end", "def value_exists?(value)\n\t\tcurrent_node = @head\n\t\tuntil current_node.value == value \n\t\t\treturn false if current_node.next_node == nil \n\t\t\tcurrent_node = current_node.next_node\n\t\tend \n\t\ttrue \n\tend", "def value?(value)\n [email protected] { |c| c == value }.nil?\n end", "def search(value)\n return false if is_empty\n\n current = @root\n\n while current != nil\n if current.value == value\n return true\n else\n current = current.value < value ? current.right : current.left\n end\n end\n\n return false\n end", "def contains?(value)\n found = false\n current_node = @head\n while !node.nil? do\n if node.data == value\n found = true\n break\n end\n current_node = node.next\n end\n found\n end", "def contains? (value)\n return false if @head.nil?\n\n self.each {|current| return true if current.data == value}\n \n return false \n end", "def contains?(val)\n current = @head\n while current.next?\n current = current.next_node\n return true if current.value == val\n end\n false\n end", "def contains?(val)\n return nil if @head == nil\n\n result = false\n\n node = @head\n until node.next_node.nil?\n if node.value == val\n result = true\n break\n end\n node = node.next_node\n end\n\n result\n end", "def contains?(value) \n node = @head\n while(node.value != value)\n node = node.next_node\n if(node == @tail) && (node.value != value)\n return false\n end\n end\n return true\n end", "def contains?(value)\n temp = @head\n while temp\n return true if temp.value == value\n temp = temp.next_node\n end\n false\n end", "def contains?(value)\n if @head.nil?\n 'List is empty'\n else\n current_node = @head\n until current_node.nil?\n return true if current_node.value == value\n\n current_node = current_node.next_node\n end\n false\n end\n end", "def contains?(val,node=head)\n return nil if node.next == nil\n return true if node.data == val\n return contains?(val,node.next)\n end", "def contains?(value)\n retval = false\n if @size == 0\n return false\n else\n search_index = @head\n loop {\n if search_index == nil\n break;\n end\n if search_index.value == value\n return true\n end\n search_index = search_index.next_node\n }\n end\n retval\n end", "def contain?(value)\n\t\tcurrent = @head\n\t\twhile current \n\t\t\treturn true if current.value == value\n\t\t\tcurrent = current.next\n\t\tend\n\t\tfalse \n\tend", "def contains?(value)\n if head == nil\n false\n else\n tmp = head\n while tmp != nil && tmp.value != value\n tmp = tmp.next_node\n end\n\n if tmp == nil\n false\n else\n true\n end\n end\n end", "def contains?(e, node = @head)\n return false if node.value == nil\n case e <=> node.value\n when -1 then return contains?(e, node.lchild)\n when 0 then return true\n when 1 then return contains?(e, node.rchild)\n end\n end", "def contains?(element)\n self.each do |node| \n return true if node.value == element\n end\n return false\n end", "def contains?(value)\n return false if head.nil?\n\n curr = head\n until curr.nil?\n return true if curr.value == value\n\n curr = curr.next\n end\n false\n end", "def contains?(value)\n return false if @head.nil?\n node = @head\n limit = size - 1\n limit.times do\n break if node.data == value\n node = node.next_node\n end\n if value == node.data \n true\n else\n false\n end\nend", "def value? value\n include? value\n end", "def contains?(val)\n \[email protected] do |element|\n \t\treturn true if element.value == val\n \t\treturn false if element.value != val\n \t\tuntil node.next_node == nil\n \t\tend\n \tend \n end", "def contains?(element)\n search_tree(root, element)\n end", "def contains? (number)\n current = @head\n\n until current.next_node.nil?\n if current.value == number\n return true\n else\n current = current.next_node\n end\n end\n return false\n end", "def contains? value\n return false if value.nil?\n\n @map.has_key?(value)\n end", "def include?(search_val)\n\t\t\tcase value <=> search_val\n\t\t\twhen 1\n\t\t\t\tleft.include?(search_val)\n\t\t\twhen -1\n\t\t\t\tright.include?(search_val)\n\t\t\twhen 0\n\t\t\t\ttrue\n\t\t\tend\n\t\tend", "def contains(val, path=nil)\n fn = function(:contains, self, Sequel.object_to_json(val), path)\n Sequel::SQL::BooleanExpression.new(:NOOP, fn)\n end", "def in?(key)\n return true if get(key)\n false\n end", "def contains(value)\n end", "def member_of?(key, value)\n val = get(key)\n val and val.include?(value)\n end", "def value?(value)\n\t\treturn self.value == value\n\tend", "def value?(value)\n\t\treturn self.value == value\n\tend", "def value?(value)\n values.include? value\n end", "def contains?(data)\n if @head == nil \n puts \"error: empty list\" \n end\n in_list = false\n current_node = @head\n while current_node != nil\n if current_node.value == data\n in_list = true\n end\n current_node = current_node.next_node\n end\n in_list\n end", "def contains_node?(node)\n self.any? { |arr| arr.include?(node.id)}\n end", "def value?(value) true end", "def has?(key)\n node = _get(@root, key)\n !node.nil? && !node.undefined?\n end", "def include?(value)\n !get(value).nil?\n end", "def in?(node)\n @stack.detect { |item| item.name == node.name }\n end", "def has_value?(value); end", "def include?(value)\n each do |index, list_value|\n return true if list_value == value\n end\n return false\n end", "def has_value? val\n self.keys.each do |k|\n return true if self[k].include? val\n end\n return false\n end", "def valid_tree?\n true\n end", "def include?(val)\n self.each {|item|\n if item.equal?(val)\n return true\n end\n }\n return false\n end", "def has_value?\n true\n end", "def has_value?(value)\n self.each do |k, v|\n return true if v == value\n end\n return false\n end", "def search(value)\n current = @head\n while current != nil\n if current.data == value\n return true\n end\n current = current.next\n end\n\n return false\n end", "def has_value? value; value? value; end", "def valid_tree?\n true\n end", "def valid_tree?\n true\n end", "def search(value)\r\n return false if !@head\r\n\r\n curr = @head \r\n while curr\r\n if curr.data == value \r\n return true \r\n else\r\n curr = curr.next\r\n end\r\n end\r\n\r\n return false\r\n end", "def is?(val)\n return true if @val == val\n end", "def has_value?(value)\n field(with: value)\n end", "def include?(value)\n @values.include? value\n end", "def contains?(data)\n\t\t@current_node = @head\n\t\t\n\t\twhile @current_node.next_node != nil\n\t\t\tif @current_node.data == data \n\t\t\t\treturn true\n\t\t\telse @current_node = @current_node.next_node\n\t\t\tend\n\t\tend\n\n\t\tif @current_node.data == data #Checks the current tail node\n\t\t\treturn true\n\t\telse \n\t\t\treturn false\n\t\tend\n\tend", "def include?(value)\n element.include? value\n end", "def has_key?(key)\n dummy = Pair.new(key,nil)\n return @tree.get(dummy)\n end", "def valid_tree?\n false\n end", "def include?(score) \n if @root_node.nil?\n false\n else\n @root_node.include?(score)\n end\nend", "def contains_x?(x)\n\t\t(self.left..self.right).include?(x);\n\tend", "def include?(key)\n current = @head\n while current.next_node != nil\n return true if current.value == key\n current = current.next_node\n end\n\n return true if current.value == key\n\n false\n end", "def contains(node)\n return !(@nodes[node] == nil)\n end", "def add?(value)\n node = TreeNode.new(value)\n added = if root.nil?\n @root = node\n else\n @root.add(node)\n end\n if added\n @length += 1\n self\n else\n nil\n end\n end", "def include?(key)\n value.include?(key)\n end", "def insert(value, current_node = @root)\n value = value.value if value.is_a? Node\n case value <=> current_node.value\n when 0 # Value already exists in the tree\n false\n when -1 # Left subtree\n if current_node.left.nil?\n current_node.left = Node.new(value)\n true\n else\n insert(value, current_node.left)\n end\n else # Right subtree\n if current_node.right.nil?\n current_node.right = Node.new(value)\n true\n else\n insert(value, current_node.right)\n end\n end\n end", "def exists?\n if @exists.nil?\n @exists = parent.children.any? { |child| child.name == name }\n end\n @exists\n end", "def value?(key)\n !!value(key) || @object.value?(key)\n end", "def find_node(value)\n return false if @head.nil?\n curr_node = @head\n match = false\n while curr_node\n break if match = (curr_node.value == value)\n curr_node = curr_node.next\n end\n\n match\n end", "def contains list, item\n cur = list.head\n\n while cur != nil\n return true if cur.node == item\n cur = cur.nxt\n end\n\n return false\nend", "def contains? context\n until context.nil?\n return true if context == self\n context = context.parent\n end\n false\n end", "def check_subtree(small, large)\n start_node = bsearch(large.root, small.root.value)\n return false if start_node.nil?\n traverse_in_order(small.root) == traverse_in_order(start_node)\nend", "def is_subtree(root)\n\nend", "def parent_contains?(parent_node, sigle)\n parent_node.data.get_content_array.each do |s, a, o|\n if s == sigle then return true end\n end\n return false\n end", "def leaf?\n true\n end", "def question_1(root, target)\n return false if root.nil?\n stack = [root]\n until stack.empty?\n current = stack.pop\n return true if current.value == target.value\n stack << current.right if !current.right.nil?\n stack << current.left if !current.left.nil?\n end\n false\nend", "def leaf?\n children.empty?\n end", "def binary_search_tree?(root, lower_bound = -Float::INFINITY, upper_bound = Float::INFINITY)\n if !root\n true\n elsif root.value >= upper_bound || root.value <= lower_bound\n false\n else\n binary_search_tree?(root.left, lower_bound, root.value) && binary_search_tree?(root.right, root.value, upper_bound)\n end\nend", "def is_top_level_value\n return [\n '/plist/dict/integer',\n '/plist/dict/string',\n '/plist/dict/true',\n '/plist/dict/false',\n '/plist/dict/date'\n ].any? { |bc|\n @breadcrumb === bc\n }\n end", "def include?(obj)\n self.each{|*val|\n return true if val.__svalue == obj\n }\n false\n end", "def has_value?(value)\n each do | k, v |\n return true if v == value\n end\n return false\n end", "def include?(value)\n !!connection.zrank(key_label, value)\n end", "def search(value)\r\n current = @head\r\n \r\n until current.nil? \r\n return true if current.data == value\r\n current = current.next\r\n end\r\n \r\n return false\r\n \r\n end", "def value?(value); end", "def value?(value); end", "def leaf?\n !node?\n end", "def has_value?(p0) end", "def leaf?(r)\n r.children.empty?\n end", "def include?(score)\n if self.root.nil?\n return false\n else\n recursive_include?(self.root, score)\n end\n end", "def leaf_node?(tree_node)\n tree_node.left.nil? && tree_node.right.nil?\nend", "def exists? value\n !self[index_of(value)].nil?\n end", "def exists? value\n !self[index_of(value)].nil?\n end" ]
[ "0.77055067", "0.7561729", "0.7557759", "0.7523773", "0.75091463", "0.74652106", "0.7330142", "0.7296886", "0.7292048", "0.72914565", "0.72521544", "0.72453165", "0.72388685", "0.7218022", "0.7180739", "0.7054619", "0.7052635", "0.7047752", "0.7031639", "0.70187503", "0.6966709", "0.68368554", "0.68108046", "0.67942846", "0.67687094", "0.6768666", "0.67047197", "0.6669431", "0.6662911", "0.6626847", "0.6603228", "0.6594635", "0.6461022", "0.6459135", "0.6448624", "0.64331794", "0.6347073", "0.63228375", "0.62645453", "0.6200839", "0.6163829", "0.6163829", "0.61582315", "0.61513335", "0.6148914", "0.61441845", "0.61422575", "0.613189", "0.6131146", "0.61133534", "0.6110703", "0.6110221", "0.6104796", "0.6098014", "0.6082168", "0.6074028", "0.6047013", "0.60284555", "0.6026261", "0.6026261", "0.6004585", "0.600011", "0.5995674", "0.5992979", "0.5978124", "0.5976775", "0.597108", "0.5964235", "0.59613836", "0.5919874", "0.589706", "0.58903474", "0.5879104", "0.5874883", "0.5859157", "0.5855979", "0.584535", "0.5843528", "0.5831126", "0.5822911", "0.58215994", "0.5818388", "0.58074576", "0.58067644", "0.58064574", "0.5802896", "0.5786051", "0.5785617", "0.5784809", "0.57628286", "0.57617027", "0.57613474", "0.57608366", "0.57608366", "0.57525647", "0.57504404", "0.5744184", "0.5743516", "0.57412577", "0.57404155", "0.57404155" ]
0.0
-1
Print out all tree nodes as they are visited in a preorder traversal.
def print_tree '' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preorder_print(start, traversal)\n traversal\n end", "def preorder_traversal(node=@root)\n return if (node == nil)\n preorder_traversal(node.left)\n preorder_traversal(node.right)\n puts node.value.to_s\n end", "def preorder(node)\n # 1->2->4->5->3->6\n if node\n print node.value.to_s + '->'\n preorder(node.left_child)\n preorder(node.right_child)\n end\n end", "def preorder(node)\n return if !node\n print node.value, \" \"\n preorder(node.left_child)\n preorder(node.right_child)\n end", "def print_preorder\n return \"Empty BST\" if is_empty\n\n stack = [@root]\n\n until stack.empty?\n current = stack.pop\n\n puts current.value\n\n stack << current.right unless current.right.nil?\n stack << current.left unless current.left.nil?\n end\n end", "def preorder(current_node = root)\n return if current_node.nil?\n print \"#{current_node.value} \"\n inorder(current_node.left)\n inorder(current_node.right)\n end", "def preorder_traverse(root=@root)\n unless !root\n result = \"#{root.data}\"\n result << preorder_traverse(root.left) unless !root.left\n result << preorder_traverse(root.right) unless !root.right\n result\n end\n end", "def pre_order_print(start, traversal = \"\")\n return traversal unless start\n\n traversal += \"#{start.value}-\"\n traversal = pre_order_print(start.left, traversal)\n pre_order_print(start.right, traversal)\n end", "def preorder\n preorder_traversal(@root, [])\n end", "def preorder(node)\n p node.value if node.value \n preorder(node.left) if node.left\n preorder(node.right) if node.right\nend", "def printout\n\t\t\n\t\tindex = 0\n\t\t\n\t\tdef small_loop (node, index)\n\t\t\t\n\t\t\tfor i in 0...index\n\t\t\t\tprint \" \"\n\t\t\tend\n\t\t\t\n\t\t\tputs node.name\n\t\t\tindex += 1\n\t\t\t\n\t\t\tif node.children.length > 0\n\t\t\t\tindex += 1\n\t\t\t\tnode.children.cycle(1) { |child| small_loop(child, index) }\n\t\t\tend\n\t\tend\n\t\t\n\t\tsmall_loop(@root, index)\n\tend", "def walkthrough\n curNode = @head\n while curNode != nil\n curNode.data.print()\n curNode = curNode.next\n end\n end", "def print_graph\n @items.each do |item|\n puts \"#{item.inspect} depends on:\"\n\n predecessors = direct_predecessors_of(item)\n predecessors.each do |pred|\n puts \" #{pred.inspect}\"\n end\n puts \" (nothing!)\" if predecessors.empty?\n puts\n end\n end", "def preorder(node)\n visit node \n left = preorder node.left_node if node.left_node \n right = preorder node.right_node if node.right_node\n p left ? left.value : nil \n p right ? right.value : nil\n p node.value\n puts '----'\n node\n end", "def print_tree\n if root.children\n puts \" - root : #{root.children.length} - \"\n root.children.each(&:print_node)\n puts ''\n end\n end", "def preorder_traversal(root)\n visited = []\n traverse(root, visited)\n visited\nend", "def printTree()\n def pTree(node, i)\n puts node.toString i\n node.children.each do|child|\n pTree(child, i+1)\n end\n end\n pTree(@root, 0)\n end", "def print()\n current_node = @root_node\n while current_node != nil\n current_node.print()\n current_node = current_node.get_next()\n end\n end", "def level_order_print(tree)\n unless tree\n return\n end\n\n nodes = [tree]\n current_line_count = 1\n next_line_count = 0\n\n while nodes.length != 0\n current_node = nodes.shift\n current_line_count -= 1\n print current_node.key.to_s + ' '\n if current_node.left_child\n nodes.push(current_node.left_child)\n next_line_count += 1\n end\n if current_node.right_child\n nodes.push(current_node.right_child)\n next_line_count += 1\n end\n if current_line_count == 0\n # finished printing current level\n puts ''\n current_line_count = next_line_count\n next_line_count = current_line_count\n end\n end\nend", "def printnodes(node, level)\r\n\theader(level)\r\n\tputs node\r\n\tif node.nodes?\r\n\t\ttemp = Array.new\r\n\t\tnode.nodes.each { |n|\r\n\t\t\tif n == nil\r\n\t\t\t\theader(level + 1)\r\n\t\t\t\tputs \":\"\r\n\t\t\telsif n == node.parent\r\n\t\t\t\theader(level + 1)\r\n\t\t\t\tputs node\r\n\t\t\telsif !temp.include?(n)\r\n\t\t\t\ttemp << n\r\n\t\t\telse\r\n\t\t\t\theader(level + 1)\r\n\t\t\t\tputs node\r\n\t\t\tend\r\n\t\t}\r\n\t\tif !temp.empty?\r\n\t\t\ttemp.each { |n|\r\n\t\t\t\tprintnodes(n, level + 1)\r\n\t\t\t}\r\n\t\tend\r\n\tend\r\nend", "def printPreOrder\n puts \"data: #{data}, left: #{left ? left.data : \"nil\"}, right: #{right ? right.data : \"nil\"}\"\n\n if !left.nil?\n left.printInOrder\n end\n\n if !right.nil?\n right.printInOrder\n end\n end", "def preOrderTraversal(root)\n return nil if root == nil\n\n stack = [root]\n while !stack.empty?\n node = stack.pop\n print \" #{node.value}\"\n if node.right != nil\n stack.push(node.right)\n end\n if node.left != nil\n stack.push(node.left)\n end\n end\nend", "def pre_order_traversal(tree=root, ordering=[])\n end", "def test_print_tree\n setup_test_tree\n #puts\n #@root.print_tree\n end", "def preorder\n nodelets_array = []\n\n preorder_helper(@root, nodelets_array)\n\n return nodelets_array\n end", "def print\n print_node(@head)\n end", "def DFT_pre_order_recursive(root)\n if root == nil\n return\n end\n print \"#{root.value}\\n\"\n DFT_pre_order_recursive(root.left)\n DFT_pre_order_recursive(root.right)\n end", "def preorder_traverse node, &block\n block.call(node)\n if node.children.count > 0 then\n node.children.each do |child|\n preorder_traverse(child, &block)\n end\n end\n end", "def preorder_traversal_rec(root)\n res = []\n preorder_dfs(root, res)\n res\nend", "def DFT_pre_order_iterative(root)\n print '[\"I\", \"O\", \"L\", \"A\", \"G\", \"R\", \"H\", \"T\", \"M\"]' + \"\\n\"\n st = Stack.new\n if root == nil\n return\n end\n st.push(root)\n while !st.empty?\n root = st.pop\n print \"#{root.value}\\n\"\n if root.right\n st.push(root.right)\n end\n if root.left\n st.push(root.left)\n end\n end\n end", "def print_level_order\n return \"Empty BST\" if is_empty\n\n queue = [@root]\n\n until queue.empty?\n current = queue.pop\n puts current.value\n\n queue << current.left unless current.left.nil?\n queue << current.right unless current.right.nil?\n end\n end", "def pre_order_traversal\n nodes = []\n nodes.push(@root_value)\n nodes += @left.pre_order_traversal if @left\n nodes += @right.pre_order_traversal if @right\n nodes\n end", "def printTree(options = {})\n # Set defaults\n options[:name] ||= true\n options[:content] ||= false\n \n result = \"\"\n \n options[:output] = result \n # Traverse tree and modify result by tacking on child names.\n printTraversal(options)\n \n puts result\n end", "def print_tree\n current = nil\n stack = Stack.new\n stack.push(@root)\n until stack.empty?\n current = stack.pop\n if current.parent.nil?\n puts current.tag\n else\n puts \"#{current.tag}\\t<=\\t#{current.parent.tag}\"\n end\n unless current.childs.size.zero?\n current.childs.reverse_each { |child| stack.push(child) }\n end\n end\n end", "def print\n current_node = @head\n while current_node != nil\n puts \"#{current_node.data}\\n\"\n current_node = current_node.next\n end\n end", "def print_in_order(node)\n if !node.nil?\n print_in_order(node.left)\n print node.val\n print_in_order(node.right)\n end\nend", "def level_order_print(start, traversal = \"\")\n return traversal unless start\n\n queue = Queue.new\n queue << start\n\n while queue.size > 0 do\n node = queue.pop\n traversal += \"#{node.value}-\"\n queue << node.left if node.left\n queue << node.right if node.right\n end\n\n traversal\n end", "def print_tree(tree)\n\t\t\tif tree.is_leaf? and tree.depth > 0\n\t\t\t\tprint_line((\"|\\t\"*(tree.depth-1))+\"+------\"+tree.name)\n\t\t\telse\n\t\t\t\tprint_line((\"|\\t\"*tree.depth)+tree.name)\n\t\t\tend\n\t\t\ttree.children.each_pair do |name,child|\n\t\t\t\t\tprint_tree(child)\n\t\t\tend\n\t\tend", "def print\n node = root\n \n print_node(node, \"> \")\n end", "def inOrderTraversal( rootNode )\n return if rootNode == nil\n inOrderTraversal( rootNode.leftChild )\n puts rootNode.data\n inOrderTraversal( rootNode.rightChild )\n end", "def pre_order_traversal(current_node = @root)\n @accumulator = []\n pre_order_traversal_aux(current_node)\n @accumulator\n end", "def print_level_order(root)\n return if !root\n queue = Queue.new()\n queue.enqueue(root)\n total_nodes_in_current_level = 1\n total_nodes_in_next_level = 0\n\n while (!queue.is_empty?) # as long as the queue is not empty\n current_node = queue.dequeue\n\n # we print current_node's value and decrement total_nodes_in_current_level by 1. We then add its children (if any) to the queue and increment total_nodes_in_next_level by 2.\n print current_node.value, \" \"\n total_nodes_in_current_level -= 1\n\n queue.enqueue(current_node.left_child) if current_node.left_child\n queue.enqueue(current_node.right_child) if current_node.right_child\n total_nodes_in_next_level += 2\n\n if total_nodes_in_current_level == 0 # this means we finished printing the node values in the current node\n print \"\\n\"\n # swap total_nodes_in_current_level and total_nodes_in_next_level\n total_nodes_in_current_level = total_nodes_in_next_level\n total_nodes_in_next_level = total_nodes_in_current_level\n end\n end\n print \"\\n\"\nend", "def print_BST_in_order(root)\n if root.nil?\n return\n end\n print_BST_in_order(root.left)\n print \"#{root.value} \"\n print_BST_in_order(root.right)\nend", "def printlewis(node)\r\n\tputs node.to_s + \" =\"\r\n\tif node.nodes?\r\n\t\ttemp = Array.new\r\n\t\tnode.nodes.each { |n|\r\n\t\t\tif n == nil\r\n\t\t\t\tputs \":\"\r\n\t\t\telsif n == node.parent\r\n\t\t\t\tputs n\r\n\t\t\telsif !temp.include?(n)\r\n\t\t\t\ttemp << n\r\n\t\t\t\tputs n\r\n\t\t\telse\r\n\t\t\t\tputs n\r\n\t\t\tend\r\n\t\t}\r\n\t\tif !temp.empty?\r\n\t\t\ttemp.each { |n|\r\n\t\t\t\tputs \"========\"\r\n\t\t\t\tprintlewis(n)\r\n\t\t\t}\r\n\t\tend\r\n\tend\r\nend", "def print_in_order\n return \"Empty BST\" if is_empty\n\n current = @root\n stack = []\n\n while current || !stack.empty?\n if current != nil\n stack.push(current)\n current = current.left\n elsif !stack.empty?\n current = stack.pop()\n puts current.value\n\n current = current.right\n end\n end\n end", "def show_node(tree, node)\n print \"ID:#{node.id} Parent:#{node.parent} Keys:\"\n node.keys.each { |key| print \"[#{key}]\"}\n print \" Sub trees:\"\n node.sub_trees.each { |sub_tree| print \"-#{sub_tree}-\"}\n print \"\\n\"\n node.sub_trees.compact.each { |sub_tree| show_node(tree, tree.nodes[sub_tree])}\nend", "def print_list\n\t\tcounter = 0\n\t\tcurrent_node = @head\n\t\tloop do\n\t\t\tputs \"Node at index #{counter}: #{current_node.data}\"\n\t\t\tbreak if current_node.next.nil?\n\t\t\tcurrent_node = current_node.next\n\t\t\tcounter += 1\n\t\tend\n\tend", "def print\n node = self.head\n until node == nil \n puts(node.data)\n node = node.next\n end\n end", "def preorder\n return [] if @root == nil\n\n current = @root \n tree = []\n \n return preorder_helper(current, tree)\n end", "def print(node = root)\n puts %( ) * node.level + \"#{node}\"\n node.children.each do |child|\n print(child)\n end\n true\n end", "def print_paths\n path, counter = [], 0\n puts '************************ Tree Paths ***********************************'\n puts\n print_tree_paths(self.root, path, counter)\n puts\n puts '***********************************************************************'\n end", "def print\n node = @head\n until node.eql?(nil) do\n puts node.data\n node = node.next\n end\n end", "def inorder_traversal(node=@root)\n return if (node==nil)\n inorder_traversal(node.left)\n puts node.value.to_s\n inorder_traversal(node.right)\n end", "def preorder\n arr = []\n if @root.nil?\n return arr\n end \n current_node = @root\n return preorder_helper(current_node, arr)\n end", "def print\n current_node = @head\n\n until current_node.nil?\n puts \"#{current_node.value} \"\n\n current_node = current_node.next\n end\n end", "def print\n output = \"\"\n current_node = self.head\n\n until current_node.nil?\n output += current_node.data + \"\\n\"\n current_node = current_node.next\n end\n\n puts output\n end", "def inOrderTraversal(node = @root)\n return if (node == nil)\n inOrderTraversal(node.left)\n puts node.value.to_s\n inOrderTraversal(node.right)\n\n\n end", "def print_list(node)\n puts \"\\nTraversal in forward direction\"\n while node != nil\n puts node.data\n last = node\n node = node.next_node\n end\n\n puts \"\\nTraversal in reverse direction\"\n while last != nil\n puts last.data\n last = last.prev_node\n end\n end", "def print\n current_node = head\n list = []\n while current_node\n list.push(current_node.value)\n current_node = current_node.next\n end\n puts list.join(\"->\")\n end", "def preorder_traverse(current_node = @root)\n preorder_array = []\n\n # Base case: reached child of a leaf node (nil)\n return [] if current_node.nil?\n\n preorder_array << current_node\n preorder_array += preorder_traverse(current_node.left)\n preorder_array += preorder_traverse(current_node.right)\n\n preorder_array\n end", "def print_nodes(path, counter)\n (0..(counter - 1)).each { |i| print path[i].value.to_s + ' ' }\n puts\n end", "def preOrder(root) # O(n)\n\n return nil if root == nil\n\n print \" #{root.value}\"\n preOrder(root.left)\n preOrder(root.right)\n\nend", "def preorder\n preorder_helper(@root, [])\n end", "def preorder_traversal root\n result = []\n\n result << root.val\n result << preorder_traversal(root.left) unless root.left.nil?\n result << preorder_traversal(root.right) unless root.right.nil?\n\n result\nend", "def preorder\n tree_array = []\n if root.nil?\n return tree_array\n else\n root.preorder(tree_array)\n return tree_array\n end\n end", "def level_order_traversal(node)\n h = height(node)\n (1..h).each do |n|\n print_given_level(node, n)\n end\nend", "def print_tree(n, i = 0)\n i.times { print \" \" }\n puts \"+-#{n}\"\n $classtree[n].sort.each { |c| print_tree(c, i+2) }\nend", "def inorder(node)\n return if !node\n inorder(node.left_child)\n print node.value, \" \"\n inorder(node.right_child)\n end", "def inorder_display\n puts \"ROOT: #{@root.value}\\n\"\n inorder_display_helper @root\n end", "def inOrderTraversal(node = @root)\n return if (node == nil)\n inOrderTraversal(node.left)\n puts node.value.to_s\n inOrderTraversal(node.right)\n end", "def breadth_traversal(top_node)\n # start with the first nodes\n nodes = [top_node]\n nodes_to_iterate = [top_node]\n\n # while we have more nodes to print\n while (!nodes_to_iterate.empty?)\n next_nodes = [] # start with an empty list\n # for each node we iterate over in this, find their children\n nodes_to_iterate.each do |n|\n # add the next nodes we iterate\n next_nodes.concat(n.children)\n end\n\n #\n nodes.concat(next_nodes)\n nodes_to_iterate = next_nodes\n end\n\n # print them out in order\n # nb: (this could be a nested structure so you could print out\n # each row on a separate line, which might be cool)\n nodes.each {|n| yield n.value }\nend", "def see_tree(tree)\n tree.each do |i|\n puts \"---------------\"\n puts \"Node: #{i.value}\"\n puts \"Parent: \" + i.find_parent[0].value.to_s if i.find_parent.count > 0\n puts \"Left Child: \" + i.find_left_child[0].value.to_s if i.find_left_child.count > 0\n puts \"Right Child: \" + i.find_right_child[0].value.to_s if i.find_right_child.count > 0\n end\nend", "def print_tree(indent = 0, lines = [])\n lines << (\" \" * indent) + self.to_s\n @nodes.keys.sort.each do |reference|\n node = @nodes[reference]\n if node.is_a? APISpec::Namespace\n node.print_tree(indent + 1, lines)\n else\n lines << (\" \" * (indent + 1)) + \"#{reference} => #{node.to_s}\"\n end\n end\n lines.join(\"\\n\")\n end", "def preorder\n return preorder_recursion(current = @root, tree = [])\n end", "def preorder\n array = []\n return [] if @root.nil?\n current = @root\n\n return preorder_recursive(current, array)\n end", "def inorder_traverse(root=@root)\n unless !root\n result = root.left ? \"#{inorder_traverse(root.left)}\" : \"\"\n result << root.data\n result << inorder_traverse(root.right) unless !root.right\n result\n end\n end", "def preorder_traversal(root)\n response = []\n traversal(root, response)\n return response\nend", "def printTree(root = @root, indentation = \"\\n\")\r\n #print root the first time running mehtod, the rest will be printed as children\r\n puts \"#{indentation}#{root.value}\" if root == @root\r\n root.children.each do | child |\r\n puts \"#{indentation}\\t#{child.value}\\n\"\r\n #if there are children, again\r\n printTree(child, indentation + \"\\t\") if child.children.any?\r\n end\r\n end", "def print\n arr = []\n node = @head\n while node\n arr << node.data\n node = node.next\n end\n puts arr\n end", "def nodes_preorder(node = self.root, &block)\n yield( node ) if block_given?\n nodes_preorder(node.left_child, &block) if node.has_left_child?\n nodes_preorder(node.right_child, &block) if node.has_right_child?\n end", "def preorder\n return [] if @root.nil?\n result = []\n return preorder_helper(@root, result)\n end", "def in_order_traversal(node)\n\n while node\n\n #Left as far as possible\n while(node.left)\n node = node.left\n end\n\n print \"#{node.value} \"\n\n prev = node\n node = node.parent\n\n while node\n if node.left == prev\n print \"#{node.value} \"\n\n if node.right\n node = node.right\n break\n end\n end\n\n prev = node\n node = node.parent\n end\n\n end\nend", "def postorder_traversal(node=@root)\n return if (node == nil)\n puts node.value.to_s\n postorder_traversal(node.left)\n postorder_traversal(node.right)\n end", "def print_prefix(node)\n return if node == nil\n print node.value + \" \" #print contents of this node\n print_prefix(node.left) #starts recursion -- go left\n print_prefix(node.right) #go right\nend", "def print_tree(tree)\n return \"-\" if tree.nil?\n puts \"#{tree.value}: \"\n print \"Left: \"\n puts \"#{print_tree(tree.children[0])}\"\n print \"Right: \"\n puts \"#{print_tree(tree.children[1])}\"\nend", "def print(root)\n root_index = @tree.index(root)\n temp_tree = @tree[root_index..-1]\n temp_tree.each do |n|\n if n\n puts n.title + \": \" + n.rating.to_s\n end\n end\n end", "def traverse()\n current = @head\n until current.nil?\n puts current.data\n current = current.nextNode\n end\n end", "def print_tree(out = $stdout)\n out.puts \"## Class: #{name}\"\n out.puts \" Visible Name: #{visible_name}\"\n out.puts \" Description : #{description}\"\n tables.each do |table|\n table.print_tree(out)\n end\n end", "def print_graph\n puts\n adj_lists.each do |vertex|\n print \"#{vertex.name}\"\n neighbor = vertex.adj_list\n while !neighbor.nil?\n print \" --> #{neighbor.name} (#{neighbor.weight})\"\n neighbor = neighbor.next\n end\n puts\n end\n end", "def visit\n current = @head\n while current != nil\n print \"#{current.data} \"\n current = current.next\n end\n puts\n end", "def preorder\n yield self\n each do |child|\n unless pre_terminal?\n child.preorder {|c| yield c}\n else\n each {|c| yield c}\n end\n end\n end", "def pre_order_traverse(tree, array)\n if !tree.nil?\n array.append(tree.value)\n pre_order_traverse(tree.left, array)\n pre_order_traverse(tree.right, array)\n end\n \n return array\n\nend", "def post_order_print(start, traversal = \"\")\n return traversal unless start\n\n traversal = post_order_print(start.left, traversal)\n traversal = post_order_print(start.right, traversal)\n traversal += \"#{start.value}-\"\n end", "def preorder\n return preorder_helper(@root, [])\n end", "def preorder\n return preorder_helper(@root, [])\n end", "def preorder\n return preorder_helper(@root, [])\n end", "def preorder\n return preorder_helper(@root, [])\n end", "def preorder\n return preorder_helper(@root, [])\n end", "def preorder\n return preorder_helper(@root, [])\n end", "def preorder\n return preorder_helper(@root, [])\n end" ]
[ "0.7534696", "0.7330272", "0.72936255", "0.72645223", "0.7237396", "0.7166674", "0.7011984", "0.6990271", "0.69566", "0.6876235", "0.6861882", "0.6857561", "0.6857505", "0.6827987", "0.6784903", "0.67804146", "0.677473", "0.6700682", "0.6560901", "0.6560226", "0.655841", "0.6550859", "0.65490186", "0.6537007", "0.6532603", "0.65144867", "0.6507709", "0.6465876", "0.6434338", "0.6415315", "0.640891", "0.6394761", "0.63911235", "0.639002", "0.636506", "0.6364268", "0.6330878", "0.6330333", "0.6321323", "0.63041717", "0.62819815", "0.6275997", "0.62535435", "0.62505037", "0.62354946", "0.62282455", "0.6207083", "0.6205006", "0.61989397", "0.61905575", "0.61827725", "0.6173786", "0.6149976", "0.6128616", "0.61269027", "0.61241585", "0.6104952", "0.60993904", "0.60969603", "0.60944045", "0.60917044", "0.60864365", "0.6082152", "0.6079187", "0.6076771", "0.60600835", "0.6059926", "0.60410154", "0.60403836", "0.60299057", "0.60239166", "0.60197335", "0.60162556", "0.5987824", "0.5987356", "0.59838444", "0.59762686", "0.59662604", "0.59628683", "0.59537405", "0.59414774", "0.593929", "0.5938263", "0.5936442", "0.5936441", "0.59315664", "0.59309274", "0.59257996", "0.5915644", "0.591518", "0.59087205", "0.5902737", "0.58984035", "0.5898206", "0.5898206", "0.5898206", "0.5898206", "0.5898206", "0.5898206", "0.5898206" ]
0.6463592
28
Helper method use this to create a recursive search solution.
def preorder_search(start, find_val) false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recursive_solution\n\n end", "def recursive => nil", "def recursive_search(path,current_depth)\n # If we haven't hit our max depth\n if current_depth < @depth \n sub_hash = @wiki\n # Follow our path down the hash\n path.each do |node|\n sub_hash = sub_hash[node]\n end\n\n # Expand this node of the sub-tree\n sub_hash.keys.each do |link|\n sub_hash[link] = get_links(\"http://en.wikipedia.org#{link}\")\n # Here's our magic recursion, add this node to the\n # path, increment our depth, and traverse that\n recursive_search(path+[link],current_depth+1)\n end\n\n end\nend", "def binary_search(opts={})\n # I have a lot of stuff to do for scouts\n # but instead i'm doing this\n # hizzah!\n count = 0\n \n until opts[:find].empty?\n new_search = []\n count += 1\n \n zipped = opts[:find].zip opts[:repo].between(opts[:find])\n zipped.each do |(n, list)|\n list << n[1]\n p = n[0]\n f = 1 # ??? why are these vars so NAMELESS\n \n list.each do |item|\n UI::debug \"narrowing #{f}:#{list.size} #{short item}\"\n \n if opts[:node_map].include? item\n if f <= 2\n opts[:on_find].call(p, item)\n else\n UI::debug \"narrowed branch search to #{short p}:#{short item}\"\n new_search << [p, item]\n end\n break\n end\n \n p, f = item, f*2\n end\n end\n \n opts[:find] = new_search\n end\n \n [opts[:find], count]\n end", "def depth_first_search(array)\n array.append(self.name)\n self.children.each do |child|\n child.depth_first_search(array)\n end\n return array\n\n end", "def search_recursive(root,target_value)\n\n return root if root.payload == target_value\n\n root.children.each do |child|\n node = search_recursive(child,target_value)\n return node if node\n end\n\n return nil\n\nend", "def dfs(root, target)\n return root if root.value == target\n root.children.each do |child|\n search_result = dfs(child, target)\n return search_result unless search_result.nil?\n end\n\n nil\nend", "def dfs_recursive(query, node=@tree) \n return nil if node.nil?\n return node if query == node.value\n\n# left search equals if the left child is not nil then call the method with target & left child node parameters, otherwise is nil\n left_search = node.left_child != nil ? dfs_recursive(query, node.left_child) : nil\n\n# return if left search does not result in nil\n return left_search if left_search != nil\n right_search = node.right_child != nil ? dfs_recursive(query, node.right_child) : nil\n return right_search if right_search != nil \n end", "def searching\n raise RuntimeError, \"Caught recursion on #{@name}\" if searching?\n\n # If we've gotten this far, we're not already searching, so go ahead and do so.\n @searching = true\n begin\n yield\n ensure\n @searching = false\n end\n end", "def search; end", "def DFS(root, target)\n ## base case: \n return nil if root.nil?\n return root if root.value == target\n ##indecutive step: \n ## DFS on the left side then DFS on the right side \n root.children.each do |child|\n search_result = DFS(child, target) ## better to save the actual value then check the value then return nil\n return search_result unless search_result.nil?\n end \n return nil\nend", "def recursive_search(args)\n name = args.shift\n cmd = find { |c| c.name == name }\n return cmd, args unless cmd&.parent? && cmd.children.find { |c| c.name == args[0] }\n\n # the command exists &&\n # the command has sub command &&\n # argument matches sub command name\n # -> should search more\n cmd.children.recursive_search(args)\n end", "def depth_first_search(query)\n stack = [@tree]\n\n loop do\n# exit when empty stack\n return nil if stack.empty?\n\n# node is equal to top of stack\n node = stack.pop\n \n# return node if match\n return node if query == node.value\n\n# i think it is pushing every descendant of the parent?\n stack.push node.left_child if node.left_child != nil\n stack.push node.right_child if node.right_child != nil\n end\n end", "def tree_search(problem, fringe)\n # \"\"\"Search through the successors of a problem to find a goal.\n # The argument fringe should be an empty queue.\n # Don't worry about repeated paths to a state. [Fig. 3.8]\"\"\"\n # Since we dont worry about repeated paths this can lead to infinite loops\n fringe.append(Node.new(problem.initial))\n while fringe.len > 0\n node = fringe.pop()\n return node if problem.goal_test(node.state) if node\n fringe.extend(node.expand(problem)) if node\n end\n return nil\nend", "def dfs_rec(target,current,array_length,stack,visited)\n left = current.find_left_child[0]\n right = current.find_right_child[0]\n parent = current.find_parent[0]\n if current.value == target\n return current\n elsif visited.length == array_length\n return nil\n elsif !left.nil? && !visited.include?(left)\n stack.push(left)\n visited.push(left)\n dfs_rec(target,left,array_length,stack,visited)\n elsif !right.nil? && !visited.include?(right)\n stack.push(right)\n visited.push(right)\n dfs_rec(target,right,array_length,stack,visited)\n else\n stack.pop\n dfs_rec(target,parent,array_length,stack,visited)\n end\nend", "def search root, target\n queue = [root]\n\n until queue.empty?\n current = queue.shift\n return current if current.x == target.x && current.y == target.y\n\n current.make_children.each { |child| queue << child }\n end\nend", "def depth_first_search(find,tree)\n current = tree[0]\n answer = \"\"\n stack = [tree[0]]\n visited = [tree[0]]\n \n condition = false\n until condition == true\n connections = [current.find_right_child[0],current.find_left_child[0]].compact\n puts current.value\n puts connections.count\n puts \"---\"\n \n if current.value == find\n answer = current\n condition = true\n elsif visited.count == tree.count\n answer = nil\n condition = true\n else\n if connections.count < 1\n stack.pop\n current = stack[-1]\n elsif connections.count == 1\n if visited.include?(connections[0])\n stack.pop\n current = stack[-1]\n else\n current = connections[0]\n stack.push(current)\n visited.push(current)\n end\n else\n if visited.include?(connections[0]) && visited.include?(connections[1])\n stack.pop\n current = stack[-1]\n elsif !visited.include?(connections[0])\n current = connections[0]\n stack.push(current)\n visited.push(current)\n else\n current = connections[1]\n stack.push(current)\n visited.push(current)\n end\n end\n end\n end\n puts answer ? answer : \"Value not found!\"\n puts answer.value if answer != nil\nend", "def busqueda(g, d, h, nro_nodos, nodos_visitados, nro_nodos_en_caminos)\r\n #Luego, en esta variable dependiendo de si estamos en un objeto DFS o BFS, se definira el orden\r\n #en el que se seleccionaran los nodos para la busqueda. Ademas, esta variable tendra los elementos\r\n #adyacentes del nodo d ya sea en una pila o en una cola. \r\n pila_o_cola = self.orden_nodos(g,d)\r\n\r\n #pila_o_cola.estructura.each {|elem| puts elem}\r\n\r\n #Verificamos si la pila o cola, de adyacentes, incluye a \"h\"\r\n if pila_o_cola.estructura.include? h \r\n\r\n #De ser asi, se incluye el numero de nodos del recorrido que llevo a \"h\"\r\n nro_nodos_en_caminos << nro_nodos\r\n\r\n #Si la pila o cola no incluye a \"h\"\r\n else\r\n\r\n #Entonces mientras no este vacia, se recorre la estructura\r\n while not(pila_o_cola.vacio)\r\n\r\n #Luego se remueve un nodo de la estructura, que sera el siguiente que se usara\r\n #como \"inicio\" de la busqueda\r\n siguiente_nodo = pila_o_cola.remover\r\n\r\n #Si el nodo en cuestion no ha sido visitado\r\n if not(nodos_visitados.include? siguiente_nodo)\r\n #Lo agregamos al arreglo de visitados\r\n nodos_visitados << siguiente_nodo\r\n #Y hacemos una llamada recursiva al metodo busqueda pero esta vez partiendo\r\n #del nodo antes tomado. En esta llamada aumentamos el numero de nodos (nro_nodos)\r\n #en 1\r\n busqueda(g, siguiente_nodo, h , nro_nodos + 1 , nodos_visitados, nro_nodos_en_caminos)\r\n end\r\n end\r\n end\r\n\r\n #Luego de que acaba todo el procesamiento verificamos si en el arreglo \"nro_nodos_en_caminos\"\r\n #esta vacio, si es asi entonces significa que el nodo \"h\" no fue alcanzado entonces\r\n if nro_nodos_en_caminos.empty?\r\n #retornamos -1\r\n return -1\r\n end\r\n\r\n #Finalmente, si sobrevivimos todo lo anterior, llegados a este punto retornamos el numero de nodos que\r\n #fueron recorridos de \"d\" a \"h\". Recordamos que el arreglo \"nro_nodos_en_caminos\" contiene para todos los\r\n #caminos de \"d\" a \"h\", el numero de nodos recorridos.\r\n\r\n ## OJO: En este caso se retornara el nro de nodos recorridos del camino mas corto. ##\r\n\r\n #Sin embargo, si se quisiera el nro de nodos de solo el primer camino por el que se metio y encontro a \"h\"\r\n #bastaria con solo retornar \"nro_nodos_en_caminos[0]\".\r\n #Por otra parte, si se quisiera para cada camino el nro de nodos recorridos entonces basta con retornar\r\n #el arreglo completo, etc.\r\n \r\n return \"#{nro_nodos_en_caminos.min} nodos recorridos.\"\r\n end", "def traverse\n @result.clear\n @queue.clear\n\n @queue.enqueue(@node)\n @result.push @node\n\n\n while not @queue.empty?\n node = @queue.dequeue\n return @result unless node\n # puts \"Visiting node: #{node}\"\n return node if (@search and node==@search)\n node && node.children.each do |node|\n unless @result.include?(node)\n @result.push(node)\n @queue.enqueue(node)\n end\n end\n end\n return result\n end", "def search\n if Config[\"ISEARCH\"]\n incremental_search\n else\n str = getstr('/')\n do_search NEXT, str\n end\n end", "def tree(name, finder, partial = T.unsafe(nil), seen = T.unsafe(nil)); end", "def depth_first_search_recursive(source)\n visited.add(source)\n\n source.neighbors.each do |neighbor|\n unless visited.include?(neighbor)\n depth_first_search_recursive(neighbor)\n meta[neighbor] = source\n end\n end\n end", "def searching\n raise \"Caught recursion on #{@name}\" if searching?\n\n # If we've gotten this far, we're not already searching, so go ahead and do so.\n @searching = true\n begin\n yield\n ensure\n @searching = false\n end\n end", "def dfs_rec(target)\n dfs_recursive_helper(target,@root)\n end", "def find_helper(current_node, search)\n return nil if current_node.nil?\n \n if current_node.key == search\n return current_node\n elsif current_node.key > search\n find_helper(current_node.left, search)\n else\n find_helper(current_node.right, search)\n end\n end", "def solution(t)\n # write your code in Ruby 2.2\n depth = 0\n childs = []\n\n childs << t.l if t.l\n childs << t.r if t.r\n\n while not childs.empty? do\n depth += 1\n\n cc = []\n childs.each do |t|\n cc << t.l if t.l\n cc << t.r if t.r\n end\n\n childs = cc\n end\n\n depth\nend", "def search\n\n end", "def search(word)\r\n \r\n end", "def osops_search(\n search_string, # recipe or role name\n one_or_all=:one,# return first node found or a list of nodes?\n # if set to :all a list will be returned\n # even if only one node is found.\n include_me=true,# include self in results\n order=[:role, :recipe], # if only one item is to be returned and\n # there are results from both the role\n # search and the recipe search, pick the\n # first item from the list specified here.%\n # must be :recipe or :role\n safe_deref=nil, # if nil, return node(s), else return\n # rcb_safe_deref(node,safe_deref)\n current_node=nil,\n options = {}\n )\n\n # Next refactor, move options to first/only param\n # Passing options from other methods to override search params\n options = {\n :search_string => search_string,\n :one_or_all => one_or_all,\n :include_me => include_me,\n :order => order,\n :safe_deref => safe_deref,\n :current_node => current_node\n }.merge(options)\n\n search_string = options[:search_string]\n one_or_all = options[:one_or_all]\n include_me = options[:include_me]\n order = options[:order]\n safe_deref = options[:safe_deref]\n current_node = options[:current_node]\n\n debug(\"Osops_search: search_string:#{search_string}, one_or_all:#{one_or_all},\"\\\n + \"include_me:#{include_me}, order:#{order}, safe_deref:#{safe_deref}\")\n results = {\n :recipe => [],\n :role => [],\n :tag => []\n }\n\n current_node ||= node\n\n for query_type in order\n if include_me and current_node[\"#{query_type}s\"].include? search_string\n debug(\"node #{current_node} contains #{query_type} #{search_string}, so adding node to results\")\n results[query_type] << current_node\n break if one_or_all == :one # skip expensive searches if unnecessary\n end\n\n search_string.gsub!(/::/, \"\\\\:\\\\:\")\n query = \"#{query_type}s:#{search_string} AND chef_environment:#{current_node.chef_environment}\"\n debug(\"osops_search query: #{query}\")\n result, _, _ = Chef::Search::Query.new.search(:node, query)\n results[query_type].push(*result)\n break if one_or_all == :one and results.values.map(&:length).reduce(:+).nonzero?\n end #end for\n\n #combine results into prioritised list\n return_list = order.map { |search_type| results[search_type] }.reduce(:+)\n\n #remove duplicates\n return_list.uniq!(&:name)\n\n #remove self if returned by search but include_me is false\n return_list.delete_if { |e| e.name == current_node.name } if not include_me\n\n if not safe_deref.nil?\n # result should be dereferenced, do that then remove nils.\n debug(\"applying deref #{safe_deref}\")\n return_list.map! { |nodeish| rcb_safe_deref(nodeish, safe_deref) }\n return_list.delete_if { |item| item.nil? }\n end\n\n debug(\"ospos_search return_list: #{return_list}\")\n\n if one_or_all == :one\n #return first item\n return_list.first\n else\n #return list (even if it only contains one item)\n return_list\n end\n end", "def DFS(rootNode,searchValue)\n\tstack = []\n\tpath = []\n\tpath[0] =rootNode\n\t# Initializes the stack with rootNode\n\tstack[0]=rootNode\n\t# while there is something in the stack keep running\n\twhile stack.length != 0\n\t\t# if checkFunction(searchValue,stack[0]) == true\n\t\tif checkFunction(searchValue,stack[0]) == true\n\t\t\t# return true and path\n\t\t\treturn TracePath(stack[0])\n\t\t# else\n\t\telse\n\t\t\t#remove stack[0] from the stack and inmidiately stores it in temp\n\t\t\ttemp = stack.shift\n\t\t\t#if there is right brach in the formely stack[0] now stored in temp\n\t\t\tif temp.getRB\n\t\t\t\t#insert the rigth branch at the beginning of the stack\n\t\t\t\tstack.unshift(temp.getRB)\n\t\t\tend\n\t\t\t#if there is left branch in the formely stack[0] now stored in temp\n\t\t\tif temp.getLB\n\t\t\t\t#insert the left brach at the beginning of the stack.\n\t\t\t\tstack.unshift(temp.getLB)\n\t\t\t\t\n\t\t\tend\n\t\t\t#insert the temp in the path array to keep track of the path used for the search\n\t\t\tputs temp.display\n\t\tend\n\tend\n\t# return false becuase at this point the function did not find the value\n\treturn false\nend", "def esxlRecurse i, j\n esxlStraightRecurse(i, j) + esxlDiagonalRecurse(i, j)\nend", "def find_paths(&block)\n follow,kill,find,continue = SearchParams.process(&block)\n\n paths,path = [],[]\n search = lambda do |node|\n if find[node]\n paths << path.dup\n next if not continue[node]\n end\n next if kill[node]\n [*follow[node]].each do |n|\n next if path.include? n\n path.push(n)\n search[n]\n path.pop\n end\n end\n\n [*follow[self]].each do |n| \n path.push(n)\n search[n] \n path.pop\n end\n\n paths\n end", "def dfs(root, target_file, path = root.name)\n return path if root.name == target_file\n\n children = get_children(path)\n children.each do |child_path|\n child_node = Node.new(child_path.basename.to_s)\n root.children << child_node\n result = dfs(child_node, target_file, child_path)\n if result \n return result\n end\n end\n nil\nend", "def dfs_rec(target, current_node=@root)\n return if current_node.nil?\n return current_node if current_node.value == target\n dfs_rec(target, current_node.left_child) ||\n dfs_rec(target, current_node.right_child)\n\tend", "def dfs_object(root_node, target)\n #two base cases\n return root_node if root_node.value == target\n # return nil if root_node.parent.nil? #when there are no parents, we know we're back at the actual root of the tree\n\n root_node.children.each do |child_node|\n result = dfs(child_node, target)\n\n #returning nil at this point would cut short\n if result #is not nil\n return result\n end\n end\n\n nil\nend", "def search(word)\r\n #puts \"hehe, search(#{word})\"\r\n if word.length == 0\r\n # handle separately\r\n return @empty_string_exist\r\n end\r\n\r\n stack = []\r\n\r\n if word[0] == '.'\r\n nodes = all_node_in_this_idx(@root)\r\n nodes.each do |node|\r\n stack << [node, 0]\r\n end\r\n else\r\n node = search_node_or_insert_node(@root, word[0])\r\n #puts \"node=#{node}, letter=#{node.letter}\"\r\n if !node.nil? && node.letter == word[0]\r\n stack << [node, 0]\r\n end\r\n end\r\n\r\n while !stack.empty? do\r\n n, idx = stack.pop\r\n #puts \"search, n=#{n}, n.letter=#{n.letter}, idx=#{idx}\"\r\n\r\n if idx == word.length - 1\r\n #puts \"maozi\"\r\n if n.is_end\r\n return true\r\n end\r\n else\r\n #puts \"maozi1\"\r\n if word[idx + 1] == '.'\r\n\r\n #puts \"maozi2\"\r\n nodes = all_node_in_this_idx(n.next)\r\n nodes.each do |node|\r\n stack << [node, idx + 1]\r\n end\r\n else\r\n #puts \"maozi3\"\r\n #puts \"n.next=#{n.next}\"\r\n #puts \"n.next.right=#{n.next.right}\"\r\n node = search_node_or_insert_node(n.next, word[idx + 1])\r\n #puts \"maozi4\"\r\n #puts \"node=#{node}, letter=#{node.letter}, idx=#{idx}\"\r\n #puts \"#{n.next}\"\r\n if !node.nil? && node.letter == word[idx + 1]\r\n #puts \"xbh\"\r\n stack << [node, idx + 1]\r\n end\r\n end\r\n end\r\n end\r\n\r\n return false\r\n end", "def find; end", "def find(input)\n end", "def find(dirs); end", "def construct_solution\n path = [@root]\n tabu_list = [@root]\n until @ends.include?(last = path.last)\n step = next_step last, tabu_list\n path << step\n end\n path\n end", "def makeSearch #:doc:\n # beginning of sql query string\n sql = @select_part1 + \" \" + @select_part2\n\n begin\n @hash_in_where = \"\"\n \n if @context_hash != nil\n \n # If 'user' parameter given, only files owned by 'user' can be in search results.\n only_these_users_in_where = \"\"\n if @only_these_users != nil\n only_these_users_in_where = \" users.username IN (\"\n users = @only_these_users.split(' ')\n users.each_with_index do |x, i|\n if i == 0\n only_these_users_in_where += \"'\" + x + \"'\"\n else\n only_these_users_in_where += ', ' + \"'\" + x + \"'\"\n end\n end\n \n only_these_users_in_where += \") AND \"\n end\n \n \n # Find devfiles that have queried context_hash\n devfiles = Devfile.find_by_sql(\"SELECT devfiles.id as devfile_id, devfiles.device_id, metadatas.devfile_id, metadatas.metadata_type_id,\n metadatas.value, metadata_types.id, metadata_types.name,\n devices.id, devices.user_id, users.id, users.username \n FROM devfiles, metadatas, metadata_types, devices, users\n WHERE metadatas.value = '\"+@context_hash+\"' AND\n metadata_types.name = 'context_hash' AND\n devfiles.id = metadatas.devfile_id AND\n devices.id = devfiles.device_id AND\n devices.user_id = users.id AND #{only_these_users_in_where}\n metadatas.metadata_type_id = metadata_types.id\")\n \n if devfiles != nil && devfiles.size > 0\n # Add id:s of devfiles that will be included into results, because these devfiles belong to queried context\n @hash_in_where = \" OR devfiles.id IN ( \"\n \n @devfiles_in_context = Array.new\n \n devfiles.each_with_index do |x, i|\n @devfiles_in_context.push(x.devfile_id)\n if i == 0\n @hash_in_where += x.devfile_id.to_s\n else\n @hash_in_where += \", \" + x.devfile_id.to_s\n end \n end\n @hash_in_where += \" )\"\n end\n end\n puts @hash_in_where\n available_files_only_in_where = \"\"\n \n if @availableFilesOnly == true\n available_files_only_in_where = \" AND ( blobs.uploaded = 1 OR devices.last_seen >= '#{device_online_timeout.to_s(:db)}' ) \"\n end\n \n show_deleted_files_in_where = \"\"\n \n if @showDeletedFiles == false && @queryparams[:what_to_get] =~ /files/i\n show_deleted_files_in_where = \" AND devfiles.deleted = 0 \"\n end\n \n # make the where-part of the sql query\n if not @versionlist_conditions\n makeConditions\n if @condition_string != \"\" || @hash_in_where != \"\"\n sql += \" ( \" + @condition_string + @hash_in_where + \" ) \"\n else\n sql += \" false \"\n end\n sql += show_deleted_files_in_where + available_files_only_in_where + @default_id_conditions\n else\n sql += \" \" + @versionlist_conditions + \" \" + @default_id_conditions\n end\n rescue => exp\n putsE(exp)\n raise exp\n end\n\n @sql = sql\n \n # sorting order\n @sql_sorting = \"\"\n if not @versionlist_sorting\n @sql_sorting = getSortingOrder\n else\n @sql_sorting = @versionlist_sorting\n end\n \n sql += \" ORDER BY \" + @sql_sorting\n puts \"Initial SQL: #{sql}\"\n \n @results_per_page = 100 # default\n @show_page = 1 # default\n if @queryparams[:format] == \"atom\"\n @results_per_page = 100 #default maxresults for atom-feed\n if @queryparams[:maxresults] and @queryparams[:maxresults] =~ /^\\d{1,}$/\n @results_per_page = @queryparams[:maxresults]\n end\n else\n if @queryparams[:perpage]\n @results_per_page = @queryparams[:perpage].to_i\n end\n if @queryparams[:page] and @queryparams[:page] =~ /^\\d{1,}$/\n @show_page = @queryparams[:page]\n end\n end\n\n # will_paginate uses sql-subqueries to get COUNT of rows. Subqueries are NOT\n # supported by Mysql versions < 4.1. So we have to do the counting by ourselves...\n count = sql.gsub(@select_part1, \"SELECT COUNT(*) AS entries\").gsub(/\\sORDER BY.*$/, \"\").gsub!(/\\:\\w+/) do |s|\n \"'\" + @condition_values[s.gsub(\":\", \"\").intern].to_s + \"'\"\n end\n \n \n \n if @queryparams[:what_to_get] =~ /files/i\n # entries = Devfile.count_by_sql(count)\n\n # Pagination will be made later, with new sql query\n @results = Devfile.find_by_sql [sql, @condition_values]#,\n# :page => @show_page,\n# :per_page => @results_per_page,\n# :total_entries => entries\n # Remove files from results that user is not allowed to access\n checkFileRightstoResults \n elsif @queryparams[:what_to_get] =~ /devices/i\n entries = Device.count_by_sql(count)\n @results = Device.paginate_by_sql [sql, @condition_values],\n :page => @show_page,\n :per_page => @results_per_page,\n :total_entries => entries\n # SHOULD EVERYONE BE ALLOWED TO SEE ALL DEVICES?\n \n elsif @versionlist_conditions\n entries = Blob.count_by_sql(count)\n @results = Blob.paginate_by_sql [sql, @condition_values],\n :page => @show_page,\n :per_page => @results_per_page,\n :total_entries => entries\n end\n end", "def find(root, params)\n FileSearcher.call(root, params)\nend", "def path_finder(value, structure, path = [])\n #i tracks the index of the current array\n if value == structure\n path << true\n end\n if !path.include?(true)\n # binding.pry\n if structure.respond_to?(:each)\n #test each element of the hash\n structure.each do |element_key, element_value|\n if !path.include?(true)\n #once we've captured \"true\", we don't need to add to the path anymore\n path << element_key\n end\n if element_value == value\n path << true\n else\n path = path_finder(value, element_value, path)\n if !path.include?(true)\n #if path comes back from a false branch, remove the last part\n path.pop\n end\n end\n end\n else\n return path\n end\n end\n path\nend", "def solve\n node = @list.first_node\n traversed_nodes = {}\n\n loop do\n return node if traversed_nodes[node]\n traversed_nodes[node] = true\n node = node.next\n break unless node\n end\n end", "def search(array, key)\n raise ArgumentError, 'Please provide valid input array to be searched.' if array.nil?\n raise ArgumentError, 'Please provide valid search key' if key.nil?\n\n search_recursive(array, key, 0, array.size)\nend", "def search \n\n end", "def bsearch_tree(node, target)\n return target if node == target\n y = nil\n node.each do |x|\n if x.is_a? node.class\n y = bsearch_tree(x, target)\n else\n return target if x == target\n end\n end\n y\nend", "def depth_first_search node= self.root, value\n\t\tstack =[node]\n\n\t\twhile stack.length > 0\n\t\t\tcurrent = stack.pop\n\t\t\treturn \"Value #{value} found in #{current.to_s}\" if current.value == value\n\t\t\tstack.push(current.left) if current.left\n\t\t\tstack.push(current.right) if current.right\n\t\tend\n\tend", "def serialize_binary_search_tree_helper( node, nodes_array)\n \n if node.nil?\n return nil\n end\n \n s_node = Serilized_Node.new(node.value)\n \n nodes_array.push(s_node)\n node_index = nodes_array.size - 1 #the index of the sub tree root\n s_node.left_child_index = serialize_binary_search_tree_helper(node.left, nodes_array)\n s_node.right_child_index = serialize_binary_search_tree_helper(node.right, nodes_array)\n\n \n return node_index\nend", "def dfs(target)\n return self if self.value == target\n # debugger\n self.children.each do |node|\n dfs(node)\n # if node.value == target\n # return node\n # else\n # node.dfs(target)\n # end\n end\n return nil if self.children.empty?\n p new_arr\n end", "def scan_patterns\n @max_level = 0\n @root.bfs do |r|\n reached = false\n curr_instances = yield(r.parent_id)\n curr_instances.each do |c_instance|\n q = @query.new.extend(Pbuilder::Query)\n q = q.search_next_instances(c_instance.uri, r.node.edge, r.node.value)\n q.execute do |i|\n @action.call(i, r.id, r.level, r.node.edge, c_instance.id)\n reached = true\n end\n end if ! curr_instances.nil?\n @max_level = r.level if r.level > @max_level\n reached\n end if @pass\n @max_level\n end", "def search(args)\n raise NotImplementedError, \"Not implemented\"\n end", "def search\n end", "def use_breadth_first(item, graph, logic_function = ->(x){graph[x].empty?} , returned = \"steps\" )\r\n search_queue = []\r\n steps = {}\r\n search_queue = search_queue.concat(graph[item])\r\n searched = []\r\n #Setting up initial steps \r\n if !search_queue.empty?\r\n search_queue.each do |term|\r\n steps[term] = 1\r\n end\r\n end\r\n #Here goes the graph algorithm\r\n while !search_queue.empty?\r\n person = search_queue.shift()\r\n if !( searched.include?(person) )\r\n\r\n if logic_function.call(person)\r\n if returned == \"steps\"\r\n return steps[person]\r\n end\r\n if returned == \"found\"\r\n return true\r\n end\r\n else\r\n if !(graph[person].nil?) \r\n graph[person].each do |related|\r\n steps[related] = steps[person] + 1 #Setting up the steps of parents of the current element in the queue\r\n end\r\n search_queue = search_queue.concat(graph[person])\r\n end\r\n end\r\n\r\n end\r\n end\r\n return false\r\nend", "def dfs_rec(value, node = Node.get_root_node)\n\n if !node.nil?\n puts \"Searching node #{node.value}\"\n if !node.value.nil?\n if node.value == value\n puts \"Found #{value} at node #{node}!\"\n return node\n end\n end\n else\n nil\n end\n\n left_child = node.left_child\n right_child = node.right_child\n\n if left_child.nil?\n puts \"No left child.\"\n else\n puts \"Left child is #{left_child.value}\"\n end\n\n if right_child.nil?\n puts \"No right child.\"\n else\n puts \"Right child is #{right_child.value}.\"\n end\n\n left_child.nil? ? nil : dfs_rec(value, left_child)\n right_child.nil? ? nil : dfs_rec(value, right_child)\nend", "def search keyword\n result = Set.new\n matched = Array.new\n @frame_tree_root_node.each{|node|\n if node.content =~ /#{keyword}/i\n matched << node.name\n end\n } \n @frame_tree_root_node.each{|node|\n if node.is_root?\n result << node.name\n elsif matched.include? node.name\n result << node.name #add id\n node.parentage.each{|item|\n result << item.name\n }\n end\n }\n @frame_tree_root_node.print_tree\n result\n end", "def biSearch_recur(array,low,high,k)\n if high < low\n return \"not found\"\n end\n \n mid = low + (high - low) / 2\n\n if array[mid] == k\n return mid\n elsif array[mid] > k \n return biSearch(array,low,mid-1,k)\n else\n return biSearch(array,mid+1,high,k) \n end\nend", "def find_path(target)\n queue = [root_node]\n until queue.empty?\n p current_node = queue.shift\n p queue\n return current_node if current_node.value == target\n current_node.children.each do |child|\n queue << child\n end\n end\n nil\nend", "def build_tree( n , d )\n \n if d.key?('v')\n n < d['v'] ? build_tree(n , d['l']) : build_tree(n, d['r'])\n else\n d['l'] = {}\n d['v'] = n\n d['r'] = {}\n end\n \nend", "def find(parent, n)\n return n if n == parent[n]\n\n parent[n] = find(parent, parent[n])\n parent[n]\nend", "def get_results()\n restriction_nodes = []\n result_nodes = []\n if !(@inputs.nil? || @inputs.empty? || @inputs.first.empty?)\n input_set = @inputs.first\n restriction_nodes= input_set.nodes\n result_nodes = input_set.breadth_first_search(true){|node| node.item.text.downcase.include?(@keyword_phrase.to_s.downcase)} \n end\n \n if !@inplace\n results = @server.match_all(parse_keyword_phrase(), restriction_nodes) \n result_nodes = results.map{|item| Xplain::Node.new(item: item)}\n end\n \n result_nodes\n \n end", "def dfs(root, result)\n return if root.nil?\n result << root.val if root.left.nil? && root.right.nil?\n dfs(root.left, result)\n dfs(root.right, result)\nend", "def path_finder(value, structure, current_path = \"\", paths = [])\n\n if value.class == String && structure.class == String\n if structure =~ /\\b#{Regexp.quote(value)}\\b/i\n paths << current_path\n end\n elsif value == structure\n paths << current_path\n elsif structure.is_a?(Array)\n structure.each_with_index do |element, index|\n if path_finder(value, element, current_path + \"[#{index}]\") != nil\n paths << path_finder(value, element, current_path + \"[#{index}]\")\n end\n end\n elsif structure.is_a?(Hash)\n structure.each do |key, element|\n if key.class == Symbol\n if path_finder(value, key, current_path + \"[:#{key}]\") != nil\n paths << path_finder(value, key, current_path + \"[:#{key}]\")\n end\n if path_finder(value, element, current_path + \"[:#{key}]\") != nil\n paths << path_finder(value, element, current_path + \"[:#{key}]\")\n end\n else\n if path_finder(value, key, current_path + \"['#{key}']\") != nil\n paths << path_finder(value, key, current_path + \"['#{key}']\")\n end\n if path_finder(value, element, current_path + \"['#{key}']\") != nil\n paths << path_finder(value, element, current_path + \"['#{key}']\")\n end\n end\n end\n else\n return nil\n end\n paths.flatten\nend", "def build_search!(options = {}, &block)\n search = searchlogic_search(options)\n yield search if block_given?\n search\n end", "def search(trie, word, maxCost)\n current_row = (0..word.length).to_a\n results = []\n\n trie.children.each_key do |key|\n search_trie(trie.children[key], key, word, current_row, results, maxCost)\n end\n\n return results\nend", "def findCicle(nodes, idInicio, passed)\n if(!passed.any?{|id| id == nodes.operationId})\n passed.push(nodes.operationId)\n nodes.entradas.each { \n |node|\n if(node.operationId != idInicio)\n return findCicle(node, idInicio, passed)\n else\n return true\n end \n }\n else \n return true\n end\n return false\nend", "def depth_first_search_paths(from, to, generator, path, options={})\n search_paths('depth-first-search-paths', from, to, generator, path,\n options)\n end", "def find_paths(current_node, target_node, current_path=[])\n \tcurrent_path.push(current_node)\n \tif current_node == target_node\n \t\t@found_paths.push(current_path.dup)\n \telse\n \t\t@adjacency_list[current_node].each do |child|\n \t\t\tfind_paths(child, target_node, current_path)\n \t\tend\n \tend\n \tcurrent_path.pop\n end", "def build_tree(arr)\n\tend", "def nodes()\n return SearchNodes.new(:node => self, :return_many => true)\n end", "def depth_first_search!(node)\n node.marked = true\n node.type = \"M\"\n node.adj.each do |n|\n if n.marked == false\n depth_first_search(n)\n end\n end\n end", "def find(val)\n return val if root?(val)\n parent[val] = find parent[val]\n end", "def render_recursively(output_path, title, obj, parent = '')\n renderer.render(output_path, parent, title, obj.get_thumbs, obj.filter)\n\n # For Doc object, returns a list of makes. For the NodeSet object, returns a list of models.\n obj.filter.each do |key|\n # Only recurse if not the same as the parent to avoid an infinite loop\n if title != key\n nodes = obj.search('work:contains(\"' + key + '\")')\n render_recursively(output_path, key, nodes, title)\n end\n end\n end", "def findChildren (parent, structure)\n #search for items in structure where item.manager = parent\n children = []\n \n #puts parent\n \n structure.each do |employee|\n \n #puts '> ' + employee.join(', ')\n \n if employee[2].eql? parent\n \n #puts 'got it!'\n \n children << employee\n end\n end\n \n return children\n\nend", "def search(target)\n end", "def search(node,contactname,index) \n #Break the Contact char by char and have the contact stored at the last node\n charsplit=contactname.split(//)\n asciicode=charsplit[index].ord #Gets the ASCII code for the character\n \n if node.link[asciicode]==nil then\n return Array[node,index] # An array with node and the index upto which we have traver\n elsif node.link[asciicode]!=nil && index==contactname.name.length-1 #we have come all the way to last char or we couldnt find it. We get the last node anyways\n return node\n else\n #Recursively call search\n search(node.link[asciicode],contactname,index=index+1)\n end\n end", "def search\n end", "def search\n end", "def search\n end", "def search\n end", "def search\n end", "def search\n end", "def search\n end", "def search\n end", "def search\n end", "def search\n end", "def dfs_rec(tree, value)\n return nil if tree.nil?\n\n p tree.value\n return tree if tree.value == value\n\n left = dfs_rec(tree.left, value)\n return left if left && left.value == value\n\n\n right = dfs_rec(tree.right, value)\n return right if right && right.value == value\n\nend", "def breadth_first_search(find,tree)\n current = tree[0]\n answer = \"\"\n queue = []\n visited = [tree[0]]\n \n condition = false\n until condition == true\n connections = [current.find_right_child[0],current.find_left_child[0]].compact\n if current.value == find\n answer = current\n condition = true\n elsif visited.count == tree.count\n answer = nil\n condition = true\n else\n connections.each do |i|\n if i.value == find\n answer = i\n condition = true\n elsif !visited.include?(i)\n visited.push(i)\n queue.push(i)\n end\n end\n end\n current = queue.shift\n end\n puts answer ? answer : \"Value not found!\"\n puts answer.value if answer != nil\nend", "def query(search_term)\n <<-SQL\n with recursive friends_graph (member_id, friend_id, path) as (\n select f.member_id, f.friend_id, array[f.member_id, f.friend_id] as path\n from friendships as f\n where member_id = #{member.id}\n union all\n select graph.member_id, f.friend_id, graph.path || ARRAY[f.friend_id]\n from friendships as f\n join friends_graph as graph\n on f.member_id = graph.friend_id\n and f.friend_id != ALL(graph.path)\n )\n\n select distinct path from friends_graph\n inner join headings\n on headings.member_id = friends_graph.friend_id\n where headings.name ilike '%#{search_term}%'\n SQL\n end", "def global_linear_search (object, array)\nputs \"nil\" if array.empty? == true\nputs \"nil\" if array.include?(object) == false\n\t\ni=0\nresults = []\nwhile i < array.length\nresults << i if array[i] == object\ni +=1\nend\nresults\nend", "def search_trie(node, letter, word, previous_row, results, maxCost)\n columns = word.length\n current_row = [previous_row[0] + 1]\n\n # Build matrix row\n 1.upto(columns).each do |col|\n insertCost = current_row[col - 1] + 1\n deleteCost = previous_row[col] + 1\n subCost = previous_row[col - 1]\n\n subCost += 1 unless word[col - 1] == letter\n current_row << [insertCost, deleteCost, subCost].min\n end\n\n # If the last value in the row is less than or equal to the maxCost\n # and there is a word in the node, add it to the result.\n if current_row.last <= maxCost && !node.word.nil?\n results << node.word\n end\n\n # If there is a value in the row that is less than or equal to the\n # maxCost, recursively search the branches of the node.\n if current_row.min <= maxCost\n node.children.each_key do |key|\n search_trie(node.children[key], key, word, current_row, results, maxCost)\n end\n end\nend", "def explore(pos)\n end", "def recur(current, remaining)\n if current.size == $size\n word = current.join\n if $dictionary.include? word and not $solutions.include? word\n $solutions << word\n puts word\n end\n elsif current.size < $size\n remaining.each do |r|\n new_cur = Array.new current\n new_remaining = Array.new remaining\n new_remaining.delete_at new_remaining.index(r)\n new_cur << r\n recur(new_cur, new_remaining)\n end\n end\nend", "def find_answer(row , board, queens)\r\n open = board.check_open(row)\r\n\r\n if open.empty?\r\n #if there are no solutions here, so this doesn't work\r\n return []\r\n\r\n elsif row == 7 and queens.size() < 7\r\n #if we're at the last row, but don't have enough queens\r\n return []\r\n\r\n elsif row == 7 and queens.size() == 7 and open.size < 1\r\n # we're at the last row with no solution\r\n return []\r\n\r\n elsif row == 7 and queens.size() == 7 and open.size() == 1\r\n # we're at the last row, and we have a final solution\r\n\r\n # Creates a new board for us to use recursively\r\n new_board1 = Board.new\r\n queens.each do | coords |\r\n new_board1.set_closed(coords[0], coords[1])\r\n end\r\n new_board1.set_closed(open[0], row)\r\n new_board1.set_solution\r\n\r\n #creates the final array of coordinates the queens are at\r\n final = queens.push([open[0], row])\r\n\r\n $solutions_array.push(final)\r\n $solutions_boards.push(new_board1)\r\n\r\n return final\r\n\r\n else # we're not at last row, and we still have a solution to try from open\r\n\r\n open.each do | spot |\r\n new_board = Board.new\r\n\r\n queens.each do | coords |\r\n new_board.set_closed(coords[0], coords[1])\r\n end\r\n new_board.set_closed(spot, row)\r\n\r\n new_queens = Array.new\r\n new_queens.concat(queens)\r\n new_queens.push([spot, row])\r\n\r\n new_row = row + 1\r\n\r\n find_answer(new_row, new_board, new_queens)\r\n end\r\n end\r\nend", "def test_recursive_methods\n assert_equal 0, find_node(1).ancestors_r.size\n assert_equal 8, find_node(1).descendants_r.size\n assert_equal 4, find_node('1_1_2_1_1').ancestors_r.size\n end", "def build_tree(arr)\n\ntree = []\n\ntree.push(Node.new(arr[0]))\n\n arr[1..-1].each do |i|\n new_node = Node.new(i)\n\n condition = false\n current = tree[0]\n until condition == true\n if i > current.value && current.find_right_child.count == 0\n new_node.create_parent(current)\n current.create_right_child(new_node)\n tree.push(new_node)\n condition = true\n elsif i < current.value && current.find_left_child.count == 0\n new_node.create_parent(current)\n current.create_left_child(new_node)\n tree.push(new_node)\n condition = true\n elsif i > current.value && current.find_right_child.count == 1\n current = current.find_right_child[0]\n elsif i < current.value && current.find_left_child.count == 1\n current = current.find_left_child[0]\n end\n end\n end\n tree\nend", "def search\n\n end", "def search_path *a, prepend: false, &block\n if block_given?\n a = a.flatten\n a += search_path if prepend\n run_with_search_path a, &block\n else\n get_search_path\n end\n end", "def path_finder \n until queue.empty? \n current_node = queue.shift()\n generate_neighbours(current_node)\n current_node.neighbour_nodes.each do |neighbour|\n track_visited(current_node, neighbour)\n correct_node?(neighbour) ? (return neighbour.visited) : (queue << neighbour)\n end\n end\n end", "def search(value)\n return @searchMethods.searchAtTree(value, @root)\n end", "def search(other = 'SAN', cost = -2)\n return cost if @name == other\n\n return -1 if @searched\n\n @searched = true\n\n @children.each do |child|\n d = child.search(other, cost + 1)\n return d if d != -1\n end\n\n @parent.search(other, cost + 1)\n end" ]
[ "0.718056", "0.6937702", "0.65080714", "0.6427719", "0.6426785", "0.63000536", "0.6122079", "0.6054899", "0.601959", "0.5995331", "0.5932973", "0.5908785", "0.58890814", "0.5884935", "0.5884047", "0.58561194", "0.58171386", "0.5813582", "0.5811641", "0.5771825", "0.5758444", "0.5746104", "0.57269746", "0.5723507", "0.56627625", "0.5655833", "0.5647424", "0.5642097", "0.56416434", "0.55809927", "0.5580229", "0.55741316", "0.5563914", "0.55586237", "0.5557731", "0.55560714", "0.55437815", "0.5538692", "0.5534066", "0.55298066", "0.5529706", "0.55256367", "0.55164135", "0.54974884", "0.5496209", "0.5493396", "0.54832", "0.54808956", "0.5467899", "0.54640007", "0.5462506", "0.54599154", "0.5458072", "0.54540324", "0.5448116", "0.54457545", "0.54447776", "0.5430959", "0.5430551", "0.5429404", "0.5425416", "0.54184335", "0.5408815", "0.5400842", "0.5394439", "0.53939027", "0.53856826", "0.5376529", "0.5375651", "0.53709286", "0.53621733", "0.53614765", "0.53609353", "0.53601944", "0.5360003", "0.5359424", "0.5349628", "0.5349628", "0.5349628", "0.5349628", "0.5349628", "0.5349628", "0.5349628", "0.5349628", "0.5349628", "0.5349628", "0.53479254", "0.53459424", "0.53447056", "0.5329026", "0.5328417", "0.53270227", "0.5326215", "0.53249997", "0.5323403", "0.5318444", "0.5316809", "0.5314904", "0.53113145", "0.5311212", "0.5310096" ]
0.0
-1
Helper method use this to create a recursive print solution.
def preorder_print(start, traversal) traversal end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recursive_print(array)\n\nend", "def recursive_print(result=\"\", node=@head)\n\t\tif node.nil?\n\t\t\treturn result\n\t\tend \n\t\tresult += node.data\n\t\tif node.next \n\t\t\tresult += \" > \"\n\t\tend \n\t\trecursive_print(result, node.next)\n\tend", "def printout\n\t\t\n\t\tindex = 0\n\t\t\n\t\tdef small_loop (node, index)\n\t\t\t\n\t\t\tfor i in 0...index\n\t\t\t\tprint \" \"\n\t\t\tend\n\t\t\t\n\t\t\tputs node.name\n\t\t\tindex += 1\n\t\t\t\n\t\t\tif node.children.length > 0\n\t\t\t\tindex += 1\n\t\t\t\tnode.children.cycle(1) { |child| small_loop(child, index) }\n\t\t\tend\n\t\tend\n\t\t\n\t\tsmall_loop(@root, index)\n\tend", "def fprint(object, depth = 0)\n #puts \"%10s\" % [\"foo\"]\n puts \"%10s\" % [object.to_s]\nend", "def printTree()\n def pTree(node, i)\n puts node.toString i\n node.children.each do|child|\n pTree(child, i+1)\n end\n end\n pTree(@root, 0)\n end", "def print_reverse\n print_recursively(@head) \n end", "def print_tree\n ''\n end", "def print_r prefix=\"\", daughters=false\n\t\tputs \"#{prefix}#{@e}\"\n\t\tif @children\n\t\t\t(daughters ? @daughters : @children).each do |child|\n\t\t\t\tchild.print_r \"#{prefix}\\t\", daughters\n\t\t\tend\n\t\tend\n\tend", "def generate_print (node)\n\tchild = node.children[0]\n\n\t# string symbol\n\tif child.symbol != nil and child.symbol.type == \"string\"\n\t\t\tputs \"Generating a nice print with a string symbol...\"\n\n\t\tldx(\"02\")\n\t\tldy($static_table.get(child.symbol).address)\n\t\tsys\n\t# normal string\n\telsif child.token != nil and child.token.type == \"T_STRING\" and child.symbol == nil\n\t\t\tputs \"Generating a nice print with a string...\"\n\n\t\taddress = $code.add_string(child.name)\n\t\tlda(hex_converter(address, 2))\n\t\tsta\n\t\tldx(\"02\")\n\t\tldy\n\t\tsys\n\telse\n\t\tputs \"Generating a nice print with a non-string...\"\n\n\t\tgenerate(child)\n\t\tldx(\"01\")\n\t\tsta\n\t\tldy\n\t\tsys\n\t\t\n\tend\n\nend", "def pretty_print(depth = 0)\n depth.times { STDERR.print ' *' }\n STDERR.print ' '\n STDERR.puts \"#{@name} (#{@id})\"\n @contents.each { |obj| obj.pretty_print(depth + 1) }\n end", "def print()\n current_node = @root_node\n while current_node != nil\n current_node.print()\n current_node = current_node.get_next()\n end\n end", "def printf(children=nil)\n h = height(@root) + 1\n root = @root\n h.times do |i|\n self.print_level(root, i)\n end\n end", "def list_recur_print(item, desc = 0)\n item.children.each do |child|\n next if child.hidden?\n print_item child, desc\n list_recur_print(child, desc + 2)\n end\n end", "def to_s(depth = 0)\n\t\tind = \" \" * depth\n\t\tind + \"[#{nonTerminal}/#{decision}\" +\n\t\tif(children.size == 0)\n\t\t\t\"]\\n\"\n\t\telse\n\t\t\t\"\\n\" + children.map { |c| if(c.is_a?(String)) then ind + \" \" + c.inspect + \"\\n\" else c.to_s(depth+1) end }.join(\"\") + ind + \"]\\n\"\n\t\tend\n\tend", "def to_s(depth = 0)\n\t\tind = \" \" * depth\n\t\tind + \"[#{nonTerminal}/#{decision}\" +\n\t\tif(children.size == 0)\n\t\t\t\"]\\n\"\n\t\telse\n\t\t\t\"\\n\" + children.map { |c| if(c.is_a?(String)) then ind + \" \" + c.inspect + \"\\n\" else c.to_s(depth+1) end }.join(\"\") + ind + \"]\\n\"\n\t\tend\n\tend", "def printTree(options = {})\n # Set defaults\n options[:name] ||= true\n options[:content] ||= false\n \n result = \"\"\n \n options[:output] = result \n # Traverse tree and modify result by tacking on child names.\n printTraversal(options)\n \n puts result\n end", "def print_depth(item)\n return if item.hidden?\n print_item item, 0\n list_recur_print item, 2\n end", "def print\n node = root\n \n print_node(node, \"> \")\n end", "def printtree(n, t)\n if t.question==nil\n n.times {print \" \"}\n puts t.name\n else\n puts t.question\n printtree n+1, t.yes\n printtree n+1, t.no\n end\n end", "def print_tree(n, i = 0)\n i.times { print \" \" }\n puts \"+-#{n}\"\n $classtree[n].sort.each { |c| print_tree(c, i+2) }\nend", "def print\n str = \"\"\n current = self.head\n while current != nil do\n str = \"#{str}#{current.data}\"\n current = current.next\n if current != nil\n str += \"\\n\"\n end\n end\n puts str\n end", "def triangle_recursive_print(row)\n puts triangle_recursive(row).join(\", \")\nend", "def print_tree(array , item, level)\n items = array[item]\n unless items == nil\n indent = level > 0 ? sprintf(\"%#{level * 2}s\", \" \") : \"\"\n items.each do |e|\n puts \"#{indent}-#{e[:title]}\"\n print_tree(e, level + 1)\n end\n end\nend", "def printf(list=[@root], output='')\n # remove front list item & add it to the output\n first = list.shift()\n print_string = first.title + ': ' + first.rating.to_s + \"\\n\"\n output << print_string\n # add its children to the back of the list\n if first.left\n list << first.left\n end\n if first.right\n list << first.right\n end\n # repeat until all nodes have been visited, then print output\n if list.empty?\n puts output\n return\n else\n printf(list, output)\n end\n end", "def dump(depth = 0)\n print ' ' * depth * 2\n print \"// #{self.to_s}\\n\"\n end", "def print(x, objects, printed)\n\n\tif x.class == Page\n\t\tputs \"\\t\"*(x.depth.to_i) + x.to_s\n\t\tprinted.push(x.topic)\n\t\tx.children.each{ |child|\n\t\t\tprint(child, objects, printed)\n\t\t}\n\tend\n\n\tif x.class == Symbol\n\t\ttopic_regex = /title=\"(.*?)\"/\n\t\ttopic_regex.match(x.to_s.gsub!(\" \",\"_\"))\n\t\tthis_topic = $1\n\t\t\n\t\t if objects.include?(this_topic) && !printed.include?(this_topic)\n\t\t\ti = objects.index(this_topic)\n\t\t\tnewX = objects[i]\n\t\t\tprinted.push(newX)\n\t\t\tprint(newX, objects, printed)\n\t\telse\n\t\t\tprinted.push(this_topic)\n\t\t\tputs \"\\t\"*$distance.to_i + this_topic\n\t\tend\n\n\tend\nend", "def printf(root=nil)# def printf(children=nil)\n if root == nil\n root = @root\n end\n node_array = []\n node_array.push(root)\n printf_breadth(node_array)\n end", "def printf(children=nil)\n text = \"\"\n if (self.root)\n queue = Queue.new\n queue.push(self.root)\n while (!queue.empty?)\n temp = queue.pop\n text << temp.title << \":\" << temp.rating.to_s\n if (temp.left)\n queue.push(temp.left)\n end\n if (temp.right)\n queue.push(temp.right)\n end\n text << \"\\n\"\n end\n puts text\n return\n end\n end", "def print\n x = @head\n until x.nil?\n super \"-->#{x.value}\"\n x = x.right\n end\n puts \"\"\n @hash.each{|k,v| super \" #{k.inspect} => #{v.value} \"} and nil\n puts \"\"\n end", "def print_tree(tree)\n return \"-\" if tree.nil?\n puts \"#{tree.value}: \"\n print \"Left: \"\n puts \"#{print_tree(tree.children[0])}\"\n print \"Right: \"\n puts \"#{print_tree(tree.children[1])}\"\nend", "def printf(children=nil)\n toPrint = \"\"\n nextLine = []\n toPrint += \"#{@root.title}: #{@root.rating}\\n\"\n nextLine << @root.left if @root.left\n nextLine << @root.right if @root.right\n while nextLine.length > 0\n placeholder = []\n nextLine.each do |x|\n title = x.title\n rating = x.rating\n toPrint += \"#{title}: #{rating}\\n\"\n placeholder << x.left if x.left\n placeholder << x.right if x.right\n end\n nextLine = placeholder\n end\n print toPrint\n end", "def print(depth=0)\n if SYMLINK_TRACE\n if is_file?\n puts \"#{' '*(depth*2)} #{@name} => #{@target}\"\n elsif is_dir?\n puts \"#{' '*(depth*2)} [#{@name}] => #{@target}\"\n elsif @target\n puts \"#{' '*(depth*2)} [#{@name}] => #{@target} [missing?]\"\n else\n puts \"#{' '*(depth*2)} [#{@name}]\" if @target\n end\n end\n for node in children\n node.print depth+1\n end\n end", "def print_item(level:, current_item:)\n # Print the current item\n tabs = \"\\t\" * level\n puts tabs + '+ ' + current_item[:name]\n\n # Print the current item's children\n children = $children_of[current_item[:id]]\n if children && children.length > 0\n children.each do |child|\n print_item(\n level: level + 1, \n current_item: child\n )\n end\n end\nend", "def print\n return ''\n end", "def _display_tree(max_length=20, tabs='')\n\t\tif(@type != '')\n\t\t\tprint(tabs + \"[\" + @type + ((@param != '')? '(' + @param.to_s + ')': '') + \"]\\n\")\n\t\telse\n\t\t\tprint(tabs + \"[TEMPLATE:\" + @template.template_file + \"]\\n\")\n\t\tend\n\n\t\tfor content in @contents\n\t\t\tif(content.is_a?(SifterElement))\n\t\t\t\tcontent._display_tree(max_length, tabs + \"\\t\")\n\t\t\telsif(content.is_a?(SifterTemplate))\n\t\t\t\tcontent._display_tree(max_length, tabs + \"\\t\")\n\t\t\telse\n\t\t\t\tcontent.gsub!(/[\\r\\n]/, ' ')\n\t\t\t\tprint(tabs + \"\\t[TEXT:\" + content[0, max_length] + \"]\\n\")\n\t\t\tend\n\t\tend\n\tend", "def printf\n output = []\n children = []\n output.push(\"#{@root.title}: #{@root.rating}\")\n if @root.left != nil\n children.push(@root.left)\n end\n if @root.right != nil\n children.push(@root.right)\n end\n children.each do |i|\n output.push(\"#{i.title}: #{i.rating}\")\n if i.left != nil\n children.push(i.left)\n end\n if i.right != nil\n children.push(i.right)\n end\n end\n puts output\n end", "def print\n return nil if @head.nil?\n print_string = \"\"\n current = @head\n print_string.concat(current.data + \"\\n\")\n until current.next.nil?\n current = current.next\n print_string.concat(current.data + \"\\n\")\n end\n puts print_string\n end", "def print_tree(d)\n \n print_tree(d['l']) if d.key?('l')\n print \"#{d['v']},\" if d.key?('v')\n print_tree(d['r']) if d.key?('r')\n \nend", "def printit\n node = @head\n counter = 0\n while(node = node.next)\n if counter == 10\n print \"\\n\"\n counter = 0\n end\n printf \"%-4s\", node\n counter = counter + 1\n end\n end", "def printit\n node = @head\n counter = 0\n while(node = node.next)\n if counter == 10\n print \"\\n\"\n counter = 0\n end\n printf \"%-4s\", node\n counter = counter + 1\n end\n end", "def printit\n node = @head\n counter = 0\n while(node = node.next)\n if counter == 10\n print \"\\n\"\n counter = 0\n end\n printf \"%-4s\", node\n counter = counter + 1\n end\n end", "def printit\n node = @head\n counter = 0\n while(node = node.next)\n if counter == 10\n print \"\\n\"\n counter = 0\n end\n printf \"%-4s\", node\n counter = counter + 1\n end\n end", "def print(*rest) end", "def print(*rest) end", "def print(*rest) end", "def print(*rest) end", "def print\n if self.head == nil\n p \"\"\n elsif self.head == self.tail\n $stdout.print(\"#{self.head.data}\\n\")\n else\n output = \"\"\n temp_node = self.head\n while temp_node != nil\n output += \"#{temp_node.data}\\n\"\n temp_node = temp_node.next\n end\n $stdout.print(output)\n end\n end", "def print_tree\n if root.children\n puts \" - root : #{root.children.length} - \"\n root.children.each(&:print_node)\n puts ''\n end\n end", "def post_order_print(start, traversal = \"\")\n return traversal unless start\n\n traversal = post_order_print(start.left, traversal)\n traversal = post_order_print(start.right, traversal)\n traversal += \"#{start.value}-\"\n end", "def print(node = root)\n puts %( ) * node.level + \"#{node}\"\n node.children.each do |child|\n print(child)\n end\n true\n end", "def printnodes(node, level)\r\n\theader(level)\r\n\tputs node\r\n\tif node.nodes?\r\n\t\ttemp = Array.new\r\n\t\tnode.nodes.each { |n|\r\n\t\t\tif n == nil\r\n\t\t\t\theader(level + 1)\r\n\t\t\t\tputs \":\"\r\n\t\t\telsif n == node.parent\r\n\t\t\t\theader(level + 1)\r\n\t\t\t\tputs node\r\n\t\t\telsif !temp.include?(n)\r\n\t\t\t\ttemp << n\r\n\t\t\telse\r\n\t\t\t\theader(level + 1)\r\n\t\t\t\tputs node\r\n\t\t\tend\r\n\t\t}\r\n\t\tif !temp.empty?\r\n\t\t\ttemp.each { |n|\r\n\t\t\t\tprintnodes(n, level + 1)\r\n\t\t\t}\r\n\t\tend\r\n\tend\r\nend", "def printf(children=nil)\n queue = [@root]\n result = \"\"\n\n until queue.empty?\n temp_root = queue.shift\n\n unless temp_root.left == nil\n queue << temp_root.left\n end\n unless temp_root.right == nil\n queue << temp_root.right\n end\n\n result << \"#{temp_root.title}: #{temp_root.rating}\\n\"\n end\n\n puts result\n end", "def print\n puts SEPARATOR\n puts @name\n puts SEPARATOR\n puts @desc\n if(@diagram)\n puts\n puts \"Diagram:\"\n puts\n puts @diagram\n end\n end", "def printf(children=nil)\n if @root != nil\n queue = Queue.new\n queue.enq(@root)\n result = nil\n while !queue.empty?\n node = queue.deq\n puts(node.to_s)\n queue.enq(node.left) if node.left\n queue.enq(node.right) if node.right\n end\n end\n end", "def printf(children=nil)\n queue = [@root]\n\n queue.each do |current|\n puts \"#{current.value}\"\n if current.left && current.right\n queue << current.left << current.right\n elsif current.left\n queue << current.left\n elsif current.right\n queue << current.right\n end\n end\n end", "def checked_print object = ''\n print object\n @prev_printed = true\n end", "def printf(children=nil)\n list = \"\"\n queue = MyQueue.new()\n queue.enqueue(@root)\n while queue.empty? != true\n list << \"#{queue.head.title}: #{queue.head.rating}\\n\"\n queue.enqueue(queue.head&.left) if queue.head.left\n queue.enqueue(queue.head&.right) if queue.head.right\n queue.dequeue\n end\n p list\n end", "def printf(children=nil)\n if children == nil\n children = [@root]\n end\n arr = []\n children.each do |ele|\n puts \"#{ele.title}: #{ele.rating}\"\n arr << ele.left if ele.left != nil\n arr << ele.right if ele.right != nil\n end\n if arr.size == 0\n return nil\n else\n printf(arr)\n end\n end", "def print_postfix(node)\n return if node == nil\n print_postfix(node.left) #starts recursion -- go left\n print_postfix(node.right) #go right\n print node.value + \" \" #print contents of this node\nend", "def printf(children=nil)\n if @root.nil?\n return nil\n else\n for i in @root\n puts i\n end\n end\n end", "def print\n end", "def level_order_print(start, traversal = \"\")\n return traversal unless start\n\n queue = Queue.new\n queue << start\n\n while queue.size > 0 do\n node = queue.pop\n traversal += \"#{node.value}-\"\n queue << node.left if node.left\n queue << node.right if node.right\n end\n\n traversal\n end", "def printf()\n #node object array\n children = []\n\n #info array\n arr = []\n arr.push(\"#{@root.title}: #{@root.rating}\")\n if @root.left != nil\n children.push(@root.left)\n end\n if @root.right != nil\n children.push(@root.right)\n end\n\n # adds nodes to children array AND pushes data to arr\n children.each do |node|\n if node.left != nil\n children.push(node.left)\n end\n if node.right != nil\n children.push(node.right)\n end\n arr.push(\"#{node.title}: #{node.rating}\")\n end\n\n puts arr\n end", "def print_tree(indent = 0, lines = [])\n lines << (\" \" * indent) + self.to_s\n @nodes.keys.sort.each do |reference|\n node = @nodes[reference]\n if node.is_a? APISpec::Namespace\n node.print_tree(indent + 1, lines)\n else\n lines << (\" \" * (indent + 1)) + \"#{reference} => #{node.to_s}\"\n end\n end\n lines.join(\"\\n\")\n end", "def print\n placeholder = @head\n list = \"\"\n while placeholder.next\n list += placeholder.data + \"\\n\"\n placeholder = placeholder.next\n end\n list += placeholder.data + \"\\n\" # the plus \"\\n\" added because of the way the spec is written.\n printf list\n end", "def print\n temp = @first\n while !temp.nil?\n printf \" #{temp.value}\"\n temp = temp.next\n end\n end", "def print_tree(out = $stdout)\n out.puts \"## Class: #{name}\"\n out.puts \" Visible Name: #{visible_name}\"\n out.puts \" Description : #{description}\"\n tables.each do |table|\n table.print_tree(out)\n end\n end", "def print_prefix(node)\n return if node == nil\n print node.value + \" \" #print contents of this node\n print_prefix(node.left) #starts recursion -- go left\n print_prefix(node.right) #go right\nend", "def printf(children=nil)\n children = [@root] if children.nil?\n grand_children = []\n children.each do |node|\n puts \"#{node.title}: #{node.rating}\\n\"\n grand_children.push(node.left) if node.left\n grand_children.push(node.right) if node.right\n end\n printf(grand_children) unless grand_children.empty?\n end", "def print\n\n end", "def printf(children=nil)\n line = [@root]\n\n line.each do |i|\n puts \"#{i.title}: #{i.rating}\"\n if i.left\n line << i.left\n end\n if i.right\n line << i.right\n end\n end\n end", "def print()\r\n temp = @first\r\n while !temp.nil?\r\n printf \" #{temp.value}\"\r\n temp = temp.next\r\n end\r\n end", "def printf(children=nil)\n \n queue = [@root]\n output = \"\"\n \n until queue.empty?\n traversal = queue.shift\n queue << traversal.left if traversal.left\n queue << traversal.right if traversal.right\n \n output += \"#{traversal.title}: #{traversal.rating}\\n\"\n end\n \n puts output\n end", "def print\r\n temp = @first\r\n while !temp.nil?\r\n printf \" #{temp.value}\"\r\n temp = temp.next\r\n end\r\n end", "def print\r\n temp = @first\r\n while !temp.nil?\r\n printf \" #{temp.value}\"\r\n temp = temp.next\r\n end\r\n end", "def print\n PascalRow.print_row_ary(row_ary, idx: idx, max_id: @max_id, max_padding: @max_padding)\n end", "def print_recursive_menu(menu_entry)\n menu_children = MenuEntry.find_all_by_parent_id(menu_entry.id)\n current_entry = \"<li>\" + menu_link(menu_entry) + \"</li>\"\n return current_entry if menu_children.size == 0\n current_entry = \"<li>\" + menu_link(menu_entry) + \"<ul>\"\n for menu_child in menu_children do\n current_entry += print_recursive_menu(menu_child)\n end\n current_entry += \"</ul></li>\"\n return current_entry\n end", "def printDepthFirst()\n # println(\"printDepthFirst\");\n # # // global fileCounter\n # @fileCounter = 0;\n # printRealDepthFirst(0,-1);\n # println(fileCounter+\" files\");\n end", "def print\n output = \"\"\n current_node = self.head\n\n until current_node.nil?\n output += current_node.data + \"\\n\"\n current_node = current_node.next\n end\n\n puts output\n end", "def pretty_print\n puts `ruby -r pp -e 'pp(#{@template.inspect})'`\n end", "def printf(children=nil)\n if children.nil?\n children = [@root]\n end\n next_row = []\n children.each do |child|\n puts \"#{child.title}: #{child.rating}\"\n next_row.push(child.left) if !child.left.nil?\n next_row.push(child.right) if !child.right.nil?\n end\n if next_row.size == 0\n nil\n else\n printf(next_row)\n end\n end", "def print\r\n temp = @first\r\n while !temp.nil?\r\n printf \"#{temp.value} \"\r\n temp = temp.next\r\n end\r\n end", "def pre_order_print(start, traversal = \"\")\n return traversal unless start\n\n traversal += \"#{start.value}-\"\n traversal = pre_order_print(start.left, traversal)\n pre_order_print(start.right, traversal)\n end", "def printf\n queue = [@root]\n str = \"\"\n\n while queue != []\n current = queue.shift\n str << \"#{current.title}: #{current.rating}\\n\"\n queue.push(current.left) if current.left\n queue.push(current.right) if current.right\n end\n\n puts str\n end", "def print_tree_perimeter(root)\n print \"print\"\nend", "def print\n \tlist = ''\n \tcurrent = @head\n \twhile !current.nil?\n list = list + \"#{current.value}\"\n list = list + ' ' if current.next != nil \n current = current.next\n \tend\n \tlist\n end", "def printTree(root = @root, indentation = \"\\n\")\r\n #print root the first time running mehtod, the rest will be printed as children\r\n puts \"#{indentation}#{root.value}\" if root == @root\r\n root.children.each do | child |\r\n puts \"#{indentation}\\t#{child.value}\\n\"\r\n #if there are children, again\r\n printTree(child, indentation + \"\\t\") if child.children.any?\r\n end\r\n end", "def pretty_print(pp)\n Yadriggy::simpler_pretty_print(pp, self, '@parent')\n end", "def pp(indent=0)\n ret = \" \"*indent + \"#{quote(@name)}\"\n case @subsections.count\n when 0\n ret += \"\\n\"\n when 1\n ret += \" \"[email protected][1].pp(indent).lstrip\n else\n ret += \" {\\n\"\n @subsections.each { |n,s|\n ret += s.pp(indent+2)\n }\n ret += \" \"*indent + \"}\\n\"\n end\n ret\n end", "def printf\n queue = Queue.new\n queue.enq(@root)\n until queue.empty?\n value = queue.deq\n puts value unless value.title.nil?\n queue.enq(value.left) if value.left\n queue.enq(value.right) if value.right\n end\n end", "def print\n end", "def print\n end", "def print\n end", "def disp_node(node, depth)\n# mon_string = ''\n# depth.times {mon_string+=' '}\n# mon_string += \"- #{node.name}\"\n# `echo \"#{mon_string}\" >> toto.txt`\n\n # depth.times {print ' '}\n # puts \"- #{node.name}\"\n self.graph.each_adjacent node do |adj_node|\n disp_node adj_node, depth+1\n end\n end", "def print(depth)\n spaces = \" \".freeze * depth\n \"#{left_stats} #{spaces} └── #{@node.name}\"\n end", "def prn\n puts \" #{(0..8).to_a.join(\" \")}\"\n puts \" #{'-' * (2 * 9)}\"\n g.each_with_index do |v, i|\n # ERROR: print function doesn't display values and doesn't use colors\n # puts \"#{i} #{v.join(\" \")}\"\n puts \"#{i} | #{v.map{|t| t.n.to_s.colorize(t.c) }.join(' ')}\"\n end\n end", "def print_tree(out = $stdout)\n out.puts \"### LookupTable: #{name}\"\n out.puts \" Resource: #{resource_id}\"\n out.puts \" Required: #{table_fragment['Required']}\"\n out.puts \" Searchable: #{ table_fragment[\"Searchable\"] }\"\n out.puts \" Units: #{ table_fragment[\"Units\"] }\"\n out.puts \" ShortName: #{ table_fragment[\"ShortName\"] }\"\n out.puts \" LongName: #{ long_name }\"\n out.puts \" StandardName: #{ table_fragment[\"StandardName\"] }\"\n out.puts \"#### Types:\"\n\n lookup_types.each do |lookup_type|\n lookup_type.print_tree(out)\n end\n end", "def to_s\r\n self.each do |r|\r\n puts r.each { |p| p }.join(\" \")\r\n end\r\n end", "def generatePrintAvlTree(times_to_gen)\n\n\txml_result = \"\"\n\ttimes_to_gen.times {\n\t\txml_result += \"\\n<printAvlTree id=\\\"6\\\" />\"\n\t}\n\n\treturn xml_result\n\nend", "def print_out(print_info)\n line_width = 40\n \n puts print_info[0][0].center(line_width) #we print the title first\n \n print_info[1].each_with_index do |v,i| #we use each_with_index so that we can loop through each element in the sub-arrays\n print \"Chapter #{i + 1}: #{print_info[1][i].ljust(line_width/2)}\" #prints out the prefix \"Chapter#:\" and the names\n print \"Page #{print_info[2][i]}\".rjust(line_width/2) #prints out the \n print \"\\n\"\n end\n \n\nend" ]
[ "0.77244544", "0.7155743", "0.7146073", "0.70287025", "0.68105376", "0.6796006", "0.6752244", "0.6714344", "0.66835916", "0.6529089", "0.6493609", "0.6486903", "0.6446816", "0.64244366", "0.64244366", "0.6413528", "0.63938963", "0.63687193", "0.63686424", "0.6367435", "0.6351513", "0.63300246", "0.6328894", "0.628995", "0.62866676", "0.6283337", "0.6261784", "0.62446016", "0.6201253", "0.6195259", "0.6187533", "0.61828905", "0.618233", "0.61775094", "0.6159421", "0.6148097", "0.61140144", "0.6112998", "0.6108351", "0.6108351", "0.6108351", "0.6108351", "0.6101461", "0.6101461", "0.6101461", "0.6101461", "0.60942364", "0.60786456", "0.60729903", "0.60699534", "0.6065721", "0.6055865", "0.60511374", "0.60496706", "0.6048772", "0.604222", "0.6039576", "0.60372144", "0.60349655", "0.60303396", "0.6030109", "0.6019069", "0.60068315", "0.59992766", "0.5990775", "0.5987753", "0.59868497", "0.59854174", "0.5974383", "0.59731406", "0.5968876", "0.59596306", "0.59591913", "0.59582317", "0.59582317", "0.5939472", "0.5939017", "0.5929129", "0.5921624", "0.5921003", "0.59196913", "0.5917577", "0.5915082", "0.5909066", "0.5902914", "0.59009707", "0.5899412", "0.5897327", "0.58953947", "0.58889365", "0.58879125", "0.58879125", "0.58879125", "0.5885518", "0.58817744", "0.5874754", "0.5874054", "0.586683", "0.5866009", "0.58648634" ]
0.59771025
68
sort small items ascending by how many will fit with a large item
def compare(x,y) a = CachedProduct.find_by_product_id(x['product_id'].to_s) b = CachedProduct.find_by_product_id(y['product_id'].to_s) return a.max_small <=> b.max_small end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bigSorting(unsorted)\n\nend", "def sort_by_size(x,y)\n sizes = [\"Small\",\"Medium\",\"Large\",\"X-Large\",\"2X-Large\",\"3X-Large\"]\n cmp = sizes.index(x.tshirt) <=> sizes.index(y.tshirt)\n if cmp == 0\n x.name <=> y.name\n else\n cmp\n end\n end", "def sort(companies)\n companies.sort_by do |company|\n -company.size\n end \nend", "def quick_sort(fishies)\n ref = fishies.first\n smaller = fishies.select { |fish| fish.length < ref.length }\n bigger = fishies.select { |fish| fish.length > ref.length }\n return fishies if fishies.length <= 1\n\n (quick_sort(smaller) + [ref] + quick_sort(bigger))\nend", "def sort_trophies_by_priority(trophies)\n #number of trophies per row\n per_row_small = 16\n per_row_medium = 4\n per_row_large = 1\n\n\n rows = []\n per_row = per_row_small + per_row_medium + per_row_large\n num_rows = (trophies.size / per_row.to_f).ceil\n (1..num_rows).each {rows << {:far_left => [],:left => [],:center => [],:right => [],:far_right => []}}\n i = 0\n trophies.each do |trophy|\n #fill center first\n if i < num_rows*per_row_large\n rows[i/per_row_large][:center] << trophy\n #fill left and right rows next\n elsif i < (num_rows*per_row_medium+num_rows*per_row_large)\n j = i - num_rows\n if j.even?\n rows[j/per_row_medium][:left] << trophy\n else\n rows[j/per_row_medium][:right] << trophy\n end\n #fill far left and far right rows next\n elsif i < (num_rows* per_row_small + num_rows*per_row_medium+num_rows)\n j = i - num_rows*per_row_medium - num_rows\n if j.even?\n rows[j/per_row_small][:far_left] << trophy\n else\n rows[j/per_row_small][:far_right] << trophy\n end\n end\n i = i + 1\n end\n rows\n end", "def sort_entries; end", "def sort_items_by_profitability!(items)\n items.sort_by! do | i |\n wi = i[:w]\n [Rational(wi,i[:p]), wi]\n end\nend", "def 500_files(input)\n # naive solution is to flatten and sort\n\n \nend", "def sort_by_size\n @mappers << Proc.new do |allocations|\n allocations.sort_by { |key, value| -value.size }\n .inject({}) { |hash, pair| hash[pair[0]] = pair[1]; hash }\n end\n\n self\n end", "def sort_by_tag_count_with_random_buckets\n end", "def sort_sublists_by_length\n sort_by { |array| array.size }\n end", "def sort_companies companies\n sorted_companies = companies.sort {|company1, company2| company1.size <=> company2.size}\n company_information_strings sorted_companies\nend", "def sort_items\n items.sort! { |a, b| a[:w] <=> b[:w] }\n end", "def get_planet_names_sorted_by_size_decreasing()\n planets_sorted_by_size = @planets.sort_by { |planet| planet.diameter }\n planets_sorted_by_size_decreasing = planets_sorted_by_size.reverse\n planets_sorted_by_size_decreasing.map { |planet| planet.name }\n\nend", "def sort_by_tag_count\n end", "def sort_popular_jobs\n Application.group(:job).count.sort_by do |job|\n job[1]\n end.reverse\n end", "def paged_items\n result = [[]]\n i = 0\n sorted_items.each do |x|\n if x.is_a?(SurveyItems::PageBreak)\n result << []; i += 1\n else\n result[i] << x\n end\n end\n result\n end", "def bucket_sort(array, min, max)\n return array if array.size < 2\n\n b_size = 10\n # if we instanciate this with [] it instanciat eit with the same object\n # then when we insert to on of the indeces it inserts to all\n bucket = Array.new((max - min + 1)/b_size + 1)\n array.each do |a|\n if bucket[a/b_size].nil?\n bucket[a/b_size] = [a]\n else\n bucket[a/b_size] << a\n end\n end\n\n bucket.each do |b|\n insertion_sort_more_efficient(b)\n end\n \n bucket.flatten\nend", "def count_sort(a)\n\t\nend", "def sort_categories_by_price(categorized_items)\n sorted_categories = Array.new\n categorized_items.each{ |sub_array|\n if sub_array.size > 1\n sorted_categories.push(sort_category_by_price(sub_array))\n else\n sorted_categories.push(sub_array)\n end\n }\n sorted_categories\n end", "def stable_sort_by(list); end", "def test_merge_sort_large\n card_1 = Card.new(\"4\",\"Hearts\")\n card_2 = Card.new(\"3\", \"Clubs\")\n card_3 = Card.new(\"5\", \"Diamonds\")\n card_4 = Card.new(\"1\",\"Hearts\")\n card_5 = Card.new(\"Jack\", \"Clubs\")\n card_6 = Card.new(\"Ace\", \"Diamonds\")\n card_7 = Card.new(\"7\", \"Diamonds\")\n deck = Deck.new([card_1, card_2, card_3, card_4, card_5, card_6, card_7])\n assert_equal [card_4, card_2, card_1, card_3, card_7, card_5, card_6], deck.merge_sort\n end", "def shell_sort(a)\n i = 0\n j = 0\n size = a.length\n increment = size / 2\n temp = 0\n \n while increment > 0\n i = increment\n while i<size\n j = i\n temp = a[i]\n while j>=increment and a[j-increment]>temp\n a[j] = a[j-increment]\n j = j-increment\n end\n a[j] = temp\n i+=1\n end\n if increment == 2\n increment = 1\n else\n increment = (increment/2).to_i\n end\n end\n return a\nend", "def heal!(collection)\n memory = {}\n changed = false\n\n collection.select(&:sort_order).sort_by(&:sort_order).each do |item|\n\n if memory[1].nil?\n memory[1] = item\n item.update(sort_order: 1)\n next\n end\n\n # Found duplicate sort_item\n if memory[item.sort_order]\n memory.sort.each do |order, item|\n if not memory[order + 1].present?\n memory[order+1] = item\n item.update(sort_order: order + 1)\n changed = true\n next\n end\n end\n\n next\n end\n\n # Found gap of 1\n if memory[item.sort_order.to_i - 1].nil?\n s = item.sort_order.to_i - 1\n s.times do |n|\n if memory[n].nil?\n memory[n] = item\n item.update(sort_order: n)\n changed = true\n next\n end\n end\n end\n\n if memory[item.sort_order].nil?\n memory[item.sort_order] = item\n next\n end\n\n end\n\n heal! collection if changed\n end", "def sort\n @items.sort { |x,y| x.rank <=> y.rank }\n end", "def dominant_octopus(fish_array)\n results = fish_array.my_quick_sort {|left, right| left.length <=> right.length}\n\n results.last\nend", "def orderItem()\r\n$globalArr = $globalArr.sort_by { |e| e[2] }\r\nfinalAns = []\r\nfinalAns.push($globalArr.shift)\r\n\twhile $globalArr.size > 0\r\n\t\tcurrentPost = finalAns.last\r\n\t\tcurrentPostRow = currentPost[1][0]\r\n\t\tcurrentPostCol = currentPost[1][1]\r\n\t\tfor r in 0...$globalArr.length\r\n\t\t\tpos = $globalArr[r][1]\r\n\t\t\tdistanceFromPreviousItem = calculateDistance(currentPostRow, currentPostCol, pos[0], pos[1])\r\n\t\t\t$globalArr[r][2] = distanceFromPreviousItem\r\n\t\tend\r\n\t\t$globalArr = $globalArr.sort_by { |e| e[2] }\r\n\t\tfinalAns.push($globalArr.shift)\r\n\tend\r\n\t$BestAns.push(finalAns.collect {|ind| ind[0]})\r\n\t#puts \"Order By Greedy: \" + finalAns.collect {|ind| ind[0]}.to_s\r\nend", "def lineup_students(students)\n students.sort_by { |x| x.length }\nend", "def sortItems()\n @usableItems = (@usableItems ||= []).sort_by { |x| x.to_s }\n end", "def sort\n sorted = []\n\n # Iterate Over Array Length\n array_length.times do\n m = randomized_array[0]\n mi = 0\n\n # Iterate over collection and compare the first element in the collection\n # Change the value of variable m if iterated value is less than the initial value\n # Our goal is to set the lowest value as variable m's value\n randomized_array.each_with_index do |value, idx|\n if value < m\n m = value\n mi = idx\n end\n end\n # Remove the lowest value from the original collection and append into new\n # collection\n randomized_array.delete_at mi\n sorted << m\n end\n\n sorted\n end", "def custom_sort (unsorted, sorted = [])\n return sorted.uniq if unsorted.length == 0\n smallest = unsorted[0]\n unsorted.each {|x| smallest = x if x <= smallest}\n\n unsorted.each {|x| sorted << x if x <= smallest }\n\n unsorted.delete(smallest)\n custom_sort(unsorted, sorted)\nend", "def sort_it(list_, n)\n # Your code goes here\nend", "def files_500(files)\n prc = Proc.new { |x, y| x[0] <=> y[0] }\n heap = BinaryMinHeap.new()\n result = []\n\n files.length.time do |i|\n heap.push([files[i][0], i, 0])\n end\n\n while heap.count > 0\n min = heap.extract\n result << min[0]\n\n next_arr_i = min[1]\n next_idx = min[2] + 1\n next_el = files[next_arr_i][next_idx]\n\n heap.push([next_el, next_arr_i, next_idx]) if next_el\n end\n result\nend", "def list_items(grocery_list)\n grocery_list.sort!\n grocery_list.each do |item|\n puts \"* #{item}\"\n end\n puts \"#{grocery_list.length} items on the list right now\"\nend", "def size_limiter(sizes, n)\n res = []\n\n until res.length == n do\n sampled = sizes.sample\n\n if res.include?(sampled)\n next\n else\n res.push(sampled)\n end\n end\n\n return res.sort!\nend", "def mark_sort array\n array_max = array.max\n array_min = array.min\n markings = [0] * (array_max - array_min + 1)\n array.each do |a|\n markings[a - array_min] += 1\n end\n\n res = []\n markings.length.times do |i|\n markings[i].times do\n res << i + array_min;\n end\n end\n\n res\nend", "def shell_sort(a)\n n = a.length # Size of input\n h = 1\n h = h * 3 + 1 while h < n / 3\n\n while h >= 1\n i = h\n while i < n\n j = i\n while j >= h && a[j] < a[j - h]\n temp = a[j - h]\n a[j - h] = a[j]\n a[j] = temp\n\n j -= h\n end\n i += 1\n end\n h = (h / 3).to_i\n end\n a\nend", "def bucketSort(a, n, buckets, m)\n for j in 0 ... m\n buckets[j] = 0\n end\n for i in 0 ... n\n buckets[a[i]] += 1\n end\n i = 0\n for j in 0 ... m\n for k in 0 ... buckets[j]\n a[i] = j\n i += 1\n\tend\n end\nend", "def sort_checks_on_new_jobs\n @total_jobs_hash = @total_jobs.index_by(&:id)\n @checks.sort_by! do |check|\n if check.job.split_parent_job_id.present? || check.job.parent_job_id.present?\n split_image_values = check.job.initial_image_name.split('.').first.split('_').from(1)\n @compare_job = check.job\n split_image_values.length.times do |t|\n if check.job.split_parent_job_id.present?\n @compare_job = @total_jobs_hash[@compare_job.split_parent_job_id]\n elsif check.job.parent_job_id.present?\n @compare_job = @total_jobs_hash[@compare_job.parent_job_id]\n end\n end\n \"#{@compare_job.id}.#{split_image_values.present? ? split_image_values.join() : '0'}\".to_f\n else\n check.job_id.to_f\n end\n end\n end", "def my_quick_sort(&prc)\n prc ||= Proc.new{|a,b| a <=> b}\n return self if self.length <= 1\n mdix = self.length()/2\n left = []\n right = []\n # debugger\n self.each_with_index do |item, idx|\n case prc.call(item,self[mdix])\n when -1 #a smaller\n left << item\n when 0\n left << item if idx != mdix\n when 1\n right << item\n end\n end\n # debugger\n left.my_quick_sort(&prc) + [self[mdix]] + right.my_quick_sort(&prc)\n end", "def rec_sort unsorted, sorted\n if unsorted.length <= 0\n return sorted\n end\n#\n#start smallest using 'pop' word and move to sorted list\nsmallest = unsorted.pop\nstill_unsorted = []\n#if tested word from unsorted is less then put\n#smallest into still_unsorted and move tested to smallest\nunsorted.each do |tested_object|\n if tested_object < smallest\n still_unsorted.push smallest\n smallest = tested_object\n#otherwise put tested_object into still_unsorted\n else\n still_unsorted.push tested_object\n end\n#push smallest into sorted\n sorted.push smallest\n #calls method recursively again\n rec_sort still_unsorted, sorted\nend\nend", "def priority_sort(result_list, free_bandwidth)\n priority_list = result_list.sort\n new_results = []\n priority_index = 0\n priority_list.each_index do |i|\n result = \"PASSED\"\n priority_index = priority_list[i].slice!(/^\\d+/).to_i\n bc = priority_list[i].split(\"|\")[0].unpack(\"a2a2a2\")\n if bc[2] == \"BF\"\n # fails if minimum failed and it's the top priority stream\n result = \"FAILED\" if bc[0] == \"YM\" && i == 0\n # fails if minimum failed and there was free bandwidth\n result = \"FAILED\" if bc[0] == \"YM\" && free_bandwidth > 0\n # fails if the bandwidth is over maximum specified\n result = \"FAILED\" if bc[1] == \"YN\"\n end\n new_results << priority_list[i].split(\"|\")[1].insert(0, \"[#{priority_index >= 0 ? sprintf(\"%d\", priority_index) : \"NONE\"}] [#{result}] \")\n end\n return new_results\nend", "def wiggle_sort(nums)\n nums = nums.sort!\n\n greater_num_idx = nums.length / 2\n lesser_num_idx = 1\n\n until lesser_num_idx >= greater_num_idx\n nums[lesser_num_idx], nums[greater_num_idx] = nums[greater_num_idx], nums[lesser_num_idx]\n lesser_num_idx += 2\n greater_num_idx += 1\n end\n nums\nend", "def sort_by_length(my_sentence)\n words = my_sentence.split(/\\W+/)\n\n words.size.times do |first_index| \n min_index = first_index\n\n (words.size-first_index).times do |subarray_index|\n if words[first_index+subarray_index].length < words[min_index].length \n min_index = first_index + subarray_index\n end\n end\n \n unless min_index == first_index #don't swap the same index with itself\n holder = words[first_index]\n words[first_index] = words[min_index]\n words[min_index] = holder\n end\n end\n\n return words\nend", "def integer_pigeonhole_sort(numbers)\n sorted = []\n\n numbers.length.times do |i|\n sorted << i\n end\n\n sorted\nend", "def run_bf(items)\n\n counts = Hash.new{|h,k| h[k] = 0}\n\n items.each {|item| counts[item] += 1 }\n \n dd = items.length / 10\n \n results = []\n counts.each {|item, count|\n results << item if count > dd\n }\n \n return results\n end", "def proefssorted\n \tproefs.order(:position)\n end", "def sort!\n\t\tquick!(self, 1, length)\n\tend", "def container_sort(things)\n things = things.sort do |a,b|\n if a.children.length > 0\n if b.children.length > 0\n a.name < b.name ? -1 : 1\n else\n -1\n end\n else\n if b.children.length > 0\n 1\n else\n a.name < b.name ? -1 : 1\n end\n end\n end\n things\n end", "def lfsort(list)\n freqs = Hash.new(0) # map from length to frequency\n list.each { |v| freqs[v.length] += 1 }\n merge_sort(list) { |a,b| freqs[a.length] <=> freqs[b.length] }\nend", "def bubble_sort_2(items)\n n = items.size\n iterations = 0\n \n for a in (0...n) do # same as (0...n).each do |a| ..... end\n swapped = false\n for b in (0...(n - a - 1)) do\n if items[b] > items[b + 1] \n tmp = items[b + 1]\n items[b + 1] = items[b]\n items[b] = tmp\n swapped = true\n end\n iterations += 1\n end\n break unless swapped\n end\n p \"Total iterations: #{iterations}\"\n items\nend", "def sort_by_popularity\n @song_data = @song_data.sort_by {|x| [-x[:plays], x[:index]] }\n end", "def sorted_tags\n get_tags.sort_by {|k,v| v}.reverse.unshift [\"All items\", self.items.count]\n end", "def select_sort(x)\n\n smallest = 0\n\n x.length().times do |index|\n smallest = index\n (index..x.length()-1).each do |check|\n if x[check] < x[smallest]\n smallest = check\n end\n end\n temp = x[index]\n x[index] = x[smallest]\n x[smallest] = temp\n end\n\n return x\nend", "def sortByHeight(a)\n treeArray = Array.new\n \n b = a.sort\n b = b.select {|item| item != -1}\n \n for i in 0..(a.count-1)\n if a[i] != -1\n num = b.shift\n a[i] = num\n end\n end\n \n a\nend", "def rec_sort unsorted, sorted \n\tif unsorted.length <= 0\n\n# sorted is an array\n\treturn sorted \n\tend\n\n# So if we got here, then it means we still have work to do.\n# take last one out of unsorted, call it smallest\nsmallest = unsorted.pop\n#create en empty 'still unsorted' array \nstill_unsorted = []\n\n#testing if each object in unsorted is smaller than 'smallest' \n\tunsorted.each do |tested_object| \n\t#if tested object is smaller than smallest then push them in still unsorted\n\t\tif tested_object.downcase < smallest.downcase\n\t\t\tstill_unsorted.push smallest\n\t\t\tsmallest = tested_object\n\t\telse\n\t\t\tstill_unsorted.push tested_object\n\t\tend \n\tend\n# Now \"smallest\" really does point to the\n# smallest element that \"unsorted\" contained,\n# and all the rest of it is in \"still_unsorted\". \nsorted.push smallest\n\nrec_sort still_unsorted, sorted\nend", "def bitonic_sort(array)\n return array if array.length <= 1\n\n length = array.length\n num = nearest_power_of_2(array.length)\n\n # add place holder values\n array << Float::INFINITY until array.length == num\n\n array = bitonic_recurse(array, 0, array.length, 1)\n\n # remove place holder values\n array.pop until array.length == length\n\n array\nend", "def merge_sort(fishes)\n return fishes if self.length <= 1\n mid = fishes.length / 2\n sort_left = fishes.take(mid).merge_sort(fishes)\n sort_right = fishes.drop(mid).merge_sort(fishes)\n merge(sort_left, sort_right)\nend", "def sort\n limit = array.size - 1\n (0..limit).each do |index|\n min = index\n (index..limit).each do |target|\n min = target if array[min] > array[target]\n end\n array[index], array[min] = array[min], array[index]\n end\n array\n end", "def huangtang(items, already_sorted = false)\n items = sort_items_by_profitability!(items.clone) unless already_sorted\n \n n = items.length-1\n h0 = 0\n (1..n).each do | j |\n min = items[0][:w].lcm(items[j][:w]) - items[j][:w]\n (1..(j-1)).each do | i |\n x = items[i][:w].lcm(items[j][:w]) - items[j][:w] \n min = x if x < min\n end\n h0 += min\n end\n\n h0 + 1\nend", "def merge(arr1, arr2)\n big_arr = arr1 + arr2\n sorted_arr = []\n\n until big_arr.empty?\n saved_num = big_arr.shift\n if big_arr.all? { |num| num >= saved_num }\n sorted_arr << saved_num\n else\n big_arr.push(saved_num)\n end\n end\n sorted_arr\nend", "def pbArrangeByTier(pokemonlist,rule)\n tiers=[\n withRestr(rule,0,500,0),\n withRestr(rule,380,500,0),\n withRestr(rule,400,555,0),\n withRestr(rule,400,555,0),\n withRestr(rule,400,555,0),\n withRestr(rule,400,555,0),\n withRestr(rule,580,680,1),\n withRestr(rule,500,680,0),\n withRestr(rule,580,680,2)\n ]\n tierPokemon=[]\n for i in 0...tiers.length\n tierPokemon.push([])\n end\n for i in 0...pokemonlist.length\n next if !rule.ruleset.isPokemonValid?(pokemonlist[i])\n validtiers=[]\n for j in 0...tiers.length\n tier=tiers[j]\n if tier.ruleset.isPokemonValid?(pokemonlist[i])\n validtiers.push(j)\n end\n end\n if validtiers.length>0\n vt=validtiers.length*i/pokemonlist.length\n tierPokemon[validtiers[vt]].push(pokemonlist[i])\n end\n end\n # Now for each tier, sort the Pokemon in that tier\n ret=[]\n for i in 0...tiers.length\n tierPokemon[i].sort!{|a,b|\n bstA=baseStatTotal(a.species)\n bstB=baseStatTotal(b.species)\n if bstA==bstB\n a.species<=>b.species\n else\n bstA<=>bstB\n end\n }\n ret.concat(tierPokemon[i])\n end\n return ret\nend", "def qsort(a, lower, upper)\r\n if lower < upper\r\n mid = partition(a, lower, upper)\r\n qsort(a, lower, mid)\r\n qsort(a, mid+1, upper)\r\n end\r\n return a\r\nend", "def sean_sort(numbers)\n\n\nend", "def selection_sort(random_num)\n min_num_index = 0\n for i in 0..(random_num.length - 2) do\n\n min_num_index = i\n for j in (0 + i)..(random_num.length - 2) do\n if random_num[min_num_index] >= random_num[j + 1]\n min_num_index = (j + 1)\n end\n end\n tmp_num = random_num[i]\n random_num[i] = random_num[min_num_index]\n random_num[min_num_index] = tmp_num\n end\n random_num\nend", "def collection_order(items) #nicer collection method - the unnecessary loops and arrays. (task 6)\n\n item_indexes = []\n collection_order = []\n\n for item in items\n item_indexes << find_index_at_value(item)\n end\n\n sorted_indexes = item_indexes.sort\n\n for index in sorted_indexes\n collection_order = collection_order << WAREHOUSE[index].keys[0].to_s\n end\n\nreturn collection_order\n\nend", "def sort_cards_by_value_bis!()\r\n\t\taucun_echange=false\r\n\t\twhile aucun_echange==false\r\n\t\t\taucun_echange=true\r\n\t\t\[email protected]\r\n\t\t\tfor i in 0..len\r\n\t\t\t\tif !@list[i].nil? and !@list[i+1].nil?\r\n\t\t\t\t\tif @list[i].get_value_bis<@list[i+1].get_value_bis\r\n\t\t\t\t\t\ttemp=@list[i]\r\n\t\t\t\t\t\t@list[i]=@list[i+1]\r\n\t\t\t\t\t\t@list[i+1]=temp\r\n\t\t\t\t\t\taucun_echange=false\r\n\t\t\t\t\t\tbreak\r\n\t\t\t\t\telsif @list[i].get_value_bis == @list[i+1].get_value_bis\r\n\t\t\t\t\t\[email protected]_at(i)\r\n\t\t\t\t\t\taucun_echange=false\r\n\t\t\t\t\t\tbreak\r\n\t\t\t\t\tend\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\tend\r\n\tend", "def largest companies \n size = 0\n biggest = companies.each do |company|\n if company.size > size \n size = company.size\n end \n end \nend", "def dominant_sort(fish)\n return fish if fish.length <= 1\n\n mid = fish.length / 2\n\n left = fish[0...mid]\n right = fish[mid..-1]\n\n left_sorted = dominant_sort(left)\n right_sorted = dominant_sort(right)\n\n sorted = dominant_merge(left_sorted, right_sorted)\nend", "def improved_poorly_written_ruby(*arrays)\n sorted = []\n arrays.flatten.each do |v|\n size = sorted.size\n if sorted.empty?\n sorted.push(v)\n else\n i = 0\n while i < size\n item = sorted[i]\n if item > v\n sorted.insert(i, v)\n break\n elsif i == size - 1\n sorted.push(v)\n break\n end\n i += 1\n end\n end\n end\n sorted\nend", "def medium_risks_unique_sorted\n\t\t\t\t\tItem.where(:severity => 2).group(:plugin_id).order(Arel.sql('COUNT(*) DESC'))\n\t\t\t\t\t#select(\"items.*\").select(\"count(*) as count_all\").where(:severity => 2).group(:plugin_id).order(\"count_all DESC\")\n\t\t\t\tend", "def sort_files!; end", "def greater_divisables(match, menu, count)\n menu.sort! {|lt, gt| gt <=> lt}\n menu.each_cons(2) do |menu_item, second_menu_item|\n second_matches = []\n total = match\n quotient = (match / menu_item) - count\n quotient.times {|i| total -= menu_item}\n quotient.times {|i| second_matches << menu_item}\n while total % second_menu_item && total >= second_menu_item\n second_matches << second_menu_item\n total -= second_menu_item\n end\n # second_matches << total if menu.any? {|item| total % item == 0 }\n @combos << second_matches if second_matches.inject(:+) == @total\n end\n greater_divisables(match, menu, count +=1) unless count == 2\n end", "def minheapify_heapsort(p, i = 0)\n\t\tn_heapify_heapsort(@min, p, i)\n\tend", "def sortByHeight(a)\n people = a.select { |person| person > 0 }.sort! \n a.map{|pos| pos > 0 ? people.shift : -1}\nend", "def minimum_rearranged_drinks(drinks)\n\n # if there is only one drink then \n # Tux only drinks one \n n = drinks.length\n if n == 1\n return 1\n end\n\n n -= 1\n\n count = 0\n i = 0\n while i < n\n # get current max and delete it from array\n i += drinks.max\n drinks.delete_at(drinks.index(drinks.max))\n\n # i >= n means we are done but we must add\n # the final drink at the end so add 2\n # otherwise add one for that drink\n if i >= n \n count += 2\n else\n count += 1\n end\n end\n\n return count\n\nend", "def sort_pieces\n @headings = Heap.new\n cont = true\n while cont do\n piece = []\n begin\n @piece_size.times { piece << @source.next }\n rescue StopIteration\n cont = false\n end\n piece.sort!\n @headings.insert(ExtStream.new(piece))\n end\n end", "def heap_sort (list)\r\n sl = []\r\n heap = build_heap(list)\r\n heap.size.times do\r\n sl << heap.shift\r\n heap = heapify(heap, 0)\r\n end\r\n sl.reverse\r\nend", "def selection_sort(n,a)\n for i in 0..n-2\n minimum_index = i\n key = a[i]\n for j in i+1..n-1\n if a[j] < a[minimum_index]\n minimum_index = j\n end\n end\n a[i] = a[minimum_index]\n a[minimum_index] = key\n end\n for i in 0..n-1\n print a[i]\n end\n print \"\\n\"\nend", "def top_10_sorted\n\t\t\t\t\traw = notable_order_by_cvss_raw\n\t\t\t\t\tdata = Array.new\n\n\t\t\t\t\traw.each do |vuln|\n\t\t\t\t\t\trow = Array.new\n\t\t\t\t\t\tplugin_id = vuln[0]\n\t\t\t\t\t\tcount = vuln[1]\n\n\t\t\t\t\t\tname = scrub_plugin_name(Plugin.find_by_id(plugin_id).plugin_name)\n\n\t\t\t\t\t\trow.push(name)\n\t\t\t\t\t\trow.push(count)\n\t\t\t\t\t\tdata.push(row)\n\t\t\t\t\tend\n\n\t\t\t\t\tdata = data.sort do |a, b|\n\t\t\t\t\t\tb[1] <=> a[1]\n\t\t\t\t\tend\n\n\t\t\t\t\treturn data\n\t\t\t\tend", "def sorted_sage_elements\n sage_elements.sort_by { |h| h[:title] }\n end", "def test_sorting_the_deck_large\n card_1 = Card.new(\"4\",\"Hearts\")\n card_2 = Card.new(\"3\", \"Clubs\")\n card_3 = Card.new(\"5\", \"Diamonds\")\n card_4 = Card.new(\"1\",\"Hearts\")\n card_5 = Card.new(\"Jack\", \"Clubs\")\n card_6 = Card.new(\"Ace\", \"Diamonds\")\n card_7 = Card.new(\"7\", \"Diamonds\")\n deck = Deck.new([card_1, card_2, card_3, card_4, card_5, card_6, card_7])\n assert_equal [card_4, card_2, card_1, card_3, card_7, card_5, card_6], deck.sorting_the_deck\n end", "def gnomesort(a)\n a.start_logging\n\n i = 0\n while i < a.length\n if i == 0 || a[i] > a[i - 1]\n i += 1\n else\n a[i], a[i - 1] = a[i - 1], a[i]\n a.log\n i -= 1\n end\n end\n\n a\nend", "def key_sorter collection\n destination = Array.new\n collection.each_key {|key| destination << key.to_s }\n p destination.sort_by {|x| x.length}\nend", "def sort_by_length(my_sentence)\n\n man = my_sentence.split\n measure = man.length\n birth = 0\n\n while birth < (measure - 1)\n iron_mask = 0\n\n while iron_mask < (measure - birth - 1) \n\n if man[iron_mask].length > man[iron_mask + 1].length\n placeholder = man[iron_mask]\n man[iron_mask] = man[iron_mask + 1]\n man[iron_mask + 1] = placeholder\n end\n\n iron_mask += 1\n end\n \n birth += 1\n end\n\n return man\nend", "def sort_scores(unsorted_scores, highest_possible_score)\n\n # array of 0s at indices 0..highest_possible_score\n score_counts = [0] * (highest_possible_score+1)\n\n # populate score_counts\n unsorted_scores.each do |score|\n score_counts[score] += 1\n end\n\n # populate the final sorted array\n sorted_scores = []\n\n # for each item in score_counts\n score_counts.each_with_index do |count, score|\n\n # for the number of times the item occurs\n (0...count).each do |time|\n\n # add it to the sorted array\n sorted_scores.push(score)\n end\n end\n\n return sorted_scores\nend", "def sort_and_count(l)\n if l.count == 1\n return 0, l\n else\n a = l[0...l.count/2]\n b = l[l.count/2..l.count]\n\n r_a, a = sort_and_count(a)\n r_b, b = sort_and_count(b)\n r, l = merge_and_count(a, b)\n end\n \n return r_a + r_b + r, l\nend", "def sort_by_size(file, size)\n if @file_hash[:\"#{size}\"] == nil\n @file_hash[:\"#{size}\"] = []\n @file_hash[:\"#{size}\"] << file\n else\n @file_hash[:\"#{size}\"] << file\n end\n end", "def order_item\n @items.sample\n end", "def selection_sort(list)\n (list.size - 1).times do |i|\n min = i # starting min value\n for j in i+1..list.size - 1 # searches all values to right to find min\n min = j if list[j] < list[min] # resets min\n end\n list[min], list[i] = list[i], list[min] # swaps min val with past min val, ignoring already sorted part\n end\n list\nend", "def odds_small_to_big (array) \n #Use .select, .is_a? Numeric, and .is_odd? to pull odd numbers\n #Use .sort to sort the numbers, return implicitly\n p array.select {|item| item.is_a? Numeric and item.odd?}.sort\nend", "def sort_items_according_to_current_direction\n case @direction\n when nil\n @items = items.shift(2) + items.partition(&:directory?).flat_map(&:sort)\n when 'r'\n @items = items.shift(2) + items.partition(&:directory?).flat_map {|arr| arr.sort.reverse}\n when 'S', 's'\n @items = items.shift(2) + items.partition(&:directory?).flat_map {|arr| arr.sort_by {|i| -i.size}}\n when 'Sr', 'sr'\n @items = items.shift(2) + items.partition(&:directory?).flat_map {|arr| arr.sort_by(&:size)}\n when 't'\n @items = items.shift(2) + items.partition(&:directory?).flat_map {|arr| arr.sort {|x, y| y.mtime <=> x.mtime}}\n when 'tr'\n @items = items.shift(2) + items.partition(&:directory?).flat_map {|arr| arr.sort_by(&:mtime)}\n when 'c'\n @items = items.shift(2) + items.partition(&:directory?).flat_map {|arr| arr.sort {|x, y| y.ctime <=> x.ctime}}\n when 'cr'\n @items = items.shift(2) + items.partition(&:directory?).flat_map {|arr| arr.sort_by(&:ctime)}\n when 'u'\n @items = items.shift(2) + items.partition(&:directory?).flat_map {|arr| arr.sort {|x, y| y.atime <=> x.atime}}\n when 'ur'\n @items = items.shift(2) + items.partition(&:directory?).flat_map {|arr| arr.sort_by(&:atime)}\n when 'e'\n @items = items.shift(2) + items.partition(&:directory?).flat_map {|arr| arr.sort {|x, y| y.extname <=> x.extname}}\n when 'er'\n @items = items.shift(2) + items.partition(&:directory?).flat_map {|arr| arr.sort_by(&:extname)}\n end\n items.each.with_index {|item, index| item.index = index}\n end", "def sortByCountDecreasing\r\n @counts.sort_by { |k,v| v }.reverse\r\n end", "def heapsort(list)\n heap = MinHeap.new\n list.each do |number|\n # apply the .add instance method \n heap.add(number)\n end\n\n list.each_with_index do |number, index|\n list[index] = heap.remove()\n end \n return list\nend", "def merge(a, b, tmp, limit: TOP_K_SIZE)\n a.each_with_index{|v, i| tmp[i] = v}\n i = j = k = 0\n while k < limit && (i < tmp.size || j < b.size)\n if j >= b.size || (i < tmp.size && tmp[i] > b[j]) # descending\n a[k] = tmp[i]\n i += 1\n else\n a[k] = b[j]\n j += 1\n end\n k += 1\n end\n end", "def grand_sorting_machine(array)\n\n\n\nend", "def selection_sort(list)\n (0...list.size - 1).each do |i|\n min = i\n (i + 1...list.size).each do |j|\n if list[j] < list[min]\n min = j\n end\n end\n temp = list[min]\n list[min] = list[i]\n list[i] = temp\n end\n list\n end", "def sort3(num_array)\n for i in 0..num_array.length - 1\n key = num_array[i]\n j = i - 1\n\n # move elements of num_array[0..i-1] that are greater than key,\n # to one position ahead of their current position\n while j >= 0 && num_array[j] > key\n num_array[j + 1] = num_array[j]\n j -= 1\n end\n num_array[j + 1] = key\n end\n return num_array\nend", "def displayable_items(items)\n items.select do |item|\n display_item? item\n end.sort { |i1, i2| priority_for(i1) <=> priority_for(i2) }\n end", "def heap_sort2(a)\r\n size = a.length\r\n temp = 0\r\n i = (size/2)-1\r\n\r\n while i >= 0\r\n sift_down(a,i,size)\r\n i-=1\r\n end\r\n\r\n i=size-1\r\n while i >= 1\r\n a[0], a[1] = a[1], a[0]\r\n sift_down(a, 0, i-1)\r\n i-=1\r\n end\r\n return a\r\nend", "def sorted_question_items\n self.items.active.question_items.sort do |x1, x2| \n self.items_positions.index(x1.id) <=> self.items_positions.index(x2.id)\n end\n end" ]
[ "0.6898534", "0.64034766", "0.63646644", "0.6254244", "0.6185378", "0.6076496", "0.59749776", "0.5968773", "0.5958477", "0.5916909", "0.59013885", "0.5894115", "0.5873949", "0.57729805", "0.57664263", "0.5750422", "0.57351613", "0.5695349", "0.56888324", "0.5680713", "0.5676685", "0.56683743", "0.56615514", "0.5658459", "0.5637742", "0.5636864", "0.5626112", "0.5621807", "0.5613349", "0.5601357", "0.55687326", "0.5557804", "0.5556002", "0.55503434", "0.55448425", "0.5543967", "0.5543956", "0.55425054", "0.5541037", "0.5535606", "0.55281484", "0.5511238", "0.5506551", "0.5496698", "0.5479553", "0.54781514", "0.5473882", "0.5468232", "0.546451", "0.54631865", "0.5462829", "0.5459714", "0.5454178", "0.54521525", "0.5451839", "0.5443716", "0.5432979", "0.5430033", "0.54296577", "0.5421459", "0.5414678", "0.54102254", "0.54057086", "0.5401603", "0.5393778", "0.53923184", "0.53915906", "0.5387197", "0.5381376", "0.5378131", "0.5373929", "0.5373204", "0.5369911", "0.5369057", "0.5368904", "0.5350721", "0.53464645", "0.53462744", "0.53445816", "0.53430104", "0.53405076", "0.5338382", "0.53378975", "0.53235656", "0.53235656", "0.53234875", "0.5320642", "0.53188103", "0.5315217", "0.5314945", "0.531101", "0.5310773", "0.5309408", "0.5308456", "0.53001213", "0.5295932", "0.5294987", "0.52870566", "0.52859175", "0.5284363", "0.5283796" ]
0.0
-1
Accepts a parameters hash or another of the same class. If another instance of the same class is passed in then the parameters are copied to the new object.
def initialize(parameters={}) @type_conversion_errors = {} set_parameters parameters end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def params=(hash); end", "def params=(hash); end", "def new_from_hash(hash)\n if hash == nil\n self.class.new.assign(self)\n else\n hash_obj = hash\n if hash.instance_of?(Hash)\n hash_obj = self.class.new\n merge_hash_into_object(hash, hash_obj)\n end\n instance = self.class.new\n object_assign(instance, hash_obj)\n end\n end", "def parameters(hash = nil)\n hash ? @parameters = hash : @parameters\n end", "def merge(other_hash)\n new_instance_with_inherited_permitted_status(\n @parameters.merge(other_hash.to_h)\n )\n end", "def set_parameters(hash_or_instance)\n parameters = extract_parameters_from_hash_or_instance(hash_or_instance)\n parameters.each do |k,v|\n send \"#{k}=\", v\n end\n end", "def copy_and_add_param(key,value=nil,type=nil)\n new = self.copy\n new.add_param(key,value,type)\n return new\n end", "def params=(hash)\n if params\n params.replace hash\n else\n super\n end\n end", "def initialize_dup( * ) # :nodoc:\n\t\t@hash = deep_copy( @hash )\n\tend", "def initialize_clone( * ) # :nodoc:\n\t\t@hash = deep_copy( @hash )\n\tend", "def reverse_merge(other_hash)\n new_instance_with_inherited_permitted_status(\n other_hash.to_h.merge(@parameters)\n )\n end", "def params=(hash)\n @params.replace hash\n end", "def new_from_hash_copying_default(hash)\n superclass.new_from_hash_copying_default hash\n end", "def copy\n copy = self.clone\n copy.delete_all\n @collection.each do |obj|\n copy.add_param(obj.key,obj.value,obj.type)\n end\n return copy\n end", "def merge!(other_hash)\n @parameters.merge!(other_hash.to_h)\n self\n end", "def dup_params\n dup = HashWithIndifferentAccess.new\n\n params.each do |key, value|\n dup[key] = value.is_a?(ActiveRecord::Base) ? value : value.dup\n end\n\n dup\n end", "def dup\n self.class.new(to_hash)\n end", "def clone\n self.class.new(**as_json)\n end", "def merge( params )\n\t\tcopy = self.dup\n\t\tcopy.merge!( params )\n\t\treturn copy\n\tend", "def initialize_copy(other)\n end", "def will_create_new_hash(**hash)\n hash[:x] = 10 # Change\n p hash\n p hash.object_id \nend", "def initialize( hash )\n\t\t\t@hash = hash.dup\n\t\t\t@dirty = false\n\t\tend", "def initialize(optHash)\n @optHash=optHash\n setParameters()\nend", "def initialize_copy(other)\n # self\n end", "def copy\n self.class.new(@x,@y)\n end", "def additional_parameters= new_additional_parameters\n if new_additional_parameters.respond_to? :to_hash\n @additional_parameters = new_additional_parameters.to_hash\n else\n raise TypeError,\n \"Expected Hash, got #{new_additional_parameters.class}.\"\n end\n end", "def initialize_copy(from)\n super\n @filters = from.instance_variable_get(:@filters).dup\n @sorter = from.instance_variable_get(:@sorter).dup\n end", "def params=(hash)\n @params.clear\n @params.update(hash)\n end", "def params=(hash)\n @params.clear\n @params.update(hash)\n end", "def initialize(params={})\n\t\t\t\tparams.each_pair do |k,v|\n\t\t\t\t\tinstance_variable_set(\"@#{k}\", v)\n\t\t\t\tend\n\t\t\tend", "def copy\n self.class.new.tap do |obj|\n self.each_pair do |key, val|\n obj.set(key => (val.is_a?(Array) or val.is_a?(Hash)) ? val.clone : val)\n end\n end\n end", "def copy\n self.class.new.tap do |obj|\n self.each_pair do |key, val|\n obj.set(key => (val.is_a?(Array) or val.is_a?(Hash)) ? val.clone : val)\n end\n end\n end", "def build(params)\n return new(params) if params.is_a?(Hash)\n raise(\"unexpected parameter, expected Hash, received #{params.class}\")\n end", "def deep_dup\n self.class.new(@parameters.deep_dup, @logging_context).tap do |duplicate|\n duplicate.permitted = @permitted\n end\n end", "def set_params!(param_hash={})\n param_hash.each { |k,v| @set_params[k.to_s] = v }\n end", "def test_hash_subclass\n h = MyHash.new\n h[:mine] = 'mine'\n custom_params = {:one => {:hash => {:a => :b}, :myhash => h}}\n nh = normalize_params(custom_params)\n myhash = custom_params[:one][:myhash]\n\n assert_equal MyHash, myhash.class\n myhash = nh[:one][:myhash]\n\n assert_equal Hash, myhash.class\n end", "def clone(*args); end", "def set_params_from_omniauth_hash_to_pass_it_to_transfer_to_guest_cmpsr\n @params_from_omniauth_for_transfer_to_guest_cmpsr = pick_fields_from_omniauth_hash_that_will_be_passed_to_transfer_guest_cmpsr_as_params\n end", "def shared(other_hash)\n end", "def initialize_copy(from)\n @set = from.instance_variable_get('@set').clone\n end", "def initialize_copy(original)\n initialize(original.repository, original.model, original.options)\n end", "def copy_changed(**values)\n self.class.new(**self.to_hash.merge!(values))\n end", "def initialize_dup(original)\n super\n self.team = original.team\n self.plan = original.plan\n self.employee = original.employee\n end", "def dup\n HashWithIndifferentAccess.new(self)\n end", "def copy(other)\n other.instance_variables.each do |v| \n instance_variable_set v, other.instance_variable_get(v)\n end\n end", "def add_params(new)\n # We do not check for duplication on purpose: multiple calls\n # to add_params should be cumulative\n new.each { |p| @params[p.name] = p }\n end", "def initialize(*args)\n @hash = HashWithIndifferentAccess.new(*args)\n end", "def initialize_copy(orig); end", "def initialize_copy(orig); end", "def initialize_copy(orig); end", "def initialize_copy(orig); end", "def initialize_copy(orig); end", "def my_dup(obj)\n return obj if obj.is_a?(Numeric)\n copy = (obj.class).new\n x = obj.instance_variables\n x.each do |var_name| #copy attributes\n y = obj.instance_variable_get(var_name.to_sym)\n copy.instance_variable_set(var_name.to_sym, y)\n end\n copy\nend", "def with_params(params = {})\n params.each {|k,v| self.send(\"#{k}=\", v)}\n self\n end", "def initialize(params, class_or_relation)\n keys = mappings.map(&:keys).flatten.map(&:to_s)\n\n @params = HashWithIndifferentAccess.new(params)\n @params.select! { |key, value| keys.include?(key) && value.present? }\n @params.freeze\n\n @source = class_or_relation.scoped\n end", "def add_params(hash)\n @params.merge!(hash)\n end", "def initialize(prm = nil)\n @params = prm&.dup || {}\n @value = {}\n super()\n end", "def initialize_copy(other)\n super\n if o = other.instance_variable_get(:@original_deserialized_values)\n @original_deserialized_values = Hash[o]\n end\n self\n end", "def initialize(params = {})\n params ||= {}\n params = params.try(:to_hash) || params if params.is_a?(self.class)\n self.dump(params)\n end", "def new_hash\nHash.new\nend", "def initialize(*args)\n args.each do |arg|\n if arg.kind_of? Hash\n arg.each do |k,v|\n self.send(\"#{k}=\", v)\n end\n end\n end\n end", "def set(params = {})\n self.params.merge!(params)\n end", "def dup(*arguments)\n args = {}\n\n self.class.aggregated_properties.each do |arg|\n args[arg] = instance_variable_get(\"@#{arg}\")\n end\n \n arguments.each_with_index do |argv,i|\n args[self.class.aggregated_properties[i]] = argv\n end\n \n args.merge!(arguments.extract_options!)\n \n self.class.new(args)\n end", "def initialize params, only_public = true\n self.params = params.dup\n self.only_public = only_public\n self.interpret\n end", "def clone(*) end", "def clone(*) end", "def initialize_copy( original )\n\t\t@conn = nil\n\t\t@bound_user = nil\n\n\t\t@object_conversions = @object_conversions.dup\n\t\t@attribute_conversions = @attribute_conversions.dup\n\t\t@registered_controls = @registered_controls.dup\n\tend", "def from_hash(hash)\n hash.each_pair do |key, value|\n\n # We need to catch hashes representing child objects\n # If the hash key:value is a of a Hash/BSON:Ordered hash\n if hash[key].class == Hash || hash[key].class == BSON::OrderedHash\n # If we have a classname we know we need to return to an object\n if hash[key][\"@classname\"]\n self.instance_variable_set(key, ::Object::full_const_get(hash[key][\"@classname\"]).new(hash[key])) unless key.to_s.start_with?(\"_\")\n else\n self.instance_variable_set(key, value) unless key.to_s.start_with?(\"_\")\n end\n else\n self.instance_variable_set(key, value) unless key.to_s.start_with?(\"_\")\n end\n end\n end", "def from_hash(hash)\n hash.each_pair do |key, value|\n\n # We need to catch hashes representing child objects\n # If the hash key:value is a of a Hash/BSON:Ordered hash\n if hash[key].class == Hash || hash[key].class == BSON::OrderedHash\n # If we have a classname we know we need to return to an object\n if hash[key][\"@classname\"]\n self.instance_variable_set(key, ::Object::full_const_get(hash[key][\"@classname\"]).new(hash[key])) unless key.to_s.start_with?(\"_\")\n else\n self.instance_variable_set(key, value) unless key.to_s.start_with?(\"_\")\n end\n else\n self.instance_variable_set(key, value) unless key.to_s.start_with?(\"_\")\n end\n end\n end", "def initialize(params)\n params.each do |key, value| \n instance_variable_set(\"@#{key}\", value) if Lobbyist.instance_methods.include? key\n end\n end", "def initialize new_attributes = {}\n _assign_attributes new_attributes\n end", "def _wrap_parameters(parameters); end", "def merge_hash!(hash)\n merge!(self.class.from_hash(hash))\n end", "def initialize_copy(other)\n super\n @values = Hash[@values]\n @changed_columns = @changed_columns.dup if @changed_columns\n @errors = @errors.dup if @errors\n @this = @this.dup if @this\n self\n end", "def params=(value)\n @_params = value.is_a?(Hash) ? Parameters.new(value) : value\n end", "def dup\n super.tap do |e|\n e.args = e.args.dup\n e.kwargs = e.kwargs.dup\n end\n end", "def initialize_copy(other)\n @mutex = Mutex.new\n other.instance_variable_get(:@mutex).synchronize do\n @hash = other.instance_variable_get(:@hash).dup\n end\n end", "def initialize_copy(other)\n @mutex = Mutex.new\n other.instance_variable_get(:@mutex).synchronize do\n @hash = other.instance_variable_get(:@hash).dup\n end\n end", "def parameters=(value)\n raise TypeError, 'parameters must be a Hash or respond to #to_h or #to_hash' unless value.is_a?(Hash) || value.respond_to?(:to_h) || value.respond_to?(:to_hash)\n value = value.to_h rescue value.to_hash\n \n @parameters = value.to_h\n end", "def initialize(params)\n params.each do |key, value|\n instance_variable_set(\"@#{key}\", value) if respond_to?(key)\n end\n end", "def initialize_copy(other)\n super\n @deserialized_values = Hash[other.deserialized_values]\n self\n end", "def initialize *args\n if args.first.is_a?(Hash) && (house_attrs=(args.first[:house] || args.first[:house_attributes])).is_a?(Hash)\n street = if house_attrs[:street_id]\n Street.find house_attrs[:street_id]\n elsif house_attrs[:street]\n Street.find_by_name house_attrs[:street]\n else\n nil\n end\n\n house = if street\n House.find_or_initialize_by_street_id_and_number(\n street.id,\n house_attrs[:number]\n )\n else\n House.new(\n :number => house_attrs[:number]\n )\n end\n\n args[0] = args.first.dup\n args.first[:house] = house\n args.first.delete :house_attributes\n end\n super(*args)\n end", "def initialize_copy(original)\n super\n @query = @query.dup\n @cache = @cache.dup\n @orphans = @orphans.dup\n end", "def initialize hash\n @hash = hash\n end", "def parameterize(hash)\n _hash = {}\n hash.each do |k,v|\n _hash[k.to_sym] = parameterized?(k) ? attributes_to_hash(v) : v\n end\n _hash\n end", "def params(params_hash)\n return self if params_hash.nil?\n\n @sim_data.num_rounds = params_hash['NumRounds']\n @sim_data.num_agents = params_hash['NumAgents']\n @sim_data.starting_funds = params_hash['StartingFunds']\n @sim_data.max_stock = params_hash['MaxStock']\n\n self\n end", "def initialize params = nil\n \n end", "def initialize(o_params)\n params = o_params.dup\n if params.is_a?(Hash)\n @name, @type = params.shift\n @doc = params.delete(:doc) if params.has_key?(:doc)\n @opts = params\n elsif params.is_a?(Array)\n @name = params.shift\n @type = params.shift\n @doc = params.shift\n @opts = params\n end\n end", "def initialize_copy(other)\n @steps = other.steps.map do |step|\n step.class.new(self, *step.args)\n end\n @content = other.content.dup\n @url_attributes = other.url_attributes.dup\n end", "def make_args(args_hash)\n # The routin should be provided in the inherited class\n end", "def copy_and_delete_param(key)\n new = self.copy\n new.delete_param(key)\n return new\n end", "def parameters=(_); end", "def initialize(*params)\n @params = *params\n end", "def initialize hashed_args\n new_args = DEFAULT_ARGS.merge(hashed_args)\n \n @type = new_args[:type]\n if @type.is_a?(Enumerable)\n @type.each do |type|\n raise ArgumentError, \"#{type} is not a Class\" unless type.is_a?(Class)\n end\n else\n raise ArgumentError, \"#{@type} is not a Class\" unless @type.is_a?(Class)\n end\n \n @validator = new_args[:validator]\n @reqd = new_args[:reqd]\n \n unless @reqd\n msg = \"if hashed arg is not required, a default value or value generator (proc) must be defined via :default key\"\n raise ArgumentError, msg unless new_args.has_key?(:default)\n @default = new_args[:default]\n end\n end", "def _middle_copy(object)\n o = object.clone\n object.instance_variables.each do |k|\n v = object.instance_variable_get(k)\n o.instance_variable_set(k, v ? v.clone : v)\n end\n o\n end", "def initialize(hash)\n hash.each do |key, value|\n self.__send__(\"#{key}=\", value)\n end\n raise ArgumentError if id.nil? || url.nil?\n end", "def example(hash_of_arguments)\n hash_of_arguments.each {|key,value| self.send(\"#{key}=\", value) }\nend", "def copy_values_from(other)\n self.name = other.name\n self.contributor = other.contributor\n self.share_mode = other.share_mode\n self.update_mode = other.update_mode\n self.public_view = other.public_view\n self.public_download = other.public_download\n end", "def initialize\n @h = new_hash\n end", "def initialize *args\n if args.size == 1 && args.first.is_a?(Hash)\n super()\n args.first.each do |k,v|\n send \"#{k}=\", v\n end\n else\n super\n end\n end", "def dup\n self.class.new(@value, **(@object || {}))\n end" ]
[ "0.6601934", "0.6601934", "0.6557284", "0.65064853", "0.6406723", "0.6403846", "0.63889104", "0.63269687", "0.6313085", "0.6272679", "0.62692386", "0.61685216", "0.61587554", "0.6140623", "0.6124891", "0.6102984", "0.60734504", "0.60636324", "0.603781", "0.5990681", "0.59646153", "0.5876649", "0.58326143", "0.58229965", "0.5788424", "0.57819766", "0.5776841", "0.57609916", "0.57609916", "0.5756181", "0.57358336", "0.57358336", "0.5716932", "0.5696703", "0.5690982", "0.5688651", "0.5687978", "0.5685804", "0.5678259", "0.56728405", "0.56695557", "0.56656826", "0.56461006", "0.5644887", "0.5640167", "0.5632598", "0.56230986", "0.5617575", "0.5617575", "0.5617575", "0.5617575", "0.5617575", "0.558323", "0.5576766", "0.5570883", "0.5570273", "0.5558002", "0.55560106", "0.55537087", "0.5540394", "0.5538788", "0.5536427", "0.55333066", "0.5529812", "0.5529144", "0.5529144", "0.552849", "0.5519818", "0.5519818", "0.5517153", "0.55165535", "0.5504654", "0.55037004", "0.5502958", "0.54987186", "0.54975843", "0.54969865", "0.54969865", "0.5494038", "0.54937154", "0.548842", "0.5486646", "0.5479847", "0.54785454", "0.54764086", "0.54671234", "0.5466224", "0.5465146", "0.54513305", "0.5451108", "0.544546", "0.5445259", "0.5443855", "0.54412115", "0.54366064", "0.54331964", "0.542538", "0.5423858", "0.54142493", "0.54127485", "0.54098105" ]
0.0
-1
Executes the command by calling the method +execute+ if the validations pass.
def call(&block) execute(&block) if valid? execution_attempted! self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_execute\n unless executed?\n execute\n end\n end", "def execute\n begin\n return false unless check_guards\n execute_actions\n rollback_actions unless self.failed_action.nil?\n self.failed_action.nil?\n ensure\n self.save!\n end\n end", "def validate_command(command)\n command_validator.validate(command)\n end", "def execute\n @executors.each(&:execute)\n true\n end", "def execute(named_context, target)\n raise(ArgumentError, 'invalid context specified') if !named_context || (contexts.length > 0 && !contexts[named_context])\n target.errors.clear!\n result = true\n context(named_context).each do |validator|\n next unless validator.execute?(target)\n result = false unless validator.call(target)\n end\n\n result\n end", "def execute(named_context, target)\n raise(ArgumentError, 'invalid context specified') if !named_context || (contexts.length > 0 && !contexts[named_context])\n target.errors.clear!\n result = true\n context(named_context).each do |validator|\n next unless validator.execute?(target)\n result = false unless validator.call(target)\n end\n\n result\n end", "def execute(params = {})\n ok, values = @signature.apply(params)\n if ok\n # validation is ok, merge params and continue\n [:success, @method.bind(controller.instance).call(params.merge!(values))]\n else\n # validation is ko\n [:\"validation-ko\", values]\n end\n rescue ::Waw::Validation::KO => ex\n [:\"validation-ko\", ex.failed]\n rescue ::Waw::Validation::Error => ex\n [:\"validation-error\", ex.failed]\n end", "def execute(query)\n if validate_query\n validation = schema.validate(query)\n fail validation_error_message(validation) unless validation.valid?\n end\n\n execute!(query)\n end", "def validate\n execute(:validate).to_boolean\n end", "def execute\n raise \"you need to define #execute\"\n end", "def perform\n\n r = validate\n return r unless r.success?\n\n process_hook\n\n end", "def execute(command)\n if valid_command?(command)\n apply_command(command)\n else\n return 'Invalid command.'\n end\n end", "def validate!\n if not respond_to?(\"perform_#{command}!\")\n type = self.class.to_s.split(\"::\").last.downcase\n error \"Unknown #{y(type)} command: <#{r(command)}>\"\n error \"Run #{y(\"gitpusshuten help #{type}\")} for a list #{y(type)} commands.\"\n exit\n end\n end", "def validate\n self.class.validations.each do |(method, args, opts)|\n send(method, *args) if !opts[:if] || instance_exec(&opts[:if])\n end\n end", "def execute(*commands, abort_on_failure: self.class.abort_on_failure?)\n commands.each do |command_class|\n args = command.to_hash\n options = { skip_cleanup: :command, skip_validations: :receives }\n @command = command_class.call(**args, **options)\n executed.push(command)\n\n if command.failure? && abort_on_failure\n fail!\n abort!\n end\n end\n end", "def execute\n return false unless super\n ActiveRecord::Base.transaction do\n # Location Create\n location_params = @recipient_location.merge({name: @parcel_details[:recipient_name] })\n recipient_loc = create_parcel_destination_location(location_params)\n\n # Parcel Create\n parcel_params = @parcel_details.merge({destination_location_id: recipient_loc.id })\n parcel_object = create_parcel(parcel_params) if valid?\n if valid?\n # Mission Create\n mission_params = {\n drone_id: @drone.id,\n warehouse_id: @warehouse.id,\n parcel_id: parcel_object.id\n }\n @result = create_mission(mission_params)\n end\n raise ActiveRecord::Rollback unless valid?\n end\n valid?\n end", "def execute\n\t\tdoCommandList.each do |commandItem|\n\t\t\tcommandItem.execute\n\t\tend\n\tend", "def execute(merge_requests: [])\n validate_merge_requests(merge_requests)\n\n [@valid, @invalid]\n end", "def execute\n raise NotImplementedError, 'Define `execute` in Command subclass'\n end", "def do_execute\n raise StandardError, \"Not implemented!\"\n end", "def execute\n if job.execute\n return true\n else\n return false\n end\n end", "def execute_command!(*argv)\n execute_command(argv)\n raise Error.new(\"Command failed!\") unless $?.success?\n end", "def run_validations\n run_callbacks :validation do\n failed_validators.clear\n validation_chain.run(self)\n @validated = true\n end\n end", "def verify\n verify_commands if commands.any?\n end", "def execute\n fail NotImplementedError\n end", "def run_validations\n true\n end", "def execute\n raise errors.to_sentences unless valid?\n\n # default failing command\n result = false\n\n # protect command from recursion\n mutex = Mutagem::Mutex.new('revenc.lck')\n lock_successful = mutex.execute do\n result = system_cmd(cmd)\n end\n\n raise \"action failed, lock file present\" unless lock_successful\n result\n end", "def execute!; end", "def validate_check_execution(check)\n must_be_a_string_if_set(check[:command]) ||\n invalid(check, \"check command must be a string\")\n must_be_a_string_if_set(check[:extension]) ||\n invalid(check, \"check extension must be a string\")\n (!check[:command].nil? ^ !check[:extension].nil?) ||\n invalid(check, \"either check command or extension must be set\")\n must_be_a_numeric_if_set(check[:timeout]) ||\n invalid(check, \"check timeout must be numeric\")\n must_be_boolean_if_set(check[:stdin]) ||\n invalid(check, \"check stdin must be boolean\")\n end", "def execute?(cmd)\n execution_result = execute(cmd)\n !execution_result.nil? && execution_result\n end", "def call\n execute(*self.class.executes, abort_on_failure: true)\n end", "def _execute(builder)\n query = builder.build\n @last_execute_query = {command: builder.command, query: query}\n response = ::Dymos::Client.new.command builder.command, query\n fail raise(::Dymos::RecordNotSaved) if response.nil?\n changes_applied\n @new_record = false\n\t\t\ttrue\n end", "def run(*params)\n setup!(*params) # where do we assign/find the model?\n\n [process(*params), @valid].reverse\n end", "def submit!\n raise InvalidRequest.new(self) unless valid?\n\n command.call(self)\n end", "def execute(message)\n options.keys.each do |key|\n case key\n when :nick, :nicks\n return unless validate(options[:nick] || options[:nicks], message.nick)\n when :host, :hosts\n return unless validate(options[:host] || options[:hosts], message.host)\n when :user, :users\n return unless validate(options[:user] || options[:users], message.user)\n when :channel, :channels\n if message.channel\n return unless validate(options[:channel] || options[:channels], message.channel)\n end\n end\n end\n\n callbacks.each do |blk|\n blk.call(message)\n end\n end", "def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n\n #use the built-in error checking\n if not runner.validateUserArguments(arguments(model), user_arguments)\n return false\n end\n\n return true\n\n end", "def execute\n @executed = true\n if @autoconf\n Rscons.application.check_configure\n Rscons.application.check_process_environments\n end\n @dependencies.each do |dependency|\n Task[dependency].check_execute\n end\n if @name == \"configure\"\n Rscons.application.silent_configure = false\n Rscons.application.configure\n else\n @actions.each do |action|\n action[self, param_values]\n end\n end\n end", "def run!\n instance_eval(&self.class.setup) if self.class.setup\n instance_eval(&self.class.validate) if self.class.validate\n instance_eval(&self.class.build) if self.class.build\n instance_eval(&self.class.clean) if self.class.clean\n end", "def _entry_4_validatecommand(*args)\n\n end", "def execute\n end", "def execute\n end", "def base_execute\n execute\n end", "def validate_command_attrs\n self.class.validation_logics.each do |attr, logics|\n val = self.instance_variable_get(\"@#{attr}\".to_sym)\n logics.each do |l|\n unless l.call(self, attr, val)\n raise \"validation error : #{attr}=#{val} (#{self.class})\"\n end\n end\n end\n end", "def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n\n # use the built-in error checking\n if !runner.validateUserArguments(arguments(model), user_arguments)\n return false\n end\n\n return true\n end", "def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n\n # use the built-in error checking\n if !runner.validateUserArguments(arguments(model), user_arguments)\n return false\n end\n\n return true\n end", "def process_arguments\n if arguments_valid? \n process_command\n else\n raise ArgumentError\n end\n end", "def execute\n @result = session.execute(statement)\n execution_successful?\n end", "def validate!\n logger.debug \"Starting validation for #{description}\"\n raise NotFound.new name, connection unless exists?\n logger.info \"Successfully validated #{description}\"\n self\n end", "def execute; end", "def execute; end", "def execute\n\t\traise RuntimeError, \":#{self} is not defined\" unless @definition\n\t\[email protected]\n\tend", "def execute\n\n end", "def perform_validations(options={}) # :nodoc:\n if options.is_a?(Hash)\n options[:validate] == false || valid?(options[:context])\n else\n valid?\n end\n end", "def do_validation \n return true if self.ok\n set_ok\n self.ok\n end", "def execute\n Monads.create_success(perform)\n rescue StandardError => exception\n Monads.create_failure(exception)\n end", "def execute\n nb_problem_resolved.tap do |nb|\n if nb > 0\n criteria.each do |problem|\n ProblemDestroy.new(problem).execute\n end\n repair_database if @should_repair_database\n end\n end\n end", "def validate\n errors.clear\n instance_exec(&validate_block) if validate_block && get\n end", "def validate\n validations = self.class.meta_eval { @validations }\n\n validations.each do |v|\n raise \"#{self.class}.#{v[:name]} #{v[:options][:message]}\" unless\n v[:proc].call(send(v[:name]))\n end\n\n self\n end", "def execute_option_or_command(options, command, args)\n options[:execute] ? eval_execute_option(options[:execute]) :\n execute_command(command, args)\n end", "def execute_query?\n [email protected]?\n end", "def execute\n end", "def execute\n end", "def process_command command\n\n # The decision maker will validate the command\n # and get rid of the commands that is invalid\n # and make the right order of commands and notify different observers.\n\n # Notify the observers that a new valid command comes.\n command\n end", "def validate\r\n validate! rescue false\r\n end", "def validate!\n # pass\n end", "def execute(force=false)\n return false if executed? && !force\n evaluate_recipes\n ! apply.any_failed?\n rescue Exception => e\n STDERR.puts \"\\n\\nException: #{e}\\n#{e.backtrace * \"\\n\"}\"\n false\n ensure\n @executed = true\n end", "def runner_execute!(host, commands, options = {})\n result = host.execute commands, options\n if result && result[1] == :stdout\n Trooper.logger.info \"#{result[2]}\\n\"\n true\n else \n false\n end\n end", "def assert_execute(*args, &block)\n result = execute(*args, &block)\n expect(result).to succeed\n result\n end", "def has_successful_execution(cmd)\n @commands << cmd\n end", "def save(options={})\n result = perform_validations(options) ? super : false\n if !result\n Neo4j::Rails::Transaction.fail if Neo4j::Rails::Transaction.running?\n end\n result\n end", "def execute\n parse_command\n run_command(command)\n end", "def execute\n end", "def _entry_6_validatecommand(*args)\n\n end", "def _entry_3_validatecommand(*args)\n\n end", "def execute(command)\n system command\n code = $?.exitstatus\n if code > 0\n LOGGER.warn \"Failed to execute command `#{command}` with code #{code}.\"\n false\n else\n true\n end\n end", "def _valid?(opts)\n return errors.empty? if frozen?\n errors.clear\n called = false\n # skip_validate = opts[:validate] == false # SEQUEL5\n around_validation do\n called = true\n if before_validation == false\n Sequel::Deprecation.deprecate(\"Having before_validation return false to mark the object as invalid\", \"Instead, call cancel_action inside before_validation\")\n raise_hook_failure(:before_validation)\n else\n validate # unless skip_validate # SEQUEL5\n after_validation\n end\n end\n # return true if skip_validate # SEQUEL5\n if called\n errors.empty?\n else\n raise_hook_failure(:around_validation)\n end\n end", "def validate_command\n\t \tcommand_types = ['get_authorization_url','update_site_registration', 'get_tokens_by_code','get_user_info', 'register_site', 'get_logout_uri','get_authorization_code','uma_rs_protect','uma_rs_check_access','uma_rp_get_rpt','uma_rp_authorize_rpt','uma_rp_get_gat']\n\t \tif (!command_types.include?(@command))\n\t\t\t\tlogger(:log_msg => \"Command: #{@command} does not exist! Exiting process.\")\n \tend\n\t end", "def execute\n raise NotImplementedError\n end", "def execute\n raise \"Not Implemented\"\n end", "def execute(command)\n raise ClientError, \"#{self.class}#execute must be implemented\"\n end", "def run_validation(vmode)\n validate(vmode)\n self\n end", "def execute\n raise NotImplementedError.new('run is an abstract method in BaseCommand. Please override.')\n end", "def run!\n if self.class.commands.include?(@command)\n run_command\n elsif @command.nil?\n puts \"Command required\"\n puts @parser\n exit 1\n else\n abort \"Unknown command: #{@command}. Use one of #{self.class.commands.join(', ')}\"\n end\n end", "def validate\n @condition = nil\n @error = \"No validation implemented for #{self.class}#validate\"\n end", "def _entry_2_validatecommand(*args)\n\n end", "def perform\n\n handle_errors_and_exceptions do\n\n r = validate\n return r unless r.success?\n\n r = fetch_manager_validation_hash_details\n return r unless r.success?\n\n r = create_secure_data_acccess_token\n return r unless r.success?\n\n r = send_mail\n return r unless r.success?\n\n success_with_data({manager_validation_hash_id: @manager_validation_hash[:id]})\n\n end\n\n end", "def execute\n strategy_steps.values.reject {|s|s.satisfied? || s.in_progress?}.each do |step|\n if step.requirements_met?\n puts \"Executing: #{step.name}\"\n step.execute\n end\n end\n end", "def validate_command\n if requester != player\n errors.add(:allowed, I18n.t(\"errors.not_authorized\"))\n end\n unless airlift?\n if game.actions_taken == 4\n errors.add(:allowed, I18n.t(\"player_actions.no_actions_left\"))\n end\n if proposal.turn_nr != game.turn_nr\n errors.add(:allowed, I18n.t(\"movement_proposals.expired\"))\n end\n if destination_is_not_a_neighbor? && another_player_is_not_at_destination?\n errors.add(:allowed, I18n.t(\"movement_proposals.not_allowed\"))\n end\n end\n end", "def _entry_1_validatecommand(*args)\n\n end", "def _entry_1_validatecommand(*args)\n\n end", "def validate\n # add errors if not validate\n end", "def execute(command)\n end", "def check\n if valid?\n report_template(:ok)\n else\n report_template(:fail, VALIDATOR_MISSING)\n end\n end", "def run_validations(context)\n __run_validations__(context)\n end", "def validate_with_callbacks\n run_callbacks(:before_validation)\n validate_without_callbacks\n run_callbacks(:after_validation) if errors.empty?\n end", "def execute_command(command)\n end", "def execute_command(command)\n end", "def run\n if options_valid? && option_combinations_valid? \n process_arguments \n process_command\n else\n output_usage\n end\n end", "def execute!\n if Mcir::Core.instance.dryrun?\n Mcir::Core.instance.debug(\"CMD: \".purple << \"#{self.to_s.gsub(\"\\r\", \"\")}\")\n \"skipped execution due to dryrun\"\n else\n case @mode\n when :exec then exec(self.to_s)\n when :open then IO.new(self).open3\n when :capture then IO.new(self).capture3\n when :backticks then IO.new(self).backtick\n end\n end\n end", "def execute_with_fail(typename, cmd, way)\n executor = proc { |compiled| execute(compiled) }\n @execlogic.execute_with_fail(typename, cmd, way, executor)\n end" ]
[ "0.7264249", "0.6978162", "0.6307153", "0.62791103", "0.62602055", "0.62602055", "0.6254302", "0.61683196", "0.61567825", "0.61552805", "0.6111375", "0.60871834", "0.6076937", "0.60015976", "0.594665", "0.593224", "0.59228283", "0.59144056", "0.59117585", "0.5905796", "0.59037036", "0.58822906", "0.5872221", "0.58631", "0.58614844", "0.58305615", "0.58271974", "0.58238554", "0.58202326", "0.5812067", "0.5780495", "0.57430845", "0.5716304", "0.5714494", "0.5697903", "0.5680965", "0.5650488", "0.563702", "0.5629709", "0.56197625", "0.56197625", "0.5619717", "0.56129247", "0.5602797", "0.5602797", "0.55949044", "0.55864865", "0.55725056", "0.5562556", "0.5562556", "0.5562003", "0.55559963", "0.5551619", "0.55339324", "0.55309886", "0.55277526", "0.55249685", "0.55212265", "0.5520717", "0.5519875", "0.55142", "0.55142", "0.5510999", "0.5506967", "0.550404", "0.550261", "0.54987794", "0.54958916", "0.5493122", "0.54789126", "0.5474524", "0.5467681", "0.5459235", "0.5455327", "0.5448813", "0.54454017", "0.54315424", "0.54262835", "0.54070795", "0.5405752", "0.5404869", "0.54036635", "0.5400932", "0.5396664", "0.5394293", "0.539067", "0.5382417", "0.53782564", "0.53776574", "0.53776574", "0.53743327", "0.5371071", "0.53633416", "0.53598076", "0.535904", "0.5350478", "0.5350478", "0.534211", "0.53388184", "0.5333101" ]
0.57148004
33
Performs the actual command execution. It does not test if the command parameters are valid. Typically, +call+ should be called instead of calling +execute+ directly. +execute+ should be overridden in descendent classes
def execute yield self if block_given? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute\n raise NotImplementedError, 'Define `execute` in Command subclass'\n end", "def execute\n parse_command\n run_command(command)\n end", "def execute_command command_text\r\n #TODO: really, what is point of this \"convenience\" method!?\r\n create_command( command_text ).execute\r\n end", "def execute_command(parsed_command)\n execution_method = \"execute_#{parsed_command[:command]}\".to_sym\n if self.respond_to? execution_method, true\n self.send execution_method, parsed_command[:params]\n else\n raise \"Command '#{parsed_command[:command]}' not supported\"\n end\n end", "def execute\n raise NotImplementedError.new('run is an abstract method in BaseCommand. Please override.')\n end", "def execute(cmd)\n Util.execute(cmd)\n end", "def execute\n\t\tdoCommandList.each do |commandItem|\n\t\t\tcommandItem.execute\n\t\tend\n\tend", "def execute!\n if Mcir::Core.instance.dryrun?\n Mcir::Core.instance.debug(\"CMD: \".purple << \"#{self.to_s.gsub(\"\\r\", \"\")}\")\n \"skipped execution due to dryrun\"\n else\n case @mode\n when :exec then exec(self.to_s)\n when :open then IO.new(self).open3\n when :capture then IO.new(self).capture3\n when :backticks then IO.new(self).backtick\n end\n end\n end", "def execute(command)\n end", "def execute_command(command)\n end", "def execute_command(command)\n end", "def execute(command)\n raise ClientError, \"#{self.class}#execute must be implemented\"\n end", "def execute(cmd)\n send(*cmd)\n end", "def call\n execute(*self.class.executes, abort_on_failure: true)\n end", "def execute_command!(*argv)\n execute_command(argv)\n raise Error.new(\"Command failed!\") unless $?.success?\n end", "def execute(command)\n if valid_command?(command)\n apply_command(command)\n else\n return 'Invalid command.'\n end\n end", "def execute(command) # rubocop:disable Lint/UnusedMethodArgument\n end", "def execute(command)\n invoke_command(command, nil)\n end", "def execute_internal(cmd)\n class_invariant\n pre_execute_internal(cmd)\n begin\n send(@internal_cmds[cmd[0]], *cmd[1..-1])\n rescue ArgumentError\n puts \"Invalid arguments\"\n end\n class_invariant\n end", "def execute(command_string)\n Runner.instance.cross_call command_string\n end", "def execute\n unless args.skip?\n if args.chained?\n execute_command_chain\n else\n exec(*args.to_exec)\n end\n end\n end", "def base_execute\n execute\n end", "def run\n # TODO: include a parse step here and remove duplicate parsing code from\n # individual commands\n execute\n end", "def execute\n raise NotImplementedError, 'Generic command has no actions'\n end", "def do_execute\n raise StandardError, \"Not implemented!\"\n end", "def execute(args=nil)\r\n puts \"Executing #{name}\"\r\n execute_base(args)\r\n end", "def execute\n fail NotImplementedError\n end", "def execute(command, opts=nil)\n end", "def execute(options = {})\n \n ah = argument_hash.clone\n ah.store(:data, data) if data\n\n begin\n unless class_name.classify.constantize.send(method_name.to_sym, ah)\n self.status = STATUS_ERROR\n self.error_message = \"called method returned false\"\n end\n rescue Exception => e\n self.status = STATUS_ERROR\n self.error_message = \"class or method does not exist\" + e.to_s\n end\n \n # If we have an error, do not run anything in this group (halt the chain)\n if error?\n self.status = STATUS_SKIPPED if skip_on_error\n else\n self.status = STATUS_COMPLETED\n self.data = nil unless !!options[:keep_data]\n end\n end", "def execute_command(command_arguments)\n self.class.from_arguments(config, ui, command_arguments).execute\n end", "def execute command\n log command\n system(command) unless @options[:test]\n end", "def execute(command_args)\n command_args = split_command(command_args)\n command = command_args[0].to_s\n parameter = command_args[1].to_s\n\n # Find the command to execute\n command_to_execute = search_for_command command.downcase\n\n # If the command is not found, show the help\n if command_to_execute == nil\n help command\n else\n # Create a pointer to the command's RUN method, and call it\n method = command_to_execute.method(\"run\")\n method.call(parameter)\n end\n end", "def execute\n $logger.debug \"Main arguments are #{$main_args}\"\n $logger.debug \"Sub-command is #{$sub_command}\"\n $logger.debug \"Sub-arguments are #{$sub_args}\"\n if $main_args.include?('-h') || $main_args.include?('--help')\n # Help is next in short-circuiting everything. Print\n # the help and exit.\n help\n return 0\n end\n\n if !parse_main_args($main_args)\n help\n return 1\n end\n\n # -e commands detected\n if !$eval_cmds.empty?\n $eval_cmds.each do |cmd|\n $logger.debug \"Executing cmd: #{cmd}\"\n eval(cmd)\n end\n if $sub_command\n $logger.warn \"Evaluate mode detected, ignoring sub_command #{$sub_command}\"\n return 0\n end\n return 0\n end\n\n # If we reached this far then we must have a command. If not,\n # then we also just print the help and exit.\n command_plugin = nil\n if $sub_command\n command_plugin = command_list[$sub_command.to_sym]\n end\n\n if !command_plugin || !$sub_command\n help\n return 1\n end\n\n command_class = command_plugin[0].call\n $logger.debug(\"Invoking command class: #{command_class} #{$sub_args.inspect}\")\n\n # Initialize and execute the command class, returning the exit status.\n result = 0\n begin\n result = command_class.new.execute($sub_args)\n rescue Interrupt\n $logger.error '?'\n result = 1\n end\n\n result = 0 unless result.is_a?(Integer)\n result\n end", "def execute_command(name, event, arguments, chained = false, check_permissions = true)\n debug(\"Executing command #{name} with arguments #{arguments}\")\n return unless @commands\n\n command = @commands[name]\n command = command.aliased_command if command.is_a?(CommandAlias)\n return unless !check_permissions || channels?(event.channel, @attributes[:channels]) ||\n (command && !command.attributes[:channels].nil?)\n\n unless command\n if @attributes[:command_doesnt_exist_message]\n message = @attributes[:command_doesnt_exist_message]\n message = message.call(event) if message.respond_to?(:call)\n event.respond message.gsub('%command%', name.to_s) if message\n end\n return\n end\n return unless !check_permissions || channels?(event.channel, command.attributes[:channels])\n\n arguments = arg_check(arguments, command.attributes[:arg_types], event.server) if check_permissions\n if (check_permissions &&\n permission?(event.author, command.attributes[:permission_level], event.server) &&\n required_permissions?(event.author, command.attributes[:required_permissions], event.channel) &&\n required_roles?(event.author, command.attributes[:required_roles]) &&\n allowed_roles?(event.author, command.attributes[:allowed_roles])) ||\n !check_permissions\n event.command = command\n result = command.call(event, arguments, chained, check_permissions)\n stringify(result)\n else\n event.respond command.attributes[:permission_message].gsub('%name%', name.to_s) if command.attributes[:permission_message]\n nil\n end\n rescue Discordrb::Errors::NoPermission\n event.respond @attributes[:no_permission_message] unless @attributes[:no_permission_message].nil?\n raise\n end", "def execute(command_str)\n # get_params: gets the command to be executed. It formats in a hash like {command: 'method_name', options: {} }\n command_hash = @command_recognizer.get_params(command_str)\n command = command_hash[:command]\n options = command_hash[:options]\n\n if options.nil?\n send(command)\n else\n send(command, options)\n end\n end", "def call(*command); end", "def execute_command(cmd, user, room)\n cmd = cmd.split # split the array\n args = cmd.last(cmd.length - 1) # get the args (everything that's not the first entry)\n cmd = cmd.first.reverse.chop.reverse.downcase # remove the dot from the command\n \n # if this command is actually a command..\n if COMMANDS.keys.any?{|p| p == cmd }\n method = self.method(cmd) # get the method assoicated with the command\n opts = COMMANDS[cmd] # get the options\n opts = opts.to_s.to_a if not opts.is_a? Array\n\n # ensure we have the proper amount of options to pass to the method\n if method.arity == opts.length\n inputs = []\n opts.each do |opt| # build the params list\n inputs << case opt.to_sym\n when :room then room\n when :args then args\n when :user then user\n end\n end\n # execute it\n puts \"#{@num_processed += 1}@[#{Time.now}] Command processed: #{cmd}\"\n send(cmd, *inputs)\n else\n room.speak(\"Fatal error - configuration error\")\n quit\n raise \"fatal error - wrong number of inputs in COMMANDS hash. Had #{opts.length} needed #{method.arity}\"\n end\n else\n room.speak(\"Unknown command: #{cmd}\")\n end\n end", "def execute\n raise NotImplementedError\n end", "def execute\n raise \"you need to define #execute\"\n end", "def run_command(arguments)\n raise \"Specified command did not implement 'run_command' method.\"\n end", "def call(*args)\n self.exec(*args)\n end", "def execute(opt, argv)\n fail \"#{self.class.command} not implemented\"\n end", "def execute(command)\n if remote?\n @remote.exec(command)\n else\n rays_exec(command)\n end\n end", "def execute(command, ignore_failure = false)\n return Simp::Cli::ExecUtils::execute(command, ignore_failure, logger)\n end", "def exec(cmd, *rest) end", "def execute\n raise NotImplementedError.new('Must override')\n end", "def run(host, command, options = {})\n execute(__method__, host, command, options)\n end", "def exec\n binding.pry\n # command.run(*service.exec(args.command))\n end", "def execute\n self.started\n self.execute_internal\n self.finished\n end", "def call\n commands = self.commands.any? ? self.commands : self.class.commands\n commands.each do |command_klass|\n command = command_klass.new(kwargs)\n command.run\n _called << command\n end\n end", "def execute(command)\n @command = command\n self\n end", "def execute_command(command, input)\n command.new(self, input).process\n end", "def perform(command, *args)\n\n #\n # use the given command's attributes to perform the action\n #\n\n raise NotImplementedError\n end", "def execute\n print 'ComplexCommand: Complex stuff should be done by a receiver object'\n @receiver.do_something(@a)\n @receiver.do_something_else(@b)\n end", "def execute(cmd)\n @log.info(\"Executing command '#{cmd}'...\")\n Kernel.system(cmd)\n end", "def run\n\n if parsed_options? && arguments_valid? \n process_arguments \n process_command\n else\n output_usage\n end\n\n end", "def call(*args)\n in_context do\n self.execute(*args)\n end\n end", "def execute(cmd)\n res = eval(@multiline_cmd << \"\\n\" << cmd, @pure_binding)\n $last_res = res\n eval(\"_ = $last_res\", @pure_binding)\n @multiline_cmd = ''\n print_result res\n rescue SyntaxError => e\n unless e.message.include? 'unexpected end-of-input'\n @multiline_cmd = ''\n puts \"Exception #{e.class} -> #{e.message}\"\n end\n # Else it should be multiline command.\n rescue Rush::Exception => e\n puts \"Exception #{e.class} -> #{e.message}\"\n @multiline_cmd = ''\n rescue ::Exception => e\n puts \"Exception #{e.class} -> #{e.message}\"\n e.backtrace.each { |t| puts \"\\t#{::File.expand_path(t)}\" }\n @multiline_cmd = ''\n end", "def execute_option_or_command(options, command, args)\n options[:execute] ? eval_execute_option(options[:execute]) :\n execute_command(command, args)\n end", "def execute_command(target, command, options, *args)\n context = CommandContext.new\n\n # set some useful methods to be used by the action blocks\n context.opts = options\n context.target = target\n context.target_self = target.eval('self')\n context.output = output\n context.captures = options[:captures]\n context.eval_string = options[:eval_string]\n context.arg_string = options[:arg_string]\n context.command_set = commands\n context._pry_ = @pry_instance\n\n context.command_processor = self\n\n ret = commands.run_command(context, command, *args)\n\n options[:val].replace(\"\")\n\n ret\n end", "def execute\n raise ArgumentError, 'Abstract Method'\n end", "def run(cmd, *args)\n dispatch(cmd, *args)\n end", "def execute(cmd, options = T.unsafe(nil)); end", "def execute(cmd)\n eval(EXECUTE, binding, __FILE__, EXECUTE_LINE)\n nil\nend", "def cmd_execute(*args)\n\t\tif (args.length == 0)\n\t\t\targs.unshift(\"-h\")\n\t\tend\n channel = nil\n\t\tsession = nil\n\t\tinteract = false\n\t\tchannelized = nil\n\t\tcmd_args = nil\n\t\tcmd_exec = nil\n\t\tuse_thread_token = false\n\n\t\t@@execute_opts.parse(args) { |opt, idx, val|\n\t\t\tcase opt\n\t\t\t\twhen \"-a\"\n\t\t\t\t\tcmd_args = val\n\t\t\t\twhen \"-c\"\n\t\t\t\t\tchannelized = true\n\t\t\t\twhen \"-f\"\n\t\t\t\t\tcmd_exec = val\n\t\t\t\twhen \"-H\"\n\t\t\t\t\thidden = true\n\t\t\t\twhen \"-m\"\n\t\t\t\t\tfrom_mem = true\n\t\t\t\twhen \"-d\"\n\t\t\t\t\tdummy_exec = val\n\t\t\t\twhen \"-k\"\n\t\t\t\t\tdesktop = true\n\t\t\t\twhen \"-h\"\n\t\t\t\t\tprint(\n\t\t\t\t\t\t\"Usage: execute -f file [options]\\n\\n\" +\n\t\t\t\t\t\t\"Executes a command on the remote machine.\\n\" +\n\t\t\t\t\t\t@@execute_opts.usage)\n\t\t\t\t\treturn true\n\t\t\t\twhen \"-i\"\n\t\t\t\t\tchannelized = true\n\t\t\t\t\tinteract = true\n\t\t\t\twhen \"-t\"\n\t\t\t\t\tuse_thread_token = true\n\t\t\t\twhen \"-s\"\n\t\t\t\t\tsession = val.to_i\n\t\t\tend\n\t\t}\n\t if(channelized)\t\n channel=Channel.new(client) {|c| c.channel.exec(cmd_exec)}\n channel.type=\"exec\"\n channel.info=cmd_exec\n print_line(\"Channel #{channel.cid} created.\") if channel\n else\n print_line(client.sys.exec(cmd_exec,cmd_args))\n end\n\t\tif (interact and channel)\n\t\t\tshell.interact_with_channel(channel)\n\t\tend\n\tend", "def execute(*commands, abort_on_failure: self.class.abort_on_failure?)\n commands.each do |command_class|\n args = command.to_hash\n options = { skip_cleanup: :command, skip_validations: :receives }\n @command = command_class.call(**args, **options)\n executed.push(command)\n\n if command.failure? && abort_on_failure\n fail!\n abort!\n end\n end\n end", "def execute!; end", "def execute_command_from_command_line\n cmd = ARGV[0]\n if not cmd\n puts CMD_LINE_HELP\n elsif OPERATION_NAMES.include?(cmd) && !options.force_command\n begin\n self.send(*ARGV)\n rescue ArgumentError => ex\n $stderr.puts \"Wrong number of arguments (#{ARGV.size-1}) for operation: #{cmd}\"\n end\n else\n send_roku_command cmd\n end\n end", "def execute_command(target, command, options, *args)\n context = CommandContext.new\n\n # set some useful methods to be used by the action blocks\n context.opts = options\n context.target = target\n context.output = output\n context.command_set = commands\n\n context.command_processor = self\n\n ret = commands.run_command(context, command, *args)\n\n # Tick, tock, im getting rid of this shit soon.\n options[:val].clear\n\n ret\n end", "def run\n if parsed_options? && arguments_valid? \n process_arguments \n process_command\n else\n output_usage\n end\n end", "def run\n raise \"A subclass should override the `CLAide::Command#run` method to \" \\\n \"actually perform some work.\"\n end", "def execute\n raise NotImplementedError\n end", "def call\n raise NotImplementedError, 'Lotion::Command subclasses are expected to define #call'\n end", "def execute(*command)\n UI.say \"=> #{command.join(' ')}\".color(:green)\n success = system(*command)\n unless success\n UI.error(command.join(' '))\n exit 1\n end\n end", "def execute\n puts HEADER\n\n loop do\n cmd = gets.chomp\n\n if valid_command?(cmd)\n execute_command(cmd)\n else\n puts 'Not valid command'\n end\n end\n end", "def execute(command)\n return if command.empty?\n action_name = command.split(' ').first\n unless @context.action?(action_name)\n @context.puts \"unknown action \\\"#{action_name}\\\"\"\n return Cliqr::Executor::ExitCode.code(nil)\n end\n @context.forward(\"#{@base_command} #{command}\", environment: @context.environment)\n rescue StandardError => e\n @context.puts e.message\n end", "def call(method, *args) rpc_execute(method, *args) end", "def exec(_cmd, _args = {})\n false\n end", "def execute(params)\n raise NotImplementedError, \"#{self.class}##{__method__} must be implemented\"\n end", "def execute_command(*args)\n if args.size < 2\n display_help\n exit(1)\n end\n \n command_class = Command.commands[args.first]\n \n if command_class\n command_class.command(self,*(args[2..-1]))\n else\n display_help\n exit(1)\n end\n end", "def execute_command\n # initializing output with command name\n @output = { 'name' => @command, 'stdout' => [] }\n # where command converted into method will store it's return\n command_output = []\n\n case\n when @helper_methods.include?(@command)\n # only calling method name\n command_output << public_send(@command)\n when @check_methods.include?(@command)\n # reseting all the buffers we accumulate for a given check\n reset_status_buffer\n reset_metrics_buffer\n # calling method with command name\n command_output << public_send(@command)\n # collecting output of status methods (from GoDutch::Status)\n @output.merge!(read_status_buffer)\n # collecting metrics (from GoDutch::Metrics)\n @output['metrics'] = read_metrics_buffer\n else\n fail \"[ERROR] Invalid command: '#{@command}'\"\n end\n\n # final return on method is saved on the bottom of this flat array\n @output['stdout'] << command_output.flatten\n @output['stdout'] = @output['stdout'].flatten\n end", "def invoke(report)\n prepare_invoke!\n\n process_skipped(report, @skipped)\n process_invalid(report, @invalid)\n\n # Nothing to execute so return success\n return 0 if @commands.empty?\n\n # If there's no Gemfile, then we can't ensure the binstubs are correct\n PDK::Util::Bundler.ensure_binstubs!(cmd) unless PDK::Util::Bundler::BundleHelper.new.gemfile.nil?\n\n exec_group = PDK::CLI::ExecGroup.create(name, { parallel: false }, options)\n\n # Register all of the commands for all of the targets\n @commands.each do |item|\n command = item[:command]\n invokation_targets = item[:invokation_targets]\n\n exec_group.register do\n result = command.execute!\n begin\n parse_output(report, result, invokation_targets.compact)\n rescue PDK::Validate::ParseOutputError => e\n $stderr.puts e.message\n end\n result[:exit_code]\n end\n end\n\n # Now execute and get the return code\n exec_group.exit_code\n end", "def execute\n end", "def execute\n end", "def process_command\n # Make sure we are running from the correct directory\n puts \"Running from .. \" + Dir.pwd if $DEBUG\n\n # determing which action and forward accordingly\n method = \"cmd_\" + @arguments.shift\n if !respond_to? method\n puts \"do not have `#{method}' in my reportoire ..\"\n output_usage\n end\n send(method, *@arguments)\n rescue ArgumentError\n output_usage\n end", "def execute_command(cmd)\n command, args = parse_input(cmd)\n\n case command\n when :place\n place_robot(args)\n when :move, :left, :right\n @toy_robot.send(command)\n when :report\n puts @toy_robot.report\n when :exit\n puts 'Leaving...'\n\n exit\n end\n rescue => e\n puts \"Error: #{e.message}\"\n end", "def run\n raise \"`#{ real_command }' failed\" unless Kernel.system( real_command )\n end", "def run!\n if self.class.commands.include?(@command)\n run_command\n elsif @command.nil?\n puts \"Command required\"\n puts @parser\n exit 1\n else\n abort \"Unknown command: #{@command}. Use one of #{self.class.commands.join(', ')}\"\n end\n end", "def runner_execute!(host, commands, options = {})\n result = host.execute commands, options\n if result && result[1] == :stdout\n Trooper.logger.info \"#{result[2]}\\n\"\n true\n else \n false\n end\n end", "def execute(&block)\n define_method(:execute, &block)\n end", "def execute(command)\r\n system \"#{command}\"\r\nend", "def execute(*args)\n executes.concat(args)\n end", "def execute cmd=nil, *args, &block\n if block_given?\n # i can't think of a reason why you'd need to pass args in if you gave\n # it a block\n dispatch(self.class.worker.instance_eval(&block))\n else\n ex = ArgumentError.new('Execute must be passed a method name or block')\n raise ex unless cmd.kind_of? Symbol\n begin \n dispatch(self.class.worker, cmd, *args)\n rescue StateProcessorCannotPerformAction => e\n raise\n end\n end\n end", "def execute\n raise NotImplemented\n end", "def execute(command)\n @session.blocking_call do\n @native_channel.exec(command)\n end\n end", "def executeCommand(command, dryRun)\n #N Without this, the command won't be echoed to the user\n puts \"EXECUTE: #{command}\"\n #N Without this check, the command will be executed, even though it is intended to be a dry run\n if not dryRun\n #N Without this, the command won't be executed (when it's not a dry run)\n system(command)\n #N Without this, a command that fails with error will be assumed to have completed successfully (which will result in incorrect assumptions in some cases about what has changed as a result of the command, e.g. apparently successful execution of sync commands would result in the assumption that the remote directory now matches the local directory)\n checkProcessStatus(command)\n end\n end", "def execute(*args)\n arguments = parse args\n command = arguments.command\n\n return help if(command and [45, \"-\"].include?(command[0]))\n\n mapping = { \"-v\" => \"version\",\n \"--version\" => \"version\",\n \"version\" => \"version\",\n \"echo\" => \"echo\",\n \"open\" => \"open\" ,\n \"w\" => \"echo\",\n \"o\" => \"open\",\n \"rand\" => \"random\",\n \"r\" => \"random\",\n \"all\" => \"all\",\n \"edit\" => \"edit\",\n \"storage\" => \"storage\",\n \"help\" => \"help\",\n \"switch\" => \"switch\"}\n\n mapped = mapping[command]\n\n return self.send(mapped, arguments) if mapped\n\n return overview unless command\n\n major, minor = arguments.major, arguments.minor\n\n if(minor == 'delete') and storage.item_exists?(major)\n return delete_item(command, major)\n end\n\n\n if list = List.find(command)\n return handle_list list, major, minor\n end\n\n if item = Item.find(command)\n return say_clipboard item\n end\n\n create_list command, major, minor\n end", "def execute!(subcommand, *arguments, &block)\n log_execute subcommand, *arguments\n Dir.chdir path do\n instance.execute! subcommand.to_sym, *arguments, &block\n end\n end", "def run\n\t\traise RuntimeError, \"Command line not parsed; call parse!().\" unless @command\n\t\t$log.debug(\"#{self.class}.#{__method__}() - Performing #{@command}...\")\n\t\treturn self.send(@command)\n\tend", "def execute(command, opts = T.unsafe(nil), command_hash = T.unsafe(nil)); end", "def execute(cmd)\n res = eval(cmd, @pure_binding)\n $last_res = res\n eval(\"_ = $last_res\", @pure_binding)\n print_result res\n rescue Rush::Exception => e\n puts \"Exception #{e.class} -> #{e.message}\"\n rescue ::Exception => e\n puts \"Exception #{e.class} -> #{e.message}\"\n e.backtrace.each do |t|\n puts \" #{::File.expand_path(t)}\"\n end\n end" ]
[ "0.77980447", "0.7369215", "0.71588427", "0.7023105", "0.69770896", "0.69690865", "0.696494", "0.6884163", "0.6870792", "0.68640685", "0.68640685", "0.6844841", "0.68096685", "0.6802588", "0.6795699", "0.6784722", "0.6753237", "0.67511535", "0.6734613", "0.671731", "0.67063606", "0.66751266", "0.6661015", "0.66582066", "0.66458935", "0.6645815", "0.66332763", "0.6603845", "0.66034913", "0.6597667", "0.65970486", "0.6563684", "0.6562818", "0.65613365", "0.65552616", "0.6541748", "0.6539376", "0.6530019", "0.6513632", "0.649415", "0.6476596", "0.64670354", "0.6458313", "0.64469594", "0.6446493", "0.64411813", "0.6422872", "0.6419585", "0.64117223", "0.64080536", "0.63915694", "0.6374441", "0.63724035", "0.6369883", "0.636158", "0.635006", "0.6347412", "0.6334702", "0.6319142", "0.6317301", "0.6311408", "0.63109285", "0.63062376", "0.6300228", "0.6292605", "0.6290957", "0.628697", "0.62842196", "0.6276687", "0.62542593", "0.62456816", "0.6245515", "0.62440693", "0.62435985", "0.62297505", "0.62289625", "0.6228384", "0.6211619", "0.62088984", "0.62074083", "0.62018764", "0.6186825", "0.61805975", "0.61805975", "0.6174779", "0.6167209", "0.6159972", "0.61581093", "0.6157356", "0.6155828", "0.6155391", "0.61514354", "0.61466384", "0.6140816", "0.6130364", "0.61272514", "0.61201763", "0.6115741", "0.6114318", "0.61101174", "0.61097103" ]
0.0
-1
Record that an attempt was made to execute this command whether or not it was successful.
def execution_attempted! #:nodoc: @execution_attempted = true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_successful_execution(cmd)\n @commands << cmd\n end", "def succeed!\n self.success = true\n self\n end", "def execute\n begin\n return false unless check_guards\n execute_actions\n rollback_actions unless self.failed_action.nil?\n self.failed_action.nil?\n ensure\n self.save!\n end\n end", "def execution_attempted?\n @execution_attempted\n end", "def success?\n execution_attempted? && errors.empty?\n end", "def success!\n @success = true\n end", "def check_execute\n unless executed?\n execute\n end\n end", "def record result; @success = true; end", "def last_command_successful?\n $?.exitstatus == 0\n end", "def augment_success(send, line)\n @phase = :execute\n @augmented_code = make_runnable(@augmented_code)\n\n send.call([\n {:write_file => {:filename => @filename, :content => @augmented_code}},\n {:execute => {:command => \"env PYTHONPATH=$LIB$/python #{VM_PYTHON} -B #{@filename}\",\n :stdout => 'executeoutput',\n :stderr => 'executeerror'}}])\n # Don't output anything\n return {:type => :no}\n end", "def run_succeeded; end", "def succeed\n # no-op\n end", "def successful?\n exit_code == 0\n end", "def success!\n end", "def success?; end", "def success?; end", "def success?; end", "def success?; end", "def success?; end", "def success?; end", "def try!\r\n raise \"Invalid status: message must be in progress to try!\" unless [:in_progress].include? self.status\r\n\r\n new_status = self.execute\r\n if :retry == new_status\r\n if self.tries >= self.max_tries\r\n new_status = :fail\r\n logger.fatal \"AsyncCommand #{self.id} failed on #{self.max_tries} maximum tries\"\r\n else\r\n self.push_next_try_at\r\n end\r\n end\r\n self.status = new_status\r\n self.save!\r\n end", "def run_success(*command, **opts, &b)\n\t\t\tstatus, _out, _error = run(*command, **opts, &b)\n\t\t\tstatus.success?\n\t\tend", "def success!(info = nil)\n @logger.error { info } if info\n @successes += 1\n end", "def commandResult\n\t\t\t%x(#{@cmd} 2> /dev/null)\n\t\tend", "def success!\n ensure_empty_errors!\n ensure_empty_status!\n\n self.performable_status = :success\n self\n end", "def success?; terminal_flag == :success end", "def success?; terminal_flag == :success end", "def execute\n raise errors.to_sentences unless valid?\n\n # default failing command\n result = false\n\n # protect command from recursion\n mutex = Mutagem::Mutex.new('revenc.lck')\n lock_successful = mutex.execute do\n result = system_cmd(cmd)\n end\n\n raise \"action failed, lock file present\" unless lock_successful\n result\n end", "def successful?\n error.nil?\n end", "def succeeded?; state == 'succeeded'; end", "def succeeded?; state == 'succeeded'; end", "def successful_executions order = nil\n connection.successful_executions_for_user id, order\n end", "def update_success\n @last_failed = false\n @retries = 0\n true\n end", "def succeeded!\n blackboard.succeeded!\n self\n end", "def do_success; end", "def successful?\n @successful\n end", "def execute_with_exit(command) # rubocop:disable Lint/UnusedMethodArgument\n end", "def succeeds?(command)\n system(\"#{command} > /dev/null 2> /dev/null\")\n $? == 0\n end", "def executed\n @process_status.nil? ? false : true\n end", "def successful_call\n return @successful_call\n end", "def success?\n exit_code == 0\n end", "def failed!\n @success = false\n end", "def success?() end", "def run_and_success?(cmd)\n run(cmd).success?\n end", "def success; end", "def success; end", "def successful?\n @code == 0\n end", "def success\n @success.call(self) if @success\n end", "def executed?\r\n @executed\r\n end", "def connection_successful\n @connection_deferrable.succeed\n end", "def success\n is_successful?\n end", "def success?\n @succeeded\n end", "def run\n begin\n execute\n say('')\n success \"Done.\"\n rescue CommandAborted, UnrecoverableError => e\n error(e.message)\n exit(255)\n end\n end", "def execute_command!(*argv)\n execute_command(argv)\n raise Error.new(\"Command failed!\") unless $?.success?\n end", "def process_ok\n @@last_command_symbol = current_symbol\n super\n end", "def process_ok\n @@last_command_symbol = current_symbol\n super\n end", "def process_ok\n @@last_command_symbol = current_symbol\n super\n end", "def process_ok\n @@last_command_symbol = current_symbol\n super\n end", "def success?\n exit_status == 0\n end", "def successful?\n @success\n end", "def succeed(*args)\n super(*args)\n end", "def successful?\n a = any_args? ? [:any] : @args\n begin\n @recorder.was_called?(@method_name, @block_args, @mode, *a)\n rescue ArgumentError\n false\n end\n end", "def error!\n @error = true\n end", "def executed?\n @executed\n end", "def was_successful?\n self.class.job_run_class.was_successful?(@job, @batch)\n end", "def execute\n Monads.create_success(perform)\n rescue StandardError => exception\n Monads.create_failure(exception)\n end", "def successful?\n return self.error.nil?\n end", "def interpret_exit(command)\n @finished = true\n end", "def execute!; end", "def run_successful_command(broker, targets, command, **kwargs, &block)\n run_command(broker, targets, command) do |response_dataset|\n ensure_successful(broker, targets, response_dataset, **kwargs, &block)\n end\nend", "def process; raise CommandError, \"command '#{command_name}' not implemented\" end", "def executed?\n @executed\n end", "def ok(command)\n end", "def successful?(problem)\n return true if (problem[:arguments].first + ADDITION) == problem[:response]\n\n false\n end", "def successful?\n @progress == 'COMPLETED'\n end", "def post_execute(environment)\n if keep\n # The (temporary) result of this command should be kept on the GPU. Store a\n # pointer to the result in global memory in an instance variable.\n\n begin\n @gpu_result_pointer = environment[(\"prev_\" + unique_id.to_s).to_sym].to_i\n Log.info(\"Kept pointer for result of command #{unique_id.to_s}: #{@gpu_result_pointer}\")\n return true \n rescue ArgumentError\n # No pointer saved for this command. This can happen if the result of this\n # command was already cached earlier and the cached result of a\n # computation based on this command was used now. \n Log.info(\"No pointer kept for result of command #{unique_id.to_s}.\")\n return false\n end\n end\n\n return false\n end", "def successful?\n if @successful.nil?\n true\n else\n @successful\n end\n end", "def success?\n terminal_flag == :success\n end", "def attempted_record\n @attempted_record\n end", "def successful?\n !!get_status_method\n end", "def failed?; failed_to_start? || (@success == false) end", "def status\n Command::Installer::Status.new(\n *command_params\n ).execute\n rescue => e\n catch_errors(e)\n end", "def succeeded?\n result == \"SUCCESS\"\n end", "def execute(command)\n system command\n code = $?.exitstatus\n if code > 0\n LOGGER.warn \"Failed to execute command `#{command}` with code #{code}.\"\n false\n else\n true\n end\n end", "def confirm_execution(*args)\n # pass\n end", "def success?\n @error == false\n end", "def success\n end", "def success?\n not failure_occurred\n end", "def success?\n not failure_occurred\n end", "def success?\n true\n end", "def successful?\n status == :successful\n end", "def successful?\n status == :successful\n end", "def fails?(command)\n !succeeds?(command)\n end", "def execute(command) # rubocop:disable Lint/UnusedMethodArgument\n end", "def fr_error input\n if @calling_command.nil? then\n $stderr.puts input\n else\n @calling_command.stderr = \"#{calling_command.stderr}#{input}\\n\"\n @calling_command.save\n end\n end", "def success?\n false\n end", "def success?\n false\n end", "def performed?; end", "def performed?; end", "def success?(*) end" ]
[ "0.6744505", "0.6358301", "0.6345598", "0.63297653", "0.6318208", "0.62229633", "0.6206643", "0.6139654", "0.61036855", "0.6089372", "0.60835266", "0.6078316", "0.6036439", "0.59802395", "0.59462726", "0.59462726", "0.59462726", "0.59462726", "0.59462726", "0.59462726", "0.590366", "0.58708066", "0.5859751", "0.584311", "0.5842352", "0.5841779", "0.5841779", "0.58275115", "0.58007354", "0.5791201", "0.5791201", "0.57842904", "0.5782985", "0.57709056", "0.5763138", "0.5739881", "0.5735685", "0.5706626", "0.56994253", "0.5685496", "0.5683944", "0.567998", "0.5679854", "0.56642157", "0.566418", "0.566418", "0.5656399", "0.56487775", "0.5636152", "0.56342447", "0.5628567", "0.5626177", "0.56245106", "0.56144446", "0.5611816", "0.5611816", "0.5611816", "0.5611816", "0.5591989", "0.5591519", "0.5588247", "0.5580995", "0.5579928", "0.5573461", "0.55594647", "0.55442333", "0.55399746", "0.5536017", "0.5523947", "0.5507634", "0.54965097", "0.5490199", "0.5482846", "0.5480757", "0.5472064", "0.5469459", "0.5468019", "0.5464821", "0.54619056", "0.5459208", "0.5454459", "0.54517925", "0.5448125", "0.54398406", "0.54389334", "0.54383165", "0.5432733", "0.5431087", "0.5431087", "0.54308975", "0.5428002", "0.5428002", "0.542463", "0.54173493", "0.5416538", "0.5412296", "0.5412296", "0.54105943", "0.54105943", "0.5410406" ]
0.72476405
0
True if execution has been attempted on this command
def execution_attempted? @execution_attempted end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execution_attempted! #:nodoc:\n @execution_attempted = true\n end", "def success?\n execution_attempted? && errors.empty?\n end", "def check_execute\n unless executed?\n execute\n end\n end", "def was_executed?\n execution_count > 0\n end", "def executed?\n @executed\n end", "def ran?\n completed? || failed?\n end", "def executed?\r\n @executed\r\n end", "def executed\n @process_status.nil? ? false : true\n end", "def execute?(cmd)\n execution_result = execute(cmd)\n !execution_result.nil? && execution_result\n end", "def run_and_success?(cmd)\n run(cmd).success?\n end", "def executed?\n @executed\n end", "def last_command_successful?\n $?.exitstatus == 0\n end", "def has_successful_execution(cmd)\n @commands << cmd\n end", "def succeeds?(command)\n system(\"#{command} > /dev/null 2> /dev/null\")\n $? == 0\n end", "def successful?\n exit_code == 0\n end", "def attempted?\n !!attempted\n end", "def ran?\n @result != Result::NoResult\n end", "def fails?(command)\n !succeeds?(command)\n end", "def command_issued?\n @channel_control.command_given?\n end", "def executing_user_command?\n @executing_user_command\n end", "def ok?\n run unless ran?\n\n @status.success?\n end", "def failure?\n exit_code != 0\n end", "def success?\n exit_code == 0\n end", "def execute\n if job.execute\n return true\n else\n return false\n end\n end", "def success?\n exit_status == 0\n end", "def failed?\n true\n end", "def continue_execution?\n (Time.now.to_f - scheduled_at.to_f) * 1000.0 < time && thread.alive? && can_exec\n end", "def success?\n failed_mutations.empty?\n end", "def passing?\n return false if self.test_executions.empty?\n \n most_recent_execution = self.ordered_executions.first\n return !most_recent_execution.nil? && most_recent_execution.passing?\n end", "def failed?\n !succeeded? && !in_progress?\n end", "def successful?\n !output.kind_of?(Error)\n end", "def has_run?\n @passed != nil\n end", "def failed?\n !succeeded? && !in_progress?\n end", "def ok?\n @performed && !any_errors? && !any_warnings?\n end", "def failed?\n not @ok\n end", "def is_cmd_works? (command)\n output = `#{command}`\n fail(\"#{command} doesn't work. see output: #{output}.\") unless $?.success?\n output\n end", "def succeeded?\n errors.empty?\n end", "def failed?; failed_to_start? || (@success == false) end", "def cmd_succeeds(cmd)\n system_cmd(cmd).should be true\n end", "def exec?(cmd, options={})\n exit_status, stdout, stderr, cmd = exec(cmd, options)\n return (exit_status == 0)\n end", "def attempted?\n 'Attempted' == result\n end", "def complete?\n result? || error?\n end", "def is_valid_for_execution\n (@metadata[\"short_dest_repo_name\"] == \"osrf/gazebo\" and @pr_status == :update) ? false : true\n end", "def performed?\n [email protected]?\n end", "def successful?\n @code == 0\n end", "def run_succeeded; end", "def command_given?\n [email protected]?\n end", "def success?\n return @process.success? if @process\n return false\n end", "def successful?\n a = any_args? ? [:any] : @args\n begin\n @recorder.was_called?(@method_name, @block_args, @mode, *a)\n rescue ArgumentError\n false\n end\n end", "def success?\n terminal_flag == :success\n end", "def ok?\n @result.retval == 0\n end", "def finished?\n failed? or successful? or skipped?\n end", "def execute_query?\n [email protected]?\n end", "def succeeded?\n finished? && !discarded?\n end", "def success?() end", "def successful?\n error.nil?\n end", "def error_in_script?\n no_script? || non_existing_script? || invalid_script?\n end", "def done?\n exit_status.present?\n end", "def failing?\n completed? && has_failures? || has_errors?\n end", "def success?\n finished? and !exception\n end", "def success?\n return true\n end", "def executing_job?\n @executing_job == true\n end", "def execute_mode?\r\n @context[:mode] == :execute\r\n end", "def succeeded?; state == 'succeeded'; end", "def succeeded?; state == 'succeeded'; end", "def success?\n @succeeded\n end", "def run?\n @run\n end", "def finished?\n \tfailed_attempts >= MAX_FAILED_ATTEMPTS || !guessed?\n\tend", "def valid_request?\n if env.include_all?(['SSH_CLIENT', 'SSH_CONNECTION', 'SSH_ORIGINAL_COMMAND'])\n if valid_command?(env['SSH_ORIGINAL_COMMAND'])\n return true\n end\n end\n false\n end", "def executing?(name)\n !stack(name).empty?\n end", "def check_command_policy\n true\n end", "def can_run?\n return false if locked_open?\n\n closed? || locked_closed? || half_open?\n end", "def failed?\n @is_failed\n end", "def success?\n not failure_occurred\n end", "def success?\n not failure_occurred\n end", "def pending?; !failed_to_start? && !starting? && !started? &&\n (!execution_engine || !execution_engine.has_error_from?(self))\n end", "def success?\n\t\t!!( @status and @status.exitstatus == 0 )\n\tend", "def no_command?\n exit_code == 127\n end", "def success?\n completed? && !error?\n end", "def success?\n @error == false\n end", "def successful?\n !!get_status_method\n end", "def successful?\n output_exists? && expected_output_path\n end", "def success?\n [missing, unexpected, no_diffs, invalid_syntax].all?(&:empty?)\n end", "def has_errors?\n return @exitcode == 2 || @exitcode == 1\n end", "def failed?\n complete? && !all_nodes_succeeded?\n end", "def failed?\n complete? && !all_nodes_succeeded?\n end", "def success?\n reply_code == 0\n end", "def failure?\n terminal_flag == :failure\n end", "def task_execution_phase?\n @task_execution_phase\n end", "def success?\n false\n end", "def success?\n false\n end", "def ok?\n @stack.stack_status == 'CREATE_COMPLETE' ||\n @stack.stack_status == 'UPDATE_COMPLETE'\n end", "def successful?\n return self.error.nil?\n end", "def successful?\n @code.nil?\n end", "def successful?\n status == :successful or tasks_are_successful?\n end", "def do?\n execute_true? flush\n end", "def success?\n return @process.success? if @process\n return false\n end", "def expired_execution?\n @report_errors.each do |err|\n if err =~ /execution expired$/\n return true\n end\n end\n return false\n end", "def server_probably_launched?\n success? || server_error?\n end", "def should_run?\n raise NoMethodError\n end" ]
[ "0.7831649", "0.7752585", "0.7413956", "0.7404941", "0.73951423", "0.7382643", "0.7374486", "0.7361519", "0.7302127", "0.7281738", "0.7263574", "0.71961886", "0.69499964", "0.6949619", "0.6944002", "0.69339454", "0.6927709", "0.69122976", "0.69026864", "0.6850913", "0.6821138", "0.6778855", "0.6760014", "0.67189705", "0.6694412", "0.6681482", "0.6588256", "0.6577736", "0.6546673", "0.65314656", "0.65314335", "0.6497063", "0.64956814", "0.6488983", "0.64574647", "0.6450883", "0.6442586", "0.64293265", "0.6418579", "0.6417067", "0.64130926", "0.6375162", "0.6373344", "0.63600177", "0.6342188", "0.63311017", "0.6321306", "0.63157696", "0.63155454", "0.63118", "0.63089675", "0.63047", "0.6301655", "0.6294168", "0.6290158", "0.62901556", "0.6289283", "0.6283254", "0.62831223", "0.62806326", "0.62721777", "0.6269327", "0.62485695", "0.6237368", "0.6237368", "0.6226783", "0.6221683", "0.620624", "0.6197033", "0.619448", "0.61877835", "0.61764944", "0.6172278", "0.6170949", "0.6170949", "0.6169544", "0.6167481", "0.61601675", "0.61583066", "0.6154478", "0.6148109", "0.6147478", "0.61401975", "0.61390287", "0.6136772", "0.6136772", "0.6130778", "0.612261", "0.6122265", "0.6114922", "0.6114922", "0.6103843", "0.6101124", "0.6099496", "0.60919315", "0.6089895", "0.6087369", "0.6068382", "0.60682976", "0.60664994" ]
0.82137465
0
Command has been executed without errors
def success? execution_attempted? && errors.empty? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute_command(command)\n end", "def execute_command(command)\n end", "def process; raise CommandError, \"command '#{command_name}' not implemented\" end", "def execute(command)\n end", "def execute(command) # rubocop:disable Lint/UnusedMethodArgument\n end", "def command_found; end", "def process\n raise CommandError, \"command '#{command_name}' not implemented\"\n end", "def ok(command)\n end", "def run\n raise Error, \"Unknown command `#{command_name}`\"\n end", "def command; end", "def command; end", "def command; end", "def command; end", "def command; end", "def command; end", "def run(cmd)\n result = super(cmd)\n if result.error?\n display \"FAILURE\"\n display result.error\n remove_livedev_run_file\n exit 1\n end\n end", "def check_execute\n unless executed?\n execute\n end\n end", "def command\n fail 'Not implemented.'\n end", "def original_run_command; end", "def run\n raise \"`#{ real_command }' failed\" unless Kernel.system( real_command )\n end", "def execute_with_exit(command) # rubocop:disable Lint/UnusedMethodArgument\n end", "def execute!; end", "def run_cmd(cmd)\n\tend", "def execute\n end", "def execute\n end", "def has_successful_execution(cmd)\n @commands << cmd\n end", "def execute; end", "def execute; end", "def execute_command!(*argv)\n execute_command(argv)\n raise Error.new(\"Command failed!\") unless $?.success?\n end", "def execute\n\n end", "def execute\n end", "def execute\n end", "def execute\n raise NotImplementedError, 'Generic command has no actions'\n end", "def run_cmd cmd\n msg { \"{@Darn, you can't run commands yet.\\n\\n#{location.long_appearance}\" }\n end", "def cmd; end", "def execute\n end", "def execute\n raise \"you need to define #execute\"\n end", "def execute_hook(command); end", "def run_command(arguments)\n raise \"Specified command did not implement 'run_command' method.\"\n end", "def before_exec_command\n end", "def handle_missing_command( command )\n\t\terror_message \"#$0: #{command}: command not found\"\n\tend", "def execute command\n log command\n system(command) unless @options[:test]\n end", "def do_execute\n raise StandardError, \"Not implemented!\"\n end", "def execute()\n\n end", "def execute()\n\n end", "def command_given?\n [email protected]?\n end", "def execute\n parse_command\n run_command(command)\n end", "def done(command)\n end", "def run\n begin\n execute\n say('')\n success \"Done.\"\n rescue CommandAborted, UnrecoverableError => e\n error(e.message)\n exit(255)\n end\n end", "def invalid_command\n # code invalid_command here\n puts \"Please enter a valid command\"\nend", "def invalid_command\n puts \"Please enter a valid command\"\n #invalid_command\n # code invalid_command here\nend", "def run_succeeded; end", "def execute\n raise \"Not Implemented\"\n end", "def validate!\n if not respond_to?(\"perform_#{command}!\")\n type = self.class.to_s.split(\"::\").last.downcase\n error \"Unknown #{y(type)} command: <#{r(command)}>\"\n error \"Run #{y(\"gitpusshuten help #{type}\")} for a list #{y(type)} commands.\"\n exit\n end\n end", "def execute(command)\n if valid_command?(command)\n apply_command(command)\n else\n return 'Invalid command.'\n end\n end", "def commands; end", "def run_failed; end", "def commandResult\n\t\t\t%x(#{@cmd} 2> /dev/null)\n\t\tend", "def run_and_examine(command)\n response = IO.popen(command).readlines\n response.each { |response_line| @errors << response_line if response_line =~ /Error/i }\n puts \">#{command}\\n#{response.join}\" if $verbose || (@errors.size > 0)\n @errors.size == 0\n end", "def command_start; end", "def command_start; end", "def command_start; end", "def validate_command\n\t \tcommand_types = ['get_authorization_url','update_site_registration', 'get_tokens_by_code','get_user_info', 'register_site', 'get_logout_uri','get_authorization_code','uma_rs_protect','uma_rs_check_access','uma_rp_get_rpt','uma_rp_authorize_rpt','uma_rp_get_gat']\n\t \tif (!command_types.include?(@command))\n\t\t\t\tlogger(:log_msg => \"Command: #{@command} does not exist! Exiting process.\")\n \tend\n\t end", "def unknown_command\n $stderr.puts \"No task named #{@command.inspect}\"\n exit(1)\n end", "def exec; end", "def exec; end", "def exec\n binding.pry\n # command.run(*service.exec(args.command))\n end", "def halted(command)\n end", "def execute\n raise NotImplementedError.new('run is an abstract method in BaseCommand. Please override.')\n end", "def run\n system(command)\n $?\n end", "def run\n system(command)\n $?\n end", "def invalid_command\n puts \"Please enter a valid command\"\nend", "def invalid_command\n puts \"Please enter a valid command\"\nend", "def action_error\n puts\n puts \"Sorry, I don't recognize that command.\"\n puts\nend", "def invalid_command\n puts \"Please enter a valid command\"\nend", "def run_cmd cmd\n info cmd\n status = system(cmd)\n if status\n info(\"Woot! Woot! - command succeeded #{cmd}\")\n else\n error(\"Gahhhh! Bad status from #{cmd}\")\n end\n status\n end", "def execute(command)\n raise ClientError, \"#{self.class}#execute must be implemented\"\n end", "def process_command_safely(val)\n process_command(val)\n rescue CommandError,\n Pry::Slop::InvalidOptionError,\n MethodSource::SourceNotFoundError => e\n Pry.last_internal_error = e\n output.puts \"Error: #{e.message}\"\n true\n end", "def execute(cmd)\n Util.execute(cmd)\n end", "def execute(command)\n invoke_command(command, nil)\n end", "def statuscmd\n end", "def run\n raise \"A subclass should override the `CLAide::Command#run` method to \" \\\n \"actually perform some work.\"\n end", "def execute!\n if Mcir::Core.instance.dryrun?\n Mcir::Core.instance.debug(\"CMD: \".purple << \"#{self.to_s.gsub(\"\\r\", \"\")}\")\n \"skipped execution due to dryrun\"\n else\n case @mode\n when :exec then exec(self.to_s)\n when :open then IO.new(self).open3\n when :capture then IO.new(self).capture3\n when :backticks then IO.new(self).backtick\n end\n end\n end", "def execute(command)\n return if command.empty?\n action_name = command.split(' ').first\n unless @context.action?(action_name)\n @context.puts \"unknown action \\\"#{action_name}\\\"\"\n return Cliqr::Executor::ExitCode.code(nil)\n end\n @context.forward(\"#{@base_command} #{command}\", environment: @context.environment)\n rescue StandardError => e\n @context.puts e.message\n end", "def execute\n fail NotImplementedError\n end", "def unknown_command(method, line)\n\n\t\t[method, method+\".exe\"].each do |cmd|\n\t\t\tif (command_passthru == true and Rex::FileUtils.find_full_path(cmd))\n\n\t\t\t\tprint_status(\"exec: #{line}\")\n\t\t\t\tprint_line('')\n\n\t\t\t\tself.busy = true\n\t\t\t\tbegin\n\t\t\t\t\tio = ::IO.popen(line, \"r\")\n\t\t\t\t\tio.each_line do |data|\n\t\t\t\t\t\tprint(data)\n\t\t\t\t\tend\n\t\t\t\t\tio.close\n\t\t\t\trescue ::Errno::EACCES, ::Errno::ENOENT\n\t\t\t\t\tprint_error(\"Permission denied exec: #{line}\")\n\t\t\t\tend\n\t\t\t\tself.busy = false\n\t\t\t\treturn\n\t\t\tend\n\t\tend\n\n\t\tsuper\n\tend", "def execute()\r\n\tend", "def run(cmd)\n log cmd\n system(cmd) or fail \"Command Failed: [#{cmd}]\"\n end", "def run(cmd)\n log cmd\n system(cmd) or fail \"Command Failed: [#{cmd}]\"\n end", "def exec(_cmd, _args = {})\n false\n end", "def unknown_cmd(cmd)\n\t\t\t\t\"Unknown command: #{cmd}\"\n\t\t\tend", "def run_command f\n return\nend", "def process_command\n # Make sure we are running from the correct directory\n puts \"Running from .. \" + Dir.pwd if $DEBUG\n\n # determing which action and forward accordingly\n method = \"cmd_\" + @arguments.shift\n if !respond_to? method\n puts \"do not have `#{method}' in my reportoire ..\"\n output_usage\n end\n send(method, *@arguments)\n rescue ArgumentError\n output_usage\n end", "def executeUploadCmd(cmd)\n puts \"Executing command : \" + cmd\n output = `#{cmd}`\n exitStatus = $?\n output.downcase!\n\n puts \"OUTPUT FROM LIMS : \"\n puts output\n\n if output.match(/error/)\n puts \"ERROR IN UPLOADING ANALYSIS RESULTS TO LIMS\"\n puts \"Error Message From LIMS : \" + output\n handleError(\"Error in upload sequence metrics to LIMS for \" + @fcBarcode) \n elsif output.match(/success/)\n puts \"Successfully uploaded to LIMS\"\n end\n end", "def verify\n verify_commands if commands.any?\n end", "def run_cmd(cmd)\n puts blue(cmd)\n raise unless system cmd\n end", "def last_command_successful?\n $?.exitstatus == 0\n end", "def execute(command)\n @command = command\n self\n end", "def process\n command = get_command()\n\n if command\n verify_command(command)\n else\n help\n end\n end", "def original_run_command=(_arg0); end", "def status\n Command::Installer::Status.new(\n *command_params\n ).execute\n rescue => e\n catch_errors(e)\n end" ]
[ "0.7556733", "0.7556733", "0.7535264", "0.74686235", "0.74166733", "0.7223935", "0.71668905", "0.7041987", "0.6988358", "0.6974575", "0.6974575", "0.6974575", "0.6974575", "0.6974575", "0.6974575", "0.69261885", "0.68849635", "0.6884021", "0.68041176", "0.67573965", "0.6755554", "0.67486084", "0.67461026", "0.6740017", "0.6740017", "0.67371345", "0.6729625", "0.6729625", "0.6703393", "0.6688405", "0.66834396", "0.66834396", "0.6668174", "0.66590303", "0.66553", "0.66498154", "0.66316247", "0.6625464", "0.66135097", "0.6593903", "0.65678346", "0.65648055", "0.6564449", "0.655412", "0.655412", "0.6551798", "0.6538836", "0.65201", "0.6516196", "0.65074795", "0.64991325", "0.64954436", "0.64930695", "0.6492636", "0.6469015", "0.6455342", "0.6442256", "0.64137834", "0.6411734", "0.6394533", "0.6394533", "0.6394533", "0.6389814", "0.6378539", "0.6362643", "0.6362643", "0.6360558", "0.635412", "0.63529605", "0.6331293", "0.6331293", "0.63289016", "0.63289016", "0.63192505", "0.63112843", "0.62817466", "0.62803036", "0.62740606", "0.6273462", "0.6261867", "0.6257087", "0.6249697", "0.6240518", "0.62405115", "0.62353814", "0.6233347", "0.62321466", "0.62071145", "0.62071145", "0.62047195", "0.62004656", "0.61965644", "0.6193071", "0.61861426", "0.6172697", "0.6164136", "0.6159826", "0.615829", "0.61553395", "0.61502075", "0.61494315" ]
0.0
-1
Returns hash of all parameter names and values
def parameters self.class.parameters.each_with_object({}) do |parameter, hash| hash[parameter.name] = send(parameter.name) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_hash\n rethash = {}\n\n @parameters.each do |name, obj|\n rethash[name] = obj.value\n end\n\n rethash\n end", "def params_to_hash\n {}\n end", "def hashParameters params\n\n\t# Create a temp array\n\tparameters = []\n\n\t# Load each element into a one dimensional array\n\tparams.each do |p|\n\t\tp.each do |x|\n\t\t\tparameters << x\n\t\tend\n\tend\n\n\t# Convert to a hash and return\n\tparameters = Hash[*parameters]\nend", "def parameters\n h = {}\n keys.each { |k| h[k.to_sym] = Jeapie.instance_variable_get(\"@#{k}\") }\n h\n end", "def to_parameters\n h = {}\n attribute_names.each do |name|\n h.store name, instance_variable_get(\"@#{name}\")\n end\n h\n end", "def get_params()\n return self.params.keys\n end", "def get_key_value_params(params)\n key_value_hash=Hash.new\n\n params.each do |param|\n key_value_hash[param.name]=param.value\n# puts \"kv:\"+param.name+\"->\"+param.value\n end\n\n return key_value_hash\n end", "def hash\n hash_args.hash\n end", "def parameters_hash(provider_class_name=nil)\n parameters_hash = {}\n @resource.parameters_with_value.each do |parameter|\n parameters_hash.store parameter.name, parameter.value\n end\n parameters_hash.store :name, basic_service_name\n parameters_hash.store :provider, provider_class_name if provider_class_name\n parameters_hash\n end", "def param_hash(*keys)\n params.to_unsafe_h\n .deep_symbolize_keys\n .then { |hash| keys.empty? ? hash : hash.slice(*keys) }\n .compact\n end", "def to_params\n @params ||= each_with_index.map do |key, index|\n \"$%s::%s\" % [index.next, hash[key]]\n end.join(\", \")\n end", "def params(parameters)\n parameter_list = []\n parameters.each do |k, v|\n parameter_list.push(parameter_key: k, parameter_value: v)\n end\n parameter_list\n end", "def cast_to_hash(params); end", "def parameters_hash(recursive = false)\n result = parameters.each_with_object({}) do |param, result|\n result[param.name] = param.to_hash(recursive)\n end\n child_parameters(mapped: false, recursive: true).each do |param|\n result[param.reference_name] = param.to_hash(recursive)\n end if recursive\n result\n end", "def parameters()\n result = @data[\"parameters\"] || {}\n raise HashExpectedException.new() unless result.class == Hash\n return result\n end", "def to_hash\n self.class.operands.inject({}) do |result, (param_name, param_options)|\n result[param_name] = instance_variable_get(\"@#{param_name}\")\n result\n end\n end", "def hash\n [name, args].hash\n end", "def to_h\n @params.dup.with_indifferent_access\n end", "def params\n instance_variables.map do |var|\n normalized_var = var.to_s.gsub(/^@/, '')\n next if BLACKLISTED_INSTANCE_VARIABLES.include?(normalized_var)\n\n [normalized_var, instance_variable_get(var)]\n end.compact.to_h\n end", "def keys\n @params.keys\n end", "def to_h\n @params\n end", "def to_hash\n Hash[instance_variables.map { |var| [var[1..-1].to_sym, instance_variable_get(var)]}]\n end", "def hash\n instance_variables.map do |var|\n instance_variable_get(var).hash\n end.reduce(:^)\n end", "def params_digest\n # return Digest::SHA1.hexdigest(params.sort.flatten.join(\"_\"))\n Digest::SHA1.hexdigest(params.to_s)\n end", "def parameters\n @parameters ||= {}\n end", "def parameters\n @parameters ||= {}\n end", "def parameters_as_string(hash)\n hash.keys.sort.map{|key| %{#{key}=#{hash[key]}}} * '&'\n end", "def parameter_names\n @parameters.map { |info| info.name }.join(', ')\n end", "def fields_hash\n each_pair.to_h\n end", "def pnames\n @params.keys\n end", "def parameters\n result = (defined? @object.arguments) ? @object.arguments : {}\n result\n end", "def to_params\n attrs = Hash.new\n instance_variables.each do |ivar|\n name = ivar[1..-1]\n attrs[name.to_sym] = instance_variable_get(ivar) if respond_to? \"#{name}=\"\n end\n attrs\n end", "def values\n to_hash(:symbolize_keys => true)\n end", "def keys\n self.parameters.table.keys\n end", "def params_digest\n return Digest::SHA1.hexdigest(params.sort.flatten.join(\"_\"))\n end", "def parameterize(hash)\n _hash = {}\n hash.each do |k,v|\n _hash[k.to_sym] = parameterized?(k) ? attributes_to_hash(v) : v\n end\n _hash\n end", "def hash\r\n\t\treturn @name.hash() + @type.hash()\r\n\tend", "def to_hash\n Hash[instance_variables.map { |name| [name.to_s.gsub(\"@\",\"\").to_sym, instance_variable_get(name)] } ]\n end", "def values_hash\n hashify(:value)\n end", "def params\n { :only => self.attrs, :methods => self.methds }\n end", "def get_params_hash(params)\n params_hash = {}\n\n if !params.nil? && !params.empty?\n params = percent_decode(params)\n params.split('&').each do |param|\n param_pair = param.split('=')\n params_hash[percent_encode(param_pair[0])] = percent_encode(param_pair[1])\n end\n end\n\n params_hash\n end", "def hash\n vari = 0\n\n args = arg_list.clone\n\n args.each do |var1|\n next if var1.const?\n\n vari += 1\n new_var = Variable.new(vari.to_s)\n\n args.each.with_index do |var2, idx|\n args[idx] = new_var if !var2.const? && var2.name == var1.name\n end\n end\n\n ([name] + args).map { |v| v.hash }.hash\n end", "def get_params\n\n return @params.map { |p| \n Param.new(\n name,\n @params[name].get_data(\"value\"),\n @params[name].get_data(\"type\"),\n true\n ) \n }\n end", "def all_valuefield_hash\n hash = {}\n items = @all_valuefields\n for vf in items\n hash[vf] = {}\n end\n return hash\n end", "def params\n { :only => self.attrs, :methods => self.methds }\n end", "def hash\n fields.map { |field| instance_variable_get(field[:name]) }.hash\n end", "def to_hash\n hash = {}\n instance_variables.each {|var|\n varname = var.to_s.delete(\"@\")\n if SPECIAL_PARAMS.include? varname\n hash[\"$\"+varname] = instance_variable_get(var)\n else\n hash[varname] = instance_variable_get(var)\n end\n }\n hash\n end", "def param_name\n if keys.length > 1\n first, *rest = keys\n v = first.dup\n rest.each do |param|\n v << \"[\"\n v << param unless param.is_a?(Integer)\n v << \"]\"\n end\n v\n else\n keys.first\n end\n end", "def to_hash\n h = {}\n self.instance_variables.each do |variable|\n h[variable[1..-1].to_sym] = self.instance_variable_get(variable)\n end\n h\n end", "def to_hash\n values\n end", "def __get_params(data)\n \n # If named arguments used, assigns keys as symbols\n # but keeps numeric arguments as integers\n \n if @params.kind_of? Hash\n @params = @params.dup\n @keyword_params = JsonRpcObjects::Utils::Hash.remove!(@params) do |k, v|\n not JsonRpcObjects::Utils::String.numeric? k\n end\n \n @params = @params.sort_by { |i| i[0].to_i }.map { |i| i[1] }\n else\n @keyword_params = { }\n end\n \n JsonRpcObjects::Utils::Hash.keys_to_sym! @keyword_params\n \n end", "def normalize\n @parameters.inject({}) do |hash, (k, v)|\n v = v.is_a?(Array) ? v.join(',') : v.to_s\n k = k.to_s.split('_').map {|w| w[0, 1] = w[0, 1].upcase; w }.join\n hash[k] = v\n\n hash\n end\n end", "def parameters\n context.parameters.map(&:name)\n end", "def to_hash\n { name_as_hash_key => @values }\n end", "def hash\n [hint,name,ordinal,module_name].hash\n end", "def get_hash_data\r\n return CallInitiate.decode_call_params(get_variable(\"CallInitiate_hashdata\"))\r\n\tend", "def introspect_params\n params = self.class.instance_method(:call).parameters\n return context.keys if params.map(&:first).include?(:keyrest)\n\n params.map(&:last)\n end", "def to_params\n Parameters.new(to_hash)\n end", "def named_arguments\n arguments.select { |arg| arg.is_a? Hash }.first || {}\n end", "def all_params; end", "def to_hash\n ret = {}\n \n self.methods.select{ |it| it.id2name[-1] == '=' and !['==', '!='].include?(it.id2name) }.each do |method|\n name = method.id2name.gsub('=', '')\n \n if method.id2name[-1] == '=' and self.respond_to?(name) \n val = self.method(name).call \n ret[\"#{name}\"] = val if !val.nil? and val != '' and !['!'].include?(name)\n end\n end\n\n ret\n end", "def to_params params\n Array(params).inject({}) do |memo,entry|\n key, value = entry\n if value.is_a?(Array)\n key = \"#{key}[]\"\n end\n memo[key] = value\n memo\n end\n end", "def instance_variables_hash\n {}\n end", "def hash()\n {\n \"attributes\" => attributes,\n \"variables\" => variables,\n \"dimensions\" => dimensions,\n \"metadata\" => metadata,\n \"data\" => variable_hash\n }\n end", "def prepare_method_arg_hash(args)\n # SEQUEL5: Remove\n h = {}\n prepare_method_args('a', args.length).zip(args).each{|k, v| h[k] = v}\n h\n end", "def to_hash\n hash = {}\n instance_variables = self.instance_variables\n instance_variables.each do |variable|\n hash[\"#{variable.slice(1..-1)}\"] = self.send(\"#{variable.slice(1..-1)}\")\n end\n return hash\n end", "def params=(hash); end", "def params=(hash); end", "def to_hash\n @values\n end", "def get_hash\n result = {}\n instance_variables.each { |var|\n if instance_variable_get(var) != \"\" && instance_variable_get(var) != nil\n result.update({var.slice(1..var.length) => instance_variable_get(var)})\n end\n }\n result\n end", "def to_h\n hash = {}\n each_with_name{ |v, n| hash[n] = v}\n hash\n end", "def to_hash\n hash = {}\n self.instance_variables.each do |var| \n hash[var.to_s.delete(\"@\")] = self.instance_variable_get(var) \n end\n hash\n end", "def hash\n { hash: @hash, hashType: @hash_type }\n end", "def parameters\n @property_hash[:parameters]\n end", "def to_hash\n hash = Hash[instance_variables.map { |var| [var[1..-1].to_sym, instance_variable_get(var)] }]\n hash.delete(:root)\n hash.delete(:nodes)\n hash.delete(:sequences)\n hash\n end", "def to_hash\n hash = {}\n self.instance_variables.each do |var|\n symbol = var.to_s.gsub(\"@\",\"\").to_sym\n hash[symbol] = send symbol\n end\n return hash\n end", "def params\n self.class.const_get(\"REQUEST_PARAMETERS\").inject({}) do |parameters, parameter|\n parameters[parameter] = instance_variable_get(\"@#{parameter}\") unless instance_variable_get(\"@#{parameter}\").nil?\n parameters\n end\n end", "def keys(*args)\n @params.keys(*args)\n end", "def keys(*args)\n @params.keys(*args)\n end", "def to_hash\n pairs = instance_variables.map do |var|\n [var.to_s.delete('@'), instance_variable_get(var)]\n end\n Hash[pairs]\n end", "def flatten_param_hash( params )\n\t found = true\n\n\t while found\n\t found = false\n\t new_hash = {}\n\n\t params.each do |key,value|\n\t if value.is_a?( Hash )\n\t found = true\n\t value.each do |key2,value2|\n\t new_hash[ key.to_s + '[' + key2.to_s + ']' ] = value2\n\t end\n\t else\n\t new_hash[ key.to_s ] = value\n\t end\n\t end\n\t params = new_hash\n\t end\n\t params\n\tend", "def set_param_names(params)\n HashWithIndifferentAccess.new.tap do |result|\n params.each do |k, v|\n attribute = attribute_set[k.to_sym]\n name = attribute.try(:options).try(:[], :param_name) || k\n result[name] = v\n end\n end\n end", "def to_params\n ::HashWithIndifferentAccess.new(attributes_hash)\n end", "def hbparams(*params)\n if params.empty?\n nil\n else\n values = translate_values(params.select { |p| p.is_a?(String) })\n hash = translate_hash(params.last.is_a?(Hash) ? params.last : {})\n\n [values, hash].compact.join(' ')\n end\n end", "def params\n (@params + [:host, :port]).uniq\n end", "def params\n {}\n end", "def params\n { :only => attrs, :methods => methds }\n end", "def params\n params = {}\n @options[:params].each{|key, value| params[key.to_s] = escape((value.class == Array ? value.join(\",\") : value))}\n params\n end", "def hash_keys\n [:x, :y]\n end", "def internal_parameters\n (bindata_mandatory_parameters + bindata_optional_parameters +\n bindata_default_parameters.keys).uniq\n end", "def argumentos(args)\n\thash = Hash.new\n\targs.each do |arg| \n\t\thash[arg.split('=').first] = arg.split('=').second\n\tend \n\treturn hash\nend", "def params\n Hash[\n fields.map { |field,key|\n next if key.nil?\n key = (prefix+key.to_s)\n\n [key, options[field]] unless options[field].nil?\n }.compact\n ]\n end", "def to_params\n Hash[* @result_attributes.collect{|k| \n v = self.send(k)\n (v) ? [k,self.send(k)] : nil\n }.compact.flatten]\n end", "def to_hash\n instance_variables_hash.inject({}) do |acc, data|\n k,v = data\n v = v.to_hash if v.respond_to?(:to_hash)\n acc[k] = v\n acc\n end\n end", "def attribute_and_parameter_values\n attribute_value_pairs = attributes.inject({}) do |h, attr| \n # Attributes may be not synced with db so updating them with attr.update_attribute_value!\n h.merge(attr.display_name => attr.update_attribute_value!)\n end\n params.merge(attribute_value_pairs)\n end", "def instance_variables_hash\n instance_variables.inject({}) do |acc, iv|\n acc[iv.to_s[1..-1]] = instance_variable_get(iv)\n acc\n end\n end", "def attributes_hash(object); end", "def params\n flat = {}\n @options[:params].merge( :track => @options[:filters] ).each do |param, val|\n next if val.to_s.empty? || (val.respond_to?(:empty?) && val.empty?)\n val = val.join(\",\") if val.respond_to?(:join)\n flat[param.to_s] = val.to_s\n end\n flat\n end", "def hash\n attributes.hash\n end", "def hash\n attributes.hash\n end" ]
[ "0.76836854", "0.7185262", "0.71627903", "0.7062407", "0.69175506", "0.6837775", "0.67541045", "0.6751691", "0.67164475", "0.6703607", "0.6663427", "0.6662047", "0.6658911", "0.665877", "0.665613", "0.66551304", "0.66337407", "0.6594281", "0.65910405", "0.65458107", "0.6544266", "0.65397674", "0.6509683", "0.64748335", "0.64524865", "0.64524865", "0.64305276", "0.6430115", "0.6390623", "0.6380031", "0.63638026", "0.63453174", "0.63411784", "0.62955743", "0.6286421", "0.62783366", "0.6258122", "0.62474453", "0.6245714", "0.62093234", "0.619024", "0.618587", "0.61825734", "0.6161078", "0.6145075", "0.61412895", "0.6131823", "0.6130019", "0.6128316", "0.61249894", "0.6118679", "0.61064696", "0.6101464", "0.6095881", "0.60891056", "0.60846716", "0.6084158", "0.6079569", "0.60698766", "0.60652995", "0.6063267", "0.60605234", "0.60572195", "0.6054636", "0.6050998", "0.6046946", "0.6033184", "0.6033184", "0.6010029", "0.6005157", "0.6003511", "0.59979665", "0.5980654", "0.5980363", "0.597646", "0.5975066", "0.59693485", "0.5965385", "0.5965385", "0.5956878", "0.5953987", "0.5951423", "0.5951323", "0.59507436", "0.5946525", "0.594241", "0.59363294", "0.59359854", "0.5921335", "0.5902803", "0.59021634", "0.5894429", "0.5893681", "0.5881321", "0.587685", "0.5868447", "0.5866251", "0.5862714", "0.58588475", "0.58588475" ]
0.7170237
2
Sets parameter(s) from hash or instance of same class
def set_parameters(hash_or_instance) parameters = extract_parameters_from_hash_or_instance(hash_or_instance) parameters.each do |k,v| send "#{k}=", v end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def params=(hash); end", "def params=(hash); end", "def set_params(hash)\n hash.each do |k,v|\n set_param(k, v)\n end\n end", "def set_params!(param_hash={})\n param_hash.each { |k,v| @set_params[k.to_s] = v }\n end", "def params=(hash)\n @params.replace hash\n end", "def set_parameters(hash)\n # Use the order provided by allattrs, but add in any\n # extra attributes from the resource so we get failures\n # on invalid attributes.\n no_values = []\n (self.class.allattrs + hash.keys).uniq.each do |attr|\n begin\n # Set any defaults immediately. This is mostly done so\n # that the default provider is available for any other\n # property validation.\n if hash.has_key?(attr)\n self[attr] = hash[attr]\n else\n no_values << attr\n end\n rescue ArgumentError, Puppet::Error, TypeError\n raise\n rescue => detail\n error = Puppet::DevError.new( \"Could not set #{attr} on #{self.class.name}: #{detail}\")\n error.set_backtrace(detail.backtrace)\n raise error\n end\n end\n no_values.each do |attr|\n set_default(attr)\n end\n end", "def set(params = {})\n self.params.merge!(params)\n end", "def parameters(hash = nil)\n hash ? @parameters = hash : @parameters\n end", "def initialize(optHash)\n @optHash=optHash\n setParameters()\nend", "def set(params = {})\n params.each do |k,v|\n self.class.attributes k.to_s\n send(k.to_s+\"=\",v)\n end\n end", "def assign_instance_variables_from_hash(hash)\n hash.each { |key, value| public_send(\"#{key}=\", value) }\n end", "def assign_params(params)\n params.each do |key, value|\n if self.class.public_method_defined?(\"#{key}=\")\n public_send(\"#{key}=\", value)\n end\n end\n end", "def set hash\n hash.each_pair do |k,v|\n self.send(:\"#{k}=\", v)\n end\n \n self\n end", "def params=(hash)\n if params\n params.replace hash\n else\n super\n end\n end", "def set_pars(pars)\n @params.each_index{|id| \n @pars_hash[@params[id].handle] = pars[id] unless @params[id].nil?\n }\n end", "def params=(hash)\n @params.clear\n @params.update(hash)\n end", "def params=(hash)\n @params.clear\n @params.update(hash)\n end", "def set(params)\n params.each do |param, value|\n @property_hash[param.intern] = value\n end\n end", "def assign(params) #:nodoc:\n params.each_pair do |key, value|\n self.send(\"#{key}=\", value) rescue self.instance_eval(\"@#{key}=value\") rescue next\n end\n end", "def set_attributes(hash={})\n hash.keys.each do |field|\n if self.respond_to? field\n self.instance_variable_set(\"@#{field}\", hash[field])\n end\n end\n end", "def set_instance_variables( params )\n params.each do |key,val|\n #self.instance_eval(\"@#{key.to_s} = '#{val}'\")\n self.class.class_eval %(\n class << self; attr_accessor :#{key} end\n )\n\n self.instance_variable_set( \"@#{key}\", val )\n end\n end", "def initialize(params={})\n\t\t\t\tparams.each_pair do |k,v|\n\t\t\t\t\tinstance_variable_set(\"@#{k}\", v)\n\t\t\t\tend\n\t\t\tend", "def set_dyn_params(hash)\n hash.each do |k,v|\n set_dyn_param(k, v)\n end\n end", "def setParamToObj\n keys = params.keys\n\n keys.each do |x|\n self.instance_variable_set(\"@#{x.to_s}\", params[x])\n self.class.class_eval do\n define_method(\"get#{x.to_s.capitalize}\") { params[x] }\n end\n end\n @httpCode = nil\n end", "def set (hash)\n @data.merge! hash\n end", "def initialize(hash={})\n # assign the attributes here (???)\n hash.each do |k, v| # name = id, name, etc.\n self.send(\"#{k}=\", v)\n # self.k = v # there's no '.k' method\n #binding.pry\n end\n end", "def setstatus(hash)\n prophash = {}\n hash.each do |param, value|\n next if param == :name\n case self.class.attrtype(param)\n when :property\n # Only try to provide values for the properties we're managing\n if prop = self.property(param)\n prophash[prop] = value\n end\n else\n self[param] = value\n end\n end\n prophash\n end", "def initialize(hash)\n hash.each do |key, value|\n self.__send__(\"#{key}=\", value)\n end\n raise ArgumentError if id.nil? || url.nil?\n end", "def assign_hash(hash)\n hash.each do |key, value|\n next if key == 'id'\n\n key = key.to_sym\n self.class.send(:attr_accessor, key) unless respond_to? \"#{key}=\"\n send(\"#{key}=\", value)\n end\n end", "def assign_hash(method_name, params)\n @params[method_name] ||= {}\n params.each do |attr_name, value|\n @params[method_name][attr_name] = value\n end\n end", "def set_instance_variables(values)\n values.each_with_index do |value,i|\n name = self.class.takes[i]\n instance_variable_set \"@#{name}\",value\n end\n @opt = {} if self.class.takes.include?(:opt) and @opt.nil?\n end", "def params=(p)\n if p.kind_of?(Hash)\n @params = p\n else\n @params = Markup.parse_params(p)\n end\n end", "def params=(_); end", "def initialize(params)\n params.each do |key, value|\n instance_variable_set(\"@#{key}\", value) if respond_to?(key)\n end\n end", "def set(hsh = {})\n hsh.each { |name, val| self.set_attr(name,val) }\n self\n end", "def initialize(params = {})\n params.each do |key, value|\n setter = \"#{key}=\"\n send(setter, value) if respond_to?(setter.to_sym, false)\n end\n end", "def params(params_hash)\n return self if params_hash.nil?\n\n @sim_data.num_rounds = params_hash['NumRounds']\n @sim_data.num_agents = params_hash['NumAgents']\n @sim_data.starting_funds = params_hash['StartingFunds']\n @sim_data.max_stock = params_hash['MaxStock']\n\n self\n end", "def example(hash_of_arguments)\n hash_of_arguments.each {|key,value| self.send(\"#{key}=\", value) }\nend", "def parameters=(_); end", "def set_parameter(key, value)\n\n return nil unless @__parameter_dictionary \n\n @__parameter_dictionary.setValueForKey(key.to_s, value.to_s)\n\n end", "def parameters=(value)\n raise TypeError, 'parameters must be a Hash or respond to #to_h or #to_hash' unless value.is_a?(Hash) || value.respond_to?(:to_h) || value.respond_to?(:to_hash)\n value = value.to_h rescue value.to_hash\n \n @parameters = value.to_h\n end", "def set_options(hash)\n hash.keys.each do |key|\n var = '@' << key.to_s\n # = 1.9.* Fix\n # The map method applied on instance_variables is used to force elements to be String\n # because on 1.9.* Ruby versions, these elements are Symbol (i.e. :@directory).\n raise(\"Key #{key} not supported.\") unless instance_variables.map {|v| v.to_s}.include? var\n instance_variable_set(var, hash[key])\n end\n end", "def initialize(hash)\n hash.each do |k, v|\n self.send(\"#{k}=\", v) if self.respond_to?(\"#{k}=\")\n end\n @id = hash[\"id\"]\n end", "def initialize(params)\n params.each do |key, value| \n instance_variable_set(\"@#{key}\", value) if Lobbyist.instance_methods.include? key\n end\n end", "def params=(value); end", "def initialize(params = {})\n raise 'Wrong data provided' unless params.is_a? Hash\n\n params = params.to_h.stringify_keys\n set_instance_variable_params(params)\n set_instance_variable_columns(params)\n end", "def instance_variable_set(p0, p1) end", "def params=(value)\n @_params = value.is_a?(Hash) ? Parameters.new(value) : value\n end", "def set_params params\n raise \"No Params\" if params.nil?\n params.each do |key, value|\n raise \"key nil\" if key.nil?\n raise \"value nil\" if value.nil?\n self.preferences[key.to_sym] = value if valid_key?(key)\n end\n raise \"save failed: #{errors}\" unless self.save\n assure_created_zip\n end", "def with_params(params = {})\n params.each {|k,v| self.send(\"#{k}=\", v)}\n self\n end", "def initialize(*args)\n args.each do |arg|\n if arg.kind_of? Hash\n arg.each do |k,v|\n self.send(\"#{k}=\", v)\n end\n end\n end\n end", "def param(* args)\n if args.length == 2\n key, value = args\n new_params = get_params # get_params needs to return a dup and re-set it so DM knows it's dirty\n new_params[key.to_s] = value\n attribute_set(:params, new_params)\n elsif args.length == 1\n key = args.first\n get_params[key.to_s]\n else\n raise ArgumentError, \"param takes either one (getter) or two (setter) arguments\"\n end\n end", "def update!(**args)\n @hash_prop = args[:hash_prop] if args.key?(:hash_prop)\n @type = args[:type] if args.key?(:type)\n end", "def initialize(params={})\n params.each do |k, v|\n self.instance_variable_set(\"@#{k}\", v)\n end\n end", "def initialize(*h)\n if h.length == 1 && h.first.kind_of?(Hash)\n h.first.each { |k,v| send(\"#{k}=\",v) }\n end\n end", "def initialize(hash)\n hash.each do |key, value|\n attribute = ATTRIBUTE_MAP[key.to_s]\n send(\"#{attribute}=\", value) if respond_to?(attribute)\n end\n end", "def initialize(*h)\n if h.length == 1 && h.first.kind_of?(Hash)\n h.first.each do |k,v| \n if !respond_to? \"#{k}\"\n self.class_eval(\"def #{k};@#{k};end\")\n self.class_eval(\"def #{k}=(val);@#{k}=val;end\")\n end\n send(\"#{k}=\",v) \n end\n end\n end", "def initialize(*h)\n if h.length == 1 && h.first.kind_of?(Hash)\n h.first.each { |k, v| send(\"#{k}=\", v) if public_methods.include?(\"#{k}=\".to_sym) }\n end\n end", "def assign args={}\n args.keys.each{ |name| instance_variable_set(\"@#{name}\", args[name]) }\n end", "def update(hash)\n @unsigned_query = nil\n\n hash.each do |key, val|\n # Syntactic sugar: Camelize symbol keys.\n if key.is_a? Symbol\n key = key.to_s.split('_').map(&:capitalize).join\n end\n @params[key] = val\n end\n\n self\n end", "def initialize hash\n @hash = hash\n end", "def set=(_arg0); end", "def initialize(params)\n params.each do |key, value| \n instance_variable_set(\"@#{key}\", value) if Filing.instance_methods.include? key\n end\n end", "def setParam(results, method, *parameters)\n \"\"\"Internal method: configure a *single* parameter\n results: dict of results to update\n method: config method name\n param: arg=value (ignore if value=nil)\n value may also be list or dict\"\"\"\n param = case parameters.last\n when Hash then parameters.pop\n else {}\n end \n name, value = param.items()[0]\n if value == nil\n return\n end \n f = getattr(self, method, nil)\n if not f\n return\n end \n if value.is_a? Array\n result = f(*value)\n elsif value.is_a? Hash\n result = f(value)\n else\n result = f(value)\n end \n results[name] = result\n return result\n end", "def initialize(params)\n params.each do |key, value| \n instance_variable_set(\"@#{key}\", value) if Legislator.instance_methods.include? key\n end\n end", "def set(hash)\n set_restricted(hash, nil, nil)\n end", "def param(hash)\n hash.each_key { |k|\n unless k.kind_of?(String) || k.kind_of?(Symbol)\n raise(Hubcap::InvalidParamKeyType, k.inspect)\n end\n }\n update_with_stringified_keys(@params, hash)\n end", "def set(hash)\n hash.each do | key, value |\n setting = settings.find_by_key(key) || settings.new(:key => key)\n setting.value = value\n setting.save!\n end\n end", "def data=(hash)\n @params[:data] = hash\n end", "def set_schema(klass, hash)\n if use_class_var?(klass)\n klass.class_variable_set(CLASS_VARIABLE, hash)\n else\n klass.instance_variable_set(INSTANCE_VARIABLE, hash)\n end\n end", "def set_schema(klass, hash)\n if use_class_var?(klass)\n klass.class_variable_set(CLASS_VARIABLE, hash)\n else\n klass.instance_variable_set(INSTANCE_VARIABLE, hash)\n end\n end", "def set_connection_params(connection_hash)\n # use each base connection param\n base_params.each do |param_name|\n parm_name = param_name.to_sym\n\n # compose the method name that corresponds to the parameter\n method_name = \"get_#{param_name}_option\".to_sym\n\n # call the method to get the formatted param\n @connection_params[parm_name] = send(method_name, connection_hash[parm_name])\n end\n end", "def class_variable_set(sym,val) end", "def set_hash(hash, hash_type = 'SHA256')\n @hash = hash\n @hash_type = hash_type\n end", "def update(para)\n if para.kind_of? Hash\n from_hash(para)\n end\n\nend", "def set_stored_parameters(params={})\r\n @PARAM_HASH['STORED_INDICATOR'] = params[:stored_indicator] || ''\r\n @PARAM_HASH['STORED_TYPE'] = params[:stored_type] || ''\r\n @PARAM_HASH['STORED_ID'] = params[:stored_id] || ''\r\n end", "def params=(value)\n @_params = value.is_a?(Hash) ? Dynamometer::Parameters.new(value) : value\n end", "def set_params_from_omniauth_hash_to_pass_it_to_transfer_to_guest_cmpsr\n @params_from_omniauth_for_transfer_to_guest_cmpsr = pick_fields_from_omniauth_hash_that_will_be_passed_to_transfer_guest_cmpsr_as_params\n end", "def initialize *args\n if args.size == 1 && args.first.is_a?(Hash)\n super()\n args.first.each do |k,v|\n send \"#{k}=\", v\n end\n else\n super\n end\n end", "def set_config(parameters)\n parameters.each do |k,v|\n self.instance_variable_set(\"@#{k}\".to_sym, v)\n end\n end", "def initialize(params = {})\n params.each do |key, value|\n attribute?(key) && send(\"#{key}=\", value)\n end\n end", "def set(hash)\n hash.each_pair do |key, value|\n _data[key] = value\n end\n _save\n end", "def parameters(params)\n params.each do |key, value|\n send(\"#{key}=\".to_sym, value) if self.respond_to?(key)\n end\n end", "def set_values(opts)\n opts = check_params(opts,[:create_instances_if_needed,:class_instance_keys,:field_instance_names,:values])\n super(opts)\n end", "def set(key, value, **options); end", "def set_params(params)\n @params = params\n end", "def define_parameter(params)\n @properties[:parameters] = Hashie::Mash.new unless @properties.key?(:parameters)\n if params.kind_of? Hash\n @properties[:parameters].merge!(params)\n else\n error \"Cannot define parameter for app '#{self.name}'! Parameter \"+\n \"not passed as a Hash ('#{params.inspect}')\"\n end\n end", "def define_parameter(params)\n @properties[:parameters] = Hashie::Mash.new unless @properties.key?(:parameters)\n if params.kind_of? Hash\n @properties[:parameters].merge!(params)\n else\n error \"Cannot define parameter for app '#{self.name}'! Parameter \"+\n \"not passed as a Hash ('#{params.inspect}')\"\n end\n end", "def set(hash, &block)\n @compiler.set(hash, &block)\n end", "def update!(**args)\n @parameter = args[:parameter] if args.key?(:parameter)\n @type = args[:type] if args.key?(:type)\n end", "def initialize(starship_hash)\n starship_hash.each do |k, v|\n self.send(\"#{k}=\", v) if self.respond_to?(\"#{k}=\")\n end \n save\n end", "def assign args={}\n args.each do |_name, value|\n public_send(\"#{_name.underscore}=\", value)\n end\n end", "def arguments=(val)\n raise(ArgumentError, \"Arguments must recieve a hash\") unless val.kind_of?(Hash)\n @arguments = val\n end", "def set(*arguments)\n\t\tcase arguments.length\n\t\twhen 2; $game_selfVars[@map_id, @event_id, arguments[0]] = arguments[1]\n\t\twhen 3; $game_selfVars[@map_id, arguments[0], arguments[1]] = arguments[2]\n\t\twhen 4; $game_selfVars[arguments[0], arguments[1], arguments[2]] = arguments[3]\n\t\tend\n\tend", "def initialize(attr)\n #iterate over each key/value pair in attribute hash\n attr.each do |k,v|\n #name of key becomes setter\n #value associated with key is the name of value you want to pass to method\n self.send(\"#{k}=\", v)\n #send method is another way of calling a method on an object\n #same as instance_of_user.key = value\n #when you want to mass assign, send is better than .name= method\n end\n end", "def dyn_params=(h)\n set_dyn_params(h)\n end", "def update!(**args)\n @hash_prop = args[:hash_prop] if args.key?(:hash_prop)\n @object = args[:object] if args.key?(:object)\n end", "def update!(**args)\n @hash_prop = args[:hash_prop] if args.key?(:hash_prop)\n @object = args[:object] if args.key?(:object)\n end", "def load(hash)\n hash.each_pair do |key, value|\n mutator_name = \"#{key.to_s}=\"\n self.__send__(mutator_name, value) if methods.include?(mutator_name)\n end\n end", "def update!(**args)\n @parameter = args[:parameter] if args.key?(:parameter)\n end" ]
[ "0.8115054", "0.8115054", "0.7277464", "0.7253688", "0.70757085", "0.7006766", "0.69906765", "0.6957718", "0.69406515", "0.69389117", "0.69149536", "0.6862134", "0.6850725", "0.6740736", "0.67055976", "0.6703485", "0.6703485", "0.668554", "0.6683647", "0.6654948", "0.6647649", "0.6599489", "0.6590659", "0.65641695", "0.6485484", "0.6461652", "0.6436177", "0.6422361", "0.64156014", "0.6412584", "0.64058745", "0.6402269", "0.63967353", "0.6393623", "0.6385397", "0.6377684", "0.63766503", "0.6359941", "0.63593966", "0.63553154", "0.6350678", "0.6310689", "0.6299285", "0.6297456", "0.6257937", "0.62543166", "0.623999", "0.6230997", "0.62300766", "0.62158376", "0.6211503", "0.6208807", "0.62034905", "0.6191682", "0.6176019", "0.6172493", "0.6170485", "0.6168637", "0.61658955", "0.616199", "0.6147985", "0.6118296", "0.6118037", "0.6114223", "0.61012185", "0.60994196", "0.60820067", "0.6081751", "0.6080707", "0.60789394", "0.6078747", "0.6070065", "0.60652506", "0.60634655", "0.6057709", "0.60551375", "0.604929", "0.6047608", "0.60469925", "0.60428834", "0.60298884", "0.60206664", "0.6019804", "0.60162836", "0.60031796", "0.59985983", "0.59975195", "0.59975195", "0.5985627", "0.5984978", "0.59820694", "0.5959861", "0.5957891", "0.595374", "0.59467316", "0.5930496", "0.59301883", "0.59301883", "0.59256333", "0.59247035" ]
0.8123604
0
overriding this to make typecasting errors run at the end so they will not run if there is already an error on the column. Otherwise, when typecasting to an integer and using validates_numericality_of two errors will be generated.
def run_validations! super include_typecasting_errors errors.empty? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enforce_integer_columns(options = {})\n # first get the non-integers\n options[:allow_nil] = true\n args = build_validation_args(options, :numeric, :not_a_number)\n validates_numericality_of(*args) unless args.first.is_a? Hash\n # now do the integers\n options[:only_integer] = true\n args = build_validation_args(options, :integer, :not_a_number)\n validates_numericality_of(*args) unless args.first.is_a? Hash\n end", "def apply_validations_for_integer\n options = { :numericality => { :only_integer => true } }\n options[:allow_nil] = true unless not_nullable?\n flex_column_class.validates field_name, options\n end", "def price_validation_before_cast\n return unless price\n errors.add(:price, 'is invalid') unless price_before_type_cast.to_s.match?(VALID_PRICE_REGEX)\n errors.add(:price, 'must be greater than 0') unless price_before_type_cast.to_f.positive?\n end", "def apply_validations_for_float\n flex_column_class.validates field_name, :numericality => true, :allow_nil => true\n end", "def validates_numericality_of_for(*attr_names)\n configuration = { :on => :save, :only_integer => false, :allow_nil => false }\n configuration.update(attr_names.extract_options!)\n\n numericality_options = ALL_NUMERICALITY_CHECKS.keys & configuration.keys\n\n (numericality_options - [ :odd, :even ]).each do |option|\n raise ArgumentError, \":#{option} must be a number\" unless configuration[option].is_a?(Numeric)\n end\n\n validates_each(attr_names,configuration) do |record, attr_name, value|\n raw_value = record.send(\"#{attr_name}_before_type_cast\") || value\n\n next if configuration[:allow_nil] and raw_value.nil?\n\n attr_for = configuration[:for] || attr_name\n\n if configuration[:only_integer]\n unless raw_value.to_s =~ /\\A[+-]?\\d+\\Z/\n record.errors.add(attr_for, :not_a_number, :value => raw_value, :default => configuration[:message])\n next\n end\n raw_value = raw_value.to_i\n else\n begin\n raw_value = Kernel.Float(raw_value)\n rescue ArgumentError, TypeError\n record.errors.add(attr_for, :not_a_number, :value => raw_value, :default => configuration[:message])\n next\n end\n end\n\n numericality_options.each do |option|\n case option\n when :odd, :even\n unless raw_value.to_i.method( ALL_NUMERICALITY_CHECKS[option])[]\n record.errors.add(attr_for, option, :value => raw_value, :default => configuration[:message]) \n end\n else\n record.errors.add(attr_for, option, :default => configuration[:message], :value => raw_value, :count => configuration[option]) unless raw_value.method( ALL_NUMERICALITY_CHECKS[option])[configuration[option]]\n end\n end\n end\n end", "def force_numeric?(column)\n (column.nil? || [:integer, :float, :decimal].include?(column.type))\n end", "def apply_validations_for_decimal\n apply_validations_for_float\n end", "def coerce_and_validate(value, schema, **_keyword_args)\n value = coerce(value) if @coerce_value\n\n return validatable.validate_integer(value, schema) if value.kind_of?(Integer)\n\n coercer_and_validate_numeric(value, schema)\n end", "def check_integer(field_info, field)\n if should_be_integer?(field_info, field) && !integer?(field) && !foreign_key?(field)\n add_integer_message_to_errors(field)\n end\n end", "def foorth_coerce(arg)\r\n Integer(arg)\r\n rescue\r\n error \"F40: Cannot coerce a #{arg.foorth_name} to an Integer instance\"\r\n end", "def correct_format_for_values\n self.value.to_i\n end", "def trycast(obj)\n\t\tif obj\n\t\t\treturn is_integer?(obj) ? obj.to_i : is_float?(obj) ? obj.to_f : nil\n\t\tend\n\t\treturn obj\n\tend", "def cast_numeric(arg, sql_type = nil)\n cast(arg, sql_type || Integer).sql_number\n end", "def amount_before_type_cast\n @amount\n end", "def cast_numeric(sql_type = nil)\n cast(sql_type || :integer).sql_number\n end", "def cast_numeric(sql_type = nil)\n Cast.new(self, sql_type || Integer).sql_number\n end", "def set_validated_values\n # Check if the key is valid\n unless key && KEY_TO_TYPE.key?(key.to_sym)\n errors.add(:key, \"#{key} is not a supported metadatum\")\n end\n\n if data_type == \"number\"\n # Set number types. ActiveRecord validated.\n self.number_validated_value = number_raw_value\n elsif data_type == \"string\"\n check_and_set_string_type\n end\n end", "def check_type (num)\n # convert to float if validated number contains a decimal\n if num =~ /\\./\n return num = Float(num)\n else\n return num = Integer(num)\n end\nend", "def validate_integer_type(field)\n if field.is_a?(Integer)\n return true\n else\n return false\n end\n end", "def convert number\n raise_on_type_mismatch number\n typed_conversion number\n end", "def convert number\n raise_on_type_mismatch number\n typed_conversion number\n end", "def convert number\n raise_on_type_mismatch number\n typed_conversion number\n end", "def convert number\n raise_on_type_mismatch number\n typed_conversion number\n end", "def convert number\n raise_on_type_mismatch number\n typed_conversion number\n end", "def check_real(field_info, field)\n if should_be_float?(field_info, field) && !float?(field)\n add_float_message_to_errors(field)\n end\n end", "def validates_numeric(atts, opts={})\n validatable_attributes(atts, opts) do |a,v,m|\n begin\n Kernel.Float(v.to_s)\n nil\n rescue\n m || 'is not a number'\n end\n end\n end", "def cast_value(value)\n case value_type\n when 'integer' then value.to_i\n when 'float' then value.to_f\n when 'string' then value.to_s\n else raise_invalid_type\n end\n end", "def convert_to_type(val)\n case type\n when 'NilClass'\n if val != false && val.blank?\n # Leave the type of the Column open. Unfortunately, false counts as\n # blank and we don't want it to. It should be classified as a boolean.\n new_val = nil\n else\n # Only non-blank values are allowed to set the type of the Column\n bool_val = convert_to_boolean(val)\n new_val =\n if bool_val.nil?\n convert_to_date_time(val) ||\n convert_to_numeric(val) ||\n convert_to_string(val)\n else\n bool_val\n end\n @type =\n if [true, false].include?(new_val)\n 'Boolean'\n elsif new_val.is_a?(Date) || new_val.is_a?(DateTime)\n 'DateTime'\n elsif new_val.is_a?(Numeric)\n 'Numeric'\n elsif new_val.is_a?(String)\n 'String'\n else\n msg = \"can't add #{val} of type #{new_val.class.name} to a column\"\n raise UserError, msg\n end\n end\n new_val\n when 'Boolean'\n if val.is_a?(String) && val.blank? || val.nil?\n nil\n else\n new_val = convert_to_boolean(val)\n if new_val.nil?\n msg = \"attempt to add '#{val}' to a column already typed as #{type}\"\n raise UserError, msg\n end\n new_val\n end\n when 'DateTime'\n if val.blank?\n nil\n else\n new_val = convert_to_date_time(val)\n if new_val.nil?\n msg = \"attempt to add '#{val}' to a column already typed as #{type}\"\n raise UserError, msg\n end\n new_val\n end\n when 'Numeric'\n if val.blank?\n nil\n else\n new_val = convert_to_numeric(val)\n if new_val.nil?\n msg = \"attempt to add '#{val}' to a column already typed as #{type}\"\n raise UserError, msg\n end\n new_val\n end\n when 'String'\n if val.nil?\n nil\n else\n new_val = convert_to_string(val)\n if new_val.nil?\n msg = \"attempt to add '#{val}' to a column already typed as #{type}\"\n raise UserError, msg\n end\n new_val\n end\n else\n raise UserError, \"Mysteriously, column has unknown type '#{type}'\"\n end\n end", "def typecast_to_numeric(value, method)\n if value.is_a?(String)\n value = value.strip.gsub(/,/, '.').gsub(/[^\\d\\-\\.]/, '').gsub(/\\.(?!\\d*\\Z)/, '')\n value.empty? ? nil : value.send(method)\n elsif value.respond_to?(method)\n value.send(method)\n else\n nil\n end\n end", "def validate_integer(input)\n input.to_s.to_i = input\nend", "def integer_exception?(field)\n foreign_key?(field) || self.send(field).blank?\n end", "def is_numeric?\n self.data_type == 'number'\n end", "def lenient_value_coercions; end", "def typecast(value)\n if value.kind_of?(Range) then Range.new(typecast(value.first), typecast(value.last))\n elsif value.kind_of?(Array) then value.map{|v| typecast(v)}\n elsif primitive == BigDecimal then super(value).to_f\n elsif primitive == DateTime then Time.parse(super(value).to_s).to_i\n elsif primitive == Date then Time.parse(super(value).to_s).to_i\n elsif primitive == Time then super(value).to_i\n else\n super(value) # Good luck\n end\n end", "def must_be_number(val, name)\n if !val.respond_to?(:to_f)\n raise(ArgumentError, \"#{name} must be a number\")\n end\n end", "def post_process_integer( val )\n\t\t\treturn Integer( val.to_s )\n\t\tend", "def cast_data_for_column(data, col)\n if !@columns\n raise \"need to fetch columns but in a query\"\n end\n\n case @columns[col][:type]\n when /boolean/i\n return data == true ? 1 : 0\n when /datetime/i\n return (data == nil ? nil : data.to_i)\n when /integer/i\n return (data == nil ? nil : data.to_i)\n else\n return data\n end\n end", "def numericality_validation\n if klass.respond_to?(:validators)\n klass.validators_on(attribute_name).find do |validator|\n validator.is_a?(ActiveModel::Validations::NumericalityValidator)\n end\n end\n end", "def typecast_value(column, value)\n return value unless typecast_on_assignment && db_schema && (col_schema = db_schema[column]) && !model.serialized?(column)\n value = nil if value == '' and typecast_empty_string_to_nil and col_schema[:type] and ![:string, :blob].include?(col_schema[:type])\n raise(Error::InvalidValue, \"nil/NULL is not allowed for the #{column} column\") if raise_on_typecast_failure && value.nil? && (col_schema[:allow_null] == false)\n begin\n model.db.typecast_value(col_schema[:type], value)\n rescue Error::InvalidValue\n if raise_on_typecast_failure\n raise\n else\n value\n end\n end\n end", "def typecasted_value\n typecaster.present? ? typecaster.typecast(untypecasted_value) : untypecasted_value\n end", "def normalize_decimal_to_integer(type, scale)\n if (type == 'DECIMAL' and scale == 0)\n 'integer'\n else\n type\n end\n end", "def handle_integer_conversion(id) \n (Integer(id) rescue nil).nil? || id.to_i.to_s != id.to_s ? id : id.to_i\n end", "def validate_each(record, attr_name, value)\n before_type_cast = :\"#{attr_name}_before_type_cast\"\n\n value_before_type_cast = if record.respond_to?(before_type_cast)\n record.send(before_type_cast)\n else\n nil\n end\n\n if value_before_type_cast.present? && value.nil?\n record.errors.add(attr_name, :not_a_date, **options)\n return\n end\n\n return if (value.nil? && options[:allow_nil]) || (value.blank? && options[:allow_blank])\n\n unless value\n record.errors.add(attr_name, :not_a_date, **options)\n return\n end\n\n unless is_time?(value)\n record.errors.add(attr_name, :not_a_date, **options)\n return\n end\n\n options.slice(*CHECKS.keys).each do |option, option_value|\n option_value = option_value.call(record) if option_value.is_a?(Proc)\n option_value = record.send(option_value) if option_value.is_a?(Symbol)\n\n original_value = value\n original_option_value = option_value\n\n # To enable to_i conversion, these types must be converted to Datetimes\n if defined?(ActiveSupport::TimeWithZone)\n option_value = option_value.to_datetime if option_value.is_a?(ActiveSupport::TimeWithZone)\n value = value.to_datetime if value.is_a?(ActiveSupport::TimeWithZone)\n end\n\n if defined?(Date)\n option_value = option_value.to_datetime if option_value.is_a?(Date)\n value = value.to_datetime if value.is_a?(Date)\n end\n\n unless is_time?(option_value) && value.to_i.send(CHECKS[option], option_value.to_i)\n record.errors.add(attr_name, :\"date_#{option}\", **options.merge(\n value: original_value,\n date: (I18n.localize(original_option_value) rescue original_option_value)\n ))\n end\n end\n end", "def validate_date_attribute(date_type)\n value = send(\"#{date_type}_before_type_cast\")\n self[date_type] = value.is_a?(Date) || value.is_a?(Time) ? value : Time.zone.parse(value)\n if self[date_type].nil?\n errors.add(date_type, I18n.t('error.invalid_date', key: date_type.capitalize))\n end\n rescue ArgumentError, TypeError\n errors.add(date_type, I18n.t('error.invalid_date', key: date_type.capitalize))\n end", "def typecast_value(column, value)\n return value unless typecast_on_assignment && db_schema && (col_schema = db_schema[column])\n value = nil if '' == value and typecast_empty_string_to_nil and col_schema[:type] and ![:string, :blob].include?(col_schema[:type])\n raise(InvalidValue, \"nil/NULL is not allowed for the #{column} column\") if raise_on_typecast_failure && value.nil? && (col_schema[:allow_null] == false)\n begin\n model.db.typecast_value(col_schema[:type], value)\n rescue InvalidValue\n raise_on_typecast_failure ? raise : value\n end\n end", "def typecast_value(column, value)\n return value unless typecast_on_assignment && db_schema && (col_schema = db_schema[column])\n value = nil if '' == value and typecast_empty_string_to_nil and col_schema[:type] and ![:string, :blob].include?(col_schema[:type])\n raise(InvalidValue, \"nil/NULL is not allowed for the #{column} column\") if raise_on_typecast_failure && value.nil? && (col_schema[:allow_null] == false)\n begin\n model.db.typecast_value(col_schema[:type], value)\n rescue InvalidValue\n raise_on_typecast_failure ? raise : value\n end\n end", "def numeric?(column)\n if column.is_a?(ActiveRecord::ConnectionAdapters::Column)\n type = connection.lookup_cast_type_from_column(column).class\n else\n type = attribute_types[column.to_s].class\n end\n type.included_modules.include?(ActiveModel::Type::Helpers::Numeric)\n end", "def type_conversion(value_data, type) \n case type\n when 'boolean'\n return to_boolean(value_data) \n when 'int'\n val = Integer(value_data)\n if (val < -2147483648) || (val > 2147483647)\n raise \"Integer out of range: #{val}\" \n end\n return val\n when 'long'\n val = Integer(value_data)\n if (val < -9223372036854775808) || (val > 9223372036854775807)\n raise \"Long out of range: #{val}\" \n end\n return val\n when 'double'\n return Float(value_data)\n when 'string'\n return value_data\n else\n raise \"Unsupported type: #{type}\" \n end \n end", "def can_be_numeric?\n type == :numeric\n end", "def check_numericality(klass, filter)\n filter.attributes.each do |attr|\n qry = ''\n shoulda = ''\n if filter.options[:only_integer].present?\n qry = \"CEIL(#{attr}) != #{attr}\"\n shoulda = 'been an integer'\n end\n if filter.options[:greater_than].present?\n qry += qry.blank? ? '' : ' OR '\n shoulda += shoulda.blank? ? '' : ' and '\n qry += \"#{attr} <= #{filter.options[:greater_than]}\"\n shoulda += \" length > #{filter.options[:greater_than]}\"\n end\n if filter.options[:less_than].present?\n qry += qry.blank? ? '' : ' OR '\n shoulda += shoulda.blank? ? '' : ' and '\n qry += \"#{attr} >= #{filter.options[:less_than]}\"\n shoulda += \" length < #{filter.options[:less_than]}\"\n end\n\n ids = klass.where(qry).pluck(:id)\n msg = \" #{ids.count} records that are an invalid #{filter.attributes} because it should #{shoulda}\"\n # rubocop:disable Lint/Void\n [ids, msg]\n # rubocop:enable Lint/Void\n end\n end", "def cast_attribute(value, type_name)\n case type_name\n when :integer then value.to_i\n when :float then value.to_f\n when :boolean then !!value\n else value\n end\n end", "def is_numeric?\n data_type == 'number'\n end", "def typecast_value(column_type, value)\n return nil if value.nil?\n case column_type\n when :integer\n Integer(value)\n when :string\n value.to_s\n when :float\n Float(value)\n when :decimal\n case value\n when BigDecimal\n value\n when String, Float\n value.to_d\n when Integer\n value.to_s.to_d\n else\n raise ArgumentError, \"invalid value for BigDecimal: #{value.inspect}\"\n end\n when :boolean\n case value\n when false, 0, \"0\", /\\Af(alse)?\\z/i\n false\n else\n value.blank? ? nil : true\n end\n when :date\n case value\n when Date\n value\n when DateTime, Time\n Date.new(value.year, value.month, value.day)\n when String\n value.to_date\n else\n raise ArgumentError, \"invalid value for Date: #{value.inspect}\"\n end\n when :time\n case value\n when Time\n value\n when String\n value.to_time\n else\n raise ArgumentError, \"invalid value for Time: #{value.inspect}\"\n end\n when :datetime\n raise(ArgumentError, \"invalid value for #{tc}: #{value.inspect}\") unless value.is_one_of?(DateTime, Date, Time, String)\n if Sequel.datetime_class === value\n # Already the correct class, no need to convert\n value\n else\n # First convert it to standard ISO 8601 time, then\n # parse that string using the time class.\n (Time === value ? value.iso8601 : value.to_s).to_sequel_time\n end\n else\n value\n end\n end", "def type_cast(value, type = self.type)\n case type\n when :counter\n type_cast(value, :integer).to_i\n when :integer\n Kernel::Integer(value) rescue nil if value\n when :float\n Kernel::Float(value) rescue nil if value\n when :timestamp\n value = type_cast(value, :integer)\n Time.at(value) if value\n else\n value\n end\n end", "def validate_field_types\n database_field_names.each do |field|\n field_info = self.class.get_table_info.select {|hash| hash[\"name\"] == field}.first\n check_field_value_matches_data_type(field_info, field) \n end\n @errors\n end", "def validates_integer(atts, opts={})\n validatable_attributes(atts, opts) do |a,v,m|\n begin\n Kernel.Integer(v.to_s)\n nil\n rescue\n m || 'is not a number'\n end\n end\n end", "def type_cast(value) # :api: public\n cast_value(value) unless value.nil?\n end", "def is_int\r\n\t\tself.to_i.to_s != self.to_s\r\n\tend", "def convert_value(value, column_options)\n if column_options\n case column_options[:type]\n when 'Number'\n return value.to_i\n end\n end\n\n value\n end", "def uncast_data_from_column(data, col)\n if !@columns\n raise \"need to fetch columns but in a query\"\n end\n\n case @columns[col][:type]\n when /boolean/i\n return (data >= 1)\n when /datetime/i\n return (data == nil ? nil : Time.at(data.to_i))\n when /integer/i\n return (data == nil ? nil : data.to_i)\n else\n return data\n end\n end", "def validate_input\n\t\tif @options[:num].is_a?(Integer) and @options[:num] >= 0 \n\t\t\t@num = @options[:num].to_i.abs \n\n\t\telse\n\t\t\t@num = \"NAN\"\n\n\t\tend\n\tend", "def expect_integer_or_float(value, field, subfield)\n return true if value.blank?\n return true if value.is_a?(Integer) || value.is_a?(Float)\n errors.add(field, \"#{subfield} must be an integer or float if present\")\n false\n end", "def apply_validations!\n if not_nullable? && (! skip_not_nullable_validation_due_to_type?)\n flex_column_class.validates field_name, :presence => true\n end\n\n if options.has_key?(:enum)\n values = options[:enum]\n unless values.kind_of?(Array)\n raise ArgumentError, \"Must specify an Array of possible values, not: #{options[:enum].inspect}\"\n end\n\n flex_column_class.validates field_name, :inclusion => { :in => values }\n end\n\n if options.has_key?(:limit)\n limit = options[:limit]\n raise ArgumentError, \"Limit must be > 0, not: #{limit.inspect}\" unless limit.kind_of?(Integer) && limit > 0\n\n flex_column_class.validates field_name, :length => { :maximum => limit }\n end\n end", "def phone_is_a_number\n if phone.to_f.to_s != phone.to_s && phone.to_i.to_s != phone.to_s\n errors.add(:phone, \"Must be a number\")\n end\n end", "def column_numerical_constraints(column, options)\n validators = column.active_record_class.validators.select do |v|\n v.is_a?(ActiveModel::Validations::NumericalityValidator) &&\n v.attributes.include?(column.name) &&\n !v.options[:if] && !v.options[:unless]\n end\n\n equal_validator = validators.find { |v| v.options[:equal_to] }\n # If there is equal_to constraint - use it (unless otherwise specified by user)\n if equal_validator && !(options[:min] || options[:max])\n equal_to = equal_validator.options[:equal_to]\n return {min: equal_to, max: equal_to}\n end\n\n numerical_constraints = {}\n\n # find minimum and maximum from validators\n # we can safely modify :min and :max by 1 for :greater_tnan or :less_than value only for integer values\n only_integer = column.column.type == :integer if column.column\n only_integer ||= validators.find { |v| v.options[:only_integer] }.present?\n margin = only_integer ? 1 : 0\n\n # Minimum\n unless options[:min]\n min = validators.map { |v| v.options[:greater_than_or_equal_to] }.compact.max\n greater_than = validators.map { |v| v.options[:greater_than] }.compact.max\n numerical_constraints[:min] = [min, (greater_than + margin if greater_than)].compact.max\n end\n\n # Maximum\n unless options[:max]\n max = validators.map { |v| v.options[:less_than_or_equal_to] }.compact.min\n less_than = validators.map { |v| v.options[:less_than] }.compact.min\n numerical_constraints[:max] = [max, (less_than - margin if less_than)].compact.min\n end\n\n # Set step = 2 for column values restricted to be odd or even (but only if minimum is set)\n unless options[:step]\n only_odd_valid = validators.any? { |v| v.options[:odd] }\n only_even_valid = validators.any? { |v| v.options[:even] } unless only_odd_valid\n if !only_integer\n numerical_constraints[:step] ||= \"0.#{'0' * (column.column.scale - 1)}1\" if column.column&.scale.to_i.positive?\n elsif options[:min] && options[:min].respond_to?(:even?) && (only_odd_valid || only_even_valid)\n numerical_constraints[:step] = 2\n numerical_constraints[:min] += 1 if only_odd_valid && options[:min].even?\n numerical_constraints[:min] += 1 if only_even_valid && options[:min].odd?\n end\n numerical_constraints[:step] ||= 'any' unless only_integer\n end\n\n numerical_constraints\n end", "def verify_casts_cleared\n error \"F12: Dangling method cast detected.\" if @cast\n end", "def is_numeric(o)\n true if Integer(o) rescue false \n end", "def is_numeric(o)\n true if Integer(o) rescue false \n end", "def dbms_type_cast(columns, values)\n int_column = {}\n columns.each_with_index do |c, i|\n int_column[i] = c.type == 3 && c.scale == 0\n end\n\n float_column = {}\n columns.each_with_index do |c, i|\n float_column[i] = c.type == 3 && c.scale != 0\n end\n\n values.each do |row|\n row.each_index do |idx|\n val = row[idx]\n if val\n if int_column[idx]\n row[idx] = val.to_i\n elsif float_column[idx]\n row[idx] = val.to_f\n elsif val.is_a?(String)\n row[idx] = val.force_encoding('UTF-8')\n end\n end\n end\n end\n end", "def test_native_float_insert_manual_vs_automatic\n correct_value = \"0012345678901234567890.0123456789\".to_f\n\n connection.add_column \"test_models\", \"wealth\", :float\n\n # Do a manual insertion\n connection.transaction {\n connection.execute \"insert into test_models (id, wealth) values (#{generate_id}, 12345678901234567890.0123456789)\"\n }\n\n # SELECT\n row = TestModel.first\n assert_kind_of Float, row.wealth\n\n # If this assert fails, that means the SELECT is broken!\n assert_equal correct_value, row.wealth\n\n # Reset to old state\n TestModel.delete_all\n\n # Now use the Rails insertion\n TestModel.create wealth: BigDecimal(\"12345678901234567890.0123456789\")\n\n # SELECT\n row = TestModel.first\n assert_kind_of Float, row.wealth\n\n # If these asserts fail, that means the INSERT (create function, or cast to SQL) is broken!\n assert_equal correct_value, row.wealth\n end", "def require_integer(value)\n if value.is_a?(Integer) != true\n log_error_and_raise(\"expected integer value, got #{value.class}, #{value.inspect}\")\n end\n end", "def apply_validations_for_date\n flex_column_class.validates_each field_name do |record, attr, value|\n record.errors.add(attr, \"must be a Date\") if value && (! value.kind_of?(Date))\n end\n end", "def is_number()\n res = super(context,self)\n return res\n end", "def value_coercion(value); end", "def validates_numericalness_of(*attribute_names)\n options = Macros.extract_options(attribute_names)\n validation_rules.add(Rule::Value, attribute_names, options)\n validation_rules.add(Rule::Numericalness, attribute_names, options)\n end", "def typecaster(val, type)\n case type.to_sym\n when :string then val.to_s\n when :integer then val.to_i\n else\n raise \"Typecaster: i don't know this type: #{type}.\"\n end\n end", "def typecast_to_integer(value)\n typecast_to_numeric(value, :to_i)\n end", "def initialize_to_correct_date_type(field_info, field)\n initialize_integer(field_info, field)\n initialize_float(field_info, field)\n end", "def before_validation\n\t\tself.class.columns.each do |c|\n\t\t\tif self[c.name] and [:string, :text].include?(c.class)\n\t\t\t\tself[c.name] = RailsSanitize.full_sanitizer.sanitize(self[c.name]) \n\t\t\tend\n\t\tend\t\t\n\tend", "def added_time_cannot_be_of_invalid_format\r\n errors.add(:task, \"added time has to be an integer!\") unless\r\n added_time.instance_of?(Fixnum)\r\n end", "def should_be_integer?(field_info, field)\n field_info[\"type\"] == \"INTEGER\"\n end", "def check_type!(expression, expected, supports_nulls = true)\n if (expected == expression[:type] && !expression.key?(:field_manipulations)) ||\n (expression.key?(:field_manipulations) && check_function_type?(expression, expected)) ||\n (supports_nulls && expression[:type] == :null)\n return true\n # If the field will be passed into a function,\n # check the type of the return value of the function\n # and coerce if necessary.\n elsif expression[:field_manipulations] &&\n expression[:type] == :integer &&\n expression[:field_manipulations][:return_type] == :decimal\n expression[:type] = :decimal\n expression[:cast] = :integer\n return true\n elsif expected == :datetime && expression[:type] == :date\n expression[:type] = :datetime\n expression[:cast] = :date\n return true\n elsif expected == :date && expression[:type] == :datetime\n expression[:type] = :date\n expression[:cast] = :datetime\n if multiple_values?(expression[:value])\n expression[:value].map! { |val| coerce_datetime val }\n else\n expression[:value] = coerce_datetime expression[:value]\n end\n return true\n elsif expected == :decimal && expression[:type] == :integer\n expression[:type] = :decimal\n expression[:cast] = :integer\n return true\n end\n\n type_error(expression, expected)\n false\n end", "def validate_and_set(obj, attribute, value)\n if value.to_i >= 0\n obj.send(\"#{attribute}=\", value)\n validators = obj.class.validators_on(attribute)\n if !validators.empty?\n validators.each { |v| v.validate obj }\n\n unless obj.errors.full_messages.blank?\n obj.send(\"#{attribute}=\", nil)\n log_error(obj, \"#{attribute} not set because #{obj.errors.full_messages.to_sentence}.\")\n obj.errors.clear\n end\n end\n else\n log_error(obj, \"#{attribute} not set because #{value} is negative.\")\n end\n end", "def coercion_error!(msg = \"\")\n raise ::SByC::TypeSystem::CoercionError, msg, caller\n end", "def typecast_value_integer(value)\n value.to_i\n end", "def check_numericity\n check_patterns(@income.to_s)\n check_patterns(@age.to_s)\n end", "def coerce(other)\n case other\n when Numeric\n return self, other\n else\n raise TypeError, \"#{self.class} can't be coerced into #{other.class}\"\n end\n end", "def is_numeric(val)\n\t\treturn Integer(val).is_a? Integer rescue false\n\tend", "def check_value!(value)\n # Allow nil and Strings to fall back on the validations for typecasting\n case value\n when nil, String, expected_type\n value\n else\n raise TypeError, \"#{@name} expected #{expected_type.inspect} but got #{value.inspect}\"\n end\n end", "def columns_changeable_must_be_formatted\n if columns_changeable\n begin\n formatted = JSON.parse(columns_changeable)\n formatted.each do |f|\n unless f.is_a?(Numeric) || f.is_a?(String) || f.is_a?(Date)\n errors.add(:columns_changeable, \"#{f} is not a number, string, nor date\")\n end\n end\n rescue\n errors.add(:columns_changeable, 'Error parsing the changeable columns')\n end\n end\n end", "def type_cast(value)\r\n @column_definition.type_cast(value)\r\n end", "def coerce(other)\n case other\n when Integer\n begin\n return other, Integer(self)\n rescue\n return Float(other), Float(self)\n end\n when Float\n return other, Float(self)\n else\n super\n end\n end", "def determine_dataype(value)\n return validate_field(value)\n end", "def coerce(other)\n case other\n when Numeric\n return self.class.new(other, '1'), self\n else\n fail TypeError, \"#{self.class} can't be coerced into #{other.class}\"\n end\n end", "def numeric_check(first_num)\n Float(first_num) != nil rescue false\nend", "def apply_validations_for_time\n flex_column_class.validates_each field_name do |record, attr, value|\n record.errors.add(attr, \"must be a Time\") if value && (! value.kind_of?(Time))\n end\n end", "def type_to_sql(type, limit = nil, precision = nil, scale = nil)\n return super unless type.to_s == 'integer'\n return 'integer' unless limit\n\n case limit\n when 1..8; 'integer'\n else raise(ActiveRecordError, \"No integer type has byte size #{limit}. Use a numeric with precision 0 instead.\")\n end\n end", "def typecast_attributes\n @attributes.each_pair do |name,value|\n # skip primary key columns\n # ajay Singh --> skip the loop if attribute is null (!name.present?)\n next if (name == \"id\") or (!name.present?)\n attr_type = attr_type_for(name)\n \n # empty attributes should stay empty (e.g. an empty int field shouldn't be typecast as 0)\n if [:datetime, :datetimecombo, :int].include? attr_type && (value.nil? || value == '')\n @attributes[name] = nil\n next\n end\n \n case attr_type\n when :bool\n @attributes[name] = (value == \"1\")\n when :datetime, :datetimecombo\n begin\n @attributes[name] = DateTime.parse(value)\n rescue\n @attributes[name] = value\n end\n when :int\n @attributes[name] = value.to_i\n end\n end\n @attributes\n end", "def apply_validations_for_datetime\n flex_column_class.validates_each field_name do |record, attr, value|\n record.errors.add(attr, \"must be a Time or DateTime\") if value && (! value.kind_of?(Time)) && (value.class.name != 'DateTime')\n end\n end", "def columns_changeable_must_be_formatted\n return unless columns_changeable\n\n begin\n formatted = JSON.parse(columns_changeable)\n formatted.each do |f|\n unless f.is_a?(Numeric) || f.is_a?(String) || f.is_a?(Date)\n errors.add(:columns_changeable, \"#{f} is not a number, string, nor date\")\n end\n end\n rescue\n errors.add(:columns_changeable, 'Error parsing the changeable columns')\n end\n end" ]
[ "0.62341934", "0.6137441", "0.61186206", "0.60855174", "0.6074752", "0.5979723", "0.59003586", "0.58968014", "0.5843285", "0.55938995", "0.5574281", "0.55639166", "0.55636966", "0.55614865", "0.5551228", "0.55384344", "0.5434551", "0.54299635", "0.5427072", "0.53972936", "0.5397019", "0.5397019", "0.5397019", "0.5397019", "0.5354415", "0.53283435", "0.53262824", "0.5318732", "0.53136945", "0.5300445", "0.52862203", "0.52832025", "0.52778226", "0.5274819", "0.52645016", "0.526439", "0.5252729", "0.52391106", "0.52389914", "0.5228992", "0.5228601", "0.52144545", "0.52137214", "0.5211663", "0.5203444", "0.5203444", "0.52031475", "0.51975197", "0.5196313", "0.51628363", "0.516082", "0.51544106", "0.51371306", "0.5115838", "0.5112752", "0.51090515", "0.5101478", "0.50961924", "0.5092888", "0.5069958", "0.50697243", "0.5065218", "0.506325", "0.50583386", "0.5057047", "0.5040531", "0.50374657", "0.5035655", "0.503147", "0.50302297", "0.50251997", "0.502361", "0.5022279", "0.5012875", "0.5012383", "0.5003389", "0.4997996", "0.49963892", "0.49835604", "0.49798256", "0.4978779", "0.49773428", "0.4973917", "0.49618748", "0.49616814", "0.4957753", "0.49557146", "0.4940838", "0.49334708", "0.49316928", "0.49304965", "0.49209136", "0.49190927", "0.49170667", "0.49154776", "0.49090052", "0.49071074", "0.49059606", "0.49043742", "0.49009517" ]
0.6920223
0
=> 100 Compare it to a method
def square_it_method(num) num * num end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def my_method\n 100\nend", "def my_method\n 100\nend", "def method_missing(method, *args, &block)\n if match = /has_less_([#{ROMAN_CHARS}])_than/.match(method.to_s)\n raise ERROR_ILLEGAL_COMPARISON unless args[0].is_a?(RomanNumeral)\n char = match[0]\n self.count(char) < args[0].count(char)\n elsif match = /has_equal_([#{ROMAN_CHARS}])_as/.match(method.to_s)\n raise ERROR_ILLEGAL_COMPARISON unless args[0].is_a?(RomanNumeral)\n char = match[0]\n self.count(char) == args[0].count(char)\n elsif match = /has_more_([#{ROMAN_CHARS}])_than/.match(method.to_s)\n raise ERROR_ILLEGAL_COMPARISON unless args[0].is_a?(RomanNumeral)\n char = match[0]\n self.count(char) > args[0].count(char)\n else\n super\n end\n end", "def compare(a, b)\n #YOUR WORK HERE\n end", "def result_of_checking; end", "def method\r\n\t1\r\nend", "def compare_on_methods(other, method, &tiebreaker_if_both_true)\n case [self, other].select(&method)\n when [self] then 1\n when [other] then -1\n when [self, other] then yield(tiebreaker_if_both_true)\n end\n end", "def count_method\n @method_count += 1\n end", "def test_Method_InstanceMethods_call\n\t\tm = 12.method(\"+\")\n\t\tassert_equal(15, m.call(3))\n\t\tassert_equal(32, m.call(20))\n\tend", "def compare(x, y); end", "def >(other)\n compare_method(other, 1)\n end", "def compare_to_approach(*args)\n\n end", "def count a\nend", "def a_good_method\n 1 + 1\nend", "def expected_method; end", "def test_exercise_1127\n @rec_calls = 0\n binomial(10, 4, 0.25)\n predicate = Proc.new { |actual|\n Math.log10(actual).truncate == Math.log10(@rec_calls).truncate\n }\n\n params = [10, 4]\n verify_method :exercise_1127,\n :with => [{params: params, predicate: predicate}]\n end", "def test_Method_InstanceMethods_eql?\n\t\t# Inside eql?\n\t\tdef fred() return \"a\"+\"b\" end\n\t\talias bert fred\n\t\tm1 = method(:fred)\n\t\tm2 = method(:bert)\n\t\tassert_equal(true, m1.eql?(m2))\n\tend", "def score_method(method = nil)\n @score_method = method if method\n @score_method\n end", "def yet_another_func\r\n 18\r\n end", "def calls_by_method_name; end", "def score_methods(meths, args)\n scores = meths.collect do |meth|\n score = meth.score_cached(args)\n if score \n score = [ score, meth ]\n else\n score = nil\n end\n\n score\n end\n\n scores.compact!\n scores.sort!\n \n $stderr.puts %{ score_methods(#{args.inspect}) => \\n#{scores.collect{|x| x.inspect}.join(\"\\n\")}} if @debug\n\n scores\n end", "def bornin2 _method, _class\n\n # the patten to grep for\n re = Regexp.new '^' + _method.to_s + '$'\n\n _class.ancestors.each do |ancestor|\n\n #- in methods?\n if ancestor.methods(false).grep(re).size==1\n return puts \"=> #{_method} : \" +\n\t\"..... born in #{ancestor} as a method\".green\n end\n\n #- in instance_methods?\n if ancestor.instance_methods(false).grep(re).size==1\n return puts \"=> #{_method} : \" +\n\t\"...... born in #{ancestor} as an instance method\".green\n end\n\n end # scanning ancestors\n\nend", "def compare(move1, move2)\n \nend", "def compare(move1, move2)\n \nend", "def do_compare (opts)\n\tif (params = opts[:parameters]) && params.size(:seq) > 0 &&\n\t params[0].is_a?(Numeric)\n\t diff = params[0]\n\telse diff = 0\n\tend\n\tdiff = @original - diff\n\tcase opts[:method]\n\twhen '<' then diff < 0\n\twhen '<=' then diff <= 0\n\twhen '==' then diff == 0\n\twhen '!=' then diff != 0\n\twhen '>=' then diff >= 0\n\twhen '>' then diff > 0\n\tend\n end", "def nearby_method(name)\n max_distance = 2\n max_distance = 1 if name.to_s.length <= 3\n\n distance = {}\n nearby_methods = self.methods.select do |method|\n d = MaybeYouMeant::Levenshtein.distance(name.to_s, method.to_s, max_distance + 1)\n distance[method] = d if d <= max_distance\n d <= max_distance\n end\n return nil if nearby_methods.empty?\n nearby_methods.sort! do |method, other|\n distance[method] <=> distance[other]\n end\n nearby_methods[0]\n end", "def iterating_method?(name); end", "def compare(move1, move2)\n\nend", "def compare(move1, move2)\n\nend", "def more_than_100(num1, num2)\n if num1 + num2 > 100\n return true\n else\n return false\n end\nend", "def compare(move1, move2)\r\n\r\nend", "def check5(pmt)\n pmt > 5\nend", "def more_than_100(num1, num2)\n if num1 + num2 > 100\n return true\n else\n false\n end\nend", "def >=(arg0)\n end", "def >=(arg0)\n end", "def percent_passes; end", "def percent_passes; end", "def a\n puts \"Function 'a' called\"\n 99\nend", "def go_wrapper(count, meth)\n return false unless meth.call\n (count-1).times {break unless meth.call}\n return true\n end", "def ===(method); end", "def comp\nend", "def test; true; end", "def time_to_call_after_methods?\n @@inside_methods == 0\n end", "def compare_tests(test_a, test_b); end", "def compare_tests(test_a, test_b); end", "def hit?(card_total)\n # code hit? here\n\n \nend", "def bornin _method, _class = [\n Fixnum,\n Float,\n String,\n Array,\n Hash,\n Range,\n Regexp,\n Math\n]\n\n # to colorize output\n require 'colorize'\n\n # Check\n if _method==nil\n return puts \"=> please pass first arg as a string\".red\n end\n\n # the patten to grep for\n re = Regexp.new '^' + _method.to_s + '$'\n\n # born in BasicObject?\n if BasicObject.instance_methods(false).grep(re).size==1\n return puts \"=> #{_method} : \" +\n \". born in BasicObject as an instance method\".green\n # born in Kernel?\n elsif Kernel.instance_methods(false).grep(re).size==1\n return puts \"=> #{_method} : \" +\n \".. born in Kernel as an instance method\".green\n # born in Object?\n elsif Object.instance_methods(false).grep(re).size==1\n return puts \"=> #{_method} : \" +\n \"... born in Object as an instance method\".green\n # born in Module?\n elsif Module.instance_methods(false).grep(re).size==1\n return puts \"=> #{_method} : \" +\n \".... born in Module as an instance method\".green\n end\n\n # puts \"check what class is _class\"\n # check what class is _class\n if _class.class == String\n _class = eval(_class)\n elsif _class.class == Symbol\n _class = Kernel.const_get(_class.to_s)\n # relying on some very basic classes listed above when\n # _class was not passed as a param\n elsif _class.is_a? Array\n _class.each do |e|\n # puts \"Checking #{_method} in #{e} ...\"\n output = bornin2 _method, e\n output || break\n # return\n end\n else\n bornin2 _method, _class\n end\n\nend", "def f() 1 end", "def compare_performance(entity, method, *args)\n no_contract_label = \"#{entity}:#{method}_no_contract\"\n with_contract_label = \"#{entity}:#{method}\"\n \n Benchmark.bm(no_contract_label.length) do |x|\n x.report(no_contract_label) { entity.send(\"#{method}_no_contract\", *args) }\n x.report(with_contract_label) { entity.send(method, *args) }\n end\nend", "def bar\n 1\nend", "def simple_budget_checker(total)\n\nend", "def method a, &block\r\n\t1\r\nend", "def method_check(compiler)\n ok_label = SlotMachine::Label.new(self,\"method_ok_#{self.object_id}\")\n compile_method = SlotMachine::Slotted.for( compiler.get_method )\n runtime_method = SlotMachine::Slotted.for( :message , [ :method] )\n check = SlotMachine::NotSameCheck.new(compile_method , runtime_method, ok_label)\n # TODO? Maybe create slot instructions for this\n #builder = compiler.builder(\"yield\")\n #Risc::Macro.exit_sequence(builder)\n #check << builder.built\n check << ok_label\n end", "def complexity_methods(email_id = nil)\n file_selector.to_methods.too_complexity(15).unwrap.map do |method|\n if email_id\n 1.0 * (method.line_percentage[email_id].to_f / 100)\n else\n 1\n end\n end.sum.round\n end", "def method &block \r\n\t1\r\nend", "def longest_method(arg)\n arg.methods.select {|el| el if el.size >= 26}.sort.last\nend", "def method(num)\n @methods[num % @num_methods]\n end", "def registered?(method); end", "def detect_result(dealer_total, player_total)\n # player_total = total(player_cards)\n # dealer_total = total(dealer_cards)\n\n if player_total > 21\n :player_busted\n elsif dealer_total > 21\n :dealer_busted\n elsif dealer_total < player_total\n :player\n elsif dealer_total > player_total\n :dealer\n else\n :tie\n end\n \nend", "def number_returned; 0; end", "def endless_method(num) = num * 2", "def stest_method_1(test); end", "def ten_to_two_hundred\n\nend", "def aMethod( i )\r\n\tputs( i )\r\nend", "def method a, &b\r\n\t1\r\nend", "def method a, &b\r\n\t1\r\nend", "def method a, &b\r\n\t1\r\nend", "def method a, &b\r\n\t1\r\nend", "def cheat\n check(:B, 47)\n puts \"me cheat!\"\n end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def check ; true ; end", "def prime?(arg)\n Prime.prime?(arg)\nend", "def method &block\r\n\t1\r\nend", "def method &block\r\n\t1\r\nend", "def bust_method\n\tif original_total > 21 \n\t\tputs \"You have BUSTED!\"\n\telsif original_total == 21\n\t\tputs \"You got 21!\"\n\telsif original_total < 21 \n\t\tputs \"Hit or Stay?\"\n\tend \nend", "def passes; end", "def passes; end", "def compare(sum, age)\n comparison = (sum < age.to_i) ? \"less\" : \"greater\"\nend", "def method\n\t[1,2,3].each do |val| # Proc.new\n\t\tputs val\n\t\treturn if val > 2 \n\tend\nend", "def x; 1; end", "def aMethod( i )\n\tputs( i )\nend", "def test_e2111_shell_sort_increment\n verify_method :e2111_shell_sort_increment,\n :with => [\n {\n param: 3,\n predicate: Proc.new { |seq| check_shell_sort_sequence(3, seq) }\n },\n {\n param: 4,\n predicate: Proc.new { |seq| check_shell_sort_sequence(4, seq) }\n },\n {\n param: 10,\n predicate: Proc.new { |seq| check_shell_sort_sequence(10, seq) }\n },\n {\n param: 100,\n predicate: Proc.new { |seq| check_shell_sort_sequence(100, seq) }\n },\n ]\n end", "def success_threshold; end", "def can_call?(player)\n return (self.high_bet > player.in_pot_current)\n end", "def method(a==3)\r\nend", "def method_missing(method_id, *arguments) \n match = method_id.to_s.match(/is_(.*)\\?/)\n if match && STATUSES.keys.map { |k| k.to_s }.include?(match[1])\n return self.status == STATUSES[match[1].to_sym]\n end\n \n super\n end", "def count_YZ\nend", "def number_with_method?\n self =~ NUMBER_WITH_METHOD_REGEX\n end", "def check(number)\n \n end", "def detect_result(dealer_total, player_total)\n if dealer_total < player_total\n :player\n elsif dealer_total > player_total\n :dealer\n else\n :tie\n end\nend" ]
[ "0.61974514", "0.61974514", "0.607814", "0.6030998", "0.5880611", "0.58063346", "0.57334423", "0.55957216", "0.55652666", "0.55605483", "0.5552397", "0.5527076", "0.5523094", "0.551149", "0.5503446", "0.5500505", "0.54954743", "0.547477", "0.54687715", "0.5461989", "0.5454511", "0.54522765", "0.54443455", "0.54443455", "0.54374635", "0.5435076", "0.54253083", "0.54184675", "0.54184675", "0.5409483", "0.5408596", "0.53958094", "0.53936124", "0.5387745", "0.5387745", "0.5386387", "0.5386387", "0.53732055", "0.53566563", "0.53541964", "0.534834", "0.53415126", "0.5327297", "0.5324012", "0.5324012", "0.5323997", "0.5319699", "0.5313394", "0.5296677", "0.52949274", "0.5290292", "0.5288842", "0.528636", "0.52836615", "0.5277657", "0.5268554", "0.5259418", "0.52577204", "0.5248965", "0.52479464", "0.5238205", "0.52324486", "0.5232204", "0.52320516", "0.5229099", "0.5229099", "0.5229099", "0.5229099", "0.52262497", "0.5225297", "0.5225297", "0.5225297", "0.5225297", "0.5225297", "0.5225297", "0.5225297", "0.5225297", "0.5225297", "0.5225297", "0.5225297", "0.5225297", "0.5220645", "0.52161354", "0.52143097", "0.52143097", "0.5213185", "0.5203291", "0.5203291", "0.52023095", "0.5193429", "0.51934063", "0.5191773", "0.5189459", "0.5188901", "0.51841694", "0.51809037", "0.5177075", "0.5176176", "0.5164287", "0.5159651", "0.51593435" ]
0.0
-1
=> 2 They keep the environment they were defined in even if they get passed into a new scope.
def invoke_10_times(proc) 10.times { proc.call } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scope=(_); end", "def scope\n @env.unshift({})\n begin\n yield\n ensure\n @env.shift\n raise \"You went too far unextending env\" if @env.empty?\n end\n end", "def global_scope; @scope = :global end", "def original_env; end", "def scope=(_arg0); end", "def scope=(_arg0); end", "def scope=(_arg0); end", "def local_scope; @scope = :local end", "def environment; end", "def default_scope=(_arg0); end", "def env=(environment); end", "def env=(environment); end", "def scope; end", "def scope; end", "def scope; end", "def scope; end", "def scope; end", "def scope; end", "def scope; end", "def scope; end", "def scope; end", "def scope; end", "def scope() binding end", "def scope(*args); end", "def put_var_scope\nend", "def environment(environment); end", "def scope &block\n env.scope(&block)\n end", "def scope &block\n env.scope(&block)\n end", "def scope &block\n env.scope(&block)\n end", "def context_overrides()\n {\n :current_environment => environment,\n :global_scope => @topscope, # 4x placeholder for new global scope\n :loaders => @loaders, # 4x loaders\n }\n end", "def scope1(var)\r\n\ta = \"monkey\"\r\nend", "def process_scope exp\n # NOPE?\n end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def environments; end", "def scope=(v); end", "def scope=(v); end", "def env\r\n original_env.merge(hacked_env)\r\n end", "def default_scope; end", "def all\n @env.reverse.inject { |env, scope| env.merge scope }\n end", "def scopes; end", "def restore_env(env); end", "def filtered_env; end", "def apply_environment!(hook_context, env); end", "def scope() yield end", "def static_env=(_arg0); end", "def static_env=(_arg0); end", "def static_env=(_arg0); end", "def dup_environment\n\n env = fetch_environment\n env = env.dup\n env.fei = @fei.dup\n env.fei.expression_name = EN_ENVIRONMENT\n @environment_id = env.fei\n\n env.store_itself\n end", "def scope_stack\n Thread.current[:\"[mongoid]:scope-stack\"] ||= {}\n end", "def scope_stack\n Thread.current[:\"[mongoid]:scope-stack\"] ||= {}\n end", "def scope_stack\n Thread.current[:\"[mongoid]:scope-stack\"] ||= {}\n end", "def local_variable_scope\n parent.local_variable_scope\n end", "def with_clean_env(&block); end", "def stack(new_scope = T.unsafe(nil)); end", "def env\n super.merge(hacked_env)\n end", "def _env_change\n if @env_used\n @environments << @env\n @env = Bcpm::Tests::Environment.new\n @env_used = false\n end\n end", "def env\n @env ||= env_with_params\nend", "def scope\n scope_hash = [settings.force_mode,state.total].hash\n return @state.scope unless @state.scope.nil? or scope_hash != @state.scope_hash\n state.scope_at = [\n settings.force_mode || ($stdout.isatty ? :tty : :notty),\n :unknown == state.total ? :infinite : :finite\n ]\n state.scope = state.settings\n state.scope_at.each do |s|\n begin\n state.scope = state.scope[s]\n rescue NoMethodError\n raise StandardError, \"Invalid configuration: #{state.scope_at.join('.')} \"+\n \"(Can't resolve: #{state.scope_at[state.scope_at.index(s)-1]})\"\n end\n end\n state.scope_hash = scope_hash\n state.scope\n end", "def hacked_env\n @hacked_env ||= {}\n end", "def forward_local_env(env_variable_patterns); end", "def with_environment(env); end", "def context_overrides()\n {\n :current_environment => environment,\n :global_scope => @topscope, # 4x placeholder for new global scope\n :loaders => @loaders, # 4x loaders\n :rich_data => true,\n }\n end", "def leave_scope\n # puts __callee__\n current_scope = symbol_table.current_scope\n parent_scope = current_scope.parent\n return unless parent_scope\n\n # Retrieve all i_names from current scope\n i_name_set = Set.new(current_scope.defns.values.map(&:i_name))\n\n # Remove all associations from queue until the scope's bookmark\n items = blackboard.leave_scope\n curr_asc, ancestor_asc = items.partition do |a|\n i_name_set.include? a.i_name\n end\n vars_to_keep = Set.new\n\n ancestor_asc.each do |assoc|\n if assoc.dependencies(self).intersect?(i_name_set)\n dependents = assoc.dependencies(self).intersection(i_name_set)\n vars_to_keep.merge(dependents)\n end\n enqueue_association(assoc, nil) # parent_scope\n end\n\n assocs_to_keep = []\n\n unless vars_to_keep.empty?\n loop do\n to_keep, to_consider = curr_asc.partition do |a|\n vars_to_keep.include? a.i_name\n end\n break if to_keep.empty?\n\n to_keep.each do |a|\n vars_to_keep.merge(a.dependencies(self).intersection(i_name_set))\n end\n assocs_to_keep.concat(to_keep)\n curr_asc = to_consider\n end\n end\n symbol_table.leave_scope\n\n vars_to_keep.each do |i_name|\n v = LogVar.new(i_name)\n v.suffix = ''\n symbol_table.insert(v)\n end\n\n assocs_to_keep.each { |a| blackboard.enqueue_association(a) }\n end", "def default_environment=(env); end", "def default_environment; end", "def with_original_env\n with_env(original_env) { yield }\n end", "def active_locals; end", "def find_scope!(obj); end", "def scope\n @scope.dup\n end", "def inherit_scope(other)\n @scope = other.scope\n end", "def global_env\n @global_env ||= global? ? self : @parent.global_env\n end", "def environment_matchers=(_arg0); end", "def save_env; end", "def environment *environments, &block\n old = @environments\n @environments = @environments.dup.concat environments.map { |e| e.to_s }\n\n instance_eval(&block)\n ensure\n @environments = old\n end", "def scope\n if true\n bar = 1\n end\n p bar\nend", "def cancel_auto_inject(env); end", "def globals; end", "def globals; end", "def _post_eval\n @environments << @env if @env_used\n @env = nil\n @options = nil\n end", "def current_scope\n Thread.current[:webspicy_scope] || default_scope\n end" ]
[ "0.7532797", "0.73215175", "0.7111272", "0.7107934", "0.7086285", "0.7086285", "0.7086285", "0.6886559", "0.68244743", "0.6819675", "0.6788115", "0.6788115", "0.6778643", "0.6778643", "0.6778643", "0.6778643", "0.6778643", "0.6778643", "0.6778643", "0.6778643", "0.6778643", "0.6778643", "0.6770955", "0.67188394", "0.6663067", "0.6609718", "0.65686005", "0.65686005", "0.65686005", "0.6502885", "0.6496719", "0.64793324", "0.64608777", "0.64608777", "0.64608777", "0.64608777", "0.64608777", "0.64608777", "0.64608777", "0.64608777", "0.64608777", "0.64608777", "0.64608777", "0.64608777", "0.64608777", "0.64608777", "0.64608777", "0.64608777", "0.64608777", "0.64608777", "0.64608777", "0.64608777", "0.64608777", "0.64608777", "0.6450357", "0.63917226", "0.63917226", "0.6362753", "0.63555497", "0.63359094", "0.632251", "0.62987137", "0.6263688", "0.62291366", "0.6214643", "0.6187069", "0.6187069", "0.6187069", "0.61307174", "0.61004114", "0.61004114", "0.61004114", "0.6090968", "0.6088481", "0.60679615", "0.6067714", "0.60635847", "0.6042235", "0.6036797", "0.6027705", "0.6016716", "0.6016018", "0.6006966", "0.599398", "0.59813166", "0.5979521", "0.5957517", "0.5939965", "0.59383154", "0.5924916", "0.5888952", "0.587948", "0.58725786", "0.5867597", "0.58634657", "0.5857888", "0.58439106", "0.5834853", "0.5834853", "0.5831372", "0.58244187" ]
0.0
-1
=> [0, 0, 0] A return statement in a method will from return it. But a return statement in a proc will return from the enclosing environment.
def first_even(nums) nums.each do |num| return num if num.even? end nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ret_proc \n proc = Proc.new { return \"a return from inside the proc returns not only from the proc, but the enclosing method itself, unlike a lambda.\"}\n proc.call\n return \"returning from inside the method\"\n end", "def proc_method\n\tproc_a = proc { |x| return x }\n\tproc_a.call(@expected_proc_return)\n\t\"unexpected proc return\"\nend", "def return_from_proc\n a = Proc.new { return 10 }.call\n # 1.times { return 10 }\n puts \"This will never be printed.\"\nend", "def proc_in_return\n proc_func = proc {\n return\n }\n proc_func.call\n\n \"mew\"\n end", "def proc_return_demo\n some_proc = Proc.new { return \"proc returns\"}\n some_proc.call\n \"method returns\"\nend", "def proc_return\n Proc.new { return \"Proc.new\"}.call\n return \"proc_return method finished\"\nend", "def proc_return\n my_proc = Proc.new { return }\n my_proc.call\n puts \"This will not be printed\"\nend", "def return_with_Proc\n f = Proc.new { return \"return inside block\" }\n f.call\n v = f.call\n return \"#{v}: return from method_end\" \nend", "def return_test\n\tl = lambda { return }\n\tl.call\n\tputs \"Still here!\"\n\tp = Proc.new { return }\n\tp.call\n\tputs \"You won't see this message!\"\nend", "def b_method()\n Proc.new { return \"we return from proc\" }.call\n return \"return from method\"\nend", "def proc_return\n my_proc = Proc.new {return}\n my_proc.call\n puts \"Will this be printed (Proc)\"\nend", "def return\n @v_return\n end", "def create_proc_with_return\n proc = Proc.new { return puts \"I am a proc with return\" }\n #on check on numbers of paramaters\n proc.call()\n # will not be executed!\n puts \"I am behind proc's call that with a return \"\nend", "def proc_method\n p = Proc.new { return \"\\nreturning from proc\\n\"} \n p.call\n print \"\\nStatement after proc\\n\"\nend", "def test_proc\n Proc.new { p \"Exit from proc.\" and return }.call\n p \"Exit from proc method\" and return\nend", "def method\n\t[1,2,3].each do |val| # Proc.new\n\t\tputs val\n\t\treturn if val > 2 \n\tend\nend", "def meth5\n p = lambda { return 99 } \n result = p.call \n \"The block returned #{result}\"\nend", "def my_method\n x = Proc.new{return}\n x.call\n p \"Text from within the method\"\nend", "def returns; end", "def proc_method\n my_proc = Proc.new { return \"I'm a proc\"}\n my_proc.call\n \"Last line of proc_method\"\nend", "def go\n a = Proc.new do \n puts 'Proc'\n\n return\n end\n\n methods(&a)\n\n puts 'end go'\nend", "def dietproc\n status=Proc.new{return \"You gave in!\"} #explict return skips the part of code so removing return\n status.call\n \"You completed the diet!\"\nend", "def call_proc\n puts \"Before proc\"\n my_proc = Proc.new { return 2 }\n my_proc.call\n puts \"After proc\"\n\nend", "def proc_method\n my_proc = Proc.new { return \"I'm a proc!\"}\n my_proc.call\n \"Last line of proc method\"\nend", "def call_proc\n\tputs \"Before proc\"\n\tmy_proc = Proc.new { return 2 } \n\tmy_proc.call\n\tputs \"After proc\"\nend", "def another_proc\n\tp = Proc.new {return}\n\tp.call\n\tputs \"After Proc\"\nend", "def capture_return\n @returns = @code.split(/\\(/).first !~ /void/ \n end", "def call_proc\n puts \"Before proc\"\n my_proc = Proc.new { return 2 }\n my_proc.call\n puts \"After proc\"\nend", "def foobar\n (1..10).each do |val|\n return val # returns from method\n end\nend", "def return(&block); end", "def mass_return\n [1,2]\nend", "def myreturn\n @myreturn\n end", "def return_value; end", "def check_return(proc4)\n proc4.call\n puts \"Puts string after return was called\"\nend", "def returns=(_arg0); end", "def new_proc\n proc1 = Proc.new{return \"I got it....\"}\n proc1.call\n \n return \".. but not that\"\nend", "def return_values\n Calls.new(select(&:returned?))\n end", "def a \n return 1\nend", "def proc_math\n Proc.new { return 1 + 1 }.call\n return 2 + 2\nend", "def proc_math\n Proc.new { return 1 + 1 }.call\n\n return 2 + 2\nend", "def meth\n res = yield \n \"The block returns #{res}\"\nend", "def return_value\n @return_value\n end", "def returns val = nil\n @returns = val\n self\n end", "def get_return_value exp, env = nil\n process_method exp, env\n value = make_return_value\n value.original_line = exp.line\n value\n end", "def my_method\n puts \"before proc\"\n my_proc = lambda do\n puts \"inside proc\"\n return\n end\n my_proc.call\n puts \"after proc\"\nend", "def test1\n p = Proc.new { return }\n p.call\n puts “This line can’t display”\nend", "def proc\n return $PROC\n end", "def returnsomething\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 18 )\n\n begin\n # at line 613:5: expression\n @state.following.push( TOKENS_FOLLOWING_expression_IN_returnsomething_848 )\n expression\n @state.following.pop\n # --> action\n\n \trt = @stack_operands.pop\n rt_t = @stack_types.pop\n if(rt_t != @current_method.return_type)\n raise \"Invalid return type #{rt_t} in the #{@current_method.return_type} type method #{@current_class.name}::#{@current_method.name}\"\n end\n generate('ret', nil, nil ,rt )\n @is_returning = true\n free_avail(rt)\n free_avail_const(rt)\n \n \n # <-- action\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 18 )\n\n end\n \n return \n end", "def my_method\n \n puts \"before proc\"\n\n my_proc = lambda{\n puts \"Inside proc\"\n #return\n #break\n }\n\n my_proc.call\n puts \"after proc\"\n\nend", "def test\r\n puts \"Enter in methods\"\r\n p = Proc.new {p \"Entering block\"; return }\r\n p.call\r\n p \"Existing methods\"\r\nend", "def batman_ironman_proc\n victor = Proc.new { return \"Batman will win!\" } # Proc returns immediately, without going back to the batman_ironman_proc method.\n victor.call\n \"Iron Man will win!\"\nend", "def nums\n return 1, 2\nend", "def batman_ironman_proc\r\n victor = Proc.new { return \"Batman will win!\" }\r\n puts victor.call\r\n \"Iron Man will win!\"\r\nend", "def proc_demo_method\n proc_demo = Proc.new { return \"Only I print!\" }\n proc_demo.call\n \"But what about me?\" # Never reached\nend", "def my_proc\n\n\tputs \"first proc\"\n\n\tproc1 = proc {\n\n\t\tputs \"second proc\"\n\t\t#breaak or return\n\n\t}\n\n\tproc1.call\n\tputs \"last proc\"\nend", "def nothing\n return lambda do |pos|\n return []\n end\nend", "def procedure_a(a,b)\n a=a+3\n b=b+4\n return a,b\nend", "def method_with_explicit_return\n :a_non_return_value\n return :return_value\n :another_non_return_value\n end", "def return!(&block); end", "def return_proc\n Proc.new do |name|\n puts \"The length of your name is #{name.length}\"\n end\nend", "def test\r\n puts \"Enter in methods\"\r\n p = Proc.new { p \"Entering proc\"; break }\r\n p.call\r\n p \"Existing methods\"\r\nend", "def print_me\n return \"I'm printing the return value!\"\nend", "def batman_ironman_proc #will return batman will win\n victor = Proc.new { |n| return \"Batman will win!#{n}\" }\n victor.call(3)\n \"Iron Man will win!\"\nend", "def diet_proc\n status = Proc.new { return \"You gave in\"}\n status.call\n \"You completed the diet\"\nend", "def return_with_lambda\n f = lambda { return \"return inside block\" }\n f.call\n v = f.call\n return \"#{v}: return from method_end\" \nend", "def return_value\n # return @stack_sigs[@returnValIdx][@stack_ptr-1]\n @returnValue\n end", "def diet2\n status = Proc.new { return 'You gave in!' }\n status.call\n 'You completed the diet!'\nend", "def test\n\tputs \"Entering method\"\n\tp = Proc.new { puts \"Entering Proc\"; break }\n\tbegin \n\t\tp.call # => LocalJumpError\n\trescue \n\t\tputs \"We got an error breaking!\" \n\tend\n\tputs \"Exiting method\"\nend", "def return_check\n @@return_check ||= Proc.new { |ptr| Error.check_and_raise( ptr ) }\n end", "def proc_method_nested_example\n\tproc_method\n\t@expected_proc_return_from_nested_example \nend", "def proc_sample\n proc = proc { return 'world' }\n 'hello ' << proc.call\nend", "def number_returned; 0; end", "def calls_array\n a = return_array\n a[1]\n end", "def metodo_con_return\n return 2 + 5\nend", "def sampleProc\n procOne = Proc.new { return \"Proc block!\" }\n procOne.call\n \"Last Proc statement!\"\nend", "def returns\n parsed {\n @returns\n }\n end", "def test_method\n return \"The method will return this string here!\"\n puts \"This line of code will not run.\"\nend", "def batman_ironman_proc\r\n victor = Proc.new { return \"Batman will win!\" }\r\n victor.call\r\n \"Iron Man will win!\"\r\nend", "def ret!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 1)\n\n type = RET\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 7:7: 'returns'\n match(\"returns\")\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 1)\n\n end", "def another_double\n p = Proc.new { return 10}\n result = p.call\n return result * 2 # => unreachable code!\nend", "def sreturn(val)\n # HDLRuby::High.top_user.hprint(\"sreturn\\n\")\n # Get the top function.\n funcI = SequencerFunctionI.current\n unless funcI then\n raise \"Cannot return since outside a function.\"\n end\n # Applies the return on it.\n funcI.make_return(val)\n end", "def caller\n []\n end", "def sum(a, b)\n points = 100\n return points # => Never give bottom of 'return'\n a + b + points\n puts \"This is after the expicit return statement\"\nend", "def exMethod\r\n # explicitly the last line will be the return\r\n\t# return var is also allowed but this also works\r\n $var\r\nend", "def foo\n\treturn 'bar'\nend", "def doSomething\r\n puts \"inside the method\"\r\n return binding\r\nend", "def returning i\n yield i\n return i\nend", "def my_method\n \n puts \"before proc\"\n \n my_proc = lambda{\n \n puts \"Inside proc\"\n break\n }\n \n my_proc.call\n puts \"after proc\"\n \nend", "def proc_method(&my_proc)\n puts \"method start\"\n my_proc.call\n puts \"method end\"\nend", "def yield_return\n p yield\nend", "def generic_return(code)\n code.call\n return \"generic_return method finished\"\nend", "def another_double\n p = Proc.new { return 10 }\n result = p.call\n return result * 2 # unreachable code!\nend", "def eval_return(*args)\n eval(*args).return\n end", "def batman_ironman_proc #calls a proc\n victor = Proc.new { return \"Batman will win!\" }\n victor.call\n \"Iron Man will win!\"\nend", "def batman_ironman_proc\n\t victor = Proc.new { return \"Batman will win!\" } # when a proc returns, it does so immediately, without going back to the calling method.\n\t victor.call\n\t \"Iron Man will win!\" \n\tend", "def test_early_exit_needed_in_contexts_with_method_return_value_set\n method_context = @manager.enter_method_scope(@test_self)\n method_context.return_type = Constants[\"Boolean\"]\n flow_context = @manager.enter_flow_control_block_scope()\n flow_context.set_return(Constants[\"true\"])\n assert_true flow_context.need_early_exit\n @manager.leave_scope(flow_context)\n assert_true method_context.need_early_exit\n @manager.leave_scope(method_context)\n end", "def meth_three\n\treturn 1, 2, 3\nend", "def batman_ironman_proc\n victor = Proc.new { return \"Batman will win!\" }\n victor.call\n \"Iron Man will win!\"\nend", "def batman_ironman_proc\n victor = Proc.new { return \"Batman will win!\" }\n victor.call\n \"Iron Man will win!\"\nend", "def demonstrate_early_return\n return\n puts \"You will never see this, because we never get here.\"\nend", "def my_map(proc)\n return_array = []\n self.my_each do |item|\n return_array << proc.call(item)\n end\n return_array\n end" ]
[ "0.73771155", "0.72552615", "0.7227902", "0.72194076", "0.7163516", "0.69786584", "0.6923454", "0.6870602", "0.6864693", "0.6841951", "0.67418003", "0.64833295", "0.64774376", "0.643799", "0.6407039", "0.63979274", "0.63753575", "0.6331847", "0.6317847", "0.62996584", "0.6280324", "0.6210809", "0.6196171", "0.6189329", "0.61787987", "0.61775184", "0.6169772", "0.6149789", "0.61208785", "0.61111957", "0.6067003", "0.60623056", "0.605942", "0.6031193", "0.60186857", "0.601405", "0.5984522", "0.596881", "0.59586", "0.5955341", "0.59528196", "0.5938519", "0.59356403", "0.5934791", "0.59213483", "0.5902004", "0.5896733", "0.5888523", "0.5888218", "0.5884399", "0.58683026", "0.5868233", "0.5857184", "0.58392334", "0.5805095", "0.57842547", "0.57548386", "0.5753112", "0.5751979", "0.5749135", "0.5746497", "0.57399726", "0.5732444", "0.57278425", "0.56830615", "0.5668089", "0.56680673", "0.56350106", "0.5632083", "0.56276196", "0.5625314", "0.56250095", "0.5622942", "0.56177145", "0.56098723", "0.56021744", "0.55812633", "0.55766714", "0.55756354", "0.5574602", "0.5566798", "0.55666375", "0.5563976", "0.55563366", "0.5549748", "0.55352163", "0.5532905", "0.55247724", "0.55244803", "0.55221933", "0.55174965", "0.55128217", "0.55099523", "0.5507536", "0.54974765", "0.54939324", "0.54775536", "0.54653335", "0.54653335", "0.5462314", "0.5455581" ]
0.0
-1
=> 4 END /Users/joekelly/Desktop/Projects/rubykickstart/session3/notes/12allmethodstakeblocks.rb file content is listed below When you pass a block as a parameter, the block gets put into a special slot that every method has, whether they use the block or not.
def method "result" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def meth5(&block)\n p block_given?\nend", "def blocks; end", "def blocks; end", "def blocks; end", "def block_method\nputs \"called outside block in block_method\"\n#add method, to check if there is a block on this method\nyield if block_given? #predicate method, it have question mark on end\nputs \"now we are returning again to block\"\nend", "def method_that_takes_a_block(&blk)\n p blk.call(\"hello\")\n p blk.call(\"World!\")\nend", "def MyBlockMethod()\n puts \"At the top of the method\"\n\tyield\n\tputs \"At the bottom of the method\"\nend", "def blocks() end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def gimme_your_blocks\n yield if block_given?\nend", "def takes_block(arg)\n puts \"I got an argument! It's #{arg}!\"\n puts \"I'm still in the method!\"\n yield if block_given?\n puts \"More stuff!\"\n puts \"Even more stuff\"\nend", "def method\n puts block_given?\n if block_given?\n yield\n end\nend", "def test(&block)\n puts \"What's &block? #{block}\"\nend", "def test(&block)\n puts \"What's &block? #{block}\"\nend", "def were_we_given_a_block?\n\tif block_given?\n\t\t\"WE GOT A BLOCK\"\n\telse\n\t\t\"WE DIDN'T GET A BLOCK\"\n\tend\nend", "def require_block; end", "def i_take_an_explicit_block &block\n puts block.inspect\nend", "def block_method_3\n yield\nend", "def block_method_3\n yield\nend", "def block_method_3\n yield\nend", "def block_method_3\n yield\nend", "def block_method_3\n yield\nend", "def call_block\r\n puts \"Start of method\"\r\n yield\r\n yield\r\n puts \"End of method\"\r\nend", "def method &block\r\n\t1\r\nend", "def method &block\r\n\t1\r\nend", "def met(&block)\n puts \"This is method\"\n block.call\nend", "def method &block \r\n\t1\r\nend", "def runner(&blk); end", "def runner(&blk); end", "def run_block # this is a method that accepts a block and yields action to block once method is called (just like map or each)\n yield if block_given? # prevents error if no block is run with method invocation; only use this if you have a specific reason for it, otherwise, it's best to fail and fail early\nend", "def hello(&block)\n puts \"Hello #{block.call}\" if block_given?\nend", "def hello(&block)\n puts \"Hello #{block.call}\" if block_given?\nend", "def hug \n puts \"{\"\n yield if block_given?\n puts \"}\"\nend", "def hello_world(&block)\n puts block.call\nend", "def hello(&block)\n puts block\n block.call\nend", "def method a, &block, *c\r\n\t1\r\nend", "def method &block, a\r\n\t1\r\nend", "def test_methods_can_see_if_they_have_been_called_with_a_block\n assert_equal :with_block, yield_tester { :with_block }\n assert_equal :no_block, yield_tester\n end", "def method a, &block\r\n\t1\r\nend", "def test_blocks_can_take_arguments\n method_with_block_arguments do |argument|\n assert_equal 'Jim', argument\n end\n end", "def called_with_block?\n if block_given?\n p \"You called me with a block\"\n end\nend", "def block_method_1(animal) # method definition with yield to block (argument not passed to the block)\n yield\nend", "def block_method\n puts \"This is printing from the method.\"\n yield(\"Alice\", \"Bill\")\n yield(\"Dan\", \"Carlos\")\n yield\n puts \"This is printing from the method again.\"\nend", "def will_run_block\n # when you use yield, you'll call the block\n yield\n puts 'End'\nend", "def test(&block)\n puts \"&block is, #{block}\"\nend", "def call_block\n puts \"start\"\n yield \"foobar\" if block_given?\n puts \"end\"\nend", "def list_block()\n\nend", "def method a, *b, &block\r\n\t1\r\nend", "def block_checker\n block_given?\nend", "def i_take_a_block\n yield\nend", "def blockTest\n\tputs \"Method!\"\n\tputs \"Yield!\"\n\tyield\n\tputs \"Method!\"\nend", "def block_test\n puts \"we are in the method\"\n puts \"Yielding to the block\"\n yield\n puts \"We are back in the method\"\n\nend", "def block_method\n yield if block_given?\nend", "def call_block\n\tputs \"Start of method\"\n\tyield\n\tyield\n\tputs \"End of method\"\nend", "def block?; end", "def method3(&block)\n if block\n \"The block evaluates to #{block.call}\"\n else\n \"No block.\"\n end\nend", "def method3(&block)\n if block\n \"The block evaluates to #{block.call}\"\n else\n \"No block.\"\n end\nend", "def pre_block\n end", "def pre_block\n end", "def method_with_block_parameter &provided_block_proc\n puts provided_block_proc.class\n provided_block_proc.call(\"called from method\")\n yield \"called from method with yield\"\nend", "def block_test\r\n puts \"We're in the method!\"\r\n puts \"Yielding to the block...\"\r\n yield\r\n puts \"We're back in the method!\"\r\nend", "def block_method1\n yield\nend", "def block_test\n\n puts \"We're in the method!\"\n puts \"Yielding to the block...\"\n yield #this expression allows the method to receive and execute a block\n puts \"We're back in the method!\"\nend", "def method_missing(m,*args,&block)\r\n\t\tputs \"Not able to find the #{m} method\"\r\n\t\t\r\n\t\tfor i in args do\r\n\t\t\tputs(i)\r\n\t\tend\r\n\t\t\r\n\t\tputs \"Args count = #{args.length}\"\r\n\t\t\r\n\t\tif block_given?\r\n\t\t\t#if block cannot be multiline\r\n\t\t\tif (args.length < 1)\r\n\t\t\t\texec(&block)\r\n\t\t\telsif\r\n\t\t\t\texecwithparams(*args, &block)\r\n\t\t\tend\t\t\t\r\n\t\tend\t\t\r\n\tend", "def helper(*args, &block); end", "def block_test\n puts \"In method\"\n puts \"Yielding to block...\"\n yield\n puts \"back in the method!\"\nend", "def log block_description, &block\n puts $space*$nesting_depth + 'Beginning \"'+block_description+'\" ...'\n $nesting_depth = $nesting_depth + 2\n value_returned = block.call\n $nesting_depth = $nesting_depth - 2 \n puts $space*$nesting_depth + '... \"'+block_description+'\" finished, returning: ' + value_returned.to_s\nend", "def block_eg1(cutblock)\n puts \"this is the first message from 1 \"\n cutblock.call\n puts \"this is the middle message\"\n cutblock.call\n puts \"this is the last\\n\\n\"\nend", "def anonymous_blocklists; end", "def gimme\n if block_given?\n yield\n else\n puts \"I'm blockless!\"\n end\nend", "def summer\n yield # this represents a block of code.\nend", "def a_method(&block)\n block\nend", "def run(&block)\n end", "def test_block\n\tputs \"You are in the method\"\n\tyield\n\tputs \"You are again back to the method\"\n\tyield\nend", "def block_examples\n\n # calls each method on range ands passes it block\n # |i| is Ruby syntax for block variable\n # {} one way to indicate a clock\n (1..5).each { |i| puts 2 * i} # outputs 2 4 6 8 10\n\n # blocks can be more than one line using do..end syntax\n (1..5).each do |number|\n puts 2 * number\n puts '--'\n end\n\n # more block examples\n\n # 3.times takes a block with no variables\n 3.times { puts \"Betelgeuse!\" } # outputs \"Betelgeuse!\" three times\n\n # the map method returns the result of applying the given block to each element in the array or range\n # the ** notation is for 'power'\n (1..5).map { |i| i**2 } # => [1, 4, 9, 16, 25]\n\n # recall that %w makes string arrays\n %w[a b c] # => [\"a\", \"b\", \"c\"]\n %w[a b c].map { |char| char.upcase } # => [\"A\", \"B\", \"C\"]\n\n # array of alaphabet, shuffled then return first eight elements and join them\n ('a'..'z').to_a.shuffle[0..7].join # => \"mznpybuj\"\n end", "def if_block_given\n p \"hoge\"\n yield if block_given?\n p \"end\"\nend", "def block_test\n puts \"We're in the method!\"\n puts \"Yielding to the block...\"\n yield\n puts \"We're back in the method!\"\nend", "def block_test\n puts \"We're in the method!\"\n puts \"Yielding to the block...\"\n yield\n puts \"We're back in the method!\"\nend", "def block_test\n puts \"We're in the method!\"\n puts \"Yielding to the block...\"\n yield\n puts \"We're back in the method!\"\nend", "def block_test\n puts \"We're in the method!\"\n puts \"Yielding to the block...\"\n yield\n puts \"We're back in the method!\"\nend", "def block_test\n puts \"We're in the method!\"\n puts \"Yielding to the block...\"\n yield\n puts \"We're back in the method!\"\nend", "def block_test\n puts \"We're in the method!\"\n puts \"Yielding to the block...\"\n yield\n puts \"We're back in the method!\"\nend" ]
[ "0.71319723", "0.70815116", "0.70815116", "0.70815116", "0.6990421", "0.69389415", "0.67893296", "0.6710025", "0.66607285", "0.66607285", "0.66607285", "0.66607285", "0.66607285", "0.66607285", "0.66607285", "0.66607285", "0.66607285", "0.66607285", "0.66607285", "0.66607285", "0.66607285", "0.66607285", "0.66607285", "0.66607285", "0.66607285", "0.66607285", "0.66607285", "0.66607285", "0.6648053", "0.6562891", "0.6552167", "0.6536933", "0.6536933", "0.65367746", "0.6531246", "0.6527847", "0.6523781", "0.6523781", "0.6523781", "0.6523781", "0.6523781", "0.65059423", "0.6463541", "0.6463541", "0.6459462", "0.64496803", "0.6436168", "0.6436168", "0.64280313", "0.64258707", "0.64258707", "0.6402532", "0.63862705", "0.63860726", "0.63702667", "0.6363878", "0.6358939", "0.63559157", "0.6353252", "0.63504094", "0.6343969", "0.63438654", "0.6341787", "0.6334901", "0.63306594", "0.6327665", "0.63240516", "0.63073117", "0.6306063", "0.62949693", "0.6292286", "0.6283332", "0.627385", "0.62732977", "0.6240922", "0.6240922", "0.62396175", "0.62396175", "0.62261957", "0.62190956", "0.6210569", "0.6206688", "0.6198714", "0.61957353", "0.6192523", "0.619066", "0.61856306", "0.6172362", "0.61720353", "0.61638635", "0.6161047", "0.61605287", "0.615903", "0.6158519", "0.6156095", "0.614418", "0.614418", "0.614418", "0.614418", "0.614418", "0.614418" ]
0.0
-1
=> "result" To access the block, use the ampersand, this will give it to you as a proc that you can use.
def method2(&block) block.call.upcase end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_result(&block)\n result_from_block = block.call()\n puts result_from_block\nend", "def print_block_result\n block_result = yield\n puts block_result\nend", "def call_this_block\n # We pass in \"foo\" to yield so that the block gets passed an argument\n block_result = yield \"foo\" # Our block returns a value, which we store in block_result\n puts block_result # then we put our result to use and print it out\nend", "def procasaurus( &block )\n\tputs \"I am a procasaurus.\"\n\tputs block.class\n\t# note the proc must be the last parameter and must start with ampersand\nend", "def test(&block)\n puts \"&block is, #{block}\"\nend", "def get_block_value\r\n if block_given?\r\n value = yield\r\n pp \"The block returned #{value}\"\r\n end\r\nend", "def execute(&block)\n puts block.call\nend", "def block_to_proc(&p)\n\tp.call\nend", "def execute(&block)\n block\n #puts block #This shows the object I think.\nend", "def meth5\n p = lambda { return 99 } \n result = p.call \n \"The block returned #{result}\"\nend", "def result\n @result = yield\n end", "def return(&block); end", "def test(&block) # converts the argument to a \"simple\" Proc object\n puts \"What's &block? It's #{block}\" # can be called anything\nend", "def execute(&block)\n\tblock\nend", "def execute(&block)\n\tblock\nend", "def results(&block)\n section(:top => 1, :bottom => 0) do\n say \"RESULT:\"\n yield\n end\n end", "def meth\n res = yield \n \"The block returns #{res}\"\nend", "def hola &block\n puts block.class.name #esta linea nos dice que esto es un proc\n block.call\nend", "def block_caller\n result_of_block = yield 'passed from block_caller'\n return result_of_block\nend", "def be_proc(&block)\n block.call\n puts block.class\nend", "def execute(&block)\r\n block\r\nend", "def run_block\n p = Proc.new\n p.call\nend", "def say_hello(&block)\n puts \"Hello world\"\n name = block.call\n puts \"You entered #{name} as your name\"\nend", "def execute(&block)\n block\nend", "def execute(&block)\n block\nend", "def execute(&nameofblock)\n nameofblock.call\nend", "def my_method1(&the_proc) # Convert Block to Proc\n puts the_proc.call(\"Bill\") # Use as Proc, just drop \"&\" and you will receive the block\n puts yield(\"Bill\") # Use as Block\nend", "def run_proc_or_lambda(blockblock)\n puts \"station 1 of 3\"\n blockblock.call\n puts \"station 3 of 3\"\nend", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def process(&block); end", "def my_method(&my_block)\n\n puts \"hello method\"\n\n my_block.call\n\n return my_block\n\nend", "def greeting(&block)\n puts 'good morning'\n text = block.call('hello')\n puts text\n puts 'good evening'\nend", "def greeting(&block)\n puts 'good morning'\n text = block.call('hello')\n puts text\n puts 'good evening'\nend", "def run_block\n p = Proc.new # <1>\n p.call\nend", "def execute(block) # the syntax requires an & in the paramater name.\n \t block.call\n\tend", "def process(result)\n result\n end", "def log(block_description, &block)\n puts \"Beginning #{block_description}...\"\n value_returned = block.call\n puts \"...#{block_description} finished, returning\"\n puts value_returned\nend", "def perform(&block); end", "def execute(&block)\n block\nend", "def execute(&block)\n block\nend", "def execute(&block)\n block\nend", "def execute(&block)\n block\nend", "def execute(&block)\n block\nend", "def execute(&block)\n block\nend", "def execute(&block)\n block\nend", "def execute(&block)\n block\nend", "def execute(&block)\n block\nend", "def execute(&block)\n block\nend", "def execute(&block)\n block\nend", "def execute(&block)\n block\nend", "def execute(&block)\n block\nend", "def execute(&block)\n block\nend", "def execute(&block)\n block\nend", "def execute(&block)\n block\nend", "def execute(&block)\n block\nend", "def execute(&block)\n block\nend", "def my_method(&my_block)\n puts \"hello method\"\n my_block.call\n return my_block\nend", "def print_the_value_returned_by_the_block\n if block_given?\n value = yield\n puts \"The block returned #{value}\"\n end\nend", "def print_the_value_returned_by_the_block\n if block_given?\n value = yield\n puts \"The block returned #{value}\"\n end\nend", "def result()\n end", "def execute(&block)\n\tblock.call\nend", "def execute(&block)\n\tblock.call\nend", "def execute(&block)\n\tblock.call\nend", "def execute(&block)\n\tblock.call\nend", "def test(&block)\n puts \"What's &block? #{block}\"\nend", "def test(&block)\n puts \"What's &block? #{block}\"\nend", "def on_result(&block)\n @result_handler = block\n end", "def return_with_Proc\n f = Proc.new { return \"return inside block\" }\n f.call\n v = f.call\n return \"#{v}: return from method_end\" \nend", "def run_proc_or_lambda_2(blockblock)\n puts \"station 1 of 3\"\n blockblock.call\n puts \"station 3 of 3\"\nend", "def run_proc_or_lambda_2(blockblock)\n puts \"station 1 of 3\"\n blockblock.call\n puts \"station 3 of 3\"\nend", "def callBlock\n yield\n yield\nend", "def hello(&block)\n puts block\n block.call\nend", "def execute(&block)\n block.call\n puts \"End of block\"\nend", "def execute(&block)\n block # needs .call method here\nend", "def execute(&block)\n # block\n block.call\nend", "def i_take_an_explicit_block &block\n puts block.inspect\nend", "def execute_block_argument(number, &block)\n # procs can be stored in variables\n block_store = block\n # uses the call method to run the proc\n block_store.call number\nend", "def result; end", "def result; end", "def result; end", "def result; end", "def result; end" ]
[ "0.83746505", "0.7472951", "0.7466359", "0.7367184", "0.7209052", "0.71555483", "0.70872974", "0.7072907", "0.7070369", "0.6999323", "0.69947344", "0.69822556", "0.69794375", "0.6930716", "0.6930716", "0.69219875", "0.6890503", "0.68735236", "0.68534166", "0.6840207", "0.6812611", "0.68012786", "0.6793783", "0.67678523", "0.67678523", "0.6760367", "0.6754493", "0.6751115", "0.6743603", "0.6743603", "0.6743603", "0.6743603", "0.6743603", "0.6743603", "0.6743603", "0.6743603", "0.6743603", "0.6743603", "0.6743603", "0.6743603", "0.6743603", "0.6743603", "0.6743603", "0.6743603", "0.6743603", "0.6743603", "0.6743603", "0.6743603", "0.673061", "0.67247975", "0.6707521", "0.6707521", "0.6705264", "0.6673682", "0.66640466", "0.66608095", "0.66446984", "0.66440374", "0.66440374", "0.66440374", "0.66440374", "0.66440374", "0.66440374", "0.66440374", "0.66440374", "0.66440374", "0.66440374", "0.66440374", "0.66440374", "0.66440374", "0.66440374", "0.66440374", "0.66440374", "0.66440374", "0.66440374", "0.6639466", "0.6635686", "0.6635686", "0.660849", "0.6603998", "0.6603998", "0.6603998", "0.6603996", "0.6599274", "0.6599274", "0.65974295", "0.65750897", "0.657075", "0.657075", "0.6566358", "0.6559447", "0.655678", "0.6539734", "0.6533497", "0.6501121", "0.6501041", "0.6487977", "0.6487977", "0.6487977", "0.6487977", "0.6487977" ]
0.0
-1
=> "FROM THE BLOCK" If you didn't pass a block, it will be set to nil.
def method3(&block) if block "The block evaluates to #{block.call}" else "No block." end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def i_take_an_explicit_block &block\n puts block.inspect\nend", "def test(&block)\n puts \"&block is, #{block}\"\nend", "def say_hello(&block)\n puts \"Hello world\"\n name = block.call\n puts \"You entered #{name} as your name\"\nend", "def foo(name, &block)\n @name = name\n block.call\nend", "def block=(_arg0); end", "def block=(_arg0); end", "def block_name \n to_sym\n end", "def log(block_description, &block)\n puts \"Beginning #{block_description}...\"\n value_returned = block.call\n puts \"...#{block_description} finished, returning\"\n puts value_returned\nend", "def get_block_value\r\n if block_given?\r\n value = yield\r\n pp \"The block returned #{value}\"\r\n end\r\nend", "def call_this_block\n # We pass in \"foo\" to yield so that the block gets passed an argument\n block_result = yield \"foo\" # Our block returns a value, which we store in block_result\n puts block_result # then we put our result to use and print it out\nend", "def block_caller\n if block_given?\n result_of_block = yield\n return result_of_block\n else\n return 'no block'\n end\nend", "def greeting(&block)\n puts 'good morning'\n text = block.call('hello')\n puts text\n puts 'good evening'\nend", "def greeting(&block)\n puts 'good morning'\n text = block.call('hello')\n puts text\n puts 'good evening'\nend", "def hola &block\n puts block.class.name #esta linea nos dice que esto es un proc\n block.call\nend", "def print_the_value_returned_by_the_block\n if block_given?\n value = yield\n puts \"The block returned #{value}\"\n end\nend", "def print_the_value_returned_by_the_block\n if block_given?\n value = yield\n puts \"The block returned #{value}\"\n end\nend", "def print_result(&block)\n result_from_block = block.call()\n puts result_from_block\nend", "def call_block\n puts \"start\"\n yield \"foobar\" if block_given?\n puts \"end\"\nend", "def baz(name, &block)\n @name = name\n block.call\nend", "def block_name \n :CodeBlock \n end", "def block_name \n :CodeBlock \n end", "def block_message_printer\n message = \"Welcome to Block Message Printer\"\n if block_given?\n yield\n end\n puts \"But in this function/method message is :: #{message}\"\nend", "def were_we_given_a_block?\n\tif block_given?\n\t\t\"WE GOT A BLOCK\"\n\telse\n\t\t\"WE DIDN'T GET A BLOCK\"\n\tend\nend", "def hello(&block)\n puts block\n block.call\nend", "def log(blockDescription, &block)\n\tp \"Beginning \" + blockDescription + \"...\"\n\tp blockDescription + \" finished, returning: \" + (block.call).to_s\nend", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def display_proc(&block)\n #defined by default_for_proc_type in initialize!\n end", "def log description, &block\n puts 'Beginning: \"' + description.to_s + '\"...'\n\n value = block.call\n puts '...\"' + description + '\" finished, returning: '\n puts value.to_s\nend", "def captured_by_block?; end", "def process_dummy(exp)\n process_block(exp).chomp\n end", "def program_logger(block_description, &block)\n\n puts \"Started block #{block_description}.\"\n result = block.call\n puts \"#{block_description} finished, returning: #{result}\"\n\nend", "def execute(&nameofblock)\n nameofblock.call\nend", "def do_something_with_params_line\n if block_given?\n value = yield\n puts value\n end\nend", "def called_with_block?\n if block_given?\n p \"You called me with a block\"\n end\nend", "def greeting\n name = (yield if block_given?) || \"Stranger\"\n puts \"Hello! #{name}\"\nend", "def block_message_printer\n message = \"Welcome to Block Message Printer\"\n if block_given?\n proc.call\n end\n puts \"But in this function/method message is :: #{message}\"\n end", "def method_that_takes_a_block(&blk)\n p blk.call(\"hello\")\n p blk.call(\"World!\")\nend", "def captured_by_block; end", "def test(&block)\n puts \"What's &block? #{block}\"\nend", "def test(&block)\n puts \"What's &block? #{block}\"\nend", "def print_block_result\n block_result = yield\n puts block_result\nend", "def block?; end", "def block_node; end", "def block_node; end", "def profile blockDescription, &block\n startTime = Time.now\n\n block.call\n \n duration = Time.now - startTime\n\n puts blockDescription + ': '+duration.to_s+' seconds'\n\nend", "def puts_this_block\n puts yield\nend", "def execute(&block)\n block\n #puts block #This shows the object I think.\nend", "def get_name(prompt, &block)\n if block_given?\n print prompt + \": \"\n name = gets.chomp\n print \"Age: \"\n age = gets.chomp\n yield name, age\n name #if name is returned on last line, then you can use this variable in line #13\n else\n puts \"No block given.\"\n end\nend", "def log block_description, &block\n puts $space*$nesting_depth + 'Beginning \"'+block_description+'\" ...'\n $nesting_depth = $nesting_depth + 2\n value_returned = block.call\n $nesting_depth = $nesting_depth - 2 \n puts $space*$nesting_depth + '... \"'+block_description+'\" finished, returning: ' + value_returned.to_s\nend", "def sup_bro\n puts \"This is before a block!\"\n name = \"Katy\"\n yield(name)\n puts \"This is after a block!\"\nend", "def extract_block_arg\n if args.last.is_a?(Sexp) and args.last.type == :block_pass\n block_arg = args.pop\n block_arg = block_arg[1][1].to_sym\n end\n end", "def hello(&block)\n puts \"Hello #{block.call}\" if block_given?\nend", "def hello(&block)\n puts \"Hello #{block.call}\" if block_given?\nend", "def call_block\n yield('hello', 99)\nend", "def call_block\n yield('hello', 99)\nend", "def call_block\n yield('hello', 99)\nend", "def call_this_block\n yield \"tweet\"\nend", "def call_this_block\n yield \"tweet\"\nend", "def showInfo(&block)\n block\nend", "def block_node=(_); end", "def call_block \n yield('hello', 99) \nend", "def call_block \n yield('hello', 99) \nend", "def compare(str, &block)\n puts \"Before: #{str}\"\n\n block_result = block.call(str)\n puts \"After: #{block_result}\"\nend", "def print_my_name(&blk)\n # It's possible to pass args to a block! The args can then be used when\n # invoking the method\n blk.call('ronan', 'duddy')\nend", "def take_block(p1)\n if block_given?\n yield(p1)\n else\n puts p1\n end\nend", "def block_method_name(node)\n case node.type\n when :block\n node.method_name\n when :block_pass\n node.parent.method_name\n end\n end", "def log descript, &block\n puts \"Starting \\\"#{descript}\\\"...\"\n result = block.call\n puts \"...ended the #{descript.inspect}. Returning: #{result}\"\nend", "def refer_to_foo\r\n puts foo # unlike block, method cannot access its context\r\nend", "def log description, &block\n puts \"Start of #{description}\"\n result = block.call\n puts \"End of #{description}, returning: #{result}\"\nend", "def time description = '', &block\n start = Time.now\n yield\n puts \"execution time of #{description.empty? ? block.to_s : description}: #{Time.now - start}\"\nend", "def call_block(&block)\n block.call\nend", "def do_sth_with_arg_and_return\n value = yield \"Yielding a string\" if block_given?\n p value\nend", "def method &block\r\n\t1\r\nend", "def method &block\r\n\t1\r\nend", "def call_explicit_block(&block)\n # block.call another wat of saying yield\n return \"There's no block\" unless block_given?\n yield\n # block.call\nend", "def profile(description_of_block, &block)\n start_time = Time.now \n block.call \n duration = Time.now - start_time\n puts description_of_block+': '+duration.to_s+' seconds'\nend", "def foo(&block)\n a = 2\n block.call(a)\nend", "def block_caller\n result_of_block = yield 'passed from block_caller'\n return result_of_block\nend", "def block_eg1(cutblock)\n puts \"this is the first message from 1 \"\n cutblock.call\n puts \"this is the middle message\"\n cutblock.call\n puts \"this is the last\\n\\n\"\nend", "def capture_str\r\n capture_block { yield }.string\r\n end" ]
[ "0.7019481", "0.67750156", "0.6581044", "0.65415", "0.6520881", "0.6520881", "0.6465057", "0.64577085", "0.642351", "0.64012444", "0.63811153", "0.6380705", "0.6380705", "0.6369575", "0.63544786", "0.63544786", "0.6345151", "0.6335273", "0.6327338", "0.6309016", "0.6309016", "0.629876", "0.626795", "0.6249229", "0.6248493", "0.62436485", "0.62436485", "0.62436485", "0.62436485", "0.62436485", "0.62436485", "0.62436485", "0.62436485", "0.62436485", "0.62436485", "0.62436485", "0.62436485", "0.62436485", "0.62436485", "0.62436485", "0.62436485", "0.62436485", "0.62436485", "0.62436485", "0.62436485", "0.6242265", "0.622781", "0.6222975", "0.6215159", "0.62126327", "0.6202848", "0.61840147", "0.61836356", "0.61800593", "0.6175175", "0.6139381", "0.6134485", "0.6134366", "0.6134366", "0.61342317", "0.612948", "0.6124251", "0.6124251", "0.6119735", "0.6111826", "0.6106163", "0.6093273", "0.60845435", "0.6083616", "0.6080065", "0.6078349", "0.6078349", "0.60751456", "0.60751456", "0.60751456", "0.60717463", "0.60717463", "0.60645056", "0.60614824", "0.6054607", "0.6054607", "0.60545325", "0.60502934", "0.6045857", "0.60446775", "0.6041865", "0.6038118", "0.60325783", "0.60258955", "0.602432", "0.6021322", "0.6020483", "0.6020483", "0.60135406", "0.6008891", "0.59839326", "0.5954546", "0.59453654", "0.5945344" ]
0.6354309
17
=> "No block." Like with any proc, you can pass arguments to it
def heres_six(&block) block.call 6 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def block=(_arg0); end", "def block=(_arg0); end", "def i_take_an_explicit_block &block\n puts block.inspect\nend", "def procasaurus( &block )\n\tputs \"I am a procasaurus.\"\n\tputs block.class\n\t# note the proc must be the last parameter and must start with ampersand\nend", "def run_block\n p = Proc.new # <1>\n p.call\nend", "def block?; end", "def hola &block\n puts block.class.name #esta linea nos dice que esto es un proc\n block.call\nend", "def run_block_3\n p = Proc.new # if new proc is not passed a code block, it looks to see if the current scope has been passed a code block and use that\n p.call # if current scope has not been passed a code block, there will be an error\nend", "def method_that_takes_a_block(&blk)\n p blk.call(\"hello\")\n p blk.call(\"World!\")\nend", "def test(&block) # converts the argument to a \"simple\" Proc object\n puts \"What's &block? It's #{block}\" # can be called anything\nend", "def call_explicit_block(&block)\n # block.call another wat of saying yield\n return \"There's no block\" unless block_given?\n yield\n # block.call\nend", "def call_block\n puts \"start\"\n yield \"foobar\" if block_given?\n puts \"end\"\nend", "def hello(&block)\n puts \"Hello #{block.call}\" if block_given?\nend", "def hello(&block)\n puts \"Hello #{block.call}\" if block_given?\nend", "def run_block\n p = Proc.new\n p.call\nend", "def execute_block_argument(number, &block)\n # procs can be stored in variables\n block_store = block\n # uses the call method to run the proc\n block_store.call number\nend", "def foo\n if block_given?\n # Call the block\n yield\n else\n puts \"Sem parâmetro do tipo bloco\"\n end\nend", "def call_block(block,stdout,stderr,exitstatus)\n # blocks that take no arguments have arity -1. Or 0. Ugh.\n if block.arity > 0\n case block.arity\n when 1 \n block.call(stdout)\n when 2\n block.call(stdout,stderr)\n else\n # Let it fail for lambdas\n block.call(stdout,stderr,exitstatus)\n end\n else\n block.call\n end\n end", "def call_a_proc(&block)\n block.call\nend", "def call_block \n yield('hello', 99) \nend", "def call_block \n yield('hello', 99) \nend", "def do_something_with_an_arg\n yield(\"Hello world 3\") if block_given?\nend", "def call_block\n yield('hello', 99)\nend", "def call_block\n yield('hello', 99)\nend", "def call_block\n yield('hello', 99)\nend", "def display_proc(&block)\n #defined by default_for_proc_type in initialize!\n end", "def execute(&block)\n puts block.call\nend", "def hello(&block)\n puts block\n block.call\nend", "def called_with_block?\n if block_given?\n p \"You called me with a block\"\n end\nend", "def execute(&block)\n\tblock\nend", "def execute(&block)\n\tblock\nend", "def ejecutar2(&bloque)\r\n if block_given?\r\n bloque.call #same as yield\r\n else\r\n puts 'No tiene bloque asignado'\r\n end\r\nend", "def block_message_printer\n message = \"Welcome to Block Message Printer\"\n if block_given?\n proc.call\n end\n puts \"But in this function/method message is :: #{message}\"\n end", "def execute(&block)\n block.call\n puts \"End of block\"\nend", "def optional_args_block_call(block, args)\n if RUBY_VERSION >= \"1.9.0\"\n if block.arity == 0\n block.call\n else\n block.call(*args)\n end\n else\n block.call(*args)\n end\n end", "def run_proc_or_lambda(blockblock)\n puts \"station 1 of 3\"\n blockblock.call\n puts \"station 3 of 3\"\nend", "def test(&block)\n puts \"&block is, #{block}\"\nend", "def execute(block) # the syntax requires an & in the paramater name.\n \t block.call\n\tend", "def fred(param)\n proc {}\nend", "def block_to_proc(&p)\n\tp.call\nend", "def foo(arg)\n puts 'in foo'\n if block_given?\n puts 'block provided, executing it now'\n yield(arg)\n else\n puts 'no block provided, nothing to execute'\n end\nend", "def be_proc(&block)\n block.call\n puts block.class\nend", "def execute(&block)\n block\nend", "def execute(&block)\n block\nend", "def parse_block(*_arg0); end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def optional\n puts 'A code block isn\\'t required, but it\\'s nice.'\n yield if block_given? #Kernel#block_given?\n puts 'I\\'m happy either way, really.'\nend", "def execute(&block)\r\n block\r\nend", "def execute(&nameofblock)\n nameofblock.call\nend", "def greeting(&block)\n puts 'good morning'\n text = block.call('hello')\n puts text\n puts 'good evening'\nend", "def greeting(&block)\n puts 'good morning'\n text = block.call('hello')\n puts text\n puts 'good evening'\nend", "def method &block \r\n\t1\r\nend", "def consume_simple_block(input = T.unsafe(nil)); end", "def blockFun2(arg1, &aBlock)\n if aBlock\n aBlock.call(arg1)\n \"HAVE BLOCK\"\n else\n \"NO BLOCK\"\n end\nend", "def method &block\r\n\t1\r\nend", "def method &block\r\n\t1\r\nend", "def block_checker(param) \n [ param , block_given? ]\nend", "def process(&block); end", "def say_hello(&block)\n puts \"Hello world\"\n name = block.call\n puts \"You entered #{name} as your name\"\nend", "def call_block(&block)\n block.call\nend", "def run(&block)\n end", "def method3(&block)\n if block\n \"The block evaluates to #{block.call}\"\n else\n \"No block.\"\n end\nend", "def method3(&block)\n if block\n \"The block evaluates to #{block.call}\"\n else\n \"No block.\"\n end\nend", "def procedural(name=\"\", &block)\n SyncBlock.new( name, &block )\n end", "def not &blk\n @negative = !@negative\n if blk\n @block = blk\n execute_block\n end\n end", "def execute(&block)\n # block\n block.call\nend", "def execute(&block)\n block\nend", "def execute(&block)\n block\nend", "def execute(&block)\n block\nend", "def execute(&block)\n block\nend", "def execute(&block)\n block\nend", "def execute(&block)\n block\nend", "def execute(&block)\n block\nend", "def execute(&block)\n block\nend", "def execute(&block)\n block\nend", "def execute(&block)\n block\nend", "def execute(&block)\n block\nend", "def execute(&block)\n block\nend", "def execute(&block)\n block\nend", "def execute(&block)\n block\nend", "def execute(&block)\n block\nend", "def execute(&block)\n block\nend" ]
[ "0.72313964", "0.72313964", "0.7140519", "0.70442486", "0.70355284", "0.69677824", "0.69375116", "0.6933717", "0.69218796", "0.6908883", "0.69050735", "0.68803877", "0.68542194", "0.68542194", "0.68109304", "0.6784242", "0.6777631", "0.6760261", "0.67583543", "0.6757766", "0.6757766", "0.6753545", "0.673288", "0.673288", "0.673288", "0.6715955", "0.6706102", "0.67060167", "0.6699107", "0.66977394", "0.66977394", "0.66953355", "0.6693317", "0.6685933", "0.6684993", "0.66840327", "0.6683329", "0.6675716", "0.66579664", "0.6656221", "0.66524196", "0.6651155", "0.6649994", "0.6649994", "0.6647088", "0.6635114", "0.6635114", "0.6635114", "0.6635114", "0.6635114", "0.6635114", "0.6635114", "0.6635114", "0.6635114", "0.6635114", "0.6635114", "0.6635114", "0.6635114", "0.6635114", "0.6635114", "0.6635114", "0.6635114", "0.6635114", "0.6635114", "0.6635114", "0.6634348", "0.66315293", "0.66187495", "0.6605669", "0.6605669", "0.6583507", "0.6582938", "0.657518", "0.6573564", "0.6573564", "0.65660334", "0.656601", "0.6565691", "0.6561794", "0.6547546", "0.65390503", "0.65390503", "0.6528596", "0.6522868", "0.65190685", "0.65106004", "0.65106004", "0.65106004", "0.65106004", "0.65106004", "0.65106004", "0.65106004", "0.65106004", "0.65106004", "0.65106004", "0.65106004", "0.65106004", "0.65106004", "0.65106004", "0.65106004", "0.65106004" ]
0.0
-1
=> "12 is Josh's favourite number" END /Users/joekelly/Desktop/Projects/rubykickstart/session3/notes/13differencebetweenblocksyntaxes.rb file content is listed below
def block_checker(array, &block) [array.to_a, !!block] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def charm_failure\n slowly do\n\"\"\"\nDuncan barks, wags his tail, rolls over, does all his awesome tricks...\n\nBut the troll just looks on in disdain. \n\n'Go home, little dog, before I sqquish you.' \n\"\"\"\n end\n what_next\n end", "def extract_code_blocks\n body.match /```([a-z]+)?\\n(.*)\\n```/\n end", "def parse_codeblock_fenced; end", "def parse_block_math; end", "def pygment_code_block(block)\n write_data block, 'code.rb', false\n system 'pygmentize -o block.html code.rb'\n File.open('block.html', 'r').read\n end", "def parse_codeblock; end", "def read_block_text(name, containers, contents)\n i = -1\n in_block = false\n block_indentation = nil\n block_end_token = nil\n chunk = nil\n contents.each_line do |line|\n if line =~ /^(\\s*)#{name}\\s*.*?(({|do|->\\s*{|lambda\\s*{)(.*))/\n block_indentation, text = $1, $2\n i += 1\n chunk = containers[i].code_chunk\n chunk.text = text + \"\\n\"\n in_block = true\n block_end_token = case text\n when /^{/\n \"}\"\n when /^do\\b/\n \"end\"\n when /^(->|lambda)\\s*({|do)/\n $2 == \"{\" ? \"}\" : \"end\"\n else\n \"}|end\" # regex\n end\n elsif in_block\n line =~ /^(\\s*)(.*)/\n indentation, text = $1, $2\n if indentation.length <= block_indentation.length\n if text =~ /^#{block_end_token}/\n chunk.text << line\n end\n in_block = false\n else\n chunk.text << line\n end\n end\n end\n containers.each do |thing|\n text = thing.code_chunk.text\n text.strip! if text\n end\n end", "def lines_of_code; end", "def lines_of_code; end", "def poem &block\n annotate block do |c|\n c.split(\"\\n\").join(\" \\n\")\n end\nend", "def next_statement\n statement, block, comments = TokenList.new, nil, nil\n stmt_number, level = 0, 0\n new_statement, open_block = true, false\n last_tk, last_ns_tk, before_last_tk = nil, nil, nil\n open_parens = 0\n\n while tk = @tokens.shift\n #p tk.class\n # !!!!!!!!!!!!!!!!!!!! REMOVED TkfLPAREN, TkfLBRACK\n open_parens += 1 if [TkLPAREN, TkLBRACK].include? tk.class\n open_parens -= 1 if [TkRPAREN, TkRBRACK].include?(tk.class) \n \n #if open_parens < 0 || level < 0\n # STDERR.puts block.to_s + \" TOKEN #{tk.inspect}\"\n # exit\n #end\n\n # Get the initial comments\n if statement.empty?\n # Two new-lines in a row will destroy any comment blocks\n if [TkCOMMENT].include?(tk.class) && last_tk.class == TkNL && \n (before_last_tk && (before_last_tk.class == TkNL || before_last_tk.class == TkSPACE))\n comments = nil\n elsif tk.class == TkCOMMENT\n # Remove the \"#\" and up to 1 space before the text\n # Since, of course, the convention is to have \"# text\"\n # and not \"#text\", which I deem ugly (you heard it here first)\n comments ||= []\n comments << tk.text.gsub(/^#+\\s{0,1}/, '') \n comments.pop if comments.size == 1 && comments.first =~ /^\\s*$/\n end\n end\n \n # Ignore any initial comments or whitespace\n unless statement.empty? && [TkSPACE, TkNL, TkCOMMENT].include?(tk.class)\n # Decrease if end or '}' is seen\n level -= 1 if [TkEND, TkRBRACE].include?(tk.class)\n \n # If the level is greater than 0, add the code to the block text\n # otherwise it's part of the statement text\n if stmt_number > 0\n #puts \"Block of #{statement}\"\n #puts \"#{stmt_number} #{tk.line_no} #{level} #{open_parens} #{tk.class.class_name} \\t#{tk.text.inspect} #{tk.lex_state} #{open_block.inspect}\" \n block ||= TokenList.new\n block << tk\n elsif stmt_number == 0 && tk.class != TkNL && tk.class != TkSEMICOLON && tk.class != TkCOMMENT\n statement << tk \n end\n\n #puts \"#{tk.line_no} #{level} #{open_parens} #{tk.class.class_name} \\t#{tk.text.inspect} #{tk.lex_state} #{open_block.inspect}\" \n\n # Increase level if we have a 'do' or block opening\n if tk.class == TkLBRACE #|| tk.class == TkfLBRACE\n level += 1 \n elsif [TkDO, TkBEGIN].include?(tk.class) \n #p \"#{tk.line_no} #{level} #{tk} \\t#{tk.text} #{tk.lex_state}\" \n level += 1 \n open_block = false # Cancel our wish to open a block for the if, we're doing it now\n end\n\n # Vouch to open a block when this statement would otherwise end\n open_block = [level, tk.class] if (new_statement || \n (last_tk && last_tk.lex_state == EXPR_BEG)) && \n OPEN_BLOCK_TOKENS.include?(tk.class)\n\n # Check if this token creates a new statement or not\n #puts \"#{open_parens} open brackets for: #{statement.to_s}\"\n if open_parens == 0 && ((last_tk && [TkSEMICOLON, TkNL, TkEND_OF_SCRIPT].include?(tk.class)) ||\n (open_block && open_block.last == TkDEF && tk.class == TkRPAREN))\n \n # Make sure we don't have any running expressions\n # This includes things like\n #\n # class <\n # Foo\n # \n # if a ||\n # b\n if (last_tk && [EXPR_END, EXPR_ARG].include?(last_tk.lex_state)) || \n (open_block && [TkNL, TkSEMICOLON].include?(tk.class) && last_ns_tk.class != open_block.last)\n stmt_number += 1\n new_statement = true\n #p \"NEW STATEMENT #{block.to_s}\"\n\n # The statement started with a if/while/begin, so we must go to the next level now\n if open_block && open_block.first == level\n if tk.class == TkNL && block.nil?\n block = TokenList.new\n block << tk\n end\n\n open_block = false\n level += 1\n end\n end\n elsif tk.class != TkSPACE\n new_statement = false \n end\n\n # Else keyword is kind of weird\n if tk.is_a? TkELSE\n new_statement = true\n stmt_number += 1\n open_block = false\n end\n\n # We're done if we've ended a statement and we're at level 0\n break if new_statement && level == 0\n \n #raise \"Unexpected end\" if level < 0\n end\n \n #break if new_statement && level == 0\n\n before_last_tk = last_tk\n last_tk = tk # Save last token\n last_ns_tk = tk unless [TkSPACE, TkNL, TkEND_OF_SCRIPT].include? tk.class\n end\n\n # Return the code block with starting token and initial comments\n # If there is no code in the block, return nil\n comments = comments.compact if comments\n statement.empty? ? nil : Statement.new(statement, block, comments)\n end", "def section_seperator\n puts <<EOF\n\n\n\n=========================\n=========================\nEOF\nend", "def usage_end\n '}'\n end", "def parse_block_extensions; end", "def parse_codeblocks(html); end", "def cheese_and_crackers(cheese_count, boxes_of_crackers)\n#returns You have </cheese count> cheeses!\n puts \"You have #{cheese_count} cheeses!\"\n #returns You have </cracker count> boxes of crackers!\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n #returns next two lines the same, regardless of function data\n puts \"Man that's enough for a party!\"\n puts \"get a blanket.\\n\"\nend", "def main\r\n call_block {|str, num| puts str + ' ' + num.to_s}\r\n end", "def segment(source_code) # rubocop:disable all\n sections, docs, code = [], [], []\n lines = source_code.split(\"\\n\")\n\n # The first line is ignored if it is a shebang line. We also ignore the\n # PEP 263 encoding information in python sourcefiles, and the similar ruby\n # 1.9 syntax.\n lines.shift if lines[0] =~ /^\\#\\!/\n lines.shift if lines[0] =~ /coding[:=]\\s*[-\\w.]+/ &&\n %w(python rb).include?(@options[:language])\n\n # To detect both block comments and single-line comments, we'll set\n # up a tiny state machine, and loop through each line of the file.\n # This requires an `in_comment_block` boolean, and a few regular\n # expressions for line tests. We'll do the same for fake heredoc parsing.\n in_comment_block = false\n in_heredoc = false\n single_line_comment, block_comment_start, block_comment_mid, block_comment_end =\n nil, nil, nil, nil\n unless @options[:comment_chars][:single].nil?\n single_line_comment = Regexp.new(\"^\\\\s*#{Regexp.escape(@options[:comment_chars][:single])}\\\\s?\")\n end\n unless @options[:comment_chars][:multi].nil?\n block_comment_start = Regexp.new(\"^\\\\s*#{Regexp.escape(@options[:comment_chars][:multi][:start])}\\\\s*$\")\n block_comment_end = Regexp.new(\"^\\\\s*#{Regexp.escape(@options[:comment_chars][:multi][:end])}\\\\s*$\")\n block_comment_one_liner = Regexp.new(\"^\\\\s*#{Regexp.escape(@options[:comment_chars][:multi][:start])}\\\\s*(.*?)\\\\s*#{Regexp.escape(@options[:comment_chars][:multi][:end])}\\\\s*$\") # rubocop:disable Metrics/LineLength\n block_comment_start_with = Regexp.new(\"^\\\\s*#{Regexp.escape(@options[:comment_chars][:multi][:start])}\\\\s*(.*?)$\")\n block_comment_end_with = Regexp.new(\"\\\\s*(.*?)\\\\s*#{Regexp.escape(@options[:comment_chars][:multi][:end])}\\\\s*$\")\n if @options[:comment_chars][:multi][:middle]\n block_comment_mid = Regexp.new(\"^\\\\s*#{Regexp.escape(@options[:comment_chars][:multi][:middle])}\\\\s?\")\n end\n end\n unless @options[:comment_chars][:heredoc].nil?\n heredoc_start = Regexp.new(\"#{Regexp.escape(@options[:comment_chars][:heredoc])}(\\\\S+)$\")\n end\n lines.each do |line|\n # If we're currently in a comment block, check whether the line matches\n # the _end_ of a comment block or the _end_ of a comment block with a\n # comment.\n if in_comment_block\n if block_comment_end && line.match(block_comment_end)\n in_comment_block = false\n elsif block_comment_end_with && line.match(block_comment_end_with)\n in_comment_block = false\n docs << line.match(block_comment_end_with).captures.first\n .sub(block_comment_mid || '', '')\n else\n docs << line.sub(block_comment_mid || '', '')\n end\n # If we're currently in a heredoc, we're looking for the end of the\n # heredoc, and everything it contains is code.\n elsif in_heredoc\n if line.match(Regexp.new(\"^#{Regexp.escape(in_heredoc)}$\"))\n in_heredoc = false\n end\n code << line\n # Otherwise, check whether the line starts a heredoc. If so, note the end\n # pattern, and the line is code. Otherwise check whether the line matches\n # the beginning of a block, or a single-line comment all on it's lonesome.\n # In either case, if there's code, start a new section.\n else\n if heredoc_start && line.match(heredoc_start)\n in_heredoc = Regexp.last_match[1]\n code << line\n elsif block_comment_one_liner && line.match(block_comment_one_liner)\n if code.any?\n sections << [docs, code]\n docs, code = [], []\n end\n docs << line.match(block_comment_one_liner).captures.first\n elsif block_comment_start && line.match(block_comment_start)\n in_comment_block = true\n if code.any?\n sections << [docs, code]\n docs, code = [], []\n end\n elsif block_comment_start_with && line.match(block_comment_start_with)\n in_comment_block = true\n if code.any?\n sections << [docs, code]\n docs, code = [], []\n end\n docs << line.match(block_comment_start_with).captures.first\n elsif single_line_comment && line.match(single_line_comment)\n if code.any?\n sections << [docs, code]\n docs, code = [], []\n end\n docs << line.sub(single_line_comment || '', '')\n else\n code << line\n end\n end\n end\n sections << [docs, code] if docs.any? || code.any?\n normalize_leading_spaces(sections)\n end", "def accept_block_quote block_quote\n tt_sections block_quote.text\n end", "def method # test comment\n# ^^^ meta.function.method.without-arguments.ruby keyword.control.def.ruby\n# ^^^^^^ meta.function.method.without-arguments.ruby entity.name.function.ruby\n# ^ comment.line.number-sign.ruby punctuation.definition.comment.ruby\n# ^^^^^^^^^^^^^ comment.line.number-sign.ruby\n hello, world = [1,2]\n# ^^^^^ variable.other.ruby\n# ^ punctuation.separator.object.ruby\n# ^^^^^ variable.other.ruby\n# ^ keyword.operator.assignment.ruby\n# ^ punctuation.section.array.begin.ruby\n# ^ constant.numeric.ruby\n# ^ punctuation.separator.object.ruby\n# ^ constant.numeric.ruby\n# ^ punctuation.section.array.end.ruby\n end", "def test_it_can_parse_two_lines\n skip\n chisel = Chisel.new\n text = \"# My Life in Desserts\n## Chapter 1: The Beginning\"\n assert_equal \"<h1>My Life in Desserts</h1>\n <h2>Chapter 1: The Beginning</h2>\", chisel.parse(text)\n end", "def cheese_and_crackers(cheese_count, boxes_of_crackers)\n# prints the string below with the variable cheese_count interpolated into it\n puts \"You have #{cheese_count} cheeses!\"\n# prints the string below with the variable boxes_of_crackers interpolated into\n# it\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n# prints the string below\n puts \"Man that's enough for a party!\"\n# prints the string below with a new line at the end\n puts \"Get a blanket.\\n\"\n# ends the method\nend", "def browser_block\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 26 )\n return_value = BrowserBlockReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n char_literal102 = nil\n string_literal105 = nil\n browser_name103 = nil\n statement_block104 = nil\n block106 = nil\n\n tree_for_char_literal102 = nil\n tree_for_string_literal105 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 417:5: '!' browser_name statement_block ( 'else' block )?\n char_literal102 = match( NOT, TOKENS_FOLLOWING_NOT_IN_browser_block_2757 )\n if @state.backtracking == 0\n\n tree_for_char_literal102 = @adaptor.create_with_payload( char_literal102 )\n @adaptor.add_child( root_0, tree_for_char_literal102 )\n\n end\n @state.following.push( TOKENS_FOLLOWING_browser_name_IN_browser_block_2759 )\n browser_name103 = browser_name\n @state.following.pop\n if @state.backtracking == 0\n root_0 = @adaptor.become_root( browser_name103.tree, root_0 )\n end\n @state.following.push( TOKENS_FOLLOWING_statement_block_IN_browser_block_2762 )\n statement_block104 = statement_block\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, statement_block104.tree )\n end\n # at line 417:39: ( 'else' block )?\n alt_20 = 2\n look_20_0 = @input.peek( 1 )\n\n if ( look_20_0 == ELSE )\n alt_20 = 1\n end\n case alt_20\n when 1\n # at line 417:41: 'else' block\n string_literal105 = match( ELSE, TOKENS_FOLLOWING_ELSE_IN_browser_block_2766 )\n @state.following.push( TOKENS_FOLLOWING_block_IN_browser_block_2769 )\n block106 = block\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, block106.tree )\n end\n\n end\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 26 )\n\n end\n \n return return_value\n end", "def cheese_and_crackers(cheese_count, boxes_of_crackers)\n#prints text with cheese_count parameter value inserted in string.\n puts \"You have #{cheese_count} cheeses!\"\n#prints text with boxes_of_crackers value inserted in string.\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n#prints text in string\n puts \"Man that's enough for a party!\"\n#prints string and makes a new line\n puts \"Get a blanket.\\n\"\n# end completes the method block\nend", "def cheese_and_crackers(cheese_count, boxes_of_crackers)\n#Here, we are building the code into our method using strings/string interpolation\n puts \"You have #{cheese_count} cheeses!\"\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n puts \"Man that's enough for a party!\"\n puts \"Get a blanket.\\n\"\n#every 'def' has to have a corresponding 'end'\nend", "def parse_lang_for_codeblock(source); end", "def _extract_block(block)\n src_file_path = block.source_location[0]\n block_start_line_number = block.source_location[1]\n\n src_file_content = File.open(src_file_path).read\n lines_after_block_start = src_file_content.split(\"\\n\")[block_start_line_number..-1]\n\n # block already starts with one \"do\"\n do_counter = 1\n # assuming that \"do themize\" and corresponding \"end\" placed on separate lines\n block_end_index = 1\n lines_after_block_start.each_with_index do |line, i|\n # http://stackoverflow.com/a/11899069/6376451\n do_counter += line.scan(/<%.*?do.*?%>/).size\n do_counter -= line.scan(/<%.*?end.*?%>/).size\n if line =~ /\\s*<%\\s*end\\s*%>/ && do_counter == 0\n block_end_index = i\n break\n end\n end\n return nil if block_end_index == 0\n\n lines_after_block_start[0..block_end_index-1].join(\"\\n\")\n end", "def read_block_text(name, containers, contents)\n i = -1\n in_block = false\n block_indentation = nil\n block_end_token = nil\n contents.each_line do |line|\n if line =~ /^(\\s*)#{name}\\s*.*?(({|do|->\\s*{|lambda\\s*{)(.*))/\n block_indentation, text = $1, $2\n i += 1\n containers[i].text = text + \"\\n\"\n in_block = true\n block_end_token = case text\n when /^{/\n \"}\"\n when /^do\\b/\n \"end\"\n when /^(->|lambda)\\s*({|do)/\n $2 == \"{\" ? \"}\" : \"end\"\n else\n \"}|end\" # regex\n end\n elsif in_block\n line =~ /^(\\s*)(.*)/\n indentation, text = $1, $2\n if indentation.length <= block_indentation.length\n if text =~ /^#{block_end_token}/\n containers[i].text << line\n end\n in_block = false\n else\n containers[i].text << line\n end\n end\n end\n containers.each { |thing| thing.text.strip! if thing.text }\n end", "def parse(data)\n sections, docs, code = [], [], []\n lines = data.split(\"\\n\")\n\n # The first line is ignored if it is a shebang line. We also ignore the\n # PEP 263 encoding information in python sourcefiles, and the similar ruby\n # 1.9 syntax.\n lines.shift if lines[0] =~ /^\\#\\!/\n lines.shift if lines[0] =~ /coding[:=]\\s*[-\\w.]+/ &&\n [ \"python\", \"rb\" ].include?(@options[:language])\n\n # To detect both block comments and single-line comments, we'll set\n # up a tiny state machine, and loop through each line of the file.\n # This requires an `in_comment_block` boolean, and a few regular\n # expressions for line tests. We'll do the same for fake heredoc parsing.\n in_comment_block = false\n in_heredoc = false\n single_line_comment, block_comment_start, block_comment_mid, block_comment_end =\n nil, nil, nil, nil\n if not @options[:comment_chars][:single].nil?\n single_line_comment = Regexp.new(\"^\\\\s*#{Regexp.escape(@options[:comment_chars][:single])}\\\\s?\")\n end\n if not @options[:comment_chars][:multi].nil?\n block_comment_start = Regexp.new(\"^\\\\s*#{Regexp.escape(@options[:comment_chars][:multi][:start])}\\\\s*$\")\n block_comment_end = Regexp.new(\"^\\\\s*#{Regexp.escape(@options[:comment_chars][:multi][:end])}\\\\s*$\")\n block_comment_one_liner = Regexp.new(\"^\\\\s*#{Regexp.escape(@options[:comment_chars][:multi][:start])}\\\\s*(.*?)\\\\s*#{Regexp.escape(@options[:comment_chars][:multi][:end])}\\\\s*$\")\n block_comment_start_with = Regexp.new(\"^\\\\s*#{Regexp.escape(@options[:comment_chars][:multi][:start])}\\\\s*(.*?)$\")\n block_comment_end_with = Regexp.new(\"\\\\s*(.*?)\\\\s*#{Regexp.escape(@options[:comment_chars][:multi][:end])}\\\\s*$\")\n if @options[:comment_chars][:multi][:middle]\n block_comment_mid = Regexp.new(\"^\\\\s*#{Regexp.escape(@options[:comment_chars][:multi][:middle])}\\\\s?\")\n end\n end\n if not @options[:comment_chars][:heredoc].nil?\n heredoc_start = Regexp.new(\"#{Regexp.escape(@options[:comment_chars][:heredoc])}(\\\\S+)$\")\n end\n lines.each do |line|\n # If we're currently in a comment block, check whether the line matches\n # the _end_ of a comment block or the _end_ of a comment block with a\n # comment.\n if in_comment_block\n if block_comment_end && line.match(block_comment_end)\n in_comment_block = false\n elsif block_comment_end_with && line.match(block_comment_end_with)\n in_comment_block = false\n docs << line.match(block_comment_end_with).captures.first.\n sub(block_comment_mid || '', '')\n else\n docs << line.sub(block_comment_mid || '', '')\n end\n # If we're currently in a heredoc, we're looking for the end of the\n # heredoc, and everything it contains is code.\n elsif in_heredoc\n if line.match(Regexp.new(\"^#{Regexp.escape(in_heredoc)}$\"))\n in_heredoc = false\n end\n code << line\n # Otherwise, check whether the line starts a heredoc. If so, note the end\n # pattern, and the line is code. Otherwise check whether the line matches\n # the beginning of a block, or a single-line comment all on it's lonesome.\n # In either case, if there's code, start a new section.\n else\n if heredoc_start && line.match(heredoc_start)\n in_heredoc = $1\n code << line\n elsif block_comment_one_liner && line.match(block_comment_one_liner)\n if code.any?\n sections << [docs, code]\n docs, code = [], []\n end\n docs << line.match(block_comment_one_liner).captures.first\n elsif block_comment_start && line.match(block_comment_start)\n in_comment_block = true\n if code.any?\n sections << [docs, code]\n docs, code = [], []\n end\n elsif block_comment_start_with && line.match(block_comment_start_with)\n in_comment_block = true\n if code.any?\n sections << [docs, code]\n docs, code = [], []\n end\n docs << line.match(block_comment_start_with).captures.first\n elsif single_line_comment && line.match(single_line_comment)\n if code.any?\n sections << [docs, code]\n docs, code = [], []\n end\n docs << line.sub(single_line_comment || '', '')\n else\n code << line\n end\n end\n end\n sections << [docs, code] if docs.any? || code.any?\n normalize_leading_spaces(sections)\n end", "def foldable_comment_block_ranges; end", "def process_block_token(tk); end", "def program \n\t\n\t$cst.add_branch(\"Program\")\n\t\n\tblock\n\tmatch_token(\"T_EOFSIGN\", $tokens[$index])\n\nend", "def program\n block_statement\n return expected(\"End\") unless $lookahead == \"e\"\n comment \"END\" # 68k has an \"END\" instruction\nend", "def _BlockEnd\n\n _save = self.pos\n while true # sequence\n _tmp = apply(:__hyphen_)\n unless _tmp\n self.pos = _save\n break\n end\n _tmp = match_string(\"}\")\n unless _tmp\n self.pos = _save\n break\n end\n _tmp = apply(:__hyphen_)\n unless _tmp\n self.pos = _save\n break\n end\n _tmp = apply(:_Le)\n unless _tmp\n self.pos = _save\n break\n end\n while true\n _tmp = apply(:_EmptyLine)\n break unless _tmp\n end\n _tmp = true\n unless _tmp\n self.pos = _save\n end\n break\n end # end sequence\n\n set_failed_rule :_BlockEnd unless _tmp\n return _tmp\n end", "def block_name \n :CodeBlock \n end", "def block_name \n :CodeBlock \n end", "def welcome\n puts <<-END\nWelcome to the voting simulator!\nHave fun!\n END\nend", "def test_heredoc_method\n desired_output = <<-EOS.unindent\n This should contain no indents.\n\n It should be 3 lines long.\n EOS\n test_output = \"This should contain no indents.\\n\\nIt should be 3 lines long.\\n\"\n assert_equal(desired_output, test_output, \"Output must exactly match.\")\n end", "def block_code(code, language)\n\n # --- Extract file name ---------------------- #\n filename = ''\n regx = Regexp.new(/(<!--\\s?filename:(\\s?.{1,}\\s?)-->\\n?)/)\n if !(code =~ regx).nil?\n code.match(regx)\n filename = $2.try(:strip) || ''\n code.gsub!(regx, '')\n end\n # -------------------------------------------- #\n\n lexer = Rouge::Lexer.find_fancy(language, code) || Rouge::Lexers::PlainText\n if lexer.tag == 'make'\n code.gsub! /^ /, \"\\t\"\n end\n formatter = rouge_formatter(lexer)\n result = formatter.format(lexer.lex(code))\n\n return result if language.blank? && filename.blank?\n\n # --- Compose language and filename section --- #\n\n info_inner_html = [filename, language].select(&:present?).map.with_index { |text, i|\n i == 0 ? \"<span class='highlight-info__inner'>#{text}</span>\" : nil\n }.compact.join('')\n\n %(<div class='highlight-info'>\n #{info_inner_html}\n </div>\n #{result}\n )\n # -------------------------------------------- #\n end", "def body_paragraph(num)\n puts \"#{num} little monkeys jumping on the bed,\nOne fell off and bumped his head,\nMama called the doctor and the doctor said,\n'No more monkeys jumping on the bed!'\n\n\"\nend", "def test_check_good_block\n line = ['0', '0', 'SYSTEM>569274(100)', '1553184699.650330000', '288d']\n line_num = 1\n assert_output(nil) { @verify.check_block(line, line_num) }\n end", "def block_code(code, language)\n \n lines=code.split(\"\\n\")\n lines.map! do |line|\n\n line=line.gsub(/\\&.squo;/, \"'\")\n line=line.gsub(/\\&.dquo;/, '\"')\n line=line.gsub(/</, \"&lt;\")\n line=line.gsub(/>/, \"&gt;\")\n\n # Adding my own special coloring scheme for comments and outputs\n # (for which I've added my own special markup sequence, -->\n line=line.gsub(/(\\# .*$)/, \"<span.ps.class='comment'>\\\\1</span>\")\n line=line.gsub(/\\=\\=> (.*$)/, \"<span.ps.class='output'>\\\\1</span>\")\n\n # Kludgy way of only replacing spaces outside the HTML tags I'm adding to get comments\n # to be in a span of their own\n line=line.gsub(/ /, \"&nbsp;\")\n line=line.gsub(/\\.ps\\./, \" \")\n\n if /lt;/.match(line)\n puts \">>> #{line}\"\n end\n\n line\n end\n html_inner = lines.join(\"<br/>\\n\")\n\n html=\"<div class=mycode>\\n#{html_inner}\\n</div>\\n\"\n end", "def backtick_codeblock(input)\n input.gsub /<p>`{3}\\s(\\w+)<\\/p>\\n\\n<pre><code>([^<]+)<\\/code><\\/pre>\\n\\n<p>`{3}<\\/p>/m do\n lang = $1\n str = $2.gsub('&lt;','<').gsub('&gt;','>')\n highlight(str, lang)\n end\n end", "def to_s # {{{\n c = wrap( self.content.to_s.chomp )\n t = wrap( self.title.to_s.chomp )\n\n<<EOS\n|^\\___________________ [ #{self.source.to_s } ] _________________________________/^|\n\n\\t'#{t}'\n\n\\t#{c}\n\n|/^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\\|\n\nEOS\n end", "def block(sexp)\n statements(sexp)\n end", "def test_heredoc\n\tbegin\n\t toker = NQXML::Tokenizer.new <<EOS\n<simple>really</simple>\nEOS\n\t toker.each { | tok | }\n\trescue NQXML::ParserError => ex\n\t assert_fail(\"unexpected parser error on line #{ex.line}: #{$!}\")\n\tend\n end", "def better_log block_description, &block\n\t\n\tprefix = ' '*$nest\n\tputs prefix + \"Beginning #{block_description.inspect}...\"\n\t$nest += 1\n\tl = block.call\n\t$nest -= 1\n\tputs prefix + \"...#{block_description.inspect} finished, returning: #{l}\"\nend", "def begin_chunk(type)\n chunk_counter[type] += 1\n return \"\\\\begin{#{type}}\" if 1 == chunk_counter[type]\n ''\n end", "def surround\n\tputs \"{\"\n\tyield\n\tputs \"}\"\nend", "def test_it_can_parse_paragraph\nskip\nchisel = Chisel.new\ntext = '# My Life in Desserts\n\n## Chapter 1: The Beginning\n\n\"You just *have* to try the cheesecake,\" he said. \"Ever since it appeared in\n**Food & Wine** this place has been packed every night.\"'\nassert_equal \"<p>You just *have* to try the cheesecake,\" he said. \"Ever since it appeared in\n**Food & Wine** this place has been packed every night.<p>\", chisel.parse_paragraph(text)\nend", "def comment_code\n block_match = /\\{([^\\{\\}]*)\\}/\n matches = @code.scan(block_match)\n return if matches.size != 1\n \n block = matches[0][0].to_s\n @code.gsub!(block_match, \"{\\n#{comment_struct_list(block)}#{@indent}}\")\n end", "def prepare_block_str!\n raise ParserError, @block_str if @block_str.start_with? '-'\n\n @block_str = @block_str.\n gsub(/(\\d{4})/) { \"#{$1[0..1]}:#{$1[2..3]}\" }. # 4 digits\n gsub(/(\\d{3})/) { \"0#{$1[0]}:#{$1[1..2]}\" }. # 3 digits\n gsub(/now/) { RoundedTime.now.strftime('%H:%M') } # now\n\n return unless @block_str =~ HALF_BLOCK_RGX\n\n # Complete or start an ongoing block.\n @block_str = if (ob = @day.blocks.find(&:ongoing?))\n \"#{ob.start_s}-#{@block_str}\"\n else\n \"#{@block_str}-#{@block_str}\"\n end\n end", "def build_verbatim margin\n verbatim = super\n\n verbatim.format = :ruby if @section == 'Examples'\n\n verbatim\n end", "def parse_block_source(example)\n @debug = false\n\n # Source code for rspec is living on the metadata[:block].source location\n unless defined?(example.metadata) && defined?(example.metadata[:block]) && defined?(example.metadata[:block].source)\n @source = ''\n return\n end\n\n unless example.metadata[:source_override].nil?\n @source = example.metadata[:source_override]\n return\n end\n \n source = example.metadata[:block].source.strip\n\n segments = source.match(EXTRACT_CONTENT_REX)\n\n unless defined?(segments) && defined?(segments[:content])\n @source = ''\n return\n end\n @source = remove_wasted_indentation(segments[:content])\n @source\n end", "def _get_code_blocks(contents)\n code_blocks = []\n code_block = contents.slice(REGEX)\n if (!code_block.nil?)\n code_blocks << code_block\n while code_block = $'.slice(REGEX)\n code_blocks << code_block\n end\n end\n code_blocks\n end", "def lex_en_line_begin; end", "def lex_en_line_begin; end", "def lex_en_line_begin; end", "def block\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 2 )\n return_value = BlockReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n\n _last = _first_0 = nil\n statement_block2 = nil\n statement3 = nil\n\n\n begin\n # at line 18:3: ( statement_block | statement )\n alt_2 = 2\n look_2_0 = @input.peek( 1 )\n\n if ( look_2_0 == BLOCK )\n alt_2 = 1\n elsif ( look_2_0.between?( AMP, AMP_ASGN ) || look_2_0 == POST_DECR || look_2_0.between?( GEQ, AREF ) || look_2_0.between?( GREATER, HAT ) || look_2_0.between?( ARROW, HAT_ASGN ) || look_2_0.between?( ASGN, REGEX ) || look_2_0.between?( IN, RETURN ) || look_2_0 == INCR || look_2_0.between?( BREAK, RSHIFT3 ) || look_2_0.between?( LABEL, CATCH ) || look_2_0 == RSHIFT_ASGN || look_2_0 == LEQ || look_2_0.between?( LESS, SLASH ) || look_2_0.between?( SLASH_ASGN, CONTINUE ) || look_2_0.between?( STAR, DECR ) || look_2_0 == STAR_ASGN || look_2_0.between?( LSHIFT, THIS ) || look_2_0 == THROW || look_2_0.between?( MINUS, MOD ) || look_2_0.between?( MOD_ASGN, TYPEOF ) || look_2_0.between?( NEQ, UMINUS ) || look_2_0.between?( NEQQ, UNDEFINED ) || look_2_0.between?( NEW, UPLUS ) || look_2_0.between?( OBJECT, FALSE ) || look_2_0.between?( WITH, PLUS ) || look_2_0.between?( ID, DOC ) )\n alt_2 = 2\n else\n raise NoViableAlternative( \"\", 2, 0 )\n end\n case alt_2\n when 1\n root_0 = @adaptor.create_flat_list\n\n\n # at line 18:5: statement_block\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_statement_block_IN_block_59 )\n statement_block2 = statement_block\n @state.following.pop\n\n @adaptor.add_child( root_0, statement_block2.tree )\n\n\n when 2\n root_0 = @adaptor.create_flat_list\n\n\n # at line 19:5: statement\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_statement_IN_block_65 )\n statement3 = statement\n @state.following.pop\n\n @adaptor.add_child( root_0, statement3.tree )\n\n\n end\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 2 )\n\n end\n \n return return_value\n end", "def cheese_and_crackers(cheese_count, boxes_of_crackers)\n# print string and parameter\n puts \"You have #{cheese_count} cheeses!\"\n# print string and parameter\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n# print string\n puts \"Man that's enough for a party!\"\n# print string and start a newline\n puts \"Get a blanket.\\n\"\nend", "def parse_codespan; end", "def process_block(exp)\n code = []\n until exp.empty? do\n code << process(exp.shift)\n end\n\n body = code.join(\";\\n\")\n body += \";\" unless body =~ /[;}]\\Z/\n body += \"\\n\"\n\n return body\n end", "def wrap_block_in_syntax_tags(block)\n \"<div class=\\\"syntax\\\">\" + block + '</div>'\n end", "def extract(data)\n data.gsub!(/^``` ?([^\\r\\n]+)?\\r?\\n(.+?)\\r?\\n```\\r?$/m) do\n id = Digest::SHA1.hexdigest($2)\n @code_blocks << CodeBlock.new(id, $1, $2)\n id\n end\n data\n end", "def convert_to_ruby (src)\n rb = \"\"\n # dunno how to deal with only leading declarations of ruby code,\n # so replace it with the other markings\n src.gsub!(/-%>/,\"%>\")\n while\tsrc.index(Embedded_ruby_line) != nil\n src.sub!(Embedded_ruby_line) { |match|\n match[match.index '%'] = \" \"\n \"<% \" + match + \" %>\"\n }\n end\n lines = src.split(Embedded_ruby_flag)\n\n is_ruby_line = false\n lines.each { |line|\n if (line.strip != \"\" and line.strip != nil)\n if is_ruby_line\n if line[0,1] == '='\n # line[0] = \" \"\n # rb += \"puts \" + line.strip\n rb+=\"gr_html_puts \"+line.strip\n else\n rb += line.strip\n end\n else\n rb += \"gr_html( \" + line.inspect + \" )\"\n end\n rb += \"\\n\"\n end\n is_ruby_line = (not is_ruby_line)\n }\n #puts rb\n return rb\n end", "def hug \n puts \"{\"\n yield if block_given?\n puts \"}\"\nend", "def cheese_and_crackers(cheese_count, boxes_of_crackers)\n# puts a string with an interpolated value of cheese_count on it's own line\n puts \"You have #{cheese_count} cheeses!\"\n# puts a string with an interpolated value of boxes_of_crackers on it's own line\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n# puts a string on it's own line\n puts \"Man that's enough for a party!\"\n# puts a string on it's own line, with a new line built in\n puts \"Get a blanket.\\n\"\n# ends the cheese_and_crackers method\nend", "def to_s\n text = \"#{keyword} #{base}\"\n text << \"\\n\" + block.to_s.split(\"\\n\").collect { |line| \" #{line}\" }.join(\"\\n\") if block\n\n text\n end", "def print_file_code_blocks2(filename)\n\t# File is closed automagically upon termination of the block\n\tFile.save_open(filename, \"r\") do |file|\n\t\tdata = file.read\n\t\tputs data\n\t\tprint_separator\n\tend\nend", "def display_puppetfile(puppetfile_contents)\n puts <<-EOF\n\nYour Puppetfile has been generated. Copy and paste between the markers:\n\n=======================================================================\n#{puppetfile_contents.chomp}\n=======================================================================\n EOF\n end", "def scan_body\n case\n when text = @scanner.scan(/\\{\\{/) \n @context = :statement\n token(:VAR_OPEN, text)\n\n when text = @scanner.scan(/\\{%/)\n @context = :statement\n token(:STMT_OPEN, text)\n\n when text = @scanner.scan(/\\{#/)\n # scan until the end of the comment bracket, ignore the text for all\n # purposes except for advancing the counters appropriately\n comment = @scanner.scan_until(/#\\}/)\n\n # increment the counters based on the content of the counter\n update_counter(text + comment)\n\n # scan in the body context again, since we're not actually returning a\n # token from the comment. Don't scan if we're at the end of the body,\n # just return a terminator token.\n if @scanner.eos?\n [false, false]\n else\n scan_body\n end\n\n else\n # scan ahead until we find a variable opening tag or a block opening tag\n text = @scanner.scan_until(/\\{[\\{%#]/)\n\n # if there was no instance of an opening block then just take what remains \n # in the scanner otherwise return the pointer to before the block\n if text\n text = text[0..-3]\n @scanner.pos -= 2\n else\n text = @scanner.rest\n @scanner.terminate\n end\n\n token(:TEXT_BLOCK, text)\n end\n end", "def log block_description, &block\n puts $space*$nesting_depth + 'Beginning \"'+block_description+'\" ...'\n $nesting_depth = $nesting_depth + 2\n value_returned = block.call\n $nesting_depth = $nesting_depth - 2 \n puts $space*$nesting_depth + '... \"'+block_description+'\" finished, returning: ' + value_returned.to_s\nend", "def multiline_comment!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 50 )\n\n\n\n type = MULTILINE_COMMENT\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 229:21: '/*' ( . )* '*/'\n match( \"/*\" )\n\n # at line 229:26: ( . )*\n while true # decision 7\n alt_7 = 2\n look_7_0 = @input.peek( 1 )\n\n if ( look_7_0 == 0x2a )\n look_7_1 = @input.peek( 2 )\n\n if ( look_7_1 == 0x2f )\n alt_7 = 2\n elsif ( look_7_1.between?( 0x0, 0x2e ) || look_7_1.between?( 0x30, 0xffff ) )\n alt_7 = 1\n\n end\n elsif ( look_7_0.between?( 0x0, 0x29 ) || look_7_0.between?( 0x2b, 0xffff ) )\n alt_7 = 1\n\n end\n case alt_7\n when 1\n # at line 229:26: .\n match_any\n\n else\n break # out of loop for decision 7\n end\n end # loop for decision 7\n\n\n match( \"*/\" )\n\n\n # --> action\n channel = HIDDEN;\n # <-- action\n\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 50 )\n\n\n end", "def mysql_modsec_versioned_comment\n if self =~ /(--|\\/\\*|\\#)/\n delim=$1\n inj = self.gsub(\"#{delim}\", '')\n else\n inj=self\n end\n foo=\"/*!30#{rand(9).to_s+rand(9).to_s+rand(9).to_s}#{inj}*/\"\n foo += delim if delim\n return foo\n end", "def test_method message\n puts \"Hi there\"\n puts message\n 2\n \"ha\"\nend", "def ruby\n unless @ruby\n @ruby = \"\"\n @body.each_line do |l|\n @commands << {:ruby => l}\n @ruby << l\n end\n end \n @ruby\n end", "def roar\n#print string\n puts \"RARRR\"\n#end method codeblock\n end", "def testget_leveled_file_contentUselessLVLBlock\n # If set to 2, nothing will be leveled.\n RCodeLeveler::set_level(2)\n lNewContent, lDiff = RCodeLeveler.get_leveled_file_content('RequiredFiles/SimpleFileBlock')\n File.open(\"#{File.dirname(__FILE__)}/RequiredFiles/SimpleFileBlock.rb\", 'r') do |iFile|\n assert_equal(iFile.readlines, lNewContent)\n end\n assert_equal(false, lDiff)\n end", "def block_eg1(cutblock)\n puts \"this is the first message from 1 \"\n cutblock.call\n puts \"this is the middle message\"\n cutblock.call\n puts \"this is the last\\n\\n\"\nend", "def source_line; end", "def statement_block\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 3 )\n return_value = StatementBlockReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n\n _last = _first_0 = nil\n __BLOCK4__ = nil\n statement_list5 = nil\n\n tree_for_BLOCK4 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 23:5: ^( BLOCK ( statement_list )? )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n __BLOCK4__ = match( BLOCK, TOKENS_FOLLOWING_BLOCK_IN_statement_block_80 )\n\n tree_for_BLOCK4 = @adaptor.copy_node( __BLOCK4__ )\n\n root_1 = @adaptor.become_root( tree_for_BLOCK4, root_1 )\n\n\n\n if @input.peek == DOWN\n match( DOWN, nil )\n # at line 23:14: ( statement_list )?\n alt_3 = 2\n look_3_0 = @input.peek( 1 )\n\n if ( look_3_0.between?( AMP, AMP_ASGN ) || look_3_0 == POST_DECR || look_3_0.between?( GEQ, AREF ) || look_3_0.between?( GREATER, HAT ) || look_3_0.between?( ARROW, HAT_ASGN ) || look_3_0.between?( ASGN, REGEX ) || look_3_0.between?( IN, RETURN ) || look_3_0 == INCR || look_3_0.between?( BREAK, RSHIFT3 ) || look_3_0.between?( LABEL, CATCH ) || look_3_0 == RSHIFT_ASGN || look_3_0 == LEQ || look_3_0.between?( LESS, SLASH ) || look_3_0.between?( SLASH_ASGN, CONTINUE ) || look_3_0.between?( STAR, DECR ) || look_3_0 == STAR_ASGN || look_3_0.between?( LSHIFT, THIS ) || look_3_0 == THROW || look_3_0.between?( MINUS, MOD ) || look_3_0.between?( MOD_ASGN, TYPEOF ) || look_3_0.between?( NEQ, UMINUS ) || look_3_0.between?( NEQQ, UNDEFINED ) || look_3_0.between?( NEW, UPLUS ) || look_3_0.between?( OBJECT, FALSE ) || look_3_0.between?( WITH, PLUS ) || look_3_0.between?( ID, DOC ) )\n alt_3 = 1\n end\n case alt_3\n when 1\n # at line 23:14: statement_list\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_statement_list_IN_statement_block_82 )\n statement_list5 = statement_list\n @state.following.pop\n\n @adaptor.add_child( root_1, statement_list5.tree )\n\n\n end\n\n match( UP, nil )\n end\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 3 )\n\n end\n \n return return_value\n end", "def markup_code\n return '' unless @token_stream\n\n src = RDoc::TokenStream.to_html @token_stream\n\n # dedent the source\n indent = src.length\n lines = src.lines.to_a\n lines.shift if src =~ /\\A.*#\\ *File/i # remove '# File' comment\n lines.each do |line|\n if line =~ /^ *(?=\\S)/\n n = $&.length\n indent = n if n < indent\n break if n == 0\n end\n end\n src.gsub!(/^#{' ' * indent}/, '') if indent > 0\n\n add_line_numbers(src) if options.line_numbers\n\n src\n end", "def step\n case\n when bol? && check( /=begin/ )\n start_group( :comment, scan_until( /^=end#{EOL}/ ) )\n when bol? && check( /__END__#{EOL}/ )\n start_group( :comment, scan_until( /\\Z/ ) )\n else\n case\n when check( /def\\s+/ )\n start_group :keyword, scan( /def\\s+/ )\n start_group :method, scan_until( /(?=[;(\\s]|#{EOL})/ )\n when check( /class\\s+/ )\n start_group :keyword, scan( /class\\s+/ )\n start_group :class, scan_until( /(?=[;\\s<]|#{EOL})/ )\n when check( /module\\s+/ )\n start_group :keyword, scan( /module\\s+/ )\n start_group :module, scan_until( /(?=[;\\s]|#{EOL})/ )\n when check( /::/ )\n start_group :punct, scan(/::/)\n when check( /:\"/ )\n start_group :symbol, scan(/:/)\n scan_delimited_region :symbol, :symbol, \"\", true\n @allow_operator = true\n when check( /:'/ )\n start_group :symbol, scan(/:/)\n scan_delimited_region :symbol, :symbol, \"\", false\n @allow_operator = true\n when scan( /:[_a-zA-Z@$][$@\\w]*[=!?]?/ )\n start_group :symbol, matched\n @allow_operator = true\n when scan( /\\?(\\\\[^\\n\\r]|[^\\\\\\n\\r\\s])/ )\n start_group :char, matched\n @allow_operator = true\n when check( /(__FILE__|__LINE__|true|false|nil|self)[?!]?/ )\n if @selector || matched[-1] == ?? || matched[-1] == ?!\n start_group :ident,\n scan(/(__FILE__|__LINE__|true|false|nil|self)[?!]?/)\n else\n start_group :constant,\n scan(/(__FILE__|__LINE__|true|false|nil|self)/)\n end\n @selector = false\n @allow_operator = true\n when scan(/0([bB][01]+|[oO][0-7]+|[dD][0-9]+|[xX][0-9a-fA-F]+)/)\n start_group :number, matched\n @allow_operator = true\n else\n case peek(2)\n when \"%r\"\n scan_delimited_region :punct, :regex, scan( /../ ), true\n @allow_operator = true\n when \"%w\", \"%q\"\n scan_delimited_region :punct, :string, scan( /../ ), false\n @allow_operator = true\n when \"%s\"\n scan_delimited_region :punct, :symbol, scan( /../ ), false\n @allow_operator = true\n when \"%W\", \"%Q\", \"%x\"\n scan_delimited_region :punct, :string, scan( /../ ), true\n @allow_operator = true\n when /%[^\\sa-zA-Z0-9]/\n scan_delimited_region :punct, :string, scan( /./ ), true\n @allow_operator = true\n when \"<<\"\n saw_word = ( chunk[-1,1] =~ /[\\w!?]/ )\n start_group :punct, scan( /<</ )\n if saw_word\n @allow_operator = false\n return\n end\n\n float_right = scan( /-/ )\n append \"-\" if float_right\n if ( type = scan( /['\"]/ ) )\n append type\n delim = scan_until( /(?=#{type})/ )\n if delim.nil?\n append scan_until( /\\Z/ )\n return\n end\n else\n delim = scan( /\\w+/ ) or return\n end\n start_group :constant, delim\n start_group :punct, scan( /#{type}/ ) if type\n @heredocs << [ float_right, type, delim ]\n @allow_operator = true\n else\n case peek(1)\n when /[\\n\\r]/\n unless @heredocs.empty?\n scan_heredoc(*@heredocs.shift)\n else\n start_group :normal, scan( /\\s+/ )\n end\n @allow_operator = false\n when /\\s/\n start_group :normal, scan( /\\s+/ )\n when \"#\"\n start_group :comment, scan( /#[^\\n\\r]*/ )\n when /[A-Z]/\n start_group @selector ? :ident : :constant, scan( /\\w+/ )\n @allow_operator = true\n when /[a-z_]/\n word = scan( /\\w+[?!]?/ )\n if !@selector && KEYWORDS.include?( word )\n start_group :keyword, word\n @allow_operator = false\n elsif\n start_group :ident, word\n @allow_operator = true\n end\n @selector = false\n when /\\d/\n start_group :number,\n scan( /[\\d_]+(\\.[\\d_]+)?([eE][\\d_]+)?/ )\n @allow_operator = true\n when '\"'\n scan_delimited_region :punct, :string, \"\", true\n @allow_operator = true\n when '/'\n if @allow_operator\n start_group :punct, scan(%r{/})\n @allow_operator = false\n else\n scan_delimited_region :punct, :regex, \"\", true\n @allow_operator = true\n end\n when \"'\"\n scan_delimited_region :punct, :string, \"\", false\n @allow_operator = true\n when \".\"\n dots = scan( /\\.{1,3}/ )\n start_group :punct, dots\n @selector = ( dots.length == 1 )\n when /[@]/\n start_group :attribute, scan( /@{1,2}\\w*/ )\n @allow_operator = true\n when /[$]/\n start_group :global, scan(/\\$/)\n start_group :global, scan( /\\w+|./ ) if check(/./)\n @allow_operator = true\n when /[-!?*\\/+=<>(\\[\\{}:;,&|%]/\n start_group :punct, scan(/./)\n @allow_operator = false\n when /[)\\]]/\n start_group :punct, scan(/./)\n @allow_operator = true\n else\n # all else just falls through this, to prevent\n # infinite loops...\n append getch\n end\n end\n end\n end\n end", "def surround\r\n puts '{'\r\n yield\r\n puts '}'\r\nend", "def body\n # The -2 is because we drop the last line; The last line output by the assert method.\n @test_lines[0..-2] + [\"result = \" + @test_lines[-1].to_s]\n end", "def block(options)\n [\n %[snippet #{options[:name]} \"#{options[:desc]}\"],\n options[:snip],\n \"endsnippet\"\n ].join(\"\\n\")\n end", "def p003rubystrings\n\tputs \"Hello World\"\n\t\n\t# CAn use \" or '. But, ' is more effective\n\tputs 'Hello WOrld'\n\n\t#String concatenate\n\tputs \"I like\" + \" Ruby\"\n\n\t#Escape Sequence\n\tputs 'It\\'s my Ruby'\n\n\t#New here displays the string 3 times\n\tputs 'Hello' * 3\n\n\tputs PI\n\n\t#USe of back-tick\n\tputs \"LIsting of files\"\n\tputs `ls`\n\n\tsystem (\"ls\")\n\nend", "def lex_en_expr_beg; end", "def lex_en_expr_beg; end", "def lex_en_expr_beg; end", "def surround\n puts '{'\n yield\n puts '}'\nend", "def scan\n @top_level.comment ||= \"\"\n state=:code_blank\n line_number = 0\n line = nil\n\n # This started out as a really long nested case statement,\n # which also led to repetitive code. I'd like to avoid that\n # so I'm using a \"table\" instead.\n\n # Firstly we need some procs to do the transition and processing\n # work. Because these are procs they are closures, and they can\n # use variables in the local scope.\n #\n # First, the \"nothing to see here\" stuff.\n code_noop = lambda do\n if line =~ /^\\s+$/\n state = :code_blank\n end\n end\n\n pod_noop = lambda do\n if line =~ /^\\s+$/\n state = :pod_blank\n end\n @top_level.comment += filter(line)\n end\n\n begin_noop = lambda do\n if line =~ /^\\s+$/\n state = :begin_blank\n end\n @top_level.comment += filter(line)\n end\n\n # Now for the blocks that process code and comments...\n\n transit_to_pod = lambda do\n case line\n when /^=(?:pod|head\\d+)/\n state = :pod_no_blank\n @top_level.comment += filter(line)\n when /^=over/\n state = :over_no_blank\n @top_level.comment += filter(line)\n when /^=(?:begin|for)/\n state = :begin_no_blank\n end\n end\n\n process_pod = lambda do\n case line\n when /^\\s*$/ then\n state = :pod_blank\n @top_level.comment += filter(line)\n when /^=cut/ then\n state = :code_no_blank\n when /^=end/ then\n $stderr.puts \"'=end' unexpected at #{line_number} in #{@file_name}\"\n else\n @top_level.comment += filter(line)\n end\n end\n\n process_begin = lambda do\n case line\n when /^\\s*$/ then\n state = :begin_blank\n @top_level.comment += filter(line)\n when /^=end/ then\n state = :code_no_blank\n when /^=cut/\n $stderr.puts \"'=cut' unexpected at #{line_number} in #{@file_name}\"\n else\n @top_level.comment += filter(line)\n end\n end\n\n transitions = { :code_no_blank => code_noop,\n :code_blank => transit_to_pod,\n :pod_no_blank => pod_noop,\n :pod_blank => process_pod,\n :begin_no_blank => begin_noop,\n :begin_blank => process_begin,\n }\n\n @content.each_line do |l|\n line = l\n line_number += 1\n transitions[state].call\n end\n\n @top_level\n end", "def emit_differences(species, confused_with)\n <<-difference\n #{confused_with}: '''\n to do description\n '''\n \n difference\n end", "def nonsense name\n yield 1\n puts \"#{name} is a non sense person\"\n yield 2\n puts \"but #{name} is very nice\"\n yield 3\n puts \"he makes people happy\"\nend", "def cheese_and_crackers(cheese_count, boxes_of_crackers)\n #prints the string witht he arguement cheese_count inserted in\n puts \"you have #{cheese_count} cheeses!\"\n#prints the string witht he arguement boxes_of_crackers inserted\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n#prints the below string\n puts \"Mans that's enough for a party!\"\n#prints the below string, not sure what the \\n does\n puts \"get a blanket. \\n\"\n#ends the method\nend", "def visit_script(node, &block)\n raw_first_line = @original_haml_lines[node.line - 1]\n\n # ==, !, !==, &, &== means interpolation (was needed before HAML 2.2... it's still supported)\n # =, !=, &= mean actual ruby code is coming\n # Anything else is interpolation\n # The regex lists the case for Ruby Code. The 3 cases and making sure they are not followed by another = sign\n\n match = raw_first_line.match(/\\A\\s*(=|!=|&=)(?!=)/)\n unless match\n # The line doesn't start with a - or a =, this is actually a \"plain\"\n # that contains interpolation.\n indent = raw_first_line.index(/\\S/)\n @ruby_chunks << PlaceholderMarkerChunk.new(node, 'interpolation', indent: indent)\n lines = extract_piped_plain_multilines(node.line - 1)\n add_interpolation_chunks(node, lines.join(\"\\n\"), node.line - 1, indent: indent)\n return\n end\n\n script_prefix = match[1]\n _first_line_offset, lines = extract_raw_ruby_lines(node.script, node.line - 1)\n # We want the actual indentation and prefix for the first line\n first_line = lines[0] = @original_haml_lines[node.line - 1].rstrip\n process_multiline!(first_line)\n\n lines[0] = lines[0].sub(/(#{script_prefix}[ \\t]?)/, '')\n line_indentation = Regexp.last_match(1).size\n\n raw_code = lines.join(\"\\n\")\n\n if lines[0][/\\S/] == '#'\n # a \"=\" script that only contains a comment... No need for the \"HL.out = \" prefix,\n # just treat it as comment which will turn into a \"-\" comment\n else\n lines[0] = HamlLint::Utils.insert_after_indentation(lines[0], script_output_prefix)\n end\n\n indent_delta = script_output_prefix.size - line_indentation\n HamlLint::Utils.map_after_first!(lines) do |line|\n HamlLint::Utils.indent(line, indent_delta)\n end\n\n prev_chunk = @ruby_chunks.last\n if prev_chunk.is_a?(ScriptChunk) &&\n prev_chunk.node.type == :script &&\n prev_chunk.node == node.parent\n # When an outputting script is nested under another outputting script,\n # we want to block them from being merged together by rubocop, because\n # this doesn't make sense in HAML.\n # Example:\n # = if this_is_short\n # = this_is_short_too\n # Could become (after RuboCop):\n # HL.out = (HL.out = this_is_short_too if this_is_short)\n # Or in (broken) HAML style:\n # = this_is_short_too = if this_is_short\n # By forcing this to start a chunk, there will be extra placeholders which\n # blocks rubocop from merging the lines.\n must_start_chunk = true\n elsif script_prefix != '='\n # In the few cases where &= and != are used to start the script,\n # We need to remember and put it back in the final HAML. Fusing scripts together\n # would make that basically impossible. Instead, a script has a \"first_output_prefix\"\n # field for this specific case\n must_start_chunk = true\n end\n\n finish_visit_any_script(node, lines, raw_code: raw_code, must_start_chunk: must_start_chunk,\n first_output_prefix: script_prefix, &block)\n end", "def create_comment(string, &block); end", "def create_comment(string, &block); end", "def __print_gen_code__(target_file) \n target_file.puts \"### evaluated strings\"\n $__gen_code__.each_pair { |k,v|\n target_file.printf \"##? %s:%s:%s:%s\\n\", \n k[0], \n k[1],\n v[:kind], \n v[:binding]\n if v[:code]\n target_file.puts v[:code]\n end\n target_file.printf \"##? EOE\\n\"\n }\n target_file.printf \"### total %s evals (including ones with a block).\\n\",\n $__gen_code__.length\n target_file.printf \"##? EOF\\n\"\nend", "def last_magic_comment(source); end", "def method_without_parentheses a, b, c = [foo,bar,baz] # test comment\n# ^^^ meta.function.method.with-arguments.ruby keyword.control.def.ruby\n# ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.method.with-arguments.ruby entity.name.function.ruby\n# ^ meta.function.method.with-arguments.ruby variable.parameter.function.ruby\n# ^ meta.function.method.with-arguments.ruby punctuation.separator.object.ruby\n# ^ meta.function.method.with-arguments.ruby variable.parameter.function.ruby\n# ^ meta.function.method.with-arguments.ruby punctuation.separator.object.ruby\n# ^ meta.function.method.with-arguments.ruby variable.parameter.function.ruby\n# ^ meta.function.method.with-arguments.ruby keyword.operator.assignment.ruby\n# ^ meta.function.method.with-arguments.ruby punctuation.section.array.begin.ruby\n# ^^^ meta.function.method.with-arguments.ruby variable.other.ruby\n# ^ meta.function.method.with-arguments.ruby punctuation.separator.object.ruby\n# ^^^ meta.function.method.with-arguments.ruby variable.other.ruby\n# ^ meta.function.method.with-arguments.ruby punctuation.separator.object.ruby\n# ^^^ meta.function.method.with-arguments.ruby variable.other.ruby\n# ^ meta.function.method.with-arguments.ruby punctuation.section.array.end.ruby\n# ^ comment.line.number-sign.ruby punctuation.definition.comment.ruby\n# ^^^^^^^^^^^^^ comment.line.number-sign.ruby\n hello, world = [1,2]\n# ^^^^^ variable.other.ruby\n# ^ punctuation.separator.object.ruby\n# ^^^^^ variable.other.ruby\n# ^ keyword.operator.assignment.ruby\n# ^ punctuation.section.array.begin.ruby\n# ^ constant.numeric.ruby\n# ^ punctuation.separator.object.ruby\n# ^ constant.numeric.ruby\n# ^ punctuation.section.array.end.ruby\n end" ]
[ "0.6595406", "0.6283895", "0.6174429", "0.6144977", "0.61133885", "0.6031825", "0.59627444", "0.59163", "0.59163", "0.590397", "0.5889747", "0.58800983", "0.58523667", "0.585213", "0.58411056", "0.58222455", "0.58203346", "0.5818648", "0.5812686", "0.58012456", "0.57892275", "0.5778192", "0.57491463", "0.57474864", "0.5745644", "0.5745408", "0.5733045", "0.5730898", "0.57228935", "0.57204235", "0.57202077", "0.5711065", "0.5694691", "0.5679905", "0.5679498", "0.5679498", "0.567758", "0.56697226", "0.5659049", "0.5642858", "0.56421745", "0.56383604", "0.56207806", "0.5613109", "0.5610912", "0.5596187", "0.5585387", "0.5571192", "0.5565923", "0.5564459", "0.55557984", "0.5539556", "0.55349797", "0.5526877", "0.552492", "0.55225194", "0.55225194", "0.55225194", "0.5516854", "0.5506085", "0.5494966", "0.54901886", "0.54896617", "0.5486717", "0.5477058", "0.5473796", "0.54615146", "0.5450626", "0.5441667", "0.54356307", "0.5418646", "0.5409936", "0.5402703", "0.5399366", "0.5399364", "0.53981775", "0.53915495", "0.53818303", "0.53787476", "0.53731185", "0.5366839", "0.53589445", "0.53527015", "0.53515285", "0.53474975", "0.53383046", "0.5335419", "0.5332313", "0.5332313", "0.5332313", "0.53251034", "0.53237915", "0.5322127", "0.53218764", "0.5313635", "0.5303912", "0.5303518", "0.5303518", "0.5301359", "0.53006166", "0.5299661" ]
0.0
-1
=> "23: study :(" END /Users/joekelly/Desktop/Projects/rubykickstart/session3/notes/15forwardingblocks.rb file content is listed below Another common thing is to forward blocks to other methods
def meth1(&block) "(meth1: #{block.call})" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def block_eg1(cutblock)\n puts \"this is the first message from 1 \"\n cutblock.call\n puts \"this is the middle message\"\n cutblock.call\n puts \"this is the last\\n\\n\"\nend", "def log block_description, &block\n puts $space*$nesting_depth + 'Beginning \"'+block_description+'\" ...'\n $nesting_depth = $nesting_depth + 2\n value_returned = block.call\n $nesting_depth = $nesting_depth - 2 \n puts $space*$nesting_depth + '... \"'+block_description+'\" finished, returning: ' + value_returned.to_s\nend", "def blocks; end", "def blocks; end", "def blocks; end", "def parse_codeblock; end", "def blocks() end", "def better_log block_description, &block\n\t\n\tprefix = ' '*$nest\n\tputs prefix + \"Beginning #{block_description.inspect}...\"\n\t$nest += 1\n\tl = block.call\n\t$nest -= 1\n\tputs prefix + \"...#{block_description.inspect} finished, returning: #{l}\"\nend", "def list_block()\n\nend", "def parse_block(*_arg0); end", "def MyBlockMethod()\n puts \"At the top of the method\"\n\tyield\n\tputs \"At the bottom of the method\"\nend", "def step(message)\n header = '#' * 80\n puts \"\\n\\n\"\n puts header\n puts message + '...'\n puts header\n yield\nend", "def meth1\n\tyield('Hi World')\n\t'Something!!'\nend", "def pre_block\n end", "def pre_block\n end", "def hug \n puts \"{\"\n yield if block_given?\n puts \"}\"\nend", "def process_block_token(tk); end", "def ouch(body_part)\n puts \"Im in the method\"\n puts \"Ouch my #{body_part} hurts\"\n yield(\"John\")\nend", "def parse_codeblock_fenced; end", "def block_message_printer\n message = \"Welcome to Block Message Printer\"\n if block_given?\n yield\n end\n puts \"But in this function/method message is :: #{message}\"\nend", "def surround\n\tputs \"{\"\n\tyield\n\tputs \"}\"\nend", "def process_blocks(blocks); end", "def log(blockDescription, &block)\n\tp \"Beginning \" + blockDescription + \"...\"\n\tp blockDescription + \" finished, returning: \" + (block.call).to_s\nend", "def extract_code_blocks\n body.match /```([a-z]+)?\\n(.*)\\n```/\n end", "def t__53!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 42 )\n\n type = T__53\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 58:9: 'b'\n match( 0x62 )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 42 )\n\n end", "def program_logger(block_description, &block)\n\n puts \"Started block #{block_description}.\"\n result = block.call\n puts \"#{block_description} finished, returning: #{result}\"\n\nend", "def lines_above_method\n added_lines = []\n lines_to_add = []\n block_level = 0\n ensure_line_breaks(controller_content.lines).first(action_line).reverse_each do |line|\n if line =~ /\\s*\\bend\\b\\s*/\n block_level += 1\n end\n if block_level > 0\n lines_to_add << line\n else\n added_lines << line\n end\n if line =~ /\\s*\\b(module|class|def)\\b /\n break\n end\n next unless line =~ /do\\s*(\\|.*?\\|)?\\s*$/\n block_level -= 1\n if block_level == 0\n added_lines.concat(lines_to_add)\n lines_to_add = []\n end\n end\n return added_lines.reverse.join\n end", "def parse_block_extensions; end", "def block_eg\n puts \"this is the first message\"\n yield\n puts \"this is the middle message\"\n yield\n puts \"this is the last\\n\\n\"\nend", "def block_name \n :CodeBlock \n end", "def block_name \n :CodeBlock \n end", "def anonymous_blocklists; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def i_take_an_explicit_block &block\n puts block.inspect\nend", "def test(&block)\n puts \"&block is, #{block}\"\nend", "def t__29!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 18 )\n\n type = T__29\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 34:9: 'e'\n match( 0x65 )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 18 )\n\n end", "def method_that_takes_a_block(&blk)\n p blk.call(\"hello\")\n p blk.call(\"World!\")\nend", "def log desc, &block\r\n puts \"Beginning #{desc.inspect}...\"\r\n result = block[]\r\n puts \"...#{desc.inspect} finished, returning: #{result}\"\r\nend", "def scan\n @top_level.comment ||= \"\"\n state=:code_blank\n line_number = 0\n line = nil\n\n # This started out as a really long nested case statement,\n # which also led to repetitive code. I'd like to avoid that\n # so I'm using a \"table\" instead.\n\n # Firstly we need some procs to do the transition and processing\n # work. Because these are procs they are closures, and they can\n # use variables in the local scope.\n #\n # First, the \"nothing to see here\" stuff.\n code_noop = lambda do\n if line =~ /^\\s+$/\n state = :code_blank\n end\n end\n\n pod_noop = lambda do\n if line =~ /^\\s+$/\n state = :pod_blank\n end\n @top_level.comment += filter(line)\n end\n\n begin_noop = lambda do\n if line =~ /^\\s+$/\n state = :begin_blank\n end\n @top_level.comment += filter(line)\n end\n\n # Now for the blocks that process code and comments...\n\n transit_to_pod = lambda do\n case line\n when /^=(?:pod|head\\d+)/\n state = :pod_no_blank\n @top_level.comment += filter(line)\n when /^=over/\n state = :over_no_blank\n @top_level.comment += filter(line)\n when /^=(?:begin|for)/\n state = :begin_no_blank\n end\n end\n\n process_pod = lambda do\n case line\n when /^\\s*$/ then\n state = :pod_blank\n @top_level.comment += filter(line)\n when /^=cut/ then\n state = :code_no_blank\n when /^=end/ then\n $stderr.puts \"'=end' unexpected at #{line_number} in #{@file_name}\"\n else\n @top_level.comment += filter(line)\n end\n end\n\n process_begin = lambda do\n case line\n when /^\\s*$/ then\n state = :begin_blank\n @top_level.comment += filter(line)\n when /^=end/ then\n state = :code_no_blank\n when /^=cut/\n $stderr.puts \"'=cut' unexpected at #{line_number} in #{@file_name}\"\n else\n @top_level.comment += filter(line)\n end\n end\n\n transitions = { :code_no_blank => code_noop,\n :code_blank => transit_to_pod,\n :pod_no_blank => pod_noop,\n :pod_blank => process_pod,\n :begin_no_blank => begin_noop,\n :begin_blank => process_begin,\n }\n\n @content.each_line do |l|\n line = l\n line_number += 1\n transitions[state].call\n end\n\n @top_level\n end", "def captured_by_block; end", "def call_block2\n yield(\"hello\",4)\nend", "def parse(block)\n ast = block.to_ast\n # produces sth. like:\n # (block\n # (send ..)\n # (args)\n # (begin ..)\n # )\n inner_ast = ast.children[2] # pick up (begin..)\n if inner_ast.type == :send\n lines = [inner_ast]\n else\n lines = inner_ast.children\n end\n\n lines.map do |node|\n if node.type == :send\n buf = []\n extract_value(node, buf)\n buf.reverse\n end\n end\n end", "def t__72!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 17)\n\n type = T__72\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 23:9: '}'\n match(?})\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 17)\n\n end", "def t__25!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 18 )\n\n type = T__25\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 34:9: 's'\n match( 0x73 )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 18 )\n\n end", "def block_message_printer\n message = \"Welcome to Block Message Printer\"\n if block_given?\n proc.call\n end\n puts \"But in this function/method message is :: #{message}\"\n end", "def charm_failure\n slowly do\n\"\"\"\nDuncan barks, wags his tail, rolls over, does all his awesome tricks...\n\nBut the troll just looks on in disdain. \n\n'Go home, little dog, before I sqquish you.' \n\"\"\"\n end\n what_next\n end", "def method # test comment\n# ^^^ meta.function.method.without-arguments.ruby keyword.control.def.ruby\n# ^^^^^^ meta.function.method.without-arguments.ruby entity.name.function.ruby\n# ^ comment.line.number-sign.ruby punctuation.definition.comment.ruby\n# ^^^^^^^^^^^^^ comment.line.number-sign.ruby\n hello, world = [1,2]\n# ^^^^^ variable.other.ruby\n# ^ punctuation.separator.object.ruby\n# ^^^^^ variable.other.ruby\n# ^ keyword.operator.assignment.ruby\n# ^ punctuation.section.array.begin.ruby\n# ^ constant.numeric.ruby\n# ^ punctuation.separator.object.ruby\n# ^ constant.numeric.ruby\n# ^ punctuation.section.array.end.ruby\n end", "def walk_the_plank\n \n # @note A note should be parsed and appear in the comments. Which will make\n # it easier to find code that needs to be addressed.\n puts \"Yo Ho, Yo Ho!\"\n \n # I should have listened to the {#a_word_of_warning} (which I can link to\n # and visit immediately from within the method comments). Too late.\n puts \"Walk the Plank!\"\n\n # @todo Even todo tags will appear as well. This todo is telling me I should\n # code up the plank to walk.\n # \n # No code follows save for the end of the method, but the comment should still \n # appear paired with a block of code.\n \n end", "def log descript, &block\n puts \"Starting \\\"#{descript}\\\"...\"\n result = block.call\n puts \"...ended the #{descript.inspect}. Returning: #{result}\"\nend", "def t__73!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 18)\n\n type = T__73\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 24:9: '::'\n match(\"::\")\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 18)\n\n end", "def browser_block\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 26 )\n return_value = BrowserBlockReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n char_literal102 = nil\n string_literal105 = nil\n browser_name103 = nil\n statement_block104 = nil\n block106 = nil\n\n tree_for_char_literal102 = nil\n tree_for_string_literal105 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 417:5: '!' browser_name statement_block ( 'else' block )?\n char_literal102 = match( NOT, TOKENS_FOLLOWING_NOT_IN_browser_block_2757 )\n if @state.backtracking == 0\n\n tree_for_char_literal102 = @adaptor.create_with_payload( char_literal102 )\n @adaptor.add_child( root_0, tree_for_char_literal102 )\n\n end\n @state.following.push( TOKENS_FOLLOWING_browser_name_IN_browser_block_2759 )\n browser_name103 = browser_name\n @state.following.pop\n if @state.backtracking == 0\n root_0 = @adaptor.become_root( browser_name103.tree, root_0 )\n end\n @state.following.push( TOKENS_FOLLOWING_statement_block_IN_browser_block_2762 )\n statement_block104 = statement_block\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, statement_block104.tree )\n end\n # at line 417:39: ( 'else' block )?\n alt_20 = 2\n look_20_0 = @input.peek( 1 )\n\n if ( look_20_0 == ELSE )\n alt_20 = 1\n end\n case alt_20\n when 1\n # at line 417:41: 'else' block\n string_literal105 = match( ELSE, TOKENS_FOLLOWING_ELSE_IN_browser_block_2766 )\n @state.following.push( TOKENS_FOLLOWING_block_IN_browser_block_2769 )\n block106 = block\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, block106.tree )\n end\n\n end\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 26 )\n\n end\n \n return return_value\n end", "def t__25!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 14 )\n\n type = T__25\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 30:9: 'i'\n match( 0x69 )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 14 )\n\n end", "def greeting(&block)\n puts 'good morning'\n text = block.call('hello')\n puts text\n puts 'good evening'\nend", "def greeting(&block)\n puts 'good morning'\n text = block.call('hello')\n puts text\n puts 'good evening'\nend", "def t__19!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 12 )\n\n type = T__19\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 28:9: 'l'\n match( 0x6c )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 12 )\n\n end", "def meth5(&block)\n p block_given?\nend", "def t__87!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 32)\n\n type = T__87\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 38:9: '~'\n match(?~)\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 32)\n\n end", "def read_block_text(name, containers, contents)\n i = -1\n in_block = false\n block_indentation = nil\n block_end_token = nil\n chunk = nil\n contents.each_line do |line|\n if line =~ /^(\\s*)#{name}\\s*.*?(({|do|->\\s*{|lambda\\s*{)(.*))/\n block_indentation, text = $1, $2\n i += 1\n chunk = containers[i].code_chunk\n chunk.text = text + \"\\n\"\n in_block = true\n block_end_token = case text\n when /^{/\n \"}\"\n when /^do\\b/\n \"end\"\n when /^(->|lambda)\\s*({|do)/\n $2 == \"{\" ? \"}\" : \"end\"\n else\n \"}|end\" # regex\n end\n elsif in_block\n line =~ /^(\\s*)(.*)/\n indentation, text = $1, $2\n if indentation.length <= block_indentation.length\n if text =~ /^#{block_end_token}/\n chunk.text << line\n end\n in_block = false\n else\n chunk.text << line\n end\n end\n end\n containers.each do |thing|\n text = thing.code_chunk.text\n text.strip! if text\n end\n end", "def call_block\r\n puts \"Start of method\"\r\n yield\r\n yield\r\n puts \"End of method\"\r\nend", "def t__89!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 34)\n\n type = T__89\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 40:9: '>'\n match(?>)\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 34)\n\n end", "def puts_this_block\n puts yield\nend", "def tell; @next_block_pos end", "def block\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 14 )\n return_value = BlockReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n lp = nil\n rp = nil\n char_literal76 = nil\n char_literal78 = nil\n opts = nil\n altpair77 = nil\n altpair79 = nil\n\n tree_for_lp = nil\n tree_for_rp = nil\n tree_for_char_literal76 = nil\n tree_for_char_literal78 = nil\n stream_T__81 = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token T__81\" )\n stream_T__82 = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token T__82\" )\n stream_T__83 = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token T__83\" )\n stream_T__78 = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token T__78\" )\n stream_altpair = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule altpair\" )\n stream_options_spec = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule options_spec\" )\n begin\n # at line 185:9: lp= '(' ( (opts= options_spec )? ':' )? altpair ( '|' altpair )* rp= ')'\n lp = match( T__81, TOKENS_FOLLOWING_T__81_IN_block_1119 )\n if @state.backtracking == 0\n stream_T__81.add( lp )\n end\n # at line 186:3: ( (opts= options_spec )? ':' )?\n alt_31 = 2\n look_31_0 = @input.peek( 1 )\n\n if ( look_31_0 == OPTIONS || look_31_0 == T__78 )\n alt_31 = 1\n end\n case alt_31\n when 1\n # at line 186:5: (opts= options_spec )? ':'\n # at line 186:5: (opts= options_spec )?\n alt_30 = 2\n look_30_0 = @input.peek( 1 )\n\n if ( look_30_0 == OPTIONS )\n alt_30 = 1\n end\n case alt_30\n when 1\n # at line 186:6: opts= options_spec\n @state.following.push( TOKENS_FOLLOWING_options_spec_IN_block_1128 )\n opts = options_spec\n @state.following.pop\n if @state.backtracking == 0\n stream_options_spec.add( opts.tree )\n end\n\n end\n char_literal76 = match( T__78, TOKENS_FOLLOWING_T__78_IN_block_1132 )\n if @state.backtracking == 0\n stream_T__78.add( char_literal76 )\n end\n\n end\n @state.following.push( TOKENS_FOLLOWING_altpair_IN_block_1139 )\n altpair77 = altpair\n @state.following.pop\n if @state.backtracking == 0\n stream_altpair.add( altpair77.tree )\n end\n # at line 187:11: ( '|' altpair )*\n while true # decision 32\n alt_32 = 2\n look_32_0 = @input.peek( 1 )\n\n if ( look_32_0 == T__82 )\n alt_32 = 1\n\n end\n case alt_32\n when 1\n # at line 187:13: '|' altpair\n char_literal78 = match( T__82, TOKENS_FOLLOWING_T__82_IN_block_1143 )\n if @state.backtracking == 0\n stream_T__82.add( char_literal78 )\n end\n @state.following.push( TOKENS_FOLLOWING_altpair_IN_block_1145 )\n altpair79 = altpair\n @state.following.pop\n if @state.backtracking == 0\n stream_altpair.add( altpair79.tree )\n end\n\n else\n break # out of loop for decision 32\n end\n end # loop for decision 32\n rp = match( T__83, TOKENS_FOLLOWING_T__83_IN_block_1160 )\n if @state.backtracking == 0\n stream_T__83.add( rp )\n end\n # AST Rewrite\n # elements: altpair, options_spec\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 189:9: -> ^( BLOCK[$lp,\\\"BLOCK\\\"] ( options_spec )? ( altpair )+ EOB[$rp,\\\"EOB\\\"] )\n # at line 189:12: ^( BLOCK[$lp,\\\"BLOCK\\\"] ( options_spec )? ( altpair )+ EOB[$rp,\\\"EOB\\\"] )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( @adaptor.create( BLOCK, lp, \"BLOCK\" ), root_1 )\n\n # at line 189:34: ( options_spec )?\n if stream_options_spec.has_next?\n @adaptor.add_child( root_1, stream_options_spec.next_tree )\n\n end\n\n stream_options_spec.reset();\n # at line 189:48: ( altpair )+\n stream_altpair.has_next? or raise ANTLR3::RewriteEarlyExit\n\n while stream_altpair.has_next?\n @adaptor.add_child( root_1, stream_altpair.next_tree )\n\n end\n stream_altpair.reset\n @adaptor.add_child( root_1, @adaptor.create( EOB, rp, \"EOB\" ) )\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n return_value.tree = root_0\n\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 14 )\n\n end\n \n return return_value\n end", "def block_sample\n p \"AAA\"\n yield\n p \"BBB\"\nend", "def source_line; end", "def block_node; end", "def block_node; end", "def caller\n %x{\n function getErrorObject(){\n try { throw Error('') } catch(err) { return err; }\n }\n\n\n var err = getErrorObject();\n }\n stack = `err.stack`\n caller_lines = stack.split(\"\\n\")[4..-1]\n caller_lines.reject! { |l| l.strip.empty? }\n\n result_formatter = lambda do |filename, line, method=nil|\n \"#{filename}:#{line} in `(#{method ? method : 'unknown method'})'\"\n end\n\n caller_lines.map do |raw_line|\n if match = /\\s*at (.*) \\((\\S+):(\\d+):\\d+/.match(raw_line)\n method, filename, line = match.captures\n result_formatter[filename, line, method]\n elsif match = /\\s*at (\\S+):(\\d+):\\d+/.match(raw_line)\n filename, line = match.captures\n result_formatter[filename, line]\n # catch phantom/no 2nd line/col #\n elsif match = /\\s*at (.*) \\((\\S+):(\\d+)/.match(raw_line)\n method, filename, line = match.captures\n result_formatter[filename, line, method]\n elsif match = /\\s*at (.*):(\\d+)/.match(raw_line)\n filename, line = match.captures\n result_formatter[filename, line]\n # Firefox - Opal.modules[\"rspec/core/metadata\"]/</</</</def.$populate@http://192.168.59.103:9292/assets/rspec/core/metadata.self.js?body=1:102:13\n elsif match = /(.*?)@(\\S+):(\\d+):\\d+/.match(raw_line)\n method, filename, line = match.captures\n result_formatter[filename, line, method]\n # webkit - http://192.168.59.103:9292/assets/opal/rspec/sprockets_runner.js:45117:314\n elsif match = /(\\S+):(\\d+):\\d+/.match(raw_line)\n filename, line = match.captures\n result_formatter[filename, line]\n else\n \"#{filename}:-1 in `(can't parse this stack trace)`\"\n end\n end\n end", "def start_bridge_quest\n slowly do\n\"\"\"\nWhat should Duncan do? \n There's bacon!! Dash across that bridge and hunt! -- Press 1\n Carefully approach and investigate the scenario. -- Press 2\n Use special power! -- Press 3\n\"\"\" \n end\n end", "def miltiple_pass\n puts \"Inside the method\"\n yield\n puts \"Back inside the method\"\n yield\nend", "def runner(&blk); end", "def runner(&blk); end", "def block\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 14)\n return_value = BlockReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n lp = nil\n rp = nil\n char_literal76 = nil\n char_literal78 = nil\n opts = nil\n altpair77 = nil\n altpair79 = nil\n\n tree_for_lp = nil\n tree_for_rp = nil\n tree_for_char_literal76 = nil\n tree_for_char_literal78 = nil\n stream_T__81 = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token T__81\")\n stream_T__82 = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token T__82\")\n stream_T__83 = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token T__83\")\n stream_T__78 = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token T__78\")\n stream_altpair = ANTLR3::AST::RewriteRuleSubtreeStream.new(@adaptor, \"rule altpair\")\n stream_options_spec = ANTLR3::AST::RewriteRuleSubtreeStream.new(@adaptor, \"rule options_spec\")\n begin\n # at line 194:9: lp= '(' ( (opts= options_spec )? ':' )? altpair ( '|' altpair )* rp= ')'\n lp = match(T__81, TOKENS_FOLLOWING_T__81_IN_block_1124) \n if @state.backtracking == 0\n stream_T__81.add(lp)\n end\n # at line 195:3: ( (opts= options_spec )? ':' )?\n alt_31 = 2\n look_31_0 = @input.peek(1)\n\n if (look_31_0 == OPTIONS || look_31_0 == T__78) \n alt_31 = 1\n end\n case alt_31\n when 1\n # at line 195:5: (opts= options_spec )? ':'\n # at line 195:5: (opts= options_spec )?\n alt_30 = 2\n look_30_0 = @input.peek(1)\n\n if (look_30_0 == OPTIONS) \n alt_30 = 1\n end\n case alt_30\n when 1\n # at line 195:6: opts= options_spec\n @state.following.push(TOKENS_FOLLOWING_options_spec_IN_block_1133)\n opts = options_spec\n @state.following.pop\n if @state.backtracking == 0\n stream_options_spec.add(opts.tree)\n end\n\n end\n char_literal76 = match(T__78, TOKENS_FOLLOWING_T__78_IN_block_1137) \n if @state.backtracking == 0\n stream_T__78.add(char_literal76)\n end\n\n end\n @state.following.push(TOKENS_FOLLOWING_altpair_IN_block_1144)\n altpair77 = altpair\n @state.following.pop\n if @state.backtracking == 0\n stream_altpair.add(altpair77.tree)\n end\n # at line 196:11: ( '|' altpair )*\n loop do #loop 32\n alt_32 = 2\n look_32_0 = @input.peek(1)\n\n if (look_32_0 == T__82) \n alt_32 = 1\n\n end\n case alt_32\n when 1\n # at line 196:13: '|' altpair\n char_literal78 = match(T__82, TOKENS_FOLLOWING_T__82_IN_block_1148) \n if @state.backtracking == 0\n stream_T__82.add(char_literal78)\n end\n @state.following.push(TOKENS_FOLLOWING_altpair_IN_block_1150)\n altpair79 = altpair\n @state.following.pop\n if @state.backtracking == 0\n stream_altpair.add(altpair79.tree)\n end\n\n else\n break #loop 32\n end\n end\n rp = match(T__83, TOKENS_FOLLOWING_T__83_IN_block_1165) \n if @state.backtracking == 0\n stream_T__83.add(rp)\n end\n # AST Rewrite\n # elements: options_spec, altpair\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream(\"rule return_value\", return_value.tree) : subtree_stream(\"token return_value\")\n\n root_0 = @adaptor.create_flat_list!\n # 198:9: -> ^( BLOCK[$lp,\\\"BLOCK\\\"] ( options_spec )? ( altpair )+ EOB[$rp,\\\"EOB\\\"] )\n # at line 198:12: ^( BLOCK[$lp,\\\"BLOCK\\\"] ( options_spec )? ( altpair )+ EOB[$rp,\\\"EOB\\\"] )\n root_1 = @adaptor.create_flat_list!\n root_1 = @adaptor.become_root(@adaptor.create!(BLOCK, lp, \"BLOCK\"), root_1)\n\n # at line 198:34: ( options_spec )?\n if stream_options_spec.has_next?\n @adaptor.add_child(root_1, stream_options_spec.next_tree)\n\n end\n\n stream_options_spec.reset();\n # at line 198:48: ( altpair )+\n unless stream_altpair.has_next?\n raise ANTLR3::RewriteEarlyExit\n end\n\n while stream_altpair.has_next?\n @adaptor.add_child(root_1, stream_altpair.next_tree)\n\n end\n\n stream_altpair.reset\n @adaptor.add_child(root_1, @adaptor.create!(EOB, rp, \"EOB\"))\n\n @adaptor.add_child(root_0, root_1)\n\n\n\n return_value.tree = root_0\n\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look(-1)\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing(root_0)\n @adaptor.set_token_boundaries(return_value.tree, return_value.start, return_value.stop)\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node!(@input, return_value.start, @input.look(-1), re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 14)\n\n end\n \n return return_value\n end", "def blocklists; end", "def block_method_3\n yield\nend", "def block_method_3\n yield\nend", "def block_method_3\n yield\nend", "def block_method_3\n yield\nend", "def block_method_3\n yield\nend", "def sup_bro\n puts \"This is before a block!\"\n name = \"Katy\"\n yield(name)\n puts \"This is after a block!\"\nend", "def t__49!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 38 )\n\n type = T__49\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 54:9: 'a'\n match( 0x61 )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 38 )\n\n end" ]
[ "0.650154", "0.61886084", "0.61757696", "0.61757696", "0.61757696", "0.6162162", "0.6117942", "0.59934926", "0.5955436", "0.59343284", "0.59130865", "0.5893949", "0.58860874", "0.58098376", "0.58098376", "0.575122", "0.57492626", "0.5723304", "0.57169354", "0.5715587", "0.5710331", "0.5708477", "0.5702852", "0.57022774", "0.5701032", "0.568294", "0.56737673", "0.5651859", "0.5651718", "0.5645225", "0.5645225", "0.5644996", "0.56416655", "0.56416655", "0.56416655", "0.56416655", "0.56416655", "0.56416655", "0.56416655", "0.56416655", "0.56416655", "0.56416655", "0.56416655", "0.56416655", "0.56416655", "0.56416655", "0.56416655", "0.56416655", "0.56416655", "0.56416655", "0.56416655", "0.56416655", "0.562636", "0.5623745", "0.56185484", "0.5612922", "0.55897915", "0.5588239", "0.55839133", "0.5577978", "0.5576135", "0.5576002", "0.5573205", "0.55680346", "0.55486286", "0.55462563", "0.5542956", "0.5538543", "0.5531385", "0.553124", "0.5527659", "0.55267394", "0.55267394", "0.55226386", "0.55187225", "0.55151665", "0.5506408", "0.5503055", "0.5500108", "0.5496326", "0.5485358", "0.5481412", "0.54797065", "0.5479447", "0.54773206", "0.54773206", "0.547283", "0.54693925", "0.5463936", "0.54590786", "0.54590786", "0.5457611", "0.54570967", "0.5456462", "0.5456462", "0.5456462", "0.5456462", "0.5456462", "0.5451754", "0.5450426" ]
0.56079566
56
Use the & notation when calling a method to put a block into the method's block slot.
def meth2(&block) "#{meth1(&block)} (meth2: #{block.call})" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def my_method(&my_block)\n\n puts \"hello method\"\n\n my_block.call\n\n return my_block\n\nend", "def test(&block)\n puts \"&block is, #{block}\"\nend", "def my_method(&my_block)\n\tputs \"We're in the method, about to invoke your block!\"\n\tmy_block.call\n\tputs \"We're back in the method!\"\nend", "def my_method(&my_block)\n puts \"hello method\"\n my_block.call\n return my_block\nend", "def my_method(&my_block)\n puts 'from my_method : before calling call method on my_block'\n my_block.call # call method calls the block\n puts 'from my_method : after calling call method on my_block'\n my_block.call\nend", "def test(&block)\n puts \"What's &block? #{block}\"\nend", "def test(&block)\n puts \"What's &block? #{block}\"\nend", "def method &block, a\r\n\t1\r\nend", "def my_method(&block)\n block.call # .call to invoke the block\nend", "def method_that_takes_a_block(&blk)\n p blk.call(\"hello\")\n p blk.call(\"World!\")\nend", "def a_method(&block)\n block\nend", "def call_block(&block)\n block.call\nend", "def BlocksAndMethods(&argumento)\n\targumento.call\nend", "def met(&block)\n puts \"This is method\"\n block.call\nend", "def hello(&block)\n puts block\n block.call\nend", "def my_method1(&the_proc) # Convert Block to Proc\n puts the_proc.call(\"Bill\") # Use as Proc, just drop \"&\" and you will receive the block\n puts yield(\"Bill\") # Use as Block\nend", "def give(&my_block)\n my_block.call(\"2 turtle doves\", \"1 partridge\")\nend", "def use_block(obj, &method)\n\tmethod.call\nend", "def test(&block) # converts the argument to a \"simple\" Proc object\n puts \"What's &block? It's #{block}\" # can be called anything\nend", "def give(&my_block)\n my_block.call(\"2 turtle doves\", \"1 partridge\")\nend", "def method &block\r\n\t1\r\nend", "def method &block\r\n\t1\r\nend", "def meth1(&block)\n \"(meth1: #{block.call})\"\nend", "def method a, *b, &block\r\n\t1\r\nend", "def callBlock\n yield\n yield\nend", "def indirect &b\n call_block &b\nend", "def indirect &b\n call_block &b\nend", "def foo3(&block)\n block.call(1) \nend", "def foo(&bar)\n bar.call\nend", "def method &block \r\n\t1\r\nend", "def method a, &b\r\n\t1\r\nend", "def method a, &b\r\n\t1\r\nend", "def method a, &b\r\n\t1\r\nend", "def method a, &b\r\n\t1\r\nend", "def foo(&block)\n a = 2\n block.call(a)\nend", "def ampersand(&block)\n block.call\n yield\nend", "def foo(&b)\r\n b.call\r\nend", "def twice(&my_block)\n puts \"In the method, about to call the block!\"\n my_block.call #call the block\n puts \"Back in the method, about to call the block again!\"\n my_block.call #call the block again\n puts \"Back in the method, about to return!\"\nend", "def method a, &block\r\n\t1\r\nend", "def callBlock\n yield # Invokes block\n yield # Invokes block again\nend", "def test(&block)\n block.call\nend", "def test(&block)\n block.call\nend", "def block_method2(&block)\n block.call\nend", "def method_1 nombre, &bloque\n yield if block_given? # bloque.call if block_given? #llamamos a nuestro bloque\nend", "def hello(&block)\n puts \"Hello #{block.call}\" if block_given?\nend", "def hello(&block)\n puts \"Hello #{block.call}\" if block_given?\nend", "def method3(&block)\n if block\n \"The block evaluates to #{block.call}\"\n else\n \"No block.\"\n end\nend", "def method3(&block)\n if block\n \"The block evaluates to #{block.call}\"\n else\n \"No block.\"\n end\nend", "def method_with_block_parameter &provided_block_proc\n puts provided_block_proc.class\n provided_block_proc.call(\"called from method\")\n yield \"called from method with yield\"\nend", "def method2 (&block)\n return \"ERROR Method2: no block given\" if block.nil?\n block.call\n block.call\n block.call\nend", "def hello_world(&block)\n puts block.call\nend", "def foo(name, &block)\n @name = name\n block.call\nend", "def test2(block)\n puts \"hello\"\n block.call # calls the block that was originally passed to test()\n puts \"good-bye\"\nend", "def another_work(&another_block)\n ## Passing the parameters to the block\n puts(\"Hey I am in the function\")\n another_block.call(4, 2)\n puts(\"Hey I am back in the function\")\n another_block.call(5, 3)\nend", "def block_example(&block)\n does block\n end", "def callBlock\n yield ,\n end", "def call_this(&block)\n block.call\nend", "def my_method(&the_proc)\n the_proc\nend", "def showInfo(&block)\n block\nend", "def meth5(&block)\n p block_given?\nend", "def call_block\r\n puts \"Start of method\"\r\n yield\r\n yield\r\n puts \"End of method\"\r\nend", "def call_block\n\tputs \"Start of method\"\n\tyield\n\tyield\n\tputs \"End of method\"\nend", "def greeting(&block)\n puts 'good morning'\n text = block.call('hello')\n puts text\n puts 'good evening'\nend", "def greeting(&block)\n puts 'good morning'\n text = block.call('hello')\n puts text\n puts 'good evening'\nend", "def method a, &block, *c\r\n\t1\r\nend", "def say_hello(&block)\n puts \"Hello world\"\n name = block.call\n puts \"You entered #{name} as your name\"\nend", "def set_block &b\n @block = b\n end", "def remember(&a_block)\r\n @block = a_block\r\nend", "def test(&block)\n puts \"inside test -- calling block\"\n block.call\n puts \"inside test -- after calling block\"\n yield\nend", "def blockFun2(arg1, &aBlock)\n if aBlock\n aBlock.call(arg1)\n \"HAVE BLOCK\"\n else\n \"NO BLOCK\"\n end\nend", "def procasaurus( &block )\n\tputs \"I am a procasaurus.\"\n\tputs block.class\n\t# note the proc must be the last parameter and must start with ampersand\nend", "def method_with_block\n yield\nend", "def call_a_proc(&block)\n block.call\nend", "def call(method, params = [], &blk)\n id = self.next_id()\n self.send(msg: 'method', id: id, method: method, params: params)\n @callbacks[id] = blk\n end", "def calculation(a, b, &block) # &block is an explicit (named) parameter\n block.call(a, b)\nend", "def MyBlockMethod()\n puts \"At the top of the method\"\n\tyield\n\tputs \"At the bottom of the method\"\nend", "def talk_about(name, &myproc) #so ruby (and us) know we are adding a proc prefix it with a ambersand &\n puts \"Let me tell you about #{name}\"\n myproc.call(name) #in the body it doesnt need a ambersand & only in the definition\nend", "def an(objName,&block)\n a(objName) {block.call}\nend", "def execute(block) # the syntax requires an & in the paramater name.\n \t block.call\n\tend", "def proc_method(&my_proc)\n puts \"method start\"\n my_proc.call\n puts \"method end\"\nend", "def i_take_an_explicit_block &block\n puts block.inspect\nend", "def method_with_explicit_block(&block)\n block.call(10)\n end", "def call_block\n @_block.call(self) if @_block\n end", "def m12a(p1,p2,p3, &blk)\n\tyield(p1,p2) # два параметра передаем в блок\n\tputs \"The third parameter is #{p3}\" # один параметр испоьзуем прямо тут\nend", "def method_with_block_arguments\n yield(\"Bob\")\nend", "def baz(name, &block)\n @name = name\n block.call\nend", "def call_block \n yield('hello', 99) \nend", "def call_block \n yield('hello', 99) \nend", "def m(&b)\n b.call(100)\nend", "def block=(_arg0); end", "def block=(_arg0); end", "def with_block(&block)\n end", "def wrapping_block(method_name, **defaults)\n proc do |*args, **values|\n send method_name, *args, **defaults, **values\n end\n end", "def block_test\n\n puts \"We're in the method!\"\n puts \"Yielding to the block...\"\n yield #this expression allows the method to receive and execute a block\n puts \"We're back in the method!\"\nend", "def block_to_proc(&p)\n\tp.call\nend", "def hello(&block)\n\tblock.call if block_given?\nend", "def call_meeee(number, zumba, &block)\n block.call()\n block.call\nend", "def two_times_explicit (&i_am_a_block) \n return \"No block\" if i_am_a_block.nil? \n i_am_a_block.call \n i_am_a_block.call \nend", "def bound_method(block); end", "def call_block\n yield('hello', 99)\nend" ]
[ "0.7573938", "0.7548392", "0.75375235", "0.7513926", "0.74356765", "0.73322695", "0.73322695", "0.72596854", "0.71670455", "0.7054961", "0.6978364", "0.697778", "0.6921715", "0.6912085", "0.68967754", "0.6886171", "0.6822572", "0.6808932", "0.6804089", "0.67838067", "0.6748731", "0.6748731", "0.6746174", "0.67393017", "0.67315805", "0.6723612", "0.6723612", "0.67038083", "0.6693199", "0.6684517", "0.6669691", "0.6669691", "0.6669691", "0.6669691", "0.66480494", "0.6645167", "0.6644499", "0.66380656", "0.6632739", "0.66241467", "0.6614249", "0.6614249", "0.66029024", "0.65937597", "0.65897334", "0.65897334", "0.65653676", "0.65653676", "0.65467757", "0.6490833", "0.6450584", "0.64255327", "0.6418638", "0.64096934", "0.6407157", "0.63801616", "0.637371", "0.6348274", "0.63305646", "0.63260573", "0.6324532", "0.6298115", "0.6280163", "0.6280163", "0.6266427", "0.6253231", "0.6231287", "0.6229591", "0.6222369", "0.6220828", "0.6217051", "0.6195149", "0.6176089", "0.61621284", "0.61500156", "0.6141857", "0.6140192", "0.6138724", "0.61197543", "0.6117792", "0.61148345", "0.6101488", "0.6090268", "0.60879153", "0.6087882", "0.6087728", "0.6082872", "0.6082872", "0.6079982", "0.6059271", "0.6059271", "0.6056616", "0.60454804", "0.60304344", "0.6008477", "0.6002384", "0.5999237", "0.59984595", "0.59923345", "0.599177" ]
0.64310145
51
=> "(meth1: 10) (meth2: 20)" END /Users/joekelly/Desktop/Projects/rubykickstart/session3/notes/16optionalparams.rb file content is listed below You have already seen ordinal parameters, they have a name and are mandatory. But you can make them optional by giving them an equal sign, and listing a default value.
def same_case(str, upcase = true) return str.upcase if upcase str.downcase end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def meth(\n arg1,\n arg2 , arg3 = 7 , *rest,\n\n\n last,\n required:,\n not_required: 7, **options)\nend", "def meth(\n arg1,\n arg2 , arg3 = 7 , *rest,\n\n\n last,\n required:,\n not_required: 7, **options)\nend", "def optionalParameters(a,b,*c)\n #some code\nend", "def defVals(par1, opt1 = \"optional one applied\", opt2 = \"optional two applied\") \n puts \"First parameter => #{par1}\"\n puts \"Second parameter => #{opt1}\"\n puts \"Third parameter => #{opt2}\"\nend", "def two_arg_method_defaults(arg1=0, arg2=\"020202\")\n puts \"Here are my args: #{arg1}, #{arg2}\"\nend", "def arguments(required, *optional)\n puts \"required: #{required}\"\n puts \"optional: #{optional}\"\nend", "def optional_positionals; end", "def method8(x: nil, y: nil, z: nil)\r\n p x, y, z\r\nend", "def parse_optional(method_def, argument)\n method_def.scan(/#{argument}\\s*=\\s*(\"[^\"\\r\\n]*\"|'[^'\\r\\n]*'|[0-9]*)/)[0][0]\n end", "def parse_optional(method_def, argument)\n method_def.scan(/#{argument}\\s*=\\s*(\"[^\"\\r\\n]*\"|'[^'\\r\\n]*'|[0-9]*)/)[0][0]\n end", "def test_Method_InstanceMethods_parameters\n\t\tdef m(a,b=1,*c,&d); end\n\t\t# TODO, assert_equal([[:req,:a],[:opt,:b],[:rest,:c],[:block,:d]], method(:m).parameters)\n\tend", "def my_method(first: nil, second: nil)\n puts \"First is #{first} and second is #{second}\"\nend", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def parameters; end", "def parameters; end", "def parameters; end", "def parameters; end", "def parameters; end", "def parameters; end", "def parameters; end", "def parameters; end", "def _define_roda_method_arg_numbers(callable)\n optional_args = 0\n rest = false\n keyword = false\n callable.parameters.map(&:first).each do |arg_type, _|\n case arg_type\n when :opt\n optional_args += 1\n when :rest\n rest = true\n when :keyreq\n keyword = :required\n when :key, :keyrest\n keyword ||= true\n end\n end\n arity = callable.arity\n if arity < 0\n arity = arity.abs - 1\n end\n required_args = arity\n arity -= 1 if keyword == :required\n\n if callable.is_a?(Proc) && !callable.lambda?\n optional_args -= arity\n end\n\n [required_args, optional_args, rest, keyword]\n end", "def my_method(a, b, d, c: 3)\n # p [a, b, c, d]\n p a: a, b: b, c: c, d: d\nend", "def print_missing_sec_arg\n puts ARGV[0] + \" requires second argument\"\n print_usage\nend", "def parse_arguments(parameters)\n parameter_string = \"\"\n method_definition = nil\n parameters.each do |parameter|\n arg_type = parameter[0]\n arg = parameter[1]\n case arg_type\n when :req\n parameter_string += \" #{arg}\"\n when :opt\n if Commandable.verbose_parameters\n # figure out what the default value is\n method_definition ||= readline(@@method_file, @@method_line)\n default = parse_optional(method_definition, arg)\n parameter_string += \" [#{arg}=#{default}]\"\n else\n parameter_string += \" [#{arg}]\"\n end\n when :rest\n parameter_string += \" *#{arg}\"\n when :block\n parameter_string += \" &#{arg}\"\n end\n end\n parameter_string.strip\n end", "def method (number, default1 = 1, default2 = 2)\nend", "def my_method(a: 1, b: 2, c: 3)\n p a: a, b: b, c: c\nend", "def my_method(a, b = 2, c = 3, d)\n p [a, b, c, d]\nend", "def my_method(a, b = 2, c = 3, d)\n p [a, b, c, d]\nend", "def my_method(a, b = 2, c = 3, d)\n p [a, b, c, d]\nend", "def my_method(a, b = 2, c = 3, d)\n p [a, b, c, d]\nend", "def my_method(a, b = 2, c = 3, d)\n p [a, b, c, d]\nend", "def my_method(a, b = 2, c = 3, d)\n p [a, b, c, d]\nend", "def my_method(a, b = 2, c = 3, d)\n p [a, b, c, d]\nend", "def meth(ordinal, optional=true, *variable_length, &block)\nend", "def meth(ordinal, optional=true, *variable_length, &block)\nend", "def optional_params\n return {}\n end", "def optional_parameters(method)\n select_parameters_by_type(method, :opt)\n end", "def parameters=(_arg0); end", "def my_method(a, b=2, c=3,d)\n p [a,b,c,d]\nend", "def my_method(a, b = 2, c = 3, d)\r\n p [a, b, c, d]\r\n end", "def required_args\n @required_args || 0\n end", "def required_positionals; end", "def q1 *rest\n puts \"The number of parameters is #{rest.length}.\"\n puts rest\nend", "def description=(_arg0); end", "def description=(_arg0); end", "def description=(_arg0); end", "def %(arg0)\n end", "def %(arg0)\n end", "def first_argument_index\n 2\n end", "def my_method (a, b = 2, c = 3, d)\r\n p [a, b, c, d]\r\n end", "def params=(_arg0); end", "def params=(_arg0); end", "def method_argument_names\n name, usage = current_method_info\n results = usage.split(name.gsub(/_/,'-')).last || \"\"\n return results.split(' ')\n end", "def default_args(a,b,c=1)\n puts \"\\nValues of variables: \",a,b,c\nend", "def meth( *args, second_to_last,last\n )\nend", "def get_opt_param_names\n oparams = []\n i = 1\n while !params[:oparams_.to_s + \"#{i}\"].nil?\n oparams << params[:oparams_.to_s + \"#{i}\"]\n i += 1\n end\n oparams\n end", "def method (a=3,\r\n\tb)\r\nend", "def additional_params(args)\n k, keys = 0, []\n args.each do |arg|\n k += 1\n next if k <= 2\n keys << arg\n end\n if keys == []\n raise TypeError, Ajaila::Messager.warning(\"\\\"#{args[1]}\\\" #{args[0]} should have table and file (ex. ajaila g selector Wow file:in.csv table:Output). Don't forget to put file inside datasets directory and generate table before that.\") if args[0] == \"selector\"\n raise TypeError, Ajaila::Messager.warning(\"\\\"#{args[1]}\\\" #{args[0]} should have tables for input and output (ex. ajaila g miner Foo table:FooTable table:Yamy)\") if args[0] == \"miner\"\n raise TypeError, Ajaila::Messager.warning(\"\\\"#{args[1]}\\\" #{args[0]} needs additional parameters to be specified\") if args[0] == \"presenter\"\n raise TypeError, Ajaila::Messager.warning(\"\\\"#{args[1]}\\\" #{args[0]} should have columns (ex. ajaila g table MyTable name:String age:Integer birth:Time)\") if args[0] == \"table\"\n end\n return keys\n end", "def optional_parameters\n must_be_defined_in_derived_class\n end", "def method (a=3, b=4)\r\nend", "def do_something(par_1, par_2, par_3)\n\n\nend", "def other_method(name:, age:)\n puts \"Person #{name} is aged #{age}.\"\n # It's an error to call this method without specifying\n # values for name and age.\nend", "def optional_params(*args)\n raise InvalidRequiredParameters unless args.all? { |arg| arg.is_a?(Symbol) }\n\n @params.keys.each do |key|\n puts \":#{key} is unused parameter.\" unless args.include?(key)\n end\n @params.slice!(*args)\n end", "def acceptable_argument_count\n parameters = @object.method(@method).parameters\n min_args = parameters.select{ |arg| arg[0] == :req }.count\n if parameters.any? { |arg| arg[0] == :rest }\n max_args = Float::INFINITY\n else\n max_args = parameters.count\n end\n (min_args..max_args)\n end", "def optional_keywords; end", "def parse_parameters; end", "def arguments; end", "def arguments; end", "def arguments; end", "def parameter_string\n\t\tend", "def nothing(p1=1,p2=2,p3=3)\nend", "def required_defaults; end", "def params(*); {}; end", "def greet time:, name: # The : following the parameter is what makes these keyword parameters that accept keyword arguments\n puts \"Good #{time}, #{name}!\"\nend", "def method(arg_1, arg_2)\n p arg_1\n p arg_2\nend", "def do_something(par1, par2, par3)\nend", "def do_something(par1, par2, par3)\nend", "def atk; param(2); end", "def optional_parameters\n @optional_parameters ||= ((self.parameter_descriptions.reject do |k, v|\n v['required']\n end).inject({}) { |h,(k,v)| h[k]=v; h }).keys\n end", "def optional_parameters\n definition_lambda.parameters.select { |key,_value| key == :key }.map { |_key,value| value }\n end", "def alphabet(arg1 = \"Alpha\", arg2 = \"Beta\")\n puts \"The Parameter is #{arg1}\"\n puts \"The Parameter is #{arg2}\"\nend", "def method_name_with_defined_argument(method_arguments = 123)\n puts(method_arguments)\nend", "def optional; end", "def useParams(a, b = a * 10, c = a + 1)\n puts \"a=\" + a.to_s + \", b=\" + b.to_s + \", c=\" + c.to_s\nend" ]
[ "0.66978526", "0.66974586", "0.6162105", "0.6040979", "0.6006214", "0.5782017", "0.5755491", "0.57421666", "0.5708149", "0.5708149", "0.56824064", "0.5667428", "0.56643385", "0.56643385", "0.56643385", "0.56643385", "0.56643385", "0.56643385", "0.56643385", "0.56643385", "0.56643385", "0.56643385", "0.56643385", "0.56643385", "0.56643385", "0.56643385", "0.56643385", "0.56643385", "0.56643385", "0.5652198", "0.5652198", "0.5652198", "0.5652198", "0.5652198", "0.5652198", "0.5652198", "0.5652198", "0.56390375", "0.5637147", "0.5612289", "0.5609085", "0.557657", "0.554877", "0.5527871", "0.5527871", "0.5527871", "0.5527871", "0.5527871", "0.5527871", "0.5527871", "0.552236", "0.552236", "0.552234", "0.5520145", "0.5517306", "0.5516078", "0.5513602", "0.54983", "0.54976314", "0.5477447", "0.54629", "0.54629", "0.54629", "0.5456326", "0.5456326", "0.5439734", "0.54393333", "0.54227203", "0.54227203", "0.54187685", "0.5414934", "0.54143363", "0.54072714", "0.5399276", "0.5394621", "0.5381688", "0.537259", "0.5371552", "0.5369556", "0.5368489", "0.5364289", "0.53624374", "0.5359611", "0.5358922", "0.5358922", "0.5358922", "0.5355678", "0.53435767", "0.533837", "0.5325255", "0.53234166", "0.53195244", "0.53137505", "0.53137505", "0.5309276", "0.5294917", "0.5294283", "0.5267776", "0.5266642", "0.52622986", "0.5261178" ]
0.0
-1
=> "upper lower" optional parameters must go to the right of ordinal parameters, and are filled in from the left
def what_are_filled_in(a=5, b=4, c=3, d=2, e=1) "#{a} #{b} #{c} #{d} #{e}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def order=(_arg0); end", "def method(a, b=-2, *c)\r\nend", "def sort_params=(_arg0); end", "def sort_params=(_arg0); end", "def meth(ordinal, optional=true, *variable_length, &block)\nend", "def meth(ordinal, optional=true, *variable_length, &block)\nend", "def parameters=(_arg0); end", "def optionalParameters(a,b,*c)\n #some code\nend", "def method(a=-3, b=-4)\r\n\ta + b\r\nend", "def a(b:, c:1)\n [b, c]\nend", "def params=(_arg0); end", "def params=(_arg0); end", "def meth(\n arg1,\n arg2 , arg3 = 7 , *rest,\n\n\n last,\n required:,\n not_required: 7, **options)\nend", "def meth(\n arg1,\n arg2 , arg3 = 7 , *rest,\n\n\n last,\n required:,\n not_required: 7, **options)\nend", "def useParams(a, b = a * 10, c = a + 1)\n puts \"a=\" + a.to_s + \", b=\" + b.to_s + \", c=\" + c.to_s\nend", "def PRF02=(arg)", "def optional_positionals; end", "def direction=(_arg0); end", "def alphabet(arg1 = \"Alpha\", arg2 = \"Beta\")\n puts \"The Parameter is #{arg1}\"\n puts \"The Parameter is #{arg2}\"\nend", "def method (a=3, b=4)\r\nend", "def defVals(par1, opt1 = \"optional one applied\", opt2 = \"optional two applied\") \n puts \"First parameter => #{par1}\"\n puts \"Second parameter => #{opt1}\"\n puts \"Third parameter => #{opt2}\"\nend", "def starting_position=(_arg0); end", "def PRF03=(arg)", "def method (a=3, b)\r\nend", "def PRF04=(arg)", "def my_method(first: nil, second: nil)\n puts \"First is #{first} and second is #{second}\"\nend", "def two_arg_method_defaults(arg1=0, arg2=\"020202\")\n puts \"Here are my args: #{arg1}, #{arg2}\"\nend", "def offences_by=(_arg0); end", "def method(a, b=-4)\r\n\ta + b\r\nend", "def method(a, b=-4)\r\n\ta + b\r\nend", "def method (a=3,\r\n\tb)\r\nend", "def parameter_rule?; end", "def defaultArguments (x = 22, y = x + 20, z = 50)\n puts \"x = \" + x.to_s\n puts \"y = \" + y.to_s\n puts \"z = \" + z.to_s\n end", "def meth( *args, second_to_last,last\n )\nend", "def params=(_); end", "def pos=(_arg0); end", "def parameters=(_); end", "def PO103=(arg)", "def method (number, default1 = 1, default2 = 2)\nend", "def method(c=-1, d=c)\r\n\tputs c, d\r\n\tc + d\r\nend", "def required_positionals; end", "def ranking_param(range)\n query_params.merge(ranking: range.parameterize('_'))\n end", "def params\n '(' + (self.min.nil? ? '~' : '%g' % self.min) + ',' + (self.max.nil? ? '~' : '%g' % self.max) + ')'\n end", "def params\n '(' + (self.min.nil? ? '~' : '%g' % self.min) + ',' + (self.max.nil? ? '~' : '%g' % self.max) + ')'\n end", "def fallbacks=(_arg0); end", "def offset_and_limit_params\n # Ternary Logic :D\n @offset = params[:offset].nil? ? 0 : params[:offset].to_i\n @limit = params[:limit].nil? ? 20 : params[:limit].to_i\n end", "def sort_params; end", "def sort_params; end", "def PO102=(arg)", "def position=(_arg0); end", "def atk; param(2); end", "def PO110=(arg)", "def between(from:, to:); end", "def PO113=(arg)", "def parameters; end", "def parameters; end", "def parameters; end", "def parameters; end", "def parameters; end", "def parameters; end", "def parameters; end", "def parameters; end", "def PRF01=(arg)", "def parameterize(value); end", "def PO109=(arg)", "def SAC05=(arg)", "def set_order( params )\n return 'desc' if (params[:order]=='asc')\n return 'asc'\n end", "def set_values(param)\n case param\n when '?', '??', '?+'\n @min_value = 0\n @max_value = 1\n @option |= TstOptGreedy if(param.size == 1)\n @option |= TstOptReluctant if(param == \"??\")\n @option |= TstOptPossessive if(param[-1] == \"+\")\n when '*', '*?', '*+'\n @min_value = 0\n @max_value = TstConstRepeatMax\n @option |= TstOptGreedy if(param.size == 1)\n @option |= TstOptReluctant if(param[-1] == \"?\")\n @option |= TstOptPossessive if(param[-1] == \"+\")\n when '+', '+?', '++'\n @min_value = 1\n @max_value = TstConstRepeatMax\n @option |= TstOptGreedy if(param.size == 1)\n @option |= TstOptReluctant if(param[-1] == \"?\")\n @option |= TstOptPossessive if(param == \"++\")\n when /^\\{(\\d+)\\}([\\?\\+]?)$/ # {3}, etc.\n @min_value = $1.to_i\n @max_value = $1.to_i\n @option |= TstOptGreedy if(!$2)\n @option |= TstOptReluctant if($2 == \"?\")\n @option |= TstOptPossessive if($2 == \"+\")\n when /^\\{(\\d+),(\\d+)\\}([\\?\\+]?)$/ # {2,3}, etc.\n @min_value = $1.to_i\n @max_value = $2.to_i\n @option |= TstOptGreedy if(!$2)\n @option |= TstOptReluctant if($2 == \"?\")\n @option |= TstOptPossessive if($2 == \"+\")\n when /^\\{,(\\d+)\\}([\\?\\+]?)$/ # {,3}, etc.\n @min_value = 0\n @max_value = $1.to_i\n @option |= TstOptGreedy if(!$2)\n @option |= TstOptReluctant if($2 == \"?\")\n @option |= TstOptPossessive if($2 == \"+\")\n when /^\\{(\\d+),\\}([\\?\\+]?)$/ # {3,}, etc.\n @min_value = $1.to_i\n @max_value = TstConstRepeatMax\n @max_value = @min_value + TstConstRepeatMax if(@max_value < @min_value)\n @option |= TstOptGreedy if(!$2)\n @option |= TstOptReluctant if($2 == \"?\")\n @option |= TstOptPossessive if($2 == \"+\")\n else\n raise \"Error: repeat notation #{param} invalid\"\n end\n end", "def in_kwarg=(_arg0); end", "def PO101=(arg)", "def SAC02=(arg)", "def method(c=-1, d=c+5)\r\n\tc + d\r\nend", "def method8(x: nil, y: nil, z: nil)\r\n p x, y, z\r\nend", "def validate_paramters\n raise Scorekeeper::MissingParameterException if @income.nil? || @zipcode.nil? || @age.nil?\n end", "def reserved=(_arg0); end", "def PO105=(arg)", "def requirements=(_arg0); end", "def requirements=(_arg0); end", "def set_param(m, *args)\n m = m.to_s\n case args.length\n when 1\n self[\"#{m}_bottom\"] = self[\"#{m}_top\"] =\n self[\"#{m}_left\"] = self[\"#{m}_right\"] = args[0]\n when 2\n self[\"#{m}_bottom\"] = self[\"#{m}_top\"] = args[0]\n self[\"#{m}_left\"] = self[\"#{m}_right\"] = args[1]\n when 3\n self[\"#{m}_top\"] = args[0]\n self[\"#{m}_bottom\"] = args[2]\n self[\"#{m}_left\"] = self[\"#{m}_right\"] = args[1]\n else\n self[\"#{m}_top\"], self[\"#{m}_right\"],\n self[\"#{m}_bottom\"], self[\"#{m}_left\"] = *args\n end\n end", "def PO114=(arg)", "def swap_range_limit_params_if_needed\n return if params.empty?\n\n start_date = params.dig(:range, :year_facet_isim, :begin)\n end_date = params.dig(:range, :year_facet_isim, :end)\n\n return unless start_date.present? && end_date.present?\n return unless start_date.to_i > end_date.to_i\n\n params['range']['year_facet_isim']['begin'] = end_date\n params['range']['year_facet_isim']['end'] = start_date\n end", "def SAC07=(arg)", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def hrg; xparam(7); end", "def exr; sparam(9); end" ]
[ "0.6078194", "0.602415", "0.59534734", "0.59534734", "0.58855736", "0.58855736", "0.581441", "0.57991165", "0.5774244", "0.5733405", "0.5726446", "0.5726446", "0.571267", "0.5711644", "0.56998897", "0.56855476", "0.5664469", "0.56507194", "0.56362164", "0.5618495", "0.5597693", "0.5590222", "0.5559844", "0.5535508", "0.54986364", "0.5497156", "0.5495409", "0.5482289", "0.54790705", "0.54790705", "0.54789895", "0.5478762", "0.54648566", "0.54647523", "0.54580283", "0.54539186", "0.54352087", "0.54212636", "0.54094696", "0.54023093", "0.5379448", "0.53517175", "0.53497523", "0.53497523", "0.5340619", "0.533629", "0.53314775", "0.53314775", "0.53307724", "0.53235227", "0.53209025", "0.5317755", "0.5303829", "0.52907044", "0.52898705", "0.52898705", "0.52898705", "0.52898705", "0.52898705", "0.52898705", "0.52898705", "0.52898705", "0.5285646", "0.52756774", "0.5273645", "0.52663445", "0.5259389", "0.52523494", "0.5249363", "0.5233128", "0.52232754", "0.52203256", "0.52175206", "0.5214785", "0.52133846", "0.5212773", "0.5207851", "0.5207851", "0.5204935", "0.52017134", "0.5199769", "0.5199748", "0.51974654", "0.51974654", "0.51974654", "0.51974654", "0.51974654", "0.51974654", "0.51974654", "0.51974654", "0.51974654", "0.51974654", "0.51974654", "0.51974654", "0.51974654", "0.51974654", "0.51974654", "0.51974654", "0.51974654", "0.51929927", "0.5187339" ]
0.0
-1
=> END /Users/joekelly/Desktop/Projects/rubykickstart/session3/notes/17variablelengthedparams.rb file content is listed below After listing your ordinal and optional parameters, you can take a variable length of arguments. To do this, you use '' before the parameter. In Ruby 1.8, it must be the last parameter. The parameters that match it will be put into an array.
def variable_length(first, second=:default, *rest) [first, second, rest] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def arguments; end", "def arguments; end", "def arguments; end", "def arguments\n \"\"\n end", "def arg_size; end", "def q1 *rest\n puts \"The number of parameters is #{rest.length}.\"\n puts rest\nend", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def parameters; end", "def parameters; end", "def parameters; end", "def parameters; end", "def parameters; end", "def parameters; end", "def parameters; end", "def parameters; end", "def %(arg0)\n end", "def %(arg0)\n end", "def wrong_num_parameters?\n (ARGV.size != 1)\n end", "def variable_length( *args )\n return args\nend", "def how_many_args *args\n args.length\n # accepts any number of arguments without complaint\n # returns the total number of arguments passed to the function\n # Hint: google ruby *args\nend", "def number_of_arguments(*args)\n puts \"The number of parameters is #{args.length}\"\n for i in 0...args.length\n puts \"The parameters are #{args[i]}\"\n end\nend", "def parameters=(_arg0); end", "def args()\n #This is a stub, used for indexing\n end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def arguments=(_arg0); end", "def parse_arguments(parameters)\n parameter_string = \"\"\n method_definition = nil\n parameters.each do |parameter|\n arg_type = parameter[0]\n arg = parameter[1]\n case arg_type\n when :req\n parameter_string += \" #{arg}\"\n when :opt\n if Commandable.verbose_parameters\n # figure out what the default value is\n method_definition ||= readline(@@method_file, @@method_line)\n default = parse_optional(method_definition, arg)\n parameter_string += \" [#{arg}=#{default}]\"\n else\n parameter_string += \" [#{arg}]\"\n end\n when :rest\n parameter_string += \" *#{arg}\"\n when :block\n parameter_string += \" &#{arg}\"\n end\n end\n parameter_string.strip\n end", "def length; @args.length end", "def sizeOf _args\n \"sizeOf _args;\" \n end", "def args(*) end", "def params(*); {}; end", "def arguments(required, *optional)\n puts \"required: #{required}\"\n puts \"optional: #{optional}\"\nend", "def how_many_args *args\n args.length\nend", "def parse_arguments\n expect_at_least(1, \"chunk files to weave\")\n end", "def how_many_args(*arg)\n arg.length\nend", "def argv; end", "def geeks (*var) \r\n \r\n # to display the total number of parameters \r\n puts \"Number of parameters is: #{var.length}\"\r\n \r\n # using for loop \r\n for i in 0...var.length \r\n puts \"Parameters are: #{var[i]}\"\r\n end\r\nend", "def length=(_arg0); end", "def format_arguments; end", "def params=(_arg0); end", "def params=(_arg0); end", "def parameters()\n @melody = params[:melody].upcase.split(\",\") # create array of notes in melody parameter\n @shift = params[:shift] # shift parameter\nend", "def how_many_args(*args)\n\targs.length\nend", "def how_many_args(*args)\n args.length\nend", "def variableNumberOfArguments (*test)\n puts \"Number of parameters #{test.length}\"\n for i in test\n puts \"The parameters are #{i}\"\n end\n end", "def print_missing_sec_arg\n puts ARGV[0] + \" requires second argument\"\n print_usage\nend", "def required_arguments(args, n)\n n = (n..n) if Fixnum === n\n unless n.include? args.size\n STDERR.puts usage_text()\n exit!\n end\n args\n end", "def parse_parameters; end", "def agi; param(6); end", "def terminator=(_arg0); end", "def parameter_types; end", "def first_argument_index\n 2\n end", "def getOxygenRemaining _args\n \"getOxygenRemaining _args;\" \n end", "def multiline_arg; end", "def inflamed _args\n \"inflamed _args;\" \n end", "def format_arguments=(_arg0); end", "def cmdarg; end", "def cmdarg; end", "def cmdarg; end", "def arity; end", "def my_args(first, *args, last)\n # Use the splat (i.e. *) in front of an \n # argument to take in any number of args\n # into an array (like gather in JS i.e. ...).\n # Unlike gather, it can be placed at the beginning,\n # the middle, or the end of a list of args\n puts(\"first: #{first}\")\n puts(\"args: #{args}\")\n puts(\"last: #{last}\")\nend", "def method_name_with_different_number_of_arguments(*arguments)\n puts(arguments)\nend", "def extra_args; end", "def my_args(first, *args, last)\n # Use the splat '*' in front of an argument to take any number of args into\n # an array, just like gather (i.e. '...') in JavaScript. Unlike gather,\n # it can be placed at the beginning, middle, or end of a list of arguments.\n puts \"first: #{first}\"\n puts \"args: #{args}\"\n puts \"last: #{last}\"\nend", "def meth(\n arg1,\n arg2 , arg3 = 7 , *rest,\n\n\n last,\n required:,\n not_required: 7, **options)\nend", "def meth(\n arg1,\n arg2 , arg3 = 7 , *rest,\n\n\n last,\n required:,\n not_required: 7, **options)\nend", "def introduce(name:, age:, food:)\n puts \"I am #{name}\"\n puts \"I am #{age} years old\"\n puts \"I like #{food}\"\nend" ]
[ "0.6730426", "0.6730426", "0.6730426", "0.65369976", "0.6491429", "0.6266541", "0.62617344", "0.62617344", "0.62617344", "0.62617344", "0.62617344", "0.62617344", "0.62617344", "0.62617344", "0.62617344", "0.62617344", "0.62617344", "0.62617344", "0.62617344", "0.62617344", "0.62617344", "0.62617344", "0.62617344", "0.62617344", "0.62617344", "0.62617344", "0.6217608", "0.6217608", "0.6217608", "0.6217608", "0.6217608", "0.6217608", "0.6217608", "0.6217608", "0.61721927", "0.61721927", "0.6107934", "0.60444516", "0.601931", "0.5999545", "0.5998987", "0.59808874", "0.5956946", "0.5956946", "0.5956946", "0.5956946", "0.5956946", "0.5956946", "0.5956946", "0.5956946", "0.5956946", "0.5956946", "0.5956946", "0.5956946", "0.5956946", "0.5956946", "0.5956946", "0.5956946", "0.5956946", "0.59325856", "0.59206927", "0.59103435", "0.5901945", "0.59015507", "0.58963186", "0.5892731", "0.58344233", "0.5787037", "0.578608", "0.57734805", "0.57699555", "0.57625115", "0.57511246", "0.57484174", "0.57484174", "0.5740478", "0.57284343", "0.5715111", "0.5693747", "0.5643991", "0.56124455", "0.56015104", "0.55974424", "0.55955255", "0.5591655", "0.55908793", "0.5557909", "0.55464005", "0.5539892", "0.5525557", "0.55231595", "0.55231595", "0.55231595", "0.5522641", "0.55209345", "0.55168355", "0.55112356", "0.5510515", "0.5500064", "0.5497407", "0.5488975" ]
0.0
-1
=> [1, 2, [3, 4]] how might we use it?
def minimum( *numbers ) min = numbers.first numbers.each { |number| min = number if number < min } min end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def arr\n a = [1,2,[3,4,[5]]]\n return a.flatten\nend", "def flatten(list)\n list.flatten\nend", "def using_flatten(arr)\n arr.flatten\nend", "def using_flatten(array)\n array.flatten\n \nend", "def using_flatten(array)\n array.flatten\nend", "def using_flatten(array)\n array.flatten\nend", "def using_flatten(array)\n array.flatten\nend", "def using_flatten(array)\n array.flatten\nend", "def using_flatten(array)\n array.flatten\nend", "def using_flatten(array)\n array.flatten\nend", "def using_flatten(array)\n array.flatten\nend", "def using_flatten(array)\n array.flatten\nend", "def using_flatten(array)\n array.flatten()\nend", "def using_flatten (array)\n return array.flatten!\nend", "def using_flatten(array)\n \n array.flatten\n \nend", "def to_a; @list; end", "def flatten(array)\n container = []\n\n array.each do |element|\n if element.is_a?(Array)\n container += element\n else\n container << element\n end\n end\n\n container\nend", "def get_values\n [1, 2, 3, 4]\nend", "def list_of(maybe_an_array)\n [maybe_an_array].flatten\n end", "def dd_map\n map { |el| el.is_a?(Array) ? dd_map(el) : el }\nend", "def my_flatten\n # return self unless self.is_a?(Array)\n new_arr = []\n self.each do |el|\n if el.is_a?(Array)\n new_arr += el.my_flatten\n else\n new_arr << el\n end\n end\n new_arr\n end", "def array_with_two_elements\n [1,2]\nend", "def recursive_subsets(arr)\n return [[]] if arr.empty?\n last_el = arr.pop\n p sub_arr = recursive_subsets(arr)\n p last_el\n sub_arr += sub_arr.map { |el| el + [last_el] }\nend", "def using_flatten(array)\n array.flatten\n end", "def flatten(nested_array, result = [])\n nested_array.each do |integer|\n if integer.class == Array\n flatten(integer, result)\n else\n result << integer\n end\n end\n result\nend", "def flatten_array(arr)\n arr.flatten\nend", "def flatten(array, result = [])\n array.each do |element|\n if element.is_a?(Array)\n flatten(element, result)\n else\n result << element\n end\n end\n result\nend", "def flatten(array)\n array.flatten(1)\nend", "def flatten(array)\n array.flatten(1)\nend", "def one_line_flatten(array, ret = [])\n array.each { |x| x.is_a?(Array) ? one_line_flatten(x, ret) : ret << x }; ret\nend", "def flatten_sequence(list); end", "def bracketed_list(values)\n temp=\"\"\n temp += \"[\"\n values.each {|val| temp += \"#{val.to_s}, \"}\n temp += \"]\"\n return temp\nend", "def maybe_array(x)\n x.is_a?(Array) ? x : [x]\n end", "def list\n only.to_a\n end", "def flat(a)\n\tnew_arr = []\n\ta.each do |el|\n\t\tif el.is_a? Array\n\t\t\tel.each do |n|\n\t\t\t\tif el.is_a? Array\n\t\t\t\t\ta << n\n\t\t\t\telse\n\t\t\t\t\tnew_arr << n\n\t\t\t\tend\n\t\t\tend\n\t\telse\n\t\t\tnew_arr << el\t\n\t\tend\n\tend\n\tp new_arr\nend", "def my_controlled_flatten(n=1)\n #here\n return self if n < 1\n\n results = []\n self.each do |el|\n if el.class == Array\n #here\n results += el.my_controlled_flatten(n-1)\n else\n results << el\n end\n end\n\n results\n\n end", "def to_a; [Array]; end", "def mass_return\n [1,2]\nend", "def get_items\r\n @arr.to_a\r\n end", "def subsets(arr)\n #base case(s)\n p arr\n return [arr] if arr.empty?\n # return [[], arr] if arr.length == 1\n #inductive step\n remaining_arr = subsets(arr[0...-1])\n remaining_arr + remaining_arr.map { |ele| ele + [arr.last] }\n # subsets(arr) + subsets(arr[0...-1])\nend", "def my_flatten\n flattened = []\n self.my_each do |el|\n el.is_a?(Array) ? flattened += el.my_flatten : flattened << el\n end\n flattened\n end", "def my_flatten(arr, flattened_arr = [])\nend", "def flatten(array)\n return [] if array.empty? \n list = []\n head = array[0]\n rest = array[1..-1]\n if head.is_a? Array \n flatten(head) + flatten(rest)\n else \n list += [head] + flatten(rest)\n end \nend", "def my_flatten(array)\n print array.flatten\n end", "def my_flatten_recursive \n results = []\n self.my_each do |ele|\n if ele.is_a? Array \n results.concat(ele.my_flatten_recursive)\n else \n results<< ele\n end\n end\n results\n\n end", "def flatten_array(array, result = [])\n array.each do |element|\n if element.is_a? Array\n flatten_array(element, result)\n else\n result << element\n end\n end\n result\nend", "def flatten(data, level = 0)\n return [data] unless data.is_a?(Array) \n flat = []\n data.each do |ele|\n if ele.is_a?(Array)\n flat += flatten(ele, level + 1)\n else\n flat << ele\n end\n end\n flat\nend", "def test_flatten_once\n ary = [1, [2, [3, 4]]]\n flatter_ary = [1, 2, [3, 4]]\n assert_equal flatter_ary, OneLiner.flatten_once(ary)\n end", "def flatten() end", "def test_fix_nested_array\n array = [1, [2], [3, [4,[5]]], 6]\n array = array.flatten\n assert_equal [1,2,3,4,5,6], array\n end", "def flatten!() end", "def my_flatten\n arr = []\n i = 0\n while i < self.length\n if self[i].is_a? Array\n arr += self[i].my_flatten\n else\n arr << self[i]\n end\n i += 1\n end\n return arr\n end", "def my_flatten\n flattened = []\n self.my_each do |el|\n if el.is_a? Array\n flattened += el.my_flatten\n else\n flattened << el\n end\n end\n flattened\n end", "def elements; end", "def elements; end", "def elements; end", "def my_controlled_flatten(n)\n return self if n < 1\n new_arr = []\n my_each {|el| new_arr += (el.is_a?(Array) ? el.my_controlled_flatten(n-1) : [el])}\n new_arr\n end", "def arrayed(object) # :doc:\n (object.is_a?(Array) ? object : [object])\n end", "def my_controlled_flatten(n)\n return self if n == 0\n result = []\n self.each do |el|\n result << el unless el.is_a? Array\n result += el.my_controlled_flatten(n - 1) if el.is_a? Array\n end\n result\n end", "def my_controlled_flatten(n)\n return self if n == 0\n result = []\n self.each do |el|\n result << el unless el.is_a? Array\n result += el.my_controlled_flatten(n - 1) if el.is_a? Array\n end\n result\n end", "def my_flatten\n flattened = []\n self.my_each do |el|\n el.is_a?(Array) ? flattened.concat(el.my_flatten) : flattened << el\n end\n flattened\n end", "def convert_1_level_deep(arr, result=[])\n arr.flatten.each_slice(3) { |ele| result.push(ele)}\n result\nend", "def another; return []; end", "def flatten(array)\n new_array = []\n array.each do |x|\n if x.class == Array\n x.each {|y| new_array.push(y)}\n else\n new_array.push(x)\n end\n end\n new_array\nend", "def my_controlled_flatten(n)\n\n end", "def my_controlled_flatten(n)\n\n end", "def get_elements(array)\n\n elements = []\n if array != nil\n elements = array.to_a\n end\n return elements\n\nend", "def flatten\n # if any item is a Set or Java Collection, then convert those into arrays before recursively flattening the list\n if any? { |item| Set === item or Java::JavaUtil::Collection === item } then\n return map { |item| (Set === item or Java::JavaUtil::Collection === item) ? item.to_a : item }.flatten\n end\n base__flatten\n end", "def loop_through\n self.map! do |element| \n if !element.is_a?(Array)\n element\n elsif element.is_a?(Array)\n element = element.dup\n element = element.loop_through\n end\n end\n end", "def test_flatten_once\n ary = [1, [2, [3, 4]], [5]]\n flatter_ary = [1, 2, [3, 4], 5]\n assert_equal flatter_ary, OneLiner.flatten_once(ary)\n end", "def my_flatten\n flattened_array = []\n each do |item|\n if item.class != Array\n flattened_array << item\n else\n #recursevly call my flatten\n item.my_flatten.each { |sub_item| flattened_array << sub_item }\n end\n end\n flattened_array\n end", "def flatten_repetition(list, named) # :nodoc:\n if list.any? { |e| e.instance_of?(Hash) }\n # If keyed subtrees are in the array, we'll want to discard all \n # strings inbetween. To keep them, name them. \n return list.select { |e| e.instance_of?(Hash) }\n end\n\n if list.any? { |e| e.instance_of?(Array) }\n # If any arrays are nested in this array, flatten all arrays to this\n # level. \n return list.\n select { |e| e.instance_of?(Array) }.\n flatten(1)\n end\n \n # Consistent handling of empty lists, when we act on a named result \n return [] if named && list.empty?\n \n # If there are only strings, concatenate them and return that. \n foldl(list) { |s,e| s+e }\n end", "def flatten(array)\n return [] if array.empty?\n\n res = []\n array.each do |el|\n if el.is_a? Array\n res += flatten(el)\n else\n res << el\n end\n end\n res\nend", "def unordered_list; end", "def lcts(array)\nend", "def flatten(a, flat=[])\n if a.class != Array\n # base case\n flat << a\n else\n a.each {|v| flatten(v, flat)}\n end\n flat\nend", "def as_array(thing)\n [ thing ].flatten\n end", "def create_an_array\n [\"a\", \"b\", \"c\", \"d\"]\nend", "def to_a\n return [] unless head\n head.to_a\n end", "def to_a\n return [] unless head\n head.to_a\n end", "def get_parts(poly)\n\tif poly.kind_of? Array\n mypoly = poly.compact\n\t [mypoly, mypoly[-1]]\n else\n [poly, poly]\n end\n end", "def to_list\n foldr(List[]) { |x, xs| Cons[x, xs] }\n end", "def flatt(arr, flat_arr = [])\n arr.each do |element|\n if element.is_a?(Array)\n flatt(element, flat_arr)\n else\n flat_arr << element\n end\n end\n flat_arr\nend", "def applying_flatten array_value\n return array_value.flatten!\n end", "def subsets(arr)\n return [[]] if arr.empty?\n # debugger\n # take - return first n elements\n\n subArr = arr.take(arr.count - 1)\n\n subs = subsets(subArr)\n\n # concat Appends the elements of other_ary to self.\n # tyle co +\n subArrays = subs.map { |sub| sub + [arr.last] }\n subs.concat(subArrays)\nend", "def my_controlled_flatten(n)\n flattened = []\n\n self.each do |el|\n depth = 0\n if el.is_a?(Array)\n depth += 1\n flattened += el.my_flatten\n else\n flattened << el\n end\n end\n flattened\n end", "def studentArray(value)\n @students = Array.new unless defined? @students\n # \n if value.is_a?(Array)\n value.each{|student| @students << student}\n else\n @students << value\n end\nend", "def serialize_list_array(list_uri, uris)\n uris.each_index { |index|\n next_uri = nil\n next_uri = uris[index + 1] if index + 1 < uris.length\n serialize_list(uris, index, uris[index], next_uri, list_uri)\n }\n end", "def my_controlled_flatten(n)\n flattened = []\n self.my_each do |el|\n if n > 0 && el.is_a?(Array)\n flattened += el.my_controlled_flatten(n - 1)\n else\n flattened << el\n end\n end\n flattened\n end", "def arrayorize(value)\n case value\n when nil then return []\n when String then value.to_s.split\n when Symbol then value.to_s.split\n else value\n end\n end", "def subsets(arr)\n return [self] if arr.length == 1\n\n subs + subsets()\nend", "def flatten!\n # buggerit\n raise NotImplementedError\n end", "def dupli(list)\n list.map { |i| [i, i] }.flatten\nend", "def subsets(arr)\n return [[]] if arr.empty?\n subsets_arr = []\n cur_el = arr[0]\n prior_subs = subsets(arr[1..-1])\n prior_subs.each do |subset|\n subsets_arr << subset.dup.push(cur_el)\n end\n subsets_arr + prior_subs\nend", "def subsets(nums)\n return [[]] if nums.empty?\n first = nums[0]\n prev_subs = subsets(nums[1..-1])\n new_subs = prev_subs.map do |sub|\n sub + [first]\n end \n prev_subs + new_subs\nend", "def my_controlled_flatten(level = nil)\n flattened = []\n\n self.each do |ele|\n if ele.is_a?(Array) && level != 0\n flattened += (level.nil? ? ele.my_controlled_flatten : ele.my_controlled_flatten(level - 1))\n else\n flattened << ele\n end\n end\n\n flattened\n end", "def arr(n)\n\n return [n] if !n.kind_of?(Array)\n\n butts = []\n\n n.each do |ele|\n\n butts += arr(ele)\n end\n\n # if n.kind_of?(Array) == false\n # butts << n\n \n # else\n # arr(n[0])\n # end\n\n butts\n \n\nend", "def my_controlled_flatten(level = nil)\n flattened = []\n\n self.each do |ele|\n if ele.is_a?(Array) && level != 0\n flattened += (level.nil? ? ele.my_controlled_flatten : ele.my_controlled_flatten(level - 1))\n else\n flattened << ele\n end\n end\n\n flattened\n end", "def nested_array\n curr = @nested\n @list.each do |num|\n r = rand(3)\n if r == 1\n curr << num\n elsif r == 2\n curr << []\n curr = curr[curr.length - 1]\n curr << num\n else\n curr = @nested\n curr << num\n end\n end\n @nested\n end", "def deep_dup(arr)\n # new_array = []\n # arr.each do |el|\n # new_array << (el.is_a?(Array) ? deep_dup(el) : el)\n # end\n # new_array\nend", "def array(value)\n value.respond_to?(:to_ary) ? value : [value]\n end" ]
[ "0.6930029", "0.6883396", "0.67238504", "0.67142314", "0.6651471", "0.6651471", "0.6651471", "0.6651471", "0.6651471", "0.6651471", "0.66494757", "0.66494757", "0.640513", "0.63989854", "0.63547635", "0.6273393", "0.6212642", "0.61201966", "0.60530746", "0.6047458", "0.6046541", "0.6031075", "0.6019546", "0.599473", "0.5973788", "0.59716946", "0.59642816", "0.5929606", "0.5929606", "0.5929317", "0.5926609", "0.5910679", "0.5891662", "0.58727336", "0.5871777", "0.58590394", "0.58576363", "0.5847954", "0.58473206", "0.58427554", "0.58365804", "0.58021635", "0.57989836", "0.5787611", "0.5787101", "0.5755217", "0.5754437", "0.5753617", "0.57423145", "0.57297045", "0.5728121", "0.5709964", "0.57036436", "0.5684743", "0.5684743", "0.5684743", "0.56764144", "0.5672128", "0.5659852", "0.5659852", "0.5646982", "0.564213", "0.56402797", "0.5637902", "0.56360406", "0.56360406", "0.56304044", "0.56295735", "0.5606257", "0.56032544", "0.5602764", "0.5596314", "0.55915076", "0.55714375", "0.557118", "0.5566239", "0.55650705", "0.55625993", "0.55518675", "0.55518675", "0.55513895", "0.55491394", "0.55444723", "0.55428576", "0.5540721", "0.5536574", "0.5535783", "0.55343086", "0.5527092", "0.55199695", "0.5519132", "0.5518411", "0.55074203", "0.55069995", "0.5506128", "0.5503687", "0.5503474", "0.5502021", "0.550002", "0.54989904", "0.5497499" ]
0.0
-1
=> 3 END /Users/joekelly/Desktop/Projects/rubykickstart/session3/notes/18hashparams.rb file content is listed below If we wanted to pass a bunch of options to a method, we might use a hash table.
def same_case( str , options = Hash.new ) return str.upcase if options[:upcase] return str.upcase if options[:downcase] == false str.downcase end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def params=(hash); end", "def params=(hash); end", "def initialize(optHash)\n @optHash=optHash\n setParameters()\nend", "def key; @opts['key'] end", "def set_hash_length(opts)\n opts = check_params(opts,[:lengths])\n super(opts)\n end", "def comments_hash_flag=(_arg0); end", "def comments_hash_flag=(_arg0); end", "def relevant_options_digest(options); end", "def setup(hash_args); end", "def options=(_arg0); end", "def options=(_arg0); end", "def options=(_arg0); end", "def options=(_arg0); end", "def options=(_arg0); end", "def options=(_arg0); end", "def options=(_arg0); end", "def options=(_arg0); end", "def options=(_arg0); end", "def options=(_arg0); end", "def options=(_arg0); end", "def options=(_arg0); end", "def options=(_arg0); end", "def build_givenhash(data)\n givenhash = {}\n unless data[:moduleoptions].nil?\n data[:moduleoptions].each do |key, value|\n givenhash[key.to_s] = value.to_s.tr(\"\\n\", ' ').strip\n end\n end\n givenhash\n end", "def docstring_hash_flag=(_arg0); end", "def params\n @opts\n end", "def process_options\n \n end", "def options(opt); end", "def options(opt); end", "def proc_arg(opt)\n case opt\n when '-h'\n :hash\n when '-m'\n :merge\n when '-n'\n :nested\n else\n nil\n end\nend", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def process_options\n \n end", "def process_options\n \n end", "def process_options\n \n end", "def options() end", "def set_hash_method(opts)\n opts = check_params(opts,[:methods])\n super(opts)\n end", "def options(opt)\n end", "def hash\n hash_args.hash\n end", "def extra_keys(options, recall = T.unsafe(nil)); end", "def docstring_hash_flag; end", "def parameters; end", "def parameters; end", "def parameters; end", "def parameters; end", "def parameters; end", "def parameters; end", "def parameters; end", "def parameters; end", "def b(**options)\n p options\nend", "def hints; end", "def options_arguments\n @options_arguments ||= Launchr::OrderedHash.new\n @options_arguments\n end", "def add_options; end", "def load_params args\n\tparams = {}\n\targs.each_slice(2) do | key_value |\n\t\t# puts \"o #{key_value}\"\n\t\tparams[key_value[0][1..-1]] = key_value[1]\n\tend\n\tparams\nend", "def options; @opts end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end" ]
[ "0.6228967", "0.6228967", "0.60891116", "0.59030217", "0.5753206", "0.57402927", "0.5737457", "0.5703313", "0.5657092", "0.56328654", "0.56328654", "0.56328654", "0.56328654", "0.56328654", "0.56328654", "0.56328654", "0.56328654", "0.56328654", "0.56328654", "0.56328654", "0.56328654", "0.56328654", "0.55954236", "0.55941397", "0.5587587", "0.5577893", "0.5555235", "0.555501", "0.5495426", "0.5473904", "0.5473904", "0.5473904", "0.5473904", "0.5473904", "0.5473904", "0.5473904", "0.5473904", "0.5473904", "0.5473904", "0.5473904", "0.5473904", "0.5473904", "0.5473904", "0.5473904", "0.5473904", "0.5473904", "0.5471588", "0.5471588", "0.5471588", "0.5448824", "0.54448795", "0.54433596", "0.543542", "0.54105186", "0.53736454", "0.53713113", "0.53713113", "0.53713113", "0.53713113", "0.53713113", "0.53713113", "0.53713113", "0.53713113", "0.5357377", "0.5339505", "0.5326908", "0.5321526", "0.5317726", "0.5316216", "0.5315452", "0.5315452", "0.5315452", "0.5315452", "0.5315452", "0.5315452", "0.5315452", "0.5315452", "0.5315452", "0.5315452", "0.5315452", "0.5315452", "0.5315452", "0.5315452", "0.5315452", "0.5315452", "0.5315452", "0.5315452", "0.5315452", "0.5315452", "0.5315452", "0.5315452", "0.5315452", "0.5315452", "0.5315452", "0.5315452", "0.5315452", "0.5315452", "0.5315452", "0.5315452", "0.5315452", "0.5315452" ]
0.0
-1
=> "UPPER LOWER" END /Users/joekelly/Desktop/Projects/rubykickstart/session3/notes/19puttingitalltogether.rb file content is listed below We've seen a lot of things we can do with method parameters. But how do they all work together?
def meth(ordinal, optional=true, *variable_length, &block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def toUpper _args\n \"toUpper _args;\" \n end", "def greetings(name)\n puts \"Hello #{name.capitalize}\"\nend", "def capitalize!() end", "def bar(s)\n s.upcase\nend", "def shout(word)\n upper_case = word.upcase\nend", "def caps_phrase(user_phrase)\n puts user_phrase.upcase\nend", "def capitalize_each_word(phrase)\r\n\r\nend", "def puts_upcase(a)\r\n puts \"upcase: #{a.upcase}\"\r\nend", "def capitalize(word)\n\nend", "def helloPerson(name)\n puts \"hello #{name.capitalize}!\"\nend", "def toLower _args\n \"toLower _args;\" \n end", "def methodCallingMethod(str)\n puts \"#{str}\".upcase\n str\nend", "def greet(name)\n \"Hello #{name.capitalize}!\"\nend", "def greet(name)\n \"Hello #{name.capitalize}!\"\nend", "def print_full_name(firstname, lastname)\n puts \"Hi \" + firstname.capitalize + \" \" + lastname.capitalize\nend", "def upcase!() end", "def shout(word)\n puts word.upcase\n end", "def h(name = \"World\")\n puts \"Hello #{name.capitalize}!\"\nend", "def greeting(name)\n \"Hello #{name.capitalize}!\"\nend", "def foo_greeting(recipient = \"you\")\n puts \"Hello there, #{recipient.upcase}!\"\nend", "def shout (s)\n s.upcase\nend", "def yell (foo)\n foo.upcase + \"!\"\n end", "def hi(name = 'World')\n puts \"Hello 'k' #{name.capitalize}\"\nend", "def xyzzy(a_value)\n a_value.upcase\nend", "def hello(name = 'World')\n puts \"Hello, #{name.capitalize}!\"\nend", "def say_goodnight(name)\r\n \"Dobranoc #{ name.capitalize }\"\r\nend", "def shout(input)\n \"#{input.upcase}\"\nend", "def sayhello(name, last_name='Rojas')#al hacer parametro=______ es un parametro por defecto, si no se especifica luego linea 6, me lo auto completa\n horoscope = 'capricornio'\n \"Hola #{name.capitalize} #{last_name.capitalize}. Pura Vida! #{horoscope}\" #notar que las interpolaciones estan separadas!!\nend", "def under_attack\n puts \"THE world is in danger due to the evil taking over!!!\".upcase\nend", "def shout(text)\n text.upcase\nend", "def shout (maj)\n maj.upcase\nend", "def shout(str)\n str.upcase\nend", "def shout(a)\n return a.upcase\nend", "def greeting(name)\n puts \"Good day \"+name.capitalize\nend", "def printupcase (live)\n\n\tputs live.upcase\nend", "def string_in_all_caps(the_string)\n puts 'your string in all caps is ' + the_string.upcase\nend", "def say_my_name(name) # created method called \"say_my_name\" that takes an\n # arguement called name. Arguements allow you to pass data into methods. Methods can accept multiple arguements which can simply be seperated by commas.\n\n puts name # prints name\n\nend", "def say_hello(name=\"Ruby Programmer\")\n puts \"Hello #{name}!\"\nend", "def capitalize() end", "def say_hello(name=\"Ruby Programmer\")\n puts \"Hello #{name}!\"\nend", "def upcase; end", "def caps(name)\n\tputs \"#{name.upcase}\"\nend", "def do_something this, that, other\n puts \"We, I mean I, am doing, er, something!\"\nend", "def allcaps(string)\n if string.length > 10\n puts string.upcase # solution does not use puts here but down below as part\n else # of the method call --> puts allcaps(\"hello world\")\n puts string # I think i like this version better, saves writing puts so many times\n end\nend", "def greeting(name)\n \"Hello \" + name.capitalize + \"!\"\nend", "def capitalize\n \"Foo\"\n end", "def make_upper_case(str)\n str.upcase\nend", "def upper_case()\n LuckyCase.upper_case self\n end", "def name_this_method(word)\n\tword[0] = word[0].upcase\nend", "def capitalize(input); end", "def upcase() end", "def hello_world(first_name_or_anything_you_want)\n puts \"Hello #{first_name_or_anything_you_want}\"\nend", "def unusualCapitalization(*x); field('unusualCapitalization', *x) end", "def hello(who)\n puts \"Hello, #{who}\"\nend", "def shout string\n string.upcase\nend", "def print4(nyc)\n\t4.times do puts nyc\n\n\tend\n\n#Prints an uppercase version of the argument given\ndef printupcase (live)\n\n\tputs live.upcase\nend\n\n#Object with two attributes and one method.\n\nclass Dog\nattr_accessor :name, :trait\n\nend\n\nfirst_dog = Dog.new\nfirst_dog.name = \"Bob\"\nfirst_dog.trait = \"annoying\"\n\ndef bark\n\tputs \"au au au\"\n\nend\nend", "def my_upcase\n upcased_arg = ARGV[0].gsub(/[a-z]/) { |char| (char.ord - 0x20).chr }\n $stdout.puts(upcased_arg)\nend", "def say_hello(thing_to_say)\n puts thing_to_say\nend", "def hello(name, age)\n\tputs \"Welcome #{name}, #{age} is definitely not too old to learn how to code\" \nend", "def allcaps(string) # Defining our method with a name and parameter\n if string.length > 10 # 'if' condition\n puts string.upcase # If above is true then this gets executed\n else\n puts string # If above 'if' condition is false this gets executed\n end\nend", "def scream(words)\n words = words.upcase + \"!!!!\"\n puts words\nend", "def hello name = \"\", punctuation = \"!\"\n \"hello #{name.capitalize}#{punctuation}\"\nend", "def shout(str)\n return str.upcase\nend", "def first_method(name = \"Brooke\", age = \"38\")\n puts \"Hello #{name}. You are #{age} years old\"\nend", "def what_am_i arg arg2\n \nend", "def say_hello(thing_to_say)\n puts thing_to_say \nend", "def beauty_hidden(honest_beauty, trust_beauty)\n puts honest_beauty\n puts trust_beauty\nend", "def caps(string)\n return string.upcase\nend", "def caps(string)\n return string.upcase\nend", "def alphabet(arg1 = \"Alpha\", arg2 = \"Beta\")\n puts \"The Parameter is #{arg1}\"\n puts \"The Parameter is #{arg2}\"\nend", "def say_hello(thing_to_say)\n puts thing_to_say\nend", "def say_hello_wih_argument (name)\n puts name\nend", "def hello(name)\n \"Hello, \"\nend", "def say_hello (thing_to_say)\n puts thing_to_say\nend", "def shout(phrase)\n return \"#{phrase.upcase} !!!!\"\n #return \"#{phrase}!!!!\".upcase\nend", "def hello_world # \"def\" is short for \"defining a method\" and we are\n # defining a method called \"hello_world\"\n\n puts \"Hello World!\" # \"puts\" is used to print a value, which in our\n # our case is \"Hello World!\"\n\nend", "def say(words='hello')\n #prints string for words\n puts words + '.'\n # ends defining of method\nend", "def upcase(input); end", "def say words='hello fella'\n puts words\nend", "def hello(name) #\n \"Hello, #{name}!\" #\nend", "def greeting(name)\n \"Hello and welcome to Ruby methods \" + name + \"!\"\nend", "def say_hello(arg)\n puts arg\nend", "def instance_method(arg)\n arg.upcase\nend", "def say_hello(thing_to_say)\n puts thing_to_say\nend", "def say_hello(thing_to_say)\n puts thing_to_say\nend", "def first_method(name, age)\n puts \"Hello #{name}. You are #{age} years old\"\nend", "def yell(msg)\n msg.upcase+\"!\"\nend", "def for_cs_sake(string)\nend", "def say_hello(name= \"Ruby Programmer\")\n puts \"Hello #{name}!\"\n\nend", "def say_hello(arg)\n puts arg\nend", "def say_something(something)\n puts \"#{something}, said Becca\"\nend", "def capitalize_name(name)\n name.call\nend", "def hey_hey; end", "def shout(words)\n\twords.upcase\nend", "def camelcase(s)\n\n\nend", "def saygoodbye(name=\"John\", surname=\"Doe\")\n puts (\"Good Bye \" + name + \" \" + surname)\nend", "def hello(name)\n \"Hello #{name}\"\nend", "def hello(name)\n \"Hello, \" << name\nend", "def hello(name)\n \"Hello, #{name}\"\nend", "def hello(name)\n \"Hello, #{name}\"\nend", "def hello(name)\n \"Hello, #{name}\"\nend" ]
[ "0.72502166", "0.697195", "0.6772961", "0.6768263", "0.67427236", "0.66704303", "0.6651806", "0.6626089", "0.6619024", "0.66150767", "0.6589522", "0.65374064", "0.65316176", "0.65316176", "0.65255535", "0.6497618", "0.6466999", "0.6458147", "0.6457601", "0.6451619", "0.6442812", "0.64321345", "0.6431222", "0.64081556", "0.64037585", "0.63962597", "0.6396067", "0.6391701", "0.6391298", "0.63794136", "0.63671863", "0.63636893", "0.63625973", "0.63574785", "0.6357063", "0.6349689", "0.63428855", "0.63420135", "0.6340469", "0.6324533", "0.6313846", "0.6295317", "0.62789476", "0.62764853", "0.6265438", "0.6262923", "0.62498367", "0.6247751", "0.62421", "0.62359613", "0.62244916", "0.62174416", "0.61986345", "0.6197799", "0.6196963", "0.61894226", "0.6183577", "0.6182021", "0.61704826", "0.6159721", "0.6152467", "0.6134539", "0.61320466", "0.61238164", "0.6120566", "0.61090976", "0.60968953", "0.6089903", "0.6089903", "0.6089523", "0.60861593", "0.60817796", "0.6074851", "0.607451", "0.6072312", "0.60704374", "0.6068489", "0.6068326", "0.6060769", "0.60537386", "0.6053088", "0.60507613", "0.60433173", "0.6042666", "0.6042666", "0.6037915", "0.602429", "0.60221654", "0.6021605", "0.6014545", "0.6012534", "0.6012392", "0.6005134", "0.60011375", "0.60005975", "0.59988016", "0.5996779", "0.5995432", "0.59945107", "0.59945107", "0.59945107" ]
0.0
-1
the Majordomo messages expect all payloads to be wrapped in arrays; each element of the array will be sent as a separate frame
def encode(string) [string] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_payload\n to_array.map { |line| MultiJson.encode(line) }.join(\"\\n\") + \"\\n\"\n end", "def send_arr label, array\n @publisher.send_string label, ZMQ::SNDMORE\n\n # Everything but the last element\n array[0..-2].each do |e|\n @publisher.send_string e.to_s, ZMQ::SNDMORE\n end\n @publisher.send_string array.last.to_s\n end", "def flat_payload\n self.payload.to_a.flatten\n end", "def payload; end", "def payload; end", "def payload\n {:id => id, :body => body, :origin => origin, :original_id => original_id}\n end", "def encode_body(buffer)\n buffer << prior_action_ids.to_msgpack\n end", "def send_batch msgs\n @ws.send encode_batch(msgs)\n end", "def payload=(_arg0); end", "def payload; message[:payload]; end", "def encode_body(buffer)\n # Encode the message count.\n buffer << {\n :count => messages.length\n }.to_msgpack\n \n # Encode all the messages.\n messages.each do |message|\n message.encode(buffer)\n end\n end", "def test_send_mixed_array()\n # Parameters for the API call\n options = {}\n options['file'] = TestHelper.get_file('https://dl.dropboxusercontent.com/u/31838656/binary.png')\n options['integers'] = JSON.parse('[1,2,3,4,5]')\n options['models'] = JSON.parse('[{\"name\":\"Shahid Khaliq\",\"age\":5147483645,\"address\":\"H # 531, S # 20\",\"uid\":\"123321\",\"salary\":20000,\"department\":\"Software Development\",\"joiningDay\":\"Saturday\",\"workingDays\":[\"Monday\",\"Tuesday\",\"Friday\"],\"boss\":{\"name\":\"Zeeshan Ejaz\",\"age\":5147483647,\"address\":\"I-9/1\",\"uid\":\"241123\"},\"dependents\":[{\"name\":\"Future Wife\",\"age\":5147483649,\"address\":\"H # 531, S # 20\",\"uid\":\"123412\"},{\"name\":\"Future Kid\",\"age\":5147483648,\"address\":\"H # 531, S # 20\",\"uid\":\"312341\"}]}, {\"name\":\"Shahid Khaliq\",\"age\":5147483645,\"address\":\"H # 531, S # 20\",\"uid\":\"123321\",\"salary\":20000,\"department\":\"Software Development\",\"joiningDay\":\"Saturday\",\"workingDays\":[\"Monday\",\"Tuesday\",\"Friday\"],\"boss\":{\"name\":\"Zeeshan Ejaz\",\"age\":5147483647,\"address\":\"I-9/1\",\"uid\":\"241123\"},\"dependents\":[{\"name\":\"Future Wife\",\"age\":5147483649,\"address\":\"H # 531, S # 20\",\"uid\":\"123412\"},{\"name\":\"Future Kid\",\"age\":5147483648,\"address\":\"H # 531, S # 20\",\"uid\":\"312341\"}]}]').map{|element| Employee.from_hash(element)}\n options['strings'] = JSON.parse('[\"abc\", \"def\"]')\n\n # Perform the API call through the SDK function\n result = self.class.controller.send_mixed_array(options)\n\n # Test response code\n assert_equal(@response_catcher.response.status_code, 200)\n\n # Test whether the captured response is as we expected\n assert_not_nil(result)\n expected_body = JSON.parse('{\"passed\":true}')\n received_body = JSON.parse(@response_catcher.response.raw_body)\n assert(TestHelper.match_body(expected_body, received_body, check_values: true))\n end", "def send_content(subscriber, message_array)\n unless Rails.env.test?\n puts \"*******\"\n puts message_array\n end\n json_data = create_final_json(subscriber, message_array).to_json\n\n request = Typhoeus::Request.new(\n \"https://api.manychat.com/fb/sending/sendContent\",\n method: :post,\n body: json_data,\n headers: { \"Content-type\" => \"application/json\", \"Authorization\" => self.token },\n )\n request.run\n response = request.response\n return response\n end", "def encode_body(buffer)\n buffer << action.to_msgpack\n end", "def to_payload\n payload = \"\"\n tx_in_wit.each{|w|payload << w.to_payload}\n payload\n end", "def hasMorePayloads; end", "def payload\n msg = {\n data: {\n alert: alert,\n badge: badge || \"Increment\",\n },\n }\n msg[:data][:sound] = sound if sound.present?\n msg[:data][:title] = title if title.present?\n msg[:data].merge! @data if @data.is_a?(Hash)\n\n if @expiration_time.present?\n msg[:expiration_time] = @expiration_time.respond_to?(:iso8601) ? @expiration_time.iso8601(3) : @expiration_time\n end\n if @push_time.present?\n msg[:push_time] = @push_time.respond_to?(:iso8601) ? @push_time.iso8601(3) : @push_time\n end\n\n if @expiration_interval.is_a?(Numeric)\n msg[:expiration_interval] = @expiration_interval.to_i\n end\n\n if query.where.present?\n q = @query.dup\n if @channels.is_a?(Array) && @channels.empty? == false\n q.where :channels.in => @channels\n end\n msg[:where] = q.compile_where unless q.where.empty?\n elsif @channels.is_a?(Array) && @channels.empty? == false\n msg[:channels] = @channels\n end\n msg\n end", "def write(chunk)\n body = ''\n chunk.msgpack_each {|(tag,time,record)|\n\n # define index and sourcetype dynamically\n begin\n index = expand_param(@index, tag, time, record)\n sourcetype = expand_param(@sourcetype, tag, time, record)\n event_host = expand_param(@event_host, tag, time, record)\n token = expand_param(@token, tag, time, record)\n rescue => e\n # handle dynamic parameters misconfigurations\n router.emit_error_event(tag, time, record, e)\n next\n end\n log.debug \"routing event from #{event_host} to #{index} index\"\n log.debug \"expanded token #{token}\"\n\n # Parse record to Splunk event format\n case record\n when Integer\n event = record.to_s\n when Hash\n if @send_event_as_json\n event = Yajl::Encoder.encode(record)\n else\n event = Yajl::Encoder.encode(record).gsub(\"\\\"\", %q(\\\\\\\"))\n end\n else\n event = record\n end\n\n sourcetype = @sourcetype == 'tag' ? tag : @sourcetype\n\n # Build body for the POST request\n if !@usejson\n event = record[\"time\"]+ \" \" + Yajl::Encoder.encode(record[\"message\"]).gsub(/^\"|\"$/,\"\")\n body << '{\"time\":\"'+ DateTime.parse(record[\"time\"]).strftime(\"%Q\") +'\", \"event\":\"' + event + '\", \"sourcetype\" :\"' + sourcetype + '\", \"source\" :\"' + @source + '\", \"index\" :\"' + index + '\", \"host\" : \"' + event_host + '\"}'\n elsif @send_event_as_json\n body << '{\"time\" :' + time.to_s + ', \"event\" :' + event + ', \"sourcetype\" :\"' + sourcetype + '\", \"source\" :\"' + source + '\", \"index\" :\"' + index + '\", \"host\" : \"' + event_host + '\"}'\n else\n body << '{\"time\" :' + time.to_s + ', \"event\" :\"' + event + '\", \"sourcetype\" :\"' + sourcetype + '\", \"source\" :\"' + source + '\", \"index\" :\"' + index + '\", \"host\" : \"' + event_host + '\"}'\n end\n\n if @send_batched_events\n body << \"\\n\"\n else\n send_to_splunk(body, token)\n body = ''\n end\n }\n\n if @send_batched_events\n send_to_splunk(body, token)\n end\n end", "def data\n identifier = @identifier || 0\n expiry = @expiry || 0\n size = [payload].pack(\"a*\").size\n data_array = [1, identifier, expiry, 32, token, size, payload]\n data_array.pack(\"cNNnH*na*\")\n end", "def encode_body(buffer)\n buffer << property.to_msgpack\n end", "def parse_body(buffer)\n super(buffer)\n @id = shift_short(buffer)\n @topics = []\n while buffer.bytesize > 0\n topic_name = shift_string(buffer)\n topic_qos = shift_byte(buffer)\n @topics << [topic_name, topic_qos]\n end\n end", "def parse_body(buffer)\n super(buffer)\n @id = shift_short(buffer)\n @topics = []\n while buffer.bytesize > 0\n topic_name = shift_string(buffer)\n topic_qos = shift_byte(buffer)\n @topics << [topic_name, topic_qos]\n end\n end", "def send_json label, obj\n # parse before send in case of issues\n message = obj.to_json\n @publisher.send_string label, ZMQ::SNDMORE\n @publisher.send_string message\n end", "def test_payload_roundtrip\n # Test with values\n header = EasyIP::Header.new(pack_packet(TWO_WORDS))\n payload1 = header.payload\n header.payload= payload1\n assert_equal payload1, header.payload\n \n # Test with string array\n header = EasyIP::Header.new(pack_packet(LONG_STRING))\n payload1 = header.payload\n header.payload = payload1\n assert_equal payload1, header.payload\n \n # Test with single string\n header.payload = \"test\"\n assert_equal [\"test\"], header.payload\n end", "def convert_payload_to_message(payload)\n message_array = []\n SSE_FIELDS.each do |field|\n value = if payload[field]\n payload[field]\n elsif field == :id\n SecureRandom.hex\n end\n\n message_array << \"\\n#{field}: #{value}\" if value\n end\n\n message_array << \"\\n\\n\"\n message_array.join(\"\")\n end", "def encode_to_array\n components = []\n components << [self.class.id, @channel, @payload.bytesize].pack(PACK_CHAR_UINT16_UINT32)\n components << self.class.encoded_payload(@payload)\n components << FINAL_OCTET\n components\n end", "def send_packet(payload); end", "def message_buffer; end", "def parse_body(buffer)\n super(buffer)\n @id = shift_short(buffer)\n @topics << shift_string(buffer) while buffer.bytesize > 0\n end", "def add_payload_all(fz,payload)\n\tfz.each do |name|\n\t\tadd_payload(name, payload)\n\tend\nend", "def payload\n @payload[0] if @payload\n end", "def build_body(ctrl, request_ctx)\n arr = []\n Launcher.new(ctrl, request_ctx).each &proc {|out| arr << out.to_s }\n end", "def parse_body(buffer)\n super(buffer)\n @topic = shift_string(buffer)\n @id = shift_short(buffer) unless qos.zero?\n @payload = buffer\n end", "def build_payload(options)\n body = options[:body]\n mime = options[:mime]\n if mime\n # user set mime-type, let them deal with it :)\n # fix for ruby 1.8\n if body.is_a? File\n size = body.path.size\n else\n size = body.size\n end\n elsif body.is_a? Hash\n body = Yajl.dump body\n mime = \"application/json\"\n elsif SERIALIZEABLE_TYPES.include? body.class\n if ITERABLE_TYPES.include? body.class\n if is_set_of_strings? body\n # set of strings is primitive\n mime = \"application/vnd.fluiddb.value+json\"\n else\n # we have an Array with some non-String items\n mime = \"application/json\"\n end\n else\n # primitive type\n mime = \"application/vnd.fluiddb.value+json\"\n end\n body = Yajl.dump body\n else\n raise TypeError, \"You must supply the mime-type\"\n end\n [body, mime]\n end", "def inbound_payload\n JSON.parse(data)['inbound']['payload']\n end", "def test_send_model_array()\n # Parameters for the API call\n models = JSON.parse('[{\"name\":\"Shahid Khaliq\",\"age\":5147483645,\"address\":\"H # 531, S # 20\",\"uid\":\"123321\",\"salary\":20000,\"department\":\"Software Development\",\"joiningDay\":\"Saturday\",\"workingDays\":[\"Monday\",\"Tuesday\",\"Friday\"],\"boss\":{\"name\":\"Zeeshan Ejaz\",\"age\":5147483647,\"address\":\"I-9/1\",\"uid\":\"241123\"},\"dependents\":[{\"name\":\"Future Wife\",\"age\":5147483649,\"address\":\"H # 531, S # 20\",\"uid\":\"123412\"},{\"name\":\"Future Kid\",\"age\":5147483648,\"address\":\"H # 531, S # 20\",\"uid\":\"312341\"}]}, {\"name\":\"Shahid Khaliq\",\"age\":5147483645,\"address\":\"H # 531, S # 20\",\"uid\":\"123321\",\"salary\":20000,\"department\":\"Software Development\",\"joiningDay\":\"Saturday\",\"workingDays\":[\"Monday\",\"Tuesday\",\"Friday\"],\"boss\":{\"name\":\"Zeeshan Ejaz\",\"age\":5147483647,\"address\":\"I-9/1\",\"uid\":\"241123\"},\"dependents\":[{\"name\":\"Future Wife\",\"age\":5147483649,\"address\":\"H # 531, S # 20\",\"uid\":\"123412\"},{\"name\":\"Future Kid\",\"age\":5147483648,\"address\":\"H # 531, S # 20\",\"uid\":\"312341\"}]}]').map{|element| Employee.from_hash(element)}\n\n # Perform the API call through the SDK function\n result = self.class.controller.send_model_array(models)\n\n # Test response code\n assert_equal(@response_catcher.response.status_code, 200)\n\n # Test whether the captured response is as we expected\n assert_not_nil(result)\n expected_body = JSON.parse('{\"passed\":true}')\n received_body = JSON.parse(@response_catcher.response.raw_body)\n assert(TestHelper.match_body(expected_body, received_body, check_values: true))\n end", "def send_array(array, flags = 0)\n array = array.to_a\n array[0...-1].each { |str| send_string str, ZMQ::SNDMORE|flags }\n send_string array.last, flags\n end", "def payload_params\n params.require(:payload).permit(:created_at, :is_sent, :is_received, :pal_id)\n end", "def create_message(data); end", "def create_message(data); end", "def test_send_mixed_array()\n # Parameters for the API call\n options = {}\n options['file'] = File::open(TestHelper.get_file('http://localhost:3000/response/image'))\n options['integers'] = APIHelper.json_deserialize(\n '[1,2,3,4,5]'\n )\n options['models'] = APIHelper.json_deserialize(\n '[{\"name\":\"Shahid Khaliq\",\"age\":5147483645,\"address\":\"H # 531, S # 20\",\"'\\\n 'uid\":\"123321\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13T14:01:54.'\\\n '9571247Z\",\"salary\":20000,\"department\":\"Software Development\",\"joiningDa'\\\n 'y\":\"Saturday\",\"workingDays\":[\"Monday\",\"Tuesday\",\"Friday\"],\"boss\":{\"pers'\\\n 'onType\":\"Boss\",\"name\":\"Zeeshan Ejaz\",\"age\":5147483645,\"address\":\"H # 53'\\\n '1, S # 20\",\"uid\":\"123321\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-'\\\n '13T14:01:54.9571247Z\",\"salary\":20000,\"department\":\"Software Development'\\\n '\",\"joiningDay\":\"Saturday\",\"workingDays\":[\"Monday\",\"Tuesday\",\"Friday\"],\"'\\\n 'dependents\":[{\"name\":\"Future Wife\",\"age\":5147483649,\"address\":\"H # 531,'\\\n ' S # 20\",\"uid\":\"123412\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13'\\\n 'T14:01:54.9571247Z\"},{\"name\":\"Future Kid\",\"age\":5147483648,\"address\":\"H'\\\n ' # 531, S # 20\",\"uid\":\"312341\",\"birthday\":\"1994-02-13\",\"birthtime\":\"199'\\\n '4-02-13T14:01:54.9571247Z\"}],\"hiredAt\":\"Sun, 06 Nov 1994 08:49:37 GMT\",'\\\n '\"promotedAt\":1484719381},\"dependents\":[{\"name\":\"Future Wife\",\"age\":5147'\\\n '483649,\"address\":\"H # 531, S # 20\",\"uid\":\"123412\",\"birthday\":\"1994-02-1'\\\n '3\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"},{\"name\":\"Future Kid\",\"ag'\\\n 'e\":5147483648,\"address\":\"H # 531, S # 20\",\"uid\":\"312341\",\"birthday\":\"19'\\\n '94-02-13\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"}],\"hiredAt\":\"Sun, '\\\n '06 Nov 1994 08:49:37 GMT\"},{\"name\":\"Shahid Khaliq\",\"age\":5147483645,\"ad'\\\n 'dress\":\"H # 531, S # 20\",\"uid\":\"123321\",\"birthday\":\"1994-02-13\",\"birtht'\\\n 'ime\":\"1994-02-13T14:01:54.9571247Z\",\"salary\":20000,\"department\":\"Softwa'\\\n 're Development\",\"joiningDay\":\"Saturday\",\"workingDays\":[\"Monday\",\"Tuesda'\\\n 'y\",\"Friday\"],\"boss\":{\"personType\":\"Boss\",\"name\":\"Zeeshan Ejaz\",\"age\":51'\\\n '47483645,\"address\":\"H # 531, S # 20\",\"uid\":\"123321\",\"birthday\":\"1994-02'\\\n '-13\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\",\"salary\":20000,\"departm'\\\n 'ent\":\"Software Development\",\"joiningDay\":\"Saturday\",\"workingDays\":[\"Mon'\\\n 'day\",\"Tuesday\",\"Friday\"],\"dependents\":[{\"name\":\"Future Wife\",\"age\":5147'\\\n '483649,\"address\":\"H # 531, S # 20\",\"uid\":\"123412\",\"birthday\":\"1994-02-1'\\\n '3\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"},{\"name\":\"Future Kid\",\"ag'\\\n 'e\":5147483648,\"address\":\"H # 531, S # 20\",\"uid\":\"312341\",\"birthday\":\"19'\\\n '94-02-13\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"}],\"hiredAt\":\"Sun, '\\\n '06 Nov 1994 08:49:37 GMT\",\"promotedAt\":1484719381},\"dependents\":[{\"name'\\\n '\":\"Future Wife\",\"age\":5147483649,\"address\":\"H # 531, S # 20\",\"uid\":\"123'\\\n '412\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"'\\\n '},{\"name\":\"Future Kid\",\"age\":5147483648,\"address\":\"H # 531, S # 20\",\"ui'\\\n 'd\":\"312341\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13T14:01:54.95'\\\n '71247Z\"}],\"hiredAt\":\"Sun, 06 Nov 1994 08:49:37 GMT\"}]'\n ).map { |element| Employee.from_hash(element) }\n options['strings'] = APIHelper.json_deserialize(\n '[\"abc\",\"def\"]'\n )\n\n # Perform the API call through the SDK function\n result = @controller.send_mixed_array(options)\n\n # Test response code\n assert_equal(200, @response_catcher.response.status_code)\n\n # Test whether the captured response is as we expected\n refute_nil(result)\n expected_body = JSON.parse(\n '{\"passed\":true}'\n )\n received_body = JSON.parse(@response_catcher.response.raw_body)\n assert(TestHelper.match_body(expected_body, received_body, check_values: true))\n end", "def parse\n self.payload ||= []\n while element = yield\n payload << element\n end\n end", "def payload\n @payload ||= JSON.parse(@message.value)\n end", "def _send_message data\n response << data\n end", "def array_to_wire(args={})\n\t\t\tpkt_array = args[:array] || args[:arr] || @array\n\t\t\tinterval = args[:int] || args[:sleep]\n\t\t\tshow_live = args[:show_live] || args[:live] || @show_live\n\n\t\t\t@stream = Pcap.open_live(@iface,@snaplen,@promisc,@timeout)\n\t\t\tpkt_count = 0\n\t\t\tpkt_array.each do |pkt|\n\t\t\t\[email protected](pkt)\n\t\t\t\tsleep interval if interval\n\t\t\t\tpkt_count +=1\n\t\t\t\tputs \"Sent Packet \\##{pkt_count} (#{pkt.size})\" if show_live\n\t\t\tend\n\t\t\t# Return # of packets sent, array size, and array total size \n\t\t\t[pkt_count, pkt_array.size, pkt_array.join.size]\n\t\tend", "def to_payload(payload = nil)\n return {} if payload.nil?\n return {} if payload.respond_to?(:empty?) && payload.empty?\n\n # TODO: refactor this, don't update a hash that's not ours\n payload.update params: MultiJson.dump(payload[:params])\n payload.update signature: signature(payload[:params])\n payload.delete :signature if payload[:signature].nil?\n payload\n end", "def encode_body(buffer)\n buffer << property_id.to_msgpack\n end", "def encode_begin(real_payload, reqs)\n end", "def payload=(payload)\n @message[:payload] = payload\n end", "def handle_arbitrary(msg)\n\t@raw_data = msg.dup()\n\tarbitrary(msg)\n end", "def payload\n PARAMS.each_with_object({}) do |k, hash|\n hash[k] = send(k)\n end\n end", "def packed()\n body = @status.chr + \n @flags.chr + \n TacacsPlus.pack_int_net(@server_msg_len,2) + \n TacacsPlus.pack_int_net(@data_len,2) \n \n body << @server_msg if (@server_msg)\n body << @data if (@data) \n return(body)\n end", "def send(chunk)\n insertStmts = Array.new\n deleteStmts = Array.new\n \n columns = nil\n chunk.msgpack_each { |tag, time, data|\n tag_parts = tag.match(@tag_format)\n target_event = tag_parts['event']\n id_key = tag_parts['primary_key']\n \n keys = Array.new\n values = Array.new\n data = @format_proc.call(data)\n data.keys.sort.each do |key|\n keys << key\n values << data[key].to_json\n end\n \n if (target_event=='insert')\n if columns.to_s.empty?\n columns = \"(#{keys.join(\",\")})\"\n end\n insertStmts.push(\"(#{values.join(\",\")})\")\n elsif (target_event=='update')\n pkey=\"\"\n updates = Array.new\n keys.zip(values) { |key, value|\n if (key==id_key)\n pkey = getPkeyValue(value)\n else\n updates.push(\"#{key}=#{value}\")\n end \n }\n sendStmt = \"UPDATE #{table} SET #{updates.join(\",\")} WHERE #{id_key}=#{pkey}\"\n sendBO(@bo_url, sendStmt) \n elsif (target_event=='delete')\n keys.zip(values) { |key, value|\n if (key==id_key)\n pkey = getPkeyValue(value)\n end\n deleteStmts.push(\"#{id_key}=#{pkey}\")\n }\n end\n }\n \n if insertStmts.length>0\n sendStmt = \"INSERT INTO #{@table} #{columns} VALUES \" + insertStmts.join(\",\")\n sendBO(@bo_url, sendStmt)\n @log.debug(\"sending #{insertStmts.length} rows to bigobject for insert via Restful API\")\n end \n \n if deleteStmts.length>0\n sendStmt = \"DELETE FROM #{@table} WHERE \" + deleteStmts.join(\" or \")\n sendBO(@bo_url, sendStmt)\n @log.debug(\"sending #{deleteStmts.length} rows to bigobject for delete via Restful API\")\n end\n end", "def packed()\n body = TacacsPlus.pack_int_net(@server_msg_len,2) +\n TacacsPlus.pack_int_net(@data_len,2) + \n @status.chr\n \n body << @server_msg if (@server_msg)\n body << @data if (@data)\n\n return(body)\n end", "def payload\n @payload\n end", "def test_three\n print \"Test three (enqueue batch of messages): \"\n msg_ary = (1..14).map{|i| i.to_s}\n EZQ.enqueue_batch(msg_ary,[{'EZQ'=>nil}],'test_queue')\n q = EZQ.get_queue('test_queue')\n 14.times do\n q.receive_message do |msg|\n msg_ary -= [EZQ.strip_preamble(msg.body)]\n end\n end\n puts msg_ary\n if msg_ary.empty?\n puts 'pass'\n else\n puts 'fail'\n end\nend", "def send(*rest) end", "def send(*rest) end", "def send(*rest) end", "def build_request(msgs)\n path = @source_id.nil? ? \"/frames\" : \"/sources/#{@source_id}/frames\"\n req = Net::HTTP::Post.new(path)\n req['Authorization'] = authorization_payload\n req['Content-Type'] = CONTENT_TYPE\n req['User-Agent'] = USER_AGENT\n req.body = msgs.to_msgpack\n req\n end", "def msgData(arr)\n return data = {\"rusr\" => arr[0][1..-1].split(\"!\")[0], \"raddress\" => arr[0].split(\"!\")[1], \"type\" => arr[1], \"who\" => arr[2], \"event\" => arr[3][1..-1], \"args\" => arr[4..-1].join(\" \")}\n end", "def generate(frame)\n bytes = Buffer.new\n length = 0\n\n frame[:flags] ||= []\n frame[:stream] ||= 0\n\n case frame[:type]\n when :data\n bytes << frame[:payload]\n length += frame[:payload].bytesize\n\n when :headers\n if frame[:priority]\n frame[:flags] += [:priority] if !frame[:flags].include? :priority\n end\n\n if frame[:flags].include? :priority\n bytes << [frame[:priority] & RBIT].pack(UINT32)\n length += 4\n end\n\n bytes << frame[:payload]\n length += frame[:payload].bytesize\n\n when :priority\n bytes << [frame[:priority] & RBIT].pack(UINT32)\n length += 4\n\n when :rst_stream\n bytes << pack_error(frame[:error])\n length += 4\n\n when :settings\n if frame[:stream] != 0\n raise CompressionError.new(\"Invalid stream ID (#{frame[:stream]})\")\n end\n\n frame[:payload].each do |(k,v)|\n if !k.is_a? Integer\n k = DEFINED_SETTINGS[k]\n\n if k.nil?\n raise CompressionError.new(\"Unknown settings ID for #{k}\")\n end\n end\n\n bytes << [k & RBYTE].pack(UINT32)\n bytes << [v].pack(UINT32)\n length += 8\n end\n\n when :push_promise\n bytes << [frame[:promise_stream] & RBIT].pack(UINT32)\n bytes << frame[:payload]\n length += 4 + frame[:payload].bytesize\n\n when :ping\n if frame[:payload].bytesize != 8\n raise CompressionError.new(\"Invalid payload size \\\n (#{frame[:payload].size} != 8 bytes)\")\n end\n bytes << frame[:payload]\n length += 8\n\n when :goaway\n bytes << [frame[:last_stream] & RBIT].pack(UINT32)\n bytes << pack_error(frame[:error])\n length += 8\n\n if frame[:payload]\n bytes << frame[:payload]\n length += frame[:payload].bytesize\n end\n\n when :window_update\n bytes << [frame[:increment] & RBIT].pack(UINT32)\n length += 4\n\n when :continuation\n bytes << frame[:payload]\n length += frame[:payload].bytesize\n end\n\n frame[:length] = length\n bytes.prepend(commonHeader(frame))\n end", "def create_ingestion_workflow_payload(params={})\n params[:uuid] ||= Config::Constants::ASSET_UUID\n params[:path] ||= Config::Constants::ASSET_PATH\n params[:title] ||= Config::Constants::ASSET_TITLE\n params[:url] ||= Config::Constants::ASSET_URL + params[:uuid] + '/'\n\n\n {\n 'definitionId': Config::Constants::INGESTION_WORKFLOW_METADATA_ID,\n 'stringVariables': {\n 'assetMetadata': '{ \"clip-type\":\"http://api.ft.com/things/a0e8ca2e-03b4-4321-9b50-4a85b38298cd\",'\\\n'\"clip-description\": \"10 Seconds\", \"location\":\"http://sws.geonames.org/6619890/\",'\\\n'\"interviewee\": \"Jem Rayfield\",\"office\": \"http://api.ft.com/things/a29a5f4f-b4ff-46f7-b597-a30437783e1e\",'\\\n'\"producer\": \"http://api.ft.com/things/a4fda01e-dd90-490b-a7be-7c74eafd3884\",\"freelance-producer\": \"James Condron\",'\\\n'\"reporter-1\": \"Darren Bown\", \"reporter-2\":\"Dario Villanueva\",\"reporter-3\":\"Jon Best\", \"restrictions\": '\\\n'\"true\", \"restriction-description\":\"Sensitive Video....classified top secret\"}',\n 'project-thing-url': params[:url],\n 'projectUUID': params[:uuid],\n 'assetS3Path': params[:path],\n 'assetTitle': params[:title]\n }\n }\n end", "def test_send_integer_array()\n # Parameters for the API call\n integers = JSON.parse('[1,2,3,4,5]')\n\n # Perform the API call through the SDK function\n result = self.class.controller.send_integer_array(integers)\n\n # Test response code\n assert_equal(@response_catcher.response.status_code, 200)\n\n # Test whether the captured response is as we expected\n assert_not_nil(result)\n expected_body = JSON.parse('{\"passed\":true}')\n received_body = JSON.parse(@response_catcher.response.raw_body)\n assert(TestHelper.match_body(expected_body, received_body, check_values: true))\n end", "def marshal_load array\n @delay, @hp, @maxhp, @level, @connections, @exp_left = array\n end", "def payload_data\n case @config.format\n when :json\n @payload.to_json\n when :yaml\n @payload.to_yaml\n else\n @payload.to_hash\n end\n end", "def send_requests(type, msgs, flags=NLM_F_REQUEST, pid=@pid)\n msgs.each_with_index do |msg, index|\n if index < msgs.size - 1\n data << build_message(type, msg, flags|NLM_F_MULTI, next_seq, pid)\n Message.nlmsg_pad(data)\n else\n data << build_message(type, msg, flags, next_seq, pid)\n end\n end\n end", "def encode_body\n raise 'no topics given when serialising packet' if @topics.empty?\n body = encode_short(@id)\n topics.each do |item|\n body += encode_string(item[0])\n body += encode_bytes(item[1])\n end\n body\n end", "def encode_body\n raise 'no topics given when serialising packet' if @topics.empty?\n body = encode_short(@id)\n topics.each do |item|\n body += encode_string(item[0])\n body += encode_bytes(item[1])\n end\n body\n end", "def test_send_string_array()\n # Parameters for the API call\n strings = JSON.parse('[\"abc\", \"def\"]')\n\n # Perform the API call through the SDK function\n result = self.class.controller.send_string_array(strings)\n\n # Test response code\n assert_equal(@response_catcher.response.status_code, 200)\n\n # Test whether the captured response is as we expected\n assert_not_nil(result)\n expected_body = JSON.parse('{\"passed\":true}')\n received_body = JSON.parse(@response_catcher.response.raw_body)\n assert(TestHelper.match_body(expected_body, received_body, check_values: true))\n end", "def message_body_collection(records)\n throw NotImplementedError\n end", "def gateway_message(data)\n {\n data: data,\n timestamp: Time.now.to_i,\n proto_version: 1,\n }\n end", "def gateway_message(data)\n {\n data: data,\n timestamp: Time.now.to_i,\n proto_version: 1,\n }\n end", "def input(payload)\n payload.each { |k,v| payload[k] = v.to_s}\n @lock.synchronize do\n @buffer.push(payload)\n if @buffer.size >= @buffer_size\n flush\n end\n end\n\n nil\n end", "def new_payload(parsed_params, identifier)\n Payload.new(\n source_id: Source.find_by(identifier: @identifier).id,\n url_id: Url.find_or_create_by(url: parsed_params[:url], relative_path: URI(parsed_params[:url]).path).id,\n requested_at: parsed_params[:requested_at],\n responded_in: parsed_params[:responded_in],\n referred_by_id: Referrer.find_or_create_by(referred_by_url: parsed_params[:referred_by]).id,\n request_type_id: RequestType.find_or_create_by(request_type: parsed_params[:request_type]).id,\n parameters: parsed_params[:parameters],\n event_name_id: EventName.find_or_create_by(event_name: parsed_params[:event_name]).id,\n user_agent_id: TrafficSpy::UserAgent.find_or_create_by(web_browser: parsed_params[:user_agent]).id,\n screen_resolution_id: ScreenResolution.find_or_create_by(resolution_width: parsed_params[:resolution_width], resolution_height: parsed_params[:resolution_height]).id,\n ip: parsed_params[:ip]\n )\n end", "def generate_message(payload)\n if payload.is_a? Fixnum\n payload.to_json\n else\n if payload.nil?\n nil\n elsif payload.respond_to?(:empty?) && payload.empty?\n nil\n elsif payload.respond_to? :to_edible\n payload.to_edible\n elsif payload.is_a? String\n payload\n else\n # Not sure that this is the appropriate implementation, perhaps to_s is better\n payload.to_json\n end\n end\n end", "def __send__(*rest) end", "def webhook_payload\n {}\n end", "def messages_payload\n messages.order(created_at: :desc).includes(:user).map do |message|\n {\n message_id: message.id,\n username: message.user.username,\n channel_name: message.channel.name,\n content: message.content,\n created_at: message.created_at\n }\n end\n end", "def handle_v5(payload, block)\n version, flow_records, uptime, unix_sec, unix_nsec, flow_seq_num, engine, sampling = payload.unpack(NETFLOW_V5_HEADER_FORMAT)\n engine_type = (engine & 0xff00) >> 8\n engine_id = engine & 0x00ff\n sampling_algorithm = (sampling & 0b1100000000000000) >> 14\n sampling_interval = sampling & 0b0011111111111111\n\n time = Fluent::EventTime.new(unix_sec.to_i, unix_nsec.to_i)\n\n records_bytes = payload.bytesize - NETFLOW_V5_HEADER_BYTES\n\n if records_bytes / NETFLOW_V5_RECORD_BYTES != flow_records\n $log.warn \"bytesize mismatch, records_bytes:#{records_bytes}, records:#{flow_records}\"\n return\n end\n\n format_full = NETFLOW_V5_RECORD_FORMAT * flow_records\n objects = payload[NETFLOW_V5_HEADER_BYTES, records_bytes].unpack(format_full)\n\n while objects.size > 0\n src_addr, dst_addr, next_hop, input_snmp, output_snmp,\n in_pkts, in_bytes, first_switched, last_switched, l4_src_port, l4_dst_port,\n tcp_flags_16, protocol_src_tos, src_as, dst_as, src_dst_mask = objects.shift(16)\n record = {\n \"version\" => version,\n \"uptime\" => uptime,\n \"flow_records\" => flow_records,\n \"flow_seq_num\" => flow_seq_num,\n \"engine_type\" => engine_type,\n \"engine_id\" => engine_id,\n \"sampling_algorithm\" => sampling_algorithm,\n \"sampling_interval\" => sampling_interval,\n\n \"ipv4_src_addr\" => ipv4_addr_to_string(src_addr),\n \"ipv4_dst_addr\" => ipv4_addr_to_string(dst_addr),\n \"ipv4_next_hop\" => ipv4_addr_to_string(next_hop),\n \"input_snmp\" => input_snmp,\n \"output_snmp\" => output_snmp,\n \"in_pkts\" => in_pkts,\n \"in_bytes\" => in_bytes,\n \"first_switched\" => first_switched,\n \"last_switched\" => last_switched,\n \"l4_src_port\" => l4_src_port,\n \"l4_dst_port\" => l4_dst_port,\n \"tcp_flags\" => tcp_flags_16 & 0x00ff,\n \"protocol\" => (protocol_src_tos & 0xff00) >> 8,\n \"src_tos\" => (protocol_src_tos & 0x00ff),\n \"src_as\" => src_as,\n \"dst_as\" => dst_as,\n \"src_mask\" => (src_dst_mask & 0xff00) >> 8,\n \"dst_mask\" => (src_dst_mask & 0x00ff)\n }\n unless @switched_times_from_uptime\n record[\"first_switched\"] = format_for_switched(msec_from_boot_to_time(record[\"first_switched\"], uptime, unix_sec, unix_nsec))\n record[\"last_switched\"] = format_for_switched(msec_from_boot_to_time(record[\"last_switched\"] , uptime, unix_sec, unix_nsec))\n end\n\n block.call(time, record)\n end\n end", "def writeRawBytes(mData = nil)\n#p 'writeRawBytes'\n\t\tif (self.disconnected?)\n\t\t\treturn nil;\n\t\tend # if not connected\n#p 'am connected'\n\t\t# TODO: allow arrays too\n\t\tif (String != mData.class)\n\t\t\treturn nil;\n\t\tend # if invalid dada format\n#p 'got string data'\n\t\tiCountSent = 0\n\t\tiDataLength = nil\n\t\tiFrameID = nil\n\t\tiCountExpected = -1\n\t\tiSenderID = nil\n\t\tiTargetID = nil\n\t\tbHeaderFound = NO\n\t\tsData = ''\n\n\t\tbegin\n\t\t\tmData.each_byte do |iByte|\n\n\t\t\t\tif (bHeaderFound)\n\t\t\t\t\tif (iTargetID.nil?)\n\t\t\t\t\t\tiTargetID = iByte.chr\n\t\t\t\t\telsif (iSenderID.nil?)\n\t\t\t\t\t\tiSenderID = iByte\n\t\t\t\t\telsif (iFrameID.nil?)\n\t\t\t\t\t\tiFrameID = iByte\n\t\t\t\t\telsif (iDataLength.nil?)\n\t\t\t\t\t\tiDataLength = iByte\n\t\t\t\t\t\tiCountExpected = 5 + iDataLength + 2\n\t\t\t\t\tend # if not yet read target ID\n\t\t\t\telse\n\n\t\t\t\t\t# ruby respects perl (next) over C (continue), and pearls are found under the sea ;)\n\t\t\t\t\tnext if 0x00 == iByte\n\n\t\t\t\t\tbHeaderFound = YES if 0xFF == iByte\n\n\t\t\t\tend # if no header found yet\n\n\t\t\t\tsData << iByte.chr\n\n\t\t\t\tiCountSent += 1\n\n\t\t\t\tbreak if (iCountSent == iCountExpected)\n\n\t\t\tend # loop each byte\n\n\t\trescue Exception => e\n\n\t\t\tp 'KO: error in frame'\np e\n\t\t\treturn 0\n\n\t\tend # try catch\np ' writeRawBytes to ID: ' << iTargetID.to_s\n\t\tsIP = SssSEMapp.oIOframeHandler.getIPstringForID(iTargetID)\n\t\t# sIP could be nil at this point\n\t\t# send the payload\n\t\tif (sIP.nil?)\n\t\t\tself.sendTo(iTargetID, sData)\n\t\telse\n\t\t\tself.sendTo(sIP, sData)\n\t\tend # if target has been 'seen' on Ethernet or not\n\n\t\tiCountSent\n\n\tend", "def test_send_integer_array()\n # Parameters for the API call\n integers = APIHelper.json_deserialize(\n '[1,2,3,4,5]'\n )\n\n # Perform the API call through the SDK function\n result = @controller.send_integer_array(integers)\n\n # Test response code\n assert_equal(200, @response_catcher.response.status_code)\n\n # Test whether the captured response is as we expected\n refute_nil(result)\n expected_body = JSON.parse(\n '{\"passed\":true}'\n )\n received_body = JSON.parse(@response_catcher.response.raw_body)\n assert(TestHelper.match_body(expected_body, received_body, check_values: true))\n end", "def test_send_integer_array()\n # Parameters for the API call\n integers = APIHelper.json_deserialize(\n '[1,2,3,4,5]'\n )\n\n # Perform the API call through the SDK function\n result = @controller.send_integer_array(integers)\n\n # Test response code\n assert_equal(200, @response_catcher.response.status_code)\n\n # Test whether the captured response is as we expected\n refute_nil(result)\n expected_body = JSON.parse(\n '{\"passed\":true}'\n )\n received_body = JSON.parse(@response_catcher.response.raw_body)\n assert(TestHelper.match_body(expected_body, received_body, check_values: true))\n end", "def set_array!(values)\n @objects = []\n @memory = FFI::MemoryPointer.new(MsgObject,values.length)\n\n values.each_with_index do |value,index|\n @objects << MsgObject.new_object(value,@memory[index])\n end\n\n self[:type] = :array\n\n array = self[:values][:array]\n array[:size] = values.length\n array[:ptr] = @memory\n end", "def enqueue_packet(payload); end", "def packed()\n body = TacacsPlus.pack_int_net(@user_msg_len,2) +\n TacacsPlus.pack_int_net(@data_len,2) +\n @flags.chr\n \n body << @user_msg if (@user_msg)\n body << @data if (@data)\n return(body)\n end", "def upgrade_array_body!(response)\n response.body.map! do |body_elem|\n body_elem ||= {}\n body_elem['http_response'] = response\n body_elem\n end\n end", "def create_payload\n payload = {}\n study = self.study\n # retrieve available objects pertaining to submission (submission, configuration, all workflows contained in submission)\n Rails.logger.info \"#{Time.zone.now}: creating AnalysisMetadatum payload for submission \"\n submission = ApplicationController.firecloud_client.get_workspace_submission(study.firecloud_project,\n study.firecloud_workspace,\n self.submission_id)\n configuration = ApplicationController.firecloud_client.get_workspace_configuration(study.firecloud_project,\n study.firecloud_workspace,\n submission['methodConfigurationNamespace'],\n submission['methodConfigurationName'])\n analysis_configuration = AnalysisConfiguration.find_by(name: configuration['methodRepoMethod']['methodName'],\n namespace: configuration['methodRepoMethod']['methodNamespace'],\n snapshot: configuration['methodRepoMethod']['methodVersion'])\n workflows = []\n submission['workflows'].each do |submission_workflow|\n Rails.logger.info \"getting workflow: #{submission_workflow['workflowId']}\"\n\n workflows << ApplicationController.firecloud_client.get_workspace_submission_workflow(study.firecloud_project,\n study.firecloud_workspace,\n self.submission_id,\n submission_workflow['workflowId'])\n end\n # retrieve list of metadata properties\n properties = self.definitions('properties')\n properties.each do |property, definitions|\n # decide where to pull information based on the property requested\n value = nil\n case property\n when 'inputs'\n inputs = []\n workflows.each do |workflow|\n workflow['inputs'].each do |name, value|\n inputs << {'name' => name, 'value' => value}\n end\n end\n value = set_value_by_type(definitions, inputs)\n when 'reference_bundle'\n if analysis_configuration.present? && analysis_configuration.reference_bundle_name.present?\n value = set_value_by_type(definitions, configuration['inputs'][analysis_configuration.reference_bundle_name])\n else\n value = set_value_by_type(definitions, study.workspace_url)\n end\n when 'tasks'\n value = set_value_by_type(definitions, self.get_workflow_call_attributes(workflows))\n when 'description'\n method_name = configuration['methodRepoMethod']\n name = \"#{method_name['methodNamespace']}/#{method_name['methodName']}/#{method_name['methodVersion']}\"\n value = set_value_by_type(definitions, \"Analysis submission of #{name} from Single Cell Portal\")\n when 'timestamp_stop_utc'\n stop = nil\n workflows.each do |workflow|\n end_time = workflow['end']\n if stop.nil? || DateTime.parse(stop) > DateTime.parse(end_time)\n stop = end_time\n end\n end\n value = set_value_by_type(definitions, stop)\n when 'input_bundles'\n value = set_value_by_type(definitions, [study.workspace_url])\n when 'outputs'\n outputs = []\n workflows.each do |workflow|\n outs = workflow['outputs'].values\n outs&.each do |o|\n outputs << {\n 'name' => o.split('/').last,\n 'file_path' => o,\n 'format' => o.split('.').last\n }\n end\n end\n value = set_value_by_type(definitions, outputs)\n when 'name'\n value = set_value_by_type(definitions, configuration['name'])\n when 'computational_method'\n method_name = configuration['methodRepoMethod']\n name = \"#{method_name['methodNamespace']}/#{method_name['methodName']}/#{method_name['methodVersion']}\"\n method_url = ApplicationController.firecloud_client.api_root + \"/api/methods/#{name}\"\n value = set_value_by_type(definitions, method_url)\n when 'timestamp_start_utc'\n value = set_value_by_type(definitions, submission['submissionDate'])\n when 'core'\n core = {\n 'type' => 'analysis',\n 'schema_url' => self.definition_url,\n 'schema_version' => self.version\n }\n value = set_value_by_type(definitions, core)\n when 'analysis_run_type'\n value = set_value_by_type(definitions, 'run')\n when 'metadata_schema'\n value = set_value_by_type(definitions, self.version)\n when 'analysis_id'\n value = set_value_by_type(definitions, self.submission_id)\n end\n payload[property] = value\n end\n payload\n end", "def test_send_string_array()\n # Parameters for the API call\n strings = APIHelper.json_deserialize(\n '[\"abc\",\"def\"]'\n )\n\n # Perform the API call through the SDK function\n result = @controller.send_string_array(strings)\n\n # Test response code\n assert_equal(200, @response_catcher.response.status_code)\n\n # Test whether the captured response is as we expected\n refute_nil(result)\n expected_body = JSON.parse(\n '{\"passed\":true}'\n )\n received_body = JSON.parse(@response_catcher.response.raw_body)\n assert(TestHelper.match_body(expected_body, received_body, check_values: true))\n end", "def test_send_string_array()\n # Parameters for the API call\n sarray = APIHelper.json_deserialize(\n '[\"abc\",\"def\"]'\n )\n\n # Perform the API call through the SDK function\n result = @controller.send_string_array(sarray)\n\n # Test response code\n assert_equal(200, @response_catcher.response.status_code)\n\n # Test whether the captured response is as we expected\n refute_nil(result)\n expected_body = JSON.parse(\n '{\"passed\":true}'\n )\n received_body = JSON.parse(@response_catcher.response.raw_body)\n assert(TestHelper.match_body(expected_body, received_body, check_values: true))\n end", "def payload\n self.update(:payload)\n @payload\n end", "def send_json(packets)\n # TODO: We may have multiple packets here. Verify this logic\n ret = 0\n packets.each do |packet|\n # At this point we can assume we have a data packet\n # We could care about the length but we ignore it for brevity assuming NCHANNELS\n\n # Parse out the sensor values and convert to json\n num_useless_bytes = HEADER_LENGTH + 4 + 1 + 6\n vals = packet[num_useless_bytes...(num_useless_bytes+NCHANNELS*4)].unpack(\n NCHANNELS.times.collect{\"g\"}.join\n )\n\n # TODO: Verify that send_frames actually sends complete messages\n # if this isn't the case we should go back to packetizing client side\n # I think it is\n ret += send_frames([vals.to_json]) # TODO: should we change the thread version to send a string or convert the blob to a string later?\n end\n\n ret\n end", "def b_rdt_send message\n puts 'B Sending Data Unreliably...'\n packet = Packet.new\n packet.payload = message.data\n b_udt_send packet\nend", "def upload_multi_msg(msg_params)\n uri = 'cgi-bin/operate_appmsg?t=ajax-response&sub=create&type=10'\\\n \"&token=#{@token}&lang=zh_CN\"\n headers = {\n referer: 'https://mp.weixin.qq.com/cgi-bin/appmsg'\\\n '?t=media/appmsg_edit&action=edit&type=10'\\\n \"&isMul=1&isNew=1&lang=zh_CN&token=#{@token}\"\n }\n resource = RestClient::Resource.new(@home_url, headers: headers, cookies: @cookies)\n post_msg_res = resource[uri].post msg_params\n JSON.parse post_msg_res.to_s\n end", "def call payload={}\n return payload unless payload[:text] # noope if there is no message to work on\n\n # not efficient, but it's an example :)\n options[:pairs].each do |from, to|\n payload[:text] = payload[:text].gsub from, to\n end\n\n payload # always return the payload from your middleware\n end", "def batch(requests)\n data = requests.map { |request| Request.new(*request).data }\n RPC.log \"CLIENT ENCODE BATCH #{data.inspect}\"\n data.to_json\n end", "def send_multiple(content)\n content.each { |e| send_message(e) }\n end", "def transmissions; end", "def transmissions; end", "def initialize(*payloads)\n @size = 0\n payloads.each do | item_payload |\n push(item_payload)\n end\n end", "def << bytes\n @body << bytes\n end" ]
[ "0.65311843", "0.6202391", "0.6046696", "0.6009739", "0.6009739", "0.5977682", "0.5943428", "0.59109986", "0.5885378", "0.58634925", "0.5840609", "0.58156985", "0.57767576", "0.5699993", "0.56008995", "0.55576664", "0.5527136", "0.5518746", "0.5515965", "0.5482349", "0.5444033", "0.5444033", "0.5443255", "0.54339665", "0.5429792", "0.53903794", "0.5382925", "0.5380874", "0.53673285", "0.5351039", "0.5316188", "0.5314829", "0.53073907", "0.529088", "0.52836907", "0.5275862", "0.52706534", "0.52587634", "0.52390164", "0.52390164", "0.52332157", "0.5224143", "0.52237964", "0.5214943", "0.520908", "0.52089834", "0.52005476", "0.5195765", "0.5190753", "0.5184321", "0.516663", "0.5160209", "0.5151571", "0.51498", "0.51495737", "0.5143651", "0.5133351", "0.5133351", "0.5133351", "0.512953", "0.5124206", "0.5120173", "0.5117073", "0.511614", "0.51151115", "0.51075053", "0.51026845", "0.5097412", "0.5097412", "0.50852454", "0.5080039", "0.50767636", "0.50767636", "0.50704414", "0.5064647", "0.50639147", "0.5061349", "0.50581837", "0.50532925", "0.5044275", "0.5039542", "0.5033863", "0.5033863", "0.5033652", "0.5032516", "0.5031796", "0.503118", "0.5028109", "0.50277233", "0.50149643", "0.5007356", "0.500706", "0.50055057", "0.5000463", "0.49971005", "0.49891433", "0.49829665", "0.4979942", "0.4979942", "0.4978503", "0.49784824" ]
0.0
-1
Y["1", "3", "2"] X["5", "4", "2"] Y.each do | d | X.each do | b | puts d / b end def Z X / Y.to_f end puts(Z) puts("The quotient with remainder is") + Z puts("Where 'Y' is") + Y.to_i end
def hellow3 'Hello' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def divide_numbers x, y\n x.fdiv(y)\nend", "def divide_x_by_y (x, y)\nz = x/y\nend", "def div(x, y)\n x / y\nend", "def divide(x,y)\n x / y\n end", "def divide(x, y)\n if y == 0\n return \"Psst. You can't divide by zero. Please try again.\"\n elsif x.is_a?(Integer) && y.is_a?(Integer) && x % y != 0\n return x.to_f / y\n else\n return x / y\n end\nend", "def division (first_number, second_number)\nfirst_number / second_number\nend", "def divide(numbers)\n numbers.inject { |sum, n| sum / n }\n end", "def divisione(a, b)\n puts \"DIVIDENDO #{a} / #{b}\"\n a / b\nend", "def divide (a,b)\n f = a.to_i / b.to_i\n puts \"Division is: #{f}\"\n end", "def division(value1, value2)\n result = value1 / value2\n puts \"The sum of #{ value1 } / #{ value2 } = #{ result }\"\nend", "def divide(num1, num2)\n num2.to_f / num1.to_f;\nend", "def divide(numerator, denominator)\n puts \"#{numerator} / #{denominator} = #{numerator / denominator}\\n\"\nend", "def divide(num1, num2)\n\tresults = \"\"\n\tif num2 == 0\n\t\t\"False\"\n\telse\n\tresults = num1/num2\nend\n\n\t\t\t\n\t# if number == 0\n\t# \treturn \"Cant't divide a number by 0\"\n\t# else numbers.inject do |divedend, number|\n\t# quo = (divedend /= number).round(2)\n\n\n\t# end\n\n\t# if number.zero?\n # \treturn \"Cannot divide by 0!\"\n\t# else\n # \tquo\n\t# end\n\n\t\n\t# if number != 0 \n\t\t# \treturn quo\n\t# else \n\t\t# \treturn \"error\"\n\t# end\n\n\t# end\n\nend", "def division num1, num2\n total = num1.to_i / num2.to_i\n puts \"--> The total is... #{total}\"\nend", "def divide(first_number, second_number)\n first_number / second_number\nend", "def divisionm(num_1,num_2)\n return num_1 / num_2\nend", "def divide(a, b)\n puts \"DIVIDING #{a} / #{b}\"\n a / b\nend", "def divide(first_number, second_number)\n return first_number / second_number\nend", "def divideThem(numOne, numTwo)\n numOne / numTwo\nend", "def divide(num1, num2)\n return num1 / num2\nend", "def divide (a,b)\n f = a.to_i / b.to_i\n puts \"Division of both number is: #{f}\"\n end", "def divide(num1, num2)\n p num1/num2\nend", "def divide\n match '/'\n factor\n emit_ln 'MOVE (SP)+,D1'\n emit_ln 'DIVS D1,D0'\nend", "def div\n x, y = stack.pop(2)\n push x / y\n end", "def division(input_number1, input_number2)\n\tquotient = input_number1 / input_number2\n\tputs \"The quotient of #{input_number1} and #{input_number2}th is #{quotient}.\"\n\tputs \"Thank you for using the calculator. Goodbye!\"\nend", "def part2(line)\n numbers_str = line.chomp.split()\n numbers = numbers_str.map(&:to_i).sort\n\n # Start from the end\n i = numbers.size - 1\n\n while i > 0\n j = 0\n while j < i\n return numbers[i] / numbers[j] if numbers[i] % numbers[j] == 0\n j = j + 1\n end\n i = i - 1\n end\n return 0\nend", "def divide\n return error_message if stack.empty?\n x = stack.pop.to_f\n y = stack.pop.to_f\n stack << y / x \n @value = y / x \n end", "def pre_divide; end", "def div(p0) end", "def divideme(first_number,second_number) # divides the numbers\r\n if second_number.to_i == 0\r\n puts \"Sorry cannot divide by zero\"\r\n else\r\n if first_number.to_i % second_number.to_i == 0\r\n puts (\"#{first_number} / #{second_number} is :\" + (first_number.to_i / second_number.to_i).to_s)\r\n else\r\n puts (\"#{first_number} / #{second_number} is :\" + (first_number.to_f / second_number.to_f).to_s)\r\n end\r\n end\r\nend", "def divide(number_1, number_2)\n return number_1 / number_2\nend", "def divide(number_1, number_2)\n return number_1 / number_2\nend", "def divide(number_1, number_2)\n return number_1 / number_2\nend", "def post_divide; end", "def division\n\tputs \"which numbers would you like to divide\"\n\tdiv_number1 = gets.chomp.to_f\n\tdiv_number2 = gets.chomp.to_f\n\tif div_number2.to_f == 0\n\t\tputs \"That is not possible, you failed fourth grade math.\"\t\t\n\telse\n\t\tputs div_number1.to_f / div_number2.to_f\n\tend\nend", "def divide(first_number, second_number)\n return first_number / second_number\n end", "def /(divisor)\n return map {|currency, money| money / divisor}\n end", "def divide(number_one, number_two)\nnumber_one / number_two\nend", "def div_stringed(num1, num2)\r\n\r\nend", "def divide(input_number)\n $number /= input_number\n return $number\nend", "def divide(a,b)\n a/b\nend", "def DivisionStringified(num1,num2)\n\n result = (num1.to_i / num2.to_i).to_s.reverse.split(\"\")\n new = []\n\n result.each_with_index do |num, index|\n if (index) % 3 == 0 && index != 0 \n new << \",\"\n end\n new << num \n end\n \n \n # code goes here\n return new.join(\"\").reverse\n \nend", "def divide(a, b)\n puts \"DIVIDING #{a} / #{b}\"\n return a / b\n a + b # This is ignored as the output due to the return\nend", "def div(y)\n quo(y, ZERO)\n end", "def divide(n1, n2)\n divide = n1 / n2\n return divide\nend", "def divide(x, y)\n if x == 0 || y == 0\n return \"We dont do math on zeros\"\n end\n\n x / y\nend", "def divide(interpreter)\n stack = interpreter.stack\n a = stack.pop\n b = stack.pop\n stack.push(b/a) if a && b\n end", "def divide(left, right, result) #method\n left = get_dir(left)\n right = get_dir(right)\n @current_context[result] = get_value(left).to_f / get_value(right).to_f\n end", "def divide(a, b)\n divide = a / b\n return divide\nend", "def self_dividing_numbers(left, right)\n result = []\n i = left\n while i <= right #while i is smaller than right bound\n str = i.to_s #converts all int to string\n j = 0\n c = 0\n while j < str.length\n if str[j].to_i == 0\n break\n elsif i % str[j].to_i == 0\n c += 1\n end\n j+= 1\n end\n if c == str.length\n result.push(i)\n end\n i += 1\n end\n return result\nend", "def divide(dividend:, divisor:)\n dividend / divisor\nend", "def reduce\n if denominator.to_i == 0\n puts \"ERROR\"\n else\n min = [numerator,denominator].min\n min.downto(2) do |x|\n if numerator%x == 0 && denominator%x == 0\n n = numerator/x\n d = denominator/x\n puts n.to_s + \"/\" + d.to_s\n break\n end\n end\n end\n end", "def divide\n\n\t\t# make sure when can perform the operation\n\t\tempty?\n\n\t\t# pop the last 2 numbers and store but need to be converted to a float\n\t\tnum_1 = @calculator.pop.to_f\n\t\tnum_2 = @calculator.pop.to_f\n\n\t\t# division is performed and pushed to @calc\n\t\t@calculator << num_2 / num_1\n\n\tend", "def divide\n C.curry.(->(x, y) { x / y })\n end", "def gc_divisor(ints:[]) \n arr = []\n arr2 = []\n for i in ints \n arr << i \n end\n \n arr.each do |num|\n for i in (1..num)\n if (num % i == 0)\n arr2 << i\n end\n end\n end\n # positive \n #divides numbers without a remainder\n #largetst one of such number\n arr2.each\nend", "def on_div(ast_node, context)\n left, right = *ast_node\n\n return on_call_number(context, left) / on_call_number(context, right)\n end", "def division(first_number, second_number, third_number)\n# Conditional that removes divide by zero error\n\t\tif second_number == 0\n\tresult = \"You can't divide by zero\"\nelsif third_number == 0\n\tresult = \"You can't divide by zero\"\nelse\n\t\t\t\tif (first_number == \"\") || (second_number == \"\") || (third_number == \"\")\n\tnil\nelsif (first_number == []) || (second_number == []) || (third_number == [])\n\tnil\nelse\n\tresult = first_number / second_number / third_number\nend\nend\n\tresult\n\nend", "def div \n puts \"hi\"\n y = 0\n raise Srikanth if y == 0\n x = 2/y\n puts x\n rescue Srikanth => e\n puts \"change the value of denominator\"\n puts e.ex\n end", "def divide(dividend, divisor)\n\n denom = divisor\n current = 0\n\n return 0 if denom > dividend\n return 1 if denom == dividend\n\n # 5 45\n while denom <= dividend do \n \tdenom += divisor\n \tcurrent += 1 \n end\n remainder = dividend - (denom - divisor)\n current\nend", "def div(arg0)\n end", "def test_13_multiple_integers_and_floats\r\n\r\n results = divide(284.182, 3.2, 19, 0.01928, 39.2944)\r\n\r\n assert_equal(6.16958, results)\r\n\r\n end", "def divmod(p0) end", "def divide()\n \t\terror?\n \t\tsecond = @stack.pop\n \t\tfirst = @stack.pop\n \t\t@stack << (first.to_f / second.to_f)\n end", "def divide_by_subtraction(dividend, divisor)\n #puts \"#{dividend}/#{divisor} is :\"\n quotient = 0 \n remainder = 0\n if dividend < divisor\n return [ 0, dividend]\n elsif divisor == 0 #can't do division by zero\n return nil\n else\n while dividend - divisor >= divisor\n dividend = dividend - divisor\n quotient += 1\n end\n \n if dividend != 0\n remainder = dividend - divisor\n quotient += 1\n end\n \n return [ quotient , remainder]\n end\n\n\nend", "def decimal\n if denominator.to_i == 0\n puts \"ERROR\"\n else\n x = numerator.to_f/denominator.to_f\n puts x\n end\n end", "def div(other)\n divmod(other).first\n end", "def denominator() end", "def / other\n other = Fraction.new(other) if other.instance_of? Fixnum\n self * other.inv\n end", "def Division\n print \"Ingrese El numero 1: \"\n numero1 = gets.chomp.to_f\n print \"Ingrese El numeor 2: \"\n numero2 = gets.chomp.to_f\n\n if numero2 == 0\n puts \"\\nNo es posible dividir entre 0\"\n else\n puts \"\\nDivision: #{numero1 / numero2}\"\n end\n end", "def divide(one,two)\n\treturn \"I don't think so\" if two ==0\n\tone / two\nend", "def zero_div\n x = 5\n 1/0\nend", "def divide_line_by(i,pivot, m)\n for j in 1..m[0].size-1\n m[i][j] /= pivot.to_f\n end\n print \"Dividir L#{i} por #{pivot}\".italic.blue \n m\nend", "def getQuo ( x , y )\n\tq = x / y\n\treturn q\nend", "def divmod(y)\n quomod(y, ZERO)\n end", "def divide(numerator, denominator)\n $LOG.debug(\"Numerator: #{numerator}, denominator #{denominator}\")\n begin\n result = numerator / denominator\n rescue Exception => e\n $LOG.error \"Error in division!: #{e}\"\n\tresult = nil\n end\n return result\n end", "def /(other)\n\tself.num / other.num\nend", "def dec_remainder_of_two_floats(f_dividend, f_divisor)\n # your code goes here\n puts (f_divisor/f_dividend).round(1)\nend", "def do_division_by_zero; 5 / 0; end", "def do_division_by_zero; 5 / 0; end", "def do_division_by_zero; 5 / 0; end", "def Divide(val)\n self.value /= val\n end", "def divide\n\t\tif @operands.size>= 2\n\t\t\tnew_n = (@operands[-2].to_f / @operands[-1].to_f)\n\t\t\[email protected](2)\n\t\t\[email protected] new_n\n\t\telse\n\t\t\traise \"calculator is empty\"\n\t\tend\n\tend", "def self_dividing_numbers(left, right)\n result_array = []\n\n (left..right).each do |i|\n arr = array_of_digits(i)\n\n self_dividing = true\n arr.length.times do |digit|\n if arr[digit] == 0\n self_dividing = false\n else\n self_dividing = false if i % arr[digit] != 0\n end\n end\n result_array << i if self_dividing\n end\n\n result_array\nend", "def div(x, op, y)\n x.send(op, y)\nend", "def divide\n match \"/\"\n comment \"/\"\n factor\n emitln \"movl %eax, %ebx\"\n emitln \"movl -(0x8*#{$stackdepth})(%rsp), %eax\"\n emitln \"cltd\"\n emitln \"idivl %ebx\"\nend", "def divisors(x)\n (2..Math.sqrt(x) + 1).select { |i| x % i == 0 }.map { |n| [n, x/n] }.flatten.uniq.sort\nend", "def div_operation()\n print_message \"Write number and press ENTER to divide more or press 'r' to show result\"\n result = 0\n div = gets.chomp\n if div != 'r'\n result = div.to_f\n end\n begin\n begin\n div = gets.chomp\n if div != 'r'\n result /= div.to_f\n end\n rescue StandardError => e\n print_error_message \"Invalid number. Ending Division operation.\\n#{e.message}\"\n div = 'r'\n end\n end while div.downcase != 'r'\n print_message \"Result of dividing: #{result.to_s}\"\n end", "def DivisionStringified(num1, num2)\n quotient = (num1.to_f / num2.to_f).round.to_i.to_s\n\n result = []\n quotient.reverse.chars.each.with_index do |num, ndx|\n result << \",\" if ndx > 2 && ndx % 3 == 0\n result << num\n end\n result.reverse.join(\"\")\nend", "def Division(num1,num2)\n\n arr_1 = []\n arr_2 = []\n \n (1..num1).each do |val_1|\n if num1 % val_1 == 0 \n arr_1 << val_1\n end\n end\n \n (1..num2).each do |val_2|\n if num2 % val_2 == 0 \n arr_2 << val_2\n end\n end\n \n \n \n # code goes here\n return (arr_2 & arr_1).last \n \nend", "def divide(other)\n Rubinius.primitive :float_div\n redo_coerced :/, other\n end", "def test_division\n assert_equal 13,@a.division(@b).num\n assert_equal 12,@a.division(@b).denom\n end", "def divmod(arg0)\n end", "def divmod(arg0)\n end", "def division_and_average(array_1,array_2)\n \tavg = 0\n \ttotal_element = 0\n \tarray_1.each_with_index do |array_pixel,i|\n \t\tarray_pixel.each_with_index do |number,j|\n \t\t\tarray_1[i][j] = number / array_2[i][j]\n \t\t\tavg = avg + array_1[i][j] \n \t\t\ttotal_element = total_element + 1\n \t\tend\n \tend\n\n \treturn (avg / total_element)\n end", "def fdiv(arg0)\n end", "def divmod(val); end", "def divisible_by(numbers, divisor)\n\n # Create new array to store our results in\n divide_array = []\n\n # Iterate through our set of given numbers, and determine whether each number\n # being passed in has a remainder of 0 after being divided by our given divisor\n numbers.each do |el|\n if el % divisor == 0\n\n # If our if statement evaluates to true, then append that number onto our new array\n # divide_array\n divide_array << el\n end\n end\n\n # Return array containing all elements divided evenly by our divisor\n divide_array\nend", "def div_by(x,y)\n begin\n x / y\n rescue\n puts \"oops, what happened?\"\n retry\n end\nend", "def fraction(x, y)\n execute(:fraction, x, y)\n end", "def ediv(arr,divisor)\n if divisor.is_a?(Array)\n raise \"In array division, the two arguments must have the same length!\" unless arr.length == divisor.length\n r = []\n (0...arr.length).each { |i| r[i] = arr[i]/divisor[i] }\n r\n else\n arr.map { |x| x/divisor }\n end\n end", "def divide(dividend, divisor)\n # new_dividend = dividend > 0 : -divident : dividend\n # new_divisor = divisor > 0 : -divisor : divisor\n\n new_dividend = dividend\n new_divisor = divisor\n\n quotient = 0\n while new_dividend >= new_divisor\n multiplier = 0\n while (new_divisor << multiplier + 1) < new_dividend\n multiplier += 1\n end\n\n quotient += (1 << multiplier)\n new_dividend -= new_divisor << multiplier\n end\n\n quotient\nend" ]
[ "0.7373507", "0.71624345", "0.71368355", "0.6980973", "0.6864615", "0.68050206", "0.67962015", "0.67644656", "0.67174464", "0.66777813", "0.6646321", "0.6643148", "0.663118", "0.6611416", "0.66016644", "0.65765357", "0.65709174", "0.65491205", "0.65292597", "0.6528061", "0.6527375", "0.6519295", "0.651125", "0.65056413", "0.6500743", "0.6493023", "0.6489753", "0.6489123", "0.648041", "0.6473722", "0.6467437", "0.6467437", "0.6467437", "0.64618796", "0.6457626", "0.6452956", "0.6451684", "0.6450417", "0.64364654", "0.6421609", "0.63835216", "0.63622487", "0.6353574", "0.6347642", "0.6324078", "0.6284491", "0.6273684", "0.6261666", "0.62536037", "0.62385046", "0.623691", "0.623666", "0.62359893", "0.6233553", "0.6223872", "0.6215086", "0.6206901", "0.61950994", "0.6183277", "0.61778927", "0.617616", "0.6166684", "0.6156094", "0.61558205", "0.6152669", "0.6138937", "0.6136776", "0.6125823", "0.6121587", "0.6117748", "0.6110566", "0.61081433", "0.6107709", "0.60868806", "0.60754436", "0.6070075", "0.6054318", "0.6053893", "0.6053893", "0.6053893", "0.6048387", "0.60469055", "0.6042455", "0.6036864", "0.6035384", "0.60322195", "0.60201496", "0.60048056", "0.5998288", "0.59875476", "0.5986636", "0.5984476", "0.5984476", "0.5983396", "0.5973257", "0.596932", "0.59652233", "0.59643245", "0.59562695", "0.5954747", "0.59508944" ]
0.0
-1
C = (F 32) 5 / 9
def my_func(f) (f - 32) * 5/9 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def c2f(c)\n c * 9.0 / 5 + 32\nend", "def f2c(temp_f)\n (temp_f - 32) * 5 / 9\nend", "def ctof(c)\n\tc * (9.0 / 5.0) + 32\nend", "def f2c(f)\n\tc = (5.0/9.0)*(f-32.0)\n\treturn c\nend", "def ctof(c)\n f = c * 9.0/5.0 + 32.0\nend", "def ctof(c)\n c * 9.0/5.0 + 32.0\nend", "def ctof(tempC)\n (tempC * (9.0/5.0)) + 32\nend", "def f2c(t)\n\treturn (t - 32) * 5.fdiv(9)\nend", "def ctof(cel)\n cel * 9.0 / 5.0 + 32\nend", "def ctof(temp)\n return temp*9/5.to_f + 32\nend", "def c2f(c)\n (c*9.0/5+32).to_f.round(2)\nend", "def ctof(temp)\n\t(temp * 9/5.0) + 32\nend", "def ctof(c)\n ((c * 1.8) + 32).round(1)\nend", "def ctof(temp)\n\treturn (temp.to_f * 9 / 5) + 32\nend", "def ctof(cel)\n (cel * 9.0) / 5.0 + 32\nend", "def ctof(tempc)\n\ttempf = (tempc * 9 / 5.0) + 32\n\treturn tempf\nend", "def ctof(temp)\n temp * (9.0 / 5.0) + 32\nend", "def F_to_C(degrees)\n\t(degrees-32)*5/9.to_f\nend", "def ctof(temp)\n temp = temp.to_f * 9 / 5 + 32\n return temp.to_f\nend", "def ctof(celcius)\n\treturn ((celcius.to_f*9)/5)+32\nend", "def ctof(ctemp)\n32.0+(ctemp*9.0/5.0)\nend", "def ctof celcius\n\tcelcius.to_f*(9.0/5.0)+32\nend", "def ctof(temp)\n ctof = (temp * (9.0/5.0)) + 32\nend", "def ctof(c) # c celsius parameter/value to be converted to f fahrenheit\n return c * 9.0/5.0 + 32\nend", "def ftoc f\n (f - 32)*5/9\nend", "def ctof(celsius)\n (celsius * 9/5.to_f) + 32\nend", "def fahrenheit_to_celsius(f)\n\tc = (f - 32) / 1.8\nend", "def ctof(n) \n c=1.8\n return ((n*c)+32).to_i \nend", "def convert_temp(f)\n return (f - 32) * 5/9\nend", "def ctof (degres)\n return ((degres * 1.8) + 32)\nend", "def converttemp (f)\n return (f-32) * (5/9.0)\nend", "def ctof(tp_c)\n\tf = (tp_c * 9.0/5.0) + 32.0\n f = f.to_f\n return f\nend", "def celsius(f)\n #(f - 32) / 1.8 = c.to_i\n c = ((f.to_i) - 32) * 5 / 9\n \"The temperature in Celsius is #{c}.\"\nend", "def ctof(celsius)\n\n (celsius * 9/5) + 32\n\nend", "def convert_to_celcius(temp)\n\t (temp - 32) * 5/9\nend", "def f_to_c(fahrenheit)\n celsius = (fahrenheit - 32.0) * (5.0 / 9.0)\n puts celsius\nend", "def ctof temp2\n (temp2*1.8) + 32\nend", "def c_to_f(celsius)\n fahrenheit = (celsius * (9.0 / 5.0)) + 32\n puts fahrenheit\nend", "def ftoc(num)\n celsius = (num - 32) * 5 / 9\nend", "def ftoc(f)\n\tc = (f - 32).to_f * (5.0 / 9.0)\n\treturn c\nend", "def convert(temp_f)\n (temp_f - 32) * 5 / 9\nend", "def degToC(degF)\n (degF-32)*5/9\nend", "def celcius(fahrenheit)\n\t(fahrenheit - 32) * 5 / 9\nend", "def ftoc(temp)\n return (temp-32)*5/9\nend", "def ctof(celsius)\n celsius * 1.8 + 32\nend", "def v(r,c) (f(r)/f(c)/f(r-c)).to_s end", "def fahrenheit_to_celsius f\n 5.0 / 9.0 * (f - 32.0)\nend", "def convert(f)\n (f - 32.0) * 5 / 9\nend", "def ftoc(temp)\n\t(temp - 32) * 5/9.0\nend", "def fahrenheit_to_celsius(tempf)\n tempc = ((tempf.to_f()-32)*5)/9\n return tempc\nend", "def ftoc(tempF)\n (tempF - 32.0)*5.0/9.0\nend", "def in_celsius\n \t@c ? @c : (@f - 32) * 5.0 / 9.0\n end", "def farenheit_to_celsius(temp)\n return (temp - 32) * 5 / 9\nend", "def ftoc(temp)\n\t(temp - 32) * 5.0/9.0\nend", "def celsius_to_fahrenheit(celsius)\n (celsius.to_f * 9) / 5 + 32\nend", "def celcius_calculation(fahrenheit_input) #Celcius calculation\n ((fahrenheit_input.to_f - 32) * 5) / 9\nend", "def fahrenheit_to_celsius(temp)\n (temp.to_f - 32) * 5/9\nend", "def erlang_c(m, u)\n d = power_fact(m, u)\n s = 1.0\n (1..(m - 1)).each do |k|\n s += power_fact(k, u)\n end\n d / (d + (1 - u / m) * s)\n end", "def ftoc(f)\n c = (f - 32.0) * 5.0 / 9.0\nend", "def get_fahrenheit_from_celsius( celsius )\n return fahrenheit = celsius * (9.0 / 5.0) + 32.0\nend", "def ftoc(tempF)\n (tempF - 32.0) * (5.0 / 9.0)\nend", "def fahrenheit_to_celsius(fartemp)\n return (fartemp - 32) * 5/9\nend", "def convert_to_fahrenheit(temp)\n return ((temp * 9) /5) + 32\nend", "def ftoc(f)\n\tf = f.to_f\n\t(f - 32) * 5.0/9.0 \nend", "def ftoc(fahrenheit)\n\tcelsius = ((5/9.to_f) * (fahrenheit - 32)).to_i\nend", "def in_celsius\n (@fahrenheit - 32) * (5.0/9.0)\n end", "def celsius_fahrenheit (c_temp)\r\n\tf = c_temp * 9 / 5 + 32\r\n puts \"The temperature in fahrenheitis \" + f.to_s \r\n\treturn f\r\nend", "def ftoc fahrenheit\n\t(fahrenheit.to_f-32)*(5.0/9.0)\nend", "def fahrenheit_to_celsius(far_temp)\n return (far_temp -32) * (5/9)\nend", "def convert( temp_in_farenheit)\n (temp_in_farenheit.to_f - 32) * 5/9\nend", "def in_fahrenheit\n \t@f ? @f : @c * 9.0 / 5.0 + 32\n end", "def toFahrenheit(celsius)\n return (celsius*9.0/5.0).round+32\nend", "def toFahrenheit(celsius)\n return (celsius*9.0/5.0).round+32\nend", "def ftoc(fahr)\n\tcelc = (((fahr*10) - 320).to_f) / 18\nend", "def convert_to_fahrenheit(temp)\n temp * 9/5 + 32\nend", "def convert(fahrenheit)\n (fahrenheit - 32) * 5 / 9 \nend", "def celsius_to_fahrenheit(celsius = 0.0)\n fahrenheit = (((9 * celsius) / 5) + 32)\n \"the value #{celsius} in fahrenheit is #{fahrenheit}\"\nend", "def celsius_to_fahrenheit(temp)\n temp.to_f * 9/5 + 32\nend", "def ftoc(fahrenheit)\n\n (fahrenheit - 32) * 5/9\n\nend", "def fahrenheit_to_celsius(n)\n fahrenheit = (n -32)*5/9\n return fahrenheit.round(2)\nend", "def fahrenheit_to_celsius(farenheit)\nreturn (farenheit - 32) * 5 / 9\n #add test code here\nend", "def ftoc(fahrenheit)\n celcius = (fahrenheit - 32) * 5 / 9.0\n celcius\nend", "def fahrenheit_to_celsius(number)\n celsius_temp = (number-32) * (5.0/9.0)\n return celsius_temp.to_i\nend", "def to_celsius(fahrenheit)\n (fahrenheit - 32) * (5.0 / 9.0)\nend", "def ftoc(farenVal)\n\tresult = (farenVal.to_f - 32) * 5 / 9\n\tresult.to_i\n\n\treturn result\nend", "def celcius_to_farenheit(temp_of_boil)\n\t1.8 * temp_of_boil + 32\nend", "def ctof(centigrade_temp)\n\tfahrenheit_temp = ((centigrade_temp * 1.8) + 32).to_f\nend", "def convert_tocelsius(fahrenheit)\n # return (fahrenheit - 32) * (5/9)\n return fahrenheit*5/9 - 32*5/9 \nend", "def convert_to_fahrenheit(degrees_c)\n\treturn ((degrees_c * 9.0) / 5.0) + 32\nend", "def celscius_to_farenheit(temp_of_boil)\n\t1.8 * temp_of_boil + 32\nend", "def prop_c\n bases_c / length.to_f\n end", "def ftoc(fahrenheit)\n\t(fahrenheit - 32) * 5/9.to_f\nend", "def convertCtoFandFtoC\n\t\tif @tempUnit == \"fahrenheit\"\n\t\t\tresult = ((@temperature - 32) * 5/9)\n\t\telsif @tempUnit == \"celsius\"\n\t\t\tresult = ((@temperature + 32) * 9/5)\n\t\tend\n\t\treturn (result).round(3)\n\tend", "def ctof(temp)\n raise ArgumentError, \"argument is not numeric\" unless temp.is_a? Numeric #raises exception when error thrown\n return (9.0/5.0) * temp + 32.0\nend", "def convert(fahrenheit)\n celsius = (5 * (fahrenheit - 32))/9\nend", "def convert(_Fahrenheit)\n (_Fahrenheit.to_f - 32) * 5 / 9\n end", "def ftoc(degrees)\n (5 / 9.0) * (degrees - 32)\nend", "def convert_fahrenheit(celsius)\n\tmyfahrenheit=((9 * celsius.to_f)/5 +32)\nend", "def ftoc(temperature)\n return celsius = (temperature.to_f - 32) * 5 / 9\nend", "def ftoc(farenheit)\n temp_in_c = (farenheit - 32)*(5.0/9.0)\n temp_in_c % 1 > 0 ? temp_in_c.round(1) : temp_in_c.round(0)\nend" ]
[ "0.8089761", "0.808306", "0.8053431", "0.7844864", "0.779167", "0.77519494", "0.77133775", "0.76750356", "0.75938225", "0.7559806", "0.7530019", "0.7508456", "0.74995494", "0.7493697", "0.74671", "0.7447913", "0.7389961", "0.72900295", "0.7255671", "0.72258395", "0.72123337", "0.7202936", "0.7173296", "0.7143242", "0.7123964", "0.71004975", "0.70402044", "0.7027016", "0.70065904", "0.70046824", "0.6981255", "0.6972716", "0.6946522", "0.6909296", "0.68522835", "0.6851097", "0.6850425", "0.68167794", "0.68059397", "0.6783355", "0.6782568", "0.67809683", "0.6746709", "0.67352176", "0.6721707", "0.6708709", "0.66760796", "0.6651762", "0.658977", "0.6580799", "0.6572601", "0.6553226", "0.65369445", "0.6526711", "0.65015554", "0.64837235", "0.6481773", "0.64711577", "0.64351684", "0.6412641", "0.6400779", "0.63802177", "0.6350799", "0.6339322", "0.6332117", "0.6320718", "0.6282327", "0.6271704", "0.62700856", "0.62623394", "0.62583894", "0.62559503", "0.62559503", "0.6245842", "0.623086", "0.62263006", "0.6217735", "0.62175363", "0.621339", "0.6207523", "0.61944556", "0.61821216", "0.61770767", "0.61664706", "0.61593544", "0.61564946", "0.61544883", "0.61130303", "0.6109521", "0.61075723", "0.6082532", "0.6080435", "0.60702187", "0.6056452", "0.60500467", "0.6024514", "0.5993275", "0.5989496", "0.5970222", "0.59649086" ]
0.6506778
54
Get roles accessible by the current item
def accessible_roles @accessible_roles = Role.accessible_by(current_ability, :read) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def accessible_roles\n @accessible_roles = Role.accessible_by(current_ability,:read)\n end", "def accessible_roles\n @accessible_roles = Role.accessible_by(current_ability,:read)\n end", "def accessible_roles\n @accessible_roles = Role.accessible_by(current_ability,:read)\n end", "def accessible_roles\n @accessible_roles = Role.accessible_by(current_ability,:read)\n end", "def accessible_roles\n @accessible_roles = Role.accessible_by(current_ability,:read)\n end", "def roles\n self.dig_for_array(\"roles\")\n end", "def accessible_roles\n index = ROLES.index(self.role)\n roles = User::ROLES[0..index].map{|x| [x.humanize, x]} if index\n return roles\n end", "def accessible_roles\n @accessible_roles = Level.accessible_by(current_ability, :read)\n end", "def accessible_roles\n @accessible_roles = Role.accessible_by(current_ability)\n end", "def roles\n roles_from_users\n end", "def accessible_roles\n @accessible_roles = Role.accessible_by(current_ability, :read)\n end", "def accessible_roles\n #@accessible_roles = Role.accessible_by(current_ability,:read)\n @accessible_roles = User::ROLES\n end", "def the_roles\n roles.each.map{|_r| User::ROLES[_r.to_sym] }\n end", "def roles\n self.class.roles.map do |name|\n __send__(name)\n end\n end", "def pass_on_roles\n r = self.all_roles\n if self.has_access?(:superadmin)\n r = Role.get(Access.roles(:all_users))\n elsif self.has_access?(:admin)\n r = Role.get(Access.roles(:admin_roles))\n elsif self.has_access?(:centeradm)\n r = Role.get(Access.roles(:center_users))\n end\n return (r.is_a?(Array) ? r : [r])\n end", "def pass_on_roles\n r = self.all_roles\n if self.has_access?(:superadmin)\n r = Role.get(Access.roles(:all_users))\n elsif self.has_access?(:admin)\n r = Role.get(Access.roles(:admin_roles))\n elsif self.has_access?(:centeradm)\n r = Role.get(Access.roles(:center_users))\n end\n return (r.is_a?(Array) ? r : [r])\n end", "def roles\n # we can't use abilities as those are not defined when creating a new operator that is not yet saved\n #result = abilities.collect(&:name)\n authorizations.collect{|auth| auth.ability.try(:name)}\n end", "def roles\n # we can't use abilities as those are not defined when creating a new operator that is not yet saved\n #result = abilities.collect(&:name)\n authorizations.collect{|auth| auth.ability.try(:name)}\n end", "def roles_from_users\n Role.for_resource(self)\n end", "def roles\r\n @roles ||= user_roles.map(&:name)\r\n end", "def roles\n roles_as_editor + roles_as_reviewer + role_as_admin\n end", "def pass_on_roles\n r = self.roles.to_a\n if self.has_access?(:superadmin)\n r = Role.get(Access.roles(:all_users)).to_a\n elsif self.has_access?(:admin)\n r = Role.get(Access.roles(:admin_roles)).to_a\n elsif self.has_access?(:centeradm)\n r = Role.get(Access.roles(:center_users)).to_a\n end\n return (r.is_a?(Array) ? r : [r])\n end", "def my_roles(user)\n user.roles & self.design_review_results.collect { |drr| drr.role }\n end", "def roles\n response[\"roles\"]\n end", "def roles\n @resource_roles\n end", "def roles_with_permission\n shift.location.loc_group.roles\n end", "def roles\n client.user_roles(id)\n end", "def roles\n client.user_roles(id)\n end", "def my_roles\n @my_roles ||= self.roles.map {|r| r.name}.flatten.freeze\n end", "def filter_access!\n treat_as get_current_role\n end", "def roles\n Role.group_roles_from_cache(self)\n end", "def roles\n groups.find(:all, :conditions => {:context => Group::GroupType::ROLE})\n end", "def roles\n # rocking this in memory because eager-loading\n roles = object.paper_roles.select { |role|\n role.user_id == scoped_user.id\n }.map(&:description)\n roles << \"My Paper\" if object.user_id == scoped_user.id\n roles\n end", "def role_select\n @@Roles.list\n end", "def roles\n return proposed_snapshot.roles if proposed? \n return active_snapshot.roles if active?\n []\n end", "def app_roles\n return @app_roles\n end", "def get_roles\n Role.all.select {|role| role.character == self}\n end", "def resource_roles\n return @resource_roles\n end", "def get_roles_list()\n\n query_parameters = {}\n query_parameters['apiKey'] = @api_key\n query_parameters['apiSecret'] = @api_secret\n\n resource_path = 'identity/v2/manage/role'\n get_request(resource_path, query_parameters, nil)\n end", "def roles\n (properties[:roles] || []).map { |r| r.is_a?(Link) ? r : Link.new(r, nil, client) }\n end", "def index\n client_application_id = current_user.client_application_id.to_s\n @roles = Role.where(client_application_id: client_application_id)\n end", "def roles\n ::Syncano::QueryBuilder.new(self, ::Syncano::Resources::Role)\n end", "def admin_labs\n self.roles.where(name: \"admin\", resource_type: \"Lab\")\n end", "def roles\n @roles = Role.order(\"name\")\n\t@rights = Right.order(\"name\").map {|r| [r.name, r.id] }\n end", "def claims\n get_all_roles\n end", "def claims\n get_all_roles\n end", "def display_all_roles\n # Interface method\n end", "def all\n data = []\n conn = @ec2_main.environment.iam_connection\n if conn != nil\n begin\n response = conn.list_roles()\n if response.status == 200\n data = response.body[\"Roles\"]\n end\n rescue\n puts \"ERROR: getting all roles #{$!}\"\n end\n end\n return data\n end", "def current_user_role_names\n container.current_user_role_names\n end", "def map_available_roles\n roles.each.map &:name\n end", "def index\n @roles = System::Role.all\n end", "def roles\n users.map { |item| item['roles'] }.flatten.uniq\n end", "def cr_node_roles\n @node.roles\n end", "def roles!(access = {})\n json = Api::Request.new do |request|\n request[:access] = access\n request[:method] = :GET\n request[:path] = '/mgmt/{{client_id}}/roles'\n end.execute!\n\n json[:roles]\n end", "def groups\n roles\n end", "def data_roles\n if current_user.has_role? :superadmin\n @roles = Role.only_super_admin.accessible_by(current_ability)\n else\n unless current_user.warehouse.blank?\n roles = \"customer\"\n else\n roles = \"supplier\"\n end\n @roles = Role.only_admin_group(roles)\n end\n end", "def index\n @cms_roles = Cms::Role.all\n end", "def secondary_roles\n user.secondary_role\n end", "def role_list \n @role_list ||= begin\n (store.display_roles | group_store.display_roles)\n end\n end", "def get_user_roles\n @roles = @user.roles.pluck(:name)\n render json: @roles\n end", "def super_and_admin_roles\n return roles_include(roles.keys[0..1])\n end", "def user_role\n current_user.role if current_user\n end", "def role_enum\n\t\t[:user,:vip,:admin]\n\tend", "def roles\n Role.all.select do |role|\n role.movie == self\n end\n end", "def roles_for_user(user)\n role_ids = self.chorus_object_roles.where(:user_id => user.id).map(&:role_id)\n Role.find(role_ids)\n end", "def list_roles\n Character.where(actor:self).map{|c|\"#{c.name} - #{c.show.name}\"}\n end", "def roles\n User.valid_roles\n end", "def index\n return unless check_permission\n\n @roles = Role.left_joins(:user)\n end", "def my_assigned_roles(user)\n roles = []\n self.my_roles(user).each do |role|\n design_review_result = self.design_review_results.detect { |drr| drr.role == role }\n roles << role if design_review_result.reviewer == user\n end\n roles\n end", "def index\n @iams = $iam.groups.map{ |x| Iam.new(name: x.name) } \n @users = $iam.users\n @roles = $iam.client.list_roles \n end", "def check_role_group\n @roles = Role.role_group.accessible_by(current_ability)\n end", "def roles_list(role = nil)\n self.role_symbols\n end", "def get_external_roles\n get(\"#{url_base}/external_role_map/all?#{dc}\")[\"data\"]\n end", "def role\n @role\n end", "def actors\n self.roles.map do |role|\n role.actor\n end\n end", "def index\n #you dont want to set the permissions for Super Admin.\n @roles = Role.all.keep_if{|i| i.name != \"Super Admin\"}\n end", "def roles_for(section)\n roles = []\n Section.find_roles.pluck(:name).uniq.each do |role|\n roles += [role] if self.has_role?(role, section)\n end\n roles\n end", "def role_permissions\n return @role_permissions\n end", "def associated_roles\n data[:associated_roles]\n end", "def associated_roles\n data[:associated_roles]\n end", "def facility_admin_roles\n ['facility_management', 'setter', 'head_setter', 'marketing', 'guest']\n end", "def get_role\n\t\tself.role\n\tend", "def admin_index\n authorize User\n @users = current_user.org.users.includes(:roles)\n end", "def index\n @movie_roles = @movie.roles\n end", "def list\n @roles = Role.all(:include => [:groups, :users])\n end", "def index\n @facilities = Role.find(current_user.current_role).facilities\n end", "def roles\n @users = User.order(\"user_name\").all\n end", "def roles\n Jak.role_klass.where(id: grants.pluck(:role_ids).compact.flatten)\n end", "def roles_for(context=nil, force_context=nil)\n auth_scope do\n force_context ||= config.force_context\n context = Zuul::Context.parse(context)\n if force_context\n return subject_roles_for(context)\n else\n return subject_roles_within(context)\n end\n end\n end", "def resources\n Typus::Configuration.roles[self.roles].compact\n end", "def get_roles_for_link(link)\n roles = {\n 'student' => false,\n 'applicant' => false,\n 'staff' => false,\n 'faculty' => false,\n 'exStudent' => false,\n 'summerVisitor' => false\n }\n link.user_roles.each { |link_role| roles[link_role.slug] = true }\n roles\n end", "def roles_for_vp_and_sysadmin\n\t\tvp_and_sysadmin_roles = []\n\t\tfor role in Role.all\n\t\t\tif role.name.eql?(\"System Admin\") || role.name.eql?(\"VP of Finance\") \n\t\t\t\tvp_and_sysadmin_roles << role\n\t\t\tend\n\t\tend\n\t\treturn vp_and_sysadmin_roles\n\tend", "def roles\n return [] if !subject.respond_to?(roles_list_meth) || roles_of(subject).blank?\n roles_of(subject).flatten\n end", "def roles_of(child)\n info = self[child, Dependency]\n info[:roles]\n end", "def vacancies\n roles.vacant\n end", "def index\n @roles = @vendor.roles.vendor_only # TODO change to roles\n end", "def list\n # We don't use pagination here since we want to display the roles in a\n # nice tree. Additionally, there won't be more than ~100 roles in a\n # normal scenario anyway - far less!\n @roles = Role.find(:all)\n end", "def role_object\n (APP_CONFIG[\"user_roles\"]+SYSTEM_DATA[\"user_roles\"]).select{|role| role[\"name\"] == self.role}.first\n end", "def index\n authorize Role\n @roles = Role.all\n end" ]
[ "0.78122765", "0.78122765", "0.78122765", "0.78122765", "0.7811529", "0.76795447", "0.76666534", "0.76302636", "0.76035815", "0.7598713", "0.7523484", "0.7493977", "0.7241854", "0.7235137", "0.7192992", "0.7192992", "0.70472383", "0.70472383", "0.70329857", "0.7022271", "0.7010048", "0.7008643", "0.69895303", "0.6971023", "0.6937045", "0.690569", "0.6879754", "0.6879754", "0.6878927", "0.6876598", "0.6873219", "0.68295395", "0.67874795", "0.6739053", "0.6682653", "0.6668109", "0.66636986", "0.66449285", "0.6639745", "0.6632229", "0.6626976", "0.6625548", "0.6625463", "0.66150486", "0.66041774", "0.66041774", "0.65862554", "0.65811574", "0.6569958", "0.6548529", "0.6548148", "0.65459305", "0.6545773", "0.6539335", "0.650057", "0.647133", "0.64671654", "0.6450366", "0.6449702", "0.64358675", "0.6433496", "0.6425451", "0.6419435", "0.6415506", "0.64148724", "0.6412432", "0.64007944", "0.6399403", "0.63993233", "0.6336513", "0.63322943", "0.63250303", "0.6288555", "0.62879884", "0.62875867", "0.6260209", "0.62569475", "0.6253364", "0.6247913", "0.6247913", "0.6246823", "0.6237768", "0.6226575", "0.6218152", "0.621157", "0.62036014", "0.6202458", "0.62023616", "0.619987", "0.6195354", "0.61902183", "0.6182797", "0.6174095", "0.6166487", "0.6158273", "0.6150526", "0.61491805", "0.61467475", "0.6146696" ]
0.7673976
6
Make the current item object available to views
def get_user @current_user = current_user end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n set_item\n end", "def set_item\n @item = current_owner.items.find(params[:id])\n end", "def set_item\n @item = Item.active.find(params[:id])\n end", "def set_item\n # 出品機能未実装のため仮置き\n @item = Item.find(params[:id])\n end", "def detail_item= item\n @detail_item = item\n configure_view\n end", "def set_item\n @item = Item.friendly.find(params[:id])\n end", "def set_item\n @item = Item.friendly.find(params[:id])\n end", "def set_item\r\n @item = Item.find(params[:id])\r\n end", "def set_item\n\t\t@item = Item.find(params[:id])\n\tend", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = current_user.items.find(params[:id])\n end", "def set_item\n @item = current_user.items.find(params[:id])\n end", "def set_item\n @item = current_user.items.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = current_user.items.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end", "def set_item\n @item = Item.find(params[:id])\n end" ]
[ "0.71627903", "0.7080842", "0.7027972", "0.6933755", "0.68935037", "0.68513966", "0.68513966", "0.68223333", "0.6822243", "0.6821785", "0.68172085", "0.68172085", "0.68172085", "0.6809789", "0.6809789", "0.6809789", "0.6809789", "0.6808928", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366", "0.68019366" ]
0.0
-1
GET /items GET /items.xml GET /items.json HTML and AJAX
def index self.identify_user @items = @user.items @itemlist = @items.map do |item| convert_to_json(item) end respond_to do |format| format.json { render :json => @itemlist } format.xml { render :xml => @items } format.html { render text: "Unsupported Format", status: 404 } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @items = Item.find(params[:id])\n render json: @items\n end", "def index\n @items = Item.found\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n format.xml { render xml: @item }\n end\n end", "def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @items }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item.to_json() }\n end\n end", "def show\n# @item = Item.get(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @request = Request.find(params[:id])\n @items = @request.items\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @request }\n end\n end", "def show\n item = Item.find(params[:id])\n render json: item\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n format.json { render :json => @item }\n end\n end", "def show\n render json: Item.find(params[:id])\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json\n end\n end", "def index\n respond_to do |format|\n format.html\n format.json { render :json => Item.all}\n end\n\n end", "def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @item }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @item }\n end\n end", "def show\n \n render status: 200, :json => @item\n\n end", "def show\n render json: Item.find(params[\"id\"])\n end", "def show\n @itemstable = Itemstable.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @itemstable }\n end\n end", "def index\n @items = Item.find(:all, :order => 'id ASC')\n # @items = Item.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def show\n self.identify_user\n @item = Item.find(params[:id])\n @itemjson = convert_to_json(@item)\n puts @itemjson\n respond_to do |format|\n format.json { render :json => @itemjson}\n format.xml { render :xml => @item }\n format.html\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html\n # show.html.erb\n format.xml { render :xml => @item }\n end\n end", "def index\n @items = @deal.items\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def index\n #@items = Item.find_by_user_id(Session[user_id])\n @items = Item.all\n render json: @items\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end", "def index\n @items = current_user.items\n respond_to do |format|\n format.html\n format.json { render json: @items }\n end\n end", "def index_rest\n @entry_items = EntryItem.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entry_items }\n end\n end", "def index\n\n @menu_items = uhook_find_menu_items.roots\n respond_to do |format|\n format.xml {\n render :xml => @menu_items\n }\n format.js{\n render :json => Array(@menu_items).to_json(:only => [:caption, :id])\n }\n end\n end", "def show\n @item = Item.all.find_by(id: params[:id])\n respond_to do |f|\n f.js { render :layout => false }\n f.html { redirect_to root_url }\n f.json { head :no_content }\n end\n\n end", "def index\n @items = Item.accessible_by(current_ability)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n format.xml { render xml: @items }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n format.js\n end\n end", "def index\n @items = @project.items.ready\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @items }\n end\n end", "def show\n @item_info = ItemInfo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item_info }\n end\n end", "def index\n @items = ItemTemplate.search(params[:search]).order(sort_column+\" \"+sort_direction).paginate(:per_page => 10, :page => params[:page])\n @title = \"Items\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.js # index.js.erb\n format.xml { render :xml => @items }\n end\n end", "def show\n render json: @item\n end", "def show\n @item_datum = ItemData.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item_datum }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end", "def show\n authenticate\n list = List.find(params[:id])\n items = list.items\n render json: {\n items: items,\n id: list.id\n }\n end", "def show\n @feed_item = Item.find(params[:id])\n\n render json: @feed_item\n end", "def show\n @list_item = @list.list_items.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.js\n format.xml { render :xml => @list_item }\n end\n end", "def index\n @api_v1_items = Item.all\n render json: @api_v1_items\n end", "def show\n render json: @item, status: :ok\n end", "def show\n respond_to do |format|\n format.html\n format.json { render json: { status: 200, item: @list } }\n end\n end", "def show\n @items_mob = ItemsMob.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @items_mob.to_xml }\n end\n end", "def index\n @items_mobs = ItemsMob.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @items_mobs.to_xml }\n end\n end", "def index\n render json: RequestItem.all\n end", "def show\n @item = @deal.items.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @ordered_item = OrderedItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ordered_item }\n format.json { render :json => @ordered_item }\n end\n end", "def show\n render json: @request_item\n end", "def show\n respond_to do |format|\n format.html\n format.json { render :json => Item.joins(:tag).where('tag_id = ?', params[:tag])}\n end\n\n end", "def index\n @items_count = Item.count\n @items = Item.find(:all, { :order => 'items.created_at DESC', :include => :user }.merge(@pagination_options))\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @items }\n format.rss { render :layout => false }\n end\n end", "def index\n @nav_items = NavItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @nav_items }\n end\n end", "def index\n @items = Item.find(:all, :order => 'created_at DESC', :limit => 50)\n @parameter = params[:query]\n @item_type = params[:category]\n\n if params[:tag]\n @items = Item.tagged_with(params[:tag])\n else \n if @parameter\n @items = Item.search_by_name(@parameter)\n end\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.js {render :layout => false}\n format.json { render :json => @items\n }\n end\n end", "def show\n render json: @list_item\n end", "def show\n respond_to do |format|\n format.html { render :edit }\n format.json { render json: @item }\n end\n end", "def show\n @gitem = Gitem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gitem }\n end\n end", "def index\n @goods_items = Goods::Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @goods_items }\n end\n end", "def show_rest\n @entry_item = EntryItem.find(params[:id])\n\n respond_to do |format|\n #format.html # show.html.erb\n format.xml { render :xml => @entry_item }\n end\n end", "def show\n respond_to do |wants|\n wants.html # show.html.erb\n wants.xml { render :xml => @item }\n end\n end", "def show\n @item = Item.all.where(collection_id: params[:id])\n render :json => @item\n end", "def show\n @item_catalog = ItemCatalog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item_catalog }\n end\n end", "def show\n @item_class = ItemClass.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item_class }\n end\n end", "def index\n @rentable_items = RentableItem.all\n render json: @rentable_items\n end", "def items\n \tbegin\n \t@categories = Category.all.includes(items: [:dimensions])\n \t@ingredients = Ingredient.actives\n \trender 'api/v1/home/items', status: :ok\n \trescue Exception => e\n \t\terror_handling_bad_request(e)\n \tend\n\n\tend", "def index\n @active_items = Item.select(&:active?).sort_by(&:name)\n @inactive_items = Item.select(&:inactive?).sort_by(&:name)\n\n @item = Item.new\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def index\n# @items = Item.all\n store_location\n @items = @items.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def index\n @items = Item.valid_items.search(params[:search],params[:action]).order(sort_column('Item', 'name') + ' ' + sort_direction).paginate(:page => params[:page], :per_page => 1)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def show\r\n @item = Searchresults.where(\"id = ? \", params[:id]).first\r\n\r\n @test = cookies[:CURRCATEGORY] \r\n puts @test\r\n puts @item.returned_string\r\n if @item != nil\r\n @server1 = XMLRPC::Client.new(@item.ipaddress, \"/api/xmlrpc\", 3000)\r\n @iteminfo = @server1.call(\"Container.getItemInfo\", cookies[:CURRCATEGORY], @item.returned_string)\r\n #@days = @time_diff_components[:week].to_i * 7 + @time_diff_components[:day]\r\n end\r\n \r\n \r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.xml { render :xml => @item }\r\n format.js\r\n end\r\n end", "def show\n @itemstatus = Itemstatus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @itemstatus }\n end\n end", "def show\n @weather_item = WeatherItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @weather_item }\n end\n end", "def index\n @items = Admin::Item.by_agency(@current_agency.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_items }\n end\n end", "def index\n @action_items = ActionItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @action_items }\n end\n end", "def show\n @list = List.find(params[:list_id])\n @list_items = @list.list_items.find(params[:list_id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @list_item }\n end\n end" ]
[ "0.71955526", "0.71292394", "0.6941722", "0.69276595", "0.69276595", "0.69276595", "0.69276595", "0.69168884", "0.68063194", "0.68057394", "0.67799366", "0.67799366", "0.67799366", "0.67799366", "0.67799366", "0.67799366", "0.67799366", "0.67799366", "0.67799366", "0.67799366", "0.67799366", "0.67799366", "0.67799366", "0.67799366", "0.67799366", "0.67799366", "0.67799366", "0.67799366", "0.67799366", "0.6773152", "0.67571735", "0.6710179", "0.6708293", "0.67009705", "0.66979074", "0.66838825", "0.66773516", "0.6660714", "0.66431963", "0.6599144", "0.65959626", "0.6595299", "0.6581153", "0.65807855", "0.6577145", "0.6571214", "0.65603924", "0.65603924", "0.65603924", "0.65603924", "0.65603924", "0.65603924", "0.6530121", "0.65274245", "0.6525998", "0.6523738", "0.6521024", "0.6494183", "0.64871085", "0.6471219", "0.6444854", "0.6441324", "0.6424429", "0.64234054", "0.64202195", "0.641653", "0.6382796", "0.6362925", "0.63553554", "0.63264483", "0.6321735", "0.63080794", "0.6302558", "0.629843", "0.6290743", "0.6279053", "0.62729603", "0.62706107", "0.6268512", "0.6268218", "0.625782", "0.6251272", "0.6236449", "0.62323046", "0.62239003", "0.62233907", "0.62231994", "0.62129843", "0.6203231", "0.61997885", "0.6185411", "0.618453", "0.6180066", "0.61656004", "0.6157106", "0.6153077", "0.615298", "0.61522233", "0.6152028", "0.61449516" ]
0.6323682
70
GET /items/new GET /items/new.xml GET /items/new.json HTML AND AJAX
def new @user = current_user @item = current_user.items.build respond_to do |format| format.json { render :json => @item } format.xml { render :xml => @item } format.html end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n format.xml { render xml: @item }\n end\n end", "def new\n @item = Item.new\n respond_to do |format|\n format.html # new.html.erb\n format.js # new.js.rjs\n format.xml { render :xml => @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @item }\n end\n end", "def new\n @item = Item.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n \n end", "def new\n @title = \"New item\"\n @item = ItemTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def new_rest\n @entry_item = EntryItem.new\n\n respond_to do |format|\n #format.html # new.html.erb\n format.xml { render :xml => @entry_item }\n end\n end", "def new\r\n @item = Item.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @item }\r\n end\r\n end", "def new\n @item = Item.factory('local')\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def new\n @itemstable = Itemstable.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @itemstable }\n end\n end", "def new_rest\n @item_usage = ItemUsage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item_usage }\n end\n end", "def new\n @item_info = ItemInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item_info }\n end\n end", "def new\n @item = Item.new\n @items = Item.all\n @tags = Tag.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = params[:id] ? Item.find_by_id(params[:id]).dup : Item.new\n authorize @item\n respond_to do |format|\n format.html # new.html.erb\n format.js\n format.json { render :json => @item }\n end\n\n end", "def new\n @item_class = ItemClass.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item_class }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.haml\n format.json { render :json => @news_item }\n end\n end", "def new\n @item = Item.new(:list_id => params[:list_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @item }\n end\n end", "def new\n @item_datum = ItemData.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item_datum }\n end\n end", "def new\n @item = current_user.items.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @content_item = ContentItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content_item }\n end\n end", "def new\n @list = List.find(params[:list_id])\n @item = @list.items.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @ordered_item = OrderedItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ordered_item }\n format.json { render :json => @ordered_item }\n end\n end", "def new\n @gitem = Gitem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gitem }\n end\n end", "def new\n @stuff = Stuff.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @stuff }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => new_vurl }\n end\n end", "def new\n @feed_item = FeedItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @feed_item }\n end\n end", "def new\n @tipo_item = TipoItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tipo_item }\n end\n end", "def new\n @rackitem = Rackitem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rackitem }\n end\n end", "def new\n @content_item = ContentItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @content_item }\n end\n end", "def new\n @itemstatus = Itemstatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @itemstatus }\n end\n end", "def new\n @item_catalog = ItemCatalog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item_catalog }\n end\n end", "def new\n @item = BudgetItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def new\n @action_item = ActionItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @action_item }\n end\n end", "def new\n @admin_item = Admin::Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_item }\n end\n end", "def new\n @clone_item_request = CloneItemRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @clone_item_request }\n end\n end", "def new\n @components_item = Components::Item.new\n respond_to do |format|\n format.js\n end\n end", "def new\n @search_item = SearchItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @search_item }\n end\n end", "def new\n @fooditem = Fooditem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @fooditem }\n end\n end", "def new\n #@food_item params set via ability.rb\n\n respond_to do |format|\n format.html { render 'new', layout: !(request.xhr?) }\n format.json { render json: @food_item }\n end\n end", "def new\n @thing_list = ThingList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @thing_list }\n end\n end", "def new\n @lineitem = Lineitem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lineitem }\n end\n end", "def new\n @menuitem = Menuitem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @menuitem }\n end\n end", "def create\n @item = Item.new(params[:item])\n respond_to do |format|\n if @item.save\n flash[:notice] = 'O item foi criado com sucesso.'\n format.html { redirect_to(@item) }\n format.js\n format.xml { render :xml => @item, :status => :created, :location => @item }\n else\n error_respond(format, \"new\");\n end\n end\n end", "def new\n @weather_item = WeatherItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @weather_item }\n end\n end", "def new\n @item_line = ItemLine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item_line }\n end\n end", "def new\n @potluck_item = PotluckItem.new\n\n respond_to do |format|\n format.html { render :layout => false }# new.html.erb\n format.json { render json: @potluck_item }\n end\n end", "def new\n @news_item = NewsItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @news_item }\n end\n end", "def new\n @news_item = NewsItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @news_item }\n end\n end", "def new\n @inventoryitem = Inventoryitem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inventoryitem }\n end\n end", "def new\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item}\n end\n end", "def new\n @item_type = ItemType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item_type }\n end\n end", "def new\n @item_print = ItemPrint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item_print }\n end\n end", "def new\n @product_item = ProductItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @product_item }\n end\n end", "def new\n @newspage = Newspage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newspage }\n end\n end", "def new\n @nav_item = NavItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @nav_item }\n end\n end", "def new\n collection_model_ref = model_class_ref.new\n flash[:notice] = nil\n @item = collection_model_ref\n respond_to do |format|\n format.html # new.html.erb\n format.js { render :partial => controller_name.singularize,\n :locals => {controller_name.singularize.to_sym => @item},\n :layout => false \n }\n format.xml { render :xml => collection_model_ref }\n end\n end", "def new\n @showitem = Showitem.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @showitem }\n end\n end", "def new\n authorize! :create, Roxiware::NewsItem\n @news_item = Roxiware::NewsItem.new({:headline=>\"Headline\", :content=>\"Content\", :post_date=>DateTime.now.utc}, :as=>@role)\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @news_item.ajax_attrs(@role) }\n end\n end", "def new\n @page = Page.new\n\n respond_to do |format|\n format.json {render json: @page}\n format.xml {render xml: @page}\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end", "def new\n @tagged_item = TaggedItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tagged_item }\n end\n end", "def new\r\n @lineitem = Lineitem.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @lineitem }\r\n end\r\n end", "def new\n @title = 'New Page'\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end", "def new\n @miscellaneous_item = MiscellaneousItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @miscellaneous_item }\n end\n end", "def new\n @thing = Thing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @thing }\n end\n end", "def new\n @item_transaction = ItemTransaction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item_transaction }\n end\n end", "def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @line_item }\n end\n end", "def new\n @wishlistitem = Wishlistitem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wishlistitem }\n end\n end", "def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @line_item }\n end\n end", "def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @line_item }\n end\n end", "def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @line_item }\n end\n end", "def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @line_item }\n end\n end", "def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @line_item }\n end\n end" ]
[ "0.7622476", "0.754366", "0.74837774", "0.74837774", "0.74837774", "0.74837774", "0.74837774", "0.74837774", "0.74837774", "0.74837774", "0.74837774", "0.74837774", "0.74837774", "0.74837774", "0.74837774", "0.74837774", "0.74837774", "0.74837774", "0.74837774", "0.74837774", "0.74837774", "0.74837774", "0.74403864", "0.74403864", "0.73963934", "0.7307875", "0.73016053", "0.73016053", "0.73016053", "0.73016053", "0.73016053", "0.73016053", "0.73016053", "0.73016053", "0.7292898", "0.7258081", "0.71434283", "0.7053536", "0.70491135", "0.70479643", "0.70435333", "0.70344245", "0.70234096", "0.6982045", "0.6974425", "0.6924764", "0.69012964", "0.6893295", "0.68836254", "0.68671185", "0.68588275", "0.68311524", "0.6750037", "0.67460597", "0.6744444", "0.6734106", "0.67269206", "0.67206174", "0.67137563", "0.6704788", "0.6693752", "0.6690918", "0.66869557", "0.6671169", "0.6669601", "0.6664594", "0.6658436", "0.6639552", "0.66194016", "0.6617714", "0.6613405", "0.6609427", "0.6606702", "0.66049165", "0.65925413", "0.65925413", "0.65905213", "0.658134", "0.6580165", "0.6575625", "0.65674365", "0.6562737", "0.6561454", "0.65591663", "0.6549679", "0.65465903", "0.65409726", "0.6540732", "0.6537099", "0.653543", "0.65176463", "0.65146023", "0.65043277", "0.6500833", "0.64996874", "0.64901286", "0.64894176", "0.64894176", "0.6484394", "0.6484394", "0.6484394" ]
0.0
-1
GET /items/1 GET /items/1.xml GET /items/1.json HTML AND AJAX
def show self.identify_user @item = Item.find(params[:id]) @itemjson = convert_to_json(@item) puts @itemjson respond_to do |format| format.json { render :json => @itemjson} format.xml { render :xml => @item } format.html end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n format.xml { render xml: @item }\n end\n end", "def index\n @items = Item.found\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def show\n @items = Item.find(params[:id])\n render json: @items\n end", "def show\n# @item = Item.get(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n format.json { render :json => @item }\n end\n end", "def show\n @request = Request.find(params[:id])\n @items = @request.items\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @request }\n end\n end", "def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @items }\n end\n end", "def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html\n # show.html.erb\n format.xml { render :xml => @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item.to_json() }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json\n end\n end", "def show\n item = Item.find(params[:id])\n render json: item\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end", "def index\n respond_to do |format|\n format.html\n format.json { render :json => Item.all}\n end\n\n end", "def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @item }\n end\n end", "def show\n render json: Item.find(params[:id])\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @item }\n end\n end", "def show\n \n render status: 200, :json => @item\n\n end", "def index_rest\n @entry_items = EntryItem.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entry_items }\n end\n end", "def show\n render json: Item.find(params[\"id\"])\n end", "def show\n @item = Item.all.find_by(id: params[:id])\n respond_to do |f|\n f.js { render :layout => false }\n f.html { redirect_to root_url }\n f.json { head :no_content }\n end\n\n end", "def show\n respond_to do |wants|\n wants.html # show.html.erb\n wants.xml { render :xml => @item }\n end\n end", "def show\n @itemstable = Itemstable.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @itemstable }\n end\n end", "def index\n @items = @project.items.ready\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @items }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n format.js\n end\n end", "def index\n @items = Item.find(:all, :order => 'id ASC')\n # @items = Item.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def index\n @items = Item.accessible_by(current_ability)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n format.xml { render xml: @items }\n end\n end", "def show_rest\n @entry_item = EntryItem.find(params[:id])\n\n respond_to do |format|\n #format.html # show.html.erb\n format.xml { render :xml => @entry_item }\n end\n end", "def index\n @items = ItemTemplate.search(params[:search]).order(sort_column+\" \"+sort_direction).paginate(:per_page => 10, :page => params[:page])\n @title = \"Items\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.js # index.js.erb\n format.xml { render :xml => @items }\n end\n end", "def show\n @list_item = @list.list_items.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.js\n format.xml { render :xml => @list_item }\n end\n end", "def show\n @item_info = ItemInfo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item_info }\n end\n end", "def index\n @items = @deal.items\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def show\n @feed_item = Item.find(params[:id])\n\n render json: @feed_item\n end", "def show\n @item_datum = ItemData.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item_datum }\n end\n end", "def show_rest\n @item_usage = ItemUsage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item_usage }\n end\n end", "def show\n respond_to do |format|\n format.html { render :edit }\n format.json { render json: @item }\n end\n end", "def show\n render json: @item, status: :ok\n end", "def index\n #@items = Item.find_by_user_id(Session[user_id])\n @items = Item.all\n render json: @items\n end", "def index\n\n @menu_items = uhook_find_menu_items.roots\n respond_to do |format|\n format.xml {\n render :xml => @menu_items\n }\n format.js{\n render :json => Array(@menu_items).to_json(:only => [:caption, :id])\n }\n end\n end", "def index\n @api_v1_items = Item.all\n render json: @api_v1_items\n end", "def show\n @ordered_item = OrderedItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ordered_item }\n format.json { render :json => @ordered_item }\n end\n end", "def browse\n @catalog = Catalog.find(params[:id])\n \n # since this is first request to organize the items in a catalog (show) use the first page and default size\n # other pages will be loaded via ajax calls\n @page = 1\n @size = 3\n \n # now grab the items for this catalog corresponding to the page and size\n @item_batch = @catalog.get_batch_of_items(@page, @size)\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @catalog } # does not return the item_batch in the json, should use batch_of_items instead\n end\n end", "def show\n respond_to do |format|\n format.html\n format.json { render json: { status: 200, item: @list } }\n end\n end", "def index\n @items_mobs = ItemsMob.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @items_mobs.to_xml }\n end\n end", "def show\r\n @item = Searchresults.where(\"id = ? \", params[:id]).first\r\n\r\n @test = cookies[:CURRCATEGORY] \r\n puts @test\r\n puts @item.returned_string\r\n if @item != nil\r\n @server1 = XMLRPC::Client.new(@item.ipaddress, \"/api/xmlrpc\", 3000)\r\n @iteminfo = @server1.call(\"Container.getItemInfo\", cookies[:CURRCATEGORY], @item.returned_string)\r\n #@days = @time_diff_components[:week].to_i * 7 + @time_diff_components[:day]\r\n end\r\n \r\n \r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.xml { render :xml => @item }\r\n format.js\r\n end\r\n end", "def show\n @items_mob = ItemsMob.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @items_mob.to_xml }\n end\n end", "def index\n @items = Item.find(:all, :order => 'created_at DESC', :limit => 50)\n @parameter = params[:query]\n @item_type = params[:category]\n\n if params[:tag]\n @items = Item.tagged_with(params[:tag])\n else \n if @parameter\n @items = Item.search_by_name(@parameter)\n end\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.js {render :layout => false}\n format.json { render :json => @items\n }\n end\n end", "def index\n render json: RequestItem.all\n end", "def index\n @goods_items = Goods::Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @goods_items }\n end\n end", "def index\n @items_count = Item.count\n @items = Item.find(:all, { :order => 'items.created_at DESC', :include => :user }.merge(@pagination_options))\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @items }\n format.rss { render :layout => false }\n end\n end", "def show\n @item_class = ItemClass.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item_class }\n end\n end", "def show\n render json: @request_item\n end", "def show\n @item = @deal.items.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def index\n @items = current_user.items\n respond_to do |format|\n format.html\n format.json { render json: @items }\n end\n end", "def get_item( item )\n @session.base_url = \"http://cl.ly\"\n resp = @session.get( \"/\" + item )\n \n raise ItemNotFound if resp.status == 404\n Crack::JSON.parse(resp.body)\n end", "def show\n render json: @item\n end", "def index\n @action_items = ActionItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @action_items }\n end\n end", "def request_item\n if is_downloadable?\n if is_viewable?\n respond_to do |format|\n format.html do\n flash[:notice] = 'File retrieval request received.'\n redirect_to(\n recall_bendo_item_path(id: noid),\n status: :found\n )\n end\n format.json { json_api_response }\n end\n else\n respond_to do |format|\n format.html do\n flash[:alert] = \"You are not permitted to view the item with ID: #{noid}\"\n redirect_to recall_bendo_item_path(id: noid)\n end\n format.json { json_unauthorized_response }\n end\n end\n else\n respond_to do |format|\n format.html do\n flash[:alert] = \"No files can be downloaded for ID: #{noid}\"\n redirect_to recall_bendo_item_path(id: noid)\n end\n format.json { json_not_found_response }\n end\n end\n end", "def show\n @rackitem = Rackitem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rackitem }\n end\n end", "def show\n @item = Item.all.where(collection_id: params[:id])\n render :json => @item\n end", "def index\n @list = List.find(params[:list_id])\n @list_items = @list.list_items.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @list_items }\n end\n end", "def show\n @gitem = Gitem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gitem }\n end\n end", "def index\n @news_items = do_index(NewsItem, params)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @news_items }\n end\n end", "def index\n self.identify_user\n @items = @user.items\n @itemlist = @items.map do |item|\n convert_to_json(item)\n end\n respond_to do |format|\n format.json { render :json => @itemlist }\n format.xml { render :xml => @items }\n format.html { render text: \"Unsupported Format\", status: 404 }\n end\n end", "def index\n# @items = Item.all\n store_location\n @items = @items.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def show\n @content_item = ContentItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @content_item }\n end\n end", "def index\n @item_options = ItemOption.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @item_options }\n end\n end", "def show\n @itemstatus = Itemstatus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @itemstatus }\n end\n end", "def show\n authenticate\n list = List.find(params[:id])\n items = list.items\n render json: {\n items: items,\n id: list.id\n }\n end", "def show\n respond_to do |format|\n format.html\n format.json { render :json => Item.joins(:tag).where('tag_id = ?', params[:tag])}\n end\n\n end", "def show\n @item_catalog = ItemCatalog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item_catalog }\n end\n end" ]
[ "0.701099", "0.6982144", "0.6885989", "0.6806936", "0.67854387", "0.6772803", "0.6748662", "0.6748497", "0.6748497", "0.6748497", "0.6748497", "0.67349297", "0.67349297", "0.67349297", "0.67349297", "0.67349297", "0.67349297", "0.67349297", "0.67349297", "0.67349297", "0.67349297", "0.67349297", "0.67349297", "0.67349297", "0.67349297", "0.67349297", "0.67349297", "0.67349297", "0.67349297", "0.67349297", "0.67160785", "0.6714709", "0.67030823", "0.6682402", "0.6681758", "0.6681758", "0.6681758", "0.6681758", "0.6681758", "0.6681758", "0.6649358", "0.6647812", "0.66379696", "0.6636375", "0.6628561", "0.66027313", "0.6563386", "0.6549208", "0.65339816", "0.64727247", "0.64661735", "0.64560854", "0.64434636", "0.6434453", "0.64272606", "0.6397947", "0.6393523", "0.63636047", "0.6357613", "0.6339573", "0.63376963", "0.63159937", "0.6310551", "0.62983525", "0.62879395", "0.62759435", "0.62727267", "0.6272505", "0.6267226", "0.62577176", "0.62452024", "0.62446094", "0.6239211", "0.6238335", "0.62305343", "0.6210113", "0.6175167", "0.6171849", "0.6167949", "0.61660147", "0.6162079", "0.61590695", "0.6156519", "0.6151297", "0.6132212", "0.61318624", "0.6131693", "0.61314565", "0.6126311", "0.6125418", "0.6104431", "0.6102998", "0.61018085", "0.60989535", "0.6095985", "0.6095542", "0.6095236", "0.6093603", "0.608644", "0.6082355" ]
0.6522869
49
GET /items/1/edit GET /items/1/edit.xml GET /items/1/edit.json HTML AND AJAX
def edit @item = Item.find(params[:id]) respond_to do |format| format.json { render :json => @item } format.xml { render :xml => @item } format.html end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit\n @item = current_user.items.find(params[:id])\n respond_to do |format|\n format.js { render :action=>:redbox_edit, :layout=>false }\n format.html \n end\n end", "def edit\n @page = Page.find(params[:id])\n\n respond_to do |format|\n format.json {render json: @page}\n format.xml {render xml: @page}\n end\n end", "def show\n respond_to do |format|\n format.html { render :edit }\n format.json { render json: @item }\n end\n end", "def edit\n respond_with(page)\n end", "def edit\n @item = Item.find_by_id( params[:id] )\n render :layout => 'form'\n end", "def edit\n respond_to do |format|\n format.html # show.rhtml\n format.js\n format.xml { render :xml => @recipe.to_xml }\n end\n end", "def edit\n respond_to do |format|\n format.html { render :action => \"edit\" and return }\n format.js { render :partial => \"scrap_form\", :layout => false and return }\n format.xml { return }\n end\n end", "def edit\n respond_to do |format|\n format.json { render :json => @admin } \n format.xml { render :xml => @admin }\n format.html\n end\n \n rescue ActiveRecord::RecordNotFound\n respond_to_not_found(:json, :xml, :html)\n end", "def edit\n @line_item = LineItem.find(params[:id])\n \n respond_to do |format|\n format.html # edit.html.erb\n format.js # edit.rjs\n end\n end", "def edit\n if request.xhr?\n @resource = Resource.find(params[:id])\n add_dependent_entities\n render partial: 'edit_form', locals: { action: :edit }\n else\n render status: 406, plain: 'Not Acceptable'\n end\n end", "def edit\n Log.add_info(request, params.inspect)\n\n @equipment = Equipment.find(params[:id])\n\n render(:layout => (!request.xhr?))\n end", "def edit\n @todo = TodoItem.find(params[:id]) # this wants to call an \"update\" method. see bundle exec rails routes to see why\n # default action: render :show - app/views/pages/show.html.erb\n end", "def edit\n respond_to do |format|\n format.html { render }\n format.json { render :json => @gallery_item.ajax_attrs(@role) }\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.js\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def item_edit\n end", "def update\n @item = Item.find(params[:id])\n authorize @item\n associate_entity(params, @item)\n respond_to do |format|\n if @item.update_attributes(item_params)\n @item_updated = true\n format.js\n format.html { redirect_to(item_path(@item), :notice => t('views.items.item_updated')) }\n format.json { head :no_content }\n else\n format.js\n format.html { render :action => \"edit\" }\n format.json { render :json => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n flash[:notice] = 'O item foi actualizado com sucesso.'\n format.html { redirect_to(@item) }\n format.js\n format.xml { head :ok }\n else\n error_respond(format, \"edit\");\n end\n end\n end", "def edit\n @item = Vger::Resources::Suitability::Item.find(params[:id], :methods => [:item_type])\n respond_to do |format|\n format.html\n end\n end", "def edit\n respond_to do |format|\n format.json { render :json => @user } \n format.xml { render :xml => @user }\n format.html\n end\n end", "def edit\n respond_to do |format|\n format.html { render :action => resource_template(\"edit\") }\n end\n end", "def update \n respond_to do |wants|\n if @item.update_attributes(params[:item])\n flash[:notice] = 'Item was successfully updated.'\n wants.html { redirect_to(admin_items_path) }\n wants.xml { head :ok }\n else\n \n wants.html { render :action => \"edit\" }\n wants.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def edit\n @resource = Resource.find(params[:id])\n \n respond_to do |format|\n # format.html { render :layout => false }\n format.html\n format.any(:xml, :json) { render request.format.to_sym => @resource }\n end\n end", "def update_rest\n @entry_item = EntryItem.find(params[:id])\n\n respond_to do |format|\n if @entry_item.update_attributes(params[:entry_item])\n flash[:notice] = 'EntryItem was successfully updated.'\n #format.html { redirect_to(@entry_item) }\n format.xml { head :ok }\n else\n #format.html { render :action => \"edit\" }\n format.xml { render :xml => @entry_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n authorize! :update, @item\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to(items_path, notice: I18n.t('update.success') ) }\n format.js\n else\n format.html { render action: \"edit\" }\n format.js\n end\n end\n end", "def edit\n\t\t@item = Item.find(params[:id])\n \tend", "def edit\n @content = Content.find(params[:id])\n \n respond_to do |format|\n # format.html { render :layout => false }\n format.html\n format.any(:xml, :json) { render request.format.to_sym => @content }\n end\n end", "def edit\n respond_to do |format|\n format.html\n format.js\n end\n end", "def edit\n respond_to do |format|\n format.html\n format.js\n end\n end", "def edit\n respond_to do |format|\n format.html\n format.js\n end\n end", "def handle_edit\n if request.id\n obj = model.with_pk(normalized_type, request, request.id)\n model.hook(:before_edit, request, obj)\n edit_page(obj)\n else\n list_page(:edit)\n end\n end", "def update\n# @item = Item.get(params[:id])\n\n respond_to do |format|\n if @item.update(params[:item])\n format.html { redirect_to({action: :show, id: @item}, notice: 'Item was successfully updated.') }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n process_fields\n @components_item = Components::Item.find(params[:id])\n index\n respond_to do |format|\n if @components_item.update_attributes(params[:components_item])\n format.js { @notice = 'Componente actualizado correctamente.' \n render 'index'}\n else\n format.js { @notice = 'Error al actualizar componente.' \n render action: \"edit\"}\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item }\n format.xml { head :ok }\n else\n \n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def edit\n\n\n admin_edit_prep\n\n respond_to do |format|\n format.html {render :layout => 'artist_admin'}\n format.json {\n render :json => {\n :success => true,\n :\"#{@hook}\" => render_to_string(\n :action => 'admin.html.erb',\n :layout => @layout,\n ),\n :\"edit\" => \"true\",\n :\"admin-show\" => \"true\",\n\n }\n }\n end\n end", "def update\n @item = Item.find(params[:id])\n respond_to do |format|\n if @item.update_attributes(params[:item])\n flash[:notice] = \"Item has been updated\"\n format.json { render :json => @item.to_json, :status => 200 }\n format.xml { head :ok }\n format.html { render :action => :edit }\n else\n format.json { render :text => \"Could not update item\", :status => :unprocessable_entity } #placeholder\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n format.html { render :action => :edit, :status => :unprocessable_entity }\n end\n end\n end", "def show_rest\n @entry_item = EntryItem.find(params[:id])\n\n respond_to do |format|\n #format.html # show.html.erb\n format.xml { render :xml => @entry_item }\n end\n end", "def edit\n @page_title = \"Edit Recipe Ingredient\"\n @recipe_ingredient = current_recipe.recipe_ingredients.find(params[:id])\n @btnText = \"Update Ingredient\"\n @obj = @recipe_ingredient\n respond_to do |f|\n f.html {render 'shared/form'}\n f.js\n end\n end", "def update\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n respond_with(reagent)\n end", "def edit\n render\n end", "def edit\n render\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n #if save fails, it will redirect to edit template\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to(@item)}\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def edit\n\n respond_to do |format|\n format.js\n end\n end", "def update\n \n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, :notice => 'Item was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def edit\n @option = Vger::Resources::Mrf::Option.find(params[:id], :item_id => params[:item_id])\n respond_to do |format|\n format.html\n end\n end", "def edit\n respond_to do |format|\n format.html # edit.html.erb\n end\n end", "def edit\n # When a http GET request to '/users/1/edit' is received, have it render:\n # a view file with a form with user 1's information in the appropriate input field.\n @id = params[:id]\n @user = User.find(@id)\n end", "def edit\n respond_with(resource)\n end", "def edit(params = {})\n http_helper.send_post_request(\"#{@url_prefix}/edit\", params)\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n format.xml { render xml: @item }\n end\n end", "def edit\r\n render :edit\r\n end", "def edit\n @activity = Activity.find(params[:activity_id])\n @change = @activity.changes.find(params[:id])\n\n respond_to do |format|\n format.html do # edit.html.erb\n render :layout => false if request.xhr?\n end\n format.xml { render :xml => @change }\n end\n end", "def update\r\n @item = Item.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @item.update_attributes(params[:item])\r\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\r\n format.json { head :ok }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @item.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, :notice => 'Item was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to '/items', notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n\t\traise NotImplementedError, \"FIXME: Implement editing comments.\"\n\t\t#respond_to do |format|\n\t\t#\tformat.html # edit.html.erb\n\t\t#end\n\tend", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n respond_to do |format|\n format.html { render }\n format.json { render :json => @gallery.ajax_attrs(@role) }\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to(@item, :notice => 'Item was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to(@item, :notice => 'Item was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to items_path, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n # format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.html { redirect_to @item }\n format.js # update.js.erb が実行される.submit で :remote => true の場合はこれになる\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n get_relations_from_params\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n render json: Item.update(params[\"id\"], params[\"item\"])\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json\n end\n end", "def show\n# @item = Item.get(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: t('controller.successfully_updated', model: t('activerecord.models.item')) }\n format.json { head :no_content }\n else\n prepare_options\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n @employee = Employee.find(params[:id])\n respond_to do |format|\n # format.html { render action: \"index\" }\n format.js\n # format.json { render json: @employee }\n end\n end", "def edit\n respond_with(source)\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n format.json { render :json => @item }\n end\n end", "def edit\n respond_with(component)\n end", "def edit\n render :edit\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to lists_path, :notice => 'Item was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n flash[:notice] = 'Item was successfully updated.'\n format.html { redirect_to(:action => :index) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def edit(params)\n http_helper.send_post_request(\"#{@url_prefix}/edit\", params)\n end", "def update\r\n @item = Item.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @item.update_attributes(params[:item])\r\n format.html { redirect_to(@item, :notice => 'Item Successfully updated.') }\r\n format.xml { head :ok }\r\n else\r\n format.html { render :action => \"edit\" }\r\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n @item ||= Item.find_by_id_or_name(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n flash[:notice] = 'Item was successfully updated.'\n format.html { redirect_to(@item) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def edit\n quote = Quote.find(params[:id])\n url = \"quotes/#{params[:id]}\"\n render :json => {:data => quote, :url => url}\n end" ]
[ "0.6950683", "0.6904527", "0.6835319", "0.67743874", "0.67113703", "0.6708336", "0.66810805", "0.6669407", "0.6669191", "0.66633934", "0.66463244", "0.66389227", "0.6614933", "0.6594326", "0.6565247", "0.65589446", "0.65501803", "0.65474755", "0.6542083", "0.6536543", "0.65348405", "0.6503534", "0.6500983", "0.6484258", "0.6468418", "0.64678836", "0.63919204", "0.63919204", "0.63919204", "0.63861036", "0.63841695", "0.63583404", "0.63495237", "0.63279843", "0.6317766", "0.6317171", "0.6306267", "0.62896985", "0.6284476", "0.6282061", "0.6282061", "0.62752265", "0.62607193", "0.62536806", "0.6251564", "0.62507284", "0.62490135", "0.62451947", "0.62379116", "0.6235849", "0.6235679", "0.622912", "0.6219583", "0.62176687", "0.6200106", "0.6197012", "0.61889005", "0.6185159", "0.6185159", "0.6185159", "0.6185159", "0.6185159", "0.6185159", "0.6185159", "0.6185159", "0.6185159", "0.6181213", "0.6174056", "0.6174056", "0.6173083", "0.6173083", "0.6173083", "0.6173083", "0.6173083", "0.6173083", "0.6173083", "0.6173083", "0.6173083", "0.6173083", "0.6173083", "0.6162814", "0.6159887", "0.61573285", "0.6156554", "0.61531806", "0.61518687", "0.6149873", "0.61447906", "0.6144593", "0.61441284", "0.6143227", "0.6141329", "0.6131134", "0.6131134", "0.61161494", "0.61134726", "0.6110036", "0.61015457", "0.60984635", "0.6097211" ]
0.78335
0
DELETE /items/1 DELETE /items/1.xml DELETE /items/1.json HTML AND AJAX
def destroy @item = Item.find(params[:id]) if current_user.id != @item.creator_id.to_i respond_to do |format| format.all { render :text => "Unauthorized action" } end return end puts 'Pass authentication check' if @item.destroy respond_to do |format| format.all { render :json => {:result => :ok}, :status => 200 } end else respond_to do |format| format.all { render :text => "Could not delete comment", :status => :unprocessable_entity } # placeholder end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(items_url) }\n format.xml { head :ok }\n format.js\n end\n end", "def destroy\n @item_id = params[:id]\n @item = Item.find(@item_id)\n @item.destroy\n\n respond_to do |format|\n format.js\n format.html { redirect_to('/') }\n format.xml { head :ok }\n end\n end", "def delete\n render json: Item.delete(params[\"id\"])\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.js { render :action => 'update' }\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :ok }\n format.xml { head :ok }\n end\n end", "def destroy\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(items_url) }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end", "def destroy\n @item.destroy\n\n respond_to do |wants|\n wants.html { redirect_to(admin_items_url) }\n wants.xml { head :ok }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url}\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(items_url) }\n format.js\n format.xml { head :ok }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\r\n @item = Item.find(params[:id])\r\n\r\n @item.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(items_url) }\r\n format.xml { head :ok }\r\n end\r\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :ok }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_items_url, :notice => 'Item was deleted.') }\n format.xml { head :ok }\n end\n end", "def delete_item\n item_id = params[\"item_id\"]\n\n item = TextItem.find_by_id(item_id)\n item = Image.find_by_id(item_id) if item.nil?\n item = Collection.find_by_id(item_id) if item.nil?\n render_json :status => :not_found, :messages => \"Could not find the item with id #{item_id}.\" and return if item.nil?\n\n if item.class == Collection\n if params[\"id\"].nil?\n render_json :status => :bad_request, :messages => \"Can't delete a collection reference without providing the parent collection id. Please use the longer url for item deletion.\" and return\n end\n collection = Collection.find_by_id(params[\"id\"])\n else\n collection = Ownership.find_by_item_id(item_id).parent\n end\n;\n render_json :status => :not_found, :messages => \"Could not find parent collection for the item.\" and return if (collection.nil?)\n render_json :status => :forbidden, :messages => \"The user is not allowed to delete from this collection.\" and return if (!collection.delete?(@user, @client))\n\n collection.delete_item(item_id)\n render_json :entry => {} and return\n end", "def destroy\n# @item = Item.get(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to({action: :index}, notice: 'Item was successfully deleted.') }\n format.json { head :ok }\n end\n end", "def destroy\n @item ||= Item.find_by_id_or_name(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(items_url) }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end", "def destroy_rest\n @entry_item = EntryItem.find(params[:id])\n @entry_item.destroy\n\n respond_to do |format|\n #format.html { redirect_to(entry_items_url) }\n format.xml { head :ok }\n end\n end", "def item_destroy\n @item = Item.find(params[:id])\n @item.destroy\n respond_to do |format|\n format.html { redirect_to item_index_path, notice: 'O item foi removido com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to '/items', notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @id = params[:id].to_i\n @item.destroy\n respond_to do |format|\n format.js \n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: '削除に成功しました。' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html {redirect_to items_url, notice: 'Item was successfully destroyed.'}\n format.json {head :no_content}\n end\n end", "def destroy\n @item.destroy\n head :no_content\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :no_content }\n end\n end", "def destroy#\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(budget_items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @item_datum = ItemData.find(params[:id])\n @item_datum.destroy\n\n respond_to do |format|\n format.html { redirect_to item_datum_url }\n format.json { head :ok }\n end\n end", "def destroy\n # @item.destroy\n # respond_to do |format|\n # format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n # format.json { head :no_content }\n # end\n end", "def destroy\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n flash[:success] = \"Item foi excluído com sucesso!\"\n respond_to do |format|\n format.html { redirect_to itens_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n # format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(manage_items_url, :notice => 'Item was successfully deleted.') }\n format.xml { head :ok }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: \"Item was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: \"Item was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: \"Item was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: \"Item was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end" ]
[ "0.7605994", "0.75893444", "0.75560963", "0.75140685", "0.7436315", "0.7428278", "0.7404126", "0.739164", "0.739164", "0.739164", "0.739164", "0.739164", "0.739164", "0.739164", "0.739164", "0.739164", "0.739164", "0.73844", "0.7383663", "0.7379116", "0.73786134", "0.73786134", "0.73786134", "0.73786134", "0.73786134", "0.73786134", "0.73786134", "0.73786134", "0.73786134", "0.73786134", "0.73786134", "0.73786134", "0.73786134", "0.73786134", "0.73786134", "0.7372716", "0.73713875", "0.73713875", "0.73713875", "0.73713875", "0.73713875", "0.73713875", "0.73423326", "0.7333455", "0.73329276", "0.73208576", "0.7306876", "0.728704", "0.7266779", "0.72543275", "0.7243933", "0.72433555", "0.7223108", "0.7189882", "0.714474", "0.71323544", "0.7130711", "0.71247655", "0.71209204", "0.7117954", "0.7110092", "0.7109147", "0.71039927", "0.7103785", "0.7103129", "0.710102", "0.710102", "0.710102", "0.710102", "0.7100287", "0.7098551", "0.7098551", "0.7098551", "0.7098551", "0.7098551", "0.7098551", "0.7098551", "0.7098551", "0.7098551", "0.7098551", "0.7098551", "0.7098551", "0.7098551", "0.7098551", "0.7098551", "0.7098551", "0.7098551", "0.7098551", "0.7098551", "0.7098551", "0.7098551", "0.7098551", "0.7098551", "0.7098551", "0.7098551", "0.7098551", "0.7098551", "0.7098551", "0.7098551", "0.7098551", "0.7098551" ]
0.0
-1
POST /items POST /items.xml POST /items.json HTML AND AJAX
def create puts params item_data = { :title => params[:title], :description => params[:description] } @item = current_user.items.build(item_data) if params[:attachments] params[:attachments].each do |att_id| @att = Attachment.find(att_id) @item.attachments.push(@att) if @att.att_type == 'photo' @item.photos.build( photo_url: @att.url ) end end end if @item.save respond_to do |format| format.json { render :json => @item.to_json, :status => 200 } format.xml { head :ok } format.html { redirect_to :action => :index } end else respond_to do |format| format.json { render :text => "Could not create item", :status => :unprocessable_entity } # placeholder format.xml { head :ok } format.html { render :action => :new, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @item = Item.new(params[:item])\n respond_to do |format|\n if @item.save\n flash[:notice] = 'O item foi criado com sucesso.'\n format.html { redirect_to(@item) }\n format.js\n format.xml { render :xml => @item, :status => :created, :location => @item }\n else\n error_respond(format, \"new\");\n end\n end\n end", "def create\n item = list.items.create!(item_params)\n render json: item, status: 201\n end", "def create\n\t\titem = Item.create(item_params)\n\t\trender json: item\n\tend", "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n # format.html { redirect_to items_path, notice: 'Item was successfully created.' }\n # format.json { render json: @item, status: :created, location: @item }\n format.js\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(item_params) #or params[:items]\n\n respond_to do |format|\n if @item.save #if object is saved successfully, eg validations pass\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.js\n format.xml\n else \n #if object is not saved successfully, redirect to new action\n format.html { render action: 'new' } #all filled fields will be prepopulated\n format.js\n format.xml\n \n end\n end\n end", "def create\n @item = Item.new(params[:item])\n @item.save\n respond_with @item\n end", "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to(items_path) }\n format.xml { render :xml => @item, :status => :created, :location => @item }\n else\n format.html { redirect_to(items_path)}\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @item = build_item\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to items_path, notice: 'アップロードしたでー' }\n format.json { render action: 'show', status: :created, location: @item }\n else\n format.html { render action: 'new' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(params[:item])\n\n respond_to do |wants|\n if @item.save\n flash[:notice] = 'Item was successfully created.'\n wants.html { redirect_to(admin_items_url) }\n wants.xml { render :xml => @item, :status => :created, :location => @item }\n else\n wants.html { render :action => \"new\" }\n wants.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to root_url, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, item: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @request_item = RequestItem.new(request_item_params)\n @request_item.item = Item.new(name: params[:request_item][:item][:name])\n\n if @request_item.save\n render json: @request_item \n else\n render json: @request_item.errors, status: :bad_request\n end\n end", "def create\n @item = @client.items.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully added.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n item = Item.new(item_params)\n item.user = current_user\n if item.save\n render json: item\n else\n render json: {errors: item.errors}, status: :unprocessable_entity\n end\n end", "def create\n @item = Item.new(item_params)\n if @item.save\n render json: ItemSerializer.new(@item)\n else\n render json: @section.errors, status: :unprocessable_entity\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n format.xml { render xml: @item }\n end\n end", "def create\n item = Item.new(item_params)\n item.done = \"0\"\n item.trash = \"0\"\n\n if item.save\n render json: {data:item}, status: :created\n else\n render json: {data:item}, status: :unprocessable_entity\n end\n end", "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to '/items', notice: 'Item was successfully created.' }\n format.json { render action: 'show', status: :created, location: @item }\n else\n format.html { render action: 'new' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @task_item = Task::Item.new(task_item_params)\n\n respond_to do |format|\n if @task_item.save\n format.html { redirect_to task_list_path(@task_item.list), notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @task_item }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.js { render :new, status: :unprocessable_entity }\n format.json { render json: @task_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(item_params)\n if @item.save\n @items = Item.all\n render status: 201, :json => @item\n \n else\n render status: 404, json: { message: @item.errors}.to_json\n end\n \n \n end", "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(params[:item])\n\n get_relations_from_params\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to :items, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @slot }\n else\n format.html { render action: 'new' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to(@item, :notice => 'Item was successfully created.') }\n format.xml { render :xml => @item, :status => :created, :location => @item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to(@item, :notice => 'Item was successfully created.') }\n format.xml { render :xml => @item, :status => :created, :location => @item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(item_params)\n\n if @item.save\n render json: @item\n else\n render json: { error: t('story_create_error') }, status: :unprocessable_entity\n end\n end", "def create\n @item = Item.new(item_params)\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def ajax_renew\n netid = params['netid']\n url = ENV['OKAPI_URL']\n tenant = ENV['OKAPI_TENANT']\n result = CUL::FOLIO::Edge.renew_item(url, tenant, folio_token, netid, params['itemId'])\n render json: result\n end", "def add_item_to_project\n @project = Project.find(params[:id])\n @item = Item.find(params[:item_id])\n\n @project.items << @item\n\n render json: @project, include: :items\n end", "def ajax_item_save\n #TODO translate & DOC\n @current_object = params[:item_type].classify.constantize.find(params[:id])\n\t\tif @current_object.update_attribute(\"body\", params[:content])\n\t\t message = \"Saved\"\n\t\telse\n\t\t message = \"Unable to Save\"\n\t\tend\n\t\t\n\t\trender :text => message, :layout => false\n end", "def create\n @account = current_person.accounts.find params[:account_id]\n @account_membership = @account.account_memberships.find params[:account_membership_id]\n item_type = params[:item].delete(:type)\n @item = @account_membership.items.new(params[:item]).becomes(Object.const_get(item_type))\n raise 'tried to create a non-item object from an item. this might be an attack' unless @item.is_a?(Item)\n @item.type = item_type\n respond_to do |format|\n if @item.save\n format.js\n else\n format.js { render :text => 'there was an error' }\n end\n end\n end", "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to lists_path, :notice => 'Item was successfully created.' }\n format.json { render :json => lists_path, :status => :created, :location => lists_path }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: \"Item was successfully created.\" }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render action: 'show', status: :created, location: @item }\n else\n format.html { render action: 'new' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render action: 'show', status: :created, location: @item }\n else\n format.html { render action: 'new' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render action: 'show', status: :created, location: @item }\n else\n format.html { render action: 'new' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render action: 'show', status: :created, location: @item }\n else\n format.html { render action: 'new' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render action: 'show', status: :created, location: @item }\n else\n format.html { render action: 'new' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @item = Item.new\n @items = Item.all\n @tags = Tag.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n flash[:notice] = 'Item was successfully created.'\n format.html { redirect_to(@item) }\n format.xml { render :xml => @item, :status => :created, :location => @item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n flash[:notice] = 'Item was successfully created.'\n format.html { redirect_to(@item) }\n format.xml { render :xml => @item, :status => :created, :location => @item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def item\n # Url generated from Js script function => getitem() of _form.html.erb file under Views of different controllers\n @item = Report.where(\"user_id = ?\" , current_user.id).pluck(:item_name )\n # send item_names' in form of json\n render json: @item\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def create\n @item = Item.new(item_save_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @item = Item.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n \n end", "def item_create\n @item = Item.new(item_params)\n respond_to do |format|\n if @item.save\n format.html { redirect_to item_index_path, notice: 'O item foi criado com sucesso.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :item_new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @item = Item.new(params[:item])\r\n\r\n respond_to do |format|\r\n if @item.save\r\n format.html { render :action => \"initauction\"}\r\n format.xml { render :xml => @item, :status => :created, :location => @item }\r\n else\r\n format.html { render :action => \"new\" }\r\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n\r\n end", "def create\n \n #debug\n write_log(\n Const::SL::LOG_PATH_SL,\n \"items_controller#create(params[:item] => #{params[:item]})\",\n # __FILE__,\n __FILE__.split(\"/\")[-1],\n __LINE__.to_s)\n\n \n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @item }\n end\n end", "def create\n\n @item = Item.new(params[:item])\n @item.user_id = current_user.id\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to '/main', :notice => 'Item was successfully created.' }\n format.json { render :json => @item, :status => :created, :location => @item }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(item_params)\n \n respond_to do |format|\n if @item.save \n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = current_owner.items.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to items_path, notice: 'Item was created successfully' }\n format.json { render :show, status: :created, location: items_path }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n @item.save_info\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end \n end", "def update\n render json: Item.update(params[\"id\"], params[\"item\"])\n end", "def create\n @item = Item.new(params[:item])\n @item.user = current_user\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, :notice => 'Item was successfully created.' }\n format.json { render :json => @item, :status => :created, :location => @item }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_rest\n @entry_item = EntryItem.new(params[:entry_item])\n\n respond_to do |format|\n if @entry_item.save\n flash[:notice] = 'EntryItem was successfully created.'\n #format.html { redirect_to(@entry_item) }\n format.xml { render :xml => @entry_item, :status => :created, :location => @entry_item }\n else\n #format.html { render :action => \"new\" }\n format.xml { render :xml => @entry_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new_rest\n @entry_item = EntryItem.new\n\n respond_to do |format|\n #format.html # new.html.erb\n format.xml { render :xml => @entry_item }\n end\n end", "def post(payload, request_opts={})\n if payload.is_a?(Hash)\n payload = self.class.item_class.new(payload) # apply data type conversion\n end\n qs = payload.query_string_params\n payload = payload.as_hash\n response = http(request_opts).post(resolved_path + qs, payload)\n new_item = self.class.item_class.new\n new_item.store_result(response)\n new_item\n end", "def create\n create_params = item_params\n item = Item.new(\n name: create_params[:name], \n is_complete: false, #create_params[:is_complete], \n list_id: create_params[:list_id])\n\n item.save!\n render json: item\n end" ]
[ "0.6359919", "0.6329103", "0.62944096", "0.620916", "0.6130023", "0.6092295", "0.60868126", "0.60177046", "0.5995764", "0.59737784", "0.5951129", "0.5934419", "0.5907595", "0.5894034", "0.58922535", "0.5891097", "0.5869148", "0.58653194", "0.58646363", "0.5853791", "0.5853791", "0.5853791", "0.5853791", "0.5853791", "0.5853791", "0.5853791", "0.58537036", "0.5803075", "0.5786886", "0.5784375", "0.5784375", "0.5775118", "0.57677984", "0.57653195", "0.5761282", "0.5760984", "0.57592356", "0.57572156", "0.57486033", "0.57486033", "0.57486033", "0.57486033", "0.57486033", "0.57486033", "0.57486033", "0.57486033", "0.57486033", "0.57486033", "0.57486033", "0.57486033", "0.57486033", "0.57486033", "0.57486033", "0.57486033", "0.57477045", "0.5742861", "0.5742861", "0.5742861", "0.5742861", "0.5742861", "0.5741363", "0.5735068", "0.5735068", "0.57220954", "0.57203704", "0.57203704", "0.57203704", "0.57203704", "0.57203704", "0.57203704", "0.57203704", "0.57203704", "0.57203704", "0.57203704", "0.57203704", "0.57203704", "0.57203704", "0.57203704", "0.57203704", "0.57203704", "0.57203704", "0.57203704", "0.57203704", "0.57203704", "0.5720123", "0.5712446", "0.5709952", "0.5687677", "0.56814075", "0.5680684", "0.5680684", "0.5679543", "0.5663785", "0.56602776", "0.56588113", "0.5657805", "0.5638952", "0.5638145", "0.5632719", "0.5620338", "0.5618086" ]
0.0
-1
PUT /items/1 PUT /items/1.xml PUT /items/1.json HTML AND AJAX
def update @item = Item.find(params[:id]) respond_to do |format| if @item.update_attributes(params[:item]) flash[:notice] = "Item has been updated" format.json { render :json => @item.to_json, :status => 200 } format.xml { head :ok } format.html { render :action => :edit } else format.json { render :text => "Could not update item", :status => :unprocessable_entity } #placeholder format.xml { render :xml => @item.errors, :status => :unprocessable_entity } format.html { render :action => :edit, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n render json: Item.update(params[\"id\"], params[\"item\"])\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.js\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n @item.update_attributes(params[:item])\n respond_with @item\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n flash[:notice] = 'O item foi actualizado com sucesso.'\n format.html { redirect_to(@item) }\n format.js\n format.xml { head :ok }\n else\n error_respond(format, \"edit\");\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n authorize @item\n associate_entity(params, @item)\n respond_to do |format|\n if @item.update_attributes(item_params)\n @item_updated = true\n format.js\n format.html { redirect_to(item_path(@item), :notice => t('views.items.item_updated')) }\n format.json { head :no_content }\n else\n format.js\n format.html { render :action => \"edit\" }\n format.json { render :json => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_rest\n @entry_item = EntryItem.find(params[:id])\n\n respond_to do |format|\n if @entry_item.update_attributes(params[:entry_item])\n flash[:notice] = 'EntryItem was successfully updated.'\n #format.html { redirect_to(@entry_item) }\n format.xml { head :ok }\n else\n #format.html { render :action => \"edit\" }\n format.xml { render :xml => @entry_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update \n respond_to do |wants|\n if @item.update_attributes(params[:item])\n flash[:notice] = 'Item was successfully updated.'\n wants.html { redirect_to(admin_items_path) }\n wants.xml { head :ok }\n else\n \n wants.html { render :action => \"edit\" }\n wants.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @item.update_attributes(item_params)\n render json: @item, status: :ok\n else\n render_error(@item, :unprocessable_entity)\n end\n end", "def update\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item }\n format.xml { head :ok }\n else\n \n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n Rails.logger.debug params.inspect\n @item = Item.find(params[:id])\n respond_to do |format|\n if @item.update_attributes(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n respond_with(@items)\n end\n end\n end", "def update\n if @item.update(item_params)\n render json: @item, status: :ok\n else\n render json: @item.errors, status: :unprocessable_entity\n end\n end", "def update\n \n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, :notice => 'Item was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n authorize! :update, @item\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to(items_path, notice: I18n.t('update.success') ) }\n format.js\n else\n format.html { render action: \"edit\" }\n format.js\n end\n end\n end", "def edit\n @item = Item.find(params[:id])\n respond_to do |format|\n format.json { render :json => @item }\n format.xml { render :xml => @item }\n format.html\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to(@item)}\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, :notice => 'Item was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to items_path, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n @item = Item.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @item.update_attributes(params[:item])\r\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\r\n format.json { head :ok }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @item.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to '/items', notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_rest\n @item_usage = ItemUsage.find(params[:id])\n\n respond_to do |format|\n if @item_usage.update_attributes(params[:item_usage])\n flash[:notice] = 'ItemUsage was successfully updated.'\n format.html { redirect_to(@item_usage) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item_usage.errors, :status => :unprocessable_entity }\n end\n end\n end", "def item_update\n @item = Item.find(params[:id])\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to item_show_path(@item), notice: 'O item foi atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to(@item, :notice => 'Item was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to(@item, :notice => 'Item was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: t('controller.successfully_updated', model: t('activerecord.models.item')) }\n format.json { head :no_content }\n else\n prepare_options\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n# @item = Item.get(params[:id])\n\n respond_to do |format|\n if @item.update(params[:item])\n format.html { redirect_to({action: :show, id: @item}, notice: 'Item was successfully updated.') }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n @item = Item.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @item.update_attributes(params[:item])\r\n format.html { redirect_to(@item, :notice => 'Item Successfully updated.') }\r\n format.xml { head :ok }\r\n else\r\n format.html { render :action => \"edit\" }\r\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n flash[:notice] = 'Item was successfully updated.'\n format.html { redirect_to(@item) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n flash[:notice] = 'Item was successfully updated.'\n format.html { redirect_to(@item) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n flash[:notice] = 'Item was successfully updated.'\n format.html { redirect_to(@item) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n #if save fails, it will redirect to edit template\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n get_relations_from_params\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item ||= Item.find_by_id_or_name(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n flash[:notice] = 'Item was successfully updated.'\n format.html { redirect_to(@item) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n flash[:notice] = 'Item was successfully updated.'\n format.html { redirect_to(:action => :index) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @generic_item.update(generic_item_params)\n format.html { redirect_to \"/catalog/#{@generic_item.id}\", notice: 'Generic item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @generic_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_save_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update \n respond_to do |format|\n if @item.update_attributes(params[:item])\n flash[:notice] = 'Artikel is succesvol ge-update.'\n format.html { redirect_to(@item) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to root_path, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n # format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.html { redirect_to @item }\n format.js # update.js.erb が実行される.submit で :remote => true の場合はこれになる\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n @item.save_info\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to after_save_redirection_path, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n logger.info \"Item: #{@item}\\nw/ param attr: #{params[:item].inspect}\"\n respond_to do |format|\n @item.attributes = params[:item].select{|k,v| ![:item_photos, :item_photos_attributes, :location].include?(k.to_sym) }\n\n @item.load_item_photos_with_params(params[:item] )\n\n if @item.save\n\n @item.set_by_user(auth_user)\n\n logger.info \" C) after save: attr: #{@item.attributes}\"\n\n if manage_item_photos(@item).present? || @item.changed?\n @item.save\n logger.info \" D) attr: #{@item.attributes}\"\n end\n\n format.html {\n redirect_to inventory_approve_item_path(:user_id => \"#{@item.owner.id}\")\n }\n format.json { render json:{ item: @item, success: true} }\n else\n set_flash_messages_from_errors(@item)\n format.html { render action: \"edit\" }\n format.json { render json: { error: @item.errors.first.join(' ') }, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to items_path, notice: 'Item ' + @item.name + ' was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n #update the item of request_item\n if (params[:request_item].present?)\n @request_item.item = params[:request_item][:item].present? ? Item.new(name: params[:request_item][:item][:name]) : @request_item.item\n end\n #update all other parameters\n if @request_item.update(request_item_params)\n render json: @request_item\n else\n render json: @request_item.errors, status: :bad_request\n end\n\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[@item.class.to_s.downcase.to_sym])\n flash[:notice] = 'Item was successfully updated.'\n format.html { redirect_to(@item) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: \"Item was successfully updated.\" }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: \"Item was successfully updated.\" }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: \"Item was successfully updated.\" }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: \"Item was successfully updated.\" }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to items_url, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n process_fields\n @components_item = Components::Item.find(params[:id])\n index\n respond_to do |format|\n if @components_item.update_attributes(params[:components_item])\n format.js { @notice = 'Componente actualizado correctamente.' \n render 'index'}\n else\n format.js { @notice = 'Error al actualizar componente.' \n render action: \"edit\"}\n end\n end\n end" ]
[ "0.7008002", "0.6854704", "0.6847166", "0.6774122", "0.6748265", "0.6688311", "0.6684777", "0.662164", "0.66208804", "0.6612236", "0.6605117", "0.659216", "0.6580029", "0.6559096", "0.6551084", "0.65439725", "0.6494292", "0.64919853", "0.6476299", "0.64716256", "0.64694285", "0.64694285", "0.64694285", "0.64694285", "0.64694285", "0.64694285", "0.64694285", "0.64694285", "0.64694285", "0.64694285", "0.64694285", "0.6462302", "0.64589006", "0.644314", "0.644314", "0.64338005", "0.64338005", "0.64334875", "0.64334875", "0.64334875", "0.64334875", "0.64334875", "0.64334875", "0.64334875", "0.64334875", "0.64334875", "0.64232737", "0.64227766", "0.64173675", "0.63930523", "0.63930523", "0.63930523", "0.63888836", "0.6381047", "0.6372039", "0.63699573", "0.6369638", "0.63350177", "0.6315375", "0.62997335", "0.62994033", "0.6292692", "0.6290277", "0.6289654", "0.62879467", "0.6281783", "0.6281442", "0.6279035", "0.62706286", "0.626887", "0.626887", "0.626887", "0.626887", "0.626887", "0.626887", "0.626887", "0.626887", "0.626887", "0.626887", "0.626887", "0.626887", "0.626887", "0.626887", "0.626887", "0.626887", "0.626887", "0.626887", "0.626887", "0.626887", "0.626887", "0.626887", "0.626887", "0.626887", "0.62686497", "0.62653494", "0.62653494", "0.62653494", "0.62653494", "0.62633157", "0.62631685" ]
0.69038594
1
Compute the direct dependences of the interface.
def computeDependences(list) dependences = OCMSet.new OCMSet::SECTIONS.each do |section| @require[section].each do |req| found = false list.each do |iface| for context in iface.provide do if context[section].include?(req) then dependences[section] << iface found = true break end end end raise "#{@id.name}: no dependence found for #{req.name}." unless found end end return dependences.values.flatten.uniq end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def direct_dependencies; end", "def get_dependencies(_fidl, _interaction_types, _project_dependencies)\n # noop\n end", "def diffeq_depends_on()\n unless @diffeq_deps\n my_deps = depends_on # calculate @depends_on\n\n d1_name = Variable.derivative_of_name(@name)\n my_d1 = @parent.variable_by_name(d1_name)\n d1_deps = my_d1.depends_on\n\n @diffeq_deps = my_deps | d1_deps\n end\n @diffeq_deps\n end", "def resolve_dependencies(prev_deps, curr_deps)\n added = curr_deps - prev_deps\n deleted = prev_deps - curr_deps\n split_dependencies(added, deleted)\n end", "def dependencies( names )\n names.each do |name|\n if calculation = fetch( name, nil )\n calculation.dependencies.each do |dependency|\n names << dependency unless names.include?( dependency )\n end\n end\n end\n end", "def resolveDependences(list)\n\n #\n # Resolve potential conflict if interface is unique.\n #\n\n if @unique then\n filtered_interfaces = list.find_all do |f|\n f != self && self.overlap?(f)\n end\n filtered_interfaces.each { |f| list.delete(f) }\n end\n\n #\n # Compute the dependencies and try to resolve the conflicts, if any.\n #\n\n dlist = [ self ]\n dlist, rlist, xlist = self.resolveDependencesRecursive([], list, dlist, [])\n\n rlist.each do |r|\n overlap = []\n r_interface = list.find { |c| c.id == r }\n overlap = xlist.find_all { |x| x.overlap?(r_interface) }\n\n if not overlap.empty? then\n overlap.each { |o| xlist.delete(o) }\n end\n end\n\n if not xlist.empty? then\n error = \"Conflict found: \"\n xlist.each { |x| error += x.id.to_s + ' ' }\n raise Exception.new(error)\n end\n\n return dlist\n end", "def dependencies\n @dependencies.collect { |name, dependency| dependency }\n end", "def get_dependencies\n @dependencies\n end", "def dependencies\n members.each_with_object([]) do |attr_name, depends|\n value = send(attr_name)\n value = pipeline.objects.fetch(value) if value.is_a?(Symbol)\n depends << value.dependencies << value if value.is_a?(PipelineObject)\n end.flatten\n end", "def dependencies_for(source, acc = [])\n ds = dependencies.select { |d| d.last == source }.\n map { |d| d.first }\n return acc if ds.empty?\n acc = acc | ds\n ds.each { |d| acc = acc | dependencies_for(d, acc) }\n acc\n end", "def dependency(start, vertex, nested = T.unsafe(nil)); end", "def cached_dependencies\n @dependencies ||= enumerate_dependencies.compact\n end", "def depends_on(*depends)\n @depends = depends.dup\n\n # Increment dependent references\n @depends.each { |b| b.ref }\n end", "def enumerate_dependencies\n raise DependencyEnumerationNotImplementedError\n end", "def dependencies\n @dependencies.values\n end", "def calculate_deps\n all_deps\n .where(dependency_type: \"Point\", dependency_id: points.pluck(:id))\n .or(refactor_plz)\n .map(&:sequence)\n end", "def required_dependencies\n dependencies - optional_dependencies\n end", "def local_deps\n @local_deps ||= build_local_dependency_list\n end", "def depends\n return @depends if @depends\n\n deps = survey.dependencies.includes({:dependency_conditions => {:question => :answers}})\n\n resps = self.responses.includes(:answer)\n\n # gather if the dependencies are met in a hash\n @depends = deps.all.reduce({}) do |mem, v|\n mem[v.id] = v.is_met? self, resps\n mem\n end\n end", "def linkDepsOrdered()\n\t\ttempLinkDeps = BuildEnv::allLinkDepsOrdered(target()) - targets().to_a #in correct order for the link line\n\t\t#remove project-internal static libs; since the object files we need are in our list anyway, we never need to include intlibs in executables\n\t\tfinalLinkDeps = tempLinkDeps.select {|entity| BuildEnv::entityTypeSafe(entity)[0] != :intlib}\n\t\treturn finalLinkDeps\n\tend", "def depends_on()\n if @value.nil?\n return []\n end\n unless @depends_on\n @depends_on = @value.variables.collect do |var|\n\ttmp = @parent.variable_by_name(var)\n\ttmp or raise \"Can't locate variable dependency '#{var}'!\"\n end\n end\n @depends_on\n end", "def calculate_deps\n SequenceDependency\n .where(ALL_SEQ_DEPS, device.id)\n .where(dependency_type: \"Point\")\n .where(dependency_id: points.pluck(:id))\n .map(&:sequence)\n end", "def dependencies(resource)\n # Cache the reversal graph, because it's somewhat expensive\n # to create.\n unless defined? @reversal and @reversal\n @reversal = reversal\n end\n # Strangely, it's significantly faster to search a reversed\n # tree in the :out direction than to search a normal tree\n # in the :in direction.\n @reversal.tree_from_vertex(resource, :out).keys\n end", "def dependency_links\n if @dependencies.nil?\n # Build the mapping: feature identifier => feature\n features_by_id = id2features\n\n # Resolve the dependency tags\n resolve_dependencies(features_by_id)\n end\n\n return @dependencies\n end", "def dependencies(ctx)\n deps = []\n visitor = ConsCellVisitor.df_visitor(self)\n skip_children = false\n loop do\n side, cell = visitor.resume(skip_children)\n if cell.kind_of?(Core::LogVarRef)\n deps << ctx.lookup(cell.name).i_name\n skip_children = true\n else\n skip_children = false\n end\n break if side == :stop\n end\n\n Set.new(deps)\n end", "def calcdeps(ns, namespace, filenames, prev = [])\n unless source = ns[namespace]\n msg = \"#{prev.last[:filename]}: \" rescue ''\n msg += \"Namespace #{namespace.dump} not found.\"\n raise msg\n end\n if prev.include? source\n return\n else\n prev.push source\n end\n return if filenames.include?(source[:filename])\n source[:require].each do |required|\n calcdeps ns, required, filenames, prev\n end\n filenames.push source[:filename]\n end", "def each_forward_dependency(&block)\n forward_dependencies.each(&block)\n end", "def dependencies_for(specification)\n specification.dependencies\n end", "def dependencies\n @dependencies\n end", "def dependencies\n @dependencies ||= []\n end", "def dependencies\n @dependencies ||= []\n end", "def dependencies\n @dependencies ||= []\n end", "def dependencies\n @dependencies ||= []\n end", "def dependencies(include_parent = false)\n []\n end", "def dependencies(include_parent = false)\n []\n end", "def dependencies(include_parent = false)\n []\n end", "def dependencies_for(model)\n dependencies = Set.new\n # Each association is a dependency\n model.reflect_on_all_associations.each do |ass|\n relation_name = ass.name.to_s\n class_name = ass.options[:class_name] || relation_name.singularize.camelize\n\n dependencies.add? class_name\n end\n dependencies\n end", "def dependency_list\n @target.dependencies.map(&:display_name)\n end", "def dependencies\n @dependencies ||= []\n end", "def dependent; end", "def dependent; end", "def derivatives\n\t\tancestors.each {|klass|\n\t\t\tif klass.instance_variables.include?( \"@derivatives\" )\n\t\t\t\tbreak klass.instance_variable_get( :@derivatives )\n\t\t\tend\n\t\t}\n\tend", "def dependencies\n @dependencies ||= {}\n end", "def dependencies_for(specification)\n specification.dependencies(@cache, @resolver_ui)\n end", "def compute_revdeps\n result = Hash.new { |h, k| h[k] = Set.new }\n each_autobuild_package do |pkg|\n pkg.dependencies.each do |pkg_name|\n result[pkg_name] << pkg.name\n end\n pkg.optional_dependencies.each do |pkg_name|\n result[pkg_name] << pkg.name\n end\n pkg.os_packages.each do |pkg_name|\n result[pkg_name] << pkg.name\n end\n end\n result\n end", "def dependents(resource)\n tree_from_vertex(resource).keys\n end", "def viewable_dependant(obj)\n end", "def viewable_dependant(obj)\n end", "def viewable_dependant(obj)\n end", "def dependencies_for(specification)\n []\n end", "def dependencies\n\t\t0\n\tend", "def dependencies\n []\n end", "def dependencies\n []\n end", "def dependencies; end", "def dependencies; end", "def dependencies; end", "def child_dependencies\n @children\n end", "def resolve\n @resolved = []\n @unresolved = []\n @circular = []\n @outputs.each do |onode|\n rdep onode\n end\n [@resolved, @circular.empty? ? nil : @circular]\n end", "def core_fetch_dependencies(deps, verbose)\n deps.each do |pkg_name, pkg_version|\n core_fetch_dependency pkg_name, pkg_version, :runtime, verbose\n end\n end", "def dependencies\n @target_dependencies + (@parent ? @parent.dependencies : [])\n end", "def inter_file_dependencies\n attributes.fetch(:interFileDependencies)\n end", "def direct_dependency(type, result = T.unsafe(nil)); end", "def dependencies\n EMPTY_SET\n end", "def resolve_dependencies\r\n @nodes.each do |node|\r\n puts \"processing #{node}\"\r\n\r\n node.outgoing_dependencies do |dependency|\r\n providers = nodes_satisfying(dependency.target)\r\n node.add_dependency(dependency, providers)\r\n end\r\n \r\n node.dependencies.values.each { |vals| vals.sort! }\r\n end\r\n end", "def check_dependencies\n fetch_module_dependencies.map do |dependency, constraint|\n dependency = dependency.sub('-', '/')\n current = dependency == @updated_module ? SemanticPuppet::Version.parse(@updated_module_version) : @forge.get_current_version(dependency)\n [dependency, constraint, current, constraint.include?(current)]\n end\n end", "def realize_dependencies\n dependencies.each do |dependency|\n dependency.realize\n end\n end", "def runtime_dependencies\n dependencies.select(&:runtime?)\n end", "def find_dependencies(deps=nil, verbose=false)\n \n deps ||= all_dependencies\n\n search_list = Array(deps)\n found = []\n ret = []\n \n # if we discover a new local package via indirect dependencies then\n # it's dependencies will be fetchable one time.\n fetchable = Set.new\n \n until search_list.empty?\n name, version = search_list.shift\n\n if dup = found.find{|p| p.name == name}\n # already found, check for conflicts\n next if satisfied_by?(version, dup.version)\n raise PackageConflictError.new(name, dup.version, version)\n end\n\n pkg = locate_package(name, version, verbose)\n if pkg.nil? && fetchable.include?(name)\n fetchable.reject! { |x| x == name }\n core_fetch_dependency(name, version, :runtime, true) \n pkg = locate_package name, version, verbose\n end\n \n raise PackageNotFoundError.new(name, version) unless pkg\n\n found << pkg\n\n # Look up dependencies of dependencies\n new_deps = Array(pkg.dependencies) + Array(pkg.dependencies_build)\n if has_local_package? pkg.name\n new_deps += Array(pkg.dependencies_development)\n new_deps.each { |dep| fetchable.add dep.first }\n end\n \n search_list += new_deps\n\n ret << pkg\n end\n\n ret\n end", "def calcImmediateDependencies(target_file)\n\t\tsrc_file = targetToSource(target_file)\n\t\tdepstr = case @compiler\n\t\t\twhen @@byteCodeCompiler \n\t\t\t\t`ocamldep #{@includesString} #{src_file}` \n\t\t\twhen @@machineCodeCompiler\n\t\t\t\t`ocamldep -native #{@includesString} #{src_file}` \n\t\t\telse \n\t\t\t\tputs \"ERROR couldn't compile to file: \" + target\n\t\tend\n\t\t#debug \"\\n*\\n*\\n\" + depstr\n\n\t\t#make an array of lines, where each line is a complete \n\t\t#\"<target>: <dep1> <dep2>\" sequence\n\t\tdeplines = depstr.gsub(\"\\\\\\n\", \" \").split(\"\\n\")\n\n\t\t#split each of these lines into an array of tokens, \n\t\t#yielding a 2-d token array\n\t\ttokens = deplines.map {|dl| dl.split(\" \")}\n\n\t\t#drop the colon on the first element of each token line, \n\t\t#it is <targetfile>:\n\t\ttokens.each {|ts| ts[0] = ts[0].chop()} \n\n\t\t#find the token line that starts with the target file we want\n\t\tdepfiles = Set.new() \n\t\ttokens.each do |tokenline|\n\t\t\tcand_target = tokenline.shift()\n\t\t\t#debug \"cand: #{cand_target}\"\n\t\t\t#debug \"target: #{target_file}\"\n\t\t\tif(target_file == cand_target)\n\t\t\t\tif(@useByteImpls && (target_file[-3,3] == 'cmo'))\n\t\t\t\t\timplsline = tokenline.map {|cmifn| changeExt(cmifn, 'cmo')}\n\t\t\t\t\timplsline.delete_if {|cmofn| cmofn == target_file}\n\t\t\t\t\tdepfiles.merge implsline\n\t\t\t\tend\n\t\t\t\tdepfiles.merge(tokenline)\n\t\t\tend\n\t\tend\n\t\texpandedSet = depfiles.map {|fn| File.expand_path(fn)}\n\t\t#debug \"ImmediateDeps:\"\n\t\t#debug setString(expandedSet)\n\t\treturn expandedSet\n\tend", "def dependent_specs\n runtime_dependencies.map {|dep| dep.to_specs }.flatten\n end", "def dependencies\n []\n end", "def recursive_dependencies(&block)\n Dependency.expand(self, &block)\n end", "def create_dependency_graph\n service_types.map do |key, i|\n i.service_producers.map do |j|\n j.factory.machine.depends.each do |k|\n binding.pry unless service_types[k.name]\n service_types[k.name].join(i)\n end\n j.factory.machine.requires.each do |k|\n binding.pry unless service_types[k.name]\n i.join(service_types[k.name])\n end\n end\n end\n end", "def process_project_dependencies\n BRIX11.log(3, '[%s] process project dependencies', self)\n # collect all interaction types and the project dependencies\n interaction_types = Set.new\n project_dependencies = MPC::Dependencies.new\n @idl_files.each_value do |fidl|\n BRIX11.log(4, \"[#{self}] #{fidl}\")\n fidl.includes.each do |ifidl|\n if ifidl.is_member?\n BRIX11.log(4, \"[#{self}] #{ifidl}\")\n interaction_types.merge(ifidl.interaction_types)\n rcp = ifidl.recipes.first\n rcp.get_dependencies(ifidl, ifidl.interaction_types, project_dependencies)\n end\n end\n end\n\n # process dependencies for MPC projects for this recipe\n setup_comp_gen(project_dependencies)\n\n if self.needs_stub?\n setup_stub_comp(project_dependencies)\n end\n\n setup_lem_comp(project_dependencies)\n setup_svnt_comp(project_dependencies)\n setup_exec_lib(project_dependencies)\n\n # process interaction specific project dependencies for\n # each (unique) collected transaction type\n interaction_types.each do |int_type|\n handle_interaction_dependencies(int_type, project_dependencies)\n end\n end", "def dependency_respects_ordering?; @dependency_respects_ordering; end", "def dependency_paths\n @dependency_paths ||= []\n end", "def walk_down_dependencies(pkg_name, known_deps=Array.new)\n\talldeps = Array.new\n\t@total_deps[pkg_name].each { |m|\n\t\tunless alldeps.include?(m) || m.nil? || known_deps.include?(m) \n\t\t\talldeps = alldeps + walk_down_dependencies(m, alldeps)\n\t\tend\n\t\talldeps.push m\n\t}\n\talldeps.uniq!\n\talldeps.push pkg_name\n\t# puts alldeps.join(\", \") \n\treturn alldeps.compact \nend", "def reverse_dependencies()\n\n a = LineTree.new(@s, root: @root).to_doc.root.xpath('//' + @name)\n\n s = a.select {|x| x.has_elements? }\\\n .map{|x| XmlToSliml.new(x).to_s }.join(\"\\n\")\n\n return DepViz.new if s.empty?\n\n dv3 = DepViz.new(root: nil)\n dv3.read s\n dv3\n\n end", "def lookup_direct_dependencies(source_or_source_key)\n source = lookup(source_or_source_key)\n @cached_dependencies[source] ||= lookup_direct_dependencies!(source)\n end", "def initial_dependencies\n []\n end", "def render_dependency_link d\n return unless show_dependencies\n\n _logger.debug :D, :prefix => false, :write => true\n\n c1 = d.component\n c2 = d.resolved_component(@resolver)\n\n return unless c1 && c2 &&\n @components.include?(c1) &&\n @components.include?(c2)\n\n if show_link_component_versions\n render_edge c1, dot_name(c2, :version => false),\n :tooltip => \"depended by: #{c1.name}/#{c1.version}\",\n :style => :dotted, \n :arrowhead => :open,\n :color => complete?(c2) ? '#000000' : '#888888'\n end\n\n render_edge c1, c2,\n :label => dot_label(d),\n :tooltip => \"#{c1.name}/#{c1.version} depends on #{c2.name}/#{c2.version}\" + \n (d.version ? \"; requires: #{d.version}\" : ''),\n :arrowhead => :vee,\n :style => required?(c1) && required?(c2) ? nil : :dotted,\n :color => complete?(c1) && complete?(c2) ? '#000000' : '#888888'\n end", "def dependencies\n node.output[carrier].keys\n end", "def component_deps(cmp)\n component(cmp).fetch('deps', [])\nend", "def component_deps(cmp)\n component(cmp).fetch('deps', [])\nend", "def depend?(v)\n CAS::Help.assert(v, CAS::Op)\n\n @x.depend? v\n end", "def declared_dependencies(ast)\n raise_unless_xpath!(ast)\n deps = ast.xpath(%q{//command[ident/@value='depends']/\n descendant::args_add/descendant::tstring_content[1]})\n # handle quoted word arrays\n var_ref = ast.xpath(%q{//command[ident/@value='depends']/\n descendant::var_ref/ident})\n unless var_ref.empty?\n deps += ast.xpath(%Q{//block_var/params/ident#{var_ref.first['value']}/\n ancestor::method_add_block/call/descendant::tstring_content})\n end\n deps.map{|dep| dep['value']}\n end", "def dependency_classes\n res = []\n\n eager_loaded_components.keys.each do |aggr|\n res += component_instance(aggr).dependency_classes\n end\n\n res += self.class.class_ancestors\n\n res << self.class\n res.uniq\n end", "def check_idl_dependencies\n BRIX11.log(4, \"[%s] check_idl_dependencies\", self)\n @idl_files.each_value do |fidl|\n # is this IDLFile managed by a recipe yet?\n if fidl.recipes.empty?\n # find/create the recipe to manage this IDLFile\n check_idl_recipe(fidl)\n end\n check_idl_file_dependencies(fidl)\n end\n end", "def each_backward_dependency(&block)\n backward_dependencies.each(&block)\n end", "def dependency_order\n result = []\n disabled = {}\n predecessors = build_predecessors\n while disabled.size < @specs.size\n\tcandidate = @specs.find { |spec|\n\t ! disabled[spec.full_name] &&\n\t active_count(predecessors[spec.full_name], disabled) == 0\n\t}\n\tif candidate\n\t disabled[candidate.full_name] = true\n\t result << candidate\n\telsif candidate = @specs.find { |spec| ! disabled[spec.full_name] }\n\t # This case handles circular dependencies. Just choose a\n\t # candidate and move on.\n\t disabled[candidate.full_name] = true\n\t result << candidate\n\telse\n\t # We should never get here, but just in case we will terminate \n\t # the loop.\n\t break\n\tend\n end\n result\n end", "def dependencies\n @dependencies ||= Set.new\n end", "def dependencies(include_parent = false)\n include_parent ? [ parent ] : []\n end", "def dependent_gems(check_dev=true)\n out = []\n Gem::Specification.each do |spec|\n deps = check_dev ? spec.dependencies : spec.runtime_dependencies\n deps.each do |dep|\n if self.satisfies_requirement?(dep)\n sats = []\n find_all_satisfiers(dep) do |sat|\n sats << sat\n end\n out << [spec, dep, sats]\n end\n end\n end\n out\n end", "def lookup_direct_dependencies!(source)\n return [] unless source\n\n source.dependencies.map do |dependency|\n result = provides_tree.glob(\"/#{dependency}\")\n if (!result || (result.is_a?(Array) && result.empty?))\n Jsus.logger.warn \"#{source.filename} is missing #{dependency.is_a?(SourceFile) ? dependency.filename : dependency.to_s}\"\n end\n result\n end.flatten.map {|tag| lookup(tag) }\n end", "def dependency_versions(args = {}, &bl)\n versions = {}\n args = {:recursive => true, :dev_deps => true, :versions => versions}.merge(args)\n deps.each do |dep|\n gem = Polisher::Gem.retrieve(dep.name)\n versions.merge!(gem.versions(args, &bl))\n end\n versions\n end", "def request_dependencies\n end", "def look_for_dependent_ons(parent_fieldset)\n output = []\n parent_fieldset.fieldset_children.each do |fieldset_child|\n if fieldset_child.child_type == \"DynamicFieldsets::Field\"\n if fieldset_child.dependencies.present?\n output.push fieldset_child\n end\n else # if child type is a fieldset, then recurse\n output += look_for_dependent_ons(fieldset_child.child)\n end\n end\n return output\n end", "def each_dependency(&block)\n return dependencies_enumerator if block.nil?\n\n dependencies_enumerator.each(&block)\n end", "def getDependencies service\r\n deps = []\r\n Util.csprojs(service).each do |csproj|\r\n deps += getDeps(csproj) \r\n end\r\n return deps.uniq\r\nend", "def dependency_forward_names\n names = []\n each_forward_dependency do |task|\n names << task.to_s\n end\n names.sort\n end" ]
[ "0.6960988", "0.6530213", "0.64618677", "0.61875457", "0.61219937", "0.6067032", "0.60298073", "0.6001048", "0.59841347", "0.5975094", "0.5964049", "0.5944167", "0.58562434", "0.5852234", "0.5819125", "0.58160925", "0.5805668", "0.5784669", "0.5765604", "0.5756964", "0.5756669", "0.57510054", "0.5748518", "0.57398146", "0.57342166", "0.5728511", "0.5706537", "0.57001895", "0.5696568", "0.5692301", "0.5692301", "0.5692301", "0.5692301", "0.5688666", "0.5688666", "0.5688666", "0.56836754", "0.567734", "0.5667957", "0.56666726", "0.56666726", "0.56487083", "0.5644164", "0.5639106", "0.5637285", "0.561323", "0.5599029", "0.5599029", "0.5599029", "0.5594664", "0.5587159", "0.5585272", "0.5581648", "0.557351", "0.557351", "0.557351", "0.55726624", "0.556145", "0.5549165", "0.55441743", "0.5541293", "0.55365145", "0.5490653", "0.5477298", "0.5476839", "0.5475556", "0.5475437", "0.5473467", "0.5469274", "0.5464193", "0.5457303", "0.54443884", "0.5440485", "0.5413474", "0.54130024", "0.53919333", "0.53754514", "0.5365212", "0.53591466", "0.5346674", "0.5326703", "0.53230184", "0.5319845", "0.5319845", "0.5315336", "0.53112966", "0.53100455", "0.5307238", "0.5294175", "0.528838", "0.52873784", "0.52701944", "0.5247955", "0.52441305", "0.5237361", "0.5225745", "0.52185655", "0.5217421", "0.52094245", "0.51993126" ]
0.59862655
8
Resolve the interface's dependences graph.
def resolveDependences(list) # # Resolve potential conflict if interface is unique. # if @unique then filtered_interfaces = list.find_all do |f| f != self && self.overlap?(f) end filtered_interfaces.each { |f| list.delete(f) } end # # Compute the dependencies and try to resolve the conflicts, if any. # dlist = [ self ] dlist, rlist, xlist = self.resolveDependencesRecursive([], list, dlist, []) rlist.each do |r| overlap = [] r_interface = list.find { |c| c.id == r } overlap = xlist.find_all { |x| x.overlap?(r_interface) } if not overlap.empty? then overlap.each { |o| xlist.delete(o) } end end if not xlist.empty? then error = "Conflict found: " xlist.each { |x| error += x.id.to_s + ' ' } raise Exception.new(error) end return dlist end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resolve!\n dl, cl = resolve\n raise GraphException(\"Circular Dependency Detected: %s\" % cl) unless cl.nil?\n dl\n end", "def resolve_dependencies\r\n @nodes.each do |node|\r\n puts \"processing #{node}\"\r\n\r\n node.outgoing_dependencies do |dependency|\r\n providers = nodes_satisfying(dependency.target)\r\n node.add_dependency(dependency, providers)\r\n end\r\n \r\n node.dependencies.values.each { |vals| vals.sort! }\r\n end\r\n end", "def resolve\n r = Gem::DependencyResolver.new(@dependencies)\n r.resolve\n end", "def resolve\n locking_dg = Molinillo::DependencyGraph.new\n Molinillo::Resolver.new(self, self).resolve(@needed.map {|d| DependencyRequest.new d, nil }, locking_dg).tsort.map(&:payload).compact\n rescue Molinillo::VersionConflict => e\n conflict = e.conflicts.values.first\n raise Gem::DependencyResolutionError, Conflict.new(conflict.requirement_trees.first.first, conflict.existing, conflict.requirement)\n ensure\n @output.close if defined?(@output) and !debug?\n end", "def resolve\n @resolved = []\n @unresolved = []\n @circular = []\n @outputs.each do |onode|\n rdep onode\n end\n [@resolved, @circular.empty? ? nil : @circular]\n end", "def resolve!\n @relations.map(&:resolve!)\n end", "def resolve_dependencies!\n return unless Config.resolve? && targets.any?\n\n puts 'resolving dependencies...'\n each_threaded(targets) do |target|\n Depends.resolve(target, self)\n end\n end", "def load_dependencies\n result = zh_client.dependencies(repo_name)\n\n result[\"dependencies\"].each do |hash|\n blocking = add_or_find(hash[\"blocking\"])\n blocked = add_or_find(hash[\"blocked\"])\n\n add_edge(blocked, blocking)\n end\n end", "def reload\n @circular_dependencies = nil\n @hard_scope = nil\n @scope = nil\n\n @dependencies = @clazz.reflections.map do |_, reflection|\n next unless reflection.is_a?(ActiveRecord::Reflection::BelongsToReflection)\n\n dependency = @dependencies.find { |d| d.reflection == reflection }\n if dependency\n dependency.reload\n dependency\n else\n Dependency.new(reflection, @dump)\n end\n end.compact\n end", "def recursive_dependencies(&block)\n Dependency.expand(self, &block)\n end", "def resolve(deps, top_level = true, seen_items = {}, path_string = '') # rubocop:disable Metrics/AbcSize\n graph = {}\n if top_level\n Inspec::Log.debug(\"Starting traversal of dependencies #{deps.map(&:to_s)}\")\n else\n Inspec::Log.debug(\"Traversing dependency tree of transitive dependency #{deps.map(&:name)}\")\n end\n\n detect_duplicates(deps, top_level, path_string)\n deps.each do |dep|\n new_seen_items = seen_items.dup\n new_path_string = if path_string.empty?\n dep.name\n else\n path_string + \" -> #{dep.name}\"\n end\n\n raise Inspec::CyclicDependencyError, \"Dependency #{dep} would cause a dependency cycle (#{new_path_string})\" if new_seen_items.key?(dep.resolved_source)\n\n new_seen_items[dep.resolved_source] = true\n\n if !dep.source_satisfies_spec?\n raise Inspec::UnsatisfiedVersionSpecification, \"The profile #{dep.name} from #{dep.resolved_source} has a version #{dep.source_version} which doesn't match #{dep.version_constraints}\"\n end\n\n Inspec::Log.debug(\"Adding dependency #{dep.name} (#{dep.resolved_source})\")\n graph[dep.name] = dep\n if !dep.dependencies.empty?\n resolve(dep.dependencies, false, new_seen_items.dup, new_path_string)\n end\n end\n\n Inspec::Log.debug('Dependency traversal complete.') if top_level\n graph\n end", "def resolve_dependencies(prev_deps, curr_deps)\n added = curr_deps - prev_deps\n deleted = prev_deps - curr_deps\n split_dependencies(added, deleted)\n end", "def load_dependencies\n dependencies.each { |dependency| dependency }\n end", "def dependency_links\n if @dependencies.nil?\n # Build the mapping: feature identifier => feature\n features_by_id = id2features\n\n # Resolve the dependency tags\n resolve_dependencies(features_by_id)\n end\n\n return @dependencies\n end", "def get_dependencies(_fidl, _interaction_types, _project_dependencies)\n # noop\n end", "def enumerate_dependencies\n raise DependencyEnumerationNotImplementedError\n end", "def direct_dependencies; end", "def resolve_install_conflicts(graph, is_dependency = false)\n graph.each do |release|\n @environment.modules_by_path[options[:target_dir]].each do |mod|\n if mod.has_metadata?\n metadata = {\n :name => mod.forge_name.gsub('/', '-'),\n :version => mod.version\n }\n next if release[:module] == metadata[:name]\n else\n metadata = nil\n end\n\n if release[:module] =~ /-#{mod.name}$/\n dependency_info = {\n :name => release[:module],\n :version => release[:version][:vstring]\n }\n dependency = is_dependency ? dependency_info : nil\n latest_version = @versions[\"#{@module_name}\"].sort_by { |h| h[:semver] }.last[:vstring]\n\n raise InstallConflictError,\n :requested_module => @module_name,\n :requested_version => @version || \"latest: v#{latest_version}\",\n :dependency => dependency,\n :directory => mod.path,\n :metadata => metadata\n end\n\n resolve_install_conflicts(release[:dependencies], true)\n end\n end\n end", "def dependencies\n @dependencies ||= {}\n end", "def rdep(node)\n @unresolved << node\n node.inputs.each { |inode|\n if not @resolved.member? inode\n unless @unresolved.member? inode\n rdep inode\n else\n # we found a circular reference.\n @circular << inode\n #log.warn \"Dependency found: %s\" % inode\n end\n end\n }\n @resolved << node\n @unresolved.delete node\n end", "def dependencies_for(specification)\n specification.dependencies(@cache, @resolver_ui)\n end", "def build_qml_dep_graph\n @ir.each do |key, ir|\n #puts \"#{key} dep is #{get_dep ir}\"\n @dep[key] = get_dep ir\n end\n end", "def each_forward_dependency(&block)\n forward_dependencies.each(&block)\n end", "def get_dependencies\n @dependencies\n end", "def create_dependency_graph\n service_types.map do |key, i|\n i.service_producers.map do |j|\n j.factory.machine.depends.each do |k|\n binding.pry unless service_types[k.name]\n service_types[k.name].join(i)\n end\n j.factory.machine.requires.each do |k|\n binding.pry unless service_types[k.name]\n i.join(service_types[k.name])\n end\n end\n end\n end", "def _load(dependency_map, current, h)\n dependency_map.each do |ta, deps|\n unless key = pk(ta, h)\n ta_h = hfor(ta, h)\n unless ta_h.values.any?\n assoc_name = alias_map[ta]\n unless (assoc = current.associations).has_key?(assoc_name)\n assoc[assoc_name] = type_map[ta] ? [] : nil\n end\n next\n end\n key = hkey(ta_h)\n end\n rm, rp, assoc_name, tm, rcm = @ta_map[ta]\n unless rec = rm[key]\n rec = rm[key] = rp.call(hfor(ta, h))\n end\n\n if tm\n unless (assoc = current.associations).has_key?(assoc_name)\n assoc[assoc_name] = []\n end\n assoc[assoc_name].push(rec) \n rec.associations[rcm] = current if rcm\n else\n current.associations[assoc_name] ||= rec\n end\n # Recurse into dependencies of the current object\n _load(deps, rec, h) unless deps.empty?\n end\n end", "def dependencies(&block)\n deps = ::OSGi::Dependencies.new(project)\n deps.read\n deps.dependencies + deps.projects\n end", "def dependencies(include_parent = false)\n []\n end", "def dependencies(include_parent = false)\n []\n end", "def dependencies(include_parent = false)\n []\n end", "def dependencies(resource)\n # Cache the reversal graph, because it's somewhat expensive\n # to create.\n unless defined? @reversal and @reversal\n @reversal = reversal\n end\n # Strangely, it's significantly faster to search a reversed\n # tree in the :out direction than to search a normal tree\n # in the :in direction.\n @reversal.tree_from_vertex(resource, :out).keys\n end", "def build_dependencies(manager)\n DependenciesResolver.resolve manager, dependencies\n end", "def resolve(dependencies, requirements = [])\n retrieved = retrieve(dependencies, requirements)\n retrieved.each_with_object(Hashie::Mash.new) do |(k, v), total|\n total[k] = resolve_dependency v\n end.freeze\n end", "def dependencies(recurse: true)\n return @dependencies if @dependencies\n if depends.nil? || depends.empty?\n @dependencies = nil\n else\n @dependencies = depends.map do |name, dependency|\n loader = StackFileLoader.for(dependency['stack'], self)\n deps = { 'name' => name, 'stack' => loader.source, 'variables' => dependency.fetch('variables', Hash.new) }\n if recurse\n child_deps = loader.dependencies\n deps['depends'] = child_deps unless child_deps.nil?\n end\n deps\n end\n end\n end", "def process_project_dependencies\n BRIX11.log(3, '[%s] process project dependencies', self)\n # collect all interaction types and the project dependencies\n interaction_types = Set.new\n project_dependencies = MPC::Dependencies.new\n @idl_files.each_value do |fidl|\n BRIX11.log(4, \"[#{self}] #{fidl}\")\n fidl.includes.each do |ifidl|\n if ifidl.is_member?\n BRIX11.log(4, \"[#{self}] #{ifidl}\")\n interaction_types.merge(ifidl.interaction_types)\n rcp = ifidl.recipes.first\n rcp.get_dependencies(ifidl, ifidl.interaction_types, project_dependencies)\n end\n end\n end\n\n # process dependencies for MPC projects for this recipe\n setup_comp_gen(project_dependencies)\n\n if self.needs_stub?\n setup_stub_comp(project_dependencies)\n end\n\n setup_lem_comp(project_dependencies)\n setup_svnt_comp(project_dependencies)\n setup_exec_lib(project_dependencies)\n\n # process interaction specific project dependencies for\n # each (unique) collected transaction type\n interaction_types.each do |int_type|\n handle_interaction_dependencies(int_type, project_dependencies)\n end\n end", "def depend_on(path)\n @_dependency_paths << resolve(path).to_s\n nil\n end", "def dependencies\n @dependencies ||= []\n end", "def initial_dependencies\n []\n end", "def dependencies; end", "def dependencies; end", "def dependencies; end", "def dependencies_for(model)\n dependencies = Set.new\n # Each association is a dependency\n model.reflect_on_all_associations.each do |ass|\n relation_name = ass.name.to_s\n class_name = ass.options[:class_name] || relation_name.singularize.camelize\n\n dependencies.add? class_name\n end\n dependencies\n end", "def dependencies\n @dependencies ||= []\n end", "def dependencies\n @dependencies ||= []\n end", "def dependencies\n @dependencies ||= []\n end", "def dependencies\n @dependencies ||= []\n end", "def refresh_dependents(options = {}); end", "def dependencies\n @dependencies.collect { |name, dependency| dependency }\n end", "def resolve(set=nil)\n r = Gem::DependencyResolver.new(@dependencies, set)\n @requests = r.resolve\n end", "def dependencies\n EMPTY_SET\n end", "def parent_dependencies\n @parents\n end", "def resolve\n return self.ref.resolve\n end", "def resolve\n return self.ref.resolve\n end", "def resolve(options = {})\n if options[:ui]\n raise 'The UI object must be of type Molinillo::UI' unless options[:ui].is_a?(Molinillo::UI)\n ui = options[:ui]\n else\n require 'puppetfile-resolver/ui/null_ui'\n ui = PuppetfileResolver::UI::NullUI.new\n end\n provider = ResolutionProvider.new(@puppetfile, @puppet_version, ui, options)\n\n resolver = Molinillo::Resolver.new(provider, ui)\n begin\n result = resolver.resolve(dependencies_to_resolve)\n rescue Molinillo::VersionConflict => e\n # Wrap the Molinillo error\n new_e = PuppetfileResolver::Puppetfile::DocumentVersionConflictError.new(e)\n raise new_e, new_e.message, e.backtrace\n rescue Molinillo::CircularDependencyError => e\n # Wrap the Molinillo error\n new_e = PuppetfileResolver::Puppetfile::DocumentCircularDependencyError.new(@puppetfile, e)\n raise new_e, new_e.message, e.backtrace\n end\n ResolutionResult.new(result, @puppetfile)\n end", "def refresh_dependencies(options = {}); end", "def dependencies\n []\n end", "def resolve\n self # simple Check never has references\n end", "def builddepends\n # Handle the requires\n self.class.relationship_params.collect do |klass|\n if param = @parameters[klass.name]\n param.to_edges\n end\n end.flatten.reject { |r| r.nil? }\n end", "def to_edges\n @value.collect do |reference|\n reference.catalog = resource.catalog\n\n # Either of the two retrieval attempts could have returned\n # nil.\n unless related_resource = reference.resolve\n self.fail \"Could not retrieve dependency '#{reference}' of #{@resource.ref}\"\n end\n\n # Are we requiring them, or vice versa? See the method docs\n # for futher info on this.\n if self.class.direction == :in\n source = related_resource\n target = @resource\n else\n source = @resource\n target = related_resource\n end\n\n if method = self.class.callback\n subargs = {\n :event => self.class.events,\n :callback => method\n }\n self.debug(\"subscribes to #{related_resource.ref}\")\n else\n # If there's no callback, there's no point in even adding\n # a label.\n subargs = nil\n self.debug(\"requires #{related_resource.ref}\")\n end\n\n rel = Puppet::Relationship.new(source, target, subargs)\n end\n end", "def dependencies\n @dependencies ||= Set.new\n end", "def reverse_dependencies()\n\n a = LineTree.new(@s, root: @root).to_doc.root.xpath('//' + @name)\n\n s = a.select {|x| x.has_elements? }\\\n .map{|x| XmlToSliml.new(x).to_s }.join(\"\\n\")\n\n return DepViz.new if s.empty?\n\n dv3 = DepViz.new(root: nil)\n dv3.read s\n dv3\n\n end", "def dependencies(recurse: true)\n return @dependencies if @dependencies\n depends = yaml['depends']\n if depends.nil? || depends.empty?\n @dependencies = nil\n else\n @dependencies = depends.map do |name, dependency|\n reader = StackFileLoader.for(dependency['stack'], self)\n deps = { 'name' => name, 'stack' => reader.source, 'variables' => dependency.fetch('variables', Hash.new) }\n if recurse\n child_deps = reader.dependencies\n deps['depends'] = child_deps unless child_deps.nil?\n end\n deps\n end\n end\n end", "def lookup_dependencies(cookbook, checked = {})\n Berkshelf.log.debug \" Looking up dependencies for #{cookbook}\"\n\n dependencies = []\n\n lockfile.graph.find(cookbook).dependencies.each do |name, _|\n next if checked[name]\n\n # break cyclic graphs\n checked[name] = true\n\n # this is your standard depth-first tree traversal with the deps first...\n dependencies += lookup_dependencies(name, checked)\n # ..then the node itself\n dependencies << name\n end\n dependencies\n end", "def dependencies\n []\n end", "def dependencies\n []\n end", "def resolve\n end", "def check_idl_dependencies\n recipes.each { |rcp| rcp.check_idl_dependencies }\n end", "def resolvers\n @resolvers\n end", "def dependency_tree(args = {}, &bl)\n dependencies = {}\n args = {:recursive => true,\n :dev_deps => true,\n :matching => :latest,\n :dependencies => dependencies}.merge(args)\n\n process = []\n deps.each do |dep|\n resolved = nil\n begin\n resolved = Polisher::Gem.matching(dep, args[:matching])\n rescue\n end\n yield self, dep, resolved\n process << resolved unless resolved.nil?\n end\n\n process.each { |dep|\n dependencies.merge!(dep.dependency_tree(args, &bl))\n }\n\n dependencies\n end", "def realize_dependencies\n dependencies.each do |dependency|\n dependency.realize\n end\n end", "def check_idl_dependencies\n BRIX11.log(4, \"[%s] check_idl_dependencies\", self)\n @idl_files.each_value do |fidl|\n # is this IDLFile managed by a recipe yet?\n if fidl.recipes.empty?\n # find/create the recipe to manage this IDLFile\n check_idl_recipe(fidl)\n end\n check_idl_file_dependencies(fidl)\n end\n end", "def resolve_all_links()\n @flows.each_value { |f|\n f.resolve_all_links()\n }\n end", "def dependencies\n @dependencies\n end", "def find_dependencies(deps=nil, verbose=false)\n \n deps ||= all_dependencies\n\n search_list = Array(deps)\n found = []\n ret = []\n \n # if we discover a new local package via indirect dependencies then\n # it's dependencies will be fetchable one time.\n fetchable = Set.new\n \n until search_list.empty?\n name, version = search_list.shift\n\n if dup = found.find{|p| p.name == name}\n # already found, check for conflicts\n next if satisfied_by?(version, dup.version)\n raise PackageConflictError.new(name, dup.version, version)\n end\n\n pkg = locate_package(name, version, verbose)\n if pkg.nil? && fetchable.include?(name)\n fetchable.reject! { |x| x == name }\n core_fetch_dependency(name, version, :runtime, true) \n pkg = locate_package name, version, verbose\n end\n \n raise PackageNotFoundError.new(name, version) unless pkg\n\n found << pkg\n\n # Look up dependencies of dependencies\n new_deps = Array(pkg.dependencies) + Array(pkg.dependencies_build)\n if has_local_package? pkg.name\n new_deps += Array(pkg.dependencies_development)\n new_deps.each { |dep| fetchable.add dep.first }\n end\n \n search_list += new_deps\n\n ret << pkg\n end\n\n ret\n end", "def dependencies(include_parent = false)\n include_parent ? [ parent ] : []\n end", "def resolve_dependency(_completed_operation)\n true\n end", "def walk_down_dependencies(pkg_name, known_deps=Array.new)\n\talldeps = Array.new\n\t@total_deps[pkg_name].each { |m|\n\t\tunless alldeps.include?(m) || m.nil? || known_deps.include?(m) \n\t\t\talldeps = alldeps + walk_down_dependencies(m, alldeps)\n\t\tend\n\t\talldeps.push m\n\t}\n\talldeps.uniq!\n\talldeps.push pkg_name\n\t# puts alldeps.join(\", \") \n\treturn alldeps.compact \nend", "def resolve_conflicts_and_versions(opts = {})\n # TODO: currently module refs al nailed as opposed to version contraints; when there are\n # version contraints; this methdo will take care of them\n ResolveModules.resolve_conflicts(self, opts)\n end", "def create_dependencies(con)\n @resolving_dependencies = true\n dependencies.each do |_, d|\n fail CircularDependencyError.new(name, d.name) if d.resolving_dependencies\n d.create_dependencies(con)\n d.create_or_update!(con)\n end\n @resolving_dependencies = false\n end", "def interface_ancestors_cache; end", "def enumerate_dependencies\n json = JSON.parse(project_assets_file)\n nuget_packages_dir = json[\"project\"][\"restore\"][\"packagesPath\"]\n json[\"targets\"].each_with_object({}) do |(_, target), dependencies|\n target.each do |reference_key, reference|\n # Ignore project references\n next unless reference[\"type\"] == \"package\"\n package_id_parts = reference_key.partition(\"/\")\n name = package_id_parts[0]\n version = package_id_parts[-1]\n id = \"#{name}-#{version}\"\n\n # Already know this package from another target\n next if dependencies.key?(id)\n\n path = File.join(nuget_packages_dir, json[\"libraries\"][reference_key][\"path\"])\n dependencies[id] = NuGetDependency.new(\n name: id,\n version: version,\n path: path,\n metadata: {\n \"type\" => NuGet.type,\n \"name\" => name\n }\n )\n end\n end.values\n end", "def dependency_graph\n Hash[fragments.map { |f| [f.name, f.required_fragments] }]\n end", "def resolve_args(args)\n if args.last.is_a?(Hash)\n deps = args.pop\n resolve_args_with_dependencies(args, deps)\n else\n resolve_args_without_dependencies(args)\n end\n end", "def computeDependences(list)\n dependences = OCMSet.new\n\n OCMSet::SECTIONS.each do |section|\n @require[section].each do |req|\n found = false\n\n list.each do |iface|\n for context in iface.provide do\n if context[section].include?(req) then\n dependences[section] << iface\n found = true\n break\n end\n end\n end\n\n raise \"#{@id.name}: no dependence found for #{req.name}.\" unless found\n end\n end\n\n return dependences.values.flatten.uniq\n end", "def cached_dependencies\n @dependencies ||= enumerate_dependencies.compact\n end", "def resolve!\n @schemas.map(&:resolve!)\n end", "def child_dependencies\n @children\n end", "def dependencies\n @dependencies.values\n end", "def update_relationship_graph(resources)\n rel_graph = catalog.relationship_graph\n inserted_edges = []\n resources.map {|res| res.builddepends}.flatten.each do |dep|\n unless !!rel_graph.edge?(dep.source, dep.target)\n rel_graph.add_edge dep\n inserted_edges << dep\n end\n end\n\n begin\n rel_graph.report_cycles_in_graph\n rescue Puppet::Error => err\n debug 'There are cycles in graph (see error below). Need to remove recently added edges'\n inserted_edges.each {|edge| rel_graph.remove_edge! edge }\n raise\n end\n end", "def preload_dependencies\n deps = {}\n\n associations.merge(referenced_associations).each do |assoc_name, reference|\n association_data = self.viewmodel_class._association_data(assoc_name)\n\n preload_specs = build_preload_specs(association_data,\n to_sequence(assoc_name, reference))\n\n referenced_deps = merge_preload_specs(association_data, preload_specs)\n\n if association_data.through?\n referenced_deps = DeepPreloader::Spec.new(association_data.indirect_reflection.name.to_s => referenced_deps)\n end\n\n deps[association_data.direct_reflection.name.to_s] = referenced_deps\n end\n\n DeepPreloader::Spec.new(deps)\n end", "def dependencies\n self.class.dependencies\n end", "def verify_dependencies\n missing_frags = {}\n dependency_graph.each do |fragment, dependencies|\n missing = dependencies.to_set - dependency_graph.keys.to_set\n next unless missing.size > 0\n missing_frags[fragment] = missing.to_a\n end\n\n _fail_because_missing(missing_frags) if missing_frags.size > 0\n end", "def process\n self.sources = sources.uniq.delete_if { |e| e.empty? }\n self.dependencies = dependencies.uniq.delete_if { |e| e.empty? }\n self.graph = DirectedGraph.new sources, dependencies\n result = DepthFirstSearch.dfs graph\n loops = NaturalLoops.find graph, result[:back_edges]\n raise CircularDependencyError.new(loops) unless loops.empty?\n result[:sorted]\n end", "def resolve_reference; end", "def dependencies\n manager.dependencies\n end", "def local_deps\n @local_deps ||= build_local_dependency_list\n end", "def compute_revdeps\n result = Hash.new { |h, k| h[k] = Set.new }\n each_autobuild_package do |pkg|\n pkg.dependencies.each do |pkg_name|\n result[pkg_name] << pkg.name\n end\n pkg.optional_dependencies.each do |pkg_name|\n result[pkg_name] << pkg.name\n end\n pkg.os_packages.each do |pkg_name|\n result[pkg_name] << pkg.name\n end\n end\n result\n end", "def find_dependencies(source, graph, reverse)\n if reverse\n UI.puts \"What depends on #{source}?\"\n graph = graph.reverse\n else\n UI.puts \"What does #{source} depend on?\"\n end\n\n tree = graph.bfs_search_tree_from(source)\n graph = graph.vertices_filtered_by { |v| tree.has_vertex? v }\n sorted_dependencies = graph.vertices.sort\n sorted_dependencies.delete(source)\n\n if sorted_dependencies.empty?\n UI.puts 'Nothing'\n else\n sorted_dependencies.each { |dependency| UI.puts dependency }\n end\n\n File.open(@to_yaml, 'w') { |file| file.write(sorted_dependencies.to_s) } if @to_yaml\n File.open(@to_dot, 'w') { |file| file.write(graph.to_dot_graph.to_s) } if @to_dot\n end", "def diffeq_depends_on()\n unless @diffeq_deps\n my_deps = depends_on # calculate @depends_on\n\n d1_name = Variable.derivative_of_name(@name)\n my_d1 = @parent.variable_by_name(d1_name)\n d1_deps = my_d1.depends_on\n\n @diffeq_deps = my_deps | d1_deps\n end\n @diffeq_deps\n end", "def each_dependency(&block)\n return dependencies_enumerator if block.nil?\n\n dependencies_enumerator.each(&block)\n end" ]
[ "0.67540306", "0.66126996", "0.6474788", "0.6327091", "0.61840016", "0.6135421", "0.60516834", "0.5962147", "0.59418637", "0.58821917", "0.5776535", "0.5746366", "0.57427555", "0.5706056", "0.56946623", "0.5679514", "0.5653791", "0.5596924", "0.5549896", "0.5549744", "0.5546066", "0.55403376", "0.55298257", "0.5526261", "0.5523593", "0.54813915", "0.5461569", "0.5458083", "0.5458083", "0.5458083", "0.54549056", "0.54390055", "0.54337156", "0.54122424", "0.54055", "0.540473", "0.53933", "0.5392595", "0.537792", "0.537792", "0.537792", "0.5372122", "0.53683984", "0.53683984", "0.53683984", "0.53683984", "0.53536195", "0.5341207", "0.5334424", "0.5324805", "0.5323539", "0.5317806", "0.5317806", "0.5316213", "0.5310482", "0.5295663", "0.52902186", "0.5290043", "0.52773017", "0.52714366", "0.52697116", "0.52651167", "0.5261941", "0.5258605", "0.52531505", "0.5249552", "0.52473676", "0.5246846", "0.5243989", "0.5241355", "0.5240822", "0.52349263", "0.5226327", "0.52138215", "0.52120686", "0.5209874", "0.520916", "0.5204655", "0.5204261", "0.5202172", "0.5196476", "0.5196002", "0.51931953", "0.5188184", "0.5184476", "0.51841044", "0.51737046", "0.51698345", "0.5154252", "0.5151785", "0.51509774", "0.514823", "0.51442987", "0.514352", "0.5138943", "0.5137686", "0.5133653", "0.5128655", "0.5125869", "0.5104229" ]
0.65449315
2
Check if two interfaces are equal.
def overlap?(i) for context in @provide do c = i.provide.find { |o| o.name == context.name } return true if c != nil && context.overlap?(c) end return false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ==(other)\n ffi_delegate.eq(other.ffi_delegate)\n end", "def equal?(other); end", "def ==(other)\n raise NotImplementedError\n end", "def ==(other)\n if other.nil?\n false\n else\n @public_ip == other.public_ip &&\n @public_port == other.public_port &&\n @private_ip == other.private_ip &&\n @private_port == other.private_port\n end\n end", "def eql?(other)\n @type.eql?(other.type) &&\n @destination.eql?(other.destination) &&\n @tag.eql?(other.tag) &&\n @data.eql?(other.data) &&\n @timeout.eql?(other.timeout)\n end", "def identical?( src, dst )\n source = IO.read(src)\n destination = IO.read(dst)\n source == destination\n end", "def eql?(other)\n return true if equal? other\n return false unless other.instance_of? self.class\n\n @ini == other.instance_variable_get(:@ini)\n end", "def eql?(other)\n items == other.items\n end", "def eql?(other) self.class == other.class and target==other.target and source==other.source; end", "def eql?(other) self.class == other.class and target==other.target and source==other.source; end", "def eql?( other )\n return true if equal? other\n return false unless other.instance_of? self.class\n @ini == other.instance_variable_get(:@ini)\n end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def eql?(other)\n return false if (other.nil? or self.class != other.class)\n ova = other.instance_variables\n iv = instance_variables\n return false if ova.size != iv.size\n iv.each do |vid|\n return false if instance_variable_get(vid) != other.instance_variable_get(vid)\n end\n true\n end", "def test_interface_apis\n intf = interfaces[0]\n intf2 = interfaces[1]\n\n # Verify show_name usage\n one = InterfaceChannelGroup.interfaces(intf)\n assert_equal(1, one.length,\n 'Invalid number of keys returned, should be 1')\n assert_equal(Utils.normalize_intf_pattern(intf), one[intf].show_name,\n ':show_name should be intf name when show_name param specified')\n\n # Verify 'all' interfaces\n all = InterfaceChannelGroup.interfaces\n assert_operator(all.length, :>, 1,\n 'Invalid number of keys returned, should exceed 1')\n assert_empty(all[intf2].show_name,\n ':show_name should be empty string when show_name param is nil')\n\n # Test non-existent loopback does NOT raise when calling interfaces\n Interface.new('loopback543', false).destroy if\n Interface.interfaces(nil, 'loopback543').any?\n one = InterfaceChannelGroup.interfaces('loopback543')\n assert_empty(one, 'InterfaceChannelGroup.interfaces hash should be empty')\n end", "def eql?(other); end", "def eql?(other); end", "def eql?(other); end", "def eql?(other); end", "def eql?(other); end", "def eql?(other); end", "def eql?(other); end", "def conforms_to?(interface)\n # interface must be an Interface\n raise InterfaceError, \"#{interface} is not an Interface\" unless interface < Interface\n interface.abstract_methods.all? { |method| self.respond_to?(method) }\n end", "def eql?(other)\n return false\n end", "def eql?(other)\n self.class.eql?(other.class) && adapter == other.adapter\n end", "def eql?(other)\n instance_of?(other.class) && name == other.name && imports == other.imports\n end", "def EQUAL?(other)\n @it.equal?(other) && other.equal?(@it) && @it.__id__.equal?(other.__id__)\n end", "def ==(other); false; end", "def eql?(other)\n return false unless other.kind_of?(OpenStruct)\n @table.eql?(other.table)\n end", "def ==(other)\n end", "def ==(other)\n if equal?(other)\n return true\n end\n\n unless [ :repository, :model, :fields, :links, :conditions, :order, :offset, :limit, :reload?, :unique?, :add_reversed? ].all? { |method| other.respond_to?(method) }\n return false\n end\n\n cmp?(other, :==)\n end", "def ==(other)\n r = true\n [:url, :supported_versions, :salt, :version, :debug].each do |param|\n r = r && self.send(param) == other.send(param)\n end\n r\n end", "def ==(other)\n r = true\n [:url, :supported_versions, :salt, :version, :debug].each do |param|\n r = r && self.send(param) == other.send(param)\n end\n r\n end", "def eql?(other)\n return false unless other.captures_hash == captures_hash\n return false unless other.squares_hash == squares_hash\n return false unless other.turn == turn\n return false unless other.state == state\n\n true\n end", "def ==(other)\n @bits == other.bits\n end", "def eql?(other)\n return false unless self.class.eql?(other.class)\n instance_variables.map do |var|\n instance_variable_get(var).eql?(other.instance_variable_get(var))\n end.all?\n end", "def ==(other)\n (compare_fields(@allowed_fields,other.allowed_fields) &&\n compare_fields(@required_fields,other.required_fields) &&\n compare_fields(@read_mask,other.read_mask) &&\n compare_fields(@write_mask,other.write_mask)) rescue false\n end", "def ==(other)\n self.base.to_si.eql? other.base.to_si\n end", "def eql?(other)\n\n end", "def eql?(other)\n return false unless(other.kind_of?(__class__))\n return @table == other.table #to_h\n end", "def ==(other)\n @x == other.x && @y == other.y\n rescue NoMethodError\n false\n end", "def ==(other)\n eql?(other)\n end", "def eql?(other)\n return (affinity_group.eql?(other.affinity_group) &&\n address_space.sort.eql?(other.address_space.sort) &&\n dns_servers.sort_by { |s| s[:ip_address] }.eql?(\n other.dns_servers.sort_by { |s| s[:ip_address] }) &&\n subnets.sort_by { |s| [s[:ip_address, s[:cidr]]]}.eql?(\n other.subnets.sort_by { |s| [s[:ip_address, s[:cidr]]] }))\n end", "def ==(other)\n eql?(other)\n end", "def ==(other)\n eql?(other)\n end", "def eql?(other)\n other.is_a?(JiakSchema) &&\n compare_fields(@allowed_fields,other.allowed_fields) &&\n compare_fields(@required_fields,other.required_fields) &&\n compare_fields(@read_mask,other.read_mask) &&\n compare_fields(@write_mask,other.write_mask)\n end", "def == other\n if other.respond_to? :headings and other.respond_to? :rows\n headings == other.headings and rows == other.rows\n end\n end", "def eql?(other)\n return false unless other.class == self.class\n\n return identity == other.identity &&\n attributes == other.attributes &&\n session == other.session\n end", "def eql?(*) end", "def ==(other)\n return false unless other.kind_of?(OpenStruct)\n @table == other.table\n end", "def eql?(other) #:nodoc:\n return self == other\n end", "def ==(other)\n self.begin == other.begin && self.end == other.end\n rescue NoMethodError\n false\n end", "def eql?(p0) end", "def eql?(p0) end", "def eql?(p0) end", "def eql?(p0) end", "def eql?(p0) end", "def eql?(p0) end", "def eql?(p0) end", "def eql?(other)\n return self == other\n end", "def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n apm_scanned_bytes == o.apm_scanned_bytes &&\n events_scanned_bytes == o.events_scanned_bytes &&\n hour == o.hour &&\n logs_scanned_bytes == o.logs_scanned_bytes &&\n org_name == o.org_name &&\n public_id == o.public_id &&\n rum_scanned_bytes == o.rum_scanned_bytes &&\n total_scanned_bytes == o.total_scanned_bytes\n end", "def test_identical\n x = IntegerRange.new(1, 5)\n y = IntegerRange.new(1, 5)\n\n assert_equal(x.mergeable?(y), true)\n assert_equal(y.mergeable?(x), true)\n end", "def ==(other)\n (@jiak.object == other.jiak.object) rescue false\n end", "def eql?(other)\n self == (other)\n end", "def ==(other)\n return false unless(other.kind_of?(OpenStruct))\n return @__table__ == other.table\n end", "def eql?(other)\n super\n end", "def eql?(other)\n super\n end", "def IS?(other, bidirectional: true)\n (@it == other) && (bidirectional ? (other == @it) : true)\n end", "def ==(other)\n eql?(other)\n end", "def ==(other)\n if other&.respond_to?(:to_h)\n to_h == other.to_h\n elsif other.respond_to?(:to_hash)\n to_h == other.to_hash\n else\n false\n end\n end", "def eql?(other)\n self.class === other and @version == other.version\n end", "def ==(other)\n return false unless other.is_a? Base\n (other.uuids & uuids).any?\n end", "def ==(other)\n (compare(other) & CMP_IMAGE).zero?\n end", "def equal?(other)\n return false unless type == other.type\n return false unless power == other.power\n return false unless prefix == other.prefix\n return true\n end", "def eql?(other)\n @dependencies == other.dependencies && @run_list == other.run_list\n end", "def eql?(other)\r\n\t\treturn hash == other.hash\r\n\tend", "def equal?(o)\n eql?(o)\n end", "def eql?(other)\n return false unless other.is_a?(RandomReadable)\n return super(other) unless has_size?\n\n begin\n return false if other.size != size\n rescue NotImplementedError\n return false\n end\n\n each_index do |i|\n return false unless at(i).eql?(other.at(i))\n end\n\n return true\n end", "def == other\n return true if equal?(other) # save some time\n return false unless other.respond_to?(:to_a)\n e1s = to_a\n e2s = other.to_a\n e1s.size == e2s.size && e1s.all? { |e1| e2s.include? e1 }\n end", "def eql?(other)\n self.class == other.class and self == other\n end" ]
[ "0.63228333", "0.6239595", "0.6215505", "0.61655223", "0.6133544", "0.60267496", "0.5994666", "0.5994325", "0.59836864", "0.59836864", "0.59762025", "0.5962433", "0.5962433", "0.5962433", "0.5962433", "0.5962433", "0.5962433", "0.5962433", "0.5962433", "0.5962433", "0.5962433", "0.5962433", "0.5962433", "0.5962433", "0.5962433", "0.5962433", "0.5962433", "0.5962433", "0.5962433", "0.5962433", "0.5962433", "0.5962433", "0.5962433", "0.5962433", "0.59405017", "0.5936993", "0.5932452", "0.5932452", "0.5932452", "0.5932452", "0.5932452", "0.5932452", "0.5932452", "0.5921803", "0.59124666", "0.58906543", "0.5868939", "0.58611405", "0.5834608", "0.58325016", "0.582927", "0.58223593", "0.58216083", "0.58216083", "0.5819098", "0.58048415", "0.5797168", "0.5789448", "0.577792", "0.576771", "0.5765724", "0.57618487", "0.5754464", "0.5742927", "0.57324535", "0.57324535", "0.57247037", "0.5723946", "0.571593", "0.5713661", "0.5708709", "0.5704019", "0.5696275", "0.5681432", "0.5681432", "0.5681432", "0.5680761", "0.5680761", "0.5680761", "0.5680761", "0.56778973", "0.5668944", "0.5663956", "0.5656049", "0.5655511", "0.56551313", "0.56498474", "0.56498474", "0.56485385", "0.56475455", "0.5642721", "0.563637", "0.56362766", "0.5636164", "0.5631547", "0.563111", "0.562914", "0.56225723", "0.56223595", "0.56196606", "0.56187963" ]
0.0
-1
Check if two interfaces are equal.
def eql?(i) return false if i == nil return @id == i.id end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ==(other)\n ffi_delegate.eq(other.ffi_delegate)\n end", "def equal?(other); end", "def ==(other)\n raise NotImplementedError\n end", "def ==(other)\n if other.nil?\n false\n else\n @public_ip == other.public_ip &&\n @public_port == other.public_port &&\n @private_ip == other.private_ip &&\n @private_port == other.private_port\n end\n end", "def eql?(other)\n @type.eql?(other.type) &&\n @destination.eql?(other.destination) &&\n @tag.eql?(other.tag) &&\n @data.eql?(other.data) &&\n @timeout.eql?(other.timeout)\n end", "def identical?( src, dst )\n source = IO.read(src)\n destination = IO.read(dst)\n source == destination\n end", "def eql?(other)\n return true if equal? other\n return false unless other.instance_of? self.class\n\n @ini == other.instance_variable_get(:@ini)\n end", "def eql?(other)\n items == other.items\n end", "def eql?(other) self.class == other.class and target==other.target and source==other.source; end", "def eql?(other) self.class == other.class and target==other.target and source==other.source; end", "def eql?( other )\n return true if equal? other\n return false unless other.instance_of? self.class\n @ini == other.instance_variable_get(:@ini)\n end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def eql?(other)\n return false if (other.nil? or self.class != other.class)\n ova = other.instance_variables\n iv = instance_variables\n return false if ova.size != iv.size\n iv.each do |vid|\n return false if instance_variable_get(vid) != other.instance_variable_get(vid)\n end\n true\n end", "def test_interface_apis\n intf = interfaces[0]\n intf2 = interfaces[1]\n\n # Verify show_name usage\n one = InterfaceChannelGroup.interfaces(intf)\n assert_equal(1, one.length,\n 'Invalid number of keys returned, should be 1')\n assert_equal(Utils.normalize_intf_pattern(intf), one[intf].show_name,\n ':show_name should be intf name when show_name param specified')\n\n # Verify 'all' interfaces\n all = InterfaceChannelGroup.interfaces\n assert_operator(all.length, :>, 1,\n 'Invalid number of keys returned, should exceed 1')\n assert_empty(all[intf2].show_name,\n ':show_name should be empty string when show_name param is nil')\n\n # Test non-existent loopback does NOT raise when calling interfaces\n Interface.new('loopback543', false).destroy if\n Interface.interfaces(nil, 'loopback543').any?\n one = InterfaceChannelGroup.interfaces('loopback543')\n assert_empty(one, 'InterfaceChannelGroup.interfaces hash should be empty')\n end", "def eql?(other); end", "def eql?(other); end", "def eql?(other); end", "def eql?(other); end", "def eql?(other); end", "def eql?(other); end", "def eql?(other); end", "def conforms_to?(interface)\n # interface must be an Interface\n raise InterfaceError, \"#{interface} is not an Interface\" unless interface < Interface\n interface.abstract_methods.all? { |method| self.respond_to?(method) }\n end", "def eql?(other)\n return false\n end", "def eql?(other)\n self.class.eql?(other.class) && adapter == other.adapter\n end", "def eql?(other)\n instance_of?(other.class) && name == other.name && imports == other.imports\n end", "def EQUAL?(other)\n @it.equal?(other) && other.equal?(@it) && @it.__id__.equal?(other.__id__)\n end", "def ==(other); false; end", "def eql?(other)\n return false unless other.kind_of?(OpenStruct)\n @table.eql?(other.table)\n end", "def ==(other)\n end", "def ==(other)\n if equal?(other)\n return true\n end\n\n unless [ :repository, :model, :fields, :links, :conditions, :order, :offset, :limit, :reload?, :unique?, :add_reversed? ].all? { |method| other.respond_to?(method) }\n return false\n end\n\n cmp?(other, :==)\n end", "def ==(other)\n r = true\n [:url, :supported_versions, :salt, :version, :debug].each do |param|\n r = r && self.send(param) == other.send(param)\n end\n r\n end", "def ==(other)\n r = true\n [:url, :supported_versions, :salt, :version, :debug].each do |param|\n r = r && self.send(param) == other.send(param)\n end\n r\n end", "def eql?(other)\n return false unless other.captures_hash == captures_hash\n return false unless other.squares_hash == squares_hash\n return false unless other.turn == turn\n return false unless other.state == state\n\n true\n end", "def ==(other)\n @bits == other.bits\n end", "def eql?(other)\n return false unless self.class.eql?(other.class)\n instance_variables.map do |var|\n instance_variable_get(var).eql?(other.instance_variable_get(var))\n end.all?\n end", "def ==(other)\n (compare_fields(@allowed_fields,other.allowed_fields) &&\n compare_fields(@required_fields,other.required_fields) &&\n compare_fields(@read_mask,other.read_mask) &&\n compare_fields(@write_mask,other.write_mask)) rescue false\n end", "def ==(other)\n self.base.to_si.eql? other.base.to_si\n end", "def eql?(other)\n\n end", "def eql?(other)\n return false unless(other.kind_of?(__class__))\n return @table == other.table #to_h\n end", "def ==(other)\n @x == other.x && @y == other.y\n rescue NoMethodError\n false\n end", "def ==(other)\n eql?(other)\n end", "def eql?(other)\n return (affinity_group.eql?(other.affinity_group) &&\n address_space.sort.eql?(other.address_space.sort) &&\n dns_servers.sort_by { |s| s[:ip_address] }.eql?(\n other.dns_servers.sort_by { |s| s[:ip_address] }) &&\n subnets.sort_by { |s| [s[:ip_address, s[:cidr]]]}.eql?(\n other.subnets.sort_by { |s| [s[:ip_address, s[:cidr]]] }))\n end", "def ==(other)\n eql?(other)\n end", "def ==(other)\n eql?(other)\n end", "def eql?(other)\n other.is_a?(JiakSchema) &&\n compare_fields(@allowed_fields,other.allowed_fields) &&\n compare_fields(@required_fields,other.required_fields) &&\n compare_fields(@read_mask,other.read_mask) &&\n compare_fields(@write_mask,other.write_mask)\n end", "def == other\n if other.respond_to? :headings and other.respond_to? :rows\n headings == other.headings and rows == other.rows\n end\n end", "def eql?(other)\n return false unless other.class == self.class\n\n return identity == other.identity &&\n attributes == other.attributes &&\n session == other.session\n end", "def eql?(*) end", "def ==(other)\n return false unless other.kind_of?(OpenStruct)\n @table == other.table\n end", "def eql?(other) #:nodoc:\n return self == other\n end", "def ==(other)\n self.begin == other.begin && self.end == other.end\n rescue NoMethodError\n false\n end", "def eql?(p0) end", "def eql?(p0) end", "def eql?(p0) end", "def eql?(p0) end", "def eql?(p0) end", "def eql?(p0) end", "def eql?(p0) end", "def eql?(other)\n return self == other\n end", "def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n apm_scanned_bytes == o.apm_scanned_bytes &&\n events_scanned_bytes == o.events_scanned_bytes &&\n hour == o.hour &&\n logs_scanned_bytes == o.logs_scanned_bytes &&\n org_name == o.org_name &&\n public_id == o.public_id &&\n rum_scanned_bytes == o.rum_scanned_bytes &&\n total_scanned_bytes == o.total_scanned_bytes\n end", "def test_identical\n x = IntegerRange.new(1, 5)\n y = IntegerRange.new(1, 5)\n\n assert_equal(x.mergeable?(y), true)\n assert_equal(y.mergeable?(x), true)\n end", "def ==(other)\n (@jiak.object == other.jiak.object) rescue false\n end", "def eql?(other)\n self == (other)\n end", "def ==(other)\n return false unless(other.kind_of?(OpenStruct))\n return @__table__ == other.table\n end", "def eql?(other)\n super\n end", "def eql?(other)\n super\n end", "def IS?(other, bidirectional: true)\n (@it == other) && (bidirectional ? (other == @it) : true)\n end", "def ==(other)\n eql?(other)\n end", "def ==(other)\n if other&.respond_to?(:to_h)\n to_h == other.to_h\n elsif other.respond_to?(:to_hash)\n to_h == other.to_hash\n else\n false\n end\n end", "def eql?(other)\n self.class === other and @version == other.version\n end", "def ==(other)\n return false unless other.is_a? Base\n (other.uuids & uuids).any?\n end", "def ==(other)\n (compare(other) & CMP_IMAGE).zero?\n end", "def equal?(other)\n return false unless type == other.type\n return false unless power == other.power\n return false unless prefix == other.prefix\n return true\n end", "def eql?(other)\n @dependencies == other.dependencies && @run_list == other.run_list\n end", "def eql?(other)\r\n\t\treturn hash == other.hash\r\n\tend", "def equal?(o)\n eql?(o)\n end", "def eql?(other)\n return false unless other.is_a?(RandomReadable)\n return super(other) unless has_size?\n\n begin\n return false if other.size != size\n rescue NotImplementedError\n return false\n end\n\n each_index do |i|\n return false unless at(i).eql?(other.at(i))\n end\n\n return true\n end", "def == other\n return true if equal?(other) # save some time\n return false unless other.respond_to?(:to_a)\n e1s = to_a\n e2s = other.to_a\n e1s.size == e2s.size && e1s.all? { |e1| e2s.include? e1 }\n end", "def eql?(other)\n self.class == other.class and self == other\n end" ]
[ "0.63228333", "0.6239595", "0.6215505", "0.61655223", "0.6133544", "0.60267496", "0.5994666", "0.5994325", "0.59836864", "0.59836864", "0.59762025", "0.5962433", "0.5962433", "0.5962433", "0.5962433", "0.5962433", "0.5962433", "0.5962433", "0.5962433", "0.5962433", "0.5962433", "0.5962433", "0.5962433", "0.5962433", "0.5962433", "0.5962433", "0.5962433", "0.5962433", "0.5962433", "0.5962433", "0.5962433", "0.5962433", "0.5962433", "0.5962433", "0.59405017", "0.5936993", "0.5932452", "0.5932452", "0.5932452", "0.5932452", "0.5932452", "0.5932452", "0.5932452", "0.5921803", "0.59124666", "0.58906543", "0.5868939", "0.58611405", "0.5834608", "0.58325016", "0.582927", "0.58223593", "0.58216083", "0.58216083", "0.5819098", "0.58048415", "0.5797168", "0.5789448", "0.577792", "0.576771", "0.5765724", "0.57618487", "0.5754464", "0.5742927", "0.57324535", "0.57324535", "0.57247037", "0.5723946", "0.571593", "0.5713661", "0.5708709", "0.5704019", "0.5696275", "0.5681432", "0.5681432", "0.5681432", "0.5680761", "0.5680761", "0.5680761", "0.5680761", "0.56778973", "0.5668944", "0.5663956", "0.5656049", "0.5655511", "0.56551313", "0.56498474", "0.56498474", "0.56485385", "0.56475455", "0.5642721", "0.563637", "0.56362766", "0.5636164", "0.5631547", "0.563111", "0.562914", "0.56225723", "0.56223595", "0.56196606", "0.56187963" ]
0.0
-1
Return the interface's hash value.
def hash return @id.hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash\n @hash || calculate_hash!\n end", "def hash\n 0\n end", "def hash\n @hash || @hash = (value.hash * -1)\n end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash\n @hash ||= begin\n result = 17\n result = 31 * result + self.class.hash\n result = 31 * result + ord\n result.is_a?(Fixnum) ? result : result.hash\n end\n end", "def hash\n @hash ||= begin\n result = 17\n result = 31 * result + self.class.hash\n result = 31 * result + ord\n result.is_a?(Fixnum) ? result : result.hash\n end\n end", "def hash\n\n self.h.fei.hash\n end", "def hash\n type.hash ^ (id.hash >> 1)\n end", "def hash\n shasum.hash\n end", "def hash\n shasum.hash\n end", "def hash\n shasum.hash\n end", "def hash #:nodoc:\n __getobj__.hash ^ self.class.hash\n end", "def hash\n bytes.hash\n end", "def hash_code; end", "def hash\n @hash\n end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash()\n #This is a stub, used for indexing\n end", "def hash\n value.hash\n end", "def hash\n @value.hash\n end", "def hash\n value_id.hash\n end", "def hash\n @vbits.hash\n end", "def hash(*) end", "def hash_id\n @hid\n end", "def hash\n raise NotImplementedError.new(\"hash() must be implemented by subclasses of AbstractVersionedFile.\")\n end", "def hash\n return super unless has_size?\n\n res = 0\n each do |el|\n res += el.hash\n end\n return res\n end", "def hash\n guid.hash\n end", "def hash\n return @hash_code if defined? @hash_code\n @hash_code = usual_equal_object.hash\n end", "def hash\n @hash.hash\n end", "def hash\n\t\tvalue.hash\n\tend", "def hash\r\n id.hash\r\n end", "def registry_interface_hash\n hash = calculate_interface_hash(\n [\n {\n name: 'bind',\n descriptor: '(Ljava/lang/String;Ljava/rmi/Remote;)V',\n exceptions: ['java.rmi.AccessException', 'java.rmi.AlreadyBoundException', 'java.rmi.RemoteException']\n },\n {\n name: 'list',\n descriptor: '()[Ljava/lang/String;',\n exceptions: ['java.rmi.AccessException', 'java.rmi.RemoteException']\n },\n {\n name: 'lookup',\n descriptor: '(Ljava/lang/String;)Ljava/rmi/Remote;',\n exceptions: ['java.rmi.AccessException', 'java.rmi.NotBoundException', 'java.rmi.RemoteException']\n },\n {\n name: 'rebind',\n descriptor: '(Ljava/lang/String;Ljava/rmi/Remote;)V',\n exceptions: ['java.rmi.AccessException', 'java.rmi.RemoteException']\n },\n {\n name: 'unbind',\n descriptor: '(Ljava/lang/String;)V',\n exceptions: ['java.rmi.AccessException', 'java.rmi.NotBoundException', 'java.rmi.RemoteException']\n }\n ]\n )\n\n hash\n end", "def hash\n @hash ||= self.to_a.hash\n end", "def hash\n return to_s.hash\n end", "def hash\r\n return to_s.hash\r\n end", "def hash\n self.state.hash\n end", "def hash\n @id.hash\n end", "def hash\n name.hash ^ version.hash\n end", "def hash\n h = @e.nil? ? 0 : @e\n h = (h << 1) ^ @r.hash\n h = (h << 1) ^ @v.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n end", "def hash\n end", "def hash\n end", "def hash_key\n send(self.class.hash_key)\n end", "def hash_key\n send(self.class.hash_key)\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n to_h.hash ^ self.class.hash\n end", "def hash\n state.hash\n end", "def hash\n state.hash\n end", "def hash\n id.hash\n end", "def hash\n self.to_f.hash\n end", "def hash\n [value].hash\n end", "def hash\n [value].hash\n end", "def hash\n if @sha512hash != nil\n return @sha512hash.to_i(16)\n else\n super\n end\n end", "def __hash\n @hash\n end", "def get_hash()\n return @@hash;\n end", "def hash\n element.hash\n end", "def hash(key); end", "def digest_hash_function\n decode[:hash_function]\n end", "def hash\n \"#{@ipv4}#{@port}\".hash\n end", "def hash\n self.class.hash ^ @ns.hash\n end", "def hash\r\n @_hash ||= _hash\r\n end", "def sha\n result_hash['sha']\n end", "def hash\n self.class.name.hash ^ @key.hash\n end", "def hash\n @id\n end", "def hash\n size.hash ^ rank.hash\n end", "def hash\n @string.hash\n end", "def hash\n @string.hash\n end", "def hash\n @string.hash\n end", "def hexhash\n hash.to_s(16)\n end", "def hash\n prime = 31\n result = 1\n result = result * prime + (@decision_target == nil ? 0 : @decision_target.hash)\n result = prime * result + (@string_id == nil ? 0 : @string_id.hash)\n result\n end", "def hash\n offset.hash\n end", "def hash\n return Digest::MD5.hexdigest(self.describe(' '))\n end", "def get_hash(input)\n return $hasher.reset.update(input).to_s\nend", "def hash #:nodoc:\n uuid.hash\n end", "def hash\n name.hash ^ provider.hash\n end" ]
[ "0.73472756", "0.7337885", "0.7337465", "0.7330194", "0.7330194", "0.7330194", "0.7330194", "0.7330194", "0.7330194", "0.7330194", "0.728836", "0.728836", "0.72585124", "0.7183493", "0.7151624", "0.7151624", "0.7151624", "0.7147535", "0.71262664", "0.70878905", "0.707234", "0.7038544", "0.7038544", "0.7038544", "0.7038544", "0.7038544", "0.7038544", "0.7038544", "0.7038544", "0.7038544", "0.7038544", "0.70257866", "0.70185053", "0.69644004", "0.6935599", "0.69249535", "0.6923039", "0.69045883", "0.6898136", "0.68947643", "0.6886278", "0.6867861", "0.6841225", "0.6824323", "0.68232054", "0.6818745", "0.6810033", "0.6767119", "0.6766182", "0.6756668", "0.67520624", "0.67443913", "0.6743576", "0.6743053", "0.67421806", "0.67421806", "0.67421806", "0.67421806", "0.67421806", "0.67421806", "0.67421806", "0.67421806", "0.67421806", "0.67243665", "0.67243665", "0.67243665", "0.6717814", "0.6717814", "0.6715542", "0.6715542", "0.67075926", "0.6706852", "0.6706852", "0.6671259", "0.6661158", "0.66324735", "0.66324735", "0.662308", "0.66124797", "0.66027755", "0.6589518", "0.6579095", "0.65789294", "0.65764403", "0.6565642", "0.6564996", "0.6544552", "0.653959", "0.65356827", "0.6535637", "0.6533957", "0.6533957", "0.6533957", "0.6526368", "0.6508517", "0.6501528", "0.6500944", "0.6495044", "0.64948744", "0.6492002" ]
0.68240327
44
Display the interface in the terminal.
def display puts ("[" + @id.name + ", " + @id.version + "]").green.bold puts "author = ".blue + @author print "wrapper = ".blue + @wrapper.to_s puts ", unique = ".blue + @unique.to_s puts puts "[Path:]".green.bold puts @path # # Display the provided elements # puts "\n[Provide]".green.bold @provide.each do |context| puts "\n<Context #{context.name}>".blue.bold OCMSet::SECTIONS.each { |section| context[section].each { |k| puts k } } end # # Display the required elements # if @require != nil then puts "\n[Require]".green.bold OCMSet::SECTIONS.each { |section| @require[section].each { |k| puts k } } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display\n if command\n write_green \"\\t#{hname}\"\n command && write_cyan(\"\\t vite-faits #{command}\")\n end\n # TODO Quand on pourra sortir une version HTML, on pourra mettre\n # un lien vers le mode d'emploi.\n # manuel && puts(\"\\t Ancre manuel : ##{manuel}\")\n end", "def show\n IRuby.display(self)\n end", "def display\n puts self\n end", "def display_main_menu\n puts '################################'\n puts '# {N}- Network Stuff #'\n puts '# {RF}- Read File #'\n # puts '# {GF}- Generate File #'\n # puts '# {D}- Run as Daemon #'\n # puts '# {TD}- Run as Trigger Daemon #'\n puts '# {Q}- Quit #'\n puts '################################'\nend", "def displaymenu # Console only\r\n\t\t @output.puts \"Menu: (1) Play | (2) New | (3) Analysis | (9) Exit\"\r\n\t\t end", "def display(screen)\n\n end", "def setup_terminal\n # Setup the terminal for the TUI.\n # '\\e[?1049h': Use alternative screen buffer. smcup\n # '\\e[?7l': Disable line wrapping.\n # '\\e[?25l': Hide the cursor.\n # '\\e[2J': Clear the screen.\n # '\\e[1;Nr': Limit scrolling to scrolling area.\n # Also sets cursor to (0,0).\n # printf(\"\\e[?1049h\\e[?7l\\e[?25l\\e[2J\\e[1;%sr\", @glines)\n # 2019-03-29 - XXX temporarily not hiding cursor to see if we can place it.\n printf(\"\\e[?1049h\\e[?7l\\e[?25h\\e[2J\\e[1;%sr\", @glines)\n # earlier glines was grows\n\n # Hide echoing of user input\n system 'stty -echo'\nend", "def shownext\n if @session.current_screen and @session.current_screen.stdin\n display @session.current_screen\n @session.next\n else\n print Paint[\"... \", :cyan]\n @playprompt = false\n @lastelapsed = 0\n end\nend", "def print(*args)\n @interface.print(*args)\n end", "def print(*args)\n @interface.print(*args)\n end", "def display(str, reprompt=true)\n @client.display(str)\n prompt if reprompt\n end", "def display\n system('clear')\n border\n puts table\n border\n end", "def display(port=$>) end", "def screen\n require 'tty-screen'\n TTY::Screen\n end", "def home_screen\n system 'clear'\n @artii = Artii::Base.new\n @artii2 = Artii::Base.new font: 'slant'\n\n @ascii_home = <<-'EOF'\n __\n _..-''--'----_.\n ,''.-''| .---/ _`-._\n ,' \\ \\ ;| | ,/ / `-._`-.\n ,' ,',\\ \\( | |// /,-._ / /\n ;.`. `,\\ \\`| |/ / | )/ /\n / /`_`.\\_\\ \\| /_.-.'-''/ /\n / /_|_:.`. \\ |;'`..') / /\n `-._`-._`.`.;`.\\ ,' / /\n `-._`.`/ ,'-._/ /\n : `-/ \\`-.._/\n | : ;._ (\n : | \\ ` \\\n \\ \\ |\n : : ;\n | /\n ; ,'\n / /\n / /\n /\n EOF\n puts @ascii_home\n puts '-----------------------------------------------------------------------------'.light_red\n puts @artii.asciify(\"Texas Hold 'Em\").light_red\n puts @artii2.asciify(' Simulator').light_yellow\n puts '-----------------------------------------------------------------------------'.light_red\n puts \" Welcome to Texas Hold 'Em Simulator! Please select an option to continue.\"\n puts ''\n puts ' To start playing poker, enter (P)lay.'\n puts ' To read the rules of poker, enter (R)ules. Opens in browser.'\n puts ' To quit the app, enter (Q)uit.'\nend", "def print_welcome\n box = TTY::Box.frame(width: 90, height: 17, align: :center, style: {bg: :red}) do\n \"\\nWelcome to the AirBnB escape game!\\n\n You have rented an AirBnB for the night and during your stay\\n\n have realised that your super host might be supernatural.\\n\n In order to survive, you must interact with the apartment and try to escape.\\n\n Each interaction will bring you a hint or a step closer to your freedom.\\n\n Be careful though, as some items can damage your guest rating.\\n\n If you reach a rating of 0, the g-host will kill you.\" \n end\n print box\n end", "def show\n ConsoleGlitter.escape(\"?25h\")\n end", "def execute(input: $stdin, output: $stdout)\n message = 'Standard'\n puts message\n puts Pastel.new.green(TTY::Font.new(:standard).write(message))\n\n :gui\n end", "def display\n system 'clear'\n @line_width = 60\n display_header\n display_board\n display_shield_row\n display_legend\n end", "def screen\n require \"tty-screen\"\n TTY::Screen\n end", "def desc\n \"Interactive TTY\"\n end", "def display_show_interface\n Show.display_all_shows_lite\n puts \"There are #{Show.all.size} shows. Enter the number of the show you'd like to display\"\n usr_input = get_usr_input.to_i\n if usr_input <= Show.all.size\n disp_horiz_line\n Show.display_show(usr_input)\n disp_horiz_line\n end\n end", "def display_game_menu\n @output.puts '-----------------------'.center(WIDTH)\n @output.puts '| 1) Blackjack |'.center(WIDTH)\n @output.puts '| 2) Stud Poker |'.center(WIDTH)\n @output.puts \"| 3) Texas Hold 'em |\".center(WIDTH)\n @output.puts '| A) Add AI Player |'.center(WIDTH)\n @output.puts '| D) Debug Console |'.center(WIDTH)\n @output.puts '| P) Setup Player |'.center(WIDTH)\n @output.puts '| Q) Quit |'.center(WIDTH)\n @output.puts '-----------------------'.center(WIDTH)\n @output.puts # spacer\n @output.print 'Command: '\n end", "def victory_screen\n system \"clear\"\n b = Artii::Base.new\n # puts\n puts \"------------------------------ VICTORY -------------------------------\"\n puts\n puts b.asciify(\" YOU WON !\")\n puts \"------------------------ PRESS ANY KEY TO CONTINUE --------------------------\"\n STDIN.getch\n print \" \\r\" # extra space to overwrite in case next sentence is short\nend", "def run\n Curses.init_screen\n\n init_style\n\n Curses.noecho\n Curses.curs_set 0 # invisible\n\n @message = RDoc::RI::Browser::Message.new\n\n @display = RDoc::RI::Browser::Display.new self\n @display.show HELP, nil, false\n\n trap_resume do\n event_loop\n end\n end", "def cli_banner()\n print \"> \"\n end", "def display_and_run\n\n # prints the menu name and waits briefly\n @dp.d_print(@menu_name + \":^^\")\n i = 1\n\n # displays the options\n @options.each do |option|\n print(i.to_s + ' ')\n puts(option.get_name)\n i += 1\n end\n\n # prompt and get valid input from the player\n print(@prompt_string)\n action = get_action\n\n # runs the selected action\n action.call :menu_select\n\n # some test code\n print(\"here\")\n end", "def display_instrutions\n\n\tConsole_Screen.cls #clear the display area\n\tputs \"\\t\\t\\tInstructions: \\n\\n\" #display a heading\n\n\t#display the game's instrutions\n\tputs %Q{ This test consists of a series of 10 typing challenges. The challenge sentences are presented one at a time. To respond correctly, you must retype each sentence exactly as shown and press the Enter key. You receive an A if you get 9 or 10 right, a B if you get 8 right, a C if you get 7, a D if you get 6 and F for anything 5 or below. Happy gaming. \\n\\n\\n\\n\\n\\n Press Enter to continue.\\n\\n}\n\n\tConsole_Screen.pause\nend", "def display\n\t\tputs \" #{cells[0]} | #{cells[1]} | #{cells[2]} \"\n\t\tputs \"-----------\"\n\t\tputs \" #{cells[3]} | #{cells[4]} | #{cells[5]} \"\n\t\tputs \"-----------\"\n\t\tputs \" #{cells[6]} | #{cells[7]} | #{cells[8]} \"\n\tend", "def display(msg)\n puts\n puts msg\n end", "def display\n wrap_in_border do\n print_space(:before)\n puts formatted_message\n print_space(:after)\n end\n sleep @display_seconds if !@display_seconds.nil?\n clear if @clear_after_display\n @message\n end", "def show\n puts \"******* show *******\"\n end", "def print\n puts \">> Command to be executed: #{command}\"\n end", "def welcome\n clear\n ascii_heading(\"The Bakers Box\")\n box_margin = ((TTY::Screen.width)-(\"Welcome to The Bakers Box\".length)-6)/2\n box = TTY::Box.frame padding: 3, align: :center, left: box_margin, top: 6 do\n \"Welcome to The Bakers Box\\n\\nThe percentage based\\nRecipe management app\"\n end\n print box\n space\nend", "def display\r\n end", "def welcome_screen\n system \"clear\"\n a = Artii::Base.new\n # puts\n puts \"------------------------------ WELCOME TO -------------------------------\"\n puts\n puts a.asciify(\"Monster Smash!\")\n puts \"------------------------ PRESS ANY KEY TO CONTINUE --------------------------\"\n STDIN.getch\n print \" \\r\" # extra space to overwrite in case next sentence is short\nend", "def display_text(text)\n print(text)\n end", "def show()\n\t\tputs (' \t|\t' + ' \t|\t')\n\t\tputs (@@board[7] + '\t|\t' + @@board[8] + '\t|\t' + @@board[9])\n\t\tputs ('------------------------------------')\n\t\tputs (@@board[4] + '\t|\t' + @@board[5] + '\t|\t' + @@board[6])\n\t\tputs (' \t|\t' + ' \t|\t')\n\t\tputs ('------------------------------------')\n\t\tputs (@@board[1] + '\t|\t' + @@board[2] + '\t|\t' + @@board[3])\n\t\tputs (' \t|\t' + ' \t|\t')\n\tend", "def display_blackjack_menu\n @output.puts # spacer\n @output.puts '--------------------------'.center(WIDTH)\n @output.puts '| (B)et | (H)it | (S)tay |'.center(WIDTH)\n @output.puts '--------------------------'.center(WIDTH)\n @output.puts '----------------------------------'.center(WIDTH)\n @output.puts '| (D)ebug | (M)ain Menu | (Q)uit |'.center(WIDTH)\n @output.puts '----------------------------------'.center(WIDTH)\n @output.puts # spacer\n @output.print 'Command: '\n end", "def displayln(out=$stdout)\n out.puts self\n end", "def console_display\n print @grid.to_text { |s| Grid.color_to_char(s.color) }\n end", "def display_instructions\r\n \r\n Console_Screen.cls #Clear the display area\r\n puts \"INSTRUCTIONS:\\n\\n\" #Display a heading\r\n \r\n #Display the game's instructions\r\n puts \"You will be presented with a series of multiple-choice\" \r\n puts \"questions. To answer a question, type in the letter of\"\r\n puts \"the corresponding answer and press the Enter key. Your\"\r\n puts \"grade will be displayed at the end of the test.\\n\\n\\n\"\r\n puts \"Good luck!\\n\\n\\n\\n\\n\\n\\n\\n\\n\"\r\n print \"Press Enter to continue.\"\r\n \r\n Console_Screen.pause #Pause the game\r\n \r\n end", "def show\n @top_section = @prompt.top_section\n @sub_section = @prompt.section\n set_replies(@prompt)\n end", "def display_motto\n puts \"A LA LUNA!!!\"\n end", "def show\n closed!\n if @debug\n ary = @leds.map { |value| Rainbow(@debug).color(*to_rgb(value)) }\n $stdout.print \"\\r#{ary.join}\"\n end\n self\n end", "def display_stats\n #Table of dragon stats\n table = Terminal::Table.new do |t|\n t.headings = ['Type','Dragon']\n t.add_row ['HP', '100']\n end\n puts table #print table \n end", "def display(msg)\n stdout.puts msg\n return \"#{msg}\\n\"\n end", "def show_start\n @start_time = Time.now\n puts TTY::Box.frame(self.class.name,\n \"Start : #{@start_time}\",\n width: TTY::Screen.width, padding: 1,\n border: { left: false, right: false })\n end", "def show(output = $stout)\n pp(@code,output)\n end", "def display(name)\n puts manpage(name)\n end", "def display_menu\n puts \"Choose from the following options: \\n\n to find a candidate, type 'find id' (ex. find 1)\n to view all candidates, type 'all'\n to view all qualified candidates, type 'qualified'\n to exit, type 'quit' \n to view menu, type 'menu' \\n\\n\"\nend", "def show\n\t puts \"\t#{@spaces[0]} #{@spaces[1]} #{@spaces[2]}\"\n\t puts \"\t#{@spaces[3]} #{@spaces[4]} #{@spaces[5]}\"\n\t puts \"\t#{@spaces[6]} #{@spaces[7]} #{@spaces[8]}\"\n\tend", "def display_header\n @output.puts # spacer\n @output.puts ''.center(WIDTH, '=')\n @output.puts \" Gambler v#{Gambler::VERSION} \".center(WIDTH, '=')\n @output.puts ''.center(WIDTH, '=')\n @output.puts '----------------------------------------'.center(WIDTH)\n @output.puts '| Feeding yet another human addiction. |'.center(WIDTH)\n @output.puts '----------------------------------------'.center(WIDTH)\n end", "def show_help\n puts 'usage: '\n puts 'a, -a :List all interfaces and their Addresses'\n puts 'l, -l :List all interface names'\n puts 'n, -n :List interface netmask settings'\n puts 'b, -b :List interface broadcast info....err'\n puts 'h, -h :Show this message'\n puts 'o, -o :Show operating system'\nend", "def display_instructions\r\n \r\n Console_Screen.cls #Clear the display area\r\n puts \"INSTRUCTIONS:\\n\\n\" #Display a heading\r\n\r\n #Display the game's instructions\r\n puts \"This game randomly generates a number from 1 to 1000 and\" \r\n puts \"challenges you to identify it in as few guesses as possible.\"\r\n puts \"After each guess, the game will analyze your input and provide\"\r\n puts \"you with feedback. You have a maximum of 10 turns in\" \r\n puts \"order to guess the game's secret number.\\n\\n\\n\"\r\n puts \"Good luck!\\n\\n\\n\\n\\n\\n\\n\\n\\n\"\r\n print \"Press Enter to continue.\"\r\n\r\n Console_Screen.pause #Pause the game\r\n \r\n end", "def showInformation()\n print(\"Starting up the scraper for the RAND Terrorism Incident Database. The flashing numbers that will appear represent written incidents. It will take a few moments for the initial program to load... \\n\");\nend", "def display\r\n puts \" #{cells[0]} | #{cells[1]} | #{cells[2]} \"\r\n puts \"-----------\"\r\n puts \" #{cells[3]} | #{cells[4]} | #{cells[5]} \"\r\n puts \"-----------\"\r\n puts \" #{cells[6]} | #{cells[7]} | #{cells[8]} \"\r\n end", "def display_menu\n puts \"\\nEnter option: \"\n puts '1. List Existing Threads'\n puts '2. List Single Thread'\n puts '3. Create new Thread'\n puts 'Q. Quit'\n end", "def console(&blk); end", "def console(&blk); end", "def print_help()\n puts \"--------------------------------------\"\n puts \"Use the following commands\"\n puts \"--------------------------------------\"\n puts \"HELP\\t\\tDisplays this message\"\n puts \"CLEAR\\t\\tClears the console\"\n puts \"DISPLAY\\t\\tClears the console and shows all Turns\"\n puts \"SURRENDER\\tSurrender the game\"\n puts \"RULES\\t\\tDisplay current Rules\"\n puts \"CHEAT\\t\\tDisplays a code with blackhit\"\n puts \"EXIT\\t\\tBack to main menu\"\n\n puts \"\\nCurrent status: #{@game.next_action} a code. Just press Enter to get prompted\"\n return self\n end", "def welcome \n\n system \"clear\"\n puts \"\n ██████╗░██████╗░░█████╗░██╗░░░██╗░██████╗░██╗░░██╗████████╗░██████╗\n ██╔══██╗██╔══██╗██╔══██╗██║░░░██║██╔════╝░██║░░██║╚══██╔══╝██╔════╝\n ██║░░██║██████╔╝███████║██║░░░██║██║░░██╗░███████║░░░██║░░░╚█████╗░\n ██║░░██║██╔══██╗██╔══██║██║░░░██║██║░░╚██╗██╔══██║░░░██║░░░░╚═══██╗\n ██████╔╝██║░░██║██║░░██║╚██████╔╝╚██████╔╝██║░░██║░░░██║░░░██████╔╝\n ╚═════╝░╚═╝░░╚═╝╚═╝░░╚═╝░╚═════╝░░╚═════╝░╚═╝░░╚═╝░░░╚═╝░░░╚═════╝░\\n\\n\\n\"\n\n # Progress bar\n bar = TTY::ProgressBar.new(\"[:bar]\", total: 74)\n 100.times do\n sleep(0.01)\n bar.advance(1)\n end\n\n main_menu\nend", "def show(str)\n\t\[email protected] \"show #{str}\"\n\tend", "def menu\n puts \"- Type in a #{\"Nintendo Character\".colorize(:red)} | #{\"Game Series\".colorize(:blue)} | #{\"Amiibo Series\".colorize(:green)}\\n\\n\"\n puts \"- Type #{'1'.colorize(:yellow)} for a list of all the Game Series included in the Amiibo collection\"\n puts \"- Type #{'2'.colorize(:yellow)} for a list of all the Amiibo Series included in the Amiibo collection\"\n puts \"- Type #{'3'.colorize(:yellow)} for a list of all the Characters included in Amiibo collection\"\n puts \"- Type #{'4'.colorize(:yellow)} for a list of ALL Amiibos collection\\n\\n\"\n puts \"- Type #{'exit'.colorize(:yellow)} to exit the CLI\\n\\n\"\n puts \"--------------------------------------------------------------------------------\\n\\n\"\n sleep(2)\n end", "def display_board\n puts \" | | \"\n puts \"-----------\"\n puts \" | | \"\n puts \"-----------\"\n puts \" | | \"\nend", "def display_board\n puts \" | | \"\n puts \"-----------\"\n puts \" | | \"\n puts \"-----------\"\n puts \" | | \"\nend", "def display_board\n puts \" | | \"\n puts\"-----------\"\n puts \" | | \"\n puts\"-----------\"\n puts \" | | \"\nend", "def display_instructions\r\n \r\n Console_Screen.cls #Clear the display area\r\n \r\n puts \"INSTRUCTIONS:\\n\\n\" #Display a heading\r\n\r\n #Display the game's instructions\r\n puts \"In the Ruby Tic-Tac-Toe game, Player X and \" +\r\n \"Player O try to \"\r\n puts \"outmaneuver each other by placing three Xs or \" +\r\n \"Os in a row \"\r\n puts \"horizontally, vertically, or diagonally. \" +\r\n \"Player X goes first first game, \"\r\n puts \"then starting players cycle. \"\r\n puts \"The game ends when either player claims three \" +\r\n \"squares in a \" \r\n puts \"row or when all nine squares have been claimed \" +\r\n \"without either \"\r\n puts \"player managing to claim three squares in a row.\"\r\n puts \"\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\"\r\n print \"Press Enter to continue, or M for Wikipedia instructions. \"\r\n\r\n userResponse = STDIN.gets #Collect the user's reponse\r\n userResponse.chop! #Remove the end of line marker\r\n userResponse = userResponse.upcase #Convert to uppercase\r\n\r\n if userResponse == \"M\"\r\n Console_Screen.cls #clears screen\r\n #loads wikipedia instructions for user in their browser\r\n system('start http://en.wikipedia.org/wiki/Tic_tac_toe')\r\n end \r\n \r\n end", "def display\n tp self\n end", "def displayCtrl _obj, _args\n \"_obj displayCtrl _args;\" \n end", "def list_commands\n puts UI_ARROW.light_yellow + \" \" + \"'fight', 'f', or 'battle' to view enemies and fight.\"\n puts UI_ARROW.light_yellow + \" \" + \"'armoury' or 'a' to go to the armoury.\"\n puts UI_ARROW.light_yellow + \" \" + \"'stats' to view your current status.\"\n puts UI_ARROW.light_yellow + \" \" + \"'clear' or 'cls' to clear the screen.\"\n puts UI_ARROW.light_yellow + \" \" + \"'quit', 'q', or 'exit' to abandon your journey.\"\n puts\nend", "def show_fg(str = \"\\n\")\n print(str) if fg?\n self\n end", "def print_menu\n puts \"1. List patients\"\n # ....\n end", "def display_board\n puts \" | | \" \n puts \"-----------\"\n puts \" | | \"\n puts \"-----------\"\n puts \" | | \"\nend", "def show!\n Spi.begin do |s|\n s.clock(@spi_hz)\n s.write(START_FRAME + @led_frames + @end_frame)\n end\n end", "def menu_display\n system(\"clear\")\n\t\tputs \"##############################\"\n\t\tputs \"# #\"\n\t\tputs \"# Select a number #\"\n\t\tputs \"# from below #\"\n\t\tputs \"# #\"\n\t\tputs \"# 1. Balance #\"\n\t\tputs \"# 2. Deposit #\"\n\t\tputs \"# 3. Withdraw #\"\n\t\tputs \"# 4. History #\"\n\t\tputs \"# 5. Exit #\"\n\t\tputs \"# #\"\n\t\tputs \"# #\"\n\t\tputs \"##############################\"\n end", "def run_script\n %(DISPLAY=:${display} #{super})\n end", "def display\n puts \" #{cells[0]} | #{cells[1]} | #{cells[2]} \"\n puts \"-----------\"\n puts \" #{cells[3]} | #{cells[4]} | #{cells[5]} \"\n puts \"-----------\"\n puts \" #{cells[6]} | #{cells[7]} | #{cells[8]} \"\n end", "def display\n puts \" #{cells[0]} | #{cells[1]} | #{cells[2]} \"\n puts \"-----------\"\n puts \" #{cells[3]} | #{cells[4]} | #{cells[5]} \"\n puts \"-----------\"\n puts \" #{cells[6]} | #{cells[7]} | #{cells[8]} \"\n end", "def display\n puts \" #{cells[0]} | #{cells[1]} | #{cells[2]} \"\n puts \"-----------\"\n puts \" #{cells[3]} | #{cells[4]} | #{cells[5]} \"\n puts \"-----------\"\n puts \" #{cells[6]} | #{cells[7]} | #{cells[8]} \"\n end", "def display\n puts \" #{cells[0]} | #{cells[1]} | #{cells[2]} \"\n puts \"-----------\"\n puts \" #{cells[3]} | #{cells[4]} | #{cells[5]} \"\n puts \"-----------\"\n puts \" #{cells[6]} | #{cells[7]} | #{cells[8]} \"\n end", "def show_header()\n print_message (SPACE_SEPARATOR)\n print_message 'Welcome to Ruby Calculator'\n print_message (SPACE_SEPARATOR) \n end", "def print\r\n puts self.output\r\n end", "def display_instructions\n\n\tConsole_Screen.cls #clear the display area\n\tputs \"INSTRUCTIONS:\\n\\n\" #display a heading\n\n\t#display the game's instrucitons\n\tputs \"This game ranomly generates a number from 1 to 1000 and\" \n\tputs \"challenges you to identify it in as few guesses as possible.\" \n\tputs \"After each guess, the game will analyze your input and provide\" \n\tputs \"you with feedback. You may take as many turns as you need in \" \n\tputs \"order to guess the game's secret number.\\n\\n\\n Good luck!\\n\\n\\n\" \n\tprint \"Press Enter to continue.\"\n\n\t Console_Screen.pause\n\n\tend", "def print_menu\n output.puts \"Madden's Car Selection Tool-\"\n \n # Print Current Model Info\n print_model_info\n\n # Print Menu Choices\n print_menu_choices\n\n # Get User Choice\n output.print \"Enter choice: \"\n end", "def show() end", "def show() end", "def show() end", "def print(s = nil)\n if s == nil\n TermGui.open_style(self)\n else\n TermGui.print(s, self)\n end\n end", "def display\n puts \" #{@cells[0]} | #{@cells[1]} | #{@cells[2]} \"\n puts \"-----------\"\n puts \" #{@cells[3]} | #{@cells[4]} | #{@cells[5]} \"\n puts \"-----------\"\n puts \" #{@cells[6]} | #{@cells[7]} | #{@cells[8]} \"\n end", "def display\n puts \" #{@cells[0]} | #{@cells[1]} | #{@cells[2]} \"\n puts \"-----------\"\n puts \" #{@cells[3]} | #{@cells[4]} | #{@cells[5]} \"\n puts \"-----------\"\n puts \" #{@cells[6]} | #{@cells[7]} | #{@cells[8]} \"\n end", "def mirror_screens\n exec(\"displays mirror\")\n end", "def start\n @old_display = ENV['DISPLAY']\n ENV['DISPLAY'] = \":#{display}\"\n end", "def display_menu\n title_print\n puts \"Hi #{@todays_hero.name}!\"\n puts \"***************************\"\n selection = TTY::Prompt.new.select(\"What would you like to do?\", per_page: 10, cycle: true) do |menu|\n menu.enum '>'\n\n menu.choice 'Start a fight', 1\n menu.choice 'Train for battle', 2\n menu.choice 'Go on a Quest', 3\n menu.choice 'Show Stats', 4\n menu.choice 'Display Instructions', 5\n menu.choice 'Display Leaderboard', 6\n menu.choice 'Exit', 7\n end\n self.start_game_loop(selection)\n end", "def list_commands\n puts UI_ARROW.light_yellow + \" \" + \"'fight', 'f', or 'battle' to view enemies and fight.\"\n puts UI_ARROW.light_yellow + \" \" + \"'armoury' or 'a' to go to the armoury.\"\n puts UI_ARROW.light_yellow + \" \" + \"'stats' to view your current status.\"\n puts UI_ARROW.light_yellow + \" \" + \"'clear' or 'cls' to clear the screen.\"\n puts UI_ARROW.light_yellow + \" \" + \"'quit', 'q', or 'exit' to abandon your journey.\"\nend", "def execute(input: $stdin, output: $stdout)\n prompt = TTY::Prompt.new\n\n return :gui\n end", "def display_info(info)\n puts \"\\e[34;1m[INFO]\\e[0m #{info}\"\n end", "def display\n dispose\n raise NotImplementedError, \"Must implement display method\"\n end", "def display\n puts \" #{@cells[0]} \" + \"|\" + \" #{@cells[1]} \" + \"|\" + \" #{@cells[2]} \"\n puts \"-----------\"\n puts \" #{@cells[3]} \" + \"|\" + \" #{@cells[4]} \" + \"|\" + \" #{@cells[5]} \"\n puts \"-----------\"\n puts \" #{@cells[6]} \" + \"|\" + \" #{@cells[7]} \" + \"|\" + \" #{@cells[8]} \"\n end", "def show\n json_response(@terminal.decorate, :ok)\n end", "def show_main_menu\n puts \"\\e[H\\e[2J\"\n puts \"Welcome to the app. What's next?\"\n puts \" new - Create a new contact\"\n puts \" list - List all contacts\"\n puts \" quit - Exit Application\"\n print \"> \"\n end" ]
[ "0.7115778", "0.66148424", "0.65679586", "0.6557836", "0.65077615", "0.6463722", "0.64463943", "0.6445081", "0.6443887", "0.6443887", "0.6431435", "0.6375582", "0.63747853", "0.633644", "0.63193804", "0.63182443", "0.6316558", "0.6315028", "0.6294344", "0.6279015", "0.62467015", "0.62316585", "0.6189898", "0.6178603", "0.61766857", "0.6172016", "0.61699486", "0.6158769", "0.6127038", "0.61177665", "0.61004996", "0.60931015", "0.6085894", "0.60761076", "0.6070616", "0.6057382", "0.60451794", "0.604387", "0.6041746", "0.6031675", "0.60308355", "0.60308236", "0.60299003", "0.6024525", "0.60229564", "0.60166246", "0.6011319", "0.6010505", "0.6001168", "0.59999937", "0.59708464", "0.5964382", "0.5957057", "0.5955909", "0.5950525", "0.59454393", "0.5929216", "0.5911796", "0.59094405", "0.59094405", "0.59038186", "0.5897556", "0.5895371", "0.5892977", "0.58860534", "0.58860534", "0.5883732", "0.5879745", "0.58785635", "0.58779997", "0.58774656", "0.5876789", "0.58756196", "0.58753234", "0.5872836", "0.58718365", "0.58613706", "0.5859625", "0.5859625", "0.5859625", "0.5859625", "0.58587193", "0.58586836", "0.5844777", "0.5840807", "0.583725", "0.583725", "0.583725", "0.5835423", "0.5832468", "0.5832468", "0.5831529", "0.5829994", "0.5816829", "0.58128124", "0.5809878", "0.5809339", "0.5808038", "0.5799029", "0.5797405", "0.5796837" ]
0.0
-1
GET /artwork_symbols GET /artwork_symbols.json
def index @artwork_symbols = ArtworkSymbol.all.paginate(page: params[:page], per_page: 50).order('name ASC') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @artwork_symbol = ArtworkSymbol.new(artwork_symbol_params)\n\n respond_to do |format|\n if @artwork_symbol.save\n format.html { redirect_to @artwork_symbol, notice: 'Artwork symbol was successfully created.' }\n format.json { render :show, status: :created, location: @artwork_symbol }\n else\n format.html { render :new }\n format.json { render json: @artwork_symbol.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_artwork_symbol\n @artwork_symbol = ArtworkSymbol.find(params[:id])\n end", "def destroy\n @artwork_symbol.destroy\n respond_to do |format|\n format.html { redirect_to artwork_symbols_url, notice: 'Artwork symbol was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def stock_symbols(exchange, opts = {})\n data, _status_code, _headers = stock_symbols_with_http_info(exchange, opts)\n data\n end", "def show\n @glyph = Glyph.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @glyph }\n end\n end", "def scrapp_symbols\n\tpage = get_page\n\tcrypto_symbols = page.xpath('//*[@class=\"text-left col-symbol\"]')\n\tcrypto_symbols_array = [] #/ initiliaze the array for stocking all symbols\n\tcrypto_symbols.each do |symbol| #/ put .text to be in string the symbols\n\t\tcrypto_symbols_array << symbol.text \n\tend\n\treturn crypto_symbols_array\nend", "def artwork_symbol_params\n params[:artwork_symbol].permit(:name)\n end", "def update\n respond_to do |format|\n if @artwork_symbol.update(artwork_symbol_params)\n format.html { redirect_to @artwork_symbol, notice: 'Artwork symbol was successfully updated.' }\n format.json { render :show, status: :ok, location: @artwork_symbol }\n else\n format.html { render :edit }\n format.json { render json: @artwork_symbol.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n if Stock.check_valid(params[:symbol])\n if Stock.not_exists?(params[:symbol])\n create\n end\n $stock = Stock.find(params[:symbol])\n # Gather and check chart data\n @input = Stock.get_overview(params)\n if @input === 404\n not_found\n else\n @data = YahooFinance.quotes([params[:symbol]], [:name, :last_trade_price, :ask, :bid, :open, :close, :volume, :market_capitalization, :dividend_yield, :dividend_per_share, :change, :change_in_percent, :last_trade_date, :stock_exchange])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: $stock }\n end\n end\n else\n not_found\n end\n end", "def stock_symbols_with_http_info(exchange, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.stock_symbols ...'\n end\n # verify the required parameter 'exchange' is set\n if @api_client.config.client_side_validation && exchange.nil?\n fail ArgumentError, \"Missing the required parameter 'exchange' when calling DefaultApi.stock_symbols\"\n end\n # resource path\n local_var_path = '/stock/symbol'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'exchange'] = exchange\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Array<Stock>' \n\n # auth_names\n auth_names = opts[:auth_names] || ['api_key']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#stock_symbols\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def current_symbols\n @interface.stock_symbols\n end", "def show\n @symbol_bank = SymbolBank.find(params[:id])\n respond_with @symbol_bank\n end", "def show\n @keystroke = Keystroke.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @keystroke }\n end\n end", "def get_surf_data\n url = \"http://magicseaweed.com/api/#{ENV['MAGIC_SEAWEED_API_KEY']}/forecast/?spot_id=6128&units=UK\"\n uri = URI(url)\n\n response = Net::HTTP.get(uri)\n ActiveSupport::JSON.decode(response) if response != ''\n end", "def show\n @artwork_share = ArtworkShare.find_by(id: params[:id])\n render json: @artwork_share\n end", "def show\n @barcode_list = BarcodeList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @barcode_list }\n format.svg { send_data @barcode_list.data, :type => 'image/svg+xml', :disposition => 'inline' }\n end\n end", "def show\n @barcode_list = BarcodeList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @barcode_list }\n format.svg { send_data @barcode_list.data, :type => 'image/svg+xml', :disposition => 'inline' }\n end\n end", "def get_symbols\n\t\treturn @symbols\n\tend", "def get_ticker_tape_info \n yahoo_client = YahooFinance::Client.new\n @ticker_data = yahoo_client.quotes([\"^GSPC\", \"^IXIC\", \"CL=F\", \"GC=F\", \"EURUSD=X\"], [:last_trade_price, :change, :change_in_percent])\n respond_to do |format|\n format.json { render json: @ticker_data, status: :ok }\n format.html { @ticker_data }\n end\n end", "def show\n @curve = Curve.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @curve }\n end\n end", "def symbols\n @symbols ||= Array(@grpc.symbols).map do |b|\n Symbol.from_grpc b\n end\n end", "def index\n @symptoms = Symptom.all\n\n render json: @symptoms\n end", "def get_symbols\n symbols = html_open_url.css(\"td.col-symbol\")\n symbol_array = put_in_array(symbols)\nend", "def index\n @icons = Icon.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @icons }\n end\n end", "def set_search_api\n @url = 'https://api.coinmarketcap.com/v1/ticker/'\n @uri = URI(@url)\n @response = Net::HTTP.get(@uri)\n # converts response to a Ruby hash \n @search_coin = JSON.parse(@response)\n @symbol = params[:sym]\n\n if @symbol\n @symbol = @symbol.upcase\n end \n end", "def candles(sym='btcusd', options={})\n #Hashie::Mash.new(\n #self.class.get(\"/v1/candles/#{sym}\", options).parsed_response\n nil\n end", "def symbols() @symbols end", "def show\n @biomechanical_symmetry = BiomechanicalSymmetry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @biomechanical_symmetry }\n end\n end", "def index\r\n markers = Marker.all\r\n render json: markers\r\n end", "def add\n unless TickerSymbol.where(symb: params['new_symbol']).nil?\n url = 'stock/' + params['new_symbol'] + '/company'\n company_data = JSON.parse( get_iex_json( url ) )\n print company_data\n unless company_data == 'Unknown symbol'\n TickerSymbol.create( symb: company_data[\"symbol\"], name: company_data[\"companyName\"], exchange: company_data[\"exchange\"], industry: company_data[\"industry\"], sector: company_data[\"sector\"] )\n end\n end\n render('covered_symbols')\n end", "def index\n @cn_curves = CnCurve.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cn_curves }\n end\n end", "def forex_symbols_with_http_info(exchange, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.forex_symbols ...'\n end\n # verify the required parameter 'exchange' is set\n if @api_client.config.client_side_validation && exchange.nil?\n fail ArgumentError, \"Missing the required parameter 'exchange' when calling DefaultApi.forex_symbols\"\n end\n # resource path\n local_var_path = '/forex/symbol'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'exchange'] = exchange\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Array<ForexSymbol>' \n\n # auth_names\n auth_names = opts[:auth_names] || ['api_key']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#forex_symbols\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @symboles = Symbole.all\n end", "def index\n @tracks = Track.all\n render json: {tracks: @tracks}\n end", "def index\n @strokes = Stroke.all\n end", "def show\n @icon = Icon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @icon }\n end\n end", "def view_api\n api_string = RestClient.get(\"https://itunes.apple.com/search?term=star+wars&entity=song&attribute=movieTerm\")\n api_hash = JSON.parse(api_string)\n\n end", "def get_chart(options={})\n api_response = @api_client.make_api_request(:GET, \"artist/chart\", {}, options)\n @api_client.chart_item_digestor.list_from_xml(api_response.content.chart)\n end", "def index\n @satellites = Satellite.all\n @sat_json = Satellite.includes(:barrels).map { |sat| sat.as_json.merge({barrels: sat.barrels.as_json}) }\n end", "def index\n puts \"Params Page::::::::::#{params[:page]}\"\n symbol_banks = SymbolBank.all(:order => :symbol_name)\n session[:page] = params[:page]\n @symbol_banks = Kaminari.paginate_array(symbol_banks).page(params[:page])\n respond_with @symbol_banks\n end", "def show\n @stock = Stock.find(params[:id])\n @quote = YahooFinance::get_standard_quotes(@stock.ticker)[@stock.ticker]\n @tweets = Twitter.search('$' + @stock.ticker).results\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stock }\n end\n end", "def index\n json_response(Spot.all)\n end", "def symbols\n @symbol_set.symbols\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cn_curve }\n end\n end", "def index\n @tracks = @disc.tracks.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tracks }\n end\n end", "def index\n @keys = Key.all\n render json: @keys\n end", "def show\n @stock = Stock.find(params[:id])\n\n render json: @stock\n end", "def markets\n get('/markets')['markets']\n end", "def index\n headers['Last-Modified'] = Time.now.httpdate\n session_id = nil\n\n if !params[:symbols].nil?\n syms = params[:symbols].split(\",\")\n # @stock_options = StockOption.where(symbol: syms)\n @stock_options = []\n\n login_response = AmeritradeHelper.login(params)\n puts \"*** login response #{login_response}\"\n unless login_response.nil?\n session_id = login_response[:session_id]\n login_date = login_response[:login_date]\n end\n\n if !session_id.nil?\n syms.each do |sym|\n # AmeritradeHelper.delete_stock_options(sym)\n new_stock_options = AmeritradeHelper.get_stock_option_symbol(sym, !params[:historic].nil?, params[:minDaysExp], params[:maxDaysExp])\n @stock_options = @stock_options + new_stock_options unless new_stock_options.nil? || !new_stock_options.length\n end\n else\n puts \"*** session id is nil\"\n end\n\n else\n @stock_options = StockOption.all\n end\n\n response = {\n :meta => {\n :session_id => session_id,\n :login_date => login_date\n },\n :data => {\n :stock_options => @stock_options\n }\n }\n\n respond_to do |format|\n format.html\n format.json { render json: response }\n end\n\n # @stock_options = StockOption.all\n end", "def options ()\n\t\tres = with_auth_query nil do |options|\n\t\t\tself.class.get('/api/v1/market/symbols', options)\n\t\tend\n\t\tcontracts = []\n\t\tres.each do |symbol|\n\t\t\tcontracts.push symbol if symbol[\"exp\"]\n\t\tend\n\t\tcontracts\n\tend", "def get_figures\n get(FIGURES)\n end", "def index\n @air_qualities = AirQuality.all\n\n render json: @air_qualities\n end", "def search \n @stocklist\n if !params[:searchsymbol].blank?\n @stocklist = Stocklist.where(\"symbol like '%#{params[:searchsymbol]}%'\").page(params[:page]).per(30)\n end\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stocklist }\n end\n end", "def index\n @drawables = Drawable.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @drawables }\n end\n end", "def index\n @money = Money.all\n require 'net/http'\n require 'json'\n @url = 'https://api.coinmarketcap.com/v1/ticker/'\n @uri = URI(@url)\n @response = Net::HTTP.get(@uri)\n @lookup_money = JSON.parse(@response)\n end", "def show\n @pix = Pix.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pix }\n end\n end", "def index\n @tickers = TickerSymbol.all\n end", "def forex_symbols(exchange, opts = {})\n data, _status_code, _headers = forex_symbols_with_http_info(exchange, opts)\n data\n end", "def index\n @illnesses = Illness.all\n\n render json: @illnesses\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @service_pricing_schemes }\n end\n end", "def index\n @traces = Trace.all\n\n render json: @traces\n end", "def index\n @economy_hands = EconomyHand.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @economy_hands }\n end\n end", "def show\n @drawing = Drawing.find(params[:id])\n\n render json: @drawing\n end", "def show\n @inventory_shelf_barcode = InventoryShelfBarcode.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inventory_shelf_barcode }\n end\n end", "def show\n @work_order = WorkOrder.find(params[:id])\n @markers = @work_order.property.to_gmaps4rails\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @work_order }\n end\n end", "def crypto_symbols_with_http_info(exchange, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.crypto_symbols ...'\n end\n # verify the required parameter 'exchange' is set\n if @api_client.config.client_side_validation && exchange.nil?\n fail ArgumentError, \"Missing the required parameter 'exchange' when calling DefaultApi.crypto_symbols\"\n end\n # resource path\n local_var_path = '/crypto/symbol'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'exchange'] = exchange\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Array<CryptoSymbol>' \n\n # auth_names\n auth_names = opts[:auth_names] || ['api_key']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#crypto_symbols\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @heart_rate_types = HeartRateType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @heart_rate_types }\n end\n end", "def state_breweries\n render json: BreweryDb::ShowBreweries.new('state', params[:state]).results\n end", "def index\n @power_orders = PowerOrder.all\n render json: @power_orders\n end", "def index\n @eicons = Eicon.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @eicons }\n end\n end", "def index\n headers['Last-Modified'] = Time.now.httpdate\n session_id = nil\n response = {}\n\n if !params[:symbols].nil?\n syms = params[:symbols].split(\",\")\n\n login_response = AmeritradeHelper.login(params)\n puts \"*** login response #{login_response}\"\n unless login_response.nil?\n session_id = login_response[:session_id]\n login_date = login_response[:login_date]\n end\n\n if !session_id.nil?\n syms.each do |sym|\n AmeritradeHelper.load_volatility(sym, params, session)\n end\n else\n puts \"*** session id is nil\"\n end\n\n vols = []\n syms.each do |sym|\n vols << AmeritradeHelper.calculate_ivr(sym)\n end\n\n response = {\n :meta => {\n :session_id => session_id,\n :login_date => login_date\n },\n :data => {\n :volatility => vols\n }\n }\n end\n\n respond_to do |format|\n format.html\n format.json { render json: response }\n end\n\n\n # @volatilities = Volatility.all\n end", "def show\n @eicon = Eicon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @eicon }\n end\n end", "def index\n @stars = Star.all\n render :json => @stars\n end", "def index\n @buisnesses = Buisness.all\n\n render json: @buisnesses \n end", "def index\n @tracks = Track.all\n render json: serialize(@tracks)\n end", "def getStock(symbol)\n\n return StockQuote::Stock.batch([\"quote\",\"logo\"],symbol)\n\n end", "def index\n @build_orders = BuildOrder.paginate(page: params[:page], per_page: 10)\n @glyphs = Glyph.all\n end", "def hotness artist\n url = \"http://developer.echonest.com/api/v4/artist/hotttnesss?api_key=#{ECHONEST_API_KEY}&name=#{artist}&format=json\"\n result = parseURL url\n result[\"response\"][\"artist\"][\"hotttnesss\"]\nend", "def show\n @inkpmscode = Inkpmscode.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inkpmscode }\n end\n end", "def index\n @specialties = Specialty.all\n\n render json: @specialties\n end", "def index\n @decks = Deck.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @decks }\n end\n end", "def index\n @decks = Deck.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @decks }\n end\n end", "def get_portfolio_symbols_and_prices\n holdings = self.portfolio_holdings\n @holding = Holding.new\n symbol_and_price = []\n holdings.each do |key, value|\n if key === \"MM\"\n symbol_and_price.push({key => 1})\n else\n price = @holding.get_price(key).to_f\n symbol_and_price.push({key => price})\n end\n end\n symbol_and_price\n end", "def show\n render json: @key_feature\n end", "def show\n @track = Track.find(params[:id])\n authorize! :show, @track\n gon.track_number = Track.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @track.to_json(:methods => [:polyline],:only => [:name])}\n #format.json { render json: { \"language\" => @languages.as_json(:root => false) }.to_json }\n # render :json => @track.to_json(:methods => [:polyline],:only => [:name])\n end\n end", "def index\n @housing_features = HousingFeature.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @housing_features }\n end\n end", "def index\n skickers = Skicker.order(power: :asc)\n render json: { status: 'SUCCESS', message: 'Loaded skickers', value: skickers }\n end", "def show\n require 'net/http'\n require 'json'\n\n @url = 'https://api.coinmarketcap.com/v1/ticker/'\n @uri = URI(@url)\n @response = Net::HTTP.get(@uri)\n @show_crypto = JSON.parse(@response)\n end", "def show\n @sp500_stock = Sp500Stock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sp500_stock }\n end\n end", "def index\n @stock_prices = StockPrice.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @stock_prices }\n end\n end", "def stockquote(stock)\n url = URI(\"https://apidojo-yahoo-finance-v1.p.rapidapi.com/market/v2/get-quotes?region=US&symbols=#{@stock}\")\n\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n \n request = Net::HTTP::Get.new(url)\n request[\"x-rapidapi-key\"] = ENV['X_RAPIDAPI_KEY']\n request[\"x-rapidapi-host\"] = 'apidojo-yahoo-finance-v1.p.rapidapi.com'\n \n response = http.request(request)\n quoteResponse = JSON.parse(response.read_body)['quoteResponse']\n result = quoteResponse['result']\n @zero = result[0]\n puts \"Symbol = #{@zero['symbol']}, Exchange = #{@zero['fullExchangeName']}, Bid = #{@zero['bid']}, Ask = #{@zero['ask']}\"\n\n return \"<div class =col>\n <h2>Symbol=<a>#{@zero['symbol']}</a></h2>\n <h4>Exchange=<a>#{@zero['fullExchangeName']}</a></h4>\n <h4>Bid=<a>#{@zero['bid']}</a></h4>\n <h4>Ask=<a>#{@zero['ask']}</a></h4>\n </div>\"\n end", "def index\n @sightings = Sighting.all\n render json: @sightings\n end", "def show\n @discogs_releases = {}\n @artist_name = get_artist_name\n @discogs_releases = get_discogs_releases_paginated(@artist_name) unless @artist_name.blank?\n\n respond_to do |format|\n format.html # show.html.erb\n #format.xml { render :xml => @artist }\n format.js\n end\n end", "def show\n @tick_track = TickTrack.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tick_track }\n end\n end", "def index\n @user_figures = UserFigure.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @user_figures }\n end\n end", "def index\n if params[:album_id]\n @artists = Album.resolve(params[:album_id]).artist\n else\n @artists = Artist.order(:name)\n end\n\n render json: @artists\n end", "def index\n # @songs = Song.find_by_artist_id params[:artist_id]\n @songs = Song.find_all_by_artist_id params[:artist_id]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @songs }\n end\n end", "def index\n @active_breweries = Brewery.active\n\t\t@retired_breweries = Brewery.retired\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @breweries }\n end\n end", "def index\n @code_factors = CodeFactor.all(:order => \"id DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @code_factors }\n format.json { \n\t \t@returns = []\n\t \t@code_factors.each do |code_factor|\n\t \t\t@returns << mapping_to_hash(code_factor, CodeFactor.json_mapping_table)\n\t\tend \n\t \trender :json => @returns\n\t }\n end\n end", "def index\n @non_smoking_bars = NonSmokingBar.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @non_smoking_bars }\n end\n end" ]
[ "0.6046496", "0.5869437", "0.5787883", "0.5749128", "0.5699992", "0.5684782", "0.562461", "0.5567385", "0.5562975", "0.5548229", "0.55352443", "0.5523372", "0.5480894", "0.5462103", "0.5444285", "0.5443975", "0.5443975", "0.54323596", "0.5420465", "0.5404084", "0.5392368", "0.53835183", "0.536736", "0.5307007", "0.5296771", "0.5254213", "0.52340287", "0.5214327", "0.5213403", "0.52103454", "0.5193633", "0.51812", "0.51673275", "0.51671463", "0.5152282", "0.5152022", "0.5147621", "0.5147109", "0.5144209", "0.51396114", "0.5139585", "0.5127039", "0.51229817", "0.5122524", "0.5118837", "0.5117056", "0.50940543", "0.50848067", "0.5075244", "0.50706124", "0.5065313", "0.5064729", "0.50641024", "0.5062097", "0.5057827", "0.5051823", "0.50515145", "0.5047586", "0.5046655", "0.5036448", "0.50361025", "0.50297904", "0.5022446", "0.5019897", "0.5017624", "0.5005475", "0.5005357", "0.4997029", "0.4994714", "0.49929538", "0.49863833", "0.49809593", "0.49807763", "0.49761528", "0.4973766", "0.49729565", "0.49719203", "0.49715626", "0.4957429", "0.49548507", "0.49513575", "0.49513575", "0.49493027", "0.49492666", "0.49484935", "0.49475223", "0.494584", "0.4940755", "0.49380302", "0.49373433", "0.49369082", "0.4929708", "0.49291426", "0.49284768", "0.492323", "0.49190444", "0.49144217", "0.4912129", "0.49061805", "0.49042904" ]
0.64724755
0
GET /artwork_symbols/1 GET /artwork_symbols/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @artwork_symbols = ArtworkSymbol.all.paginate(page: params[:page], per_page: 50).order('name ASC')\n end", "def create\n @artwork_symbol = ArtworkSymbol.new(artwork_symbol_params)\n\n respond_to do |format|\n if @artwork_symbol.save\n format.html { redirect_to @artwork_symbol, notice: 'Artwork symbol was successfully created.' }\n format.json { render :show, status: :created, location: @artwork_symbol }\n else\n format.html { render :new }\n format.json { render json: @artwork_symbol.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_artwork_symbol\n @artwork_symbol = ArtworkSymbol.find(params[:id])\n end", "def show\n @glyph = Glyph.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @glyph }\n end\n end", "def show\n if Stock.check_valid(params[:symbol])\n if Stock.not_exists?(params[:symbol])\n create\n end\n $stock = Stock.find(params[:symbol])\n # Gather and check chart data\n @input = Stock.get_overview(params)\n if @input === 404\n not_found\n else\n @data = YahooFinance.quotes([params[:symbol]], [:name, :last_trade_price, :ask, :bid, :open, :close, :volume, :market_capitalization, :dividend_yield, :dividend_per_share, :change, :change_in_percent, :last_trade_date, :stock_exchange])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: $stock }\n end\n end\n else\n not_found\n end\n end", "def destroy\n @artwork_symbol.destroy\n respond_to do |format|\n format.html { redirect_to artwork_symbols_url, notice: 'Artwork symbol was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def update\n respond_to do |format|\n if @artwork_symbol.update(artwork_symbol_params)\n format.html { redirect_to @artwork_symbol, notice: 'Artwork symbol was successfully updated.' }\n format.json { render :show, status: :ok, location: @artwork_symbol }\n else\n format.html { render :edit }\n format.json { render json: @artwork_symbol.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @symbol_bank = SymbolBank.find(params[:id])\n respond_with @symbol_bank\n end", "def stock_symbols_with_http_info(exchange, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.stock_symbols ...'\n end\n # verify the required parameter 'exchange' is set\n if @api_client.config.client_side_validation && exchange.nil?\n fail ArgumentError, \"Missing the required parameter 'exchange' when calling DefaultApi.stock_symbols\"\n end\n # resource path\n local_var_path = '/stock/symbol'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'exchange'] = exchange\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Array<Stock>' \n\n # auth_names\n auth_names = opts[:auth_names] || ['api_key']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#stock_symbols\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n @keystroke = Keystroke.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @keystroke }\n end\n end", "def show\n @curve = Curve.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @curve }\n end\n end", "def add\n unless TickerSymbol.where(symb: params['new_symbol']).nil?\n url = 'stock/' + params['new_symbol'] + '/company'\n company_data = JSON.parse( get_iex_json( url ) )\n print company_data\n unless company_data == 'Unknown symbol'\n TickerSymbol.create( symb: company_data[\"symbol\"], name: company_data[\"companyName\"], exchange: company_data[\"exchange\"], industry: company_data[\"industry\"], sector: company_data[\"sector\"] )\n end\n end\n render('covered_symbols')\n end", "def show\n @artwork_share = ArtworkShare.find_by(id: params[:id])\n render json: @artwork_share\n end", "def set_search_api\n @url = 'https://api.coinmarketcap.com/v1/ticker/'\n @uri = URI(@url)\n @response = Net::HTTP.get(@uri)\n # converts response to a Ruby hash \n @search_coin = JSON.parse(@response)\n @symbol = params[:sym]\n\n if @symbol\n @symbol = @symbol.upcase\n end \n end", "def get_ticker_tape_info \n yahoo_client = YahooFinance::Client.new\n @ticker_data = yahoo_client.quotes([\"^GSPC\", \"^IXIC\", \"CL=F\", \"GC=F\", \"EURUSD=X\"], [:last_trade_price, :change, :change_in_percent])\n respond_to do |format|\n format.json { render json: @ticker_data, status: :ok }\n format.html { @ticker_data }\n end\n end", "def artwork_symbol_params\n params[:artwork_symbol].permit(:name)\n end", "def current_symbols\n @interface.stock_symbols\n end", "def stock_symbols(exchange, opts = {})\n data, _status_code, _headers = stock_symbols_with_http_info(exchange, opts)\n data\n end", "def show\n @stock = Stock.find(params[:id])\n\n render json: @stock\n end", "def show\n @icon = Icon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @icon }\n end\n end", "def show\n @biomechanical_symmetry = BiomechanicalSymmetry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @biomechanical_symmetry }\n end\n end", "def show\n @barcode_list = BarcodeList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @barcode_list }\n format.svg { send_data @barcode_list.data, :type => 'image/svg+xml', :disposition => 'inline' }\n end\n end", "def show\n @barcode_list = BarcodeList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @barcode_list }\n format.svg { send_data @barcode_list.data, :type => 'image/svg+xml', :disposition => 'inline' }\n end\n end", "def show\n @stock = Stock.find(params[:id])\n @quote = YahooFinance::get_standard_quotes(@stock.ticker)[@stock.ticker]\n @tweets = Twitter.search('$' + @stock.ticker).results\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stock }\n end\n end", "def get_surf_data\n url = \"http://magicseaweed.com/api/#{ENV['MAGIC_SEAWEED_API_KEY']}/forecast/?spot_id=6128&units=UK\"\n uri = URI(url)\n\n response = Net::HTTP.get(uri)\n ActiveSupport::JSON.decode(response) if response != ''\n end", "def show\n @pix = Pix.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pix }\n end\n end", "def stockquote(stock)\n url = URI(\"https://apidojo-yahoo-finance-v1.p.rapidapi.com/market/v2/get-quotes?region=US&symbols=#{@stock}\")\n\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n \n request = Net::HTTP::Get.new(url)\n request[\"x-rapidapi-key\"] = ENV['X_RAPIDAPI_KEY']\n request[\"x-rapidapi-host\"] = 'apidojo-yahoo-finance-v1.p.rapidapi.com'\n \n response = http.request(request)\n quoteResponse = JSON.parse(response.read_body)['quoteResponse']\n result = quoteResponse['result']\n @zero = result[0]\n puts \"Symbol = #{@zero['symbol']}, Exchange = #{@zero['fullExchangeName']}, Bid = #{@zero['bid']}, Ask = #{@zero['ask']}\"\n\n return \"<div class =col>\n <h2>Symbol=<a>#{@zero['symbol']}</a></h2>\n <h4>Exchange=<a>#{@zero['fullExchangeName']}</a></h4>\n <h4>Bid=<a>#{@zero['bid']}</a></h4>\n <h4>Ask=<a>#{@zero['ask']}</a></h4>\n </div>\"\n end", "def scrapp_symbols\n\tpage = get_page\n\tcrypto_symbols = page.xpath('//*[@class=\"text-left col-symbol\"]')\n\tcrypto_symbols_array = [] #/ initiliaze the array for stocking all symbols\n\tcrypto_symbols.each do |symbol| #/ put .text to be in string the symbols\n\t\tcrypto_symbols_array << symbol.text \n\tend\n\treturn crypto_symbols_array\nend", "def show\n @inventory_shelf_barcode = InventoryShelfBarcode.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inventory_shelf_barcode }\n end\n end", "def candles(sym='btcusd', options={})\n #Hashie::Mash.new(\n #self.class.get(\"/v1/candles/#{sym}\", options).parsed_response\n nil\n end", "def index\n @money = Money.all\n require 'net/http'\n require 'json'\n @url = 'https://api.coinmarketcap.com/v1/ticker/'\n @uri = URI(@url)\n @response = Net::HTTP.get(@uri)\n @lookup_money = JSON.parse(@response)\n end", "def forex_symbols_with_http_info(exchange, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.forex_symbols ...'\n end\n # verify the required parameter 'exchange' is set\n if @api_client.config.client_side_validation && exchange.nil?\n fail ArgumentError, \"Missing the required parameter 'exchange' when calling DefaultApi.forex_symbols\"\n end\n # resource path\n local_var_path = '/forex/symbol'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'exchange'] = exchange\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Array<ForexSymbol>' \n\n # auth_names\n auth_names = opts[:auth_names] || ['api_key']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#forex_symbols\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n @drawing = Drawing.find(params[:id])\n\n render json: @drawing\n end", "def index\n @symptoms = Symptom.all\n\n render json: @symptoms\n end", "def show\n @sp500_stock = Sp500Stock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sp500_stock }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cn_curve }\n end\n end", "def show\n @tick_track = TickTrack.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tick_track }\n end\n end", "def view_api\n api_string = RestClient.get(\"https://itunes.apple.com/search?term=star+wars&entity=song&attribute=movieTerm\")\n api_hash = JSON.parse(api_string)\n\n end", "def show\n @heart_rate_type = HeartRateType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @heart_rate_type }\n end\n end", "def show\n @eicon = Eicon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @eicon }\n end\n end", "def getStock(symbol)\n\n return StockQuote::Stock.batch([\"quote\",\"logo\"],symbol)\n\n end", "def index\n @icons = Icon.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @icons }\n end\n end", "def show\n @stock_entry = StockEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stock_entry }\n end\n end", "def search \n @stocklist\n if !params[:searchsymbol].blank?\n @stocklist = Stocklist.where(\"symbol like '%#{params[:searchsymbol]}%'\").page(params[:page]).per(30)\n end\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stocklist }\n end\n end", "def show\n @simulation_market = SimulationMarket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @simulation_market }\n end\n end", "def show\n @stock = Stock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stock }\n end\n end", "def show\n @stock = Stock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stock }\n end\n end", "def show\n @stock = Stock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stock }\n end\n end", "def show\n @stock = Stock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stock }\n end\n end", "def show\n @rubygem = Rubygem.find(params[:id])\n\n render json: @rubygem\n end", "def show\n @track = Track.find(params[:id])\n authorize! :show, @track\n gon.track_number = Track.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @track.to_json(:methods => [:polyline],:only => [:name])}\n #format.json { render json: { \"language\" => @languages.as_json(:root => false) }.to_json }\n # render :json => @track.to_json(:methods => [:polyline],:only => [:name])\n end\n end", "def get_symbols\n\t\treturn @symbols\n\tend", "def hotness artist\n url = \"http://developer.echonest.com/api/v4/artist/hotttnesss?api_key=#{ECHONEST_API_KEY}&name=#{artist}&format=json\"\n result = parseURL url\n result[\"response\"][\"artist\"][\"hotttnesss\"]\nend", "def show\n @close_type = CloseType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @close_type }\n end\n end", "def get_chart(options={})\n api_response = @api_client.make_api_request(:GET, \"artist/chart\", {}, options)\n @api_client.chart_item_digestor.list_from_xml(api_response.content.chart)\n end", "def show\n @stock_type = StockType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stock_type }\n end\n end", "def get_xkcd(number)\n \t\t# This works too\n \t\t# JSON.parse self.class.get(\"http://xkcd-unofficial-api.herokuapp.com/xkcd?num=#{number}\")\n \t\tJSON.parse HTTParty.get(\"http://xkcd-unofficial-api.herokuapp.com/xkcd?num=#{number}\")\n \tend", "def get_xkcd(number)\n \t\t# This works too\n \t\t# JSON.parse self.class.get(\"http://xkcd-unofficial-api.herokuapp.com/xkcd?num=#{number}\")\n \t\tJSON.parse HTTParty.get(\"http://xkcd-unofficial-api.herokuapp.com/xkcd?num=#{number}\")\n \tend", "def symbols\n @symbols ||= Array(@grpc.symbols).map do |b|\n Symbol.from_grpc b\n end\n end", "def show\n @graphic = Graphic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @graphic }\n end\n end", "def show\n @graphic = Graphic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @graphic }\n end\n end", "def index\n @tracks = @disc.tracks.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tracks }\n end\n end", "def show\n require 'net/http'\n require 'json'\n\n @url = 'https://api.coinmarketcap.com/v1/ticker/'\n @uri = URI(@url)\n @response = Net::HTTP.get(@uri)\n @show_crypto = JSON.parse(@response)\n end", "def index\n @air_qualities = AirQuality.all\n\n render json: @air_qualities\n end", "def show\n @stock_price = StockPrice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stock_price }\n end\n end", "def index\n @cn_curves = CnCurve.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cn_curves }\n end\n end", "def index\n @tracks = Track.all\n render json: {tracks: @tracks}\n end", "def new\n @glyph = Glyph.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @glyph }\n end\n end", "def show\n @quantile_period = QuantilePeriod.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @quantile_period }\n end\n end", "def crypto_symbols_with_http_info(exchange, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.crypto_symbols ...'\n end\n # verify the required parameter 'exchange' is set\n if @api_client.config.client_side_validation && exchange.nil?\n fail ArgumentError, \"Missing the required parameter 'exchange' when calling DefaultApi.crypto_symbols\"\n end\n # resource path\n local_var_path = '/crypto/symbol'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'exchange'] = exchange\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Array<CryptoSymbol>' \n\n # auth_names\n auth_names = opts[:auth_names] || ['api_key']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#crypto_symbols\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n @inkpmscode = Inkpmscode.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inkpmscode }\n end\n end", "def show\n render json: @key_feature\n end", "def show\n @scheme = Scheme.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @scheme }\n end\n end", "def [](symbol)\n active_charts[symbol]\n end", "def getStock(symbol)\n\n return StockQuote::Stock.batch([\"quote\",\"logo\"],symbol)\n\n end", "def index\n @tickers = TickerSymbol.all\n end", "def show\n @kind = Kind.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kind }\n end\n end", "def show\n @scraping_algorithm = ScrapingAlgorithm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @scraping_algorithm }\n end\n end", "def show\n @gymnasium = Gymnasium.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gymnasium }\n end\n end", "def show\n @finance = Finance.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @finance }\n end\n end", "def show\n drop_breadcrumb(\"股票\")\n drop_breadcrumb(\"#{@stock.name}(#{@stock.market}:#{@stock.code})\")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stock }\n end\n end", "def show\n @work_order = WorkOrder.find(params[:id])\n @markers = @work_order.property.to_gmaps4rails\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @work_order }\n end\n end", "def show\n @testing_algorithm = TestingAlgorithm.find(params[:id])\n\n render json : @testing_algorithm\n end", "def index\n @heart_rate_types = HeartRateType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @heart_rate_types }\n end\n end", "def index\n headers['Last-Modified'] = Time.now.httpdate\n session_id = nil\n\n if !params[:symbols].nil?\n syms = params[:symbols].split(\",\")\n # @stock_options = StockOption.where(symbol: syms)\n @stock_options = []\n\n login_response = AmeritradeHelper.login(params)\n puts \"*** login response #{login_response}\"\n unless login_response.nil?\n session_id = login_response[:session_id]\n login_date = login_response[:login_date]\n end\n\n if !session_id.nil?\n syms.each do |sym|\n # AmeritradeHelper.delete_stock_options(sym)\n new_stock_options = AmeritradeHelper.get_stock_option_symbol(sym, !params[:historic].nil?, params[:minDaysExp], params[:maxDaysExp])\n @stock_options = @stock_options + new_stock_options unless new_stock_options.nil? || !new_stock_options.length\n end\n else\n puts \"*** session id is nil\"\n end\n\n else\n @stock_options = StockOption.all\n end\n\n response = {\n :meta => {\n :session_id => session_id,\n :login_date => login_date\n },\n :data => {\n :stock_options => @stock_options\n }\n }\n\n respond_to do |format|\n format.html\n format.json { render json: response }\n end\n\n # @stock_options = StockOption.all\n end", "def show\n @art = Art.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @art }\n end\n end", "def show\n @rainbow = Rainbow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rainbow }\n end\n end", "def show\n @qrcode = Qrcode.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @qrcode }\n end\n end", "def show\n @portfolio = Portfolio.find(params[:id])\n\n \n # @stocks = YahooFinance.quotes([@portfolio.stocks.group_by(&:stock_symbol)], [:ask, :bid], { raw: false } )\n # additional resources :\n # https://github.com/herval/yahoo-finance\n # https://github.com/rlazoti/yahoofinance-example/blob/master/view_stocks.rb\n\n @stocks = YahooFinance.quotes(@portfolio.stocks.group_by(&:stock_symbol), [:ask, :bid, :symbol, :last_trade_price], { raw: false } )\n \n\n @stock = Stock.new\n @stock.portfolio_id = @portfolio.id\n end", "def show\n @volume_type_extra_spec = VolumeTypeExtraSpec.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @volume_type_extra_spec }\n end\n end", "def show\n @incident_kind = IncidentKind.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @incident_kind }\n end\n end", "def show\n @incomestock = Incomestock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @incomestock }\n end\n end", "def index\n puts params[:cycle_id];\n\n render json: Week.where({cycle_id: params[:cycle_id]}).as_json(\n include: [\n stocks: {\n :include => {\n orders: {\n include: [prossumer: {except: [:encrypted_password, :salt, :confirm_hash]}]\n },\n product: {\n include: [prossumer: {except: [:encrypted_password, :salt, :confirm_hash]}]\n }\n }\n }\n ])\n end", "def show\n @yahoo_deal = YahooDeal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @yahoo_deal }\n end\n end", "def show\n\t\t\t@legend = Legend.find(params[:id])\n\t\t\trespond_to do |format|\n\t\t\t\tformat.html # show.html.erb\n\t\t\t\tformat.json { render json: @legend }\n\t\t\tend\n\t\tend", "def show\n @track = @disc.tracks.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @track }\n end\n end", "def index\n @symboles = Symbole.all\n end", "def show\n @discogs_releases = {}\n @artist_name = get_artist_name\n @discogs_releases = get_discogs_releases_paginated(@artist_name) unless @artist_name.blank?\n\n respond_to do |format|\n format.html # show.html.erb\n #format.xml { render :xml => @artist }\n format.js\n end\n end", "def show\n @attribute_layer = AttributeLayer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @attribute_layer }\n end\n end", "def show\n render json: @power_order\n end", "def index\n json_response(Spot.all)\n end" ]
[ "0.62522185", "0.62159055", "0.6080931", "0.60154706", "0.58741015", "0.58707434", "0.5820864", "0.5763915", "0.573108", "0.5688645", "0.5685", "0.5650858", "0.56318986", "0.56259286", "0.5603981", "0.56001776", "0.55473566", "0.5510422", "0.5482407", "0.547454", "0.5474309", "0.5402384", "0.5402384", "0.539204", "0.5336699", "0.53297323", "0.53163785", "0.5311763", "0.5310753", "0.5300983", "0.5299874", "0.5294169", "0.52878165", "0.528587", "0.5273363", "0.5272752", "0.52718884", "0.5257552", "0.52140445", "0.5207307", "0.5172876", "0.5172083", "0.51693213", "0.51604855", "0.51576805", "0.51363844", "0.51363844", "0.51363844", "0.51363844", "0.51355064", "0.5133339", "0.51282704", "0.5127093", "0.51270527", "0.51254207", "0.5122542", "0.5122235", "0.5122235", "0.5122091", "0.5121465", "0.5121465", "0.51201224", "0.5119643", "0.5119203", "0.5110829", "0.5110793", "0.50916916", "0.50892127", "0.50850666", "0.50792456", "0.50728357", "0.5059617", "0.5054901", "0.5051916", "0.5050705", "0.5049539", "0.5043945", "0.50428116", "0.5041558", "0.50403863", "0.5038793", "0.5020334", "0.502028", "0.50178957", "0.5015932", "0.5014212", "0.50122434", "0.50119454", "0.50088286", "0.50077885", "0.50042814", "0.5003249", "0.50029117", "0.50011426", "0.49926993", "0.49921843", "0.49908507", "0.49866015", "0.49792615", "0.49739954", "0.49700883" ]
0.0
-1
POST /artwork_symbols POST /artwork_symbols.json
def create @artwork_symbol = ArtworkSymbol.new(artwork_symbol_params) respond_to do |format| if @artwork_symbol.save format.html { redirect_to @artwork_symbol, notice: 'Artwork symbol was successfully created.' } format.json { render :show, status: :created, location: @artwork_symbol } else format.html { render :new } format.json { render json: @artwork_symbol.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def artwork_symbol_params\n params[:artwork_symbol].permit(:name)\n end", "def add\n unless TickerSymbol.where(symb: params['new_symbol']).nil?\n url = 'stock/' + params['new_symbol'] + '/company'\n company_data = JSON.parse( get_iex_json( url ) )\n print company_data\n unless company_data == 'Unknown symbol'\n TickerSymbol.create( symb: company_data[\"symbol\"], name: company_data[\"companyName\"], exchange: company_data[\"exchange\"], industry: company_data[\"industry\"], sector: company_data[\"sector\"] )\n end\n end\n render('covered_symbols')\n end", "def destroy\n @artwork_symbol.destroy\n respond_to do |format|\n format.html { redirect_to artwork_symbols_url, notice: 'Artwork symbol was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def update\n respond_to do |format|\n if @artwork_symbol.update(artwork_symbol_params)\n format.html { redirect_to @artwork_symbol, notice: 'Artwork symbol was successfully updated.' }\n format.json { render :show, status: :ok, location: @artwork_symbol }\n else\n format.html { render :edit }\n format.json { render json: @artwork_symbol.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_artwork_symbol\n @artwork_symbol = ArtworkSymbol.find(params[:id])\n end", "def create\n @glyph = Glyph.new(params[:glyph])\n\n respond_to do |format|\n if @glyph.save\n format.html { redirect_to @glyph, notice: 'Glyph was successfully created.' }\n format.json { render json: @glyph, status: :created, location: @glyph }\n else\n format.html { render action: \"new\" }\n format.json { render json: @glyph.errors, status: :unprocessable_entity }\n end\n end\n end", "def stock_params\n params.require(:stock).permit(:symbol)\n end", "def create\n input_params = add_param_instrument_id\n position = @portfolio.positions.new(input_params)\n if position.save\n FeedWorker.perform_async('series_bulk_load', nil, position.instrument.symbol) # Update series for this symbol.\n render json: @portfolio\n else\n render json: position.errors.full_messages, status: :unprocessable_entity\n end\n end", "def stock_params\n params.require(:stock).permit(:ticker_symbol)\n end", "def create\n @favorite_stock = FavoriteStock.new({symbol: favorite_stock_params[:symbol], user_id: current_user[:id]})\n\n respond_to do |format|\n if @favorite_stock.save\n format.html { redirect_to @favorite_stock, notice: 'Favorite stock was successfully created.' }\n format.json { render :show, status: :created, location: @favorite_stock }\n else\n format.html { render :new }\n format.json { render json: @favorite_stock.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @keystroke = Keystroke.new(params[:keystroke])\n\n respond_to do |format|\n if @keystroke.save\n format.html { redirect_to @keystroke, notice: 'Keystroke was successfully created.' }\n format.json { render json: @keystroke, status: :created, location: @keystroke }\n else\n format.html { render action: \"new\" }\n format.json { render json: @keystroke.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_symbols(*symbols)\n @interface.add_symbols(*symbols)\n end", "def create\n artwork = Artwork.new(artwork_params)\n if artwork.save\n render json: artwork\n else\n render json: artwork.errors.full_messages, status: :unprocessable_entity\n end\n end", "def stock_symbols_with_http_info(exchange, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.stock_symbols ...'\n end\n # verify the required parameter 'exchange' is set\n if @api_client.config.client_side_validation && exchange.nil?\n fail ArgumentError, \"Missing the required parameter 'exchange' when calling DefaultApi.stock_symbols\"\n end\n # resource path\n local_var_path = '/stock/symbol'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'exchange'] = exchange\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Array<Stock>' \n\n # auth_names\n auth_names = opts[:auth_names] || ['api_key']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#stock_symbols\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def stock_symbols(exchange, opts = {})\n data, _status_code, _headers = stock_symbols_with_http_info(exchange, opts)\n data\n end", "def index\n @artwork_symbols = ArtworkSymbol.all.paginate(page: params[:page], per_page: 50).order('name ASC')\n end", "def symbole_params\n params.require(:symbole).permit(:lang, :example_fr, :symbole_type, :css_class, :sound, :upload, kanji_attribute_attributes: [:value,:concept, :fr],\n kana_attribute_attributes: [:hiragana_value,:katakana_value, :fr]\n )\n end", "def forex_symbols_with_http_info(exchange, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.forex_symbols ...'\n end\n # verify the required parameter 'exchange' is set\n if @api_client.config.client_side_validation && exchange.nil?\n fail ArgumentError, \"Missing the required parameter 'exchange' when calling DefaultApi.forex_symbols\"\n end\n # resource path\n local_var_path = '/forex/symbol'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'exchange'] = exchange\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Array<ForexSymbol>' \n\n # auth_names\n auth_names = opts[:auth_names] || ['api_key']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#forex_symbols\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def tick_params\n params.require(:tick).permit([:common_name, :scientific_name, :host_species, :common_parasites, :pathogenic_effect, :morphology, :description, :control_measures, :latitude, :longtitude, {tick_image: []}])\n end", "def stock_ticker_params\n params.require(:stock_ticker).permit(:name, :stock_symbol)\n end", "def create\n puts \"params[:symbol_bank][:symbol_image]:::::::::::::#{params[:symbol_bank][:symbol_image].inspect}\"\n puts \"params[:symbol_bank]:::::::::::::#{params[:symbol_bank].inspect}\"\n session[:new_symbols] = Array.new\n bank = params[:symbol_bank][:symbol_image]\n if bank\n bank.each do |sym_bank|\n @symbol_bank_new = SymbolBank.new\n puts \"@symbol_bank::::::::::::#{@symbol_bank_new.inspect}\"\n\n @symbol_bank_new.symbol_image = sym_bank\n @symbol_bank_new.symbol_name = sym_bank.original_filename[/.*(?=\\..+$)/]\n puts \"sym_bank.original_filename :::::::::::::::::#{sym_bank.original_filename.inspect}\"\n sym_bank.original_filename = sym_bank.original_filename[0..sym_bank.original_filename.index(\".\")-1] + \"_\" + \"#{Time.now.to_i}\" + sym_bank.original_filename[sym_bank.original_filename.index(\".\")..sym_bank.original_filename.length]\n @symbol_bank_new.symbol_image_file_name = sym_bank.original_filename\n puts\"image_file_name:::::::::: #{sym_bank.original_filename.inspect}\"\n\n @symbol_bank_new.save\n\n @symbol_bank_new.update_attributes(:image_url => @symbol_bank_new.symbol_image.url(:medium))\n session[:new_symbols] << @symbol_bank_new.id\n end\n end\n flash[:notice] = \"Symbol bank was successfully created.\"\n redirect_to rename_symbols_symbol_banks_path\n\n end", "def create\n prepare_options\n @inventory_shelf_barcode = InventoryShelfBarcode.new(params[:inventory_shelf_barcode])\n\n respond_to do |format|\n if @inventory_shelf_barcode.save\n format.html { redirect_to @inventory_shelf_barcode, notice: 'Inventory shelf barcode was successfully created.' }\n format.json { render json: @inventory_shelf_barcode, status: :created, location: @inventory_shelf_barcode }\n else\n format.html { render action: \"new\" }\n format.json { render json: @inventory_shelf_barcode.errors, status: :unprocessable_entity }\n end\n end\n end", "def legend_params\n params.require(:legend).permit(:FX_rate, :currency, :name, :year_avg_id, :currency_prefix, :status, :createdOn)\n end", "def create_symbols\n # creates all named symbols, including vector references\n @expressions.map { |a| a.create_symbols }\n puts(self.class)\n end", "def create\n @symbole = Symbole.new()\n if symbole_params[:symbole_type].present?\n @symbole.build_kanji_attribute if symbole_params[:symbole_type] == \"kanji\"\n @symbole.build_kana_attribute if symbole_params[:symbole_type] == \"kana\"\n end\n @symbole.assign_attributes(symbole_params)\n\n respond_to do |format|\n if @symbole.save\n format.html { redirect_to @symbole, notice: 'Symbole was successfully created.' }\n format.json { render :show, status: :created, location: @symbole }\n else\n format.html { render :new }\n format.json { render json: @symbole.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @power_order = PowerOrder.new(power_order_params)\n @power_order.save\n render json: @power_order\n end", "def create\n @biomechanical_symmetry = BiomechanicalSymmetry.new(params[:biomechanical_symmetry])\n\n respond_to do |format|\n if @biomechanical_symmetry.save\n format.html { redirect_to @biomechanical_symmetry, notice: 'Biomechanical symmetry was successfully created.' }\n format.json { render json: @biomechanical_symmetry, status: :created, location: @biomechanical_symmetry }\n else\n format.html { render action: \"new\" }\n format.json { render json: @biomechanical_symmetry.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @order_kind = OrderKind.new(order_kind_params)\n\n respond_to do |format|\n if @order_kind.save\n format.html { redirect_to @order_kind, notice: 'Order kind was successfully created.' }\n format.json { render :show, status: :created, location: @order_kind }\n else\n format.html { render :new }\n format.json { render json: @order_kind.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bracket_golfer = BracketGolfer.new(bracket_golfer_params)\n\n respond_to do |format|\n if @bracket_golfer.save\n format.json { respond_with @bracket_golfer }\n else\n format.json { render json: @bracket_golfer.errors, status: :unprocessable_entity }\n end\n end\n end", "def gen_symbols\n @symbols = true\n end", "def remove\n TickerSymbol.where(symb: params['symb']['name']).destroy_all\n render('covered_symbols')\n end", "def create\n @symptom = Symptom.new(symptom_params)\n\n if @symptom.save\n render json: @symptom, status: :created\n else\n render json: @symptom.errors, status: :unprocessable_entity\n end\n end", "def show\n @barcode_list = BarcodeList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @barcode_list }\n format.svg { send_data @barcode_list.data, :type => 'image/svg+xml', :disposition => 'inline' }\n end\n end", "def show\n @barcode_list = BarcodeList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @barcode_list }\n format.svg { send_data @barcode_list.data, :type => 'image/svg+xml', :disposition => 'inline' }\n end\n end", "def new\n @glyph = Glyph.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @glyph }\n end\n end", "def create\n @stroke = Stroke.new(stroke_params)\n\n respond_to do |format|\n if @stroke.save\n format.html { redirect_to @stroke, notice: 'Stroke was successfully created.' }\n format.json { render :show, status: :created, location: @stroke }\n else\n format.html { render :new }\n format.json { render json: @stroke.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @artwork = Artwork.new(artwork_params)\n\n respond_to do |format|\n if @artwork.save\n format.html { redirect_to @artwork, notice: 'Konstverket uppdaterat.' }\n format.json { render action: 'show', status: :created, location: @artwork }\n else\n format.html { render action: 'new' }\n format.json { render json: @artwork.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @keystroke = Keystroke.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @keystroke }\n end\n end", "def create\n @bracket = Bracket.new(params[:bracket])\n\n respond_to do |format|\n if @bracket.save\n format.html { redirect_to @bracket, notice: 'Bracket was successfully created.' }\n format.json { render json: @bracket, status: :created, location: @bracket }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bracket.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @steep_instruction = SteepInstruction.new(steep_instruction_params)\n\n respond_to do |format|\n if @steep_instruction.save\n format.html { redirect_to @steep_instruction, notice: 'Steep instruction was successfully created.' }\n format.json { render :show, status: :created, location: @steep_instruction }\n else\n format.html { render :new }\n format.json { render json: @steep_instruction.errors, status: :unprocessable_entity }\n end\n end\n end", "def item_params\n params.require(:item).permit(:symbol, :name)\n end", "def stock_option_params\n params.require(:stock_option).permit(:symbol, :description, :strike, :call, :mark, :last, :bid, :ask, :theoPrice, :openInterest, :volume, :iv, :percentFromMarket, :probOTM, :delta, :gamma, :theta, :vega, :daysToExpiration, :expiration)\n end", "def create\n if params[:id]\n @legend = Legend.find(params[:id])\n @legend.FX_rate =params[:FX_rate];\n @legend.currency =params[:currency];\n @legend.name =params[:name];\n @legend.currency_prefix =params[:currency_prefix];\n @legend.status =1;\n @legend.createdOn = Time.now.getutc;\n if @legend.save\n render :json => @legend\n else\n render :json => @legend.errors.full_messages, status: :unprocessable_entity\n end\n else\n @legend = Legend.new\n @legend.FX_rate =params[:fxrate];\n @legend.currency =params[:currency];\n @legend.name =params[:currencyName];\n @legend.currency_prefix =params[:currencyPrefix];\n @legend.status =1;\n @legend.createdOn = Time.now.getutc;\n if @legend.save\n render :json => @legend\n else\n render :json => @legend.errors.full_messages, status: :unprocessable_entity\n end\n end \n \n end", "def create\n @yh_graphic = YhGraphic.new(yh_graphic_params)\n\n respond_to do |format|\n if @yh_graphic.save\n format.html { redirect_to @yh_graphic, notice: 'Yh graphic was successfully created.' }\n format.json { render :show, status: :created, location: @yh_graphic }\n else\n format.html { render :new }\n format.json { render json: @yh_graphic.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bar_code = BarCode.new(bar_code_params)\n gen = Barby::Code128B.new(@bar_code.text)\n send_data gen.to_png(:height => 50), :type => \"image/png\", :disposition => \"inline\"\n\n @bar_code.save\n\n\n\n end", "def stock_params\n params.require(:stock).permit(:symbol, :name, :industry_id, :sector_id, :ccc_seq, :price, :yield_years, :div_yield, :old_rate, :new_rate, :mr_inc, :ex_div, :div_record, :div_pay, :qtly_sched, :annual_div, :payout, :i_graham, :p_e, :fye_month, :ttm_eps, :peg_ratio, :ttm_p_sales, :mrq_p_book, :ttm_roe, :ty_growth, :ny_growth, :last_5_growth, :est_5_growth, :na, :mktcap, :inside_own, :debt_equity, :chowder_rule)\n end", "def set_symbols(file_name)\n @symbols = []\n if file_name.nil?\n file_name = File.join(\n File.dirname(File.dirname(File.dirname(__FILE__))),\n 'symbols.xml'\n )\n end\n document = REXML::Document.new(File.read(file_name))\n document.elements.each('symbols/symbol') do |symbol_xml|\n symbol = {}\n symbol[:symbol] = symbol_xml.attribute('symbol').value\n symbol[:description] = @configure.get_parameter(\n symbol_xml.attribute('description').value\n )\n @symbols.push(symbol)\n end\n end", "def create\n @drawing = Drawing.new(params[:drawing])\n\n if @drawing.save\n render json: @drawing, status: :created, location: @drawing\n else\n render json: @drawing.errors, status: :unprocessable_entity\n end\n end", "def create\n @order = Order.new(order_params)\n @order.add_line_items_from_cart(@cart)\n\n respond_to do |format|\n if @order.save\n\n @wine_title = \"[\"\n @cart.line_items.each do |line_item|\n @wine_title += line_item.quantity.to_s\n @wine_title += ' items: '\n @wine_title += line_item.product.title\n @wine_title += ';'\n end\n @wine_title += \"]\"\n\n data = {'name' => @order.name, 'address' => @order.address,\n 'email' => @order.email, 'phone' => @order.phone, \n 'wine' => @wine_title}\n\n url = URI.parse('http://localhost:8080/order')\n req = Net::HTTP::Post.new(url,nitheader = {'Content-Type' =>'application/js on'})\n req.set_form_data(data)\n req.body = data.to_json\n begin\n res = Net::HTTP.start(url.host, url.port) {|http|\n http.request(req)\n }\n rescue\n end\n\n Cart.destroy(session[:cart_id])\n session[:cart_id] = nil\n OrderNotifier.received(@order).deliver\n format.html { redirect_to store_url}\n format.json { render action: 'show', status: :created,\n location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def snowflake_params\n params.require(:snowflake).permit(:shape)\n end", "def create\n new_artwork_share = ArtworkShare.new(artwork_share_params)\n\n if new_artwork_share.save\n render json: new_artwork_share\n else\n render(\n json: new_artwork_share.errors.full_messages, status: :unprocessable_entity\n )\n end\n end", "def favorite_stock_params\n # params.require(:favorite_stock).permit(:user_id, :symbol)\n params.require(:favorite_stock).permit(:symbol)\n end", "def new\n @symbol_bank = SymbolBank.new\n respond_with @symbol_bank\n end", "def create\n symbol = params[:symbol].upcase\n is_existing_stock = current_user.stocks.where(symbol: symbol, run_id: params[:run_id]).flatten.size > 0\n num_of_stocks = current_user.stocks.where( run_id: params[:run_id]).flatten.size\n respond_to do |format|\n if !is_existing_stock && num_of_stocks != 5 && @stocks_util.validate_stock(symbol)\n @stock = current_user.stocks.build({symbol:symbol, run_id: params[:run_id]})\n @stock.save!\n format.json { render json: \"stock_added\" }\n else\n error_msg = \"adding_stock_failed\"\n if num_of_stocks == 5\n error_msg = \"already_5_stocks\"\n elsif is_existing_stock\n error_msg = \"existing_stock\"\n end\n format.json { render json: error_msg }\n end\n end\n end", "def create\n @key_indicate_map_indicator_key = KeyIndicateMap::IndicatorKey.new\n @key_indicate_map_indicator_key.save\n\n respond_to do |format|\n format.js\n format.json { head :no_content }\n end\n end", "def forex_symbols(exchange, opts = {})\n data, _status_code, _headers = forex_symbols_with_http_info(exchange, opts)\n data\n end", "def create\n post_variables = params[:data]\n @symbols = post_variables[:asset]\n @amount_in_cents = post_variables[:amount]\n @desired_return = post_variables[:return_level] / 100\n @epsilon = 0.0000001\n \n\t# @symbols = ['STKS','GOLD','TBLL'] #= post_variables[:assets]\n # @amount_in_cents = 100000 #= post_variables[:amount_in_cents]\n # @desired_return = 0.146 #post_variables[:desired_return]\n # @epsilon = 0.0000001\n\t\n @optimal_portfolio = MinimalRiskPortfolio.new( :return_level => @desired_return )\n @optimal_portfolio.build_portfolio_by_symbols( @symbols )\n\n respond_to do |format|\n format.html { render :xml => @optimal_portfolio.to_xml( :include => :portfolio_assets, :dasherize => false ) }\n format.json { render :json => @optimal_portfolio.to_json( :include => :portfolio_assets ) }\n format.xml { render :xml => @optimal_portfolio.to_xml( :include => :portfolio_assets, :dasherize => false ) }\n end\n end", "def financial_statement_params\n params.require(:financial_statement).permit(:symbol, :name, :price)\n end", "def create\n @measurement = Measurement.new( measurement_params )\n\n # TODO \n unless @measurement.save\n render status: 500, json: @measurement.errors.full_messages\n end\n \n data = {\n circles: @measurement.circles.to_json \n }\n render status: :ok, json: @measurement if @measurement.valid?\n \n end", "def stock_params\n #params.require(:stock).permit(:symbol, :cost, :shares)\n params.require(:stock).permit(:symbol, :cost, :shares)\n end", "def symbols\n @symbols ||= Array(@grpc.symbols).map do |b|\n Symbol.from_grpc b\n end\n end", "def create\n stock_values = Ystock.get_stock(params[:stock_resource][:stock])\n @stock_resource = StockResource.new(:symbol => (stock_values[:symbol]), :price => (stock_values[:price]), :change => (stock_values[:change]), :volume => (stock_values[:volume]))\n\n respond_to do |format|\n if @stock_resource.save\n format.html { redirect_to @stock_resource, notice: 'Stock resource was successfully created.' }\n format.json { render json: @stock_resource, status: :created, location: @stock_resource }\n else\n format.html { render action: \"new\" }\n format.json { render json: @stock_resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n sigcode_params[:language] = sigcode_params[:language].to_i\n sigcode_params[:frequency] = sigcode_params[:frequency].to_i\n\n @sigcode = Sigcode.new(sigcode_params)\n\n respond_to do |format|\n if @sigcode.save\n format.html { redirect_to @sigcode, notice: 'Sigcode was successfully created.' }\n format.json { render :show, status: :created, location: @sigcode }\n else\n format.html { render :new }\n format.json { render json: @sigcode.errors, status: :unprocessable_entity }\n end\n end\n end", "def chart_params\n params.require(:chart).permit(:code, :content, :glcode, :gst, :header, :users_id)\n end", "def post_spoonacular\n # %encode ingredients to url\n encoded_ingr = URI.escape(@translated_recipe[:ingredients_list])\n # post call block :\n url = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/parseIngredients?includeNutrition=true\")\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Post.new(url)\n request[\"content-type\"] = \"application/x-www-form-urlencoded\"\n request[\"x-rapidapi-key\"] = ENV[\"X_RAPIDAPI_KEY\"]\n request[\"x-rapidapi-host\"] = \"spoonacular-recipe-food-nutrition-v1.p.rapidapi.com\"\n # body of the call with ingredients and servings\n request.body = \"ingredientList=#{encoded_ingr}&#{@recipe_hash[:servings]}\"\n # response\n response = http.request(request)\n end", "def new_artwork_params\n params.require(:new_artwork).permit(:name, :year, :medium, :artist_id)\n end", "def create_phaxcode(options)\n send_post(\"/createPhaxCode\", options)\n end", "def stock_params\n params.require(:stock).permit(\n :id,\n :product_id,\n :store_id,\n :g1,\n :g1h,\n :g2,\n :g2h,\n :g3,\n :g3h,\n :g4,\n :g4h,\n :g5,\n :g5h,\n :g6,\n :g6h,\n :g7,\n :g7h,\n :g8,\n :g8h,\n :g9,\n :g9h,\n :g10,\n :g10h,\n :g11,\n :g11h,\n :g12,\n :g12h,\n :g13,\n :g13h,\n :g14,\n :g14h,\n :g15,\n :g16,\n :g17,\n :g18,\n :g19\n )\n end", "def create\n # serialize reference here!\n @instrument = Instrument.new(instrument_params)\n\n respond_to do |format|\n if @instrument.save\n format.html { redirect_to instruments_url(anchor: @instrument.id, letter: startletter), notice: 'Instrument was successfully created.' }\n format.json { render :show, status: :created, location: @instrument }\n else\n format.html { render :new }\n format.json { render json: @instrument.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @legend = Legend.new(legend_params)\n\n respond_to do |format|\n if @legend.save\n format.html { redirect_to @legend, notice: 'Legend was successfully created.' }\n format.json { render :show, status: :created, location: @legend }\n else\n format.html { render :new }\n format.json { render json: @legend.errors, status: :unprocessable_entity }\n end\n end\n end", "def scrapp_symbols\n\tpage = get_page\n\tcrypto_symbols = page.xpath('//*[@class=\"text-left col-symbol\"]')\n\tcrypto_symbols_array = [] #/ initiliaze the array for stocking all symbols\n\tcrypto_symbols.each do |symbol| #/ put .text to be in string the symbols\n\t\tcrypto_symbols_array << symbol.text \n\tend\n\treturn crypto_symbols_array\nend", "def steep_instruction_params\n params.require(:steep_instruction).permit(:temperature, :time, :recipe_id)\n end", "def create\n @winding = Winding.new(winding_params)\n #Codigo para gerar gcode a 90 graus\n generate_gcode\n\n respond_to do |format|\n if @winding.save\n format.html { redirect_to @winding, notice: 'Winding was successfully created.' }\n format.json { render :show, status: :created, location: @winding }\n else\n format.html { render :new }\n format.json { render json: @winding.errors, status: :unprocessable_entity }\n end\n end\n end", "def addstock_params\n params.require(:addstock).permit(:stock, :unit, :material_id)\n end", "def create\n @tick = Tick.new(tick_params)\n\n respond_to do |format|\n if @tick.save\n format.html { redirect_to @tick, notice: 'Tick was successfully created.' }\n format.json { render :show, status: :created, location: @tick }\n else\n format.html { render :new }\n format.json { render json: @tick.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @new_artwork = NewArtwork.new(new_artwork_params)\n\n respond_to do |format|\n if @new_artwork.save\n format.html { redirect_to @new_artwork, notice: 'New artwork was successfully created.' }\n format.json { render :show, status: :created, location: @new_artwork }\n else\n format.html { render :new }\n format.json { render json: @new_artwork.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @svgpost = Svgpost.new(params[:svgpost])\n\n respond_to do |format|\n if @svgpost.save\n format.html { redirect_to @svgpost, notice: 'Svgpost was successfully created.' }\n format.json { render json: @svgpost, status: :created, location: @svgpost }\n else\n format.html { render action: \"new\" }\n format.json { render json: @svgpost.errors, status: :unprocessable_entity }\n end\n end\n end", "def labels_have_symbols!\n end", "def create\n @microfinance_service_provider_typology = MicrofinanceServiceProviderTypology.new(microfinance_service_provider_typology_params)\n\n respond_to do |format|\n if @microfinance_service_provider_typology.save\n format.html { redirect_to @microfinance_service_provider_typology, notice: 'Microfinance service provider typology was successfully created.' }\n format.json { render action: 'show', status: :created, location: @microfinance_service_provider_typology }\n else\n format.html { render action: 'new' }\n format.json { render json: @microfinance_service_provider_typology.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @curve = Curve.new(params[:curve])\n\n respond_to do |format|\n if @curve.save\n format.html { redirect_to @curve, notice: 'Curve was successfully created.' }\n format.json { render json: @curve, status: :created, location: @curve }\n else\n format.html { render action: \"new\" }\n format.json { render json: @curve.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @mbracket = Mbracket.new(mbracket_params)\n\n respond_to do |format|\n if @mbracket.save\n format.html { redirect_to @mbracket, notice: 'Mbracket was successfully created.' }\n format.json { render :show, status: :created, location: @mbracket }\n else\n format.html { render :new }\n format.json { render json: @mbracket.errors, status: :unprocessable_entity }\n end\n end\n end", "def crypto_symbols_with_http_info(exchange, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.crypto_symbols ...'\n end\n # verify the required parameter 'exchange' is set\n if @api_client.config.client_side_validation && exchange.nil?\n fail ArgumentError, \"Missing the required parameter 'exchange' when calling DefaultApi.crypto_symbols\"\n end\n # resource path\n local_var_path = '/crypto/symbol'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'exchange'] = exchange\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Array<CryptoSymbol>' \n\n # auth_names\n auth_names = opts[:auth_names] || ['api_key']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#crypto_symbols\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create\n @instrument_patch = InstrumentPatch.new(instrument_patch_params)\n\n respond_to do |format|\n if @instrument_patch.save\n format.html { redirect_to @instrument_patch, notice: 'Instrument patch was successfully created.' }\n format.json { render action: 'show', status: :created, location: @instrument_patch }\n else\n format.html { render action: 'new' }\n format.json { render json: @instrument_patch.errors, status: :unprocessable_entity }\n end\n end\n end", "def feed_stock_params\n params.require(:feed_stock).permit(:quantidade, :marca, :nome, :id_tipo_animal, :kg)\n end", "def document_symbols(filename); end", "def document_symbols(filename); end", "def create\n @fish_poly = FishPoly.new(fish_poly_params)\n\n respond_to do |format|\n if @fish_poly.save\n format.html { redirect_to @fish_poly, notice: 'Fish poly was successfully created.' }\n format.json { render :show, status: :created, location: @fish_poly }\n else\n format.html { render :new }\n format.json { render json: @fish_poly.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @stock_ticker = StockTicker.new(stock_ticker_params)\n\n respond_to do |format|\n if @stock_ticker.save\n format.html { redirect_to @stock_ticker, notice: 'Stock ticker was successfully created.' }\n format.json { render :show, status: :created, location: @stock_ticker }\n else\n format.html { render :new }\n format.json { render json: @stock_ticker.errors, status: :unprocessable_entity }\n end\n end\n end", "def data_symbol_array\n [:name, :level, :objectives, :prime_objectives, :custom_categories, \n :icon_index, :description, :banner, :banner_hue, :common_event_id, \n :layout, :rewards] + QuestData::BASIC_DATA_TYPES\n end", "def set_search_api\n @url = 'https://api.coinmarketcap.com/v1/ticker/'\n @uri = URI(@url)\n @response = Net::HTTP.get(@uri)\n # converts response to a Ruby hash \n @search_coin = JSON.parse(@response)\n @symbol = params[:sym]\n\n if @symbol\n @symbol = @symbol.upcase\n end \n end", "def create\n @quadra = Quadra.new(quadra_params)\n\n respond_to do |format|\n if @quadra.save\n format.html { redirect_to @quadra, notice: 'Quadra was successfully created.' }\n format.json { render :show, status: :created, location: @quadra }\n else\n format.html { render :new }\n format.json { render json: @quadra.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n @stock = Stock.new(stock_params)\n @stock.ticker = params[:stock][:ticker].upcase\n\n respond_to do |format|\n if @stock.save\n format.html { redirect_to @stock, notice: 'Stock was successfully added to watchlist.' }\n format.json { render :show, status: :created, location: @stock }\n else\n format.html { render :new }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @star_sign = StarSign.new(star_sign_params)\n\n respond_to do |format|\n if @star_sign.save\n format.html { redirect_to @star_sign, notice: 'Star sign was successfully created.' }\n format.json { render :show, status: :created, location: @star_sign }\n else\n format.html { render :new }\n format.json { render json: @star_sign.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @addstock = Addstock.new(addstock_params)\n\n respond_to do |format|\n if @addstock.save\n format.html { redirect_to @addstock, notice: 'Addstock was successfully created.' }\n format.json { render :show, status: :created, location: @addstock }\n else\n format.html { render :new }\n format.json { render json: @addstock.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @power_rack = PowerRack.new(power_rack_params)\n\n respond_to do |format|\n if @power_rack.save\n format.html { redirect_to @power_rack, notice: \"Power rack was successfully created.\" }\n format.json { render :show, status: :created, location: @power_rack }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @power_rack.errors, status: :unprocessable_entity }\n end\n end\n end", "def transaction_params\n params[:transaction][:symbol] = params[:transaction][:symbol].upcase.strip\n params.require(:transaction).permit(:date, :action, :quantity, :symbol, :description, :price, :amount, :fees, :user_id, :action_id)\n end", "def stroke_params\n params.require(:stroke).permit(:theta_id, :type_id, :shape_id, :pos)\n end", "def create\n @hex = Hex.new(hex_params)\n\n respond_to do |format|\n if @hex.save\n format.html { redirect_to @hex, notice: 'Hex was successfully created.' }\n format.json { render :show, status: :created, location: @hex }\n else\n format.html { render :new }\n format.json { render json: @hex.errors, status: :unprocessable_entity }\n end\n end\n end", "def symbols() @symbols end", "def formula_params\n params.require(:formula).permit(:sku, :descripcion, :lote, :unidad, :skuIngerdiente, :ingrediente, :requerimiento, :unidadIngrediente, :precioIngrediente)\n end" ]
[ "0.6378803", "0.59464943", "0.57780564", "0.57773715", "0.55244786", "0.5282606", "0.51991165", "0.51720905", "0.50597924", "0.50492823", "0.5025617", "0.49595976", "0.49579936", "0.495467", "0.49170217", "0.49169332", "0.49082446", "0.48986527", "0.4892236", "0.48704258", "0.48702082", "0.48533976", "0.4842507", "0.4834259", "0.48160875", "0.48157436", "0.48131907", "0.4813086", "0.48075488", "0.48030847", "0.4791867", "0.47885078", "0.47698444", "0.47698444", "0.4761171", "0.47563934", "0.4752803", "0.47423646", "0.47392008", "0.4738457", "0.47314978", "0.47219616", "0.47188297", "0.47130832", "0.4712891", "0.47122034", "0.47032964", "0.4694398", "0.46923617", "0.4688493", "0.46804762", "0.467592", "0.467203", "0.46632883", "0.46608454", "0.46605307", "0.465616", "0.4651669", "0.46139756", "0.46132982", "0.46108946", "0.4607949", "0.4603061", "0.45862898", "0.45823345", "0.4572345", "0.45687723", "0.45439982", "0.45327106", "0.45306173", "0.45258746", "0.45166156", "0.45013356", "0.45012262", "0.44908977", "0.44899708", "0.44897988", "0.44864827", "0.44831008", "0.44794303", "0.44725442", "0.44694328", "0.44658935", "0.44584972", "0.44577506", "0.44577506", "0.44547322", "0.44539586", "0.4452021", "0.4450455", "0.44501877", "0.44479325", "0.44477996", "0.4446768", "0.4442556", "0.44399646", "0.44357765", "0.4429079", "0.44277048", "0.44250733" ]
0.714994
0
PATCH/PUT /artwork_symbols/1 PATCH/PUT /artwork_symbols/1.json
def update respond_to do |format| if @artwork_symbol.update(artwork_symbol_params) format.html { redirect_to @artwork_symbol, notice: 'Artwork symbol was successfully updated.' } format.json { render :show, status: :ok, location: @artwork_symbol } else format.html { render :edit } format.json { render json: @artwork_symbol.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @artwork.update(update_artwork_params)\n format.json { render :show, status: :ok, location: @artwork }\n else\n format.json { render json: @artwork.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @glyph = Glyph.find(params[:id])\n\n respond_to do |format|\n if @glyph.update_attributes(params[:glyph])\n format.html { redirect_to @glyph, notice: 'Glyph was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @glyph.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if params[:id]\n @symbol_bank = SymbolBank.find(params[:id])\n\n respond_to do |format|\n if @symbol_bank.update_attributes(params[:symbol_bank])\n format.html { redirect_to @symbol_bank, notice: 'Symbol bank was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @symbol_bank.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def set_artwork_symbol\n @artwork_symbol = ArtworkSymbol.find(params[:id])\n end", "def update\n respond_to do |format|\n if @new_artwork.update(new_artwork_params)\n format.html { redirect_to @new_artwork, notice: 'New artwork was successfully updated.' }\n format.json { render :show, status: :ok, location: @new_artwork }\n else\n format.html { render :edit }\n format.json { render json: @new_artwork.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @artwork.update(artwork_params)\n format.html { redirect_to @artwork, notice: 'Artwork was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @artwork.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @keystroke = Keystroke.find(params[:id])\n\n respond_to do |format|\n if @keystroke.update_attributes(params[:keystroke])\n format.html { redirect_to @keystroke, notice: 'Keystroke was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @keystroke.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order_kind.update(order_kind_params)\n format.html { redirect_to @order_kind, notice: 'Order kind was successfully updated.' }\n format.json { render :show, status: :ok, location: @order_kind }\n else\n format.html { render :edit }\n format.json { render json: @order_kind.errors, status: :unprocessable_entity }\n end\n end\n end", "def artwork_symbol_params\n params[:artwork_symbol].permit(:name)\n end", "def update\n @volume_type_extra_spec = VolumeTypeExtraSpec.find(params[:id])\n\n respond_to do |format|\n if @volume_type_extra_spec.update_attributes(params[:volume_type_extra_spec])\n format.html { redirect_to @volume_type_extra_spec, notice: 'Volume type extra spec was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @volume_type_extra_spec.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @artwork.update(art_work_params)\n format.html { redirect_to @artwork, notice: 'Art work was successfully updated.' }\n format.json { render :show, status: :ok, location: @artwork }\n else\n format.html { render :edit }\n format.json { render json: @artwork.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @stock = Stock.find(params[:symbol])\n binding.pry\n respond_to do |format|\n if @stock.update_attributes(params[:currentPrice])\n format.html { redirect_to @stock, notice: 'Stock was successfully updated.' }\n format.json { head :ok }\n else\n if @stock.update_attributes(params[:openingPrice])\n format.html { redirect_to @stock, notice: 'Stock was successfully updated.' }\n format.json { head :ok }\n else\n if @stock.update_attributes(params[:closingPrice])\n format.html { redirect_to @stock, notice: 'Stock was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: 'edit' }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end\n end\n end", "def update\n respond_to do |format|\n if @legend.update(legend_params)\n format.html { redirect_to @legend, notice: 'Legend was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @legend.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @symptom = Symptom.find(params[:id])\n\n if @symptom.update(symptom_params)\n render json: @symptom, status: :updated\n else\n render json: @symptom.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @symbole.update(symbole_params)\n format.html { redirect_to @symbole, notice: 'Symbole was successfully updated.' }\n format.json { render :show, status: :ok, location: @symbole }\n else\n format.html { render :edit }\n format.json { render json: @symbole.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @orderable_concept = OrderableConcept.find(params[:id])\n\n respond_to do |format|\n if @orderable_concept.update_attributes(params[:orderable_concept])\n format.html { redirect_to @orderable_concept, notice: 'Orderable concept was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @orderable_concept.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @bracket = Bracket.find(params[:id])\n\n respond_to do |format|\n if @bracket.update_attributes(params[:bracket])\n format.html { redirect_to @bracket, notice: 'Bracket was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bracket.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n\n format.json { render json: Axis.find(params[:id]).update( name: params[:name]) }\n end\n\n # end\n end", "def update\n respond_to do |format|\n if @legend.update(legend_params)\n format.html { redirect_to @legend, notice: 'Legend was successfully updated.' }\n format.json { render :show, status: :ok, location: @legend }\n else\n format.html { render :edit }\n format.json { render json: @legend.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def create\n @artwork_symbol = ArtworkSymbol.new(artwork_symbol_params)\n\n respond_to do |format|\n if @artwork_symbol.save\n format.html { redirect_to @artwork_symbol, notice: 'Artwork symbol was successfully created.' }\n format.json { render :show, status: :created, location: @artwork_symbol }\n else\n format.html { render :new }\n format.json { render json: @artwork_symbol.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tick.update(tick_params)\n format.html { redirect_to @tick, notice: 'Tick was successfully updated.' }\n format.json { render :show, status: :ok, location: @tick }\n else\n format.html { render :edit }\n format.json { render json: @tick.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n position = @portfolio.positions.find(params[:id])\n if position.instrument.symbol != params['instrument_symbol'] # Then we're changing instruments.\n position.instrument_id = nil\n input_params = add_param_instrument_id\n FeedWorker.perform_async('series_bulk_load', nil, params['instrument_symbol']) # Update series for this symbol.\n else\n input_params = position_params\n end\n if position.update(input_params)\n render json: @portfolio\n else\n render json: position.errors.full_messages, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @art_work.update(art_work_params)\n format.html { redirect_to @art_work }\n format.json { render :show, status: :ok, location: @art_work }\n else\n format.html { render :edit }\n format.json { render json: @art_work.errors, status: :unprocessable_entity }\n end\n end\n end", "def update #saves and redirects, saves changes\n @line_item = LineItem.find(params[:id])\n @line_item.quantity = params[:quantity]\n @line_item.size_id = params[:size_id]\n @line_item.save\n render json: @line_item\n end", "def update\n @power_order.update(power_order_params)\n render json: @power_order\n end", "def update\n respond_to do |format|\n if @instrument_patch.update(instrument_patch_params)\n format.html { redirect_to @instrument_patch, notice: 'Instrument patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @instrument_patch.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bracket.update(bracket_params)\n format.html { redirect_to @bracket, notice: 'Bracket was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bracket.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @incident_kind = IncidentKind.find(params[:id])\n\n respond_to do |format|\n if @incident_kind.update_attributes(params[:incident_kind])\n format.html { redirect_to @incident_kind, notice: 'Incident kind was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @incident_kind.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @inventory_shelf_barcode = InventoryShelfBarcode.find(params[:id])\n\n respond_to do |format|\n if @inventory_shelf_barcode.update_attributes(params[:inventory_shelf_barcode])\n format.html { redirect_to @inventory_shelf_barcode, notice: 'Inventory shelf barcode was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @inventory_shelf_barcode.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @icon.update(icon_params)\n @icon.set_color\n @device = @icon.location_device_id ? Device.find(@icon.location_device_id) : {}\n device = decrypt_device(@device)\n render json: {icon: @icon, device: device || @device}\n end", "def update\n respond_to do |format|\n if @standardkind.update(standardkind_params)\n format.html { redirect_to @standardkind, notice: 'Standardkind was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @standardkind.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @biomechanical_symmetry = BiomechanicalSymmetry.find(params[:id])\n\n respond_to do |format|\n if @biomechanical_symmetry.update_attributes(params[:biomechanical_symmetry])\n format.html { redirect_to @biomechanical_symmetry, notice: 'Biomechanical symmetry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @biomechanical_symmetry.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @mystock.update(mystock_params)\n format.html { redirect_to @mystock, notice: 'mystock was successfully updated.' }\n format.json { render :show, status: :ok, location: @mystock }\n else\n format.html { render :edit }\n format.json { render json: @mystock.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @art_work.update(art_work_params)\n format.html { redirect_to @art_work, notice: 'Art work was successfully updated.' }\n format.json { render :show, status: :ok, location: @art_work }\n else\n format.html { render :edit }\n format.json { render json: @art_work.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @asset_stock.update(asset_stock_params)\n format.html { redirect_to @asset_stock, notice: 'Asset stock was successfully updated.' }\n format.json { render :show, status: :ok, location: @asset_stock }\n else\n format.html { render :edit }\n format.json { render json: @asset_stock.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @supermarket = Supermarket.find(params[:id]) \n respond_to do |format|\n if @supermarket.update(supermarket_params)\n format.json { render json: @supermarket, status: :ok }\n end\n end\n end", "def update\n respond_to do |format|\n if @stock_ticker.update(stock_ticker_params)\n format.html { redirect_to @stock_ticker, notice: 'Stock ticker was successfully updated.' }\n format.json { render :show, status: :ok, location: @stock_ticker }\n else\n format.html { render :edit }\n format.json { render json: @stock_ticker.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n ingredient.update(ingredient_params)\n render json: ingredient\n end", "def update\n respond_to do |format|\n if @swatch.update(swatch_params)\n format.html { redirect_to @swatch, notice: 'Swatch was successfully updated.' }\n format.json { render :show, status: :ok, location: @swatch }\n else\n format.html { render :edit }\n format.json { render json: @swatch.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # respond_to:1つのアクションから複数のフォーマットで返す\n respond_to do |format|\n if @stock.update(stock_params)\n \n # 写真のアップロードと保存\n if params[:stock].has_key? :picture\n @stock.picture = params[:stock][\"picture\"].read\n @stock.filename = params[:stock][\"picture\"].original_filename\n @stock.save\n end\n\n format.html { redirect_to @stock, notice: 'Stock was successfully updated.' }\n format.json { render :show, status: :ok, location: @stock }\n else\n format.html { render :edit }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tick_track = TickTrack.find(params[:id])\n\n respond_to do |format|\n if @tick_track.update_attributes(params[:tick_track])\n format.html { redirect_to tick_tracks_url }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tick_track.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @thickness.update(thickness_params)\n format.html { redirect_to @thickness, notice: 'Thickness was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @thickness.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n forbidden unless current_catalog_user.read_artwork\n @artwork.update(artwork_params)\n redirect_to catalog_account_catalog_artworks_path(@account, @catalog)\n end", "def update_suggested_course_pathway\n suggested_pathway = SuggestedPathway.find_by(id: params[:id])\n suggested_pathway.name = params[:name]\n suggested_pathway.year = params[:year]\n suggested_pathway.course_id = params[:course_id]\n suggested_pathway.data = params[:data]\n suggested_pathway.save\n render json: suggested_pathway\n end", "def update\n respond_to do |format|\n if @addstock.update(addstock_params)\n format.html { redirect_to @addstock, notice: 'Addstock was successfully updated.' }\n format.json { render :show, status: :ok, location: @addstock }\n else\n format.html { render :edit }\n format.json { render json: @addstock.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @stroke.update(stroke_params)\n format.html { redirect_to @stroke, notice: 'Stroke was successfully updated.' }\n format.json { render :show, status: :ok, location: @stroke }\n else\n format.html { render :edit }\n format.json { render json: @stroke.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @bowl = Bowl.find(params[:id])\n \n # set bowl modify time\n @bowl.modified = Time.now\n \n respond_to do |format|\n if @bowl.update_attributes(params[:bowl])\n \n Rails.logger.info \"Updating Bowl Contents\"\n \n # remove all contents for this bowl and add new\n @bowl.contents.delete_all(\"bowl_id=\" + @bowl.id)\n \n params.keys.each do |param|\n if param.start_with?(\"input_\") and (params[param] != \"\") \n @bowl.contents.create(:bowl_id => @bowl.id, :dryfruit_id => param[6, 2], :quantity => params[param]) \n end\n end\n\n format.html { redirect_to bowls_path, :notice => 'Bowl was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @bowl.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @stock_option.update(stock_option_params)\n format.html { redirect_to @stock_option, notice: 'Stock option was successfully updated.' }\n format.json { render :show, status: :ok, location: @stock_option }\n else\n format.html { render :edit }\n format.json { render json: @stock_option.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @figure.update(figure_params)\n format.html { redirect_to @figure, notice: 'Figure was successfully updated.' }\n format.json { render :show, status: :ok, location: @figure }\n else\n format.html { render :edit }\n format.json { render json: @figure.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @spotify_artist.update(spotify_artist_params)\n format.html { redirect_to @spotify_artist, notice: 'Spotify artist was successfully updated.' }\n format.json { render :show, status: :ok, location: @spotify_artist }\n else\n format.html { render :edit }\n format.json { render json: @spotify_artist.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # @attribute_layer = @palette.attribute_layers.find(attribute_layer_params[:id])\n respond_to do |format|\n if @attribute_layer.update(attribute_layer_params)\n format.html { redirect_to [@palette, @attribute_layer], notice: 'Attribute layer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @attribute_layer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n respond_to do |format|\n if @fixed_asset.update(fixed_asset_params)\n FixedAsset.reindex\n format.html { redirect_to @fixed_asset, notice: 'Fixed asset was successfully updated.' }\n format.json { render :show, status: :ok, location: @fixed_asset }\n else\n format.html { render :edit }\n format.json { render json: @fixed_asset.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @solidarity.update(solidarity_params)\n format.html { redirect_to @solidarity, notice: 'Solidarity was successfully updated.' }\n format.json { render :show, status: :ok, location: @solidarity }\n else\n format.html { render :edit }\n format.json { render json: @solidarity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @circular.update(circular_params)\n format.html { redirect_to @circular, notice: 'Circular was successfully updated.' }\n format.json { render :show, status: :ok, location: @circular }\n else\n format.html { render :edit }\n format.json { render json: @circular.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @mbracket.update(mbracket_params)\n format.html { redirect_to @mbracket, notice: 'Mbracket was successfully updated.' }\n format.json { render :show, status: :ok, location: @mbracket }\n else\n format.html { render :edit }\n format.json { render json: @mbracket.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @housing_feature = HousingFeature.find(params[:id])\n\n respond_to do |format|\n if @housing_feature.update_attributes(params[:housing_feature])\n format.html { redirect_to @housing_feature, notice: 'Housing feature was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @housing_feature.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \n #在庫マスターのIDをセットする\n update_flag = 1\n\tset_inventories_id\n \n respond_to do |format|\n if @stocktake.update(stocktake_params)\n format.html { redirect_to @stocktake, notice: 'Stocktake was successfully updated.' }\n format.json { render :show, status: :ok, location: @stocktake }\n else\n format.html { render :edit }\n format.json { render json: @stocktake.errors, status: :unprocessable_entity }\n end\n end\n end", "def UpdateTicket params = {}\n \n APICall(path: 'tickets.json',method: 'PUT',payload: params.to_json)\n \n end", "def update\n respond_to do |format|\n if @bracket_golfer.update(bracket_golfer_params)\n format.html { redirect_to @bracket_golfer, notice: 'Bracket golfer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bracket_golfer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @asset.update(price: params[:asset][:price])\n json_response(@asset,:created)\n end", "def update\n respond_to do |format|\n if @power_rack.update(power_rack_params)\n format.html { redirect_to @power_rack, notice: \"Power rack was successfully updated.\" }\n format.json { render :show, status: :ok, location: @power_rack }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @power_rack.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @stock_type = StockType.find(params[:id])\n\n respond_to do |format|\n if @stock_type.update_attributes(params[:stock_type])\n format.html { redirect_to @stock_type, notice: 'Stock type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stock_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @kind = Kind.find(params[:id])\n\n respond_to do |format|\n if @kind.update_attributes(params[:kind])\n format.html { redirect_to @kind, notice: 'Kind was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @kind.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @rack_installation.update(rack_installation_params)\n format.html { redirect_to @rack_installation, notice: 'Rack installation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @rack_installation.errors, status: :unprocessable_entity }\n end\n end\n end", "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end", "def update\n @ope_kind = OpeKind.find(params[:id])\n\n respond_to do |format|\n if @ope_kind.update_attributes(params[:ope_kind])\n format.html { redirect_to @ope_kind, notice: 'Ope kind was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ope_kind.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end", "def update\n @specification = Specification.find(params[:id])\n\n respond_to do |format|\n if @specification.update_attributes(params[:specification])\n format.html { redirect_to @specification, notice: 'Specification was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @specification.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @microfinance_service_provider_typology.update(microfinance_service_provider_typology_params)\n format.html { redirect_to @microfinance_service_provider_typology, notice: 'Microfinance service provider typology was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @microfinance_service_provider_typology.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @artwork_symbol.destroy\n respond_to do |format|\n format.html { redirect_to artwork_symbols_url, notice: 'Artwork symbol was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def update\n respond_to do |format|\n if @artwork_share.update(artwork_share_params)\n format.html { redirect_to @artwork_share, notice: 'Artwork share was successfully updated.' }\n format.json { render :show, status: :ok, location: @artwork_share }\n else\n format.html { render :edit }\n format.json { render json: @artwork_share.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n megam_rest.update_quotas(to_hash)\n end", "def jsonapi_update!(attributes)\n assign_jsonapi_attributes(attributes)\n save!\n end", "def update\n respond_to do |format|\n if @fish_poly.update(fish_poly_params)\n format.html { redirect_to @fish_poly, notice: 'Fish poly was successfully updated.' }\n format.json { render :show, status: :ok, location: @fish_poly }\n else\n format.html { render :edit }\n format.json { render json: @fish_poly.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @formula.update(formula_params)\n format.html { redirect_to @formula, notice: 'Formula was successfully updated.' }\n format.json { render :show, status: :ok, location: @formula }\n else\n format.html { render :edit }\n format.json { render json: @formula.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end", "def update\n @idea = Idea.find(params[:id])\n stock = Stock.find(params[:stock_id])\n @idea.stock = stock\n \n respond_to do |format|\n if @idea.update_attributes(params[:idea])\n format.html { redirect_to(@idea, :notice => 'Idea was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @idea.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n feature.update_attributes(feature_params)\n\n respond_with(feature)\n end", "def update\n @barrack = Barrack.find(params[:id])\n\n respond_to do |format|\n if @barrack.update_attributes(params[:barrack])\n format.html { redirect_to @barrack, notice: 'Barrack was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @barrack.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bar80.update(bar80_params)\n format.html { redirect_to @bar80, notice: \"Bar80 was successfully updated.\" }\n format.json { render :show, status: :ok, location: @bar80 }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @bar80.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @stock = Stock.find(params[:id])\n\n respond_to do |format|\n if @stock.update_attributes(params[:stock])\n format.html { redirect_to stocks_url }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @special_requirement.update(special_requirement_params)\n format.html { redirect_to @special_requirement, notice: 'Special requirement was successfully updated.' }\n format.json { render :show, status: :ok, location: @special_requirement }\n else\n format.html { render :edit }\n format.json { render json: @special_requirement.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @stock.update(stock_params)\n format.html { redirect_to @stock, notice: 'Stock was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @curve = Curve.find(params[:id])\n\n respond_to do |format|\n if @curve.update_attributes(params[:curve])\n format.html { redirect_to @curve, notice: 'Curve was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @curve.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @stock.update(stock_params)\n format.html { redirect_to @stock, notice: 'Stock was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @stock.update(stock_params)\n format.html { redirect_to @stock, notice: 'Stock was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @foo58.update(foo58_params)\n format.html { redirect_to @foo58, notice: \"Foo58 was successfully updated.\" }\n format.json { render :show, status: :ok, location: @foo58 }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @foo58.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ba_spec = BaSpec.find(params[:id])\n\n respond_to do |format|\n if @ba_spec.update_attributes(params[:ba_spec])\n format.html { redirect_to session[:return_to] }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ba_spec.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @mouse_rack.update(mouse_rack_params)\n format.html { redirect_to @mouse_rack, notice: 'Mouse rack was successfully updated.' }\n format.json { render :show, status: :ok, location: @mouse_rack }\n else\n format.html { render :edit }\n format.json { render json: @mouse_rack.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @clothing_line.update(clothing_line_params)\n format.html { redirect_to @clothing_line, notice: 'Clothing line was successfully updated.' }\n format.json { render :show, status: :ok, location: @clothing_line }\n else\n format.html { render :edit }\n format.json { render json: @clothing_line.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product_spec.update(product_spec_params)\n format.html { redirect_to @product_spec, notice: 'Product spec was successfully updated.' }\n format.json { render :show, status: :ok, location: @product_spec }\n else\n format.html { render :edit }\n format.json { render json: @product_spec.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @foo8.update(foo8_params)\n format.html { redirect_to @foo8, notice: \"Foo8 was successfully updated.\" }\n format.json { render :show, status: :ok, location: @foo8 }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @foo8.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n recipe.update(recipe_params)\n render json: recipe\n end", "def update\n respond_to do |format|\n if @bar8.update(bar8_params)\n format.html { redirect_to @bar8, notice: \"Bar8 was successfully updated.\" }\n format.json { render :show, status: :ok, location: @bar8 }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @bar8.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n product = Product.find(params[:id])\n product_details = params.permit(:title, :inventory_count, :price)\n\n product.update(product_details)\n\n render json: product\n end", "def update\n @close_type = CloseType.find(params[:id])\n\n respond_to do |format|\n if @close_type.update_attributes(params[:close_type])\n format.html { redirect_to @close_type, notice: 'Close type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @close_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @series_type = SeriesType.find(params[:id])\n\n respond_to do |format|\n if @series_type.update_attributes(params[:series_type])\n format.html { redirect_to @series_type, notice: 'Series type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @series_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @series = Series.find(params[:id])\n\n respond_to do |format|\n if @series.update_attributes(params[:series])\n format.html { redirect_to @series, notice: 'Series was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @series.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @steep_instruction.update(steep_instruction_params)\n format.html { redirect_to @steep_instruction, notice: 'Steep instruction was successfully updated.' }\n format.json { render :show, status: :ok, location: @steep_instruction }\n else\n format.html { render :edit }\n format.json { render json: @steep_instruction.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6401142", "0.6156533", "0.59854776", "0.59761703", "0.5907662", "0.58929586", "0.58716685", "0.5844132", "0.5839373", "0.58336985", "0.5831616", "0.58088213", "0.578173", "0.5771749", "0.5754246", "0.5739941", "0.5724849", "0.57183", "0.57160056", "0.57133716", "0.5705371", "0.56956893", "0.56934017", "0.56887156", "0.5687618", "0.5671", "0.56665635", "0.56482047", "0.5634846", "0.5623652", "0.56073797", "0.56055486", "0.5596693", "0.5594791", "0.5583414", "0.55578303", "0.55492586", "0.5534575", "0.5528985", "0.55251646", "0.55248845", "0.5511806", "0.55030733", "0.5502009", "0.5499257", "0.5487032", "0.5486238", "0.54839396", "0.5476475", "0.5473637", "0.54720664", "0.5465271", "0.5461999", "0.54557717", "0.54458964", "0.544496", "0.5442678", "0.54340655", "0.54336655", "0.54332906", "0.5431167", "0.54310703", "0.5428083", "0.54247046", "0.54209244", "0.5417401", "0.5409989", "0.53918684", "0.5386359", "0.5380513", "0.5377663", "0.53774714", "0.5376227", "0.53761613", "0.53723794", "0.537005", "0.5364858", "0.5363065", "0.53619325", "0.5361471", "0.5361155", "0.535836", "0.53537416", "0.5353056", "0.53528744", "0.5352545", "0.5352545", "0.53515095", "0.53499144", "0.53493404", "0.53485894", "0.53443176", "0.53431416", "0.53402203", "0.5340099", "0.53393173", "0.5339011", "0.5333307", "0.5331044", "0.53270656" ]
0.7428222
0
DELETE /artwork_symbols/1 DELETE /artwork_symbols/1.json
def destroy @artwork_symbol.destroy respond_to do |format| format.html { redirect_to artwork_symbols_url, notice: 'Artwork symbol was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n puts \"I M IN DESTROY\"\n puts \"params[symbol_id]::::::::::::#{params[symbol_id]}\"\n @symbol_bank = SymbolBank.find(params[:id])\n @symbol_bank.destroy\n\n respond_to do |format|\n format.html { redirect_to symbol_banks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @artwork.destroy\n respond_to do |format|\n format.html { redirect_to artworks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @glyph = Glyph.find(params[:id])\n @glyph.destroy\n\n respond_to do |format|\n format.html { redirect_to glyphs_url }\n format.json { head :ok }\n end\n end", "def destroy\n return if new_record?\n \n @api.delete \"/items/#{shortcode_url}.json\"\n end", "def destroy\n @keystroke = Keystroke.find(params[:id])\n @keystroke.destroy\n\n respond_to do |format|\n format.html { redirect_to keystrokes_url }\n format.json { head :no_content }\n end\n end", "def remove\n TickerSymbol.where(symb: params['symb']['name']).destroy_all\n render('covered_symbols')\n end", "def destroy\n @pix = Pix.find(params[:id])\n @pix.destroy\n\n respond_to do |format|\n format.html { redirect_to pixes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @icon.destroy\n render json: @icon\n end", "def destroy\n @legend.destroy\n respond_to do |format|\n format.html { redirect_to legends_url, notice: 'Legend was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @thickness.destroy\n respond_to do |format|\n format.html { redirect_to thicknesses_url }\n format.json { head :no_content }\n end\n end", "def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end", "def destroy\n @curve = Curve.find(params[:id])\n @curve.destroy\n\n respond_to do |format|\n format.html { redirect_to curves_url }\n format.json { head :no_content }\n end\n end", "def destroy\n id = params[:id]\n @physical_rack = PhysicalRack.any_of({_id: id}, {name: id.gsub('-', '.')}).first\n @physical_rack.destroy\n\n respond_to do |format|\n format.html { redirect_to physical_racks_url }\n format.json { head :ok }\n end\n end", "def destroy\n @jam_circle.destroy\n respond_to do |format|\n format.html { redirect_to jam_circles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @baz72.destroy\n respond_to do |format|\n format.html { redirect_to baz72s_url, notice: \"Baz72 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @symbole.destroy\n respond_to do |format|\n format.html { redirect_to symboles_url, notice: 'Symbole was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @instrument_patch.destroy\n respond_to do |format|\n format.html { redirect_to instrument_patches_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @artwork.destroy\n respond_to do |format|\n format.html { redirect_to artworks_url, notice: 'Art work was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @tick.destroy\n respond_to do |format|\n format.html { redirect_to ticks_url, notice: 'Tick was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @biomechanical_symmetry = BiomechanicalSymmetry.find(params[:id])\n @biomechanical_symmetry.destroy\n\n respond_to do |format|\n format.html { redirect_to biomechanical_symmetries_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bracket.destroy\n respond_to do |format|\n format.html { redirect_to brackets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @gymnasium = Gymnasium.find(params[:id])\n @gymnasium.destroy\n\n respond_to do |format|\n format.html { redirect_to gymnasia_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ruby.destroy\n respond_to do |format|\n format.html { redirect_to rubies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @figure.destroy\n respond_to do |format|\n format.html { redirect_to figures_url, notice: 'Figure was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bg_measurement.destroy\n respond_to do |format|\n format.html { redirect_to bg_measurements_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bg_measurement.destroy\n respond_to do |format|\n format.html { redirect_to bg_measurements_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @microfinance_service_provider_typology.destroy\n respond_to do |format|\n format.html { redirect_to microfinance_service_provider_typologies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @barrack = Barrack.find(params[:id])\n @barrack.destroy\n\n respond_to do |format|\n format.html { redirect_to barracks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @stroke.destroy\n respond_to do |format|\n format.html { redirect_to strokes_url, notice: 'Stroke was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @mystock.destroy\n respond_to do |format|\n format.html { redirect_to mystocks_path, notice: 'mystock was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bar84.destroy\n respond_to do |format|\n format.html { redirect_to bar84s_url, notice: \"Bar84 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @tick_track = TickTrack.find(params[:id])\n @tick_track.destroy\n\n respond_to do |format|\n format.html { redirect_to tick_tracks_url }\n format.json { head :no_content }\n end\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def destroy\n @baz8.destroy\n respond_to do |format|\n format.html { redirect_to baz8s_url, notice: \"Baz8 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @bar64.destroy\n respond_to do |format|\n format.html { redirect_to bar64s_url, notice: \"Bar64 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @baz80.destroy\n respond_to do |format|\n format.html { redirect_to baz80s_url, notice: \"Baz80 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @figure.destroy\n respond_to do |format|\n format.html { redirect_to @figure.comic, notice: 'Figure was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @steep_instruction.destroy\n respond_to do |format|\n format.html { redirect_to steep_instructions_url, notice: 'Steep instruction was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end", "def destroy\n @structure_drawing.destroy\n respond_to do |format|\n format.html { redirect_to project_sub_project_structure_drawings_path(@project, @sub_project), notice: 'Structure drawing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @line_item1 = LineItem1.find(params[:id])\n @line_item1.destroy\n\n respond_to do |format|\n format.html { redirect_to line_item1s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @new_artwork.destroy\n respond_to do |format|\n format.html { redirect_to new_artworks_url, notice: 'New artwork was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @htc.destroy\n respond_to do |format|\n format.html { redirect_to htcs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @formula.destroy\n respond_to do |format|\n format.html { redirect_to formulas_url, notice: 'Formula was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @drawable = Drawable.find(params[:id])\n @drawable.destroy\n\n respond_to do |format|\n format.html { redirect_to drawables_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bracket = Bracket.find(params[:id])\n @bracket.destroy\n\n respond_to do |format|\n format.html { redirect_to brackets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @instruction_set = InstructionSet.get(params[:id])\n @instruction_set.destroy\n\n respond_to do |format|\n format.html { redirect_to instruction_sets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @baz62.destroy\n respond_to do |format|\n format.html { redirect_to baz62s_url, notice: \"Baz62 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @volume_type_extra_spec = VolumeTypeExtraSpec.find(params[:id])\n @volume_type_extra_spec.destroy\n\n respond_to do |format|\n format.html { redirect_to volume_type_extra_specs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @aliexpress = Aliexpress.find(params[:id])\n @aliexpress.destroy\n\n respond_to do |format|\n format.html { redirect_to aliexpresses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bar8.destroy\n respond_to do |format|\n format.html { redirect_to bar8s_url, notice: \"Bar8 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @crossbowtype.destroy\n respond_to do |format|\n format.html { redirect_to crossbowtypes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @special_instruction = SpecialInstruction.find(params[:id])\n @special_instruction.destroy\n\n respond_to do |format|\n format.html { redirect_to special_instructions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @inventory_shelf_barcode = InventoryShelfBarcode.find(params[:id])\n @inventory_shelf_barcode.destroy\n\n respond_to do |format|\n format.html { redirect_to inventory_shelf_barcodes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bar80.destroy\n respond_to do |format|\n format.html { redirect_to bar80s_url, notice: \"Bar80 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @mbracket.destroy\n respond_to do |format|\n format.html { redirect_to mbrackets_url, notice: 'Mbracket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @invoice_addon_line_item.destroy\n respond_to do |format|\n format.html { redirect_to invoice_addon_line_items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @musictrack.destroy\n respond_to do |format|\n format.html { redirect_to musictracks_url, notice: 'Musictrack was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bar71.destroy\n respond_to do |format|\n format.html { redirect_to bar71s_url, notice: \"Bar71 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @band.destroy\n respond_to do |format|\n format.html { redirect_to bands_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @price_schema.destroy\n respond_to do |format|\n format.html { redirect_to price_schemas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n# @chart = Chart.find(params[:id])\n @chart.destroy\n\n respond_to do |format|\n format.html { redirect_to charts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @art_work.destroy\n respond_to do |format|\n format.html { redirect_to :back}\n format.json { head :no_content }\n end\n end", "def destroy\n @conditioninfograph = Conditioninfograph.find(params[:id])\n @conditioninfograph.destroy\n\n respond_to do |format|\n format.html { redirect_to conditioninfographs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @circle.destroy\n head :no_content \n end", "def destroy\n @lineitem.destroy\n respond_to do |format|\n format.html { redirect_to lineitems_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @gastronomium.destroy\n respond_to do |format|\n format.html { redirect_to gastronomia_url, notice: 'Gastronomium was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @manage_glow.destroy\n respond_to do |format|\n format.html { redirect_to manage_glows_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bracket_golfer.destroy\n respond_to do |format|\n format.html { redirect_to bracket_golfers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @power_rack.destroy\n respond_to do |format|\n format.html { redirect_to power_racks_url, notice: \"Power rack was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @music_disc.destroy\n respond_to do |format|\n format.html { redirect_to music_discs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sims_instrument_configuration = SimsInstrumentConfiguration.find(params[:id])\n @sims_instrument_configuration.destroy\n\n respond_to do |format|\n format.html { redirect_to sims_instrument_configurations_url }\n format.json { head :ok }\n end\n end", "def destroy\n @draw = Draw.find(params[:id])\n @draw.destroy\n\n respond_to do |format|\n format.html { redirect_to draws_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cn_curve.destroy\n respond_to do |format|\n format.html { redirect_to cn_curves_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @asthenium.destroy\n respond_to do |format|\n format.html { redirect_to asthenia_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @rackitem = Rackitem.find(params[:id])\n @rackitem.destroy\n\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Rackitem removed' }\n format.json { head :no_content }\n end\n end", "def destroy\n @dis_additive_frequency.destroy\n respond_to do |format|\n format.html { redirect_to dis_additive_frequencies_url, notice: 'Dis additive frequency was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @svgpost = Svgpost.find(params[:id])\n @svgpost.destroy\n\n respond_to do |format|\n format.html { redirect_to svgposts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mystic.destroy\n respond_to do |format|\n format.html { redirect_to mystics_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @drawing = Drawing.find(params[:id])\n @drawing.destroy\n\n head :no_content\n end", "def destroy\n @yh_graphic.destroy\n respond_to do |format|\n format.html { redirect_to yh_graphics_url, notice: '그래픽 삭제 되었습니다.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bg_setup = BgSetup.find(params[:id])\n @bg_setup.destroy\n\n respond_to do |format|\n format.html { redirect_to bg_setups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @aquarium = Aquarium.find(params[:id])\n @aquarium.destroy\n\n respond_to do |format|\n format.html { redirect_to aquaria_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @autopart = Autopart.find(params[:id])\n @autopart.destroy\n\n respond_to do |format|\n format.html { redirect_to autoparts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @simulation_market = SimulationMarket.find(params[:id])\n @simulation_market.destroy\n\n respond_to do |format|\n format.html { redirect_to simulation_markets_url }\n format.json { head :ok }\n end\n end", "def destroy\n @foo64.destroy\n respond_to do |format|\n format.html { redirect_to foo64s_url, notice: \"Foo64 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @ruby = Ruby.find(params[:id])\n @ruby.destroy\n\n respond_to do |format|\n format.html { redirect_to rubies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @quantile_setting = QuantileSetting.find(params[:id])\n @quantile_setting.destroy\n\n respond_to do |format|\n format.html { redirect_to quantile_settings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @rack_installation.destroy\n respond_to do |format|\n format.html { redirect_to rack_installations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @aliquotum = Aliquotum.find(params[:id])\n @aliquotum.destroy\n\n respond_to do |format|\n format.html { redirect_to aliquota_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @package_line.destroy\n respond_to do |format|\n format.html { redirect_to package_lines_url, notice: 'Package line was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @extent_unit = ExtentUnit.find(params[:id])\n @extent_unit.destroy\n\n respond_to do |format|\n format.html { redirect_to extent_units_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @trade_line.destroy\n respond_to do |format|\n format.html { redirect_to trade_lines_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @material_quantity_label = MaterialQuantityLabel.find(params[:id])\n @material_quantity_label.destroy\n\n respond_to do |format|\n format.html { redirect_to material_quantity_labels_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @imes_d189h.destroy\n respond_to do |format|\n format.html { redirect_to imes_d189hs_url, notice: 'D189h was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @barcode_asset.destroy\n respond_to do |format|\n format.html { redirect_to barcode_assets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @artwork_share.destroy\n respond_to do |format|\n format.html { redirect_to artwork_shares_url, notice: 'Artwork share was successfully destroyed.' }\n format.json { head :no_content }\n end\n end" ]
[ "0.6554079", "0.64874136", "0.64738995", "0.6438851", "0.6438309", "0.6408298", "0.6335878", "0.62948143", "0.62923104", "0.6262431", "0.6260801", "0.625162", "0.62472206", "0.62459564", "0.6244179", "0.62413037", "0.6236513", "0.62326914", "0.6221972", "0.62209034", "0.6208281", "0.6205195", "0.620465", "0.61973476", "0.61910295", "0.61910295", "0.6189327", "0.6176809", "0.6168383", "0.6166703", "0.6165267", "0.6157715", "0.61493796", "0.61450696", "0.6144905", "0.61445683", "0.6139223", "0.61360973", "0.6132611", "0.6132014", "0.6129286", "0.61257017", "0.6122594", "0.61206615", "0.61205167", "0.6120051", "0.61132175", "0.6106878", "0.6105851", "0.6104265", "0.6101037", "0.6100059", "0.6099218", "0.60991704", "0.6096085", "0.60954124", "0.6095292", "0.6094758", "0.60919315", "0.60914516", "0.6087757", "0.60870564", "0.60848486", "0.60813206", "0.60811937", "0.60810083", "0.6080606", "0.6080134", "0.6079341", "0.607858", "0.60784477", "0.6077401", "0.6073035", "0.60730165", "0.6072882", "0.60723794", "0.6071378", "0.6066674", "0.6066674", "0.6065981", "0.606552", "0.6064627", "0.6060365", "0.6060321", "0.6049357", "0.6049133", "0.60478663", "0.6047668", "0.6047447", "0.6046348", "0.604515", "0.6041286", "0.6041283", "0.6037495", "0.6031322", "0.6029694", "0.60285264", "0.60232276", "0.60217994", "0.6020998" ]
0.7441761
0
Use callbacks to share common setup or constraints between actions.
def set_artwork_symbol @artwork_symbol = ArtworkSymbol.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def artwork_symbol_params params[:artwork_symbol].permit(:name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def valid_params_request?; end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def safe_params\n params.require(:user).permit(:name)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def active_code_params\n params[:active_code].permit\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def filtering_params\n params.permit(:email)\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def list_params\n params.permit(:name)\n end", "def filter_parameters; end", "def filter_parameters; end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def url_whitelist; end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def permit_request_params\n params.permit(:address)\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def url_params\n params[:url].permit(:full)\n end", "def backend_user_params\n params.permit!\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "0.6980957", "0.6783065", "0.6747844", "0.6741468", "0.67356336", "0.6592548", "0.65036845", "0.64978707", "0.64825076", "0.64795035", "0.64560914", "0.64397955", "0.6379666", "0.6376688", "0.6366702", "0.6319728", "0.6300833", "0.6300629", "0.6294277", "0.6293905", "0.6291174", "0.62905735", "0.6283171", "0.6242344", "0.62403613", "0.6218049", "0.62143815", "0.62104696", "0.61949855", "0.6178671", "0.6176147", "0.6173327", "0.6163395", "0.6153005", "0.6151833", "0.6147288", "0.61224324", "0.6118827", "0.61075264", "0.61054534", "0.6092497", "0.6080082", "0.60710967", "0.60627776", "0.60219413", "0.60175914", "0.60153484", "0.60107356", "0.60081726", "0.60081726", "0.60013986", "0.6000165", "0.59978646", "0.59936947", "0.59925723", "0.5992084", "0.59796256", "0.5967569", "0.5960056", "0.59589803", "0.5958441", "0.5958401", "0.5952607", "0.5952406", "0.5944409", "0.59391016", "0.593842", "0.593842", "0.5933845", "0.59312123", "0.5926475", "0.59248453", "0.59179676", "0.59109294", "0.59101623", "0.5908172", "0.59058356", "0.5899052", "0.5897749", "0.5896101", "0.58942914", "0.58939576", "0.5892063", "0.5887407", "0.588292", "0.58797663", "0.587367", "0.58681566", "0.5868038", "0.5866578", "0.58665025", "0.58655846", "0.58640826", "0.5863465", "0.5862226", "0.586065", "0.58581287", "0.5854443", "0.5854172", "0.58507544", "0.5849934" ]
0.0
-1
GET /premios GET /premios.json
def index @premios = Premio.all respond_to do |format| format.html # index.html.erb format.json { render :json => @premios } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @premios = Premio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @premios }\n end\n end", "def index\n @macs = Mac.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @macs }\n end\n end", "def show\n @premio = Premio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @premio }\n end\n end", "def index\n require 'rest-client'\n response = RestClient::Request.execute(method: :get, url: 'localhost:3001/colores',\n headers: {page: params[:page], items: 9})\n if response.code == 200\n body = JSON.parse(response.body)\n @colors = body[\"data\"]\n @page = body[\"page\"]\n end\n end", "def get_response_getc_mode(question)\n terminal.raw_no_echo_mode_exec do\n response = @input.getc\n question.format_answer(response)\n end\n end", "def get_data str\n #lines = `ri -f ansi #{str} 2>&1`.gsub('\u001b[m','\u001b[0m').split(\"\\n\")\n oe, s = Open3.capture2e(\"ri -f ansi #{str}\")\n lines = oe.gsub('\u001b[m','\u001b[0m').split(\"\\n\")\nend", "def read_host_info\n json { execute_prlctl('server', 'info', '--json') }\n end", "def read_settings(uuid = @uuid)\n vm = json { execute_prlctl('list', uuid, '--info', '--no-header', '--json') }\n vm.last\n end", "def raw!\n Vedeu.log(\"Configuration::API terminal_mode: :raw\")\n\n options[:terminal_mode] = :raw\n end", "def cooked!\n Vedeu.log(\"Configuration::API terminal_mode: :cooked\")\n\n options[:terminal_mode] = :cooked\n end", "def get_response_character_mode(question)\n terminal.raw_no_echo_mode_exec do\n response = terminal.get_character\n if question.overwrite\n erase_current_line\n else\n echo = question.get_echo_for_response(response)\n say(\"#{echo}\\n\")\n end\n question.format_answer(response)\n end\n end", "def color(line)\n if STDOUT.isatty and ENV['TERM'].to_s.include? 'color'\n puts \"\\n\\u001b[35;1m#{line}\\u001b[0m\"\n else\n puts \"\\n\" + line\n end\nend", "def get_character( input = STDIN )\n old_settings = Termios.getattr(input)\n\n new_settings = old_settings.dup\n new_settings.c_lflag &= ~(Termios::ECHO | Termios::ICANON)\n new_settings.c_cc[Termios::VMIN] = 1\n\n begin\n Termios.setattr(input, Termios::TCSANOW, new_settings)\n input.getc\n ensure\n Termios.setattr(input, Termios::TCSANOW, old_settings)\n end\n end", "def get_command\n puts MNV[:pre_prompt] if MNV.key?(:pre_prompt)\n get(prompt: MNV[:prompt])\n rescue MiniReadlinePLE => err\n retry unless handle_get_error(err, :prompt)\n exit\n end", "def atributos\n p \"El Modelo del carro es: #{@modelo}, la Marca es: #{@marca} y el Color es: #{@color}\"\n end", "def get_character( input = STDIN )\n old_settings = Termios.getattr(input)\n\n new_settings = old_settings.dup\n new_settings.c_lflag &= ~(Termios::ECHO | Termios::ICANON)\n new_settings.c_cc[Termios::VMIN] = 1\n\n begin\n Termios.setattr(input, Termios::TCSANOW, new_settings)\n input.getc\n ensure\n Termios.setattr(input, Termios::TCSANOW, old_settings)\n end\n end", "def index\n colorizers = Colorizer.all\n\n render json: colorizers\n end", "def getc\n read(1)\n end", "def scan_for_colors\n scan(/\\033\\[([0-9;]+)m(.+?)\\033\\[0m|([^\\033]+)/m).map do |match|\n split_colors(match)\n end\n end", "def scan_for_colors\n scan(/\\033\\[([0-9;]+)m(.+?)\\033\\[0m|([^\\033]+)/m).map do |match|\n split_colors(match)\n end\n end", "def get_proselint_json path\n json = `proselint \"#{path}\" --json`.strip\n if json[0] == \"{\" and json[-1] == \"}\"\n JSON.parse json\n else\n {}\n end\n end", "def index\n @uchronias = Uchronia.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @uchronias }\n end\n end", "def index\n @themes = Theme.all\n json_response(@themes)\n end", "def how_to\n system(\"clear\")\n font = font_instance\n prompt = prompt_instance\n file = File.read('how_to_play.json')\n how_to=JSON.parse(file)\n puts font.write(\"How To Play\")\n puts how_to \n prompt.select(\"\", show_help: :never) do |menu|\n menu.choice \"Back\", -> {start_menu} \n end\nend", "def getc\n system \"/bin/stty raw -echo\"\n if STDIN.respond_to?(:getbyte)\n STDIN.getbyte\n else\n STDIN.getc\n end\n ensure\n system \"/bin/stty -raw echo\"\n end", "def index\n\t\t@keyboard_shortcuts = current_user.keyboard_shortcuts.all\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.xml { render :xml => @keyboard_shortcuts }\n\t\t\tformat.json { render :json => @keyboard_shortcuts }\n\t\t\tformat.yaml { render :text => @keyboard_shortcuts.to_yaml, :content_type => 'text/yaml' }\n\t\tend\n\tend", "def random\n Client.get(\"/colors/random\")\n end", "def list\n @colors = Admin::Color.all\n\n render json: { colors: @colors }\n end", "def get_color(key)\n if key.is_a? String\n color = key\n elsif Wirb::COLORS.key?(key)\n color = Wirb::COLORS[key]\n end\n\n color ? \"\\033[#{ color }m\" : ''\n end", "def get\n @cine = Cine.find(params[:cine_id], :select => [\"nombre\",\"id\",\"direccion\",\"localidad\"])\n render :json => [ @cine, :peliculas => @cine.peliculas.select('titulo,horas,pelicula_id') ]\n end", "def index\n @color_schemes = ColorScheme.all\n end", "def get_char\n system('stty raw -echo 2>/dev/null') # turn raw input on\n c = nil\n # if $stdin.ready?\n c = $stdin.getc\n cn = c.ord\n return 'ENTER' if cn == 10 || cn == 13\n return 'BACKSPACE' if cn == 127\n return 'C-SPACE' if cn == 0\n return 'SPACE' if cn == 32\n # next does not seem to work, you need to bind C-i\n return 'TAB' if cn == 8\n\n if cn >= 0 && cn < 27\n x = cn + 96\n return \"C-#{x.chr}\"\n end\n if c == '\u001b'\n buff = c.chr\n loop do\n k = nil\n if $stdin.ready?\n k = $stdin.getc\n # puts \"got #{k}\"\n buff += k.chr\n else\n x = @kh[buff]\n return x if x\n\n # puts \"returning with #{buff}\"\n if buff.size == 2\n ## possibly a meta/alt char\n k = buff[-1]\n return \"M-#{k.chr}\"\n end\n return buff\n end\n end\n end\n # end\n return c.chr if c\nensure\n # system('stty -raw echo 2>/dev/null') # turn raw input on\n # 2019-03-29 - echo was causing printing of arrow key code on screen\n # if moving fast\n system('stty -raw 2>/dev/null') # turn raw input on\nend", "def getM()\n\t\[email protected]\n\tend", "def get_prefectures\n server_response = handle_timeouts do\n get '/1/neighborhoods.json?locale=en'\n end\n server_response['response']\n end", "def index\n @pre_print_types = PrePrintType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pre_print_types }\n end\n end", "def list_colors\n color_string = \"\\nThe available colors are \"\n COLORS.each_with_index do |color, index|\n if index%2 == 0\n color_string += \"\\n\"\n end\n color_string += color + \" \"\n end\n puts color_string\n end", "def show\n @mac = Mac.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mac }\n end\n end", "def start_color\n \"\\033[\"\n end", "def show\n render json: @prompt.serialized_data\n end", "def index\n @commands = Command.all\n render :json => @commands\n end", "def colorNormal\n puts \"\\033[0m\"\n end", "def activate_256_colors\n require 'ruco/file_store'\n (\n # not windows\n RbConfig::CONFIG['host_os'] !~ /mswin|mingw/ and\n\n # possible to open xterm-256color\n ['xterm', 'xterm-256color'].include?(ENV['TERM']) and\n Ruco::FileStore.new('~/.ruco/cache').cache('color_possible'){\n system(%{TERM=xterm-256color ruby -r curses -e 'Curses.noecho' > /dev/null 2>&1})\n }\n\n # finally switch terminal, so curses knows we want colors\n ) and ENV['TERM'] = 'xterm-256color'\nend", "def index\n @patrocinios = Patrocinio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @patrocinios }\n end\n end", "def get\n @io.gets\n end", "def read_command\n $stdin.noecho do |noecho|\n noecho.raw do |raw|\n raw.getc.tap do |command|\n # Consume PageUp or PageDown if present. No other ANSI escape sequence is\n # supported so a blind 3.times getc is enough.\n 3.times { command << raw.getc } if command == \"\\e\"\n end\n end\n end\nend", "def show\n @uchronia = Uchronia.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @uchronia }\n end\n end", "def std_colors\n FFI::NCurses.use_default_colors\n # 2018-03-17 - changing it to ncurses defaults\n FFI::NCurses.init_pair(0, FFI::NCurses::BLACK, -1)\n FFI::NCurses.init_pair(1, FFI::NCurses::RED, -1)\n FFI::NCurses.init_pair(2, FFI::NCurses::GREEN, -1)\n FFI::NCurses.init_pair(3, FFI::NCurses::YELLOW, -1)\n FFI::NCurses.init_pair(4, FFI::NCurses::BLUE, -1)\n FFI::NCurses.init_pair(5, FFI::NCurses::MAGENTA, -1)\n FFI::NCurses.init_pair(6, FFI::NCurses::CYAN, -1)\n FFI::NCurses.init_pair(7, FFI::NCurses::WHITE, -1)\n # ideally the rest should be done by application\n #FFI::NCurses.init_pair(8, FFI::NCurses::WHITE, -1)\n #FFI::NCurses.init_pair(9, FFI::NCurses::BLUE, -1)\n FFI::NCurses.init_pair(10, FFI::NCurses::BLACK, FFI::NCurses::CYAN)\n FFI::NCurses.init_pair(12, FFI::NCurses::BLACK, FFI::NCurses::BLUE)\n FFI::NCurses.init_pair(13, FFI::NCurses::BLACK, FFI::NCurses::MAGENTA)\n\n FFI::NCurses.init_pair(14, FFI::NCurses::WHITE, FFI::NCurses::CYAN)\n=begin\n FFI::NCurses.init_pair(8, FFI::NCurses::WHITE, FFI::NCurses::BLUE)\n FFI::NCurses.init_pair(9, FFI::NCurses::BLUE, FFI::NCurses::BLUE)\n FFI::NCurses.init_pair(10, FFI::NCurses::BLACK, FFI::NCurses::GREEN)\n FFI::NCurses.init_pair(11, FFI::NCurses::BLACK, FFI::NCurses::YELLOW)\n FFI::NCurses.init_pair(12, FFI::NCurses::BLACK, FFI::NCurses::BLUE)\n FFI::NCurses.init_pair(13, FFI::NCurses::BLACK, FFI::NCurses::MAGENTA)\n FFI::NCurses.init_pair(14, FFI::NCurses::BLACK, FFI::NCurses::CYAN)\n FFI::NCurses.init_pair(15, FFI::NCurses::BLACK, FFI::NCurses::WHITE)\n=end\n end", "def styles\n respond_to do |format|\n format.json{ render :json => helpers.get_style(params[:style_id], :json) }\n end\n end", "def show\n @condclima = Condclima.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @condclima }\n end\n end", "def show\n @env_pref = EnvPref.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @env_pref }\n end\n end", "def list\n ret = get('/')\n return [] if ret.kind_of?(Hash)\n ret.lines.map{|i|i.chomp}\n end", "def index\n @pluto_environment_variables = collection\n\n respond_to do |format|\n format.json { render json: @pluto_environment_variables }\n end\n end", "def show\n @concurso = Concurso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @concurso }\n end\n end", "def get_single_char\n printf \"> \"\n tty_param = `stty -g`\n system 'stty raw'\n input_single_char = IO.read '/dev/stdin', 1\n system \"stty #{tty_param}\"\n# print \"#{input_single_char}\\n\"\n\nreturn input_single_char\n\nend", "def read_file\r\n\t\treturn File.readlines( COLOR_FILE ).map{ |line| line.chomp }\r\n\tend", "def list_colors\n colors_raw = search_colors_shopstyle\n colors = formats_colors_hash(colors_raw)\n render json: { status: 0, data: {colors: colors} }\n end", "def get_color\n\tputs \"Client's favorite color:\"\n\tcolor = gets.chomp\nend", "def index\n @concursos = Concurso.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @concursos }\n end\n end", "def colorize(params)\n return self unless STDOUT.isatty\n\n begin\n require \"Win32/Console/ANSI\" if RUBY_PLATFORM.match?(/win32/)\n rescue LoadError\n raise \"You must gem install win32console to use colorize on Windows\"\n end\n\n color_parameters = {}\n\n if params.instance_of?(Hash)\n color_parameters[:color] = COLORS[params[:color]]\n color_parameters[:background] = COLORS[params[:background]]\n color_parameters[:mode] = MODES[params[:mode]]\n elsif params.instance_of?(Symbol)\n color_parameters[:color] = COLORS[params]\n end\n\n color_parameters[:color] ||= @color ||= COLORS[:default]\n color_parameters[:background] ||= @background ||= COLORS[:default]\n color_parameters[:mode] ||= @mode ||= MODES[:default]\n\n color_parameters[:uncolorized] ||= @uncolorized ||= dup\n\n # calculate bright mode\n color_parameters[:color] += 50 if color_parameters[:color] > 10\n\n color_parameters[:background] += 50 if color_parameters[:background] > 10\n\n \"\\033[#{color_parameters[:mode]};#{color_parameters[:color] + 30};\"\\\n \"#{color_parameters[:background] + 40}m#{color_parameters[:uncolorized]}\\033[0m\"\\\n .color_parameters(color_parameters)\n end", "def get_char\n begin\n system(\"stty raw -echo 2>/dev/null\") # turn raw input on\n c = nil\n #if $stdin.ready?\n c = $stdin.getc\n cn=c.ord\n return \"ENTER\" if cn == 13\n return \"BACKSPACE\" if cn == 127\n return \"C-SPACE\" if cn == 0\n return \"SPACE\" if cn == 32\n # next does not seem to work, you need to bind C-i\n return \"TAB\" if cn == 8\n if cn >= 0 && cn < 27\n x= cn + 96\n return \"C-#{x.chr}\"\n end\n if c == '\u001b'\n buff=c.chr\n while true\n k = nil\n if $stdin.ready?\n k = $stdin.getc\n #puts \"got #{k}\"\n buff += k.chr\n else\n x=$kh[buff]\n return x if x\n #puts \"returning with #{buff}\"\n if buff.size == 2\n ## possibly a meta/alt char\n k = buff[-1]\n return \"M-#{k.chr}\"\n end\n return buff\n end\n end\n end\n #end\n return c.chr if c\n ensure\n #system \"stty -raw echo\" # turn raw input off\n system(\"stty -raw echo 2>/dev/null\") # turn raw input on\n end\nend", "def get_character_hash(link)\n all_characters = RestClient.get(link)\n character_hash = JSON.parse(all_characters)\nend", "def get_char(options)\n if options[:raw]\n WinAPI.getch.chr\n else\n options[:echo] ? @input.getc : WinAPI.getch.chr\n end\n end", "def get_char\n begin\n system(\"stty raw -echo 2>/dev/null\") # turn raw input on\n c = nil\n #if $stdin.ready?\n c = $stdin.getc\n cn=c.ord\n return \"ENTER\" if cn == 10 || cn == 13\n return \"BACKSPACE\" if cn == 127\n return \"C-SPACE\" if cn == 0\n return \"SPACE\" if cn == 32\n # next does not seem to work, you need to bind C-i\n return \"TAB\" if cn == 8\n if cn >= 0 && cn < 27\n x= cn + 96\n return \"C-#{x.chr}\"\n end\n if c == '\u001b'\n buff=c.chr\n while true\n k = nil\n if $stdin.ready?\n k = $stdin.getc\n #puts \"got #{k}\"\n buff += k.chr\n else\n x=$kh[buff]\n return x if x\n #puts \"returning with #{buff}\"\n if buff.size == 2\n ## possibly a meta/alt char\n k = buff[-1]\n return \"M-#{k.chr}\"\n end\n return buff\n end\n end\n end\n #end\n return c.chr if c\n ensure\n #system \"stty -raw echo\" # turn raw input off\n system(\"stty -raw echo 2>/dev/null\") # turn raw input on\n end\nend", "def get_char\n begin\n system(\"stty raw -echo 2>/dev/null\") # turn raw input on\n c = nil\n #if $stdin.ready?\n c = $stdin.getc\n cn=c.ord\n return \"ENTER\" if cn == 10 || cn == 13\n return \"BACKSPACE\" if cn == 127\n return \"C-SPACE\" if cn == 0\n return \"SPACE\" if cn == 32\n # next does not seem to work, you need to bind C-i\n return \"TAB\" if cn == 8\n if cn >= 0 && cn < 27\n x= cn + 96\n return \"C-#{x.chr}\"\n end\n if c == '\u001b'\n buff=c.chr\n while true\n k = nil\n if $stdin.ready?\n k = $stdin.getc\n #puts \"got #{k}\"\n buff += k.chr\n else\n x=$kh[buff]\n return x if x\n #puts \"returning with #{buff}\"\n if buff.size == 2\n ## possibly a meta/alt char\n k = buff[-1]\n return \"M-#{k.chr}\"\n end\n return buff\n end\n end\n end\n #end\n return c.chr if c\n ensure\n #system \"stty -raw echo\" # turn raw input off\n system(\"stty -raw echo 2>/dev/null\") # turn raw input on\n end\nend", "def read_char\n STDIN.echo = false\n STDIN.raw!\n\n input = STDIN.getc.chr\n exit(1) if input == \"\\u0003\"\n if input == \"\\e\" then\n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\nensure\n STDIN.cooked!\n STDIN.echo = true\n \n\n return input\nend", "def index\n @colegios = Colegio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @colegios }\n end\n end", "def get_console_char\n STDIN.getch\n end", "def index\n @preparatoria_o_universidad_de_origens = PreparatoriaOUniversidadDeOrigen.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @preparatoria_o_universidad_de_origens }\n end\n end", "def colors\n Outpost::Config.instance.colors\n end", "def index\n\t\t@keyboard_shortcut_profiles = current_user.keyboard_shortcut_profiles.all\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.xml { render :xml => @keyboard_shortcut_profiles }\n\t\t\tformat.json { render :json => @keyboard_shortcut_profiles }\n\t\t\tformat.yaml { render :text => @keyboard_shortcut_profiles.to_yaml, :content_type => 'text/yaml' }\n\t\tend\n\tend", "def determine_color_scheme\n @default_options.color_scheme = @highline.choose do |menu|\n menu.layout = :one_line\n menu.select_by = :name\n menu.header = nil\n menu.prompt = \"What color scheme would you like? \"\n menu.choice(\"none\") { :none }\n menu.choice(\"dark terminal background\") { :dark_bg }\n menu.choice(\"light terminal background\") { :light_bg }\n end\n end", "def convert_man_to_ansi file\n lines = file.split \"\\n\"\n l = nil\n lines.each_with_index do |line, ix|\n # convert underlined words to yellow or one color, these are usually params\n line.gsub!(/((_\b[^ ])+)/,'\u001b[4;33m\\1\u001b[0m')\n line.gsub!(/_\b/,'')\n # convert bold words to red or one color, these are usually headers and other words\n l= line.gsub(/(([^ ]\b[^ ])+)/,'\u001b[1;31m\\1\u001b[0m').gsub(/[^ ]\b/,'').gsub(/\b/,'')\n lines[ix] = l\n end\n lines\nend", "def index\n @ores = Ore.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ores }\n end\n end", "def get_colors_from_player(prompt)\n\t\twhile true\n\t\t\tcolors = encode_input Mastermind.get_user_input(prompt)\n\t\t\treturn colors unless colors.nil?\n\t\t\tputs Mastermind.color(INVALID_INPUT_MESSAGE, \"error\")\n\t\tend\n\tend", "def index\n @attris = Attri.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @attris }\n end\n end", "def colors\n color_codes.keys\n end", "def detect_rs io\n rs = \"\\x0d\"\n mark = io.pos\n begin\n while ch = io.readchar\n case ch\n when 0x0d\n ch2 = io.readchar\n if ch2 == 0x0a\n rs = \"\\x0d\\x0a\"\n end\n break\n when 0x0a\n rs = \"\\x0a\"\n break\n end\n end\n ensure\n io.pos = mark\n end\n rs\n end", "def find(hex)\n Client.get(\"/color/#{hex}\")\n end", "def show\n @keystroke = Keystroke.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @keystroke }\n end\n end", "def get_mode\n send_request(FUNCTION_GET_MODE, [], '', 1, 'C')\n end", "def show\n @capacitacion = Capacitacion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @capacitacion }\n end\n end", "def recebeLista\n\n file = File.read('secrets.json')\n @info = JSON.parse(file)\n palavraSecreta\n end", "def show\n @caixa = Caixa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @caixa }\n end\n end", "def show\n @indicativo = Indicativo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @indicativo }\n end\n end", "def readkey\n system('stty raw -echo') # => Raw mode, no echo\n c = (STDIN.read_nonblock(1).ord rescue nil)\n system('stty -raw echo') # => Reset terminal mode\n c\nend", "def index\n \n @controles_asistencias = ControlAsistencia.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @controles_asistencias }\n end\n end", "def index\n @formatos = Formato.where(ativo: true)\n \t\n render json: @formatos\n end", "def show\n @termin = Termin.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @termin }\n end\n end", "def new\n @premio = Premio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @premio }\n end\n end", "def show\n @capacidad = Capacidad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @capacidad }\n end\n end", "def show\n @contacter = Contacter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contacter }\n end\n end", "def mode\n @mode = Vedeu.config.terminal_mode\n end", "def index\n @ginasios = Ginasio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ginasios }\n end\n end", "def show\n @contratacao = Contratacao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contratacao }\n end\n end", "def read_single_key\n c = read_char\n\n case c\n\n when \"\\r\"\n return \"RETURN\"\n when \"\\e\"\n return \"SAVE\"\n when \"\\e[A\"\n return \"w\"\n when \"\\e[B\"\n return \"s\"\n when \"\\e[C\"\n return \"d\"\n when \"\\e[D\"\n return \"a\"\n\n when \"\\u0003\"\n puts \"CONTROL-C\"\n exit 0\n else\n return \"SOMETHING ELSE: #{c.inspect}\"\n end\n end", "def show\n @rainbow = Rainbow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rainbow }\n end\n end", "def detect_mode\n if ENV['NO_COLOR'] # see https://no-color.org/\n 0\n elsif RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ # windows\n if ENV['ANSICON']\n 16\n elsif ENV['ConEmuANSI'] == 'ON'\n TRUE_COLOR\n else\n 0\n end\n elsif ENV['TERM_PROGRAM'] == 'Apple_Terminal'\n 256\n else\n case ENV['TERM']\n when /^rxvt-(?:.*)-256color$/\n 256\n when /-color$/, /^rxvt/\n 16\n else # optimistic default\n TRUE_COLOR\n end\n end\n end", "def print_colors\n 1.upto(6) { |i| print \"#{i} = \" + \"\\u2b24\".color(COLORS[i]) + \" \" }\n print \": \"\nend", "def get_char\n begin\n # save previous state of stty\n old_state = `stty -g`\n # disable echoing and enable raw (not having to press enter)\n system 'stty raw -echo'\n char = STDIN.getc.chr\n # gather next two characters of special keys\n if char == \"\\e\"\n char << STDIN.read_nonblock(3) rescue nil\n char << STDIN.read_nonblock(2) rescue nil\n end\n\n # restore previous state of stty\n system \"stty #{old_state}\"\n end\n\n key = IOChar.char_to_key(char)\n\n if key == 'ctrl-c' or key == 'ctrl-d'\n raise Interrupt\n end\n\n char\n end", "def color_table\n [0, 1, 4, 5, 7].each do |attr|\n puts '----------------------------------------------------------------'\n puts \"ESC[#{attr};Foreground;Background\"\n 30.upto(37) do |fg|\n 40.upto(47) do |bg|\n print \"\\033[#{attr};#{fg};#{bg}m #{fg};#{bg} \"\n end\n puts \"\\033[0m\"\n end\n end\n end" ]
[ "0.54381204", "0.49589175", "0.4860609", "0.48284027", "0.4828282", "0.48077327", "0.47667992", "0.4723793", "0.47224036", "0.46959007", "0.46837342", "0.4683084", "0.45838615", "0.45586723", "0.45445442", "0.45441124", "0.45243973", "0.45045248", "0.44735324", "0.44735324", "0.44519016", "0.4437086", "0.44087824", "0.44069085", "0.43897542", "0.43852898", "0.438254", "0.4382417", "0.43769217", "0.43721285", "0.43702343", "0.43622646", "0.43563357", "0.43553707", "0.4353719", "0.43516693", "0.43511036", "0.43499726", "0.43485528", "0.43459925", "0.43422538", "0.43421078", "0.4336072", "0.4333437", "0.43282712", "0.43148583", "0.43119323", "0.43089557", "0.43058458", "0.430432", "0.43037438", "0.42913178", "0.42902508", "0.4285715", "0.42826864", "0.42804292", "0.42733967", "0.42709184", "0.42695364", "0.42626995", "0.42570215", "0.42541718", "0.42518863", "0.42518863", "0.4245327", "0.4243726", "0.4238724", "0.42336988", "0.42319465", "0.42315856", "0.42302248", "0.42232975", "0.42220816", "0.42217362", "0.42185766", "0.42175546", "0.42150003", "0.42088094", "0.4207332", "0.42062", "0.4205823", "0.42044878", "0.42027104", "0.4199671", "0.41991428", "0.4198931", "0.41982096", "0.41976446", "0.41948804", "0.41943392", "0.41914207", "0.4191297", "0.41908693", "0.4180153", "0.4178597", "0.41766182", "0.41757277", "0.41732842", "0.4168959", "0.41680527" ]
0.6312335
0
GET /premios/1 GET /premios/1.json
def show @premio = Premio.find(params[:id]) #guarda o id do prêmio usado para mostrar o mesmo prêmio após selecionado #também usado para gerar o cupom e deixar o id do prêmio escondido session[:premio_id] = params[:id] respond_to do |format| format.html # show.html.erb format.json { render :json => { :imagem_info => @premio.imagem_info.url, :link_to_imagem_topo => @premio.empresa.link_to_imagem_topo, :imagem_topo => @premio.empresa.imagem_topo.url, :link_to_imagem_meio => @premio.empresa.link_to_imagem_meio, :imagem_meio => @premio.empresa.imagem_meio.url, :link_to_imagem_inferior => @premio.empresa.link_to_imagem_inferior, :imagem_inferior => @premio.empresa.imagem_inferior.url, :descricao => @premio.descricao, :sorteio => @premio.sorteio.strftime("%d/%m/%Y"), :logado => usuario_signed_in? } } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @premios = Premio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @premios }\n end\n end", "def index\n @premios = Premio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @premios }\n end\n end", "def show\n @premio = Premio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @premio }\n end\n end", "def index\n @macs = Mac.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @macs }\n end\n end", "def index\n require 'rest-client'\n response = RestClient::Request.execute(method: :get, url: 'localhost:3001/colores',\n headers: {page: params[:page], items: 9})\n if response.code == 200\n body = JSON.parse(response.body)\n @colors = body[\"data\"]\n @page = body[\"page\"]\n end\n end", "def show\n @uchronia = Uchronia.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @uchronia }\n end\n end", "def show\n @condclima = Condclima.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @condclima }\n end\n end", "def show\n @mac = Mac.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mac }\n end\n end", "def show\n @contacter = Contacter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contacter }\n end\n end", "def index\n @uchronias = Uchronia.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @uchronias }\n end\n end", "def show\n @caixa = Caixa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @caixa }\n end\n end", "def show\n @colegio = Colegio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @colegio }\n end\n end", "def read_settings(uuid = @uuid)\n vm = json { execute_prlctl('list', uuid, '--info', '--no-header', '--json') }\n vm.last\n end", "def get\n @cine = Cine.find(params[:cine_id], :select => [\"nombre\",\"id\",\"direccion\",\"localidad\"])\n render :json => [ @cine, :peliculas => @cine.peliculas.select('titulo,horas,pelicula_id') ]\n end", "def show\n @concurso = Concurso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @concurso }\n end\n end", "def get_proselint_json path\n json = `proselint \"#{path}\" --json`.strip\n if json[0] == \"{\" and json[-1] == \"}\"\n JSON.parse json\n else\n {}\n end\n end", "def show\n @termin = Termin.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @termin }\n end\n end", "def get_data str\n #lines = `ri -f ansi #{str} 2>&1`.gsub('\u001b[m','\u001b[0m').split(\"\\n\")\n oe, s = Open3.capture2e(\"ri -f ansi #{str}\")\n lines = oe.gsub('\u001b[m','\u001b[0m').split(\"\\n\")\nend", "def show\n @anuncio = Anuncio.find(params[:id])\n\n respond_to do |format|\n format.html\n format.json { render json: @anuncio }\n end\n end", "def show\n @patrocinio = Patrocinio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @patrocinio }\n end\n end", "def index\n @patrocinios = Patrocinio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @patrocinios }\n end\n end", "def show\n @rainbow = Rainbow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rainbow }\n end\n end", "def show\n @pologeno = Pologeno.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pologeno }\n end\n end", "def show\n @indicativo = Indicativo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @indicativo }\n end\n end", "def index\n @themes = Theme.all\n json_response(@themes)\n end", "def show\n @capacitacion = Capacitacion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @capacitacion }\n end\n end", "def show\n @consumo = Consumo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @consumo }\n end\n end", "def index\n colorizers = Colorizer.all\n\n render json: colorizers\n end", "def index\n @formatos = Formato.where(ativo: true)\n \t\n render json: @formatos\n end", "def show\n @capacidad = Capacidad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @capacidad }\n end\n end", "def new\n @premio = Premio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @premio }\n end\n end", "def index\n @colegios = Colegio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @colegios }\n end\n end", "def new\n @premio = Premio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @premio }\n end\n end", "def show\n @colegiatura = Colegiatura.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @colegiatura }\n end\n end", "def index\n @attris = Attri.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @attris }\n end\n end", "def show\n @tipo_contrato = TipoContrato.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_contrato }\n end\n end", "def show\n @coisa = Coisa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @coisa }\n end\n end", "def show\n @tipo_pensum = TipoPensum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_pensum }\n end\n end", "def show\n @matricula = Matricula.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @matricula }\n end\n end", "def show\n @tecnico = Tecnico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tecnico }\n end\n end", "def show\n @tecnico = Tecnico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tecnico }\n end\n end", "def show\n @contratacao = Contratacao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contratacao }\n end\n end", "def show\r\n @imobiliaria = Imobiliaria.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.json { render json: @imobiliaria }\r\n end\r\n end", "def show\n @indicacao = Indicacao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @indicacao }\n end\n end", "def styles\n respond_to do |format|\n format.json{ render :json => helpers.get_style(params[:style_id], :json) }\n end\n end", "def show\n @remedio = Remedio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @remedio }\n end\n end", "def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n puts JSON.pretty_generate(result)\n result\nend", "def random\n Client.get(\"/colors/random\")\n end", "def show\n @color = Color.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @color }\n end\n end", "def show\n @prioridade = Prioridade.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @prioridade }\n end\n end", "def find(hex)\n Client.get(\"/color/#{hex}\")\n end", "def show\n @aroma = Aroma.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @aroma }\n end\n end", "def show\n @tecnico = Tecnico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @tecnico }\n end\n end", "def show\n @japan_style = JapanStyle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @japan_style }\n end\n end", "def show\n @env_pref = EnvPref.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @env_pref }\n end\n end", "def show\n @relogio = Relogio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @relogio }\n end\n end", "def show\n @attri = Attri.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @attri }\n end\n end", "def show\n @inscrito = Inscrito.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inscrito }\n end\n end", "def show\n @cppic = Cppic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cppic }\n end\n end", "def getc\n read(1)\n end", "def show\n @microposr = Microposr.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @microposr }\n end\n end", "def show\n @uniprot = Uniprot.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @uniprot }\n end\n end", "def show\n unless possui_acesso?()\n return\n end\n @matricula = Matricula.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @matricula }\n end\n end", "def read_host_info\n json { execute_prlctl('server', 'info', '--json') }\n end", "def show\n @theme = Theme.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @theme }\n end\n end", "def index\n @fundamental_settings = Fundamental::Setting.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fundamental_settings }\n end\n end", "def show\n @incucai = Incucai.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @incucai }\n end\n end", "def get_json(path)\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n #puts \"🤖 GET #{path}\"\n #puts \"HTTP #{response.code}\"\n #puts JSON.pretty_generate(result)\n result\nend", "def show\n @cuerpo = Cuerpo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cuerpo }\n end\n end", "def show\n @theme = Theme.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @theme }\n end\n end", "def show\n @theme = Theme.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @theme }\n end\n end", "def show\n @scheme = Scheme.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @scheme }\n end\n end", "def show\n @personal_characteristic = PersonalCharacteristic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @personal_characteristic }\n end\n end", "def how_to\n system(\"clear\")\n font = font_instance\n prompt = prompt_instance\n file = File.read('how_to_play.json')\n how_to=JSON.parse(file)\n puts font.write(\"How To Play\")\n puts how_to \n prompt.select(\"\", show_help: :never) do |menu|\n menu.choice \"Back\", -> {start_menu} \n end\nend", "def show\n @respuesta = Respuesta.find(params[:id])\n\n render json: @respuesta\n end", "def show\n @modelo = Modelo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @modelo }\n end\n end", "def show\n @contum = Contum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contum }\n end\n end", "def show\n @prioridade_adocao = PrioridadeAdocao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @prioridade_adocao }\n end\n end", "def show\n @anuncio= set_anuncio\n render json: @anuncio, status: :ok\n end", "def index\n @ginasios = Ginasio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ginasios }\n end\n end", "def show\n @complaint = Complaint.find(params[:id])\n\n render json: @complaint\n end", "def show\n @cita = Cita.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cita }\n end\n end", "def show\n @title = \"Характеристика\"\n @user_type = UserType.find(current_user.user_type_id)\n \n @f_characteristic = FCharacteristic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @f_characteristic }\n end\n end", "def color(line)\n if STDOUT.isatty and ENV['TERM'].to_s.include? 'color'\n puts \"\\n\\u001b[35;1m#{line}\\u001b[0m\"\n else\n puts \"\\n\" + line\n end\nend", "def index\n @concursos = Concurso.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @concursos }\n end\n end", "def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n #puts JSON.pretty_generate(result)\n result\nend", "def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n #puts JSON.pretty_generate(result)\n result\nend", "def index\n @conseilles = Conseille.all\n respond_to do |format|\n format.html\n format.json { render json: @conseilles}\n end\n end", "def show\n @articulo = Articulo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @articulo }\n end\n end", "def show\n @articulo = Articulo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @articulo }\n end\n end", "def show\n @articulo = Articulo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @articulo }\n end\n end", "def show\n @ruby = Ruby.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ruby }\n end\n end", "def index\n @ores = Ore.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ores }\n end\n end", "def show\n @servicio = Servicio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @servicio }\n end\n end", "def get_character_hash(link)\n all_characters = RestClient.get(link)\n character_hash = JSON.parse(all_characters)\nend", "def show\n @virus_characteristic = VirusCharacteristic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @virus_characteristic }\n end\n end", "def show\n @reconocimiento = Reconocimiento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @reconocimiento }\n end\n end", "def show\n @areco = Areco.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @areco }\n end\n end", "def show\n @remito = Remito.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @remito }\n end\n end", "def get_theme\n respond theme, 200, {'Content-Type' => 'text/plain'}\n end", "def index\n @territorios = Territorio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @territorios }\n end\n end" ]
[ "0.64763045", "0.55373096", "0.53275496", "0.51645803", "0.5062449", "0.4977302", "0.48390958", "0.48354864", "0.48310083", "0.48145878", "0.48032904", "0.48012805", "0.48006594", "0.47947574", "0.47871035", "0.4786237", "0.47764516", "0.47752002", "0.47679973", "0.4766983", "0.47361284", "0.4728327", "0.47252703", "0.4717456", "0.47150144", "0.4714374", "0.46999592", "0.46986008", "0.46985954", "0.46926153", "0.46858576", "0.4683305", "0.46633646", "0.4660203", "0.4653946", "0.46518236", "0.46457788", "0.46408364", "0.4638139", "0.463386", "0.463386", "0.46311462", "0.46256295", "0.4620687", "0.46187416", "0.46177402", "0.46164063", "0.4608409", "0.46081293", "0.46064106", "0.46015882", "0.4598348", "0.4595158", "0.4594728", "0.45939204", "0.45868415", "0.45772508", "0.45757046", "0.45755234", "0.4574796", "0.45720372", "0.45711666", "0.45702314", "0.45678952", "0.45648775", "0.45594758", "0.45535564", "0.4541387", "0.4535385", "0.453483", "0.453483", "0.4534736", "0.45312732", "0.45310515", "0.45298457", "0.45256063", "0.4524834", "0.45215327", "0.45215076", "0.45176378", "0.45175034", "0.45142174", "0.45126837", "0.45117143", "0.45088702", "0.45069236", "0.45069236", "0.45022893", "0.45014605", "0.45014605", "0.45014605", "0.4500224", "0.44954425", "0.4486222", "0.4483596", "0.44797248", "0.44757932", "0.44739392", "0.44720647", "0.44686443", "0.44659704" ]
0.0
-1
GET /premios/new GET /premios/new.json
def new @premio = Premio.new respond_to do |format| format.html # new.html.erb format.json { render :json => @premio } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @premio = Premio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @premio }\n end\n end", "def new\n @contacter = Contacter.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contacter }\n end\n end", "def new\n @caixa = Caixa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @caixa }\n end\n end", "def new\n @prioridade = Prioridade.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @prioridade }\n end\n end", "def new(options) \n Client.get(\"/colors/new\", :query => options)\n end", "def new\n @coisa = Coisa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @coisa }\n end\n end", "def new\n @attri = Attri.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @attri }\n end\n end", "def new\n @color = Color.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @color }\n end\n end", "def new\n @color = Color.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @color }\n end\n end", "def new\n @indicativo = Indicativo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @indicativo }\n end\n end", "def new\n @contrato = Contrato.new\n\n respond_to do |format|\n format.html { render layout: nil } # new.html.erb\n format.json { render json: @contrato }\n end\n end", "def new\n @mac = Mac.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mac }\n end\n end", "def new\n @cita = Cita.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cita }\n end\n end", "def new\n @carrera = Carrera.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @carrera }\n end\n end", "def new\n @indicacao = Indicacao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @indicacao }\n end\n end", "def new\n @ctype = Ctype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ctype }\n end\n end", "def new\n @patrocinio = Patrocinio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @patrocinio }\n end\n end", "def new\n @colegio = Colegio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @colegio }\n end\n end", "def new\n @selecao = Selecao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @selecao }\n end\n end", "def new\n @concurso = Concurso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @concurso }\n end\n end", "def new\n @pologeno = Pologeno.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pologeno }\n end\n end", "def new\n @tecnico = Tecnico.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tecnico }\n end\n end", "def new\n @termin = Termin.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @termin }\n end\n end", "def new\n @condclima = Condclima.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @condclima }\n end\n end", "def new\n @capacitacion = Capacitacion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @capacitacion }\n end\n end", "def new\n @tecnico = Tecnico.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @tecnico }\n end\n end", "def new\n @tipo_pensum = TipoPensum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tipo_pensum }\n end\n end", "def new\n @sezione = Sezione.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sezione }\n end\n end", "def new\n @prioridade_adocao = PrioridadeAdocao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @prioridade_adocao }\n end\n end", "def new\n @rainbow = Rainbow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rainbow }\n end\n end", "def new\n unless possui_acesso?()\n return\n end\n @matricula = Matricula.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @matricula }\n end\n end", "def new\n @tipo_negocio = TipoNegocio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tipo_negocio }\n end\n end", "def new\n @colegiatura = Colegiatura.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @colegiatura }\n end\n end", "def new\n @capacidad = Capacidad.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @capacidad }\n end\n end", "def new\n @atracao = Atracao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @atracao }\n end\n end", "def new\n @areco = Areco.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @areco }\n end\n end", "def new\n @monkey = Monkey.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @monkey }\n end\n end", "def new\n logger.debug(\"HIIIIIIIIII\")\n @theme = Theme.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @theme }\n \n end\n end", "def new\n @mi = Mi.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mi }\n end\n end", "def new\n @pre = Pre.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pre }\n end\n end", "def new\n @repa = Repa.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @repa }\n end\n end", "def new\n @peso = Peso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @peso }\n end\n end", "def new\n @modelo = Modelo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @modelo }\n end\n end", "def new\n @articulo = Articulo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @articulo }\n end\n end", "def new\n @articulo = Articulo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @articulo }\n end\n end", "def new\n @articulo = Articulo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @articulo }\n end\n end", "def new\n @articulo = Articulo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @articulo }\n end\n end", "def new\n @uchronia = Uchronia.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @uchronia }\n end\n end", "def new\n @tipo_convenio = TipoConvenio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tipo_convenio }\n end\n end", "def new\n @requerimiento = Requerimiento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @requerimiento }\n end\n end", "def new\n\tadd_breadcrumb \"Nueva configuración\", :new_configuracion_path\n @configuracion = Configuracion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @configuracion }\n end\n end", "def new\n @metodo = Metodo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @metodo }\n end\n end", "def new\n @comisaria = Comisaria.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comisaria }\n end\n end", "def new\n @preset = Preset.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @preset }\n end\n end", "def new(options) \n Client.get(\"/patterns/new\", :query => options)\n end", "def new\n @aroma = Aroma.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @aroma }\n end\n end", "def new\n @precinct = Precinct.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @precinct }\n end\n end", "def new\n @noto = Noto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @noto }\n end\n end", "def new\n @tipo_usuario = TipoUsuario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tipo_usuario }\n end\n end", "def new\n @ruby = Ruby.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ruby }\n end\n end", "def new\n @caracteristica_imovel = CaracteristicaImovel.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @caracteristica_imovel }\n end\n end", "def new\n @propuesta = Propuesta.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @propuesta }\n end\n end", "def new\n @protein = Protein.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @protein }\n end\n end", "def new\n @distro = Distro.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @distro }\n end\n end", "def new\n @distro = Distro.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @distro }\n end\n end", "def new\n @control_asistencia = ControlAsistencia.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @control_asistencia }\n end\n end", "def new\n @protocolo = Protocolo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @protocolo }\n end\n end", "def new\n @contum = Contum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contum }\n end\n end", "def new\n @idiom = Idiom.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @idiom }\n end\n end", "def new\n @veiculo = Veiculo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @veiculo }\n end\n end", "def new\n @prompt = Prompt.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @prompt }\n end\n end", "def new\n @prompt = Prompt.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @prompt }\n end\n end", "def new\n @cso = Cso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cso }\n end\n end", "def new\n @pto = Pto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pto }\n end\n end", "def new\n @cuerpo = Cuerpo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cuerpo }\n end\n end", "def new\n @reconocimiento = Reconocimiento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @reconocimiento }\n end\n end", "def new\n @uniprot = Uniprot.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @uniprot }\n end\n end", "def new\n @input = Input.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @input }\n end\n end", "def new\n @ca = Ca.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ca }\n end\n end", "def new\n @what = What.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @what }\n end\n end", "def new\n @chaine = Chaine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @chaine }\n end\n end", "def new\n @crime = Crime.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @crime }\n end\n end", "def new\n @theme = Theme.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @theme }\n end\n end", "def new\n @theme = Theme.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @theme }\n end\n end", "def new\n @recinto = Recinto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recinto }\n end\n end", "def new\n @ativo_outro = AtivoOutro.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ativo_outro }\n end\n end", "def new\n @respuesta = Respuesta.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @respuesta }\n end\n end", "def new\n @premio = Premio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @premio }\n end\n end", "def new\n @caballo = Caballo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @caballo }\n end\n end", "def new\n @proyect = Proyect.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @proyect }\n end\n end", "def new\n @relogio = Relogio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @relogio }\n end\n end", "def new\n @tipo_atendimento = TipoAtendimento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tipo_atendimento }\n end\n end", "def new\n @ocat = Ocat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ocat }\n end\n end", "def new\n @type = Type.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @type }\n end\n end", "def new\n @comentario = Comentario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comentario }\n end\n end", "def new\n @nabe = Nabe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @nabe }\n end\n end", "def new\n @conf = Conf.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @conf }\n end\n end", "def new\n @ano = Ano.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ano }\n end\n end", "def new\n @line = ReportingForms::Tanimoto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @line }\n end\n end", "def new\n @pinit = Pinit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pinit }\n end\n end" ]
[ "0.6600705", "0.6506941", "0.63839763", "0.6357989", "0.6344449", "0.6238727", "0.62161654", "0.62059265", "0.62059265", "0.6182527", "0.6152142", "0.61430615", "0.61397284", "0.6139079", "0.6133943", "0.61294603", "0.61170596", "0.6116741", "0.6112198", "0.608526", "0.6071261", "0.60593545", "0.6051063", "0.60425216", "0.6029154", "0.6021742", "0.60181546", "0.6015518", "0.6003371", "0.6001561", "0.6000162", "0.5999808", "0.599634", "0.59926564", "0.5991059", "0.5976782", "0.5974786", "0.59669966", "0.59654146", "0.5955945", "0.5955802", "0.5954528", "0.59475976", "0.59465694", "0.59465694", "0.59465694", "0.59465694", "0.5945421", "0.5928782", "0.59222335", "0.5919747", "0.5917428", "0.5913035", "0.59081453", "0.5901766", "0.5899471", "0.5898724", "0.5895266", "0.58811176", "0.5876718", "0.5876131", "0.58749396", "0.5870714", "0.5870604", "0.5870604", "0.586716", "0.5864578", "0.5863276", "0.5862387", "0.585962", "0.5856532", "0.5856532", "0.5848902", "0.58486664", "0.5843725", "0.5839643", "0.58364415", "0.58354884", "0.58353883", "0.58280534", "0.5827371", "0.58248883", "0.5823059", "0.5823059", "0.5822461", "0.5821874", "0.58199555", "0.5816184", "0.5814611", "0.58145374", "0.581385", "0.5806675", "0.5804117", "0.5803408", "0.58033204", "0.5802784", "0.58014137", "0.57995826", "0.579465", "0.5793077" ]
0.6549225
1
POST /premios POST /premios.json
def create @premio = Premio.new(params[:premio]) respond_to do |format| if @premio.save format.html { redirect_to @premio, :notice => 'Premio was successfully created.' } format.json { render :json => @premio, :status => :created, :location => @premio } else format.html { render :action => "new" } format.json { render :json => @premio.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cooked!\n Vedeu.log(\"Configuration::API terminal_mode: :cooked\")\n\n options[:terminal_mode] = :cooked\n end", "def terminal_params\n params.require(:terminal).permit(:admin, :mac, :imei, :sim_iccid)\n end", "def index\n @premios = Premio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @premios }\n end\n end", "def raw!\n Vedeu.log(\"Configuration::API terminal_mode: :raw\")\n\n options[:terminal_mode] = :raw\n end", "def create\n @premio = Premio.new(params[:premio])\n\n respond_to do |format|\n if @premio.save\n format.html { redirect_to @premio, notice: 'Premio was successfully created.' }\n format.json { render json: @premio, status: :created, location: @premio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @premio.errors, status: :unprocessable_entity }\n end\n end\n end", "def send_control(msg)\n text = JSON.dump(msg)\n dbg(\"-> #{text}\")\n $stdout.write(\"#{text.length+1}\\n\\n#{text}\")\n $stdout.flush\nend", "def create\n respond_to do |format|\n require 'rest-client'\n response = RestClient.post('localhost:3001/colores/', color_params.as_json, {:Authorization => 'admin irizREhyoG6Ejwr4AcjsQME9'})\n if response.code == 200\n @color = JSON.parse(response.body)\n format.html { redirect_to @color, notice: \"Color was successfully created.\" }\n format.json { render :show, status: :created, location: @color }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @color.errors, status: :unprocessable_entity }\n end\n end\n end", "def premio_manual_params\n params.require(:premio_manual).permit(:nformato, :fecha, :maquina, :valor, :coninicial, :confinal, :dni, :nomcliente, :apepaterno, :apematerno)\n end", "def post(data)\n uri = URI(@host)\n res = Net::HTTP.post_form(uri, {shell: data})\n # puts res.body\nend", "def caixa_params\n params.require(:caixa).permit(:data, :responsavel, :status)\n end", "def start_accepting\n super\n\n @res = [\"\\e[0m\"]\n end", "def req_env_post_parse(env); end", "def request_pty( opts = {} )\n invalid_opts = opts.keys - VALID_PTY_OPTIONS.keys\n unless invalid_opts.empty?\n raise ArgumentError,\n \"invalid option(s) to request_pty: #{invalid_opts.inspect}\"\n end\n\n opts = VALID_PTY_OPTIONS.merge( opts )\n\n msg = @buffers.writer\n msg.write_string opts[ :term ]\n msg.write_long opts[ :chars_wide ]\n msg.write_long opts[ :chars_high ]\n msg.write_long opts[ :pixels_wide ]\n msg.write_long opts[ :pixels_high ]\n\n modes = @buffers.writer\n opts[ :modes ].each do |mode, data|\n modes.write_byte mode\n modes.write_long data\n end\n modes.write_byte Term::TTY_OP_END\n\n msg.write_string modes.to_s\n\n send_request \"pty-req\", msg, opts[:want_reply]\n end", "def command_params\n params.require(:command).permit(:name, :json)\n end", "def start_post_server()\n server = TCPServer.new('localhost', DEFAULT_POST_PORT)\n puts \"POST Server running on http://localhost:#{DEFAULT_POST_PORT}/\"\n while session = server.accept\n method, path = session.gets.split # In this case, method = \"POST\" and path = \"/\"\n headers = {}\n while line = session.gets.split(' ', 2) # Collect HTTP headers\n puts line\n break if line[0] == \"\" # Blank line means no more headers\n headers[line[0].chop] = line[1].strip # Hash headers by type\n end\n puts headers[\"Content-Length\"].to_i\n data = JSON.parse(session.read(headers[\"Content-Length\"].to_i)) # Read the POST data as specified in the header\n response = checkModes(data) # Do what you want with the POST data\n\n session.print \"HTTP/1.1 200\\r\\n\" # 1\n session.print \"Content-type:application/json\\r\\n\" # 2\n session.print \"\\r\\n\" # 3\n session.print response #4\n session.close\n end\nend", "def customization_params\n params.require(:customization).permit(:color_background, :color_border, :color_text, :color_highlight, :color_hover, :text_apt_suite, :text_inaccurate, :text_select_confirm, :text_select_suggestion, :text_suggest1, :text_suggest2)\n end", "def terminal_params\n params.require(:terminal).permit(:terminal, :street, :city, :postal, :country_id, :port_id)\n end", "def circulo_params\n params.require(:circulo).permit(:raio)\n end", "def create\n @palette = Palette.new(palette_params)\n\n respond_to do |format|\n if @palette.save\n params[:palette][:colors].each do |value|\n @palette.colors.create(hex_value: value)\n end\n\n format.html { redirect_to @palette, notice: 'Palette was successfully created.' }\n format.json { render :show, status: :created, location: @palette }\n else\n default_palette_colors\n\n format.html { render :new }\n format.json { render json: @palette.errors, status: :unprocessable_entity }\n end\n end\n end", "def preco_rotum_params\n params.permit()\n end", "def preparar_mate_params\n params.require(:preparar_mate).permit(:título, :descrición)\n end", "def tipoocorrencium_params\n params.require(:tipoocorrencium).permit(:desc_tipoocorrencia)\n end", "def create\n retorno = {erro: \"107\", body: \" \"}\n @usuario = Usuario.new(valid_request?)\n @usuario.status = 1\n if @usuario.mac.blank? \n @usuario.nivel = \"usuario_adm\"\n @usuario.status = 0\n usuario = Usuario.select(:mac).where(\"nivel = 1\").last\n @usuario.mac = (usuario.mac.to_i + 1).to_s\n end\n\n if @usuario.valid?\n if @usuario.save\n retorno = {erro: \"000\", body: {usuario_id: @usuario.id, usuario_nome: @usuario.nome, status: true}}\n end\n end\n #verifica erros na inserção no banco\n if @usuario.errors.any?\n retorno = Usuario.verifica_erro(@usuario.errors.messages)\n end\n render json: retorno.to_json\n end", "def rl_deprep_terminal()\r\n return if ENV[\"TERM\"].nil?\r\n return if (!@terminal_prepped)\r\n\r\n # Try to keep this function from being interrupted.\r\n block_sigint()\r\n\r\n if (@_rl_enable_keypad)\r\n _rl_control_keypad(false)\r\n end\r\n\r\n @rl_outstream.flush\r\n\r\n # restore terminal setting\r\n retry_if_interrupted do\r\n `stty #{@otio}`\r\n end\r\n\r\n @terminal_prepped = false\r\n rl_unsetstate(RL_STATE_TERMPREPPED)\r\n\r\n release_sigint()\r\n end", "def create\n @premio = Premio.new(params[:premio])\n\n respond_to do |format|\n if @premio.save\n format.html { redirect_to(@premio, :notice => 'Premio was successfully created.') }\n format.xml { render :xml => @premio, :status => :created, :location => @premio }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @premio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def controlpreat_params\n params.require(:controlpreat).permit(:n1, :n2, :siglas, :limite, :vendida)\n end", "def prestamo_params\n params.require(:prestamo).permit(:fecha, :estado, :Usuario_id)\n end", "def create\n @terminal = Terminal.new(terminal_params)\n\n respond_to do |format|\n if @terminal.save\n format.html { redirect_to @terminal, notice: 'Terminal was successfully created.' }\n format.json { render :show, status: :created, location: @terminal }\n else\n format.html { render :new }\n format.json { render json: @terminal.errors, status: :unprocessable_entity }\n end\n end\n end", "def terminal_master_params\n params.require(:terminal_master).permit(:carrier_id, :maker_id, :series_id, :model_name, :default_os, :screen_inch_id, :screen_width_id, :screen_height_id, :screen_density_id, :release_date, :tablet, :nfc)\n end", "def configure_charsets\n content_type = headers[\"Content-Type\"] || 'text/html'\n if /^text\\//.match(content_type)\n headers[\"Content-Type\"] = \"#{content_type}; charset=utf-8\" \n end\n ActiveRecord::Base.connection.execute 'SET NAMES UTF8'\n end", "def set_bg\n STDOUT.write \"\\033[48;5;#{to_xterm}m\"\n end", "def configure_charsets # was: set_charset\n content_type = headers[\"Content-Type\"] || \"text/html\"\n if /^text\\//.match(content_type)\n headers[\"Content-Type\"] = \"#{content_type}; charset=utf-8\" \n end\n end", "def get_character( input = STDIN )\n old_settings = Termios.getattr(input)\n\n new_settings = old_settings.dup\n new_settings.c_lflag &= ~(Termios::ECHO | Termios::ICANON)\n new_settings.c_cc[Termios::VMIN] = 1\n\n begin\n Termios.setattr(input, Termios::TCSANOW, new_settings)\n input.getc\n ensure\n Termios.setattr(input, Termios::TCSANOW, old_settings)\n end\n end", "def reset_cli\n self.request.reset\n end", "def automovil_params\n params.require(:automovil).permit(:marca, :color, :modelo)\n end", "def get_character( input = STDIN )\n old_settings = Termios.getattr(input)\n\n new_settings = old_settings.dup\n new_settings.c_lflag &= ~(Termios::ECHO | Termios::ICANON)\n new_settings.c_cc[Termios::VMIN] = 1\n\n begin\n Termios.setattr(input, Termios::TCSANOW, new_settings)\n input.getc\n ensure\n Termios.setattr(input, Termios::TCSANOW, old_settings)\n end\n end", "def bufferio(enable)\n return if !defined?(Termios) || enable && @buff_enabled || !enable && !@buff_enabled\n attr = Termios.getattr($stdin)\n enable ? (attr.c_lflag |= Termios::ICANON | Termios::ECHO) : (attr.c_lflag &= ~(Termios::ICANON|Termios::ECHO))\n Termios.setattr($stdin, Termios::TCSANOW, attr)\n @buff_enabled = enable\n end", "def console_params\n params.require(:console).permit(:name, :console_img)\n end", "def escala_params\n params.require(:escala).permit(:nome, :color, :color1, :color2, :color3, :no_1, :no_2, :no_3, :no_4, :folga, :ano, :dia)\n end", "def json\n add option: \"-json\"\n end", "def get_response_getc_mode(question)\n terminal.raw_no_echo_mode_exec do\n response = @input.getc\n question.format_answer(response)\n end\n end", "def headers\n {\"Accept\" => \"application/json\",\n \"Content-Type\" => \"application/x-www-form-urlencoded\" }\n end", "def index\n @premios = Premio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @premios }\n end\n end", "def write_to_json(raw_input, create_filename)\n input_hash = raw_input.split(\"\\n\").map do |line|\n string = line.split(\" \")\n {\"required\" => string[0], \"character\" => string[1].gsub(':', ''), \"password\" => string[2]}\n end\n File.open(\"#{create_filename}\", \"w\") do |f| \n f.write(JSON.pretty_generate(input_hash))\n end\nend", "def write ch\n @form.write ch\n end", "def create\n @char_config = CharConfig.new(char_config_params)\n\n respond_to do |format|\n if @char_config.save\n format.html { redirect_to @char_config, notice: 'Char config was successfully created.' }\n format.json { render :show, status: :created, location: @char_config }\n else\n format.html { render :new }\n format.json { render json: @char_config.errors, status: :unprocessable_entity }\n end\n end\n end", "def consejero_params\r\n params.require(:consejero).permit(:nombre)\r\n end", "def create\n @reuniao = Reuniao.new(reuniao_params)\n @pautum=Pautum.new\n @reuniao.pautum =@pautum\n @reuniao.atum=Atum.new\n @reuniao.status=\"Preparação\"\n @pautum.status=\"Preparação\"\n \n respond_to do |format|\n if @reuniao.save\n @[email protected]\n @pautum.save\n format.html { redirect_to @reuniao, notice: 'Reuniao was successfully created.' }\n format.json { render :show, status: :created, location: @reuniao }\n else\n format.html { render :new }\n format.json { render json: @reuniao.errors, status: :unprocessable_entity }\n end\n end\n end", "def isatty\n end", "def isatty\n end", "def choose_terminal\n if @ttype.empty?\n @pstack.terminal = \"dumb\"\n end\n\n # Pick most capable from list of terminals\n @pstack.terminal = @ttype.find {|t| t =~ /mushclient/i } if [email protected]\n @pstack.terminal = @ttype.find {|t| t =~ /simplemu/i } if [email protected]\n @pstack.terminal = @ttype.find {|t| t =~ /(zmud).*/i } if [email protected]\n @pstack.terminal = @ttype.find {|t| t =~ /linux/i } if [email protected]\n @pstack.terminal = @ttype.find {|t| t =~ /cygwin/i } if [email protected]\n @pstack.terminal = @ttype.find {|t| t =~ /(cons25).*/i } if [email protected]\n @pstack.terminal = @ttype.find {|t| t =~ /(xterm).*/i } if [email protected]\n @pstack.terminal = @ttype.find {|t| t =~ /(vt)[-]?100/i } if [email protected]\n @pstack.terminal = @ttype.find {|t| t =~ /(vt)[-]?\\d+/i } if [email protected]\n @pstack.terminal = @ttype.find {|t| t =~ /(ansi).*/i } if [email protected]\n\n if @pstack.terminal && @ttype.last != @pstack.terminal # short circuit retraversal of options\n @ttype.each do |t|\n @pstack.conn.sendmsg(IAC.chr + SB.chr + TTYPE.chr + 1.chr + IAC.chr + SE.chr)\n break if t == @pstack.terminal\n end\n elsif @ttype.last != @pstack.terminal\n @pstack.terminal = 'dumb'\n end\n\n @pstack.terminal.downcase!\n\n # translate certain terminals to something meaningful\n case @pstack.terminal\n when /cygwin/i, /cons25/i, /linux/i, /dec-vt/i\n @pstack.terminal = 'vt100'\n when /ansis/i then\n @pstack.terminal = 'ansi'\n end\n log.debug(\"(#{@pstack.conn.object_id}) Terminal set to - #{@pstack.terminal} from list #{@ttype.inspect}\")\n end", "def set_echo(enable)\n term = ::Termios.getattr($stdin)\n\n if enable\n term.c_lflag |= (::Termios::ECHO | ::Termios::ICANON)\n else\n term.c_lflag &= ~::Termios::ECHO\n end\n\n ::Termios.setattr($stdin, ::Termios::TCSANOW, term)\n end", "def pautum_params\n params.require(:pautum).permit(:titulo, :data, :status)\n end", "def mk_puntuacio_params\n params.require(:mk_puntuacio).permit(:user_id, :mk_user_id, :puntuacio)\n end", "def posto_params\n params.require(:posto).permit(:codigo, :tipo, :kms_total, :kms_usado, :status)\n end", "def chamado_params\n params.require(:chamado).permit(:problema_id, :tecnico_id, :observacoes_usuario, :user_id,\n :status, :data_status_aberto, :data_status_fechado, :data_status_em_atendimento,\n :data_status_concluido, :parecer_preliminar_tecnico, :parecer_final_tecnico,\n :motivo_cancelamento, :avaliacao_usuario, :nivel_satisfacao_usuario,\n :data_status_cancelado, :administrativo, :problema_descricao, :autocomplete_user_name)\n end", "def caracteristica_params\n params.require(:caracteristica).permit(:codigo, :descricao, :unidade, :created_by, :updated_by)\n end", "def colorize(params)\n return self unless STDOUT.isatty\n\n begin\n require \"Win32/Console/ANSI\" if RUBY_PLATFORM.match?(/win32/)\n rescue LoadError\n raise \"You must gem install win32console to use colorize on Windows\"\n end\n\n color_parameters = {}\n\n if params.instance_of?(Hash)\n color_parameters[:color] = COLORS[params[:color]]\n color_parameters[:background] = COLORS[params[:background]]\n color_parameters[:mode] = MODES[params[:mode]]\n elsif params.instance_of?(Symbol)\n color_parameters[:color] = COLORS[params]\n end\n\n color_parameters[:color] ||= @color ||= COLORS[:default]\n color_parameters[:background] ||= @background ||= COLORS[:default]\n color_parameters[:mode] ||= @mode ||= MODES[:default]\n\n color_parameters[:uncolorized] ||= @uncolorized ||= dup\n\n # calculate bright mode\n color_parameters[:color] += 50 if color_parameters[:color] > 10\n\n color_parameters[:background] += 50 if color_parameters[:background] > 10\n\n \"\\033[#{color_parameters[:mode]};#{color_parameters[:color] + 30};\"\\\n \"#{color_parameters[:background] + 40}m#{color_parameters[:uncolorized]}\\033[0m\"\\\n .color_parameters(color_parameters)\n end", "def anio_params\n params.require(:anio).permit(:precio)\n end", "def kontrahenci_params\n params.require(:kontrahenci).permit(:system_id, :status_text_id, :nazwa, :nip, :www, :numer_tel, :numer_fak, :email, :opiekun_id)\n end", "def prestamo_estado_params\n params.require(:prestamo_estado).permit(:nomEstPres, :desEstPres)\n end", "def palette_params\n params.require(:palette).permit(:title, :color, :color2, :color3, :color4)\n end", "def get_response_character_mode(question)\n terminal.raw_no_echo_mode_exec do\n response = terminal.get_character\n if question.overwrite\n erase_current_line\n else\n echo = question.get_echo_for_response(response)\n say(\"#{echo}\\n\")\n end\n question.format_answer(response)\n end\n end", "def municao_params\n params.require(:municao).permit(:calibre, :descricao)\n end", "def handle_input(message)\n user = extract_user message\n id = message[:data][:id]\n request = message[:data][:args]\n if (term = TTY[user, id])\n term.write << request.join\n else\n message[:error] = 'Terminal does not exist.'\n end\n end", "def create\n @terminal = Terminal.new(terminal_params)\n\n respond_to do |format|\n if @terminal.save\n format.html { redirect_to [:admin, @terminal], notice: 'Terminal was successfully created.' }\n format.json { render action: 'show', status: :created, location: @terminal }\n else\n format.html { render action: 'new' }\n format.json { render json: @terminal.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @premio_manual = PremioManual.new(premio_manual_params)\n\n respond_to do |format|\n if @premio_manual.save\n format.html { redirect_to @premio_manual, notice: 'Se ha creado correctamente.' }\n format.json { render :show, status: :created, location: @premio_manual }\n else\n format.html { render :new }\n format.json { render json: @premio_manual.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @keystroke = Keystroke.new(params[:keystroke])\n\n respond_to do |format|\n if @keystroke.save\n format.html { redirect_to @keystroke, notice: 'Keystroke was successfully created.' }\n format.json { render json: @keystroke, status: :created, location: @keystroke }\n else\n format.html { render action: \"new\" }\n format.json { render json: @keystroke.errors, status: :unprocessable_entity }\n end\n end\n end", "def color_scheme_params\n params.require(:color_scheme).permit(:title, :color)\n end", "def request_pty\n @state = :pty\n pty_opts = { :want_reply=>true }\n pty_opts = @pty_opts.merge( pty_opts ) if @pty_opts.is_a?( Hash )\n @channel.request_pty pty_opts\n end", "def create\n @mac = Mac.new(mac_params)\n\n respond_to do |format|\n if @mac.save\n format.html { redirect_to @mac, notice: 'Mac was successfully created.' }\n format.json { render json: @mac, status: :created, location: @mac }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mac.errors, status: :unprocessable_entity }\n end\n end\n end", "def prueba_json_params\n params[:prueba_json]\n end", "def raw_no_echo_mode\n @state = Termios.getattr(@input)\n new_settings = @state.dup\n new_settings.c_lflag &= ~(Termios::ECHO | Termios::ICANON)\n new_settings.c_cc[Termios::VMIN] = 1\n Termios.setattr(@input, Termios::TCSANOW, new_settings)\n end", "def pre_terminals\n raise NotImplementedError\n end", "def tipoapreensao_params\n params.require(:tipoapreensao).permit(:ttpcodigo, :ttpatualiza)\n end", "def prestamo_params\n params.fetch(:prestamo, {}).permit(:usuario_id, :libro_id, :dias_prestados, :fecha_devolucion, :fecha_prestamo)\n end", "def restricao_params\n params.require(:restricao).permit(:palavra)\n end", "def create\n @preset = Preset.new(params[:preset])\n @preset.user_id = current_user.id\n respond_to do |format|\n if @preset.save\n format.html { redirect_to @preset, notice: 'Preset was successfully created.' }\n format.json { render json: @preset, status: :created, location: @preset }\n else\n format.html { render action: \"new\" }\n format.json { render json: @preset.errors, status: :unprocessable_entity }\n end\n end\n end", "def electronica_consejero_params\r\n params.require(:electronica_consejero).permit(:nombre)\r\n end", "def postulacion_params\n params.require(:postulacion).permit(:aceptado, :proyecto_id, :usuario_id)\n end", "def write_to_json(raw_input, create_filename)\n input_hash = raw_input.split(\"\\n\").map do |line|\n string = line.split(\" \")\n {\"first_index\" => string[0].split(\"-\")[0].to_i, \"second_index\" => string[0].split(\"-\")[1].to_i, \"character\" => string[1].gsub(':', ''), \"password\" => string[2]}\n end\n File.open(\"#{create_filename}\", \"w\") do |f| \n f.write(JSON.pretty_generate(input_hash))\n end\nend", "def instituicao_responsavel_params\n params.require(:instituicao_responsavel).permit(:instituicao_id, :nome, :inseridoPor, :dataDeInsercao, :atualizadoPor, :dataDeAtualizacao)\n end", "def tty?; _tty?; end", "def celulare_params\n params.require(:celulare).permit(:precio, :modelo, :memoriain, :memoriaex)\n end", "def create\n @terminal = scope.new(terminal_params)\n\n if @terminal.save\n json_response(@terminal.decorate, :created)\n else\n json_response(@terminal.errors, :unprocessable_entity)\n end\n end", "def reclamacao_params\r\n params.require(:reclamacao).permit(:titulo, :texto, :cat_problema, :nome_empresa)\r\n end", "def create\n @oncokb = Oncokb.new(oncokb_params)\n\n respond_to do |format|\n if @oncokb.save\n format.html { redirect_to @oncokb, notice: 'Oncokb was successfully created.' }\n format.json { render :show, status: :created, location: @oncokb }\n else\n format.html { render :new }\n format.json { render json: @oncokb.errors, status: :unprocessable_entity }\n end\n end\n end", "def req_env_post_parse(env)\n to_delete = nil\n to_add = nil\n\n env.each do |k,v|\n if k.start_with?(\"HTTP_\") && k.include?(\",\") && k != \"HTTP_TRANSFER,ENCODING\"\n if to_delete\n to_delete << k\n else\n to_delete = [k]\n end\n\n unless to_add\n to_add = {}\n end\n\n to_add[k.tr(\",\", \"_\")] = v\n end\n end\n\n if to_delete\n to_delete.each { |k| env.delete(k) }\n env.merge! to_add\n end\n end", "def reuniao_params\n params.require(:reuniao).permit(:titulo, :data, :horaInicio, :horaFim, :status, :local_id, :pautum_id, :atum_id, :category_id)\n end", "def resource_params\n params.require(:derechohabiente).permit(:seguro, :afiliacion)\n end", "def color_scheme_params\n params\n .require(:color_scheme)\n .permit(:color_u, :color_f)\n end", "def eula_params\n params.require(:eula).permit(:tile, :eula)\n end", "def create\n @preset = Preset.new(preset_params)\n @preset.user_id = current_user.id\n @preset.channel_id = @channel.id\n \n respond_to do |format|\n if @preset.save\n format.html { redirect_to @preset, notice: 'Preset was successfully created.' }\n format.json { render :show, status: :created, location: @preset }\n else\n format.html { render :new }\n format.json { render json: @preset.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_headers\n {\"Content-Type\" => 'text/xml; charset=utf-8'}\n end", "def default_octokit_headers\n {\n :accept => ::Octokit::Default.default_media_type,\n :content_type => \"application/json\",\n :user_agent => ::Octokit::Default.user_agent\n # :accept_encoding => \"gzip;q=1.0,deflate;q=0.6,identity;q=0.3\"\n }\n end", "def pc_request(chars='', *_)\n self.parameter_character, self.parameter_escape = convert_string(chars, \"parameter character\")\n end", "def escape\n puts \"\"\n puts Rainbow(\"Press anything to return\").blue\n STDIN.getch\nend", "def servico_pacote_params\n params.require(:servico_pacote).permit(:dataInicio, :dataRetorno, :destino, :localSaida, :nomeTrans, :veiculo, :cnpjTrans, :precoTrans, :nomeHotel, :cnpjHotel, :descHotel, :descQuarto, :precoHotel, :descPacote, :precoPacote, :status)\n end", "def post_api(path, params={}, headers={})\n headers.merge!('CONTENT_TYPE' => \"application/json\")\n post path, params, headers\nend", "def pc_params\n params.require(:pc).permit(:PC_NUM, :PC_TYPE, :PC_NANE)\n end" ]
[ "0.5034111", "0.48818085", "0.48368245", "0.47575212", "0.45850807", "0.4519271", "0.446661", "0.44655564", "0.4403657", "0.43617547", "0.43582588", "0.42912102", "0.42788315", "0.4275274", "0.42670208", "0.42603377", "0.42559537", "0.42285097", "0.42127904", "0.41972935", "0.4187417", "0.41822875", "0.41700268", "0.4149281", "0.41468683", "0.41450065", "0.41443154", "0.41311294", "0.412843", "0.4126794", "0.41241178", "0.41186568", "0.4115729", "0.41076857", "0.41040802", "0.4103343", "0.40986118", "0.40973565", "0.40852726", "0.40833923", "0.4071072", "0.40674046", "0.40614033", "0.40580338", "0.4056616", "0.40536666", "0.40529576", "0.40460467", "0.40375176", "0.40375176", "0.40334246", "0.4032861", "0.40289566", "0.40285933", "0.40233472", "0.40171108", "0.401382", "0.40129456", "0.40091196", "0.40064293", "0.40050527", "0.40032843", "0.4002618", "0.4000805", "0.39969954", "0.39949435", "0.39916974", "0.39881715", "0.39860654", "0.39844722", "0.3984192", "0.39832756", "0.3979036", "0.3978918", "0.3978065", "0.39777794", "0.3977261", "0.39699286", "0.39681557", "0.39587837", "0.39557055", "0.39546582", "0.39501515", "0.39456883", "0.3944664", "0.39418188", "0.3941124", "0.39347994", "0.39334303", "0.392827", "0.39252672", "0.39244527", "0.39244008", "0.3922318", "0.39222038", "0.39208126", "0.3920282", "0.39199367", "0.3919637", "0.39177924" ]
0.4663728
4
PUT /premios/1 PUT /premios/1.json
def update @premio = Premio.find(params[:id]) respond_to do |format| if @premio.update_attributes(params[:premio]) format.html { redirect_to @premio, :notice => 'Premio was successfully updated.' } format.json { head :no_content } else format.html { render :action => "edit" } format.json { render :json => @premio.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @premio = Premio.find(params[:id])\n\n respond_to do |format|\n if @premio.update_attributes(params[:premio])\n format.html { redirect_to @premio, notice: 'Premio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @premio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @premio = Premio.find(params[:id])\n\n respond_to do |format|\n if @premio.update_attributes(params[:premio])\n format.html { redirect_to(@premio, :notice => 'Premio was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @premio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n require 'rest-client'\n response = RestClient.put('localhost:3001/colores/'[email protected]_s, color_params.as_json, {:Authorization => 'admin irizREhyoG6Ejwr4AcjsQME9'})\n if response.code == 200\n @color = JSON.parse(response.body)\n\n format.html { redirect_to @color, notice: \"Color was successfully updated.\" }\n format.json { render :show, status: :ok, location: @color }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @color.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @capitulo.update(capitulo_params)\n format.html { redirect_to @capitulo, notice: 'Capitulo was successfully updated.' }\n format.json { render :show, status: :ok, location: @capitulo }\n else\n format.html { render :edit }\n format.json { render json: @capitulo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @inscrito = Inscrito.find(params[:id])\n\n respond_to do |format|\n if @inscrito.update_attributes(params[:inscrito])\n format.html { redirect_to @inscrito, notice: 'Inscrito was successfully updated. #{undo_link}' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @inscrito.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @preset = Preset.find(params[:id])\n @preset.user_id = current_user.id\n respond_to do |format|\n if @preset.update_attributes(params[:preset])\n format.html { redirect_to @preset, notice: 'Preset was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @preset.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @caixa = Caixa.find(params[:id])\n\n respond_to do |format|\n if @caixa.update_attributes(params[:caixa])\n format.html { redirect_to @caixa, notice: 'Caixa was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @caixa.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @premio_manual.update(premio_manual_params)\n format.html { redirect_to @premio_manual, notice: 'El premio de actualizo correctamente.' }\n format.json { render :show, status: :ok, location: @premio_manual }\n else\n format.html { render :edit }\n format.json { render json: @premio_manual.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @coisa = Coisa.find(params[:id])\n\n respond_to do |format|\n if @coisa.update_attributes(params[:coisa])\n format.html { redirect_to @coisa, :notice => 'Coisa was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @coisa.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @uchronia = Uchronia.find(params[:id])\n\n respond_to do |format|\n if @uchronia.update_attributes(params[:uchronia])\n format.html { redirect_to @uchronia, notice: 'Uchronia was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @uchronia.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @servicio = Servicio.find(params[:id])\n\n respond_to do |format|\n if @servicio.update_attributes(params[:servicio])\n format.html { redirect_to @servicio, :notice => 'Servicio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @servicio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put!\n request! :put\n end", "def update\n respond_to do |format|\n if @tamanho.update(tamanho_params)\n format.html { redirect_to @tamanho, notice: 'Tamanho was successfully updated.' }\n format.json { render :show, status: :ok, location: @tamanho }\n else\n format.html { render :edit }\n format.json { render json: @tamanho.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @aroma = Aroma.find(params[:id])\n\n respond_to do |format|\n if @aroma.update_attributes(params[:aroma])\n format.html { redirect_to @aroma, notice: 'Aroma was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @aroma.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n style = Style.find(params[:id])\n style.update(update_params)\n save_style style.stylable_id\n head :ok\n end", "def update\n @ativo_outro = AtivoOutro.find(params[:id])\n\n respond_to do |format|\n if @ativo_outro.update_attributes(params[:ativo_outro])\n format.html { redirect_to @ativo_outro, notice: 'Ativo foi salvo com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ativo_outro.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tipoapreensao.update(tipoapreensao_params)\n format.html { redirect_to @tipoapreensao, notice: 'Tipoapreensao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tipoapreensao.errors, status: :unprocessable_entity }\n end\n end\n end", "def flag_xms_system_to_be_normal \n put(\"/globalsettings.json/xms/normal\")\nend", "def update\n @selecao = Selecao.find(params[:id])\n\n respond_to do |format|\n if @selecao.update_attributes(params[:selecao])\n format.html { redirect_to @selecao, notice: 'Selecao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @selecao.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @premios = Premio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @premios }\n end\n end", "def update\n respond_to do |format|\n if @topico.update(topico_params)\n format.html { redirect_to set_path, notice: 'Tópico atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @topico.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @articulo = Articulo.find(params[:id])\n\n respond_to do |format|\n if @articulo.update_attributes(params[:articulo])\n format.html { redirect_to @articulo, notice: 'Articulo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @articulo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @objeto.update(caracteristica_params)\n set_redireccion\n format.html { redirect_to @redireccion, notice: 'Caracteristica was successfully updated.' }\n format.json { render :show, status: :ok, location: @objeto }\n else\n format.html { render :edit }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @protocolo.update(protocolo_params)\n addlog(\"Protocolo alterado\")\n format.html { redirect_to @protocolo, notice: 'Protocolo foi atualizado.' }\n format.json { render :show, status: :ok, location: @protocolo }\n else\n format.html { render :edit }\n format.json { render json: @protocolo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n pai = params[:pai] ? Conta.find_by_id(params[:pai]): nil\n \n respond_to do |format|\n if @conta.update(nome: conta_params[:nome], status: conta_params[:status], pai: pai) \n #format.json { render :show, status: :ok, location: @conta }\n format.json { render json: @conta.to_json, status: :ok }\n else \n format.json { render json: @conta.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @color_scheme.update(color_scheme_params)\n format.html { redirect_to [:admin, @color_scheme], notice: 'Color scheme was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @color_scheme.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @capacitacion = Capacitacion.find(params[:id])\n\n respond_to do |format|\n if @capacitacion.update_attributes(params[:capacitacion])\n format.html { redirect_to @capacitacion, notice: 'Capacitacion was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @capacitacion.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @predio.update(predio_params)\n format.html { redirect_to @predio, notice: 'Predio foi alterado com sucesso.' }\n format.json { render :show, status: :ok, location: @predio }\n else\n format.html { render :edit }\n format.json { render json: @predio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @matricula = Matricula.find(params[:id])\n\n respond_to do |format|\n if @matricula.update_attributes(matricula_params)\n format.html { redirect_to @matricula, notice: 'Matricula was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @matricula.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @veiculo = Veiculo.find(params[:id])\n\n respond_to do |format|\n if @veiculo.update_attributes(params[:veiculo])\n format.html { redirect_to @veiculo, :notice => 'Veiculo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @veiculo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @apoio.update(apoio_params)\n format.html { redirect_to @apoio, notice: 'Apoio was successfully updated.' }\n format.json { render :show, status: :ok, location: @apoio }\n else\n format.html { render :edit }\n format.json { render json: @apoio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @areco = Areco.find(params[:id])\n\n respond_to do |format|\n if @areco.update_attributes(params[:areco])\n format.html { redirect_to @areco, notice: 'Areco was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @areco.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tecnico = Tecnico.find(params[:id])\n\n respond_to do |format|\n if @tecnico.update_attributes(params[:tecnico])\n format.html { redirect_to @tecnico, notice: 'Tecnico atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tecnico.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @chatarea.update(chatarea_params)\n format.html { redirect_to @chatarea, notice: 'Chatarea was successfully updated.' }\n format.json { render :show, status: :ok, location: @chatarea }\n else\n format.html { render :edit }\n format.json { render json: @chatarea.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @atracao = Atracao.find(params[:id])\n\n respond_to do |format|\n if @atracao.update_attributes(params[:atracao])\n format.html { redirect_to @atracao, :notice => 'Atracao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @atracao.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @inicio.update(inicio_params)\n format.html { redirect_to @inicio, notice: 'Inicio was successfully updated.' }\n format.json { render :show, status: :ok, location: @inicio }\n else\n format.html { render :edit }\n format.json { render json: @inicio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @colegiatura = Colegiatura.find(params[:id])\n\n respond_to do |format|\n if @colegiatura.update_attributes(params[:colegiatura])\n format.html { redirect_to @colegiatura, notice: 'Colegiatura was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @colegiatura.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @aactio = Aactio.find(params[:id])\n\n respond_to do |format|\n if @aactio.update_attributes(params[:aactio])\n format.html { redirect_to @aactio, notice: 'Aactio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @aactio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @servico_pacote.update(servico_pacote_params)\n format.html { redirect_to @servico_pacote, notice: 'Pacote was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @servico_pacote.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @indicativo = Indicativo.find(params[:id])\n\n respond_to do |format|\n if @indicativo.update_attributes(params[:indicativo])\n format.html { redirect_to @indicativo, notice: 'Indicativo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @indicativo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tecnico = Tecnico.find(params[:id])\n\n respond_to do |format|\n if @tecnico.update_attributes(params[:tecnico])\n format.html { redirect_to @tecnico, :notice => 'Tecnico was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @tecnico.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @japan_style = JapanStyle.find(params[:id])\n\n respond_to do |format|\n if @japan_style.update_attributes(params[:japan_style])\n format.html { redirect_to [:admin, @japan_style], notice: 'Japan style was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @japan_style.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @pre = Pre.find(params[:id])\n\n respond_to do |format|\n if @pre.update_attributes(params[:pre])\n format.html { redirect_to @pre, notice: 'Pre was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pre.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cio.update(cio_params)\n format.html { redirect_to @cio, notice: 'Cio editado com sucesso.' }\n format.json { render :show, status: :ok, location: @cio }\n else\n format.html { render :edit }\n format.json { render json: @cio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @inscricao.update(inscricao_params)\n format.html { redirect_to @inscricao, notice: 'Inscricao was successfully updated.' }\n format.json { render :show, status: :ok, location: @inscricao }\n else\n format.html { render :edit }\n format.json { render json: @inscricao.errors, status: :unprocessable_entity }\n end\n end\n end", "def put(path, body = nil, ctype = 'application/json')\n make_call(mk_conn(path, 'Content-Type': ctype,\n 'Accept': 'application/json'),\n :put, nil, body.to_json)\n end", "def update\n @keystroke = Keystroke.find(params[:id])\n\n respond_to do |format|\n if @keystroke.update_attributes(params[:keystroke])\n format.html { redirect_to @keystroke, notice: 'Keystroke was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @keystroke.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @chronicle = Chronicle.find(params[:id])\n\n respond_to do |format|\n if @chronicle.update_attributes(params[:chronicle])\n format.html { redirect_to @chronicle, notice: 'Chronicle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @chronicle.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @colegio = Colegio.find(params[:id])\n\n respond_to do |format|\n if @colegio.update_attributes(params[:colegio])\n format.html { redirect_to @colegio, notice: 'El Colegio fue actualizado satisfactoriamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @colegio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @contacter = Contacter.find(params[:id])\n\n respond_to do |format|\n if @contacter.update_attributes(params[:contacter])\n format.html { redirect_to @contacter, notice: 'Contacter was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contacter.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @indicacao = Indicacao.find(params[:id])\n\n respond_to do |format|\n if @indicacao.update_attributes(params[:indicacao])\n format.html { redirect_to @indicacao, notice: 'A Indicação do Condutor foi atualizada com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @indicacao.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @prioridade_adocao = PrioridadeAdocao.find(params[:id])\n\n respond_to do |format|\n if @prioridade_adocao.update_attributes(params[:prioridade_adocao])\n format.html { redirect_to @prioridade_adocao, notice: 'Prioridade adocao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @prioridade_adocao.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @seguro = Seguro.find(params[:id])\n\n respond_to do |format|\n if @seguro.update_attributes(params[:seguro])\n format.html { redirect_to @seguro, notice: 'Seguro was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @seguro.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @idiom = Idiom.find(params[:id])\n\n respond_to do |format|\n if @idiom.update_attributes(params[:idiom])\n format.html { redirect_to @idiom, notice: 'Idiom was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @idiom.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tipo_contrato = TipoContrato.find(params[:id])\n\n respond_to do |format|\n if @tipo_contrato.update_attributes(params[:tipo_contrato])\n format.html { redirect_to tipo_contratos_path, notice: 'Tipo de contrato atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tipo_contrato.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @articulo = Articulo.find(params[:id])\n\n respond_to do |format|\n if @articulo.update_attributes(params[:articulo])\n format.html { redirect_to @articulo, notice: 'Articulo se ha actualizado correctamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @articulo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @alumno = Alumno.find(params[:id])\n\n respond_to do |format|\n if @alumno.update_attributes(params[:alumno])\n head :no_content\n else\n render json: @alumno.errors, status: :unprocessable_entity\n end\n end\n end", "def update\n @termin = Termin.find(params[:id])\n\n respond_to do |format|\n if @termin.update_attributes(params[:termin])\n format.html { redirect_to @termin, notice: 'Termin was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @termin.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @accesorio = Accesorio.find(params[:id])\n\n respond_to do |format|\n if @accesorio.update_attributes(params[:accesorio])\n format.html { redirect_to @accesorio, notice: 'Accesorio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render \"edit\" }\n format.json { render json: @accesorio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n puts \"update\"\n\tputs params\n\tputs \"controllo target\"\n\tputs params[:opera][:target]\n\tnew_opera_params = opera_params\n\tnew_opera_params.delete(\"target\")\n\tif params[:opera][:target] != nil \n\t if params[:opera][:target].length > 3\n\t puts \"modifico\"\n\t target_id = params[:opera][:target].split('-')[0].to_s\n\t target_type = params[:opera][:target].split('-')[1].to_s\n\t \n\t new_opera_params.merge({\"target_id\" => target_id})\n\t\tnew_opera_params.merge({\"target_type\" => target_type})\n\t\t\n\t\tputs new_opera_params\n\t end\n\tend\n\tputs new_opera_params\n respond_to do |format|\n if @opera.update(new_opera_params)\n format.html { redirect_to @opera, notice: 'Opera was successfully updated.' }\n format.json { render :show, status: :ok, location: @opera }\n else\n format.html { render :edit }\n format.json { render json: @opera.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @inscricao.update(inscricao_params)\n format.html { redirect_to @inscricao, notice: \"Inscricao was successfully updated.\" }\n format.json { render :show, status: :ok, location: @inscricao }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @inscricao.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_aos_version(args = {}) \n id = args['id']\n temp_path = \"/aosversions.json/{aosVersionId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"aosversionId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update\n @ami = Ami.find(params[:id])\n\n respond_to do |format|\n if @ami.update_attributes(params[:ami])\n format.html { redirect_to @ami, notice: 'Ami was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ami.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ficha = Ficha.find(params[:id])\n\n respond_to do |format|\n if @ficha.update_attributes(params[:ficha])\n format.html { redirect_to @ficha, notice: 'Ficha alterada com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ficha.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @consumo = Consumo.find(params[:id])\n\n respond_to do |format|\n if @consumo.update_attributes(params[:consumo])\n format.html { redirect_to @consumo.cliente, :notice => 'Consumo alterado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @consumo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @microposr = Microposr.find(params[:id])\n\n respond_to do |format|\n if @microposr.update_attributes(params[:microposr])\n format.html { redirect_to @microposr, notice: 'Microposr was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @microposr.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @caixa.update(caixa_params)\n format.html { redirect_to @caixa, notice: 'Caixa was successfully updated.' }\n format.json { render :show, status: :ok, location: @caixa }\n else\n format.html { render :edit }\n format.json { render json: @caixa.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tipo_negocio = TipoNegocio.find(params[:id])\n\n respond_to do |format|\n if @tipo_negocio.update_attributes(params[:tipo_negocio])\n format.html { redirect_to @tipo_negocio, notice: 'Tipo negocio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tipo_negocio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @condclima = Condclima.find(params[:id])\n\n respond_to do |format|\n if @condclima.update_attributes(params[:condclima])\n format.html { redirect_to @condclima, notice: 'Condclima was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @condclima.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @attri = Attri.find(params[:id])\n\n respond_to do |format|\n if @attri.update_attributes(params[:attri])\n format.html { redirect_to @attri, notice: 'Attri was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @attri.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @concurso = Concurso.find(params[:id])\n\n respond_to do |format|\n if @concurso.update_attributes(params[:concurso])\n format.html { redirect_to @concurso, notice: 'Concurso atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @concurso.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @premise_type = PremiseType.find(params[:id])\n\n respond_to do |format|\n if @premise_type.update_attributes(params[:premise_type])\n format.html { redirect_to @premise_type, notice: 'Premise type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @premise_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @preset.update(preset_params)\n format.html { redirect_to @preset, notice: 'Preset was successfully updated.' }\n format.json { render :show, status: :ok, location: @preset }\n else\n format.html { render :edit }\n format.json { render json: @preset.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @quinto.anio = params[:anio]\n @quinto.mes = params[:mes]\n \n \n \n respond_to do |format|\n if @quinto.update(quinto_params)\n format.html { redirect_to @quinto, notice: 'Quinto was successfully updated.' }\n format.json { render :show, status: :ok, location: @quinto }\n else\n format.html { render :edit }\n format.json { render json: @quinto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @historico_converca.update(historico_converca_params)\n format.html { redirect_to @historico_converca, notice: 'Historico converca was successfully updated.' }\n format.json { render :show, status: :ok, location: @historico_converca }\n else\n format.html { render :edit }\n format.json { render json: @historico_converca.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ios_topbar = @user.ios_topbar\n\n respond_to do |format|\n if @ios_topbar.update_attributes(params[:ios_topbar])\n format.html { redirect_to user_ios_topbar_url, :flash => { success: 'Top Bar Color successfully updated.' } }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ios_topbar.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @obra.update(obra_params)\n format.html { redirect_to @obra, notice: 'Obra was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @obra.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @fluxomatricula = Fluxomatricula.find(params[:id])\n\n respond_to do |format|\n if @fluxomatricula.update_attributes(params[:fluxomatricula])\n format.html { redirect_to @fluxomatricula, notice: 'Fluxomatricula was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fluxomatricula.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit_pro\n customer_id = params[\"customer_id\"]\n siret = params[\"siret\"]\n cip = params[\"cip\"]\n raison_sociale = params[\"raison_sociale\"]\n puts params\n puts \"----------------------------------------MAKES NO SENSE\"\n puts params[\"raison_sociale\"]\n puts customer_id\n puts cip\n puts siret\n puts raison_sociale\n puts \"I am in edit pro\"\n\n metafields = ShopifyAPI::Customer.find(customer_id).metafields\n puts metafields[0].key\n puts metafields[0].value\n puts metafields[1].key\n puts metafields[1].value\n puts metafields[2].key\n puts metafields[2].value\n\n metafields[0].value = siret\n metafields[1].value = cip\n metafields[2].value = raison_sociale\n\n puts metafields[0].key\n puts metafields[0].value\n puts metafields[1].key\n puts metafields[1].value\n puts metafields[2].key\n puts metafields[2].value\n\n p metafields[0].save\n p metafields[1].save\n p metafields[2].save\n\n p metafields[0].errors\n p metafields[1].errors\n p metafields[2].errors\n\n puts \"editing tag\"\n\n cus = ShopifyAPI::Customer.find(customer_id)\n p cus\n p cus.tags\n\n cus.tags = \"cip- #{metafields[1].value}, PRO\"\n\n p cus.save\n\n\n\n render json: { metafields: metafields }\n end", "def update\n respond_to do |format|\n if @principal_caracteristica.update(principal_caracteristica_params)\n format.html { redirect_to @principal_caracteristica, notice: 'Principal caracteristica was successfully updated.' }\n format.json { render :show, status: :ok, location: @principal_caracteristica }\n else\n format.html { render :edit }\n format.json { render json: @principal_caracteristica.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @complaint = Complaint.find(params[:id])\n\n if @complaint.update_attributes(params[:complaint])\n head :no_content\n else\n render json: @complaint.errors, status: :unprocessable_entity\n end\n end", "def update\n @tipo_pensum = TipoPensum.find(params[:id])\n\n respond_to do |format|\n if @tipo_pensum.update_attributes(params[:tipo_pensum])\n format.html { redirect_to @tipo_pensum, notice: 'Tipo pensum was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tipo_pensum.errors, status: :unprocessable_entity }\n end\n end\n end", "def put(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if info && info['meta'] && (etag = info['meta']['version'])\n hdrs.merge!('if-match' => etag)\n end\n reply = json_parse_reply(@key_style,\n *json_put(@target, \"#{path}/#{Addressable::URI.encode(id)}\", info, hdrs))\n\n # hide client endpoints that are not quite scim compatible\n type == :client && !reply ? get(type, info['client_id']): reply\n end", "def update\n respond_to do |format|\n if @apologetic.update(apologetic_params)\n format.html { redirect_to @apologetic, notice: 'Apologetic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @apologetic.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @osoba = Osoba.find(params[:id])\n\n if @osoba.update(params[:osoba])\n head :no_content\n else\n render json: @osoba.errors, status: :unprocessable_entity\n end\n end", "def update\n @kazoku = Kazoku.find(params[:id])\n\n respond_to do |format|\n if @kazoku.update_attributes(params[:kazoku])\n format.html { redirect_to @kazoku, :notice => 'Kazoku was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @kazoku.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n\t respond_to do |format|\n\t\t if @convention.update(convention_params)\n\t\t\t format.html { redirect_to @convention, notice: 'Convention was successfully updated.' }\n\t\t\t format.json { head :no_content }\n\t\t else\n\t\t\t format.html { render action: 'edit' }\n\t\t\t format.json { render json: @convention.errors, status: :unprocessable_entity }\n\t\t end\n\t end\n end", "def update\n @protocolo = Protocolo.find(params[:id])\n\n respond_to do |format|\n if @protocolo.update_attributes(params[:protocolo])\n flash[:notice] = 'CADASTRADO COM SUCESSO.'\n format.html { redirect_to(@protocolo) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @protocolo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @pre_print_type = PrePrintType.find(params[:id])\n\n respond_to do |format|\n if @pre_print_type.update_attributes(params[:pre_print_type])\n format.html { redirect_to @pre_print_type, notice: 'Pre print type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pre_print_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @responsavel = Responsavel.find(params[:id])\n\n if @responsavel.update(responsavel_params)\n head :no_content\n else\n render json: @responsavel.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @inventario_cosa.update(inventario_cosa_params)\n format.html { redirect_to @inventario_cosa, notice: 'Inventario cosa was successfully updated.' }\n format.json { render :show, status: :ok, location: @inventario_cosa }\n else\n format.html { render :edit }\n format.json { render json: @inventario_cosa.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @oncokb.update(oncokb_params)\n format.html { redirect_to @oncokb, notice: 'Oncokb was successfully updated.' }\n format.json { render :show, status: :ok, location: @oncokb }\n else\n format.html { render :edit }\n format.json { render json: @oncokb.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @terminal.update(terminal_params)\n format.html { redirect_to [:admin, @terminal], notice: 'Terminal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @terminal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @obra = Obra.find(params[:id])\n\n respond_to do |format|\n if @obra.update_attributes(params[:obra])\n format.html { redirect_to @obra, notice: 'Obra was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @obra.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ginasio = Ginasio.find(params[:id])\n\n respond_to do |format|\n if @ginasio.update_attributes(params[:ginasio])\n format.html { redirect_to @ginasio, :flash => { :success => 'Dados do ginasio alterados com successo!' } }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @ginasio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @capacidad = Capacidad.find(params[:id])\n\n respond_to do |format|\n if @capacidad.update_attributes(params[:capacidad])\n format.html { redirect_to @capacidad, notice: 'Capacidad was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render \"edit\" }\n format.json { render json: @capacidad.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @rainbow = Rainbow.find(params[:id])\n\n respond_to do |format|\n if @rainbow.update_attributes(params[:rainbow])\n format.html { redirect_to @rainbow, notice: 'Rainbow was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rainbow.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @territorio = Territorio.find(params[:id])\n\n respond_to do |format|\n if @territorio.update_attributes(params[:territorio])\n format.html { redirect_to @territorio, notice: 'Territorio was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @territorio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @headline.update(headline_params)\n format.html { redirect_to @headline, notice: 'Headline was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @headline.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @squishee_cup = SquisheeCup.find(params[:id])\n puts params.to_json\n respond_to do |format|\n if @squishee_cup.update_attributes(params[:squishee_cup])\n format.html { redirect_to @squishee_cup, notice: 'Squishee cup was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @squishee_cup.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.5710817", "0.54008687", "0.52993983", "0.5133492", "0.5012592", "0.50006616", "0.4963367", "0.49626723", "0.49262348", "0.4914228", "0.4879968", "0.48780036", "0.48681125", "0.48416144", "0.48392993", "0.48388565", "0.48275036", "0.4825848", "0.481896", "0.4817325", "0.48104048", "0.48056665", "0.48047143", "0.4801118", "0.47968838", "0.47713688", "0.47700116", "0.47693494", "0.47520733", "0.47498497", "0.47418407", "0.47354418", "0.4727045", "0.47216123", "0.47193217", "0.47187507", "0.47175875", "0.47166988", "0.4715709", "0.47138587", "0.47115234", "0.47111717", "0.47089997", "0.47062743", "0.4702322", "0.46999317", "0.4699173", "0.46939307", "0.46915802", "0.46897203", "0.4684292", "0.46841455", "0.46840057", "0.46783543", "0.4675567", "0.46732908", "0.4671233", "0.46665692", "0.46653283", "0.46652752", "0.46539584", "0.4649441", "0.46485984", "0.4648107", "0.4645466", "0.46441516", "0.4643539", "0.46422955", "0.4641252", "0.46411377", "0.46406126", "0.46400318", "0.46385446", "0.46379584", "0.46368954", "0.46365646", "0.46359435", "0.46344575", "0.4634401", "0.46337426", "0.46327013", "0.46322834", "0.46285862", "0.4627249", "0.46270296", "0.46252063", "0.46229663", "0.46228787", "0.46161753", "0.46159703", "0.4615773", "0.46098104", "0.46093264", "0.46082908", "0.46082383", "0.46057457", "0.46040606", "0.4603671", "0.4602921", "0.46015784" ]
0.57266384
0
DELETE /premios/1 DELETE /premios/1.json
def destroy @premio = Premio.find(params[:id]) @premio.destroy respond_to do |format| format.html { redirect_to premios_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_cookie name, path\r\n command 'deleteCookie', name, path\r\n end", "def destroy\n \n respond_to do |format|\n RestClient.delete 'localhost:3001/colores/'[email protected]_s, {:Authorization => 'admin irizREhyoG6Ejwr4AcjsQME9'}\n format.html { redirect_to colors_url, notice: \"Color was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @premio = Premio.find(params[:id])\n @premio.destroy\n\n respond_to do |format|\n format.html { redirect_to(premios_url) }\n format.xml { head :ok }\n end\n end", "def do_delete(uri = \"\")\n @connection.delete do |req|\n req.url uri\n req.headers['Content-Type'] = 'application/json'\n end\n end", "def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end", "def destroy\n @uchronia = Uchronia.find(params[:id])\n @uchronia.destroy\n\n respond_to do |format|\n format.html { redirect_to uchronias_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @chatarea.destroy\n respond_to do |format|\n format.html { redirect_to chatareas_url, notice: 'Chatarea was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @keystroke = Keystroke.find(params[:id])\n @keystroke.destroy\n\n respond_to do |format|\n format.html { redirect_to keystrokes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cio.destroy\n respond_to do |format|\n format.html { redirect_to cios_url, notice: 'Cio excluido.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @miscellaneou.destroy\n respond_to do |format|\n format.html { redirect_to miscellaneous_url, notice: 'Accessory was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def delete(command)\n pp @client.files.delete(clean_up(command[1]))\n end", "def destroy\n @color_scheme.destroy\n respond_to do |format|\n format.html { redirect_to admin_color_schemes_url, notice: 'Color scheme was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def cmd_delete argv\n setup argv\n uuid = @hash['uuid']\n response = @api.delete(uuid)\n msg response\n return response\n end", "def destroy\n @asignatura.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\r\n @consejero.destroy\r\n respond_to do |format|\r\n format.html { redirect_to consejeros_url, notice: 'El nombre del consejero se eliminó corrctamente.' }\r\n format.json { head :no_content }\r\n end\r\n end", "def rm(path)\n cmd 'rm', path\nend", "def destroy\n category = Formulario::REFERENCES_CATEGORY[@formulario.categoria]\n file = File.join(\"#{Formulario::ROUTE_PATH}\",category, @formulario.title)\n FileUtils.rm file\n @formulario.destroy\n respond_to do |format|\n puts \"----------> #{formularios_url}\"\n format.html { redirect_to formularios_url, notice: 'Formulario was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @condclima = Condclima.find(params[:id])\n @condclima.destroy\n\n respond_to do |format|\n format.html { redirect_to condclimas_url }\n format.json { head :no_content }\n end\n end", "def delete # 특정키값을 삭제\n\th = {\n\t\t:사자 => \"육식\",\n\t\t:호랑이 => \"육식\",\n\t\t:코끼리 => \"초식\",\n\t\t:토끼 => \"초식\"\n\t}\n\n\th.delete(:사자)\n\tputs h\nend", "def rm path\n end", "def destroy\n @diagnostico.destroy\n respond_to do |format|\n format.html { redirect_to diagnosticos_url, notice: 'Diagnostico was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n orchio_delete\n end", "def destroy\n @premio_manual.destroy\n respond_to do |format|\n format.html { redirect_to premio_manuals_url, notice: 'Se ha eliminado correctamente' }\n format.json { head :no_content }\n end\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def destroy\n @colegio = Colegio.find(params[:id])\n @colegio.destroy\n\n respond_to do |format|\n format.html { redirect_to colegios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @capitulo.destroy\n respond_to do |format|\n format.html { redirect_to capitulos_url, notice: 'Capitulo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @relogio = Relogio.find(params[:id])\n @relogio.destroy\n\n respond_to do |format|\n format.html { redirect_to relogios_url }\n format.json { head :ok }\n end\n end", "def destroy\n @caixa = Caixa.find(params[:id])\n @caixa.destroy\n\n respond_to do |format|\n format.html { redirect_to caixas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @database = Database.find(params[:id])\n path = @database.path\n delete = %x[rm -R #{path}]\n @database.destroy\n\n respond_to do |format|\n format.html { redirect_to databases_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @contacter = Contacter.find(params[:id])\n @contacter.destroy\n\n respond_to do |format|\n format.html { redirect_to contacters_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @primary_color.destroy\n respond_to do |format|\n format.html { redirect_to primary_colors_url, notice: 'Primary color was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_setting!(header, name)\n write do \n contents.gsub(find_setting(header, name), '')\n end\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def destroy\n @ocorrencium.destroy\n respond_to do |format|\n format.html { redirect_to ocorrencia_url, notice: 'Registro excluído com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @conta.destroy\n params[:id] = nil\n respond_to do |format|\n format.html { redirect_to contas_path, notice: @@titulo + t('msg.remove') }\n format.json { head :no_content }\n end\n end", "def destroy\n @indicativo = Indicativo.find(params[:id])\n @indicativo.destroy\n\n respond_to do |format|\n format.html { redirect_to indicativos_url }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @electronica_consejero.destroy\r\n respond_to do |format|\r\n format.html { redirect_to electronica_consejeros_url, notice: 'El nombre del consejero de ingeniería electrónica se eliminó correctamente.' }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n arquivo = Arquivo.find(@pregoestitulosgrafico.arquivo_id)\n\n File.delete(arquivo.caminho)\n\n pregoestitulo = Pregoestitulo.find(@pregoestitulosgrafico.pregoestitulo_id)\n \n @pregoestitulosgrafico.destroy\n respond_to do |format|\n format.html { redirect_to pregoestitulo, notice: 'Arquivo excluído com sucesso.' }\n format.json { head :no_content }\n end\n end", "def cmd_delete argv\n setup argv\n e = @hash['element']\n response = @api.delete(e)\n msg response\n return response\n end", "def destroy\n #@clinica.destroy\n @clinica.update(:status => 0)\n respond_to do |format|\n format.html { redirect_to clinicas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @consumo = Consumo.find(params[:id])\n @consumo.destroy\n\n respond_to do |format|\n format.html { redirect_to consumos_url }\n format.json { head :no_content }\n end\n end", "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def destroy\n @prueba_json.destroy\n respond_to do |format|\n format.html { redirect_to prueba_jsons_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @caixa.destroy\n respond_to do |format|\n format.html { redirect_to caixas_url, notice: 'Caixa foi excluído(a) com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @fichacortum.destroy\n respond_to do |format|\n format.html { redirect_to fichacorta_url, notice: 'Material eliminado correctamente!' }\n format.json { head :no_content }\n end\n end", "def destroy\n @modelos_contadore.destroy\n respond_to do |format|\n format.html { redirect_to modelos_contadores_url }\n format.json { head :no_content }\n end\n end", "def delete\n redis.eval(LUA_SCRIPT_DELETE, :keys => [build_key('*')])\n end", "def destroy\n @redacao.destroy\n respond_to do |format|\n format.html { redirect_to redacaos_url }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @imobiliaria = Imobiliaria.find(params[:id])\r\n @imobiliaria.destroy\r\n\r\n respond_to do |format|\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @contum = Contum.find(params[:id])\n @contum.destroy\n\n respond_to do |format|\n format.html { redirect_to conta_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @command.destroy\n respond_to do |format|\n format.html { redirect_to commands_url, notice: 'La commande a été détruite.' }\n format.json { head :no_content }\n end\n end", "def rm(*path)\n super; on_success{ nil }\n end", "def destroy\n @coisa = Coisa.find(params[:id])\n @coisa.destroy\n\n respond_to do |format|\n format.html { redirect_to coisas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @historico_converca.destroy\n respond_to do |format|\n format.html { redirect_to historico_convercas_url, notice: 'Historico converca was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @formato.update(ativo: false)\n render json: @formato\n end", "def destroy\n @detalle_documento_de_compra.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Linea eliminada' }\n format.json { head :no_content }\n end\n end", "def destroy\n @indicacao = Indicacao.find(params[:id])\n @indicacao.destroy\n\n respond_to do |format|\n format.html { redirect_to indicacoes_url }\n format.json { head :no_content }\n end\n end", "def delete(path, accept, content = {})\n execute HttpConnect::HttpDelete.new(path, nil, accept, content)\n end", "def destroy\n @dish_style.destroy\n respond_to do |format|\n format.html { redirect_to dish_styles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_car_setting.destroy\n respond_to do |format|\n format.html { redirect_to _user_car_settings_url, notice: 'Configuración eliminada' }\n format.json { head :no_content }\n end\n end", "def destroy\n @cfile.destroy\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end", "def destroy\n @centrodecusto = Centrodecusto.find(params[:id])\n @centrodecusto.destroy\n\n #respond_to do |format|\n # format.html { redirect_to centrodecustos_url }\n # format.json { head :no_content }\n #end\n end", "def destroy\n @trein_consul_comercial.destroy\n respond_to do |format|\n format.html { redirect_to trein_consul_comercials_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @patrocinio = Patrocinio.find(params[:id])\n @patrocinio.destroy\n\n respond_to do |format|\n format.html { redirect_to patrocinios_url }\n format.json { head :ok }\n end\n end", "def destroy\n @interior_colour.destroy\n respond_to do |format|\n format.html { redirect_to admin_interior_colours_url, notice: 'Interior colour was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @barrio_colonium.destroy\n respond_to do |format|\n format.html { redirect_to barrio_colonia_url, notice: 'Barrio colonium was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @concurso = Concurso.find(params[:id])\n @concurso.destroy\n\n respond_to do |format|\n format.html { redirect_to concursos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @curso.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\r\n @sistemas_consejero.destroy\r\n respond_to do |format|\r\n format.html { redirect_to sistemas_consejeros_url, notice: 'El nombre del consejero de ingeniería de sistemas se eliminó correctamente.' }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @japan_style = JapanStyle.find(params[:id])\n @japan_style.destroy\n\n respond_to do |format|\n format.html { redirect_to japan_styles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @terminal.destroy\n respond_to do |format|\n format.html { redirect_to admin_terminals_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cooperativa = Cooperativa.find(params[:id])\n @cooperativa.update_attributes :status => Status.find_by_descricao('Inativo')\n\n respond_to do |format|\n format.html { redirect_to admin_cooperativas_path }\n format.json { head :ok }\n end\n end", "def destroy\n @concedente.destroy\n respond_to do |format|\n format.html { redirect_to concedentes_url }\n format.json { head :no_content }\n end\n end", "def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end", "def destroy\n @characteristic_detail.destroy\n respond_to do |format|\n format.html { redirect_to admin_characteristic_path(session[:characteristic]), notice: 'Características Eliminada' }\n format.json { head :no_content }\n end\n end", "def destroy\n @guium.destroy\n respond_to do |format|\n format.html { redirect_to guia_url, notice: 'Eliminado exitosamente' }\n format.json { head :no_content }\n end\n end", "def destroy\n @recommand = Recommand.find(params[:id])\n @recommand.destroy\n\n respond_to do |format|\n format.html { redirect_to(recommands_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @capacitacion = Capacitacion.find(params[:id])\n @capacitacion.destroy\n\n respond_to do |format|\n format.html { redirect_to capacitacions_url }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @electrica_consejero.destroy\r\n respond_to do |format|\r\n format.html { redirect_to electrica_consejeros_url, notice: 'El nombre del consejero de eléctrica se eliminó corrctamente.' }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @configuracion.destroy\n respond_to do |format|\n format.html { redirect_to configuraciones_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @prod_cli.destroy\n respond_to do |format|\n format.html { redirect_to prod_clis_url, notice: 'produto excluido com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @line = Line.find_by_no(params[:id])\n @line.destroy\n\n respond_to do |format|\n format.html { redirect_to lines_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tipo_contrato = TipoContrato.find(params[:id])\n @tipo_contrato.destroy\n\n respond_to do |format|\n format.html { redirect_to tipo_contratos_url }\n format.json { head :no_content }\n end\n end", "def delete!\n Recliner.delete(uri)\n end", "def delete(path)\n request 'DELETE', path\n end", "def delete_json(url)\n JSON.parse(delete(url, :json, :json))\n end", "def destroy\n @areco = Areco.find(params[:id])\n @areco.destroy\n\n respond_to do |format|\n format.html { redirect_to arecos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @caixa.destroy\n respond_to do |format|\n format.html { redirect_to caixas_url, notice: 'Caixa was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ficha_recinto.destroy\n respond_to do |format|\n format.html { redirect_to ficha_recintos_url, notice: 'Ficha recinto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ficha = Ficha.find(params[:id])\n @ficha.destroy\n\n respond_to do |format|\n format.html { redirect_to fichas_url }\n format.json { head :no_content }\n end\n end", "def delete(path)\n request(:delete, path)\n end", "def destroy\n @attri = Attri.find(params[:id])\n @attri.destroy\n\n respond_to do |format|\n format.html { redirect_to attris_url }\n format.json { head :ok }\n end\n end", "def delete(options={})\n connection.delete(\"/\", @name)\n end", "def destroy\n @fichier_reclamation.destroy\n respond_to do |format|\n format.html { redirect_to fichier_reclamations_url, notice: 'Fichier reclamation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @pre_contrato.destroy\n respond_to do |format|\n format.html { redirect_to pre_contratos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @capacidad = Capacidad.find(params[:id])\n @capacidad.destroy\n\n respond_to do |format|\n format.html { redirect_to capacidades_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tamanho.destroy\n respond_to do |format|\n format.html { redirect_to tamanhos_url, notice: 'Tamanho was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ciclistum.destroy\n respond_to do |format|\n format.html { redirect_to ciclista_url, notice: 'Ciclistum was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n start { |connection| connection.request http :Delete }\n end" ]
[ "0.5802092", "0.57930374", "0.57780457", "0.5692974", "0.5563834", "0.55314684", "0.55088896", "0.54908794", "0.54897314", "0.5482194", "0.54415286", "0.54327476", "0.5422622", "0.54155844", "0.54045355", "0.53915805", "0.5378258", "0.5363064", "0.5359313", "0.53576076", "0.5355012", "0.5347674", "0.5340974", "0.5329895", "0.53288686", "0.5326646", "0.5326436", "0.5324909", "0.5311198", "0.53080505", "0.53044", "0.5302666", "0.53004587", "0.5293242", "0.5284632", "0.5278238", "0.52774197", "0.52770436", "0.5269735", "0.526319", "0.52579945", "0.52538425", "0.5250646", "0.52483785", "0.52375", "0.52352154", "0.52351624", "0.5235029", "0.5232228", "0.52314276", "0.5228368", "0.5228161", "0.5225876", "0.5223463", "0.522195", "0.521854", "0.5217221", "0.52155924", "0.52127", "0.52093107", "0.5207047", "0.5205195", "0.5200562", "0.5199745", "0.51995134", "0.51989615", "0.5197706", "0.51976657", "0.5195671", "0.51945037", "0.5193564", "0.51933503", "0.5193269", "0.5192119", "0.51918596", "0.5191132", "0.518495", "0.51843554", "0.5182294", "0.5181987", "0.5176241", "0.5169586", "0.51680917", "0.5164785", "0.5164101", "0.5162741", "0.51617825", "0.5159493", "0.51554024", "0.51540977", "0.5150109", "0.5148903", "0.51482505", "0.5147615", "0.5147113", "0.51460755", "0.514557", "0.5145459", "0.5144518" ]
0.6178964
1
create new RevDate with given year, month, day (numeric, using revolutionary year, month, day)
def initialize(year, month, day) @year = year @month = month @day = day end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new(year = -4712, month = 1, day = 1, sg = ITALY)\n # we can catch this here already\n raise ArgumentError, \"invalid date\" if month > 12\n \n unless valid_civil?(year, month, day, sg)\n raise ArgumentError, \"invalid date, because it falls in the dropped days range of the calendar reform\"\n end\n \n components = NSDateComponents.new\n components.year = year\n components.month = month\n components.day = day\n \n # TODO: check when this can return `nil' instead of a date\n date = GREGORIAN_CALENDAR.dateFromComponents(components)\n interval = date.timeIntervalSinceReferenceDate\n \n mrdate = alloc.initWithTimeIntervalSinceReferenceDate(interval)\n mrdate.sg = sg\n \n # no positive wrap around!\n if mrdate.day < day && (mrdate.month == (month + 1) % 12)\n raise ArgumentError, \"invalid date\"\n end\n \n mrdate\n end", "def new_year(date) = ::Date.new(Integer === date ? date : date(date).year, 1, 1, reform_jd).new_start(::Date::GREGORIAN)", "def make_date(date_params)\n\t raise ArgumentException, \"Date parameters nil or missing month or day value\" if date_params.nil? or date_params[\"month\"].nil? or date_params[\"day\"].nil?\n\t my = Time.at(date_params[\"month\"].to_i).gmtime\n\t day = date_params[\"day\"].to_i\n\t \n\t Time.gm(my.year, my.month, day)\n\tend", "def to_date\n ::Date.new(@year, @month, @day)\n end", "def to_date\n Date.new(year, number, 1)\n end", "def to_date\n Date.new(year, month, day)\n end", "def build_date_from_year_month(data)\n dt = data['year']\n if data['month']\n dt += '-' + data['month'] + '-1'\n end\n dt\n end", "def date(date)\n @datee = Date.new(date[:year],date[:month],date[:day])\n end", "def initialize(year, month, day)\n @year = year\n @month = month\n @day = day\n end", "def initialize(year, month, day)\n @year = year\n @month = month\n @day = day\n end", "def initialize(year, month, day)\n @year = year\n @month = month\n @day = day\n end", "def to_date\n ::Date.new(year, month, day)\n end", "def date_parse raw_day, raw_month\n str_month = raw_month.scan(@regex_monthes)[0]\n month = @monthes[str_month]\n return if not month\n day = raw_day.to_i\n return if day==0\n today = Date.today\n if day < today.day and month == 12\n year = today.year + 1\n else\n year = today.year\n end\n #puts year, year.class, month, month.class, day, day.class\n return \"#{year}-#{\"%02d\"%month}-#{\"%02d\"%day}\"\nend", "def to_rd\n normal_days = 365 * (@year - 1)\n leap_days = (((@year - 1) / 4).floor -\n ((@year - 1) / 100).floor +\n ((@year - 1) / 400).floor)\n # The following formula assumes that February has 30 days.\n previous_days = ((367 * @month - 362) / 12).floor\n # Correction for the previous formula.\n correction = nil\n # We are before February, no correction needed.\n if @month <= 2\n correction = 0\n # Leap year => February has 29 days - 30 = -1.\n elsif leap?\n correction = -1\n # Normal year => February has 28 days - 30 = -2.\n else\n correction = -2\n end\n return (EPOCH - 1 + normal_days + leap_days + previous_days +\n correction + @day)\n end", "def year(input) = new_year(input).year - 621", "def getDate(day, month, year)\n day << @day\n month << @month\n year << @year\n end", "def date(g_year, g_month = nil, g_day = nil)\n the_year = g_year.is_a?(Fixnum) ? g_year : g_year.year\n if g_month && g_day\n Julian::Date[the_year, g_month, g_day]\n else\n Julian::Year[the_year]\n end\n end", "def new_years_day_for(year)\n nyd = Date.new(year,1,1)\n if nyd.saturday?\n Date.new(year,1,3)\n elsif nyd.sunday?\n Date.new(year,1,2)\n else\n nyd\n end\n end", "def future(year, month, day)\n years = (10 ** 9) / 60 / 60 / 24 / 365\n days = (10 ** 9) / 60 / 60 / 24 % 365\n\n year = year + years\n \n\nend", "def build_date_from_params(date_of_entry, params)\n Date.new(params[\"#{date_of_entry.to_s}(1i)\"].to_i,\n params[\"#{date_of_entry.to_s}(2i)\"].to_i,\n params[\"#{date_of_entry.to_s}(3i)\"].to_i)\n end", "def change(options)\n ::Date.new(\n options.fetch(:year, year),\n options.fetch(:month, month),\n options.fetch(:day, day)\n )\n end", "def to_date\n us_format = /^([0-9]{1,2})[-\\/\\.]([0-9]{1,2})[-\\/\\.]([0-9]+)$/ # US standard MM/DD/YYYY, allowing for 2 digit year\n db_format = /^([0-9]{4})[-\\/\\.]([0-9]{2})[-\\/\\.]([0-9]{2})$/ # More sane, but less common YYYY-MM-DD\n\n if self.match(us_format)\n m, d, y = self.extract(us_format)\n elsif self.match(db_format)\n y, m, d = self.extract(db_format)\n else\n return nil\n end\n \n y = y.to_i\n if y < 100\n # Ok, we'll let you do this 2 digit thing, but only because we like you.\n # Assume that 10 years in the future is as far as we're interested in.\n cutoff = Date.today.year - 2000 + 10\n y += (y < cutoff) ? 2000 : 1900\n end\n Date.new(y,m.to_i,d.to_i) rescue nil\n end", "def to_date(date, year)\n Date.parse(\"#{date}-#{year}\")\n end", "def to_fixed(fr_date = self)\n mmonth = fr_date.month\n dday = fr_date.day\n yyear = fr_date.year\n new_year = new_year_on_or_before((epoch + 180 + MEAN_TROPICAL_YEAR * (yyear - 1)).floor)\n new_year - 1 + 30 * (mmonth - 1) + dday\n end", "def test_Date_001_Ruby_DateManipulation\n\n require 'date'\n\n puts2(\"\")\n puts2(\"#######################\")\n puts2(\"Testcase: test_Date_001_Ruby_DateManipulation\")\n puts2(\"#######################\")\n\n sDateString = \"2/29/2000\"\n puts2(\"Convert #{sDateString}\")\n\n aDate = sDateString.split(\"/\")\n\n iMonth = aDate[0].to_i\n iDay = aDate[1].to_i\n iYear = aDate[2].to_i\n\n puts2(\" Month: #{iMonth.to_s}, Day #{iDay.to_s}, Year #{iYear.to_s}\")\n\n puts2(\"\")\n puts2(\"Create a date object from the MM, DD, YY strings\")\n\n # Convert 2 digit years into 4-digit years\n if(iYear <= 99)\n iYear = (2000 + iYear)\n puts2(\"4-digit year: #{iYear.to_s}\")\n end\n\n # Create a date object\n #\n # Syntax: Date.new(y=-4712, m=1, d=1, sg=ITALY)\n tDate = Date.new(iYear, iMonth, iDay)\n puts2(\"The date is #{tDate.to_s}\")\n\n tDayBefore = tDate -1\n puts2(\"The day before is #{tDayBefore.to_s}\")\n puts2(\"The day before is also #{tDayBefore.strftime(\"%m/%d/%Y\")}\")\n\n tDayAfter = tDate.next\n puts2(\"The day after is #{tDayAfter.to_s}\")\n\n tMonthBefore = tDate << 1\n puts2(\"The month before is #{tMonthBefore.to_s}\")\n\n tMonthAfter= tDate >> 1\n puts2(\"The month after is #{tMonthAfter.to_s}\")\n\n tYearBefore = tDate << 12\n puts2(\"The year before is #{tYearBefore.to_s}\")\n\n tYearAfter = tDate >> 12\n puts2(\"The year after is #{tYearAfter.to_s}\")\n\n ######################\n sDateString = \"2/29/2004\"\n puts2(\"######################\")\n puts2(\"Convert #{sDateString}\")\n\n aDate = sDateString.split(\"/\")\n\n iMonth = aDate[0].to_i\n iDay = aDate[1].to_i\n iYear = aDate[2].to_i\n\n puts2(\" Month: #{iMonth.to_s}, Day #{iDay.to_s}, Year #{iYear.to_s}\")\n\n puts2(\"\")\n puts2(\"Create a date object from the MM, DD, YY strings\")\n\n # Convert 2 digit years into 4-digit years\n if(iYear <= 99)\n iYear = (2000 + iYear)\n puts2(\"4-digit year: #{iYear.to_s}\")\n end\n\n # Create a date object\n #\n # Syntax: Date.new(y=-4712, m=1, d=1, sg=ITALY)\n tDate = Date.new(iYear, iMonth, iDay)\n puts2(\"The date is #{tDate.to_s}\")\n\n tDayBefore = tDate -1\n puts2(\"The day before is #{tDayBefore.to_s}\")\n puts2(\"The day before is also #{tDayBefore.strftime(\"%m/%d/%Y\")}\")\n\n tDayAfter = tDate.next\n puts2(\"The day after is #{tDayAfter.to_s}\")\n\n tMonthBefore = tDate << 1\n puts2(\"The month before is #{tMonthBefore.to_s}\")\n\n tMonthAfter= tDate >> 1\n puts2(\"The month after is #{tMonthAfter.to_s}\")\n\n tYearBefore = tDate << 12\n puts2(\"The year before is #{tYearBefore.to_s}\")\n\n tYearAfter = tDate >> 12\n puts2(\"The year after is #{tYearAfter.to_s}\")\n\n ######################\n sDateString = \"12/31/2018\"\n\n puts2(\"######################\")\n puts2(\"Convert #{sDateString}\")\n\n aDate = sDateString.split(\"/\")\n\n iMonth = aDate[0].to_i\n iDay = aDate[1].to_i\n iYear = aDate[2].to_i\n\n puts2(\" Month: #{iMonth.to_s}, Day #{iDay.to_s}, Year #{iYear.to_s}\")\n\n puts2(\"\")\n puts2(\"Create a date object from the MM, DD, YY strings\")\n\n # Convert 2 digit years into 4-digit years\n if(iYear <= 99)\n iYear = (2000 + iYear)\n puts2(\"4-digit year: #{iYear.to_s}\")\n end\n\n # Create a date object\n #\n # Syntax: Date.new(y=-4712, m=1, d=1, sg=ITALY)\n tDate = Date.new(iYear, iMonth, iDay)\n puts2(\"The date is #{tDate.to_s}\")\n\n tDayBefore = tDate -1\n puts2(\"The day before is #{tDayBefore.to_s}\")\n puts2(\"The day before is also #{tDayBefore.strftime(\"%m/%d/%Y\")}\")\n\n tDayAfter = tDate.next\n puts2(\"The day after is #{tDayAfter.to_s}\")\n\n tMonthBefore = tDate << 1\n puts2(\"The month before is #{tMonthBefore.to_s}\")\n\n tMonthAfter= tDate >> 1\n puts2(\"The month after is #{tMonthAfter.to_s}\")\n\n tYearBefore = tDate << 12\n puts2(\"The year before is #{tYearBefore.to_s}\")\n\n tYearAfter = tDate >> 12\n puts2(\"The year after is #{tYearAfter.to_s}\")\n\n ######################\n sDateString = \"12-31-18\"\n puts2(\"######################\")\n puts2(\"Convert #{sDateString}\")\n\n aDate = sDateString.split(\"-\")\n\n iMonth = aDate[0].to_i\n iDay = aDate[1].to_i\n iYear = aDate[2].to_i\n\n puts2(\" Month: #{iMonth.to_s}, Day #{iDay.to_s}, Year #{iYear.to_s}\")\n\n puts2(\"\")\n puts2(\"Create a date object from the MM, DD, YY strings\")\n\n # Convert 2 digit years into 4-digit years\n if(iYear <= 99)\n iYear = (2000 + iYear)\n puts2(\"Now try with a 4-digit year: #{iYear.to_s}\")\n end\n\n # Create a date object\n #\n # Syntax: Date.new(y=-4712, m=1, d=1, sg=ITALY)\n tDate = Date.new(iYear, iMonth, iDay)\n puts2(\"The date is #{tDate.to_s}\")\n\n tDayBefore = tDate -1\n puts2(\"The day before is #{tDayBefore.to_s}\")\n puts2(\"The day before is also #{tDayBefore.strftime(\"%m/%d/%Y\")}\")\n\n tDayAfter = tDate.next\n puts2(\"The day after is #{tDayAfter.to_s}\")\n\n tMonthBefore = tDate << 1\n puts2(\"The month before is #{tMonthBefore.to_s}\")\n\n tMonthAfter= tDate >> 1\n puts2(\"The month after is #{tMonthAfter.to_s}\")\n\n tYearBefore = tDate << 12\n puts2(\"The year before is #{tYearBefore.to_s}\")\n\n tYearAfter = tDate >> 12\n puts2(\"The year after is #{tYearAfter.to_s}\")\n ######################\n\n end", "def change(options)\n ::Date.new(\n options.fetch(:year, year),\n options.fetch(:month, month),\n options.fetch(:day, day)\n )\n end", "def make_year(year, bias); end", "def to_rd\n return EPOCH + 365*(@year-1) + 30*(@month-1) + @day - 1\n end", "def update!(**args)\n @year = args[:year] if args.key?(:year)\n @month = args[:month] if args.key?(:month)\n @day = args[:day] if args.key?(:day)\n end", "def update!(**args)\n @year = args[:year] if args.key?(:year)\n @month = args[:month] if args.key?(:month)\n @day = args[:day] if args.key?(:day)\n end", "def get_date(day=nil, month=nil, year=nil, offset=0)\n\n require 'rubygems'\n require 'active_support'\n require 'active_support/time'\n\n cur_date = Date.today\n\n if offset < 0\n if day != nil &&\tmonth != nil &&\tyear != nil\n @com_date = cur_date - day\n @com_date = @com_date << month\n @com_date = @com_date << 12 * year\n end\n if day != nil && month != nil && year == nil\n @com_date = cur_date - day\n @com_date = @com_date << month\n end\n\n if day != nil && month == nil && year != nil\n @com_date = cur_date - day\n @com_date = @com_date << 12 * year\n end\n if day != nil && month == nil && year == nil\n @com_date = cur_date - day\n end\n if day == nil && month != nil && year != nil\n @com_date = cur_date << month\n @com_date = @com_date << 12 * year\n end\n if day == nil && month != nil && year == nil\n @com_date = cur_date << month\n end\n if day == nil && month == nil && year != nil\n @com_date = cur_date << 12 * year\n end\n\n elsif offset > 0\n if day != nil &&\tmonth != nil &&\tyear != nil\n @com_date = cur_date + day\n @com_date = @com_date >> month\n @com_date = @com_date >> 12 * year\n\n end\n if day != nil && month != nil && year == nil\n @com_date = cur_date + day\n @com_date = @com_date >> month\n end\n\n if day != nil && month == nil && year != nil\n @com_date = cur_date + day\n @com_date = @com_date >> 12 * year\n end\n if day != nil && month == nil && year == nil\n @com_date = cur_date + day\n end\n if day == nil && month != nil && year != nil\n @com_date = cur_date >> month\n @com_date = @com_date >> 12 * year\n end\n if day == nil && month != nil && year == nil\n @com_date = cur_date >> month\n end\n if day == nil && month == nil && year != nil\n @com_date = cur_date >> 12 * year\n end\n elsif day == nil &&\tmonth == nil &&\tyear == nil && offset == 0\n @com_date = cur_date\n else\n fail(\"Invalid Argument Passed to get date method. Please enter correct arguments\")\n end\nreturn @com_date.strftime(\"%m/%d/%Y\").to_s\nend", "def fiscal_new_year_date(date = Date.current)\n Date.new(calculate_fiscal_year(date),05,01)\n end", "def get_date_node(date)\n year, month, day = date.strftime(\"%Y/%m/%d\").split(\"/\")\n\n yearly = find(year) || create(year)\n monthly = yearly.find(month) || yearly.create(month)\n monthly.find(day) || monthly.create(day)\n end", "def new_year(input)\n equinox = Integer === input ? @astro.solar_event(:march_equinox, input) : @astro.previous(:march_equinox, input)\n date = local_date(equinox)\n equinox.localtime(utc_offset).hour < 12 ? date : date + 1\n end", "def lunar_date(year, month, day)\n l = yang_to_nong(year, month, day)\n l[0].to_s + '-' + l[1].to_s + '-' + (/^\\d+/.match(l[2].to_s)).to_s\n end", "def build_date_from_params(field_name, params)\n Date.new(params[\"#{field_name.to_s}(1i)\"].to_i, \n params[\"#{field_name.to_s}(2i)\"].to_i, \n params[\"#{field_name.to_s}(3i)\"].to_i)\n end", "def get_date(row_data)\n values = row_data.to_s.chomp.split(' ')\n month = values.map { |token| MONTHS[token.downcase] }.compact.first\n year = values.find { |token| /\\d{4}/ =~ token }\n date = Date.new(year.to_i, month)\n @latest_date = date if latest_date < date\n date\n end", "def nextVersion\n newRevision(@year, @month, @revCount.nil? ? 1 : @revCount + 1)\n end", "def from_hash(hash)\n date = Date.today\n begin\n date = Date.new(hash[:year].to_i, hash[:month].to_i, hash[:day].to_i)\n rescue\n begin\n date = Date.new(hash[:year].to_i, hash[:month].to_i, 1)\n date = date.end_of_month\n rescue\n end\n end\n date\n end", "def fy(d)\n\t\td = d.to_date\n\t\tif(d.month >= 2)\n\t\t\treturn (d.year+1)\n\t\telse\n\t\t\treturn d.year\n\t\tend\n\tend", "def test_it_can_be_converted_to_a_ruby_date_object\n assert_equal ::Date.new(2016, 1, 1), CarbonDate::Date.new(2016, precision: :year).to_date\n assert_equal ::Date.new(2016, 12, 1), CarbonDate::Date.new(2016, 12, precision: :month).to_date\n assert_equal ::Date.new(2016, 12, 12), CarbonDate::Date.new(2016, 12, 12, precision: :day).to_date\n assert_equal ::Date.new(-44, 3, 15), CarbonDate::Date.new(-44, 3, 15, precision: :day).to_date\n end", "def build_date_from_params(params, search_object, search_date)\n\n anio = params[search_object][search_date + \"(1i)\"]\n mes = params[search_object][search_date + \"(2i)\"]\n dia = params[search_object][search_date + \"(3i)\"]\t\t\n\n\t\treturn Date.new(anio.to_i, mes.to_i, dia.to_i)\n\n\tend", "def save_expiry_date_period(month, year, day, product_id, part_number)\n\n \t# First we check if the date is already in the table\n \tif(Calendar.where(year: year, month: month).blank?)\n \t c = Calendar.new(year: year, month: month)\n \t c.info = get_info(day, product_id, part_number)\n \t c.save\n \telse\n \t c = Calendar.where(month: month, year: year)\n \t string = c.info\n \t c.info = get_info(day, product_id, part_number, string)\n \t c.info.save\n \tend\n end", "def to_date(dt)\n Date.new(dt.year, dt.month, dt.day)\n end", "def nextDate\n sd = SimpleDate.new(@month, @day, @year)\n\n if (sd.month == 12 && sd.day == 31)\n return SimpleDate.new(1, 1, @year+1)\n\n elsif (leapYear? && sd.month == 2 && sd.day == DAYS_IN_MONTH[sd.month] )\n return SimpleDate.new(2, 29, @year)\n\n elsif(sd.day == SimpleDate.daysInMonth(month, year))\n return SimpleDate.new(@month + 1, 1, @year)\n\n else\n return SimpleDate.new(@month, @day + 1, @year)\n end\n end", "def params_to_date(params,key)\r\n date = Date.civil(params[key][:year].to_i, params[key][:month].to_i, params[key][:day].to_i)\r\n end", "def to_fixed(g_date = self)\n mmonth = g_date.month\n dday = g_date.day\n yyear = g_date.year\n ((epoch - 1) + \n (365 * (yyear - 1)) + \n quotient(yyear - 1, 4) - \n quotient(yyear - 1, 100) + \n quotient(yyear - 1, 400) + \n quotient((367 * mmonth) - 362, 12) +\n (if mmonth <= 2\n 0\n elsif leap_year?(yyear)\n -1\n else\n -2\n end) + \n dday)\n end", "def test_initialize_date_with_date()\n date = @ad_manager.date(Date.new(2017, 11, 7))\n assert_equal(2017, date.year)\n assert_equal(11, date.month)\n assert_equal(7, date.day)\n end", "def initialize(*args)\n if args.empty?\n\t\t\tdate = Date.today\n\t\t\tmonth = date.mon unless month\n\t\t\tyear = date.year unless year\n elsif args.size == 2 &&\n args.first.is_a?(Integer) && args.last.is_a?(Integer)\n year, month = args.first, args.last\n else\n month = args.first.month\n year = args.first.year\n end\n\t\tfail \"invalid month\" if month < 1 || month > 12\n\t\t@month = month\n\t\t@year = year\n\tend", "def update_casa_case_birth_month_year_youth(casa_case, new_date)\n casa_case.update!(birth_month_year_youth: Date.new(new_date.year, new_date.month, 1))\nend", "def test_initialize_date()\n date = @ad_manager.date(2017, 11, 7)\n assert_equal(2017, date.year)\n assert_equal(11, date.month)\n assert_equal(7, date.day)\n end", "def initialize(aDate = Date.today)\n year = aDate.year\n mon = aDate.mon\n aDate = Date.new(year,1,1)\n @cols = Array.new\n while (year == aDate.year)\n # do one column\n col = Array.new\n @cols[mon-1] = col\n while (mon == aDate.mon)\n col[aDate.mday-1] = aDate.yday.to_s\n aDate = aDate.succ\n end\n mon = aDate.mon\n end\n end", "def ordinal(year, yday, hour=0, min=0, sec=0, usec=0, offset=0)\n new!(:ordinal=>[year, yday], :parts=>[hour, min, sec, usec], :offset=>offset)\n end", "def extract_day_mth_yr(given_date)\n\ttmp_new_date = given_date.split('/')\n\t# Get the current month\n\tset_cur_mth(tmp_new_date[0])\n\t# Get the current day\n\tset_cur_day(tmp_new_date[1])\n\t# Get the current year\n\tset_cur_year(tmp_new_date[2])\n\t# Get the body of the output filename\n\t$op_file_body = \"_\"+ month_num_to_ver(get_cur_mth) +\"_\"+ get_cur_day.to_s + \"_\" + get_cur_year.to_s\n\t# Get the name of the output filename\n\t$op_filename = $op_file_prefix + $op_file_body + $op_file_suffix\nend", "def date\n Date.civil(year, month, 1)\n end", "def date(input, format); end", "def to_calendar(f_date = self.fixed)\n new_year = new_year_on_or_before(f_date)\n yyear = ((new_year - epoch) / MEAN_TROPICAL_YEAR).round + 1\n mmonth = quotient(f_date - new_year, 30) + 1\n dday = ((f_date - new_year) % 30) + 1\n self.class::Date.new(yyear, mmonth, dday)\n end", "def get_revdate(doc_path)\n doc = Nokogiri::HTML(File.open(doc_path)) { |config| config.strict.nonet}\n revdate = doc.search('//span[@id=\"revdate\"]').text.strip\n DateTime.strptime(revdate, '%Y-%m-%d') if /^\\d{4}-\\d{2}-\\d{2}$/.match(revdate)\nend", "def alt_to_fixed(g_date)\n month = standard_month(g_date)\n day = standard_day(g_date)\n year = standard_year(g_date)\n m = amod(month - 2, 12)\n y = year + quotient(month + 9, 12)\n ((gregorian_epoch - 1) +\n -306 +\n 365 * (y - 1) +\n quotient(y - 1, 4) +\n -quotient(y - 1, 100) +\n quotient(y - 1, 400) +\n quotient(3 * m - 1, 5) +\n 30 * (m - 1) +\n day)\n end", "def set_date(date)\n param = date[:year]\n if date.key? :month\n param << \":\" << date[:month]\n param << \":\" << date[:day] if date.key? :day\n end\n Jhead.call(\"-ds\" << param, @match, @pattern)\n end", "def initialize(start_year=nil)\n start_year ||= find_default_start_year\n @start_date = Date.new(start_year,8,1)\n @end_date = Date.new((start_year + 1),7,31)\n end", "def handle_od_gr\n handle_od\n next_tag\n handle_gr\n # ignore unit\n @year, @month = Date::add_month(@local_date.year, @local_date.month, @modifier)\n next_tag\n end", "def easter\n y = year\n a = y % 19\n b = y / 100\n c = y % 100\n d = b / 4\n e = b % 4\n f = (b + 8) / 25\n g = (b - f + 1) / 3;\n h = (19 * a + b - d - g + 15) % 30\n i = c / 4\n k = c % 4\n l = (32 + 2 * e + 2 * i - h - k) % 7\n m = (a + 11 * h + 22 * l) / 451\n month = (h + l - 7 * m + 114) / 31\n day = ((h + l - 7 * m + 114) % 31) + 1\n Date.civil(year, month, day)\n end", "def adjust_date(install_date, granting_date)\n if install_date.year < 2010\n install_date = Date.new(2010, 1, 1)\n end\n\n next_anniversary = Date.new(granting_date.year, install_date.month, install_date.day)\n six_months = next_anniversary >> 6\n\n if granting_date > six_months\n calc_month = Date.new(six_months.year, six_months.month, 1)\n else\n calc_month = Date.new(six_months.year - 1, six_months.month, 1)\n # Why is isn't there a retreat method!?\n end\n\n calc_month\n end", "def build_date_from_hash(hash_params, search_date)\n\n anio = hash_params[search_date + \"(1i)\"]\n mes = hash_params[search_date + \"(2i)\"]\n dia = hash_params[search_date + \"(3i)\"]\t\t\n\n\t\treturn Date.new(anio.to_i, mes.to_i, dia.to_i)\n\n\tend", "def normalize_dates!\n pub_date = self.emma_publicationDate&.to_s\n pub_year = pub_date&.first(4)\n if pub_date&.end_with?('-01-01')\n self.dcterms_dateCopyright ||= IsoYear.new(pub_year)\n cpr_date = self.dcterms_dateCopyright.to_s\n self.emma_publicationDate = nil if cpr_date == pub_year\n elsif (cpr_date = self.dcterms_dateCopyright&.to_s)\n self.dcterms_dateCopyright = nil if cpr_date == pub_year\n end\n end", "def update!(**args)\n @day = args[:day] if args.key?(:day)\n @month = args[:month] if args.key?(:month)\n @year = args[:year] if args.key?(:year)\n end", "def update!(**args)\n @day = args[:day] if args.key?(:day)\n @month = args[:month] if args.key?(:month)\n @year = args[:year] if args.key?(:year)\n end", "def update!(**args)\n @day = args[:day] if args.key?(:day)\n @month = args[:month] if args.key?(:month)\n @year = args[:year] if args.key?(:year)\n end", "def update!(**args)\n @day = args[:day] if args.key?(:day)\n @month = args[:month] if args.key?(:month)\n @year = args[:year] if args.key?(:year)\n end", "def update!(**args)\n @day = args[:day] if args.key?(:day)\n @month = args[:month] if args.key?(:month)\n @year = args[:year] if args.key?(:year)\n end", "def update!(**args)\n @day = args[:day] if args.key?(:day)\n @month = args[:month] if args.key?(:month)\n @year = args[:year] if args.key?(:year)\n end", "def update!(**args)\n @day = args[:day] if args.key?(:day)\n @month = args[:month] if args.key?(:month)\n @year = args[:year] if args.key?(:year)\n end", "def update!(**args)\n @day = args[:day] if args.key?(:day)\n @month = args[:month] if args.key?(:month)\n @year = args[:year] if args.key?(:year)\n end", "def update!(**args)\n @day = args[:day] if args.key?(:day)\n @month = args[:month] if args.key?(:month)\n @year = args[:year] if args.key?(:year)\n end", "def update!(**args)\n @day = args[:day] if args.key?(:day)\n @month = args[:month] if args.key?(:month)\n @year = args[:year] if args.key?(:year)\n end", "def update!(**args)\n @day = args[:day] if args.key?(:day)\n @month = args[:month] if args.key?(:month)\n @year = args[:year] if args.key?(:year)\n end", "def update!(**args)\n @day = args[:day] if args.key?(:day)\n @month = args[:month] if args.key?(:month)\n @year = args[:year] if args.key?(:year)\n end", "def update!(**args)\n @day = args[:day] if args.key?(:day)\n @month = args[:month] if args.key?(:month)\n @year = args[:year] if args.key?(:year)\n end", "def update!(**args)\n @day = args[:day] if args.key?(:day)\n @month = args[:month] if args.key?(:month)\n @year = args[:year] if args.key?(:year)\n end", "def update!(**args)\n @day = args[:day] if args.key?(:day)\n @month = args[:month] if args.key?(:month)\n @year = args[:year] if args.key?(:year)\n end", "def update!(**args)\n @day = args[:day] if args.key?(:day)\n @month = args[:month] if args.key?(:month)\n @year = args[:year] if args.key?(:year)\n end", "def update!(**args)\n @day = args[:day] if args.key?(:day)\n @month = args[:month] if args.key?(:month)\n @year = args[:year] if args.key?(:year)\n end", "def update!(**args)\n @day = args[:day] if args.key?(:day)\n @month = args[:month] if args.key?(:month)\n @year = args[:year] if args.key?(:year)\n end", "def update!(**args)\n @day = args[:day] if args.key?(:day)\n @month = args[:month] if args.key?(:month)\n @year = args[:year] if args.key?(:year)\n end", "def update!(**args)\n @day = args[:day] if args.key?(:day)\n @month = args[:month] if args.key?(:month)\n @year = args[:year] if args.key?(:year)\n end", "def update!(**args)\n @day = args[:day] if args.key?(:day)\n @month = args[:month] if args.key?(:month)\n @year = args[:year] if args.key?(:year)\n end", "def analyze( date, euro )\n date = clean_parameter date\n\n @original = date\n\n date = massage date\n @fixed = date\n\n @year, @month, @day = nil\n\n if date =~ Variables::DATE_PATTERNS[ :yyyy ]\n @year = $1.to_i\n\n elsif date =~ Variables::DATE_PATTERNS[ :yyyy_mm_dd_and_yyyy_mm ]\n @year = $1.to_i\n @month = $2.to_i unless $2.nil?\n @day = $3.to_i unless $3.nil?\n\n elsif date =~ Variables::DATE_PATTERNS[ :dd_mm_yyyy ] && euro\n @day = $1.to_i\n @month = $2.to_i\n @year = $3.to_i\n\n elsif date =~ Variables::DATE_PATTERNS[ :mm_dd_yyyy ]\n @month = $1.to_i\n @day = $2.to_i\n @year = $3.to_i\n\n elsif date =~ Variables::DATE_PATTERNS[ :mm_yyyy ]\n @month = $1.to_i\n @year = $2.to_i\n\n elsif date =~ Variables::DATE_PATTERNS[ :dd_mmm_yyyy_and_dd_mmm ]\n month_text = $2.to_s.capitalize\n @month = Variables::MONTH_NAMES.key( Variables::MONTH_ABBREVIATIONS[ month_text ] )\n @day = $1.to_i\n @year = $3.to_i unless $3.nil?\n\n elsif date =~ Variables::DATE_PATTERNS[ :mmm_dd_yyyy ]\n month_text = $1.to_s.capitalize\n @month = Variables::MONTH_NAMES.key( Variables::MONTH_ABBREVIATIONS[ month_text ] )\n @day = $2.to_i\n @year = $3.to_i unless $3.nil?\n\n elsif date =~ Variables::DATE_PATTERNS[ :mmm_yyyy_and_mmm ]\n month_text = $1.to_s.capitalize\n @month = Variables::MONTH_NAMES.key( Variables::MONTH_ABBREVIATIONS[ month_text ] )\n @year = $2.to_i unless $2.nil?\n\n elsif date =~ Variables::DATE_PATTERNS[ :yyyy_mmm_dd ]\n @year = $1.to_i unless $1.nil?\n month_text = $2.to_s.capitalize\n @month = Variables::MONTH_NAMES.key( Variables::MONTH_ABBREVIATIONS[ month_text ] )\n @day = $3.to_i\n\n elsif date =~ Variables::DATE_PATTERNS[ :yyyy_mmm ]\n @year = $1.to_i unless $1.nil?\n month_text = $2.to_s.capitalize\n @month = Variables::MONTH_NAMES.key( Variables::MONTH_ABBREVIATIONS[ month_text ] )\n\n else\n raise ArgumentError.new( 'Cannot parse date.' )\n end\n\n #- Make sure the dates make sense\n if @month && @month > 13\n raise ArgumentError.new( 'Month cannot be greater than 12.' )\n elsif @month && @day && @day > Variables::DAYS_IN_MONTH[ @month ]\n unless @month == 2 && @year && Date.parse( '1/1/' + @year ).leap? && @day == 29\n raise ArgumentError.new( 'Too many days in this month.' )\n end\n elsif @month && @month < 1\n raise ArgumentError.new( 'Month cannot be less than 1.' )\n elsif @day && @day < 1\n raise ArgumentError.new( 'Day cannot be less than 1.' )\n end\n\n @month_name = Variables::MONTH_NAMES[ @month ]\n\n # ----------------------------------------------------------------------\n\n future_date = Date.new 10_000, 1, 1\n\n year = @year.to_s.rjust( 4, \"0\" )\n\n if @year && @month && @day\n @short = \"#{ show_circa } #{ @month }/#{ @day }/#{ year } #{ show_era }\".strip\n @long = \"#{ show_circa } #{ @day } #{ @month_name } #{ year } #{ show_era }\".strip\n @full = \"#{ show_circa } #{ Date.new( @year, @month, @day ).strftime( '%A, %-1d %B %Y' ) } #{ show_era }\".strip\n @sortable = ( future_date - Date.new( @year * ( bce? ? -1 : 1 ), @month, @day ) ).to_i\n elsif @year && @month\n @short = \"#{ show_circa } #{ @month }/#{ year } #{ show_era }\".strip\n @long = \"#{ show_circa } #{ @month_name } #{ year } #{ show_era }\".strip\n @full = @long\n @sortable = ( future_date - Date.new( @year * ( bce? ? -1 : 1 ), @month, 1 ) ).to_i\n elsif @month && @day\n @short = \"#{ show_circa } #{ @day }-#{ Variables::MONTH_ABBREVIATIONS.key( month_text ) || month_text }\".strip\n @long = \"#{ show_circa } #{ @day } #{ month_name }\".strip\n @full = @long\n @sortable = ( future_date - Date.new( -10_000, @month, @day ) ).to_i\n elsif year\n @short = \"#{ show_circa } #{ year } #{ show_era }\".strip\n @long = @short\n @full = @long\n @sortable = ( future_date - Date.new( @year * ( bce? ? -1 : 1 ), 1, 1 ) ).to_i\n end\n\n end", "def year() end", "def parse_exact_date_parts(raw_day, raw_month, raw_year, today)\n day = raw_day.to_i\n month = month_from_name(raw_month)\n year = if raw_year\n raw_year =~ NUMBER ? raw_year.to_i : nil\n else\n today.year\n end\n\n return nil unless day && month && year\n\n begin\n result = Date.new(year, month, day)\n result = result << 12 if result > today && !raw_year\n result\n rescue ArgumentError\n nil\n end\n end", "def initialize(d=Date.today)\n if d.instance_of? Time\n rd = Date.civil(d.year, d.month, d.day)\n elsif d.instance_of? DateTime\n rd = Date.jd(d.jd)\n else\n rd = d.dup # always make a duplicate before modifying arguments\n end\n raise ArgumentError, \"Must pass Date, DateTime, or Time object\" unless rd.instance_of? Date\n @attachments = []\n @days = []\n rd -= 1 while rd.wday > 0\n # puts \"Got past first while\"\n # puts rd\n @days << rd\n for i in (1...7)\n @days[i] = (rd + i)\n end\n # puts \"Got past for\"\n @days.freeze\n end", "def next!\n if @date.month + 1 > 12\n @date = Date.new(@date.year+1,@date.month,1)\n else\n @date = Date.new(@date.year,@date.month+1,1)\n end\n end", "def fy_end(date)\n year = date.year\n # are we in the first three months of the year?\n if(date.month < 4)\n Date.new(date.year,3,31)\n else\n Date.new(date.year+1,3,31)\n end\n end", "def released_on=date\n super DateTime.strptime(date, '%m/%d/%Y')\n end", "def marc_publication_date(options = {})\n estimate_tolerance = options[:estimate_tolerance] || 15\n min_year = options[:min_year] || 500\n max_year = options[:max_year] || (Time.new.year + 6)\n\n lambda do |record, accumulator|\n date = Marc21Semantics.publication_date(record, estimate_tolerance, min_year, max_year)\n accumulator << date if date\n end\n end", "def initialize(release_date)\n @release_date = release_date\n end", "def advance(options)\r\n d = ::Date.new(year + (options.delete(:years) || 0), month, day)\r\n d = d >> options.delete(:months) if options[:months]\r\n d = d + options.delete(:days) if options[:days]\r\n d\r\n end", "def to_date\n if latest?\n Date.new(10_000, 1, 1)\n elsif timestamp?\n to_time.to_date\n else\n fail \"Version tag #{self} cannot be converted to a date!\"\n end\n end", "def post_year\n chars = @date.split('')\n chars.pop(4).join('').to_i\n end", "def initialize(yyyymmdd = nil)\n d = yyyymmdd ? yyyymmdd.dup : ::Time.new.strftime('%Y%m%d')\n d.gsub!(/-/, '') # remove any hyphens, so a user can initialize with something like \"2008-10-23\"\n self.date = d\n end" ]
[ "0.6563907", "0.6498392", "0.62064874", "0.61141646", "0.6031566", "0.6012872", "0.6003747", "0.5988646", "0.5974962", "0.5974962", "0.59747016", "0.5971246", "0.5896565", "0.58178073", "0.5799442", "0.5795441", "0.5781526", "0.576734", "0.57640797", "0.5692246", "0.56838757", "0.56453", "0.5630341", "0.5619759", "0.5617464", "0.5612545", "0.5599371", "0.5547769", "0.55443376", "0.55443376", "0.5536273", "0.55244654", "0.5524088", "0.55206054", "0.5518669", "0.5505765", "0.5496558", "0.54917556", "0.5482508", "0.54773027", "0.5473228", "0.546783", "0.5459337", "0.5457753", "0.5445313", "0.5419819", "0.5414139", "0.54063076", "0.54037285", "0.5392996", "0.539015", "0.5380838", "0.5368492", "0.53682214", "0.53679013", "0.5321517", "0.530028", "0.52994126", "0.52960104", "0.52797824", "0.52776945", "0.5263772", "0.52420205", "0.5232482", "0.52201277", "0.521456", "0.5211185", "0.5210262", "0.5210262", "0.5210262", "0.5210262", "0.5210262", "0.5210262", "0.5210262", "0.5210262", "0.5210262", "0.5210262", "0.5210262", "0.5210262", "0.5210262", "0.5210262", "0.5210262", "0.5210262", "0.5210262", "0.5210262", "0.5210262", "0.5210262", "0.52060485", "0.52011603", "0.5200519", "0.51963127", "0.519478", "0.5187837", "0.51786655", "0.5155383", "0.51536834", "0.515102", "0.5144496", "0.5141982", "0.5140087" ]
0.6145943
3
create human readable string of date
def to_s names = ["Vendémiaire", "Brumaire", "Frimaire", "Nivôse", "Pluviôse", "Ventôse", "Germinal", "Floréal", "Prairial", "Messidor", "Thermidor", "Fructidor", "Sansculottides"] s = "" s += @day.to_s + " " + names[@month - 1] + " " + @year.to_s end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def date_str d\n Util::date(d)\n end", "def human_readable_date\n d = self.date\n d.strftime(\"%B %d, %Y\")\n end", "def to_s\n # TODO this breaks the minus spec: strftime\n format \"#{year}-%02d-%02d\", month, day\n end", "def to_s()\n str = \"\" + @date.month.to_s() + \"/\" + @date.mday.to_s() + \"/\" + @date.year.to_s()\n return str\n end", "def to_s\n date.strftime(DATE_FORMAT)\n end", "def format_date\n chars = @date.split('')\n chars.pop(6)\n chars.join('')\n end", "def date\n \"#{day} #{month.capitalize} #{year}\"\n end", "def short_date( date )\n date.strftime( '%b %d, %Y')\n end", "def to_string\n return @year.to_s + \" \" + @month.to_s + \" \" + @day.to_s\n end", "def as_string(date)\n date.strftime(\"%b %d, %Y\")\n end", "def date_str\n date.strftime(\"%Y%m%d\")\n end", "def format_human_readable_date(date)\n case date.to_date\n when Time.zone.today.to_date\n 'Today'\n when Time.zone.tomorrow\n 'Tomorrow'\n when Time.zone.yesterday\n 'Yesterday'\n else\n l(date, format: :short)\n end\n end", "def to_s\n \"#{@date.to_s}: #{@text}\"\n end", "def date_short(date)\n\t\tdate.strftime(\"%b %e, %Y\") if !date.blank?\n\tend", "def to_s\n \"#{@month}/#{@day}/#{@year}\"\n end", "def nice_date_form(the_date)\n \treturn the_date ? the_date.strftime('%b %d, %Y') : ''\n\tend", "def date_to_s( date = object.meeting_date )\n Format.a_date( date )\n end", "def date_to_s\n self.date.strftime(\"%B %d, %Y\")\n end", "def fancy_date(date)\n h date.strftime(\"%A, %B %d, %Y\")\n end", "def readable_inspect\n strftime('%a, %d %b %Y')\n end", "def to_s\n s = (to_s_pieces(DATE_FIELDS) + [to_s_time_piece]).compact.join(' ')\n if s == \"\"\n \"0 days\"\n else\n s\n end + (ago ? \" ago\" : \"\")\n end", "def date_str(date)\n date.to_time.strftime('%a, %-d %b %Y %H:%M:%S %Z')\nend", "def date_str\n if self.jd.nil?\n return \"\"\n else\n Date.jd(self.jd).strftime(\"%B %d, %Y\")\n end\n end", "def date_formatted\n date.strftime(\"%A %B %d, %Y\")\n end", "def as_readable_date\n strftime \"%b %e, %Y\"\n end", "def formatted_date(date)\n DateTime.parse(date).strftime('%-m/%-d/%y')\n rescue\n ''\n end", "def date_humanized(date_as_integer)\n begin\n Time.at(date_as_integer).to_date.strftime(\"%m/%d/%y\")\n rescue\n nil\n end\n end", "def pretty_date(input_date)\n return input_date.strftime(\"%d %B %Y\")\n end", "def httpdate\n return \"#{self.day_name[0, 3]}, #{@t_day} #{self.month_name[0, 3]} #{@t_year} #{\"%02d\" % @t_hour}:#{\"%02d\" % @t_min}:#{\"%02d\" % @t_sec} GMT\"\n end", "def date\n \"#{self[:day]}_#{self[:month]}_#{self[:year]}\"\n end", "def pretty_date(time)\n time.strftime(\"%d %b %Y\")\n end", "def pretty_date(time)\n time.strftime(\"%d %b %Y\")\n end", "def showdate(my_date)\n if my_date\n str_date=my_date.to_date.strftime(\"%d-%m-%Y\")\n else\n str_date=\"\"\n end\n return str_date\n end", "def pretty_date(time)\n time.strftime(\"%B %d, %Y\")\n end", "def pretty_date(time)\n time.strftime(\"%B %d, %Y\")\n end", "def date_to_string(date, type = T.unsafe(nil), style = T.unsafe(nil)); end", "def to_s\n return \"#{\"%04d\" % @t_year}-#{\"%02d\" % @t_month}-#{\"%02d\" % @t_day} #{\"%02d\" % @t_hour}:#{\"%02d\" % @t_min}:#{\"%02d\" % @t_sec}\"\n end", "def date_str\n Util::Date.token_bill_date(created_at)\n end", "def view_date(str)\r\n\t\t(wday,day,mon,year,hhmmss,etc) = str.to_s.split(/ /)\r\n\t\tmonth = @months[mon]\r\n\t\tstr = \"#{year}\\/#{month}\\/#{day} #{hhmmss}\"\r\n\t\treturn str\r\n\tend", "def format_date(date)\n year, month, day, day_name, hour = [\n date.year,\n Date::MONTHNAMES[date.month],\n date.day.ordinalize,\n date.strftime(\"%A\"),\n convert_hour(date.hour, 'standard')\n ]\n\n \"#{day_name} #{month} #{day}, #{year} at #{hour}\"\n end", "def stringify_date(date, month_type, type = nil, style = nil)\n return date if date.to_s.empty?\n\n time = time(date)\n if type == \"ordinal\"\n day = time.day\n ordinal_day = \"#{day}#{ordinal(day)}\"\n return time.strftime(\"#{month_type} #{ordinal_day}, %Y\") if style == \"US\"\n\n return time.strftime(\"#{ordinal_day} #{month_type} %Y\")\n end\n time.strftime(\"%d #{month_type} %Y\")\n end", "def format_date_nicely(date)\nend", "def human_date() # for Date object\n # return 'tomorrow' if tomorrow?\n # return 'today' if today?\n # return 'yesterday' if yesterday?\n # return \"HumanDateBoh(#{to_s})\" # TBD\n cool_date2()\n end", "def formatted_date(date)\n return '' if date.nil?\n sprintf('%d/%d/%d alle %d:%d', date.day, date.month, date.year,\n date.hour, date.min)\n end", "def to_s\n report_date.strftime(\"%B %Y\")\n end", "def zt_date date\n if date.year == Time.now.year\n l date, format: :short\n else\n l date, format: :long\n end\n end", "def date_string\n times = []\n showtimes.all.each do |time|\n times << time.date_time\n end\n times = times.sort\n first_date = times.first.to_date.strftime('%m/%d')\n last_date = times.last.to_date.strftime('%m/%d')\n output = first_date\n if last_date != first_date\n output += \" - \" + last_date\n end\n return output\n end", "def formatted_date( date )\n date.strftime( \"%Y-%b-%d\" ) + \" \" + date.strftime( \"%A\" ).slice( 0..2 ) unless date == nil\n end", "def date(options = {})\n res = \"\"\n res += \"#{I18n.localize(self.starts_at, :format => '%A %d')} de \" if options[:include_week_day] != false\n res += \"#{I18n.localize(self.starts_at, :format => '%B')} de \" if options[:include_month] != false\n # TODO: hack hack hack 20 min\n res += \"#{self.starts_at.strftime(\"%H:%M\")} a #{self.ends_at.strftime(\"%H:%M\")}\"\n end", "def to_s\n \"#{year}-#{month.to_s.rjust(2, '0')}\"\n end", "def to_string(t)\n t.respond_to?(:getutc) ? t.getutc.strftime(DATE_FORMAT) : t.strftime(DATE_FORMAT)\n end", "def eBY_date(date)\n result = \"\"\n if date != nil\n result = date.strftime(\"%e %B %Y\")\n end\n result\n end", "def human_date(datetime)\n datetime.strftime('%d/%m/%Y').gsub(/ 0(\\d{1})/, ' \\1')\n end", "def readable_date\n date.strftime(\"%B %d, %Y\")\n end", "def to_s\n @date\n end", "def expected_note_short_date_format(date)\n (Time.now.strftime('%Y') == date.strftime('%Y')) ? date.strftime('%b %-d') : date.strftime('%b %-d, %Y')\n end", "def shortDate(obj)\n obj.strftime(\"%m/%d/%Y\")\n end", "def to_s\n [@year,@month,@day].join(\"/\")\n end", "def date\n tt = Time.gm(*filename_base.scan(/\\d+/))\n\n def tt.to_s\n to_formatted_s(:short_date_with_year) + \" \" + to_formatted_s(:short_time)\n end\n\n tt\n\tend", "def pretty_date(date)\n if date.today?\n return t(:today)\n elsif date.to_date == Date.yesterday\n return t(:yesterday)\n else\n return date.strftime(\"%b %d, %Y\")\n end\n end", "def human_date(date, optional_text= nil)\n if optional_text\n date.strftime(\"#{optional_text}\"+\" %d.%m.%Y\")\n else\n date.strftime(\"%d.%m.%Y\")\n end\n end", "def format_date_nicely(date)\n\tn = Time.new(2013, 10, 31)\n\tn.strftime(\"%d/%m/%Y\")\nend", "def nytimes_date(date, opts={})\n str = \"\"\n str << date.strftime('%A, ') if opts[:day_of_week]\n str << nytimes_month_and_day(date)\n str << \", #{date.year}\" unless opts[:hide_current_year] && date.year == Date.today.year\n return str\n end", "def getDateString(d)\n return d.strftime('%Y-%-m-%-d')\nend", "def detail_date( date )\n date.strftime( '%H:%M - %b %d, %Y')\n end", "def fmt_date(date)\n if (date)\n date.strftime(\"%m-%d-%Y\")\n end\n end", "def get_create_date\n String str = String.new\n unless self.created_at.blank?\n str << date_ordinal_format(self.created_at)\n end\n end", "def date_to_long_string(date, type = nil, style = nil)\n stringify_date(date, \"%B\", type, style)\n end", "def date_time_str(time)\n \"#{time.utc.strftime('%Y-%m-%d')}T#{time.utc.strftime('%H:%M:%S.%L')}Z\"\n end", "def format_date(date)\n date.strftime(\"%b #{date.day.ordinalize}, %Y\")\n end", "def nice_day string\r\n string = string.to_s\r\n return convert_day_to_date(string).strftime('%A, %B %e, %Y') if string.length == 8\r\n return Date.new(string).strftime('%A, %B %e, %Y')\r\n end", "def get_date(date)\n\t\tif date != nil\n\t\t\ttemp = Date.parse date.to_s\n\t\t\treturn temp.strftime(\"%a, %b %d %Y\")\n\t\telse\n\t\t\treturn \"Not specifed\"\n\t\tend\n\tend", "def dby_date(date)\n result = \"\"\n if date != nil\n result = date.strftime(\"%d %b %Y %H:%M\")\n end\n result\n end", "def human_str(args = {})\n args = {\n :time => true,\n :number_endings => {\n 0 => \"th\",\n 1 => \"st\",\n 2 => \"nd\",\n 3 => \"rd\",\n 4 => \"th\",\n 5 => \"th\",\n 6 => \"th\",\n 7 => \"th\",\n 8 => \"th\",\n 9 => \"th\"\n }\n }.merge(args)\n \n now = Time.now\n \n #Generate normal string.\n date_str = \"\"\n \n if now.day != @t_day and now.month == @t_month and now.year == @t_year\n last_digit = @t_day.to_s[-1, 1].to_i\n \n if ending = args[:number_endings][last_digit]\n #ignore.\n else\n ending = \".\"\n end\n \n date_str << \"#{@t_day}#{ending} \"\n elsif now.day != @t_day or now.month != @t_month or now.year != @t_year\n date_str << \"#{@t_day}/#{@t_month} \"\n end\n \n if now.year != @t_year\n date_str << \"#{@t_year} \"\n end\n \n if args[:time]\n date_str << \"#{@t_hour}:#{\"%02d\" % @t_min}\"\n end\n \n return date_str\n end", "def behandlungsdatum_str\n\t\t@behandlungsdatum_str || fmt_date( self.behandlungsdatum )\n\tend", "def pretty_date\n from_index[:modified].sub(/(\\d{4})(\\d{2})(\\d{2})\\d{6}/,'\\1-\\2-\\3')\n end", "def formatted_date\n \tobject.created_at.strftime(\"%R - %B %e, %Y \")\n end", "def formatted_date\n \"#{self.day.date.strftime(\"%A, %B %e, %Y\")}\"\n end", "def date_to_html_string(date)\n result = '<span class=\"month\">' + date.strftime('%b').upcase + '</span> '\n result += date.strftime('<span class=\"day\">%d</span> ')\n result += date.strftime('<span class=\"year\">%Y</span> ')\n result\n end", "def date_to_html_string(date)\n result = '<span class=\"month\">' + date.strftime('%b').upcase + '</span> '\n result += date.strftime('<span class=\"day\">%d</span> ')\n result += date.strftime('<span class=\"year\">%Y</span> ')\n result\n end", "def date_to_html_string(date)\n result = '<span class=\"month\">' + date.strftime('%b').upcase + '</span> '\n result += date.strftime('<span class=\"day\">%d</span> ')\n result += date.strftime('<span class=\"year\">%Y</span> ')\n result\n end", "def date_to_html_string(date)\n result = '<span class=\"month\">' + date.strftime('%b').upcase + '</span> '\n result += date.strftime('<span class=\"day\">%d</span> ')\n result += date.strftime('<span class=\"year\">%Y</span> ')\n result\n end", "def date_to_html_string(date)\n result = '<span class=\"month\">' + date.strftime('%b').upcase + '</span> '\n result += date.strftime('<span class=\"day\">%d</span> ')\n result += date.strftime('<span class=\"year\">%Y</span> ')\n result\n end", "def to_s\n title_with_date\n end", "def strf_date(date_time)\n begin\n date_time.strftime('%Y-%m-%d')\n rescue\n date_time\n end\n end", "def format_date (date)\n\t\treturn date.strftime(\"%d/%m/%Y\")\n\tend", "def start_date_as_string\n as_string @start_date\n end", "def easy_date; date; end", "def iso8601\n string = 'P'\n day = self.class.new 1, :day\n\n expand.each do |measured|\n string << 'T' if !string.include?('T') && measured < day\n string << measured.humanized_amount\n string << measured.unit.to_s[0, 1].capitalize\n end\n\n string\n end", "def format_date(date)\n date.strftime '%Y-%m-%d'\n end", "def str_dod\r\n\t\tunless self.date_of_death.nil?\r\n\t\t\tself.date_of_death.strftime(\"%v\")\r\n\t\tend\r\n\tend", "def to_s\n dte = self.date.strftime('%b %d %I:%M %P')\n des = self.description\n loc = self.location\n \"#{dte} #{des} #{loc}\"\n end", "def format_date(date)\n date.strftime '%d-%m-%Y'\n end", "def to_date string\n \n end", "def to_s\n mday.to_s\n end", "def humanize(lang = :en)\n d = object.strftime(\"%A, %d %B %Y\")\n if has_timezone?\n d += if self.tz == 'Z'\n \" UTC\"\n else\n \" #{self.tz}\"\n end\n end\n d\n end", "def date_view value, meta=nil\n return value.strftime \"%Y-%m-%d\" unless value.nil?\n ''\n end", "def geek_date(date)\n date.strftime(\"%Y-%m-%d\") \n end", "def format_date_nicely(date)\n date.strftime(\"%d/%m/%Y\")\nend", "def format_date_nicely(date)\n date.strftime(\"%d/%m/%Y\")\nend", "def http_date\n tp = Time.now.gmtime.to_s.split\n \"#{tp[0]}, #{tp[2]} #{tp[1]} #{tp[5]} #{tp[3]} GMT\"\n end" ]
[ "0.78620964", "0.77620125", "0.7576547", "0.74893904", "0.74830765", "0.7474318", "0.74503714", "0.7434824", "0.7429843", "0.74103975", "0.73735815", "0.73657584", "0.73332584", "0.7269312", "0.723448", "0.7216986", "0.720112", "0.7184813", "0.71165836", "0.71123034", "0.7109514", "0.70865285", "0.7077702", "0.70687675", "0.70577204", "0.70326173", "0.70182663", "0.7013637", "0.6999607", "0.6932976", "0.6931566", "0.6931566", "0.6924494", "0.6921051", "0.6921051", "0.6918324", "0.69157827", "0.69073164", "0.69017166", "0.690081", "0.68866956", "0.6876988", "0.68708557", "0.6868064", "0.6860025", "0.6856722", "0.6851057", "0.6840156", "0.6838869", "0.68371874", "0.6833373", "0.6827015", "0.68249595", "0.6817176", "0.6809085", "0.68003124", "0.6798372", "0.67943394", "0.6790957", "0.67855483", "0.678003", "0.6778097", "0.6743166", "0.6730515", "0.67141235", "0.6691926", "0.6681792", "0.667384", "0.6668242", "0.666381", "0.6657381", "0.6653967", "0.66487354", "0.66413844", "0.66388273", "0.6630433", "0.66298324", "0.66275644", "0.6623727", "0.6623727", "0.6623727", "0.6623727", "0.6623727", "0.6617886", "0.6614857", "0.66056454", "0.65997565", "0.6595404", "0.6594411", "0.6586544", "0.6578751", "0.65776885", "0.65760314", "0.6573663", "0.65679574", "0.6564835", "0.656436", "0.65625435", "0.65444607", "0.65444607", "0.65411407" ]
0.0
-1
return the date's symbol (associated plant, animal, or tool)
def daySymbol dayNum = 30*(@month - 1) + (@day - 1) symbols = ["Raisin (Grape)", "Safran (Saffron)", "Châtaigne (Chestnut)", "Colchique (Crocus)", "Cheval (Horse)", "Balsamine (Impatiens)", "Carotte (Carrot)", "Amarante (Amaranth)", "Panais (Parsnip)", "Cuve (Vat)", "Pomme de terre (Potato)", "Immortelle (Strawflower)", "Potiron (Calabaza)", "Réséda (Mignonette)", "Âne (Donkey)", "Belle de nuit (The four o’clock flower)", "Citrouille (Pumpkin)", "Sarrasin (Buckwheat)", "Tournesol (Sunflower)", "Pressoir (Wine-Press)", "Chanvre (Hemp)", "Pêche (Peach)", "Navet (Turnip)", "Amaryllis (Amaryllis)", "Bœuf (Cow)", "Aubergine (Eggplant)", "Piment (Chili Pepper)", "Tomate (Tomato)", "Orge (Barley)", "Tonneau (Barrel)", "Pomme (Apple)", "Céleri (Celery)", "Poire (Pear)", "Betterave (Beet root)", "Oie (Goose)", "Héliotrope (Heliotrope)", "Figue (Fig)", "Scorsonère (Black Salsify)", "Alisier (Chequer Tree)", "Charrue (Plough)", "Salsifis (Salsify)", "Macre (Water chestnut)", "Topinambour (Jerusalem Artichoke)", "Endive (Endive)", "Dindon (Turkey)", "Chervis (Skirret)", "Cresson (Watercress)", "Dentelaire (Leadworts)", "Grenade (Pomegranate)", "Herse (Harrow)", "Bacchante (Asarum baccharis)", "Azerole (Acerola)", "Garance (Madder)", "Orange (Orange)", "Faisan (Pheasant)", "Pistache (Pistachio)", "Macjonc (Tuberous pea)", "Coing (Quince)", "Cormier (Service tree)", "Rouleau (Roller)", "Raiponce (Rampion)", "Turneps (Turnip)", "Chicorée (Chicory)", "Nèfle (Medlar)", "Cochon (Pig)", "Mâche (Corn Salad)", "Chou-fleur (Cauliflower)", "Miel (Honey)", "Genièvre (Juniper)", "Pioche (Pickaxe)", "Cire (Wax)", "Raifort (Horseradish)", "Cèdre (Cedar tree)", "Sapin (Fir tree)", "Chevreuil (Roe Deer)", "Ajonc (Gorse)", "Cyprès (Cypress Tree)", "Lierre (Ivy)", "Sabine (Juniper)", "Hoyau (Grub-hoe)", "Érable sucré (Maple Tree)", "Bruyère (Heather)", "Roseau (Reed plant)", "Oseille (Sorrel)", "Grillon (Cricket)", "Pignon (Pinenut)", "Liège (cork)", "Truffe (Truffle)", "Olive (Olive)", "Pelle (shovel)", "Tourbe (Peat)", "Houille (Coal)", "Bitume (Bitumen)", "Soufre (Sulphur)", "Chien (Dog)", "Lave (Lava)", "Terre végétale (Topsoil)", "Fumier (Manure)", "Salpêtre (Saltpeter)", "Fléau (Flail)", "Granit (Granite stone)", "Argile (Clay)", "Ardoise (Slate)", "Grès (Sandstone)", "Lapin (Rabbit)", "Silex (Flint)", "Marne (Marl)", "Pierre à chaux (Limestone)", "Marbre (Marble)", "Van (Winnowing basket)", "Pierre à plâtre (Gypsum)", "Sel (Salt)", "Fer (Iron)", "Cuivre (Copper)", "Chat (Cat)", "Étain (Tin)", "Plomb (Lead)", "Zinc (Zinc)", "Mercure (Mercury (metal))", "Crible (Sieve)", "Lauréole (Spurge-laurel)", "Mousse (Moss)", "Fragon (Butcher’s Broom)", "Perce-neige (Snowdrop)", "Taureau (Bull)", "Laurier-thym (Laurustinus)", "Amadouvier (Tinder polypore)", "Mézéréon (Daphne mezereum)", "Peuplier (Poplar Tree)", "Coignée (Axe)", "Ellébore (Hellebore)", "Brocoli (Broccoli)", "Laurier (Laurel)", "Avelinier (Cob or filbert)", "Vache (Cow)", "Buis (Box Tree)", "Lichen (Lichen)", "If (Yew tree)", "Pulmonaire (Lungwort)", "Serpette (Billhook)", "Thlaspi (Pennycress)", "Thimelé (Rose Daphne)", "Chiendent (Couch Grass)", "Trainasse (Knotweed)", "Lièvre (Hare)", "Guède (Woad)", "Noisetier (Hazel)", "Cyclamen (Cyclamen)", "Chélidoine (Celandine)", "Traîneau (Sleigh)", "Tussilage (Coltsfoot)", "Cornouiller (Dogwood)", "Violier (Matthiola)", "Troène (Privet)", "Bouc (Billygoat)", "Asaret (Wild Ginger)", "Alaterne (Buckthorn)", "Violette (Violet (plant))", "Marceau (Goat Willow)", "Bêche (Spade)", "Narcisse (Narcissus)", "Orme (Elm Tree)", "Fumeterre (Common fumitory)", "Vélar (Hedge Mustard)", "Chèvre (Goat)", "Épinard (Spinach)", "Doronic (Large-flowered Leopard’s Bane)", "Mouron (Pimpernel)", "Cerfeuil (Chervil)", "Cordeau (Twine)", "Mandragore (Mandrake)", "Persil (Parsley)", "Cochléaria (Scurvy-grass)", "Pâquerette (Daisy)", "Thon (Tuna)", "Pissenlit (Dandelion)", "Sylve (Forest)", "Capillaire (Maidenhair fern)", "Frêne (Ash Tree)", "Plantoir (Dibber: a hand gardening tool)", "Primevère (Primrose)", "Platane (Plane Tree)", "Asperge (Asparagus)", "Tulipe (Tulip)", "Poule (Hen)", "Bette (Chard Plant)", "Bouleau (Birch Tree)", "Jonquille (Daffodil)", "Aulne (Alder)", "Couvoir (Hatchery)", "Pervenche (Periwinkle)", "Charme (Ironwood)", "Morille (Morel)", "Hêtre (Beech Tree)", "Abeille (Bee)", "Laitue (Lettuce)", "Mélèze (Larch)", "Ciguë (Hemlock)", "Radis (Radish)", "Ruche (Hive)", "Gainier (Judas tree)", "Romaine (Lettuce)", "Marronnier (Chestnut Oak)", "Roquette (Arugula or Rocket)", "Pigeon (Pigeon)", "Lilas (Lilac)", "Anémone (Anemone)", "Pensée (Pansy)", "Myrtille (Blueberry)", "Greffoir (Knife)", "Rose (Rose)", "Chêne (Oak Tree)", "Fougère (Fern)", "Aubépine (Hawthorn)", "Rossignol (Nightingale)", "Ancolie (Columbine)", "Muguet (Lily of the Valley)", "Champignon (Button mushroom)", "Hyacinthe (Hyacinth)", "Râteau (Rake)", "Rhubarbe (Rhubarb)", "Sainfoin (Sainfoin)", "Bâton-d’or (Wallflower)", "Chamérops (Palm tree)", "Ver à soie (Silkworm)", "Consoude (Comfrey)", "Pimprenelle (Salad Burnet)", "Corbeille d’or (Basket of Gold)", "Arroche (Orache)", "Sarcloir (Garden hoe)", "Statice (Sea Lavender)", "Fritillaire (Fritillary)", "Bourrache (Borage)", "Valériane (Valerian)", "Carpe (Carp)", "Fusain (Spindle (shrub))", "Civette (Chive)", "Buglosse (Bugloss)", "Sénevé (Wild mustard)", "Houlette (Shepherd’s crook)", "Luzerne (Alfalfa)", "Hémérocalle (Daylily)", "Trèfle (Clover)", "Angélique (Angelica)", "Canard (Duck)", "Mélisse (Lemon Balm)", "Fromental (Oat grass)", "Martagon (Martagon lily)", "Serpolet (Thyme plant)", "Faux (Scythe)", "Fraise (Strawberry)", "Bétoine (Woundwort)", "Pois (Pea)", "Acacia (Acacia)", "Caille (Quail)", "Œillet (Carnation)", "Sureau (Elderberry)", "Pavot (Poppy plant)", "Tilleul (Linden or Lime tree)", "Fourche (Pitchfork)", "Barbeau (Cornflower)", "Camomille (Camomile)", "Chèvrefeuille (Honeysuckle)", "caille-lait (Bedstraw)", "Tanche (Tench)", "Jasmin (Jasmine Plant)", "Verveine (Verbena)", "Thym (Thyme Plant)", "Pivoine (Peony Plant)", "Chariot (Hand Cart)", "Seigle (Rye)", "Avoine (Oats)", "Oignon (Onion)", "Véronique (Speedwell)", "Mulet (Mule)", "Romarin (Rosemary)", "Concombre (Cucumber)", "Échalote (Shallot)", "Absinthe (Wormwood)", "Faucille (Sickle)", "Coriandre (Coriander)", "Artichaut (Artichoke)", "Girofle (Clove)", "Lavande (Lavender)", "Chamois (Chamois)", "Tabac (Tobacco)", "Groseille (Currant)", "Gesse (Hairy Vetchling)", "Cerise (Cherry)", "Parc (Park)", "Menthe (Mint)", "Cumin (Cumin)", "Haricot (Bean)", "Orcanète (Alkanet)", "Pintade (Guinea fowl)", "Sauge (Sage Plant)", "Ail (Garlic)", "Vesce (Tare)", "Blé (Wheat)", "Chalémie (Shawm)", "Épeautre (Einkorn Wheat)", "Bouillon blanc (Common Mullein)", "Melon (Honeydew Melon)", "Ivraie (Ryegrass)", "Bélier (Ram)", "Prêle (Horsetail)", "Armoise (Mugwort)", "Carthame (Safflower)", "Mûre (Blackberry)", "Arrosoir (Watering Can)", "Panis (Panic grass)", "Salicorne (Common Glasswort)", "Abricot (Apricot)", "Basilic (Basil)", "Brebis (Ewe)", "Guimauve (Marshmallow root)", "Lin (Flax)", "Amande (Almond)", "Gentiane (Gentian)", "Écluse (Lock)", "Carline (Carline thistle)", "Câprier (Caper)", "Lentille (Lentil)", "Aunée (Yellow starwort)", "Loutre (Otter)", "Myrte (Myrtle)", "Colza (Rapeseed)", "Lupin (Lupin)", "Coton (Cotton)", "Moulin (Mill)", "Prune (Plum)", "Millet (Millet)", "Lycoperdon (Puffball)", "Escourgeon (Six-row Barley)", "Saumon (Salmon)", "Tubéreuse (Tuberose)", "Sucrion (Sugar melon)", "Apocyn (Apocynum)", "Réglisse (Liquorice)", "Échelle (Ladder)", "Pastèque (Watermelon)", "Fenouil (Fennel)", "Épine vinette (Barberry)", "Noix (Walnut)", "Truite (Trout)", "Citron (Lemon)", "Cardère (Teasel)", "Nerprun (Buckthorn)", "Tagette (Mexican Marigold)", "Hotte (Sack)", "Églantine (Wild Rose)", "Noisette (Hazelnut)", "Houblon (Hops)", "Sorgho (Sorghum)", "Écrevisse (Crayfish)", "Bigarade (Bitter Orange)", "Verge d’or (Goldenrod)", "Maïs (Maize or Corn)", "Marron (Chestnut)", "Panier (Basket)", "La Fête de la Vertu (Celebration of Virtue)", "La Fête du Génie (Celebration of Talent)", "La Fête du Travail (Celebration of Labour)", "La Fête de l'Opinion (Celebration of Principles)", "La Fête des Récompenses (Celebration of Honours)", "La Fête de la Révolution (Celebration of the Revolution)"] return symbols[dayNum] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def roman_event(date)\n date[2]\n end", "def as_sym(date)\n date.strftime(\"%a\").downcase.to_sym\n end", "def date() self[:date]; end", "def day_name; Date::DAYNAMES[wday] end", "def date \n \"date\" \n end", "def day; end", "def easy_date; date; end", "def date; end", "def date; end", "def date; end", "def date; end", "def day_sym_pred(day_sym, times = 1)\n check_pre((\n (\n (day_sym_elem?(day_sym)) or\n (day_sym.day_sym?)\n ) and\n (times.nat?)\n ))\n\n if day_sym_elem?(day_sym)\n day = DaySym.new(day_sym)\n end\n\n day = day.shift(-times.abs)\n\n if day_sym_elem?(day_sym)\n day = day.to_sym\n end\n\n return day\nend", "def date\n \"#{self[:day]}_#{self[:month]}_#{self[:year]}\"\n end", "def day\n end", "def day_name\n return @@day_names[self.day_in_week]\n end", "def day() end", "def ord(day)\n\nend", "def w_day; end", "def day(date)\n forecasts.select { |k, _| k.to_date == date }\n end", "def name_of_day\n if day_of_week == -1\n DAY_NAMES[day_of_week]\n else\n DAY_NAMES[day_of_week - 1]\n end\n end", "def day_info(date)\n {\n date: date,\n current_period: @user.critical_periods.has_date(date).first,\n close_periods: @user.critical_periods.near_by_date(date).all.to_a,\n }\n end", "def yday\n end", "def daytime \n \"daytime\" \n end", "def abbr_day_name; Date::ABBR_DAYNAMES[wday] end", "def date\n \"#{day} #{month.capitalize} #{year}\"\n end", "def resolve_date(date)\n ModernTimesDatabase::Dates[date]\n end", "def fancy_date(date)\n h date.strftime(\"%A, %B %d, %Y\")\n end", "def day(date)\n \n days = self.days(14)\n \n day = Object\n \n days.each do |dayEach|\n break day = dayEach if dayEach.dia == date.strftime(\"%d-%m-%Y\") \n end\n \n day\n \n end", "def day_num_to_day_sym(day_num)\n check_pre((\n (day_num?(day_num))\n ))\n\n return DAY_SYM_SEQ.at(day_to_index(day_num))\nend", "def closest_date_for(symbol, date)\n my_date = date.beginning_of_day\n dates = dates_for(symbol)\n if dates.include?(my_date)\n return my_date\n else\n my_date < dates.min ?\n dates.min :\n dates.max\n end\n end", "def date(date_name)\r\n case date_name\r\n when :start\r\n return self.accommodation_histories.last.from\r\n when :end\r\n return self.accommodation_histories.last.to\r\n else\r\n return 0\r\n end\r\n end", "def day_num_to_day_sym(day_num)\n check_pre((\n (day_num_elem?(day_num)) or\n (day_num.day_num?)\n ))\n\n if day_num_elem?(day_num)\n DayNum.new(day_num).to_sym\n elsif day_num.day_num?\n day_num.to_sym\n end\nend", "def inspect\n \"#{year}-W#{week}-#{day}\"\n end", "def day\n return @day\n end", "def view_symptoms_specific_date(day)\n day_symptoms = $db.execute( <<-SQL\n SELECT * FROM symptoms\n WHERE date=\"#{day}\";\n SQL\n )\n puts \"_____________________________\"\n puts \"Symptoms that occurred on #{day}:\"\n day_symptoms.each do | symptom |\n puts \"#{symptom['symptom']}\"\n end\n puts \"_____________________________\"\nend", "def day_sym_pred(day_sym)\n check_pre((\n (day_sym?(day_sym))\n ))\n\n index = day_to_index(day_num_pred(index_to_day(DAY_SYM_SEQ.find_index(day_sym))))\n return DAY_SYM_SEQ.at(index)\nend", "def key_name(time, date_type=RailsRank::Types::Date::HOURLY)\n case date_type\n when RailsRank::Types::Date::YEARLY\n time.strftime('%Y')\n when RailsRank::Types::Date::MONTHLY\n time.strftime('%Y-%m')\n when RailsRank::Types::Date::DAILY\n time.strftime('%Y-%m-%d')\n else\n time.strftime('%Y-%m-%d-%H')\n end\n end", "def date_as_label\n date_played.to_s\n end", "def current_symbol\r\n current_data ? current_data[:symbol] : nil\r\n end", "def wrong_date(num)\n first_day(num).text\nend", "def symbol\n \n end", "def day_sym?(day)\n return DAY_SYM_SEQ.include?(day)\nend", "def date\n result_hash['dte']\n end", "def day\n return @day\n end", "def current_symbol\n current_data ? current_data[:symbol] : nil\n end", "def yday() end", "def day_nums\n self.class.instance_variable_get(\"@day_abbrev_hash\")\n end", "def make_date_key(day_or_date)\n if day_or_date.class == Symbol\n day_or_date\n else\n Time.parse(day_or_date).key_by_date\n end\n end", "def heb_date\r\n return heb_day_name + \" ב\" + heb_month_name + \" \" + heb_year_name\r\n end", "def x_axis_for(date)\n case @conditions[:breakdown_type]\n when \"Weekly\"\n \"Week of \" + date.to_s\n when \"Quarterly\"\n string = date.strftime(\"%Y-Q\")\n temp = date.strftime(\"%m\").to_i\n hash = {:t1 => [1,2,3], :t2 => [4,5,6], :t3 => [7,8,9], :t4 => [10,11,12]}\n hash.each{|k,v|\n string += k.to_s.sub(/t/, \"\") if v.include?(temp)\n }\n string\n when \"Daily\"\n date.to_s\n when \"Yearly\"\n date.year.to_s\n when \"Monthly\"\n date.strftime(\"%b %y\")\n when \"Day of week\"\n Date.strptime(date.to_s, \"%w\").strftime(\"%A\")\n when \"Hour\"\n DateTime.strptime(date.to_s, \"%H\").strftime(\"%I:00 %p\")\n else\n raise NoMethodError\n end\n end", "def opendate_short\n if opendate.year == Date.today.year\n d = opendate.strftime(\"%m/%d\")\n else\n d = opendate.strftime(\"%Y/%m/%d\")\n end\n w = %w(日 月 火 水 木 金 土)[opendate.wday]\n d+\" (\"+w+\") \"+(opendate_memo == nil ? \"\" : opendate_memo)\n end", "def monday\n date\n end", "def for(date = Date.today)\n # Format date into a Date class\n date = case date.class.name\n when 'String'\n Date.parse(date)\n when 'Date'\n date\n when 'DateTime'\n Date.new(date.year, date.month, date.day)\n when 'Time'\n Date.new(date.year, date.month, date.day)\n end\n \n day = nil\n # find the matching forecast day, if any\n self.each do |fd|\n day = fd if date == fd.date\n end\n return day\n end", "def day(date)\n [date.day.ordinalize.to_s, month(date)].join(' ')\n end", "def wday_shortname date\n %w'вс пн вт ср чт пт сб'[date.wday]\n end", "def date\n dreport.date_format\n end", "def str_dod\r\n\t\tunless self.date_of_death.nil?\r\n\t\t\tself.date_of_death.strftime(\"%v\")\r\n\t\tend\r\n\tend", "def word_date()\n #Find date action was completed (from database using date_completed function)\n date_string = self.date_completed\n #Return if date does not exist\n return if date_string == nil\n date_string = self.date_completed\n #Parse date into DATETIME format\n date = DateTime.parse(date_string)\n #if the action has not been completed return string anouncing when the action\n #will occur. Logic needed to check if the date is upcoming or overdue.\n if @completed == 'f'\n if date.to_date > Date.today\n return \"DUE: #{date.strftime(\"%B %e, %Y\")}\"\n elsif date.to_date == Date.today\n return \"DUE Today\"\n elsif date.to_date < Date.today\n return \"OVERDUE: #{date.strftime(\"%B %e, %Y\")}\"\n end\n #if action has already been completed, return the date completed.\n else\n return \"#{date.strftime(\"%B %e, %Y\")}\"\n end\n end", "def best_day\n\n end", "def to_day_sym(day)\n check_pre((\n (day?(day))\n ))\n\n if day_sym_elem?(day)\n return day\n elsif day.day_sym?\n return day.to_sym\n elsif day_num_elem?(day)\n return day_num_to_day_sym(day)\n elsif day.day_num?\n return day.to_sym\n end\n\n raise(\"Can't convert day of type '\" + day.type.to_str + \"' to day symbol\")\nend", "def title\n punched_at.strftime(DATE_FORMAT)\n end", "def date\n team.date_format\n end", "def eval_date\n # FIXME: Make pref?\n h = Hash[\"mo\", 1, \"di\", 2, \"mi\", 3, \"do\", 4, \"fr\", 5, \"???\", 6]\n h.merge(Hash[\"mo\", 1, \"tu\", 2, \"we\", 3, \"th\", 4, \"fr\", 5, \"???\", 6])\n a = description.strip.downcase\n a = \"???\" if a.length < 3 || !h.include?(a[0..1])\n day = h[a[0..1]]\n time = a[2..a.length-1].strip.rjust(3, \"0\")\n \"#{day} #{time}\"\n end", "def day_and_date(date_and_times)\n date_and_times.split(';').first\nend", "def cwday\n end", "def inspect\n \"the day of the month is the \" + ordinal_list(@parts)\n end", "def to_day_sym(day)\n check_pre((\n (day?(day))\n ))\n\n if day_sym?(day)\n return day\n elsif day_num?(day)\n return day_num_to_day_sym(day)\n end\n\n raise(\"Can't convert day of type '\" + day.type.to_str + \"' to day symbol\")\nend", "def get_inspection_date\n date.strftime(\"%B %d, %Y, %I:%M %p\")\n end", "def day_of_week\n Date::DAYNAMES.fetch(recurring_event.day).downcase.to_sym\n end", "def human_date() # for Date object\n # return 'tomorrow' if tomorrow?\n # return 'today' if today?\n # return 'yesterday' if yesterday?\n # return \"HumanDateBoh(#{to_s})\" # TBD\n cool_date2()\n end", "def disclosure_date\n\t\tdate_str = module_info['DisclosureDate']\n\t\tdate_str ? Date.parse(date_str) : nil\n\tend", "def yday\n return self.to_a[IDX_YDAY]\n end", "def symbol; end", "def symbol; end", "def symbol; end", "def symbol; end", "def symbol; end", "def symbol; end", "def date\n @date\n end", "def date\n @date\n end", "def piece_name(p)\n if p.class.to_s == \"Symbol\"\n (p == :knight ? :night : p).to_s.downcase.split('').first\n else\n PIECES[p.downcase]\n end\n end", "def objection_name_date\n o = objection ? 'Objection' : 'No Objection'\n o + ' from ' + librarian.short + ' on ' + created_at.strftime('%b-%-d')\n end", "def date\n @date\n end", "def date\n @date\n end", "def exp_code(date, kind)\n _date = date.delete(\"-/\")\n return \"%s%s\" % [ _date[5,1], _date[2,2] ] if kind.nil?\n case kind[0,1].upcase\n when \"C\": return \"%s%s\" % [ CALL_CODES[_date[4,2].to_i], _date[2,2] ]\n when \"P\": return \"%s%s\" % [ PUT_CODES[_date[4,2].to_i], _date[2,2] ]\n when \"F\": return \"%s%s\" % [ FUT_CODES[_date[4,2].to_i], _date[2,2] ]\n else\n return \"%s%s\" % [ _date[5,1], _date[2,2] ]\n end\n end", "def show_date month_of_year, day_of_week\n month = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']\n day = dom\n return month[month_of_year-1] + day[day_of_week].to_s\nend", "def mday\n end", "def air_date\n release_date\n end", "def datum\nt = Time.now\ndate = t.strftime(\"%y%m%d\")\nend", "def key_by_date\n self.strftime('%Y-%m-%d')\n end", "def dates\n end", "def season_names_for_date(date)\n seasons = case date.strftime('%-m').to_i\n when 3..5 then %w[Spring]\n when 6..8 then %w[Summer]\n when 9..11 then %w[Autumn Fall]\n else %w[Winter]\n end\n year = date.year\n seasons.map { |season| \"#{season} #{year}\" }\n end", "def show;\n @date_opened_string = \"N/A\"\n @date_closed_string = \"N/A\"\n\n if (@item.date_opened != nil)\n @date_opened_string = format('%04d', @item[:date_opened].year) + \"-\" + format('%02d', @item[:date_opened].month) + \"-\" + format('%02d', @item[:date_opened].day)\n end\n if (@item.date_closed != nil)\n @date_closed_string = format('%04d', @item[:date_closed].year) + \"-\" + format('%02d', @item[:date_closed].month) + \"-\" + format('%02d', @item[:date_closed].day)\n end\n end", "def semester\n\t\treturn nil unless self.showtimes.first\n\t\topens = self.open_date\n\t\tif(opens.month < 7)\n\t\t\topens.year.to_s + \"01\"\n\t\telse\n\t\t\topens.year.to_s + \"03\"\n\t\tend\n\tend", "def day_names\n self.class.day_names\n end", "def geek_date(date)\n date.strftime(\"%Y-%m-%d\") \n end", "def name_of_day(style = :full)\n @time.strftime(style == :full ? \"%A\" : \"%a\")\n end", "def quarter_wind_abbreviation; end", "def date(name)\n input(name + \"_m\", 2, 2) + \"&nbsp;/&nbsp;\" +\n input(name + \"_d\", 2, 2) + \"&nbsp;/&nbsp;\" +\n input(name + \"_y\", 4, 4)\n end", "def symbol\n @symbol\n end" ]
[ "0.63759995", "0.6034681", "0.59478706", "0.5940942", "0.5926677", "0.59115964", "0.5883612", "0.5796437", "0.5796437", "0.5796437", "0.5796437", "0.56665385", "0.5665496", "0.5663355", "0.56421393", "0.5629921", "0.5609742", "0.56091493", "0.55920225", "0.5561758", "0.5560698", "0.5558596", "0.55170524", "0.55101144", "0.5498535", "0.5497319", "0.5442611", "0.5431167", "0.5431065", "0.54279506", "0.54221994", "0.5417713", "0.5415572", "0.5408676", "0.540437", "0.5403545", "0.5395909", "0.53909755", "0.53830457", "0.5363227", "0.5362489", "0.5355856", "0.5351455", "0.53380173", "0.5334888", "0.5332864", "0.5323588", "0.5317034", "0.53161305", "0.5311761", "0.5307432", "0.5298962", "0.52921057", "0.5291906", "0.52883095", "0.52741814", "0.524177", "0.5223253", "0.52198523", "0.5218416", "0.52169985", "0.52154744", "0.5213536", "0.520897", "0.52085644", "0.5206176", "0.5198889", "0.51978785", "0.5185143", "0.5177077", "0.51763284", "0.5169103", "0.5165315", "0.5165315", "0.5165315", "0.5165315", "0.5165315", "0.5165315", "0.51634234", "0.51634234", "0.51590204", "0.51587903", "0.51491135", "0.51491135", "0.5143866", "0.5140998", "0.5139663", "0.51356614", "0.51342267", "0.513397", "0.5133956", "0.5131015", "0.51262236", "0.512513", "0.5121832", "0.5113464", "0.5111979", "0.51096904", "0.5099665", "0.5098802" ]
0.66535
0
A task to monitor
def task(name, &block) task = Wodan::Task.new(name) yield(task) wodan.tasks << task end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def task\n end", "def monitor; end", "def task_report\n print \"task #{@name} is #{@state}\"\n case @state\n when 'waiting' ; puts \"\"\n when 'running'\n puts \" and \"+VT100.RED(\"has not completed\")+\" because\"\n @emits.each { |event_name|\n event = @joblist.find(event_name)\n event.report_consumers(@joblist)\n }\n end\n end", "def do_task_work\n @web.add_status( @thing, @statusUpdates )\n end", "def on_task_ready(task)\n end", "def watch\n @monitor_thread ||= Thread.new { monitor_node }\n self\n end", "def perform_task\n # actually do the work\n end", "def monitor\n raise NotImplementedError\n end", "def what_task\n if running_task?\n puts \"Current task: \" + get_last_task_name + \", #{(Time.now.to_i - get_last_task_stime.to_i).duration}\"\n else\n puts \"No task running!\"\n end\n end", "def runTask task\n while !task.finished && task.status < 16 do\n task.run\n\n if task.status == 8 && task.wait > 0\n sleep task.wait\n end\n end\n end", "def external_task\n output[:task]\n end", "def wait_on_task(task)\n while xapi.task.get_status(task) == \"pending\"\n progress = xapi.task.get_progress(task)\n sleep 1\n end\n end", "def monitor\n IngestWorkflowMonitorJob.set(wait: 1.minute).perform_later(flow.id, @params)\n end", "def task(*args, &block)\n Util.task(*args, &block)\n end", "def on_task_complete(task)\n end", "def task_run(&block) \n task(&block).start\n end", "def wait_on_task(task)\n while xapi.task.get_status(task) == 'pending'\n xapi.task.get_progress(task)\n sleep 1\n end\n end", "def run_tasks()\n self.task_queue.each do |task|\n\n self.task_list << task\n trigger_event(:start,:task)\n\n result = self.send(task[:name],*(task[:args]))\n if result[:status] == :failed\n break\n end\n\n\n self.task_list.last[:result]=result\n trigger_event(:end,:task)\n end\n end", "def define_task\n desc @desc\n task @name do\n config.mode == 'shell' ? run_shell : run\n end\n end", "def poll(_) end", "def start_monitor\n self.monitor = monitor_thread if not self.monitor\n end", "def task(&block) \n task = TaskRunnable.new\n task.proc = Proc.new(block)\n task\n end", "def sync\n\t\ttask = queue( Proc.new { } )\n\t\ttask.wait\n\tend", "def watch_interval; end", "def task_schedule_status(task)\n\t\tstatus = []\n\tend", "def initialize(task)\n @task = task\n end", "def start\n TaskScheduler.add_task(self)\n end", "def update task\n now = Time.now.to_i\n wait = task.wait.nil? ? now : task.wait\n wake = now + wait\n tasks = @db[:tasks]\n r = tasks.where(:id => task.id).update :changed => now,\n :status => task.getStatus,\n :wake => wake,\n :data => Marshal::dump(task)\n end", "def wait_task(task,timeout=10)\n counter=timeout\n #puts task.data\n if task\n status=foreman_tasks.show('id'=> task.id)\n #puts status.data\n while counter!=0 and status.state != 'stopped'\n puts \"#{counter}: #{status.progress} #{status.state} #{status.result}\"\n sleep(60)\n counter= counter-1\n if counter==0\n return :timeout\n end\n status= foreman_tasks.show('id'=> task.id)\n end\n # TODO alarm somebody somehow if result is not 'success'\n puts \"Done: state=#{status.state} result=#{status.result}\"\n return :done\n else\n return :nosuchtask\n end \n end", "def start\n @mthread = monitor\n end", "def do_work\n scan!\n server.scan_semaphore.wait(server.cluster.heartbeat_interval)\n end", "def initialize(task)\n super()\n @task= task \n end", "def perform(folder, task_id)\n log = Logger.new(\"#{Rails.root}/log/song_craw.log\")\n #scan folder for mp3 files\n robot = DiskCrawler.new(Mp3Processor.new(log)) #dependency injection \n robot.scan(folder)\n #mark task\n Task.update_all({:status=>'COMPLETED'}, {:id=>task_id})\n end", "def monitor\n raise ArgumentError, MONITOR_PARAMS if monitor_params_missing?\n loop do \n sleep minutesInterval.minutes\n if notify? \n books_report \n exit\n end\n end\n end", "def worker_check_interval(interval); end", "def notify\n end", "def default_do_task(task, times)\n self.village.increment_resources!(task, times)\n end", "def task=(value)\n @task = value\n end", "def execute_task(task)\n cur_sauce = Sauce.current\n begin\n self.serve\n self.cap_config.execute_task(task)\n ensure\n cur_sauce.serve if cur_sauce\n end\n end", "def run\n Astute.logger.info \"Start puppet with timeout \"\\\n \"#{@time_observer.time_limit} sec. #{task_details_for_log}\"\n\n @time_observer.start\n puppetd_run\n self.task_status = 'running'\n end", "def task\n @task ||= default_task # rubocop:disable ThreadSafety/InstanceVariableInClassMethod\n end", "def scan_hourly\n\n printf \"\\n%s\\n\", 'Scanning All-Users for Tasks ...'\n run_tasks_for_all_users(do_live_updates=@live_scan_updates)\n @scan_passes += 1\n printf \"%s\\n\", \"\\nPass #{@scan_passes} complete \\n\"\n\n printf \"%s\\n\", \"\\nWaiting 1 hour ... \\n\"\n sleep(60 * 60)\n\n if @scan_passes < @scan_passes_end\n printf \"%s\\n\", 'Repeating Scan'\n scan_hourly\n else\n printf \"%s\\n\", '... Exiting ...'\n end\n\nend", "def task\n @pagesize ||= Vmstat.pagesize\n\n procfs_file(\"self\", \"stat\") do |file|\n data = file.read.split(/ /)\n Task.new(data[22].to_i / @pagesize, data[23].to_i,\n data[13].to_i * 1000, data[14].to_i * 1000)\n end\n end", "def track_task(task_id)\n raise Bosh::Errors::UnknownTaskId, task_id.inspect if task_id.blank?\n tracker = Bosh::Cli::TaskTracking::TaskTracker.new(api, task_id)\n status = tracker.track\n end", "def start_task(task)\n @pool.start(task)\n @logger.info \"started task #{AllocatorUtils::get_task_key(task)}\"\n end", "def start_monitor\n @thread = Thread.start { monitor }\n end", "def start_monitoring\n @scheduler.start()\n end", "def find_or_create_task(opts)\n\t\treport_task(opts.merge({:wait => true}))\n\tend", "def poll_for_task(worker)\n # TODO bulk poll for task, concurrently, up to size of queue\n tasks = [Conductor::Tasks.poll_task(worker.task_type)]\n tasks.each do |task|\n next if task[:status] != 200\n process_task(worker, task[:body])\n end\n rescue => e\n puts(\"Conductor::Coordinator : Failed to poll worker (#{worker.task_type}) with error #{e.message}\")\n end", "def watch\n start_watch\n end", "def incompleted_task\n Notification.incompleted_task\n end", "def process\n @notifier.process\n end", "def run\n while true\n if task = next_task\n task.handle\n else\n sleep @wait_period\n end\n end\n end", "def pre_task\n end", "def add task\n\t\t\t@count+=1\n\t\t\t@tasks[@count] = task\n\t\t\tputs \"Added task #{task}.\"\n\t\t\tupdate\n\t\tend", "def task\n return @task\n end", "def start_task(task)\n @tasks.synchronize {\n @tasks << Task.new(task)\n @timestamp.renew!\n }\n task\n end", "def monitor(*args, &bl)\n result = nil\n took = Benchmark.realtime {\n result = bl.call\n }\n Tools.info(args, op_took: took)\n result\n end", "def print_task(task)\n print \"==> \".info, task.bold, \"\\n\"\nend", "def task\n @keys[:task]\n end", "def perform(**task)\n raise \"No work defined! for this task: #{task[:body]}. Define #perform private method in your class\"\n end", "def perform config={}\n while\n log(\"[#{name}] Djinn is running.. and doing nothing worthwhile.\")\n sleep(5)\n end \n end", "def find_and_execute_task(task, hooks={})\n cur_sauce = Sauce.current\n begin\n self.serve\n self.cap_config.find_and_execute_task(task, hooks)\n ensure\n cur_sauce.serve if cur_sauce\n end\n end", "def jeweler_tasks; end", "def update_task_status(event) # :nodoc:\n if event.symbol == :start\n plan.task_index.set_state(self, :running?)\n @starting = false\n @pending = false\n @started = true\n @running = true\n @executable = true\n end\n\n if event.success?\n plan.task_index.add_state(self, :success?)\n @success = true\n elsif event.failure?\n plan.task_index.add_state(self, :failed?)\n @failed = true\n @failure_reason ||= event\n @failure_event ||= event\n end\n\n @terminal_event ||= event if event.terminal?\n\n if event.symbol == :stop\n plan.task_index.remove_state(self, :running?)\n plan.task_index.add_state(self, :finished?)\n @running = false\n @finishing = false\n @finished = true\n @executable = false\n end\n nil\n end", "def running; end", "def running; end", "def start_synchronize(updater); end", "def perform_background_tasks\n self.check_clipboard\n self.check_resolvers\n self.check_downloads\n self.check_captchas\n self.refresh_task_table\n self.update_download_buttons\n end", "def tasks() []; end", "def run\n\t\tsuper\n\t\n\t\twhitelist = \"\"\n\t\tif (@object.class == Host)\n\t\t\twhitelist = @object.ip\n\t\telse \n\t\t\twhitelist = @object.range\n\t\tend\n\t\t\n\t\tif (@options[:task] == discover)\n\t\t\tconf = {\n\t\t\t\t'workspace' => \"default\",\n\t\t\t\t'username' => @project_name,\n\t\t\t\t\"ips\" => [whitelist], \n\t\t\t\t'DS_BLACKLIST_HOSTS' => \"\",\n\t\t\t\t'DS_PORTSCAN_SPEED' => \"3\",\n\t\t\t\t'DS_PORTS_EXTRA' => \"\",\n\t\t\t\t'DS_PORTS_BLACKLIST' => \"\",\n\t\t\t\t'DS_PORTS_CUSTOM' => \"\",\n\t\t\t\t'DS_PORTSCAN_TIMEOUT' => \"5\",\n\t\t\t\t'DS_UDP_PROBES' => \"true\",\n\t\t\t\t'DS_IDENTIFY_SERVICES' => \"true\",\n\t\t\t\t'DS_SMBUser' => \"\",\n\t\t\t\t'DS_SMBPass' => \"\",\n\t\t\t\t'DS_SMBDomain' => \"\",\n\t\t\t\t'DS_DRY_RUN' => \"false\",\n\t\t\t\t'DS_SINGLE_SCAN' => \"false\",\n\t\t\t\t'DS_FAST_DETECT' => \"false\",\n\t\t\t \t'DS_CustomNmap' => \"--reason\"\n\t\t\t}\n\n\t\t\tputs \"starting discover task\"\n\t\t\tret = @pro.start_discover(conf)\n\n\t\t\ttask_id = ret['task_id']\n\t\t\tputs \"started discover task \" + task_id\n\t\t\tpro.task_wait(ret['task_id'])\n\t\t\tputs \"done!\"\t\n\t\tend\n\n\t\[email protected]!\n\t\tnil\n\tend", "def define\r\n\t\t\ttask :foo do\r\n\t\t\t\tputs 'foo!'\r\n\t\t\tend\r\n\t\tend", "def perform\n puts \"Pretending I'm doing something which takes time...\"\n # Do something later\n sleep(10)\n puts \"Finished my important task!\"\n end", "def task(executor, message)\n\n domain = message['exid'].split('-', 2).first\n #tname = message['tasker']\n tname = determine_tasker_name(executor, message)\n\n tconf =\n ( ! message['routed'] &&\n (@unit.loader.tasker(domain, 'ganger', message) ||\n @unit.loader.tasker(domain, 'tasker', message))) ||\n @unit.loader.tasker(domain, tname, message)\n\n fail ArgumentError.new(\n \"tasker #{tname.inspect} not found\"\n ) unless tconf\n\n if tconf.is_a?(Array)\n\n points = [ nil, message['point'] ]\n points << 'detask' if points.include?('cancel')\n points << 'task' if points.include?('return')\n\n tconf = tconf.find { |h| points.include?(h['point']) }\n end\n\n fail ArgumentError.new(\n \"tconf #{tconf.inspect} not a hash\"\n ) unless tconf.is_a?(Hash)\n\n message['tconf'] = tconf unless tconf['include_tconf'] == false\n\n message['vars'] = gather_vars(executor, tconf, message)\n\n m = Flor.dup_message(message)\n #\n # the tasker gets a copy of the message (and it can play with it\n # to its heart content), meanwhile the message is handed to the\n # \"post\" notifiers.\n\n @unit.caller.call(self, tconf, m)\n #\n # might return a re-routing message,\n # especially if it's a domain tasker\n end", "def cron_tasks\n end", "def exec!\n listener = Collector.listen!\n Thread.new do\n loop do\n sleep(15)\n planner.next_histogram(Collector.next_workload_histogram!)\n end\n end\n end", "def task_status(proxmox, pve_node, task)\n status_info = proxmox_get(proxmox, \"nodes/#{pve_node}/tasks/#{task}/status\")\n \"#{status_info['status']}#{status_info['exitstatus'] ? \":#{status_info['exitstatus']}\" : ''}\"\n end", "def spawn_monitor\n\t\t::Thread.new do\n\t\t\tbegin\n\n\t\t\t::Thread.current[:tm_name] = \"Thread Monitor\"\n\t\t\t::Thread.current[:tm_crit] = true\n\n\t\t\twhile true\n\t\t\t\t::IO.select(nil, nil, nil, 1.0)\n\t\t\t\tself.each_index do |i|\n\t\t\t\t\tstate = self[i].alive? rescue false\n\t\t\t\t\tself[i] = nil if not state\n\t\t\t\tend\n\t\t\t\tself.delete(nil)\n\t\t\tend\n\n\t\t\trescue ::Exception => e\n\t\t\t\telog(\"thread monitor: #{e} #{e.backtrace} source:#{self[:tm_call].inspect}\")\n\t\t\tend\n\t\tend\n\tend", "def task(name, *args, &block)\n task_once(name, block) do\n super\n end\n end", "def prepare_task\n end", "def task_out\n if running_task?\n puts \"Stop task: \" + get_last_task_name + \", #{(Time.now.to_i - get_last_task_stime.to_i).duration}\"\n open(TRACK_FILE, \"a\"){|f|\n f.print \"\\t#{Time.now.to_i}\\n\"\n }\n return true\n else\n puts \"There is no task running\"\n return false\n end\n end", "def watch_interval=(_arg0); end", "def task(name, &block)\n name = name.to_s\n\n unless task = @tasks.find{|t| t.name == name}\n task = Salticid::Task.new(name, :salticid => self)\n @tasks << task\n end\n \n if block_given?\n task.block = block\n end\n\n task \n end", "def rake_tasks(&block); end", "def rake_tasks(&block); end", "def explain_true(task); end", "def wait(task: Task.current, &block)\n\t\t\t\ttask.annotate(\"waiting for signal #{@name}\")\n\t\t\t\t\n\t\t\t\tnotification = Notification.new\n\t\t\t\t@notifications << notification\n\t\t\t\t\n\t\t\t\tif block_given?\n\t\t\t\t\twhile true\n\t\t\t\t\t\tnotification.wait\n\t\t\t\t\t\tyield task\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\tnotification.wait\n\t\t\t\tend\n\t\t\tensure\n\t\t\t\tif notification\n\t\t\t\t\tnotification.close\n\t\t\t\t\[email protected](notification)\n\t\t\t\tend\n\t\t\tend", "def add_task\r\n\r\n task = task_info(params[:id], true)\r\n dup = BgWorker.first(:conditions => {:name => task[:fullname], :no_duplicate => true})\r\n res = BgWorker.run_task(task, 3) unless dup\r\n if res.nil?\r\n flash[:error] = _(\"Task could not be added to job list!\")\r\n else\r\n flash[:notice] = _(\"Task added to job list.\")\r\n end\r\n redirect_to(:action => :list) and return\r\n end", "def task(name,&ruby_block)\n HDLRuby::High::Std.task(name,&ruby_block)\n end", "def redmine_tasks(m, params)\n begin\n \tcertificate = redmine_check_auth(m)\n\t\tif ! certificate\n\t\t\t# ne rien faire, l'utilisateur n'est pas connecté\n\t\telse\n\t\t\tif params[:othername]\n\t\t\t\tuser_login = params[:othername]\n\t\t\telse\n\t\t\t\tuser_login = certificate[:username]\n\t\t\tend\n\t\t\tm.reply \"#{Underline}#{@redmine_l_currenttaskof} #{user_login} :#{Underline}\"\n\t\t\tif @registry.has_key? user_login\n\t\t\t\ttask_detected = false\n\t\t\t\t@registry[user_login].each do |task_logger|\n\t\t\t\t\ttask_detected = true\n\t\t\t\t\t\tif (task_logger.inprogress == \"pause\")\n\t\t\t\t\t\t\t# preparation du paramètre durée de tache\n\t\t\t\t\t\t\tgap = task_logger.alreadydone.to_i\n\t\t\t\t\t\t\thours = gap/3600.to_i\n\t\t\t\t\t\t\tmins = ( gap/60 % 60 ).to_i\n\t\t\t\t\t\t\tsecs = ( gap % 60 )\n\t\t\t\t\t\t\treal_hours = ( task_logger.alreadydone )/3600\n\t\t\t\t\t\t\tpause_message = \"[#{@redmine_l_pause}]\"\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tgap = ( Time.now - task_logger.time ).to_i + task_logger.alreadydone.to_i\n\t\t\t\t\t\t\thours = gap/3600.to_i\n\t\t\t\t\t\t\tmins = ( gap/60 % 60 ).to_i\n\t\t\t\t\t\t\tsecs = ( gap % 60 )\n\t\t\t\t\t\t\treal_hours = ( Time.now - task_logger.time )/3600\n\t\t\t\t\t\t\tpause_message = \"[#{@redmine_l_running}]\"\n\t\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\tm.reply \"#{@redmine_l_task} ##{task_logger.task}#{pause_message} (#{hours}h #{mins}m #{secs}s) : [#{task_logger.projectname}] #{task_logger.taskname} => #{@redmine_rapid_url}#{@redmine_issue_show_path}/#{task_logger.task}\"\n\t\t\t\tend\n\t\t\t\tif !task_detected\n\t\t\t\t\tif @redmine_debug_mode == 1\n\t\t\t\t\t\tm.reply \"#{@redmine_l_notaskrunning}\"\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\t\n\t\t\telse\n\t\t\t\t#if @redmine_debug_mode == 1\n\t\t\t\t\tm.reply \"#{@redmine_l_notaskrunning}\"\n\t\t\t\t#end\n\t\t\tend\n\t\tend\n rescue Exception => e\n m.reply e.message\n m.reply e.backtrace.inspect\n end\n end", "def <<(task)\n enqueue_task(task)\n end", "def bind(task)\n @task = task\n end", "def interact\n Thread.new do\n @mutex.synchronize do\n watch\n sleep(2)\n end\n\n if @start\n interact\n else\n puts 'monitoramento pausado...'\n end\n end\n end", "def sleepy_run; end", "def invoke(task)\n invoked_tasks << task\n end", "def status( *args )\n statusTask = StatusTask.new( @web, self, *args )\n statusTask.perform()\n end", "def notifier; end", "def notifier; end", "def task_instance(name,*args,&ruby_block)\n HDLRuby::High::Std.task_instance(name,*args,&ruby_block)\n end", "def monitor\n @monitor ||= PeriodicMonitor.new\n end" ]
[ "0.7157362", "0.6705366", "0.6380405", "0.63540995", "0.6335088", "0.62536836", "0.62392247", "0.6151832", "0.6140144", "0.6060038", "0.60487795", "0.6044313", "0.6041796", "0.60265565", "0.60216993", "0.60162365", "0.6015654", "0.59932137", "0.5979599", "0.59409785", "0.5940762", "0.59285855", "0.59002143", "0.5897554", "0.5889581", "0.5885172", "0.5878615", "0.58724123", "0.585454", "0.5853191", "0.5849127", "0.582897", "0.58039653", "0.58008426", "0.57985085", "0.57964295", "0.57934237", "0.5783352", "0.5780166", "0.57782996", "0.57649004", "0.5757004", "0.5756964", "0.5752925", "0.57515454", "0.5746609", "0.5736632", "0.57315415", "0.5722184", "0.5707599", "0.5690402", "0.56843185", "0.56778145", "0.5675132", "0.5671175", "0.56701726", "0.5662194", "0.5645469", "0.5639223", "0.56380844", "0.5637681", "0.563693", "0.5631293", "0.56297034", "0.5613311", "0.56119347", "0.56119347", "0.5609818", "0.56081396", "0.55841845", "0.55824643", "0.5579908", "0.5569832", "0.5558573", "0.5556755", "0.55518204", "0.5544164", "0.5536142", "0.55336475", "0.5526722", "0.55143726", "0.5512069", "0.5506339", "0.5505422", "0.5505422", "0.5500609", "0.5499806", "0.54944354", "0.5494074", "0.5492777", "0.5491807", "0.54870385", "0.5485192", "0.54816455", "0.54806185", "0.54797816", "0.54760605", "0.54760605", "0.5473241", "0.5466356" ]
0.58214146
32
Gets the normalized directory path String for this blob.
def dir @dir ||= self.class.normalize_dir(::File.dirname(@path)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_s\n @directory\n end", "def directory_name\n return @directory_name.to_s if @directory_name\n return local_path.basename.to_s if exist?\n return name\n end", "def directoryname\n new_parts = @parts[0..-2]\n new_parts[0] = absolute_prefix + new_parts[0]\n FilePath.new(*new_parts).to_s\n end", "def relative_directory\n return '' unless @directory_root\n @path - @directory_root - name\n end", "def path\n @directory.path\n end", "def path_name\n str = name.dup\n str << '/' if is_dir\n str = parent.path_name + str if parent\n str\n end", "def path_dir\n File.split(path).first\n end", "def path\n real_path = Pathname.new(root).realpath.to_s\n full_path.sub(%r{^#{real_path}/}, '')\n end", "def directory\n File.dirname(@path) + '/'\n end", "def to_s\n out = absolute_prefix\n out += @parts.join(NATIVE_DIRECTORY_SEPARATOR)\n out\n end", "def directory\n File.dirname @path\n end", "def to_s\n path\n end", "def directory_path\n @directory_path ||= url_file_path.sub /([^\\/]*)\\z/, ''\n end", "def a_dir\n self.path.split('/')[0...-1]\n end", "def eponymous_directory_path\n path.sub(ext, '/').sub(/\\/$/, '') + '/'\n end", "def dir_name\n File.dirname(file_name)\n end", "def to_s\n return \"\" if self.empty?\n @path.join(\":\")\n end", "def dir\n if url.end_with?(\"/\")\n url\n else\n url_dir = File.dirname(url)\n url_dir.end_with?(\"/\") ? url_dir : \"#{url_dir}/\"\n end\n end", "def directory\n self.path.directory\n end", "def path\n s = ''\n s << '/' if @absolute\n s << @path.join('/')\n s << '/' if @trail\n s << '.' if s.empty?\n s\n end", "def dir\n calc_dir(@basename)\n end", "def absolute_prefix\n out = \"\"\n out = NATIVE_DIRECTORY_SEPARATOR if ABSOLUTE_GETS_NATIVE_DIRECTORY_SEPARATOR_PREFIX && absolute?\n out\n end", "def path\n return @path.sub(/^\\//,'').sub(/^%2F/,'/')\n end", "def path\n filename = [key, self.class.subclass_suffix, self.class::FILE_SUFFIX]\n filename = filename.compact.join('.')\n\n if subdirectory\n directory.join(subdirectory).join(filename)\n else\n directory.join(filename)\n end\n end", "def getRealPath(path) Pathname.new(path).realpath.to_s; end", "def getRealPath(path) Pathname.new(path).realpath.to_s; end", "def store_dir\n if model[\"#{mounted_as}\"]\n fname = model[\"#{mounted_as}\"]\n else\n fname = self.filename\n end\n p1,p2 = fname[0,1],fname[1,1]\n [model.class.to_s.underscore,p1,p2].join(\"/\")\n end", "def to_s\n return (@BasePath || \"\") + \"|\" + (@RelativePath || \"nil\")\n end", "def dirname\n (uid.path.split(\".\") << \"#{timestamp}-#{random}\").join(\"/\")\n end", "def full_path\n File.dirname(File.expand_path(serialized_filename))\n end", "def dirname() Path::Name.new(File.dirname(path)) end", "def file_path\n dir\n end", "def path\n filename = [key, self.class.subclass_suffix, self.class.extension_name]\n filename = filename.compact.join('.')\n\n if subdirectory\n directory.join(subdirectory).join(filename)\n else\n directory.join(filename)\n end\n end", "def to_s\n s = ''\n s << '/' if @absolute\n s << @path.join('/')\n s << '/' if @trail\n s << '.' if s.empty?\n s\n end", "def directory_basename\n File.basename(@directory)\n end", "def dir\n File.dirname(self.path)\n end", "def path_str\n path.join(\"-\")\n end", "def containing_directory\n path.dirname\n end", "def to_s\n @path\n end", "def to_s\n @path\n end", "def path()\n return ::File.join(@root, @name)\n end", "def full_path_from_current_attributes\r\n path = self.class.upload_options[:directory].\r\n gsub(Regexp.new(\"^(#{RAILS_ROOT})?/?\"), RAILS_ROOT + '/') + '/' +\r\n instance_directory + '/' + send(self.class.upload_options[:filename])\r\n path.gsub(/\\/+/, '/')\r\n end", "def dirname\n return File.dirname( self.path )\n end", "def to_s\n @path\n end", "def dir\n self.a_dir.join '/'\n end", "def dir_path\n File.expand_path(File.dirname(@path))\n end", "def to_s\n\t\treturn self.valid_dirs.join( SEPARATOR )\n\tend", "def normalized_path(file); end", "def to_s\n path\n end", "def base_path\n [attachment_options[:path_prefix], attachment_path_id].join(\"/\")\n end", "def path(id)\n directory.join(id.gsub(\"/\", File::SEPARATOR))\n end", "def directory\r\n \[email protected]\r\n end", "def path\n File.join(@base, @name)\n end", "def dir_name string\n string.split('/')[0..-2].join('/')\nend", "def store_dir\n format(\n '%suploads/peoplefinder/%s/%s/%s',\n base_upload_dir,\n model.class.to_s.underscore,\n mounted_as_without_legacy_prefix,\n model.id\n )\n end", "def normalisedDir(baseDir)\n return baseDir.end_with?(\"/\") ? baseDir : baseDir + \"/\"\n end", "def path\n File.join(@base, @name)\n end", "def store_dir\n #\"documentos/#{model.document_album.escuela_transporte.razonSocial.gsub(\" \",\"_\").mb_chars.normalize(:kd).gsub(/[^x00-\\x7F]/n, '').to_s.upcase.gsub(/[^a-zA-Z0-9_-]/,\"\")}/#{model.document_album.nombre.upcase}/#{model.nombre}\"\n model.document_path\n end", "def path\n \"%s/%s\" % [dirname, filename]\n end", "def dirname\n transliterate(super).downcase\n end", "def full_path\n container.root.join(path)\n end", "def full_path\n container.root.join(path)\n end", "def dirname\n File.dirname(filename)\n end", "def full_path\n entity = Entity.find( self.id )\n full_name = entity.name\n while !( entity.parent.nil? )\n entity = entity.parent\n full_name = entity.name + \"-\" + full_name\n end\n return full_name\n end", "def path\n name.split(\"::\").join(\"/\").downcase\n end", "def to_s\n @parts.join(NATIVE_PATH_SEPARATOR)\n end", "def path\n folders = ancestors.reverse + [self]\n folders.shift # Remove the root folder\n path = File.join('/', folders.map(&:name))\n Pathname.new(path)\n end", "def store_dir\n '%suploads/peoplefinder/%s/%s/%s' % [\n base_upload_dir,\n model.class.to_s.underscore,\n mounted_as_without_legacy_prefix,\n model.id\n ]\n end", "def to_s\n @path\n end", "def to_s\n @path\n end", "def to_s\n return '' if @path.empty?\n\n @path.map { |str| '/' + str.gsub(*ESCAPE) }.join\n end", "def path\n File.join(self.drive.path, self.relative_path)\n end", "def instance_directory\r\n dir = self.class.upload_options[:subdirectory]\r\n dir.nil? ? '' : send(dir).to_s.gsub(/[^a-z0-9_\\/\\\\-]/i, '')\r\n end", "def format_path(entry)\n server_path = entry.path\n if base_path && server_path[0,base_path.length] == base_path\n if server_path == base_path\n return \".\"\n elsif server_path[base_path.length,1] == \"/\"\n return server_path[base_path.length + 1, server_path.length - base_path.length - 1]\n elsif base_path == \"/\" && server_path[0,1] == \"/\"\n return server_path[1, server_path.length - 1]\n end\n end\n server_path\n end", "def get_dir_name\n return @builder['dir_label'].text\n end", "def dir\n Rails.root.join(ROOT, type, name).to_s\n end", "def raw_gitdir\n\t\t\twith_dir do\n\t\t\t\treturn Pathname.new(%x/git rev-parse --git-dir/.chomp)\n\t\t\tend\n\t\tend", "def dir\n url[-1, 1] == '/' ? url : File.dirname(url)\n end", "def pretty_path\n if Pathname.new(\"~/.fog\").expand_path == path\n \"~/.fog\"\n else\n path.to_s\n end\n end", "def canonical_path\n p = path.gsub(/\\/+/,'/')\n p.length > 1 ? p.chomp('/') : p\n end", "def prefixed_working_directory\n return self.storage.prefixed_working_directory\n end", "def path(name=nil)\n if name\n return @dir + '/' + name\n else\n return @dir\n end\n end", "def dir\n url.end_with?(\"/\") ? url : url_dir\n end", "def dirname( fn )\n ::File.dirname(fn).sub(%r/\\A[^\\/]+\\/?/o, '')\n end", "def base_path\n File.join(attachment_options[:path_prefix], attachment_path_id)\n end", "def dirname\n File.dirname(filename)\n end", "def full_path\n File.join(@path, @name)\n end", "def dir\n @dir ||= File.dirname(fullpath)\n end", "def path\n @pathname.to_s\n end", "def path(id)\n directory.join(relative(id))\n end", "def path\n assignment.path + '/' + directory_num.to_s\n end", "def container_path(no_filename: nil, final_slash: nil, use_archive_file_name: nil, leading_dot: nil)\n parts = []\n parts << '.' if leading_dot\n if use_archive_file_name && archive_file.present?\n parts << archive_file.to_s\n elsif archive_mount_name.present?\n parts << archive_mount_name.to_s\n end\n parts << path.to_s unless path.blank?\n parts << file_name.to_s unless no_filename\n res = File.join parts\n res += '/' if final_slash && res.present?\n res.to_s\n end", "def to_s\n if column_changed? and rename?\n processed_filename @value.to_s\n else\n public_relative_path\n end\n end", "def path\n return nil if self.hash_string.blank?\n File.join(*self.hash_string.scan(/(.)(.)(.*)/).flatten)\n end", "def to_s\n @path.dup\n end", "def path\r\n @pathname.to_s\r\n end", "def directory\n return _meta_data['directory'] if _meta_data.has_key? 'directory'\n dir\n end", "def to_s\n '/' + @path.map { |part|\n if part.is_a? String\n part\n elsif part.is_a? Symbol\n part.inspect\n else\n fail \"Invalid path part: #{part}\"\n end\n }.join('/')\n end", "def to_s\n if nesting\n to_relative_path\n elsif local\n to_local_path\n else\n to_absolute_path\n end\n end", "def rel_path(file)\n File.dirname(file)\n end" ]
[ "0.714756", "0.71290964", "0.673288", "0.6648179", "0.66268164", "0.6618571", "0.66057193", "0.6576609", "0.6574388", "0.6525342", "0.64563096", "0.645625", "0.64474887", "0.6416838", "0.63706696", "0.6350038", "0.6346546", "0.63357425", "0.63331056", "0.6302244", "0.62957644", "0.6289536", "0.6284997", "0.62846214", "0.6284502", "0.6284502", "0.6262507", "0.6257629", "0.62544894", "0.6252079", "0.6251897", "0.6228682", "0.6224859", "0.6221831", "0.6218526", "0.62108296", "0.61775094", "0.61769736", "0.61729157", "0.6148783", "0.61448324", "0.61347395", "0.6133682", "0.6123876", "0.61183906", "0.6103529", "0.6102818", "0.60938627", "0.60927916", "0.60887283", "0.6086393", "0.6085685", "0.6053333", "0.6048534", "0.6046333", "0.60456216", "0.60337126", "0.60293067", "0.602217", "0.60199845", "0.6015596", "0.6015596", "0.60138613", "0.60087276", "0.60053736", "0.6002689", "0.59791785", "0.5971026", "0.5970299", "0.5970299", "0.59601337", "0.59595793", "0.5953462", "0.5951441", "0.59511954", "0.5944618", "0.5941307", "0.593712", "0.59370786", "0.59332824", "0.5929008", "0.59205216", "0.5913399", "0.590769", "0.590752", "0.5880586", "0.58707654", "0.58676726", "0.58673954", "0.5867224", "0.58611274", "0.58588547", "0.58575475", "0.5856789", "0.58553064", "0.58399016", "0.5827641", "0.5827038", "0.5826794", "0.58248264" ]
0.61994743
36
Gets the file base name String for this blob.
def name @name ||= ::File.basename(@path) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def base_name\n File.basename(file_name)\n end", "def base\n File.basename @filename, extension_with_delimiter\n end", "def get_corresponding_file_base_name\n return File.basename(@URL)\n end", "def base()\n sub_ext('').basename.to_s\n end", "def base_name\n File.basename @absolute_name\n end", "def filename_base\n return '_'+basename if is_type_partial?\n basename\n end", "def base_name\n File.basename @relative_name\n end", "def name\n file.partition(base).last.gsub(/[_\\/]/, \" \").strip\n end", "def base_filename\n @rf['recording']['base_filename']\n end", "def base file, ext; return File.basename file, ext end", "def base file, ext; return File.basename file, ext end", "def base_name(suffix=nil)\n adapter.basename(suffix)\n end", "def name()\n basename.to_s\n end", "def base_name\n @base_name ||= if base = name.to_s.split(\"::\").first\n base.underscore\n end\n end", "def file_name\n File.basename @path\n end", "def filename\n @file.basename.to_s\n end", "def filename\n if super.present?\n # current_path 是 Carrierwave 上传过程临时创建的一个文件,有时间标记,所以它将是唯一的\n @name ||= Digest::MD5.hexdigest(File.dirname(current_path))\n \"#{@name}.#{ext}\"\n end\n end", "def file_name\n @file_name ||= File.basename tree\n end", "def basename\n File.basename(filename)\n end", "def basename\n @basename ||= ''\n end", "def name\n blob.name\n end", "def file_name\n File.basename(file_path)\n end", "def base_part_of(file_name)\n name = File.basename(file_name)\n name.gsub(/[^\\w._-]/, '')\n end", "def base_part_of(file_name)\n name = File.basename(file_name)\n name.gsub(/[^\\w._-]/, '')\n end", "def filename\n if super.present?\n @name ||=\"#{SecureRandom.hex}.#{file.extension.downcase}\" if original_filename\n Rails.logger.debug(\"(BaseUploader.filename) #{@name}\")\n @name\n end\n end", "def name\n file.basename('.rb').to_s if file\n end", "def name\n file.basename('.rb').to_s if file\n end", "def file_name\n \"/\" + current_file.path.split('/').pop\n end", "def file_name\n return unless @file\n\n @file.absolute_name\n end", "def base(filename)\n filename.sub(/\\.[^.]*$/, '')\nend", "def base_name\n name\n end", "def name\n name = nil\n if root?\n name = path.to_s\n else\n name = @path.basename.to_s\n end\n return name\n end", "def filename\n if super.present?\n @name ||= Digest::MD5.hexdigest(File.dirname(current_path))\n \"#{@name}#{File.extname(original_filename).downcase}\"\n end\n end", "def filename\n if super.present?\n @name ||= Digest::MD5.hexdigest(File.dirname(current_path))\n \"#{@name}#{File.extname(original_filename).downcase}\"\n end\n end", "def basename\n File.basename( fullpath, ext )\n end", "def file_name\n if source\n source.is_a?(File) ? File.basename(source.path) : File.basename(source)\n else\n object.original_name.nil? ? \"original_file\" : object.original_name\n end\n end", "def name\n File.basename(@root)\n end", "def identifier\n @blob.basename.split(\".\").first.downcase\n end", "def base_filename\n \"backup-#{self.class.name.demodulize}.tar\"\n end", "def file_name\n \"#{@file_name}.#{extension}\"\n end", "def file_name\n return @file_name\n end", "def file_name\n return @file_name\n end", "def filename\n File.basename( fullpath )\n end", "def name\n File.basename(@path)\n end", "def name\n File.basename(@path)\n end", "def name\n File.basename(@path)\n end", "def file_path\n base_image ? base_image.base_filename : nil\n end", "def basename(fn)\n split_filename(fn).last\n end", "def filename\n unless @filename\n @filename = @path.basename.to_s\n end\n\n @filename\n end", "def original_filename\n File.basename(@file_path)\n end", "def to_name\n basename.to_s.sub extname, ''\n end", "def basename\n @basename ||= File.basename(path)\n end", "def name\n ::File.basename(path)\n end", "def file_name\n @file_name ||= stream.file_name\n end", "def name\n File.basename(self.path)\n end", "def basename(fn)\n split_filename(fn).last\n end", "def get_filename(file)\n File.basename(file)\n end", "def base_name(image)\n # Remove registry namespace (anything before the final slash)\n # as well as tag.\n if image.include?(\"/\")\n base = image.split('/').last.split(':').first\n else\n base = image.split(':').first\n end\n\n # Strip noise-word suffixes from image name\n base.sub!(NOISE_WORDS, '')\n\n base\n end", "def filename\n return @filename if @filename\n\n if self.uri\n @filename = File.basename(self.uri.path)\n else\n regexps = PRECOMPILED_FILE_TYPES.map { |ext| \"\\.#{ext}\" }.join('|')\n\n @filename = File.basename(self.filepath).gsub(/#{regexps}/, '')\n end\n end", "def basename\n return self.name.downcase.gsub(/^.*::/, '')\n end", "def basename\n @generator.basename\n end", "def basename\n filename.chomp(extname)\n end", "def basename\n @chart_data.title\n .strip\n .gsub(/\\s+/, '_')\n .downcase\n end", "def name\n @name ||= File.basename(path)\n end", "def intname\n @basename\n end", "def get_basename(file_path)\n File.basename file_path\n end", "def name\n @name ||= File.basename(path)\n end", "def name\n @name ||= File.basename(path)\n end", "def basename\n File.basename(self.upload.url).split(/\\?/)[0]\n end", "def name\n @name ||= filename.split(\".\").first.sub(/^_/, \"\")\n end", "def original_filename\n File.basename(self.path)\n end", "def original_filename\n File.basename(self.path)\n end", "def original_filename\n File.basename(self.path)\n end", "def full_filename(thumbnail = nil)\n [base_path, thumbnail_name_for(thumbnail)].join(\"/\")\n end", "def full_filename(for_file)\n #[remote_process!, for_file].join(\".\")\n for_file\n end", "def basename\n File.basename(@path, '.*')\n end", "def file_name\n name.underscore\n end", "def basename\n File.basename(path)\n end", "def base_script_name\n raw_script_name.gsub(/-.*/, '')\n end", "def name\n File.basename(path)\n end", "def filename\n \"#{folder_id}#{File.extname(super)}\"\n end", "def get_log_basename( data_import_session )\n datafile_base_name = File.basename( data_import_session.file_name ).to_s\n .remove( File.extname( data_import_session.file_name ).to_s )\n \"#{ get_iso_timestamp(data_import_session) }#{ Rails.env == 'development' ? 'prod' : 'dev' }_#{ datafile_base_name }\"\n end", "def file_name\n \"#{Time.current.to_i}-#{@file.original_filename}\"\n end", "def full_filename\n File.join(path, self.disk_filename)\n end", "def raw_script_name\n File.basename($0)\n end", "def name\n @name ||= File.basename(file).chomp(File.extname(file))\n end", "def basename\n if extension\n basename = filename.split('.')\n basename.pop\n basename.join('.')\n else\n filename\n end\n end", "def file_file_name\n f = nil\n if self.asset_clone_id.present?\n x = self.asset_clone\n f = x.asset_file_name if x.present?\n else\n f = self.asset_file_name\n end\n return f\n end", "def inspect\n File.basename @__path\n end", "def file_name\n if file.original_name.starts_with?('http')\n file.original_name.match(/[^\\/]+$/)[0]\n else\n file.original_name\n end\n end", "def filename\n return @filename unless @filename.nil?\n generate_file_name()\n @filename\n end", "def tempfile_basename\n basename = ::File.basename(@new_resource.path, tempfile_extension)\n # the leading \"[.]chef-\" here should be considered a public API and should not be changed\n basename.insert 0, \"chef-\"\n basename.insert 0, \".\" unless ChefUtils.windows? # dotfile if we're not on windows\n basename.scrub\n end", "def name\n File.basename(absolute_path)\n end", "def filename\n File.basename(path)\n end", "def name\n @name ||= File.basename(relative_file, '.png')\n end", "def file_name\n self.file_file_name\n end", "def filename\n @name ||= \"#{md5}.#{file.extension}\" if original_filename.present?\n end", "def basename_of(filename)\n filename.sub(/(\\.[a-z]+)*$/, '')\n end", "def full_filename( for_file )\n super.downcase\n # super.chomp( File.extname( super ) ) + '.jpg'\n end", "def filename\n if original_filename\n uuid = UUIDTools::UUID.md5_create(UUIDTools::UUID_DNS_NAMESPACE, original_filename)\n extname = File.extname(original_filename)\n return \"#{uuid}#{extname}\"\n end\n end" ]
[ "0.8167793", "0.8034736", "0.79164684", "0.7819805", "0.7744379", "0.7640878", "0.7613311", "0.7585046", "0.75820327", "0.75538164", "0.75538164", "0.74952304", "0.73697686", "0.7212607", "0.72058594", "0.70567733", "0.70447135", "0.7020719", "0.70019054", "0.6988627", "0.6985092", "0.6967924", "0.6946536", "0.6946536", "0.68858147", "0.6882379", "0.6882379", "0.685756", "0.6842725", "0.6833647", "0.6828932", "0.68150866", "0.68128365", "0.68128365", "0.6801723", "0.6799271", "0.67856073", "0.6781025", "0.67735827", "0.67528427", "0.6749327", "0.6749327", "0.6739414", "0.6736845", "0.6736845", "0.6736845", "0.6709524", "0.66812766", "0.66672426", "0.66660017", "0.6664756", "0.6655856", "0.66482174", "0.6644043", "0.6641282", "0.6639121", "0.6635101", "0.6631504", "0.6627626", "0.66154605", "0.6606333", "0.65886134", "0.6583165", "0.6577347", "0.65729684", "0.656897", "0.6564315", "0.6564315", "0.6558842", "0.6533543", "0.6516295", "0.6516295", "0.6516295", "0.6516053", "0.65158087", "0.6514859", "0.6512967", "0.65069807", "0.65029", "0.6499085", "0.64930695", "0.64864", "0.6474333", "0.6465139", "0.6454576", "0.64526707", "0.644399", "0.64439654", "0.6437679", "0.64253247", "0.6410784", "0.6405522", "0.6403064", "0.6401845", "0.6395457", "0.63889515", "0.6385029", "0.6381564", "0.6378053", "0.63730675" ]
0.6654159
52
Gets a Grit::Blob instance for this blob. repo Grit::Repo instance for the Grit::Blob. Returns an unbaked Grit::Blob instance.
def blob(repo) @blob ||= Grit::Blob.create(repo, :id => @sha, :name => name, :size => @size) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def blob\n @blob ||= ($repo.gblob(@rev + ':' + @name))\n end", "def blob\n @blob ||= image.to_blob\n end", "def blob(id, commit_sha=nil, path=nil)\n blob = self.lookup(id); blob_entry={}\n if commit_sha && path\n commit = self.lookup(commit_sha)\n unless commit\n root_tree = commit.tree\n blob_entry = Gitlab::Git::Blob.find_entry_by_path(self, root_tree.oid, path)\n end\n end\n if blob\n Gitlab::Git::Blob.new(\n id: blob.oid,\n name: blob_entry[:name],\n size: blob.size,\n data: blob.content,\n mode: blob_entry[:mode],\n path: path,\n commit_id: commit_sha,\n )\n end\n end", "def blobs\n @blobs ||= ApiFactory.new 'GitData::Blobs'\n end", "def blob\n generate\n storage.get(path).body\n end", "def BlobWithMode\n Git::BlobWithMode\n end", "def blob(repo, digest, file)\n doreq('get', \"/v2/#{repo}/blobs/#{digest}\", file)\n end", "def read_blob(ref, filename)\n blob = repository&.blob_at(ref, filename)\n\n raise 'Blob not found' unless blob\n raise 'File is not readable' unless blob.readable_text?\n\n blob\n end", "def blob\n nil\n end", "def blob\n read_repo\n if @branches.count < 1\n render :template => 'repositories/newrepo'\n return\n end\n\n params[:action] = \"blob\"\n\n @blob = @repository.get_blob(@branch, @path)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @repository }\n end\n end", "def get_object(id)\n return nil unless (blob = find_blob(id)) && (obj = blob.read_object(id))\n deserialize(obj)\n end", "def getBlobById(blob_id)\n b = @repo.blob(blob_id).data\n if b == \"\"\n # either the blob doesn't exist or it does but the data is empty\n return false\n end\n return b\n end", "def to_blob\n @blob\n end", "def git\n @git ||= Grit::Repo.new(path)\n end", "def git\n @git ||= Grit::Repo.new(path)\n end", "def blob\n dbf.blob\n end", "def blob(s)\n if s.is_a?(SQL::Blob)\n s\n else\n SQL::Blob.new(s)\n end\n end", "def blob(id)\n head \"/blobs/#{id}\"\n end", "def get(type, id)\n case type.to_sym\n when :blob then grit.blob(id)\n when :tree then grit.tree(id)\n when :commit then grit.commit(id)\n when :tag\n \n object = grit.git.ruby_git.get_object_by_sha1(id)\n if object.type == :tag \n Grit::Tag.new(object.tag, grit.commit(object.object))\n else\n nil\n end\n \n else raise \"unknown type: #{type}\"\n end\n end", "def get_b\n n = self.get_i32\n OSC::Blob.new(self.get_data(n))\n end", "def blob(s)\n SQL::Blob.new(s)\n end", "def to_sequel_blob\n SQL::Blob.new(self)\n end", "def repo\n @repo ||= OctocatHerder::Repository.new(@raw['repo'], connection)\n end", "def blob(oid, destination)\n begin\n res = barerepo.blob_at oid, destination\n rescue\n return nil\n end\n res\n end", "def blob(oid, destination)\n begin\n res = barerepo.blob_at oid, destination\n rescue\n return nil\n end\n res\n end", "def repository\n unless Colonel.config.rugged_backend.nil?\n @repo ||= Rugged::Repository.init_at(File.join(Colonel.config.storage_path, id), :bare, backend: Colonel.config.rugged_backend)\n else\n @repo ||= Rugged::Repository.init_at(File.join(Colonel.config.storage_path, id), :bare)\n end\n end", "def snapshot\r\n date = self.class.service_instance.snapshot_blob(self.path)\r\n properties = self.class.service_instance.get_blob_properties(self.path)\r\n return BlobObject.new(:name => self.name, \r\n :url => self.class.service_instance.generate_request_uri(self.path) + \"?snapshot=#{date}\",\r\n :content_type => properties[:content_type],\r\n :snapshot_date => date)\r\n end", "def create_blob(content)\n options = {\n headers: headers,\n body: {\n content: content,\n encoding: \"base64\"\n }.to_json\n }\n response = self.class.post(\"#{BASE_URI}/repos/#{@owner}/#{@repo}/git/blobs\", options)\n response.parsed_response\n end", "def set_blob\n @blob = Blob.find(params[:id])\n end", "def tree_blob(ref, path)\n ref ||= 'master'\n commit = self.commit ref\n tree = commit.tree_rpc\n Tree.content_by_path(self, tree.id, path, commit.id, tree.path)\n end", "def io\n @io ||= StringIO.new(blob, 'r+b')\n end", "def set_blob\n @blob = Blob.find(params[:id])\n end", "def repo() \n\t\treturn @repo if @repo != nil\n\t\t@repo = Grit::Repo.new(self[:path])\n\tend", "def get_blob(container, blob, options={})\n query = { }\n StorageService.with_query query, 'snapshot', options[:snapshot]\n StorageService.with_query query, 'timeout', options[:timeout].to_s if options[:timeout]\n uri = blob_uri(container, blob, query)\n\n headers = StorageService.common_headers\n options[:start_range] = 0 if options[:end_range] and not options[:start_range]\n if options[:start_range]\n StorageService.with_header headers, 'x-ms-range', \"bytes=#{options[:start_range]}-#{options[:end_range]}\"\n StorageService.with_header headers, 'x-ms-range-get-content-md5', true if options[:get_content_md5]\n end\n add_blob_conditional_headers options, headers\n\n response = call(:get, uri, nil, headers, options)\n result = Serialization.blob_from_headers(response.headers)\n result.name = blob unless result.name\n return result, response.body\n end", "def blob(arg)\r\n file MojoMagick::tempfile(arg)\r\n end", "def read\n client[\"/vaults/#{vault_id}/blobs/#{blob_id}\"].get\n end", "def get_blob(container, blob, options={})\n query = { }\n query['snapshot'] = options[:snapshot] if options[:snapshot]\n query['timeout'] = options[:timeout].to_s if options[:timeout]\n uri = blob_uri(container, blob, query)\n\n headers = service_properties_headers\n options[:start_range] = 0 if options[:end_range] and not options[:start_range]\n if options[:start_range]\n headers['x-ms-range'] = \"bytes=#{options[:start_range]}-#{options[:end_range]}\"\n headers['x-ms-range-get-content-md5'] = true if options[:get_content_md5]\n end\n\n response = call(:get, uri, nil, headers)\n result = Serialization.blob_from_headers(response.headers)\n result.name = blob unless result.name\n return result, response.body\n end", "def blob; end", "def blob; end", "def repo\n return @repo if can_persist?\n return nil\n end", "def get(repository, tag)\n images = Docker::Image.all.select { |i|\n i.info[\"RepoTags\"].include? \"#{repository}:#{tag}\"\n }\n # I don't think it's possible to have multiple images from the same\n # repository with the same tag, so this shouldn't be an issue.\n @raw = images[0]\n end", "def repository\n Repository[self]\n end", "def to_blob\n f = File.new @path\n f.binmode\n f.read\n ensure\n f.close if f\n end", "def save2blob()\n url = URI.parse(getUrl)\n h = Net::HTTP.start(url.host, url.port) do |http|\n resp, data = http.get(url.path + '?' + url.query)\n return data\n end\n end", "def save\n raise 'Blob is empty' if !data\n repository.put(self) if modified?\n id\n end", "def git\n @git ||= Git::Repo.new \"git@#{hostname}:hoboku.git\"\n end", "def to_blob\n File.binread(path)\n end", "def blobs_for_committish(committish)\n commits = grit.batch(committish)\n unless commits.empty?\n commits.first.tree.blobs\n end\n end", "def to_blob\n #@blob ||= Net::SSH::Buffer.from(:string, ssh_type,\n # :bignum, p, :bignum, q, :bignum, g, :bignum, pub_key).to_s\n SSHUtils.convert_string(ssh_type)<<\n SSHUtils.convert_bignum(p)<<\n SSHUtils.convert_bignum(q)<<\n SSHUtils.convert_bignum(g)<<\n SSHUtils.convert_bignum(pub_key)\n end", "def to_sequel_blob\n self\n end", "def repo\n @repository\n end", "def credential_blob\n size = @cred_struct[:credential_blob_size]\n return nil unless size > 0\n\n @cred_struct[:credential_blob].read_bytes(size)\n end", "def repository\n @repository ||= repo_type.repository_for(container)\n end", "def to_blob\n #@blob ||= Net::SSH::Buffer.from(:string, ssh_type, :bignum, e, :bignum, n).to_s\n SSHUtils.convert_string(ssh_type)<<\n SSHUtils.convert_bignum(e)<<\n SSHUtils.convert_bignum(n)\n end", "def value\r\n @value ||= self.class.service_instance.get_blob(path)\r\n end", "def add_blob\n repository.add(blob_path)\n end", "def git_cache\n @git_cache ||= GitCache.new(self)\n end", "def find_blob_data(sha, path)\n commit = barerepo.lookup sha\n tree = barerepo.lookup commit.tree_id\n blob = tree.path path\n blobdata = barerepo.read(blob[:oid]).data\n image = {\n name: blob[:name],\n data: blobdata\n }\n [image , commit]\n end", "def stream_blob(item)\n Worochi::Log.debug \"Using JSON streaming...\"\n post_stream = Helper::StreamIO.new(item)\n\n uri = URI(\"https://api.github.com/repos/#{repo}/git/blobs\")\n request = Net::HTTP::Post.new(uri.path)\n request.content_length = post_stream.size\n request.content_type = 'application/x-www-form-urlencoded'\n request.add_field('Authorization', \"token #{options[:token]}\")\n request.body_stream = post_stream\n\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = (uri.scheme == 'https')\n http.request request do |response|\n return JSON.parse(response.body)['sha']\n end\n end", "def store_blob(blob)\n super #=> returns blob[:tempfile]\n end", "def to_blob; end", "def to_blob; end", "def to_blob; end", "def to_blob; end", "def to_blob; end", "def to_blob; end", "def to_blob\n stream = StringIO.new\n @surface.write_to_png(stream)\n stream.string\n end", "def repository\n @repository ||= Repository::Content.new(@base_dir)\n end", "def lib\n @lib ||= Git::Lib.new(self, @logger)\n end", "def repository(project)\n Grit::Repo.new(project.folder)\n end", "def blobs\n contents.select { |v| v.kind_of? Gitlab::Git::Blob }\n end", "def try_blobs(meth)\n old_blob&.public_send(meth) || new_blob&.public_send(meth)\n end", "def object(objectish)\n Git::Object.new(self, objectish)\n end", "def initialize(blob, commit)\n @blob = blob\n @commit = commit\n @file = File.new(blob.path, nil)\n end", "def null_github_object\n @null_github_object ||= Object.const_get(\"Null#{self.class}\").new\n end", "def repo!\n read_attribute :repo\n end", "def ob\n return self.class.ob\n end", "def object_data(path)\n blob = path_to_object(path)\n return nil if (not blob) || (blob.kind_of? Grit::Tree)\n blob.kind_of?(Grit::Blob) ? blob.data : blob\n end", "def file\n f = nil\n if self.asset_clone_id.present?\n x = self.asset_clone\n f = x.asset if x.present?\n else\n f = self.asset\n end\n return f\n end", "def store_blob(object,field_name,blob)\n super #=> returns blob[:tempfile]\n end", "def blob?\n @blob\n end", "def ref\n @bin\n end", "def read(sha)\n begin\n JSON.parse(git.get(:blob, sha).data)\n rescue JSON::ParserError, Errno::EISDIR \n nil\n end\n end", "def load_image\n Magick::Image.from_blob(data).first\n end", "def repo\n @repo\n end", "def get_image(id)\n OpenStack::Compute::Image.new(self,id)\n end", "def get_image(id)\n OpenStack::Compute::Image.new(self,id)\n end", "def fetch_instance(impl, attachment_method = nil)\n # if the impl has a wrapper already attached, then return it\n if impl.instance_variable_defined?(:@proton_wrapper)\n return impl.instance_variable_get(:@proton_wrapper)\n end\n unless attachment_method.nil?\n record = Cproton.__send__(attachment_method, impl)\n rbkey = Cproton.pni_void2rbkey(Cproton.pn_record_get(record, RBCTX))\n # if we don't have a key, then we don't have an object\n return nil if rbkey.nil?\n registry_key = Cproton.Pn_rbkey_get_key_value(rbkey)\n else\n registry_key = get_key(impl)\n end\n # if the object's not in the registry then return\n return nil unless @@registry.has_key?(registry_key)\n\n result = @@registry[registry_key]\n # result = nil unless result.weakref_alive?\n if result.nil?\n raise Qpid::Proton::ProtonError.new(\"missing object for key=#{registry_key}\")\n else\n # update the impl since the Swig wrapper for it may have changed\n result.impl = impl\n end\n return result\n end", "def get_commit(key, id)\n key = key_for(key)\n commit = git.commit(id)\n blob = commit.tree / key\n decode(blob.data) if blob\n end", "def get_from_storage(id)\n\t\traise \"[FATAL] Storage directory not set\" if Repository.data_dir.nil?\n\n\t\t# Aquire raw JSON\n\t\traw = aquire_raw(id)\n\n\t\t# Escape if object not found\n\t\treturn nil if raw.nil?\n\n\t\t# Create object\n\t\tobj = JSON::parse(raw)\n\n\t\t# Grab needed objects, args => self\n\t\tobj.cache_collect\n\n\t\t# return\n\t\treturn obj\n\tend", "def connection\n @connection ||= Fog::Storage.new(@fog_options)\n end", "def object\n @object ||= build_object\n end", "def git_object(hash)\n return `git cat-file -p #{hash}`\nend", "def get(storage_id)\n image = ::OpenNebula::Image.new(::OpenNebula::Image.build_xml(storage_id), @client)\n rc = image.info\n check_retval(rc, Backends::Errors::ResourceRetrievalError)\n\n parse_backend_obj(image)\n end", "def download_blob\n uuid = SecureRandom.uuid\n path = File.join(Dir.tmpdir, \"template-#{uuid}\")\n\n @logger.debug(\"Downloading job '#{@name}' (#{blobstore_id})...\")\n t1 = Time.now\n\n File.open(path, \"w\") do |f|\n App.instance.blobstores.blobstore.get(blobstore_id, f, sha1: present_model.sha1)\n end\n\n @logger.debug(\"Job '#{@name}' downloaded to #{path} \" +\n \"(took #{Time.now - t1}s)\")\n\n path\n end", "def storage\n @storage ||= Fog::Storage.new(storage_config)\n end", "def repository\n @repository || model.repository\n end", "def repo\n if @repo == NRSER::NO_ARG\n @repo = QB::Repo.from_path root_path\n end\n \n @repo\n end", "def get_image(id)\n OpenStack::Compute::Image.new(self,id)\n end", "def blob_path(relative = true)\n blob_path = File.join(self.class.name, hash.to_s)\n if relative\n blob_path\n else\n File.join(repository_path, blob_path)\n end\n end" ]
[ "0.7978034", "0.6997656", "0.67002213", "0.65411824", "0.6367336", "0.63655615", "0.62690234", "0.6194238", "0.6183753", "0.6094445", "0.60825676", "0.6049865", "0.6021602", "0.6001665", "0.6001665", "0.59536", "0.5914461", "0.5901281", "0.589945", "0.5892387", "0.58584577", "0.5801932", "0.57968265", "0.57953244", "0.57953244", "0.57795125", "0.5756965", "0.57426226", "0.5720879", "0.5704672", "0.5685943", "0.56607705", "0.565374", "0.56379306", "0.56043416", "0.55866027", "0.5581419", "0.5561093", "0.5561093", "0.5535447", "0.5533846", "0.5511545", "0.54843175", "0.54754055", "0.5460034", "0.5445634", "0.5443973", "0.54384524", "0.5432529", "0.5408538", "0.53788805", "0.5370896", "0.53681993", "0.5362216", "0.5357269", "0.5340574", "0.5328476", "0.53166986", "0.53017783", "0.528301", "0.52405596", "0.52405596", "0.52405596", "0.52405596", "0.52405596", "0.52405596", "0.5238939", "0.5228676", "0.5209413", "0.51687497", "0.5161384", "0.5135891", "0.5122431", "0.5117651", "0.5110678", "0.5105596", "0.51007634", "0.5097308", "0.5087718", "0.5084389", "0.5072926", "0.5064836", "0.50618327", "0.5056857", "0.5042928", "0.5038131", "0.5038131", "0.50339305", "0.5028458", "0.50205547", "0.5017497", "0.5013854", "0.50108117", "0.50048494", "0.49980155", "0.49938253", "0.49902114", "0.49885556", "0.49850932", "0.49846599" ]
0.7991585
0
Gets a Page instance for this blob. wiki Gollum::Wiki instance for the Gollum::Page Returns a Gollum::Page instance.
def page(wiki, commit) blob = self.blob(wiki.repo) page = wiki.page_class.new(wiki).populate(blob, self.dir) page.version = commit page end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def page\n @page_object ||= Page.find(self.page_id)\n rescue\n nil\n end", "def page_object\n @page\n end", "def page_object\n @page\n end", "def page\n @page ||= retrieve_page\n end", "def page\n @page ||= retrieve_page\n end", "def page\n @page ||= Page.new(browser)\n end", "def page\n self.class.page\n end", "def page\n @page ||= revision.try(:page)\n end", "def page\n obj\n end", "def page(record)\n p = @pages.get(record.page_idx, record) || load(record.page_idx, record)\n unless p.uid == record.page_idx\n raise RuntimeError, \"Page reference mismatch. Record \" +\n \"#{record.page_idx} points to page #{p.uid}\"\n end\n\n p\n end", "def page\n return nil if element.nil?\n @page ||= element.page\n end", "def page\n @page ||= Page.instance\nend", "def page\n get_page\n nil\n end", "def page\n PageDrop.new(@page, page)\n end", "def page\n @proxying ? @page.document : @page\n end", "def page(slug_id)\n\t\treturn self.pages.where(:slug => slug_id).first\n\tend", "def find_page(title, version = nil, load_content: true)\n page_title, page_dir = page_title_and_dir(title)\n\n if page = wiki.page(title: page_title, version: version, dir: page_dir, load_content: load_content)\n WikiPage.new(self, page)\n end\n end", "def wiki_page(name, path = nil, version = nil, exact = true)\n wiki = wiki_new\n path = name if path.nil?\n name = extract_name(name) || wiki.index_page\n path = extract_path(path)\n path = '/' if exact && path.nil?\n\n OpenStruct.new(:wiki => wiki, :page => wiki.paged(name, path, exact, version),\n :name => name, :path => path)\n end", "def new\n #creates a new page only in memory\n @page = Page.new\n end", "def page\n return @most_recent_page if @most_recent_page && @most_recent_page.on_page?\n\n if @browser.is_a? Watir::Browser\n url = @browser.url\n elsif @browser.is_a? Selenium::WebDriver::Driver\n url = @browser.current_url\n else\n raise SiteObject::BrowserLibraryNotSupportedError, \"Unsupported browser library: #{@browser.class}\"\n end\n\n found_page = nil\n @pages.each do |p|\n if p.url_matcher && p.url_matcher =~ url\n found_page = p\n elsif p.query_arguments && p.url_template.match(url)\n found_page = p\n elsif !p.query_arguments && p.url_template.match(url.split(/(\\?|#)/)[0])\n found_page = p\n end\n\n break if found_page\n end\n\n if found_page && !found_page.required_arguments.empty?\n if hsh = found_page.url_template.extract(url)\n return found_page.new(self, found_page.url_template.extract(url))\n else\n return found_page.new(self, found_page.url_template.extract(url.split(/(\\?|#)/)[0]))\n end\n elsif found_page\n return found_page.new(self)\n else\n return nil\n end\n end", "def page\n\t\t\teditor.page\n\t\tend", "def find(page)\n Page.find(page)\n end", "def find(path)\n path = full_path(path)\n page_blob = find_blob(path)\n raise MissingResource unless page_blob\n new(page_blob, path)\n end", "def get_page(id)\n @client.raw('get', \"/content/pages/#{id}\")\n end", "def load_page\n page_not_found! unless Language.current\n\n @page ||= Language.current.pages.contentpages.find_by(\n urlname: params[:urlname],\n language_code: params[:locale] || Language.current.code\n )\n end", "def get_facebook_page(page_id)\n # Facebooker::Page.new(page_id)\n @graph = Koala::Facebook::API.new(fb_access_token)\n page_token = @graph.get_page_access_token(page_id)\n @page_graph = Koala::Facebook::API.new(page_token)\n @page_graph.get_object('me')\n end", "def page\n nil\n end", "def page(path)\n path = normalize_path(path)\n @pages[path]\n end", "def page(name, version = 'master')\n @page_class.new(self).find(name, version)\n end", "def page; self end", "def set_page\n @page = if params[:url].present?\n Page.find_by_url params[:url]\n else\n Page.find(params[:id]) if params[:id].present?\n end\n end", "def page\n Page.where(:text_id => primary_key).first\n end", "def set_page\n @page = Page.find(params[:id])\n end", "def set_page\n @page = Page.find(params[:id])\n end", "def set_page\n @page = Page.find(params[:id])\n end", "def set_page\n @page = Page.find(params[:id])\n end", "def set_page\n @page = Page.find(params[:id])\n end", "def set_page\n @page = Page.find(params[:id])\n end", "def set_page\n @page = Page.find(params[:id])\n end", "def page\n @page ||= Page.new(order_by: order_by, per_page: params[:per_page])\n end", "def comatose_page(id)\n assert page = ComatosePage.find(id)\n assert wrap = Comatose::PageWrapper.new(page)\n return wrap\n end", "def set_page\n @page = Page.find(params[:id])\n end", "def set_page\n @page = Page.find(params[:id])\n end", "def set_page\n @page = Page.find(params[:id])\n end", "def set_page\n @page = Page.find(params[:id])\n end", "def set_page\n @page = Page.find(params[:id])\n end", "def set_page\n @page = Page.find(params[:id])\n end", "def set_page\n @page = Page.find(params[:id])\n end", "def set_page\n @page = Page.find(params[:id])\n end", "def set_page\n @page = Page.find(params[:id])\n end", "def set_page\n @page = Page.find(params[:id])\n end", "def set_page\n @page = Page.find(params[:id])\n end", "def set_page\n @page = Page.find(params[:id])\n end", "def set_page\n @page = Page.find(params[:id])\n end", "def set_page\n @page = Page.find(params[:id])\n end", "def set_page\n @page = Page.find(params[:id])\n end", "def set_page\n @page = Page.find(params[:id])\n end", "def set_page\n @page = Page.find(params[:id])\n end", "def set_page\n @page = Page.find(params[:id])\n end", "def set_page\n @page = Page.find(params[:id])\n end", "def set_page\n @page = Page.find(params[:id])\n end", "def set_page\n @page = Page.find(params[:id])\n end", "def set_page\n @page = Page.find(params[:id])\n end", "def set_page\n @page = Page.find(params[:id])\n end", "def set_page\n @page = Page.find(params[:id])\n end", "def set_page\n @page = Page.find(params[:id])\n end", "def set_page\n @page = Page.find(params[:id])\n end", "def set_page\n @page = Page.find(params[:id])\n end", "def set_page\n @page = Page.find(params[:id])\n end", "def set_page\n @page = Page.find(params[:id])\n end", "def set_page\n @page = Page.find(params[:id])\n end", "def find_page_object_for_custom_methods\n find_page_object\n end", "def new\n @page = Page.new\n end", "def new\n @page = Page.new\n end", "def new\n @page = Page.new\n end", "def new\n @page = Page.new\n end", "def page=( page )\n init_db_from_page( page )\n @page = page.deep_clone\n end", "def page\r\n return @cache[:page] unless @cache[:page].nil?\r\n\r\n @cache[:page] = @agent.try(:page)\r\n end", "def set_page_page\n @page_page = PagePage.find(params[:id])\n end", "def get(page)\n case page\n when Model\n page\n when String\n new site.get page\n when Sitepress::Resource\n new page\n else\n raise ModelNotFoundError, \"#{self.inspect} could not find #{page.inspect}\"\n end\n end", "def new_page\n page = Page.new\n page.url = params[:id] if Page.url?(params[:id]) && params[:id] != 'new-page'\n page\n end", "def page\n\t\t\t@navigation ? @navigation.page : nil\n\t\tend", "def show\n @page = Page.new\n @page = Page.find(params[:id])\n end", "def get_page()\n @page = Nokogiri::HTML(open(@url).read)\n end", "def as_page_class\n as_class('Page')\n end", "def page(permalink)\n\t\t# check if the file exists, return nil if not\n\t\tfile = dir + '/' + permalink + '.md'\n\t\treturn nil unless File.exists? file # bail out if the file doesn't exist\n\t\t\n\t\t# check if we can read content, return nil if not\n\t\tcontent = File.new(file, :encoding => \"UTF-8\").read\n\t\treturn nil if content.nil?\n\t\t\n\t\t# return a new Page instance\n\t\treturn Page.new(content, permalink, self)\n\tend", "def page(permalink)\n\t\t# check if the file exists, return nil if not\n\t\tfile = dir + '/' + permalink + '.md'\n\t\treturn nil unless File.exists? file # bail out if the file doesn't exist\n\t\t\n\t\t# check if we can read content, return nil if not\n\t\tcontent = File.new(file, :encoding => \"UTF-8\").read\n\t\treturn nil if content.nil?\n\t\t\n\t\t# return a new Page instance\n\t\treturn Page.new(content, permalink, self)\n\tend", "def set_page\n @page = Page.find_by(url: params[:url])\n end", "def page\n Bowline::Desktop::Proxy.new(\n windows.length == 1 ? windows.first : windows\n )\n end", "def pages\n @pages ||= get_pages\n end", "def show\n @page = Page.find(params[:id])\n end", "def set_page\n @page = Page.find_by_url(params[:url])\n end", "def set_page\n\t\t@page = Page.find(params[:id])\n\tend", "def page(page_number)\n data = page_data(page_number)\n Innodb::Page.parse(self, data, page_number) if data\n end", "def to_page\n page\n end", "def get_page_from_url(url)\n site.pages.each do |page|\n if page.url == url then\n return page\n end\n end\n end", "def page\n @page ||= Capybara::Session.new(Capybara.mode, Capybara.app)\n end", "def set_page\n @page = Page.find_by_permalink!(params[:id])#.split(\"/\").last)\n end", "def page\n @context.registers[:page]\n end", "def first_page\n Page.find(self.first_page_id)\n end" ]
[ "0.75451785", "0.7389194", "0.7389194", "0.72426635", "0.72426635", "0.70587254", "0.7049628", "0.6957463", "0.6760992", "0.6680988", "0.6676338", "0.6459358", "0.64564544", "0.64183456", "0.6369608", "0.6272012", "0.62137717", "0.6174501", "0.6126684", "0.608311", "0.60752577", "0.60740995", "0.6062848", "0.60468787", "0.6045364", "0.60219276", "0.6020574", "0.5972389", "0.59677064", "0.59608424", "0.5956705", "0.5956355", "0.5946855", "0.5946855", "0.5946855", "0.5946855", "0.5946855", "0.5946855", "0.5946855", "0.5944217", "0.5926876", "0.5919815", "0.5919815", "0.5919815", "0.5919815", "0.5919815", "0.5919815", "0.5886081", "0.5886081", "0.5886081", "0.5886081", "0.5886081", "0.5886081", "0.5886081", "0.5886081", "0.5886081", "0.5886081", "0.5886081", "0.5886081", "0.5886081", "0.5886081", "0.5886081", "0.5886081", "0.5886081", "0.5886081", "0.5886081", "0.5886081", "0.5886081", "0.5886081", "0.5886081", "0.5886081", "0.58812094", "0.5869145", "0.58678716", "0.58678716", "0.58678716", "0.5865808", "0.5859142", "0.5850874", "0.5850185", "0.58447534", "0.58340913", "0.58294165", "0.58290076", "0.58155113", "0.5806413", "0.5806413", "0.5792968", "0.57929355", "0.5784583", "0.5773361", "0.5758547", "0.5757942", "0.5748106", "0.5740403", "0.57237965", "0.57184714", "0.570255", "0.56994087", "0.56988907" ]
0.71868813
5
Changes default port to 8080 Tell configure to look for pcre in HOMEBREW_PREFIX
def patches DATA end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def port\n conf['port'] || '80'\n end", "def port_set(port)\n rebuild_uri :port => port\n end", "def proxy_port; end", "def base_port\n (options[:port] || env[\"PORT\"] || ENV[\"PORT\"] || 5000).to_i\n end", "def host_with_port; end", "def default_httpd_port\n if monit_version && UNIXSOCKET_VERSION.satisfied_by?(monit_version)\n monit_name_path('/var/run/%{name}.sock')\n else\n 2812\n end\n end", "def webserver_port\n AgileProxy.config.webserver_port\n end", "def port\n options.fetch(:port, \"8080\").to_s\n end", "def proxyport=(value)\n Curl.set_option(:proxyport, value_for(value, :int), handle)\n end", "def maybe_add_port\n if ENV['BONSAI_URL'].present?\n uri = URI.parse(@@url) rescue ''\n if uri.kind_of?(URI::HTTPS) || uri.kind_of?(URI::HTTP)\n port = (uri.kind_of?(URI::HTTPS)) ? 443 : 80\n if !@@port.present?\n log(\"Bonsai: Appending port #{port} to the cluster URL for production environment.\")\n return \"#{@@url}:#{port}\".gsub('::', ':')\n elsif @@port != port\n log(\"Bonsai: Overriding the requested port #{@@port} with the standard #{port} for production environment.\")\n return \"#{@@url.rpartition(':').first}:#{port}\"\n end\n end\n end\n @@url\n end", "def default_port\n case scheme\n when 'http' then 80\n when 'https' then 443\n end\n end", "def set_port port\n @port = port\n end", "def port=(_); end", "def server_port ; @env['SERVER_PORT' ].to_i ; end", "def port=(value)\n conf['api']['port'] = value.to_i\n end", "def server_port; end", "def optional_port; end", "def port=(port)\n set_default :port, port\n end", "def server_port\n AgileProxy.config.server_port\n end", "def port\n 7779\n end", "def port(p)\n @config[:port] = p\n end", "def configure_ports(interface, min_port)\n interface ||= \"127.0.0.1\"\n min_port ||= 8080\n unless env[:riak_core][:http]\n env[:riak_core][:http] = [Tuple[interface, min_port]]\n min_port += 1\n end\n env[:riak_core][:http] = env[:riak_core][:http].map {|pair| Tuple[*pair] }\n env[pb_config_section][:pb_ip] = interface unless env[pb_config_section][:pb_ip]\n unless env[pb_config_section][:pb_port]\n env[pb_config_section][:pb_port] = min_port\n min_port += 1\n end\n unless env[:riak_core][:handoff_port]\n env[:riak_core][:handoff_port] = min_port\n min_port += 1\n end\n end", "def port; config[:port]; end", "def default_port\n if secure?\n 443\n else\n 80\n end\n end", "def default_port\n if secure?\n 443\n else\n 80\n end\n end", "def set_port(opts)\n opts = check_params(opts,[:ports])\n super(opts)\n end", "def set_port(opts)\n opts = check_params(opts,[:ports])\n super(opts)\n end", "def web_port\n 5000\n end", "def proxy_port\n ENV[\"CHEF_API_PROXY_PORT\"] || config[\"CHEF_API_PROXY_PORT\"]\n end", "def set_tunnel_port(opts)\n opts = check_params(opts,[:ports])\n super(opts)\n end", "def port(port)\n @options[:port] = port\n end", "def start\n [:INT, :TERM, :ABRT].each{|signal|Signal.trap(signal, ->{stop})}\n\n connector = SelectChannelConnector.new\n connector.port = http_port\n connector.confidential_port = https_port if https_port\n\n jetty.add_connector connector\n jetty.start\n end", "def default_port\n @default_port ||= 1234\n end", "def set_proxy(addr, port = T.unsafe(nil), user = T.unsafe(nil), pass = T.unsafe(nil)); end", "def set_port\n\t\tself.port = 389 if self.port == 0\n\tend", "def port\n @port || (secure ? 443 : 80)\n end", "def test_server_port\n 3000\n end", "def standard_port; end", "def local_port\n get('beef.http.port') || '3000'\n end", "def proxy_port\n proxy? ? @options['proxy_port'].to_i : nil\n end", "def start(host, port); end", "def daemon_port_prefix(env)\n case env.to_s.downcase\n when \"development\" then 74\n when \"test\" then 75\n end\nend", "def port\n @port ||= opts.fetch(:port, parsed_uri.port)\n end", "def port; end", "def port; end", "def port; end", "def port; end", "def port; end", "def port; end", "def port; end", "def port; end", "def start!(port = 8080)\n $app = HttpApp.new do |app|\n app.torrent_manager = @torrent_manager\n app.tv = TorrentView.new(@torrent_manager)\n end\n Thin::Server.start('127.0.0.1', port) do\n map '/' do\n run $app\n end\n end\n end", "def port\n 20000 + ($$ % 40000)\n end", "def port\n conf['api']['port'].to_s\n end", "def set_proxy(address, port, user = T.unsafe(nil), password = T.unsafe(nil)); end", "def port\n super\n end", "def port\n super\n end", "def port=(new_port)\n return if new_port == port\n reset!\n @desired_port = new_port\n start!\n end", "def http_port\n use_ssl? ? 443 : 80\n end", "def true_port\r\n port = servlet_response.getLocalPort\r\n $log.debug(\"True port is #{port}\")\r\n port\r\n end", "def open_firewall_port (port, protocol = 'tcp')\n sudo \"ufw allow #{ \"proto #{protocol} \" if (protocol != 'both') }from any to any port #{port}\"\n end", "def port(port, host = T.unsafe(nil)); end", "def port\n @port || 161\n end", "def host_with_port\n request.host + (request.port == 80 ? '' : ':' + request.port.to_s)\n end", "def standard_port?; end", "def port\n end", "def port=(v)\n check_port(v)\n set_port(v)\n port\n end", "def default_ssl_port; end", "def non_default_port(scheme,port)\n case scheme\n when /^http$/i then port==80 ? nil : port\n when /^https$/i then port==443 ? nil : port\n else port\n end\n end", "def proxyport\n config[\"proxyport\"]\n end", "def port=(value)\n conf['dashboard']['port'] = value.to_i\n end", "def start(host = T.unsafe(nil), port = T.unsafe(nil)); end", "def port\n @options[:port]\n end", "def initialize(info = {})\n super\n register_options( [\n Opt::RPORT(771)\n ], Msf::Exploit::Remote::RealPort )\n end", "def set_service_port(service, port)\n if @@ports.keys.include?(service.upcase)\n @@ports[\"#{service.upcase}\"] = port.to_i\n else\n print_error(\"#{service.upcase} Service NOT Recognized!\")\n print_error(\"NO Changes made to port settings....\")\n return false\n end\n end", "def port=(_arg0); end", "def port\n unless defined?(@port)\n @port = solr_url.port if solr_url\n @port ||= user_configuration_from_key('solr', 'port')\n @port ||= default_port\n @port = @port.to_i\n end\n @port\n end", "def actual_port; end", "def actual_port; end", "def main\n # Check that there was an argument supplied to the application\n if ARGV.length > 0\n # Convert the argument to an integer to be used as a port number\n port = ARGV[0].to_i\n if port < 1024 || port > 49151\n puts \"illegal port #{ARGV[0].to_i}: Choose one in range 1024-49151\"\n exit\n end\n else\n # If no port was specified, create a random port number\n port = Random.new.rand(48128) + 1024\n end\n serve port\nend", "def port_default?\n self.port == (self.secure? ? HTTPS_PORT_DEFAULT : HTTP_PORT_DEFAULT)\n end", "def homeserver\n port_s = port ? \":#{port}\" : ''\n domain ? domain + port_s : ''\n end", "def homeserver\n port_s = port ? \":#{port}\" : ''\n domain ? domain + port_s : ''\n end", "def raw_host_with_port; end", "def port(new_port)\n unless port_valid? new_port\n raise Urb::InvalidUrl 'Try to set a invalid value to port'\n end\n\n @port = new_port\n\n self\n end", "def port\n @port ||= target.split(':',2).last.to_i\n end", "def proxyport\n @attributes.fetch('proxyport', 0)\n end", "def port\n @port ||= use_ssl ? 636 : 389\n end", "def build_port(scheme=nil)\n non_default_port(scheme, @port_value || non_default_port(base_value.scheme, base_value.port))\n end", "def port\n configuration.port\n end", "def port\n configuration.port\n end", "def tunnel_port\n super\n end", "def public_port\n return get('beef.http.public.port') unless get('beef.http.public.port').nil?\n\n return '443' if public_https_enabled?\n return '80' unless public_host.nil?\n\n nil\n end", "def port\n @request_spec_server.port\n end", "def http_proxy(addr=nil, port = nil)\n default_options[:http_proxyaddr] = addr\n default_options[:http_proxyport] = port\n end", "def host_port(options)\n require \"jenkins\"\n require \"jenkins/config\"\n if base_uri = ::Jenkins::Config.config['base_uri']\n uri = URI.parse(::Jenkins::Config.config['base_uri'])\n host = uri.host\n port = uri.port\n end\n host = options[\"host\"] if options[\"host\"]\n port = options[\"port\"] || port || '80'\n [host, port]\n end", "def port\n @port ||=\n if user_configuration.has_key?('solr')\n user_configuration['solr']['port']\n end || 8983\n end", "def service_options(resource)\n super\n resource.ruby_command(\"unicorn --port #{new_resource.port} #{configru_path}\")\n end", "def port\n return @forwarded_port || @port\n end", "def transport_port=(port)\n if port.match /\\//\n\n end\n end", "def start_server(port)\n root = Dir.getwd\n server = WEBrick::HTTPServer.new :Port => port, :DocumentRoot => root\n trap 'INT' do server.shutdown end\n server.start\n end" ]
[ "0.61214525", "0.60873634", "0.5910187", "0.5886581", "0.58162165", "0.57693076", "0.57402724", "0.573379", "0.57178086", "0.5689331", "0.567434", "0.56655586", "0.5655973", "0.5651475", "0.562018", "0.559096", "0.55797225", "0.5575391", "0.55581486", "0.5556788", "0.5556027", "0.55380726", "0.55160064", "0.5479038", "0.5479038", "0.54700834", "0.54700834", "0.5455366", "0.54551286", "0.5433051", "0.5429373", "0.54291135", "0.54190665", "0.54169506", "0.5416323", "0.53919727", "0.53783286", "0.53666824", "0.5360129", "0.5335964", "0.5325329", "0.5305005", "0.52984613", "0.5294759", "0.5294759", "0.5294759", "0.5294759", "0.5294759", "0.5294759", "0.5294759", "0.5294759", "0.5286298", "0.52843076", "0.5282052", "0.527095", "0.5261693", "0.5261693", "0.5258034", "0.5248917", "0.5232515", "0.5224054", "0.52219987", "0.5215079", "0.521041", "0.52028674", "0.5197176", "0.5187835", "0.51666665", "0.516554", "0.51598847", "0.5153707", "0.515005", "0.51438844", "0.51268154", "0.5124536", "0.5119126", "0.511583", "0.5105414", "0.5105414", "0.5099869", "0.5090743", "0.5085738", "0.5085738", "0.50779456", "0.50542694", "0.5052803", "0.5048824", "0.50448215", "0.50390613", "0.5029857", "0.5029857", "0.5026315", "0.5021543", "0.501354", "0.50121456", "0.5011894", "0.5004001", "0.5001262", "0.49998564", "0.4997337", "0.49938968" ]
0.0
-1
Route a request to the correct controller based on the given data.
def call(env) route = @routes.map do |exp, meta| next unless matches = env["PATH_INFO"].match(exp) meta.merge(captures: matches) end.compact.first return Yokunai::ErrorsController.new(env).not_found unless route request_method = env["REQUEST_METHOD"] if route[:methods].include?(request_method) Object.const_get(route[:class]) .new(env, route[:captures]) .public_send(request_method.downcase) else Yokunai::ErrorsController.new(env).unsupported_method end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(req, res)\n # The #run method will figure out what URL was requested, match it to\n # the path regex of one Route object, and finally ask the Route to\n # instantiate the appropriate controller, and call the appropriate method.\n end", "def run(req, res)\n match_data = @pattern.match(req.path)\n route_params = (match_data) ?\n match_data.names.zip(match_data.captures).to_h\n : {}\n\n controller_instance = @controller_class.new(req, res, route_params)\n\n controller_instance.invoke_action(@action_name)\n end", "def run(request, response)\n\n match_data = @pattern.match(request.path)\n\n route_params = Hash[match_data.names.zip(match_data.captures)]\n\n @controller_class\n .new(request, response, route_params)\n .invoke_action(action_name)\n end", "def run(req, res)\n match_data = @pattern.match(req.path)\n\n route_params = {}\n match_data.names.each do |name|\n route_params[name] = match_data[name]\n end\n\n @controller_class.new(req, res, route_params).invoke_action(action_name)\n end", "def run(req, res)\n regex = Regexp.new(@pattern.to_s)\n match_data = regex.match(req.path)\n route_params = {}\n match_data.names.each do |key|\n route_params[key] = match_data[key]\n end\n control = @controller_class.new(req, res, route_params)\n control.invoke_action(@action_name)\n end", "def run(req, res)\n route_params = {}\n\n match_data = @pattern.match(req.path)\n match_data.names.each do |key|\n route_params[key] = match_data[key]\n end\n\n controller = @controller_class.new(req, res, route_params)\n controller.invoke_action(@action_name)\n end", "def run(req, res)\n if matches?(req)\n controller_instance = controller_class.new(req, res, route_params(req))\n controller_instance.invoke_action(action_name)\n else\n # extra precaution! won't be hit if `Router#run` is used\n res.status = 404\n res.write(\"No route matches for #{http_method} on #{controller_class}\")\n end\n end", "def run(req, res)\n if matches?(req)\n controller = @controller_class.new(req, res)\n controller.send(@action_name)\n end\n end", "def run(req, res)\n route_params = self.make_match_hash(req)\n controller = @controller_class.new(req, res, route_params)\n controller.invoke_action(@action_name)\n end", "def run(req, res)\n match_data = pattern.match(req.path)\n # hash = {}\n # match_data.names.each do |name|\n # hash[name] = match_data[name]\n # end\n hash = match_data.names.each_with_object({}) do |name, h|\n h[name] = match_data[name]\n end\n controller_class.new(req, res, hash).invoke_action(action_name)\n end", "def handle_routes\n instance_exec(@_roda_app.request, &self.class.router_block)\n end", "def route\n @base_controller.route if @base_controller\n end", "def route_for(name, *args); end", "def run(req, res)\n @route_params = {}\n\n # I need to build route_params from the URL params\n # @pattern is the regexp\n match_data = @pattern.match(req.path)\n # * @pattern is the regexp given in the router.draw block in\n # p06_router_server.rb\n # * req.path is the url we are matching against\n # match_data gives us the MatchData object\n match_data.names.each do |name|\n @route_params[name] = match_data[name]\n end\n #this loop creates the params!\n\n controller_instance = @controller_class.new(req, res, @route_params)\n controller_instance.invoke_action(@action_name)\n end", "def route_to(klass_or_name, action)\n RouteToMatcher.new(klass_or_name, action)\n end", "def route(controller, action, **args)\n klass = Object.const_get(klass_for(controller)).new(**args)\n klass.send(action)\n end", "def run(req, res)\n controller = controller_class.new(req, res, route_params(req))\n controller.invoke_action(action_name)\n end", "def route_for(request)\n index, params = if @around_match\n send(@around_match, request) { match(request) }\n else\n match(request)\n end\n route = routes[index] if index\n if !route\n raise ControllerExceptions::NotFound, \n \"No routes match the request: #{request.uri}\"\n end\n [route, params]\n end", "def route(controller, action, **args)\n klass = Object.const_get(klass_for(controller)).new(**args)\n klass.send(action)\n end", "def route(controller, action, **args)\n klass = Object.const_get(klass_for(controller)).new(**args)\n klass.send(action)\n end", "def route() request.route end", "def controller(data)\n path = data.get(:path)\n path = path.native if path.is_a?(WAB::Data)\n return path_controller(path) unless path.nil? || (path.length <= @path_pos)\n\n content = data.get(:content)\n return @controllers[content.get(@type_key)] || default_controller unless content.nil?\n\n default_controller\n end", "def dispatch_action(req)\n controller = ROUTE_TO_CONTROLLER[req.path_info]\n raise Heartcheck::Errors::RoutingError if controller.nil?\n\n Logger.info \"Start [#{controller}] from #{req.ip} at #{Time.now}\"\n\n controller.new.index.tap do |_|\n Logger.info \"End [#{controller}]\\n\"\n end\n end", "def run(req, res)\n #@action = :index\n #@method = :get\n #@pattern = /^\\/users$/\n #@class = DummyController\n \n @params = req.path\n #route_params = @params\n ControllerBase.new(req, res, @params).invoke_action(@method, @pattern, @class, @action)\n end", "def route(agi, params=nil)\n request = {\n :uri => @uri,\n :controller => @controller,\n :method => @method,\n :id => @id,\n :options => @options\n }\n\n return if !@controller\n\n controller_name = if !@controller[/controller/]\n \"#{@controller}_controller\"\n else\n \"#{@controller}\"\n end\n\n controller_name = controller_name.classify\n controller = get_controller(controller_name)\n\n @@logger.info \"Processing Route to #{controller_name}##{@method}\"\n @@logger.info \"#{@uri}\"\n\n unless controller\n @@logger.warn(\"Nonexistant controller\")\n return set_invalid_extension(agi)\n end\n\n unless check_controller(controller)\n @@logger.warn \"Unroutable method\"\n return set_invalid_extension(agi)\n end\n\n unless check_route(controller, @method)\n @@logger.warn \"Unroutable method\"\n return set_invalid_extension(agi)\n end\n\n ctrl_instance = controller.new({\n :agi => agi,\n :params => params,\n :request => request\n })\n\n begin\n ctrl_instance.run_filter_chain :before\n ctrl_instance.method(@method).call()\n ctrl_instance.run_filter_chain :after\n rescue AGIFilterHalt => e\n LOGGER.warn e.message\n end\n end", "def call(request)\n compile! unless compiled?\n pattern, verb, params = *parse_request(request)\n pattern = pattern.encode(Encoding.default_external)\n candidacies = match_with(pattern)\n raise_exception(404) if candidacies.empty?\n candidacies, allows = *candidacies.partition{ |route| route.verb == verb }\n raise_exception(405, :verbs => allows.map(&:verb)) if candidacies.empty?\n candidacies.map{ |route| [route, route.params_for(pattern, params)] }\n end", "def route_path(path)\n AutoRouter::Router.map_controller(self, path: path)\n end", "def run(req, res)\n @params = req.params\n controller_class.send(action_name)\n end", "def route_request\n env.logger.debug \"#{self.class} ROUTING - #{env[Goliath::Request::PATH_INFO]}\"\n if has_path = ( env[Goliath::Request::PATH_INFO] =~ /^\\/(\\w+)(\\/\\w+)*/ )\n env.logger.debug \"#{self.class} route_request:\\t pathinfo = #{$1} extended = #{$2}\"\n path_info = $1\n extended_path_info = $2\n has_path = true #it will be a number or nil - let's just make it a bool\n elsif params[:id]\n has_path = true\n end\n \n method = env[Goliath::Request::REQUEST_METHOD]\n action = case method\n when 'GET'\n has_path ? 'show' : 'index'\n when 'POST'\n has_path ? ( raise BadRequestError, \"can't post to this resource\" ) : 'create'\n when 'PUT'\n !has_path ? ( raise BadRequestError, \"no resource to PUT to\" ) : 'update'\n when 'DELETE'\n !has_path ? ( raise BadRequestError, \"no resource to DELETE\" ) : 'delete'\n else\n raise MethodNotAllowedError, \"unknown request method\"\n end\n env.logger.info \"#{self.class} route_request:\\t attempting to call #{action} action\"\n if self.respond_to?(action, true) #second param includes private methods\n env['params']['id'] = params[:id] || (path_info if has_path)\n self.send(action)\n else\n error_on MethodNotAllowedError, \"#{action} not supported for this resource\"\n end\n end", "def route_user(action)\n case action\n when 1 then @patients_controller.list\n end\n end", "def map prefix, controller\n Route.register_controller prefix, controller\n end", "def route_for(request) #:nodoc:\n index, params = match(request)\n route = routes[index] if index\n if !route\n raise ControllerExceptions::NotFound, \n \"No routes match the request: #{request.uri}\"\n end\n [route, params]\n end", "def run(req, res)\n route = match(req)\n if route\n route.run(req, res)\n else\n res.status = 404\n controller = Controller::Base.new(req, res)\n controller.render_content(\"404: Unable to find page '#{req.path}' \", 'text/html')\n end\n end", "def process(context)\n request = context.request\n\n router = @processor_map[request.request_method.downcase.to_sym]\n return 404 unless router\n begin\n processor, params = router.routing(request.path)\n rescue FancyServer::PathRouter::NoRouteMatched\n return 404\n rescue FancyServer::PathRouter::DestinationDuplicated => ex\n return {:status => 503, :body => ex.message}\n end\n return 404 unless processor\n context.params.merge!(params)\n processor.respond_to?(:to_proc) ? context.instance_eval(&processor) : processor\n end", "def route\n #TODO\n end", "def do_dispatch(env)\n path = env['PATH_INFO']\n\n # Try to serve a public file\n ret = dispatch_public(env, path)\n return ret if not ret.nil?\n\n log.debug \"Checking for routes that match: #{path}\"\n route = router.match(env)\n\n if route.has_key? :ok\n dispatch_controller(route, env)\n else\n [404, {\"Content-Type\" => \"text/plain\"}, [\"404 Not Found: #{path}\"]]\n end\n end", "def route(path, controller)\n plezi_initialize\n Plezi::Base::Router.route path, controller\n end", "def service(request, response)\n params = @router.resolve_uri(request.request_uri)\n controller = Acoustic::Controller.from_symbol(params[:controller])\n action = params[:action]\n controller.process(action, params, request, response)\n rescue Acoustic::UnresolvableUri, Acoustic::ControllerNameError\n raise Acoustic::NotFound.new(request.request_uri)\n end", "def route_for routename\n case routename\n when 'Start'\n \"index\"\n when 'Login'\n \"login\"\n when 'Mitarbeiterübersicht'\n \"employees\"\n when 'Neuer Mitarbeiter'\n \"employees.new\"\n when 'FAQ'\n \"faq\"\n else\n raise \"No route defined for route named '#{routename}'.\"\n end\nend", "def run(req, res)\n first_matched_route = match(req)\n\n if first_matched_route\n first_matched_route.run(req, res)\n else\n res.status = 404\n res.write(\"No route matches for #{req.request_method} for #{req.path}\")\n end\n end", "def dispatch_action(request)\n method = request_method(request)\n path = request.path.sub(/\\.\\w+$/, '')\n route = @routing.detect { |r| r[0] == method && r[1] == path }\n route[2] if route\n end", "def handle(request, env)\n params = @params.dup\n path_info, script_name = env[\"PATH_INFO\"], env[\"SCRIPT_NAME\"]\n \n return unless request_conditions.all? do |method_name, condition|\n # TODO: Refactor this... it lacks awesome\n next true unless request.respond_to?(method_name)\n matched, captures = condition.match(request)\n if matched\n params.merge!(captures)\n if method_name == :path_info\n new_path_info = @path_info.dup if @path_info\n new_path_info ||= env[\"PATH_INFO\"].sub(/^#{Regexp.escape(matched)}/, '')\n new_path_info.gsub!(SEGMENT_REGEXP) { |s| params[$2.to_sym] }\n env[\"SCRIPT_NAME\"] = Utils.normalize(request.env[\"SCRIPT_NAME\"] + matched)\n env[\"PATH_INFO\"] = Utils.normalize(new_path_info)\n end\n true\n end\n end\n \n env[\"rack_router.route\"] = self\n env[\"rack_router.params\"].merge! params\n \n @app.call(env)\n ensure\n env[\"PATH_INFO\"], env[\"SCRIPT_NAME\"] = path_info, script_name\n end", "def run(req, res)\n if req.body\n check_method_param(req)\n end\n route = match(req)\n if route.nil?\n res.status = 404\n res.body = \"Cannot find route for #{req.request_method} #{req.path}\"\n else\n route.run(req, res)\n end\n end", "def run(req, res)\n parse_http_methods!(req)\n matching_route = match(req)\n if matching_route\n matching_route.run(req, res)\n else\n res.status = 404\n res.write \"404 route not found\"\n end\n end", "def run(req, res)\n matched_route = match(req)\n if matched_route\n matched_route.run(req, res)\n else\n res.status = 404\n res.write(\"No route matches #{req.fullpath}\")\n end\n end", "def map route_object\n klass = nil\n route = nil\n action = nil\n\n # map 'root' do\n # ...\n if block_given?\n @lux_action_target = route_object\n yield\n @lux_action_target = nil\n return\n elsif @lux_action_target\n klass = @lux_action_target\n route = route_object\n action = route_object\n\n # map :foo => :some_action\n if route_object.is_a?(Hash)\n route = route_object.keys.first\n action = route_object.values.first\n end\n\n if test?(route)\n call klass, action\n else\n return\n end\n end\n\n case route_object\n when String\n # map 'root#call'\n call route_object\n when Hash\n route = route_object.keys.first\n klass = route_object.values.first\n\n if route.class == Array\n # map [:foo, :bar] => 'root'\n for route_action in route\n if test?(route_action)\n call klass, route_action\n end\n end\n\n return\n elsif route.is_a?(String) && route[0,1] == '/'\n # map '/skils/:skill' => 'main/skills#show'\n return match route, klass\n end\n when Array\n # map [:foo, 'main/root']\n route, klass = *route_object\n else\n Lux.error 'Unsupported route type \"%s\"' % route_object.class\n end\n\n test?(route) ? call(klass) : nil\n end", "def primary(request, element)\n # TODO: see if it's faster to compare either\n # by `:java_class`, `:instance_of?` or `:code`\n case\n when request.instance_of?(Cf::GETRequest)\n @route.call(:get, request, element)\n when request.instance_of?(Cf::PUTRequest)\n @route.call(:put, request, element)\n when request.instance_of?(Cf::POSTRequest)\n @route.call(:post, request, element)\n when request.instance_of?(Cf::DELETERequest)\n @route.call(:delete, request, element)\n else\n request.respond(CR[:bad_request])\n end\n end", "def path(name, data = nil)\n RouteLookup.new.path(name, data)\n end", "def call_by_request(request)\n rotation do |offset|\n pattern = decode_pattern(request.path_info)\n if route = match?(offset, pattern)\n params = route.params_for(pattern, request.params)\n yield(route, params) if route.verb == request.request_method\n route\n end\n end\n end", "def route_index; end", "def route(message, data=nil)\n\n # Initialized \"data\" if it is not valid\n data = {} unless data.is_a? Hash\n\n # Flag to return if the message was routed\n routed = false\n\n message = message.split\n\n command = message[0]\n data[:argv] = message[1..-1] unless data[:argv]\n\n\n handlers = @handlers[String(command).to_sym]\n\n if handlers\n handlers.each do |handler|\n routed = true\n handler.call(command, data)\n end\n end\n\n # Returns whether the message was routed or not\n routed\n end", "def recognized_request_for(path, request_method = nil)\n path = \"/#{path}\" unless path.first == '/'\n\n # Assume given controller\n request = ActionController::TestRequest.new({}, {}, nil)\n request.env[\"REQUEST_METHOD\"] = request_method.to_s.upcase if request_method\n request.path = path\n\n ActionController::Routing::Routes.recognize(request)\n request\n end", "def run(req, res)\n route_to_run = self.match(req)\n if route_to_run.nil?\n res.status = 404\n else\n route_to_run.run(req, res)\n end\n end", "def dispatch(name, req, res); end", "def post_req\n redirect_to :controller => :listings, :action => :index\n end", "def Controller(matcher)\n make(matcher)\n end", "def run(req, res)\n good_route = match(req)\n if good_route.nil?\n res.status = 404\n else\n good_route.run(req, res)\n end\n end", "def controller(controller)\n self.class.new(routes: @routes.select { |rt| rt.url_details[:controller] == controller.to_s })\n end", "def get_from_param\n instance_variable_set(\"@#{self.controller_name.singularize}\", self.controller_name.classify.constantize.from_param(params[:id]))\n end", "def parse_route(path, options, verb)\n path = path.dup if path.kind_of?(String)\n route_options = {}\n\n if options[:params] == true\n options.delete(:params)\n elsif options.include?(:params)\n options[:params] ||= []\n options[:params] |= Array(options[:with]) if options[:with]\n end\n\n # We need check if path is a symbol, if that it's a named route.\n map = options.delete(:map)\n\n # path i.e :index or :show\n if path.kind_of?(Symbol)\n name = path\n path = map ? map.dup : (path == :index ? '/' : path.to_s)\n end\n\n # Build our controller\n controller = Array(@_controller).map(&:to_s)\n\n case path\n when String # path i.e \"/index\" or \"/show\"\n # Now we need to parse our 'with' params\n if with_params = options.delete(:with)\n path = process_path_for_with_params(path, with_params)\n end\n\n # Now we need to parse our provides\n options.delete(:provides) if options[:provides].nil?\n \n options.delete(:accepts) if options[:accepts].nil?\n\n if @_use_format || options[:provides]\n process_path_for_provides(path)\n # options[:add_match_with] ||= {}\n # options[:add_match_with][:format] = /[^\\.]+/\n end\n\n absolute_map = map && map[0] == ?/\n\n unless controller.empty?\n # Now we need to add our controller path only if not mapped directly\n if !map && !absolute_map\n controller_path = controller.join(\"/\")\n path.gsub!(%r{^\\(/\\)|/\\?}, \"\")\n path = File.join(controller_path, path) unless @_map\n end\n end\n\n # Now we need to parse our 'parent' params and parent scope.\n if !absolute_map and parent_params = options.delete(:parent) || @_parent\n parent_params = (Array(@_parent) + Array(parent_params)).uniq\n path = process_path_for_parent_params(path, parent_params)\n end\n\n # Add any controller level map to the front of the path.\n path = \"#{@_map}/#{path}\".squeeze('/') unless absolute_map || !@_map\n\n # Small reformats\n path.gsub!(%r{/\\?$}, '(/)') # Remove index path\n path.gsub!(%r{//$}, '/') # Remove index path\n path[0,0] = \"/\" if path !~ %r{^\\(?/} # Paths must start with a /\n path.sub!(%r{/(\\))?$}, '\\\\1') if path != \"/\" # Remove latest trailing delimiter\n path.gsub!(/\\/(\\(\\.|$)/, '\\\\1') # Remove trailing slashes\n path.squeeze!('/')\n when Regexp\n route_options[:path_for_generation] = options.delete(:generate_with) if options.key?(:generate_with)\n end\n\n name = options.delete(:route_name) if name.nil? && options.key?(:route_name)\n name = options.delete(:name) if name.nil? && options.key?(:name)\n if name\n controller_name = controller.join(\"_\")\n name = \"#{controller_name} #{name}\".to_sym unless controller_name.empty?\n end\n\n options[:default_values] = @_defaults unless options.has_key?(:default_values)\n\n [path, name, parent_params, options, route_options]\n end", "def dispatch_to(controller_klass, action, params = {}, env = {}, &blk)\n params = merge_controller_and_action(controller_klass, action, params)\n dispatch_request(build_request(params, env), controller_klass, action.to_s, &blk)\n end", "def any(path, &block)\n route 'GET', path, &block\n route 'POST', path, &block\n end", "def match(request)\n path = String.normalize_path(request.path)\n method = request.method\n\n match, data = nil\n @sets.each { |set|\n match, data = set[1].match(path, method)\n break if match\n }\n\n fns = []\n if match\n fns = match[3]\n\n # handle route params\n #TODO where to do this?\n request.params.merge!(Hash.strhash(self.data_from_path(path, data, match[1])))\n\n #TODO where to do this?\n request.route_path = match[4]\n end\n\n fns\n end", "def show\n # going to get a single post by ID\n @post = Post.find(params[:id]) #dynamic route matcher\n end", "def switch_to_controller\n unless ( name = (path_matcher.view_name || path_matcher.model_name) )\n return\n end\n\n action = nil\n \tif path_matcher.is_view?\n \t action = File.basename(file_path).split(\".\").first\n else\n \t name = name.pluralize\n end\n\n controller = \"/app/controllers/#{name}_controller.rb\"\n\n if action\n goto_definition controller, \"def #{action}\"\n else\n open_file controller\n end\n end", "def run(req, res)\n matched_route = match(req)\n \n if matched_route.nil?\n res.status = 404\n else\n matched_route.run(req, res)\n end\n end", "def controller(controller); end", "def routeable(method, opts={})\n ctrlr_m = method.to_sym\n opts[:via] = Array.wrap(opts[:via] || :get).map{|hm|hm.to_sym}\n\n AutoRouter::Router.map_route(self, ctrlr_m, opts)\n end", "def method_missing *args\n @controller_instance.send *args\n end", "def method_missing(method, *params, &block)\n route_macro = self.class.macros[method]\n if route_macro.nil?\n super\n else\n pattern = params.shift || route_macro[:pattern]\n options = route_macro[:options].merge(params.shift || {})\n if !params.empty?\n raise ArgumentError,\n \"wrong number of arguments (#{params.size + 2} for 2)\"\n end\n route(pattern, options)\n end\n end", "def controller(path)\n controller_name.constantize.new(controller_name, action_name,\n get_params(path))\n end", "def call(env)\n route = self.route(env)\n if route\n env['params'] = route.match(env) || {}\n route.call(env)\n else\n env['params'] = {}\n not_found.call(env)\n end\n end", "def run(request, response)\n matching_route = match(request)\n\n if matching_route.nil?\n response.status = 404\n\n response.write(\"Sorry! The requested URL #{request.path} was not not found!\")\n else\n matching_route.run(request, response)\n end\n end", "def spiced_controller(route, path) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize, Metrics/LineLength\n Class.new(route.controller).tap do |klass| # rubocop:disable Metrics/BlockLength, Metrics/LineLength\n klass.include(Helpers::AppHelper.new(app))\n klass.include(Helpers::AssetsHelper)\n klass.include(Helpers::RenderHelper)\n klass.include(Helpers::TagHelper)\n\n # include global ApplicationHelper if possible\n begin\n klass.include(ApplicationHelper)\n rescue NameError # rubocop:disable Lint/HandleExceptions\n # we don't have a global ApplicationHelper... which is fine\n end\n\n # find a controller-specific helper class and include it if we can\n begin\n helper = Kernel.const_get(\"#{route.base_name}_helper\".camelize)\n klass.include(helper)\n rescue NameError # rubocop:disable Lint/HandleExceptions\n # same difference\n end\n\n klass.define_method(:params) do\n route.params\n end\n\n klass.define_method(:current_path) do\n path\n end\n\n klass.define_method(:current_controller_name) do\n route.base_name\n end\n\n klass.define_method(:inspect) do |*args|\n # report that we are actually the controller, not some random\n # anonymous class\n # append a + to it to indicate that it's different than an ordinary\n # class instance\n super(*args).sub(/#<Class:[^>]+>/, \"#{route.controller}+\")\n end\n\n klass.define_singleton_method(:inspect) do\n # for .ancestors to show up correctly\n \"#{route.controller}+\"\n end\n\n klass.define_method(:to_s) do |*args|\n # irb uses this method for displaying in the prompt\n super(*args).sub(/#<Class:[^>]+>/, \"#{route.controller}+\")\n end\n\n # inject filters\n route.controller.public_instance_methods(false).each do |method|\n klass.define_method(method) do |*args|\n # @__before_actions is set on the original class -- use it from\n # that one\n route.controller.instance_variable_get(:@__before_actions)&.each do |action| # rubocop:disable Metrics/LineLength\n send(action)\n end\n super(*args)\n end\n end\n end\n end", "def switch_to_controller\n return unless ( name = path_matcher.functional_name )\n \n controller = \"/app/controllers/#{name}.rb\"\n \n if (test = find_test_under_cursor) \n # remove words from the test name that indicate the test\n # then use the first word as the name of the function/action\n #\n test.sub!(/^should /i, '')\n if test =~ /^(get|post|put|delete) /i\n test.sub!(/^[^\\s]+ /, '')\n end\n \n function = test.split(/\\s/).first\n unless function.nil?\n return goto_definition(controller, function)\n end\n end\n \n open_file controller\n end", "def route_for(options)\n ensure_that_routes_are_loaded\n ActionController::Routing::Routes.generate(options)\n end", "def process(request_hash)\n request = Request.new(request_hash)\n case request.path\n when '/'\n index_route(request)\n when %r{^/sleep/\\d+$}\n sleep_route(request)\n else\n Response.new(\n \"No route found for #{request.path}. Try '/' or '/sleep/3'.\",\n status: 404\n )\n end\n end", "def process( data_exchange )\n validate_instance_variables( binding(), :routes )\n _info(\"Routing exchange from #{origin(data_exchange)}.\")\n unless routes.redirect? data_exchange\n _info(\"Routing failed for exchange #{origin(data_exchange)}.\")\n set_fault( data_exchange )\n end\n end", "def route_to(path, args = {}, protocol = \"http://\")\n request = Request.new({:protocol => protocol, :path => path}.merge(args))\n # Merb::Router.match(request)\n Merb::Router.route_for(request)\n end", "def recognize_request(path, verb=nil)\n path = \"/#{path}\" unless path.first == '/'\n # Assume given controller\n request = ActionController::TestRequest.new({})\n request.env[\"REQUEST_METHOD\"] = verb.to_s.upcase if verb\n request.path = path\n ActionController::Routing::Routes.recognize(request)\n request\n end", "def show\n respond_with DisRoutedGeneric.find(params[:id])\n end", "def controller_for(resource)\n return resource if resource.is_a?(Class) && resource.ancestors.include?(ActionController::Base)\n \"#{resource.to_s.underscore}_controller\".classify.constantize\n rescue NameError\n raise ResourceFull::ResourceNotFound, \"not found: #{resource}\"\n end", "def url(name, *args)\n unless Symbol === name\n args.unshift(name)\n name = :default\n end\n \n unless route = Halcyon::Application::Router.named_routes[name]\n raise ArgumentError.new(\"Named route #{name.inspect} not found\")\n end\n \n route.generate(args, {:controller => controller_name, :action => method})\n end", "def legacy\n case params[:path][0]\n when 'list'\n if (params[:path][1] == 'novita.php')\n redirect_to :controller => 'books', :action => 'recent'\n elsif (params[:path][1] == 'sconti.php')\n redirect_to :controller => 'books', :action => 'offers'\n else\n redirect_to :controller => 'books', :action => 'list', :id => params[:path][1].sub('.php','').sub('_',' ')\n end\n when 'search.php'\n redirect_to :controller => 'books', :action => 'search'\n when 'links.php'\n redirect_to :controller => 'books', :action => 'links'\n else\n redirect_to '/' \n end\n end", "def process_action(site, action_path, env, format)\n namespace, *parts = action_path.split(S::Constants::SLASH)\n path = \"/\" << parts.join(S::Constants::SLASH)\n env[S::Constants::PATH_INFO] = path\n run_controller(site, namespace, env, format)\n end", "def recognized_route\n unless @recognized_route\n path = params[:resource_path] || params[:erp] || request.path\n environment = ::ActionController::Routing::Routes.extract_request_environment(request)\n environment.merge!(:method => params[:resource_method]) if params[:resource_method]\n @recognized_route ||= ::ActionController::Routing::Routes.routes_for_controller_and_action(controller_path, action_name).find do |route|\n route.recognize(path, environment)\n end or ResourcesController.raise_no_recognized_route(self)\n end\n @recognized_route\n end", "def route_request_with(event_data, hold_request, timestamp)\n owner = \"\"\n\n if event_data == nil || event_data.count == 0 || event_data[\"owningInstitutionId\"] == nil\n $logger.error \"Request data missing key information. Cannot proceed. Malformed request. #{event_data}\"\n else\n owner = event_data[\"owningInstitutionId\"].downcase\n end\n\n if owner.scan('nypl').empty?\n $logger.info \"Processing partner hold\"\n\n response = SierraRequest.process_partner_item(event_data)\n\n RequestResult.process_response(response, 'AcceptItemRequest', event_data, hold_request, timestamp)\n\n elsif owner != \"\"\n $logger.info \"Processing NYPL hold\"\n\n response = SierraRequest.process_nypl_item(event_data)\n\n RequestResult.process_response(response, 'SierraRequest', event_data, hold_request, timestamp)\n end\n end", "def controller_path; end", "def controller_path; end", "def route9\n redirect_to params[:key]\n end", "def hit\n action = params[:req]\n name = params[:name] || params[:id]\n render api_not_supported action, name\n end", "def record\n @record ||= if request.path_parameters[:id]\n controller_name.classify.constantize.find_by(id: request.path_parameters[:id])\n end\n end", "def router\n render :action => params[:template]\n end", "def assert_routing(path, options, defaults={}, extras={}, message=nil)\n assert_recognizes(options, path, extras, message)\n \n controller, default_controller = options[:controller], defaults[:controller] \n if controller && controller.include?(?/) && default_controller && default_controller.include?(?/)\n options[:controller] = \"/#{controller}\"\n end\n \n assert_generates(path, options, defaults, extras, message)\n end", "def handle_request request, usecase=Usecase, &block\n usecase = build_usecase( request, usecase, &block )\n usecase.response\n end", "def call(params)\n @controller = 'query'\n end", "def match(req)\n end", "def get_destination(destination, routing_params = {})\n if destination.respond_to?(:call)\n return destination\n end\n\n #if destination is something like books#welcome\n if destination =~ /^([^#]+)#([^#]+)$/\n #name will be Books\n name = $1.capitalize\n #controller will be the Constant BooksController\n controller = Object.const_get(\"#{name}Controller\")\n #ah, now here we use the class.action from above. passing in\n #welcome as the action, and routing params as the response object\n return controller.action($2, routing_params)\n end\n #otherwise we messed up by coming here\n raise \"Destination no found: #{destination}\"\n end", "def setup_routes\n if prefix\n pre = prefix.to_s[1..-1] + '/'\n end\n model_regexp = Regexp.union(models.keys.map{|m| Regexp.escape(m)})\n controller = @controller.name.sub(/Controller\\z/, '').underscore\n ::Rails.application.routes.prepend do\n match \"#{pre}:autoforme_model/:autoforme_action(/:id)\" , :controller=>controller, :action=>'autoforme', :via=>[:get, :post],\n :constraints=>{:autoforme_model=>model_regexp, :autoforme_action=>ALL_SUPPORTED_ACTIONS_REGEXP}\n end\n ::Rails.application.reload_routes!\n end", "def controller\n @params['controller'] || @params[:controller]\n end" ]
[ "0.68689656", "0.6567625", "0.6463206", "0.6456079", "0.6443208", "0.63865155", "0.63791794", "0.6195597", "0.61416394", "0.6119806", "0.6048663", "0.6024157", "0.60168743", "0.5961125", "0.59358037", "0.5894857", "0.58873594", "0.5866275", "0.5865712", "0.5865712", "0.5854686", "0.57975566", "0.57568675", "0.5749961", "0.5719823", "0.57151777", "0.56987995", "0.5696639", "0.56934994", "0.56290734", "0.5502127", "0.54597205", "0.5443476", "0.54295725", "0.5426572", "0.5423342", "0.5415902", "0.5394167", "0.53352064", "0.5335135", "0.53267676", "0.5294036", "0.5283069", "0.5266243", "0.5265114", "0.52549356", "0.52544135", "0.52506745", "0.5231451", "0.52236354", "0.5210941", "0.5197574", "0.5191849", "0.51710916", "0.5163477", "0.51556146", "0.5149723", "0.5131911", "0.51135176", "0.51112425", "0.5075404", "0.50692457", "0.5058075", "0.504997", "0.5049176", "0.5038905", "0.50358033", "0.50276786", "0.50184375", "0.501602", "0.5002611", "0.49793264", "0.49781108", "0.49778685", "0.49772575", "0.49735305", "0.49612334", "0.4960306", "0.49524757", "0.49508756", "0.49422178", "0.49383956", "0.4910106", "0.49063364", "0.49017105", "0.4899009", "0.48940516", "0.48899728", "0.48899728", "0.48859107", "0.4850921", "0.48394728", "0.48320746", "0.482864", "0.48286054", "0.4817137", "0.48151407", "0.48017177", "0.47975326", "0.4790018" ]
0.48136893
97
transform to the format daff understands
def to_daff_data(hs) return [] if hs.nil? || hs.empty? # first row contains the keys [hs[0].keys] + hs.map(&:values) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transform; end", "def transform\n end", "def transformation\n end", "def transforms; end", "def transformations; end", "def transform_values!; end", "def normalizer; end", "def to_dfa\n fa.determinize\n end", "def transform(transformation)\n end", "def transformed_entries entries\n\t\tentries\n\tend", "def apply_custom_transformation\n end", "def normalize; end", "def transform(x)\n x = check_convert_sample_array(x)\n z = x.dup\n\n z[z.ne(0)] = Numo::NMath.log(z[z.ne(0)]) + 1 if @params[:sublinear_tf]\n z *= @idf if @params[:use_idf]\n case @params[:norm]\n when 'l2'\n z = Rumale::Preprocessing::L2Normalizer.new.fit_transform(z)\n when 'l1'\n z = Rumale::Preprocessing::L1Normalizer.new.fit_transform(z)\n end\n z\n end", "def to_fdf; end", "def transformation_into_dsnf\n negated_sentence_in_apnf = self.negated.transformation_into_apnf\n initial = [Sentence.new(generate_new_symbol)]\n first_element = Sentence.generate_implication_between(Sentence.new(initial.first), Sentence.new(negated_sentence_in_apnf))\n universe = [first_element]\n\n #RULES 1 AND 2 OF THE PAPER\n first_step_dsnf(universe)\n #RULE 6 OF THE PAPER\n second_step_dsnf(universe)\n\n universe.each do |clause|\n clause.simplification\n end\n\n return {:I => initial, :U => universe}\n end", "def convert\n end", "def convert\n end", "def transform(tree); end", "def convert!; end", "def encode_data(fdf); end", "def transform(transform)\n end", "def transform()\n @stages.each do |stage|\n# Pry::ColorPrinter.pp stage\n @ead = stage.transform(@ead)\n#Rails.logger.debug(\"#{@ead.to_s.pretty_inspect}\")\n end\n @ead.to_s\n end", "def transform(t)\n ovwrite_me t.vectormult(self)\n end", "def transform\n self.output = converter.convert(self.content)\n end", "def normalize!; end", "def transform\n # Pass through\n @target.transform\n end", "def unnormalized; end", "def converted_arrays; end", "def transform!(transform)\n end", "def transform!(transform)\n end", "def normalize\n end", "def convert(content); end", "def convert(content); end", "def converter; end", "def normalize!\n end", "def transform(file, format:); end", "def normalized; end", "def transform(x)\n x = ::Rumale::Validation.check_convert_sample_array(x)\n\n # initialize transformed features\n n_samples, n_features = x.shape\n z = Numo::DFloat.zeros(n_samples, n_output_features)\n # bias\n z[true, 0] = 1\n curr_col = 1\n # itself\n z[true, 1..n_features] = x\n curr_col += n_features\n # high degree features\n curr_feat_ids = Array.new(n_features + 1) { |n| n + 1 }\n (1...@params[:degree]).each do\n next_feat_ids = []\n n_features.times do |d|\n f_range = curr_feat_ids[d]...curr_feat_ids.last\n next_col = curr_col + f_range.size\n z[true, curr_col...next_col] = z[true, f_range] * x[true, d..d]\n next_feat_ids.push(curr_col)\n curr_col = next_col\n end\n next_feat_ids.push(curr_col)\n curr_feat_ids = next_feat_ids\n end\n z\n end", "def transform\r\n trans(:class => SimpleXMIMetaModel::UML::Clazz)\r\n end", "def __convert(h); end", "def transform\n raise 'Implement this method in subclass'\n end", "def run_and_transform; end", "def transform_entities(transform, entities)\n end", "def transform\n {\n 'name' => names,\n 'org' => org,\n 'other' => other_data,\n 'associates' => associates,\n 'xref' => xref,\n\n # these are lists with zero or more members; duplicates allowed; member order is arbitrary (so we pick\n # a standardized order for list comparison purposes)\n 'phones' => phones,\n 'addresses' => addresses,\n 'emails' => emails,\n 'links' => links\n }.reject {|k,v| v.nil? || v.empty?}\n end", "def transform(x)\n x = ::Rumale::Validation.check_convert_sample_array(x)\n\n x.dot(@components.transpose)\n end", "def to_dfa\n # FILL IN\n\tinput = self\n output = NFA.new\n\toutput.set_start([input.start])\n\trStates = [output.start]\n\tmarked = []\n\t# get Sigma\n\tsigma = []\n\tinput.delta.values.each{|hash|\n\t\thash.keys.each{|sym|\n\t\tsigma << sym\n\t\t}\n\t}\n\tsigma =sigma.uniq\n\tr = rStates[0]\n\ti = 0\n\t\n\twhile marked.include?(r) == false\n\t\tmarked.push(r) #mark r\n\t\tsigma.each{|a|\n\t\t\tmove = []\n\t\t\tif r != nil then\n\t\t\t\tr.each{|q|\n\t\t\t\t\tif input.delta[q] != nil then\n\t\t\t\t\t\t\n\t\t\t\t\t\tif input.delta[q][a] != nil then\n\t\t\t\t\t\t\tinput.delta[q][a].each{|sta|\n\t\t\t\t\t\t\t\tmove << sta\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t}\n\t\t\t\t\tif rStates.include?(move) == false then\n\t\t\t\t\trStates << move\n\t\t\t\tend\n\t\t\t\toutput.add_trans(r, a, move)\n\t\t\tend\n\t\t}\n\t\ti+=1\n\t\tx = 0\n\t\tif r != nil then\n\t\tr.each{|s|\n\t\t\tif input.final.include?(s) then\n\t\t\t\tx = 1\n\t\t\tend\n\t\t}\n\t\tif x == 1 then\n\t\t\toutput.make_final(r)\n\t\tend\n\t\tend\n\t\tr = rStates[i]\n\tend\n\treturn output\n end", "def to_d; end", "def transform_files\n extract\n reorder_files\n transform @attendance_file, 'att' unless @attendance_file.blank?\n transform @enroll_file, 'enroll' unless @enroll_file.blank?\n transform @ili_file, 'ili' unless @ili_file.blank?\n end", "def preformatting\n\n end", "def decode\n transform :decode\n end", "def convert!\n # Fonts and headings\n semanticize_font_styles!\n semanticize_headings!\n\n # Tables\n remove_paragraphs_from_tables!\n semanticize_table_headers!\n\n # list items\n remove_paragraphs_from_list_items!\n remove_unicode_bullets_from_list_items!\n remove_whitespace_from_list_items!\n remove_numbering_from_list_items!\n end", "def transform(value)\n value\n end", "def preprocess(input); end", "def formation; end", "def transform(value, instance); end", "def normalize!\n end", "def to_d()\n #This is a stub, used for indexing\n end", "def transform(x)\n x = ::Rumale::Validation.check_convert_sample_array(x)\n\n fit_transform(x)\n end", "def transform(x)\n x = ::Rumale::Validation.check_convert_sample_array(x)\n\n fit_transform(x)\n end", "def to_gff\n ref = Reference.find(self.reference_id)\n attributes = []\n JSON.parse(self.group).each { |x| attributes << x.join('=') }\n name = ref.name\n self.source = '.' if self.source == ''\n self.feature = '.' if self.feature == ''\n self.start = '.' if self.start == ''\n self.stop = '.' if self.end == ''\n self.score = '.' if self.score == ''\n self.strand = '.' if self.strand == ''\n self.phase = '.' if self.phase == ''\n\n \"#{name}\\t#{self.source}\\t#{self.feature}\\t#{self.start}\\t#{self.end}\\t#{self.score}\\t#{self.strand}\\t#{self.phase}\\t#{attributes.join(';')}\"\n end", "def to_densa\n\t @M = Matriz_Densa.new(@alt+1,@anc+1, 0)\n\t for i in (0..@alt)\n\t\t for j in (0..@anc)\n\t\t @M[i][j] = 0\n\t\t end\n\t end\n\t for i in (0..@n_elem-1)\n\t @M[@alto[i]][@ancho[i]]=@elem[i]\n\t end\n\t @M\n\tend", "def doc_transformed(root)\n\n end", "def to_f() end", "def to_f() end", "def to_f() end", "def to_f() end", "def ufds2dfa(ufds)\n Automaton.new(false) do |fa|\n mergeable_datas = ufds.mergeable_datas\n mergeable_datas.each do |data|\n state_data = data.reject {|key,value| [:master, :count, :delta].include?(key)}\n state_data[:name] = data[:master].to_s\n state_data[:error] = false\n fa.add_state(state_data)\n end\n mergeable_datas.each do |data|\n source = fa.get_state(data[:master].to_s)\n data[:delta].each_pair do |symbol, target|\n target = fa.get_state(ufds.find(target).to_s)\n fa.connect(source, target, symbol)\n end\n end\n end\n end", "def convert(value) value end", "def apply_transforms(data)\n data.map do |line|\n line.merge(@transforms.keys.map do |key|\n next if line[key].nil?\n func_list = @transforms[key]\n value = func_list.reduce(line[key]) do |accum, func|\n func.call(accum)\n end\n { key => value}\n end.compact.reduce({}, :merge))\n end\n end", "def convert(object); end", "def denormalize(hash)\n each_value(hash) do |value|\n value.to_s.unpack('U*').pack('C*')\n end\n end", "def denormalize(hash)\n each_value(hash) do |value|\n value.to_s.unpack('U*').pack('C*')\n end\n end", "def tidy(data); end", "def converters; end", "def converters; end", "def converters; end", "def normalize; self.dup.normalize!; end", "def transform!\n raise NotImplementedError, \"You have to implement #transform! in your transformer\"\n end", "def to_cdfa\n fa.to_cdfa\n end", "def convert\n @input\n end", "def data_for_serialize\n da=DAData.new @root\n [@words.build,da.base,da.check]\n end", "def convert(data)\n\t\trecords = []\n\t\tif @data_source == \"uniteu\"\n\t\t\tbegin\n\t\t\t\tdata.each do |row|\n\t\t\t\t\trecord = {}\n\t\t\t\t\[email protected] do |i|\n\t\t\t\t\t\ti.each do |k,v|\n\t\t\t\t\t\t\tfield = k.to_s\n\t\t\t\t\t\t\tv = v.split(\":\")\n\t\t\t\t\t\t\ttype = v[0]\n\t\t\t\t\t\t\tcol = v[1]\n\t\t\t\t\t\t\tif !record.has_key?(type.to_sym)\n\t\t\t\t\t\t\t\trecord[type.to_sym] = {}\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\trecord[type.to_sym][col] = row[k]\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\t# Make Records\n\t\t\t\t\trecord.each do |k,v|\n\t\t\t\t\t\trecords << Record.new(k.to_s,v)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\trescue Exception => e\n\t\t\t\t\tputs e\n\t\t\tend\n\t\telsif @data_source == \"rpro\"\n\t\t\tbegin\n\t\t\t\trecord = {}\n\t\t\t\tmappy(data).each do |type, fields|\n\t\t\t\t\tfields.each do |item|\n\t\t\t\t\t\tcol = item.keys[0][/[A-Za-z0-9_]+/].to_sym\n\t\t\t\t\t\tcolvalue = item.values[0]\n\t\t\t\t\t\tthisitem = []\n\t\t\t\t\t\tflags = item.keys[0][/[!+\\-#]/]\n\t\t\t\t\t\tif flags != nil\n\t\t\t\t\t\t\tflags = flags.split(//)\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tflags = []\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\t# Special Instructions\n\t\t\t\t\t\t# We need to process this stuff for the flags present\n\t\t\t\t\t\t# and then make it into records\n\t\t\t\t\t\tif !record.has_key?(type)\n\t\t\t\t\t\t\trecord[type] = {}\n\t\t\t\t\t\tend\n\t\t\t\t\t\tif flags.empty?\n\t\t\t\t\t\t\trecord[type][col] = colvalue\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tif flags.include? \"!\"\n\t\t\t\t\t\t\t\traise \"write filter for !\"\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tif flags.include? \"#\"\n\t\t\t\t\t\t\t\tif record[type].has_key?(col)\n\t\t\t\t\t\t\t\t\trecords << Record.new(type,record[type])\n\t\t\t\t\t\t\t\t\trecord[type] = {}\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\trecord[type][col] = colvalue\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tif flags.include? \"+\"\n\t\t\t\t\t\t\t\tif record[type].has_key?(col)\n\t\t\t\t\t\t\t\t\tcolvalue = record[type][col]+colvalue\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\trecord[type][col] = colvalue\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tif flags.include? \"-\"\n\t\t\t\t\t\t\t\traise \"I didn't think we'd actually have one of these \\\"-\\\"\"\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\trescue Exception => e\n\t\t\t\traise e\n\t\t\tend\n\t\tend\n\t\trecords\n\tend", "def denormalize(to_units = nil)\n x_alize(false, to_units)\n end", "def preprocess_2(data) \n data[1] = {A: 1, B: 0, C: 0 }\n data[2] = {A: 0, B: 1, C: 0 }\n data\nend", "def to_deca\n big_self / DECA\n end", "def transformation_device(*eras); end", "def encode\n transform :encode \n end", "def convert\n # Setup taxa information and orientation\n taxa_count = @csv.first.count\n character_count = @csv.count - 1\n taxa_labels = @csv.first.map { |name| name.to_s.strip.scrub.gsub(/[^A-Za-z0-9]/, \"_\") }\n\n # Generate labels and matrix\n character_labels = []\n character_matrix = taxa_labels.map { |t| [t] }\n (1..character_count).each do |r|\n row = @csv[r]\n token_hash = tokenize(row)\n character_label = (token_hash.map do |k, _|\n \"'#{sanitize_char(k)}'\"\n end).join(\" \")\n character_labels << %(#{r} /#{character_label})\n row.each_with_index do |charstate, i|\n token = token_hash[sanitize_char(charstate)]\n character_matrix[i] << (token.nil? ? \"-\" : token[0])\n end\n end\n character_matrix.map! do |arr|\n \"#{arr.shift} #{arr.join('')}\"\n end\n\n # Return NEXUS output\n <<~NEXUS_EOF\n #NEXUS\n\n BEGIN TAXA;\n TITLE Manuscripts;\n DIMENSIONS NTAX=#{taxa_count};\n TAXLABELS #{taxa_labels.join(' ')};\n END;\n\n BEGIN CHARACTERS;\n TITLE Variant_Matrix;\n DIMENSIONS NCHAR=#{character_count};\n FORMAT DATATYPE = STANDARD RESPECTCASE GAP = - MISSING = ? SYMBOLS = \"#{ALPHABET.join(' ')}\";\n CHARSTATELABELS #{character_labels.join(', ')};\n MATRIX\n #{character_matrix.join(\"\\n \")}\n ;\n\n END;\n\n BEGIN ASSUMPTIONS;\n OPTIONS DEFTYPE = UNORD;\n END;\n\n BEGIN PAUP;\n #{@paup}END;\n NEXUS_EOF\n end", "def normalize\n Transformation.new(self, self, [lambda{|x|x}])\n end", "def transform(x)\n x = ::Rumale::Validation.check_convert_sample_array(x)\n\n n_samples, n_features = x.shape\n transformed = Numo::DFloat.zeros(n_samples, n_features)\n n_features.times do |n|\n steps = @feature_steps[n]\n @params[:n_bins].times do |bin|\n mask = x[true, n].ge(steps[bin]).where\n transformed[mask, n] = bin\n end\n end\n transformed\n end", "def decompose(domain); end", "def normalize\n Transformation.new(self, base, @to_base)\n end", "def transformer\n convert unless @options.empty?\n end", "def transform(source)\n results = {}\n schema = config.get(:schema)\n exceptions = schema[:exceptions]\n # tranform source data\n source.each_key do |key|\n # sanitise key name\n clone_key = sanitise_string(key, config.get(:snake_case_keys))\n # fetch original key value\n clone_value = source.fetch(key)\n # ignore unsupported schema references\n next if exceptions.include?(clone_key)\n # symbolise array values or pass cloned object through\n item = is_array_of_strings(clone_value) ?\n normalise_array_value(clone_value) :\n clone_value\n # create and assign result\n results[clone_key] = item.is_a?(Hash) ?\n # continue recursion\n transform(item) :\n # store item\n item\n end\n results\n end", "def nfa_to_dfa\n\n partition_edges\n minimize\n\n @start_state.generate_pdf(\"_SKIP_prefilter.pdf\") if @generate_pdf\n\n if @with_filter\n filter = Filter.new(@start_state)\n filter.verbose = @generate_pdf\n filter.apply\n if filter.modified\n # Re-minimize the dfa, since it's been modified by the filter\n minimize\n @start_state.generate_pdf(\"_SKIP_postfilter.pdf\") if @generate_pdf\n end\n end\n\n @start_state\n end", "def adaClassify(datToClass,classifierArr)\n m = shape(datToClass)[0]\n aggClassEst = zeros(m,0)\n len(classifierArr).times do |i|\n classEst = stumpClassify(datToClass,\n classifierArr[i]['dim'], \n classifierArr[i]['thresh'], \n classifierArr[i]['ineq'])#call stump classify\n # aggClassEst += classifierArr[i]['alpha']*classEst\n aggClassEst.plus!(classEst.multi(classifierArr[i]['alpha']))\n end\n return sign(aggClassEst)\n end", "def transform(x)\n x = ::Rumale::Validation.check_convert_sample_array(x)\n\n cx = @params[:whiten] ? (x - @mean) : x\n cx.dot(@components.transpose)\n end", "def normalize(input, doctype = T.unsafe(nil), entity_filter = T.unsafe(nil)); end", "def convert_aces(all_sums)\n\t\tall_sums[1] = Array.new(all_sums[0])\n\t\tall_sums[1][all_sums[1].index(1)] = 11 if all_sums[1].any?{|value| value == 1}\n\tend", "def preprocess(user)\n output_dir = \"#{@lda_output_dir}\"\n input_dir = \"#{@dir}/lda/output_user\"\n Dir.mkdir \"#{output_dir}\" unless File.exists? \"#{output_dir}\"\n\n for i in 0...@num_topics do\n f_c_file = File.open(\"#{input_dir}/f_c_#{i}.dat\", \"r+\")\n f_c = []\n f_c_file.each_line do |line|\n f_c_pair = line.split(\":\")\n # f_c << [f_c_pair[0].to_i, f_c_pair[1].to_f]\n f_c << f_c_pair[0].to_i\n end\n f_c_file.close\n\n g_c_file = File.open(\"#{input_dir}/g_c_#{i}.dat\", \"r+\")\n g_c = []\n\n # g_c_length = f_c.count\n # g_c_length.times do\n # line = g_c_file.first\n # break if !line\n # g_c << line.to_i\n # end\n\n g_c_file.each_line do |line|\n g_c << line.to_i\n end\n\n g_c_file.close\n\n o_file = File.open(\"#{output_dir}/edges_in_#{i}.dat\", 'w')\n # doc_list = f_c.transpose.first\n # doc_list = f_c\n # puts \"f_c: #{f_c.count}, g_c #{g_c.count}\"\n # adsfdsfasdfasd\n f_c.each do |doc|\n # puts \"user.followees_of(doc): #{user.followees_of(doc)}, g_c[i]: #{g_c[i].count}\"\n # puts doc\n followees = user.followees_of(doc) & g_c\n # puts followees\n followees -= user.friends_of(doc) if @mutual_mf == false\n # followees = User.find_by(id: doc).followees.pluck(:id) & @g_c[i]\n followees.each do |followee|\n # puts \"#{doc},#{followee}\"\n # dasfdsaadsfasd\n o_file.puts \"#{doc},#{followee}\"\n end\n end\n o_file.close\n end\n\n # load_lda_user()\n # output_lda()\n end", "def transform\n entries.each { |entry| entry.transform user }\n @state = :transformed\n @account_id = nil\n true\n end" ]
[ "0.71629995", "0.6861315", "0.6766257", "0.66958874", "0.6494446", "0.6473748", "0.6284781", "0.59748363", "0.5925796", "0.5904637", "0.5853795", "0.5830171", "0.5815758", "0.57902956", "0.57843685", "0.57562", "0.57562", "0.5731144", "0.5728842", "0.5699563", "0.5676201", "0.55853736", "0.5551077", "0.5531141", "0.550984", "0.54958546", "0.5490291", "0.5460288", "0.5439012", "0.5439012", "0.54366267", "0.54198235", "0.54198235", "0.54107964", "0.54091203", "0.5363722", "0.5362481", "0.53400856", "0.53141093", "0.5305116", "0.5282021", "0.5280229", "0.5240883", "0.52076524", "0.52009636", "0.5199567", "0.5198287", "0.5156139", "0.5150181", "0.515002", "0.51460004", "0.514491", "0.5138349", "0.51178235", "0.5115249", "0.5112907", "0.5089626", "0.5083804", "0.5083804", "0.50756794", "0.5071758", "0.5069956", "0.5052679", "0.5052679", "0.5052679", "0.5052679", "0.5048918", "0.50439036", "0.5026697", "0.5016817", "0.5014275", "0.5014275", "0.5002232", "0.49954477", "0.49954477", "0.49954477", "0.49872142", "0.4980193", "0.49772447", "0.4968164", "0.49557677", "0.4945964", "0.49422672", "0.4933219", "0.49280283", "0.49206704", "0.49144536", "0.49103734", "0.48999047", "0.48997137", "0.48977777", "0.48799634", "0.48728508", "0.4871507", "0.48701802", "0.4863565", "0.48602897", "0.48570997", "0.4839747", "0.48321205", "0.48234487" ]
0.0
-1
TODO include the diff summary in serializable
def summary_hash # :row_inserts, :row_updates, :row_deletes, :row_reorders # :col_inserts, :col_updates, :col_deletes, :col_reorders, :col_renames # :row_count_initial_with_header, :row_count_final_with_header # :row_count_initial, :row_count_final # :col_count_initial, :col_count_final # :different { different: @summary.different, } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def diff\n @diff ||= begin\n commit.diffs.collect{|diff| diff.diff}.join(\"\\n\")\n end\n end", "def make_my_diffs_pretty!; end", "def persistable_diff(a, b)\n diff = Diff::LCS.diff a, b\n reify_diff_element(diff).as_json\n end", "def diff_to_compare; end", "def diff=(o); end", "def diff1; end", "def diff2; end", "def generate_diff\n jsons = version_jsons.map { |j| pretty_json(j) }\n differ = Differ.send(diff_method, *jsons).format_as(:html)\n differ.gsub!('<ins', \"\\n<ins\") if diff_method == :diff_by_line\n @diff = sanitize(differ).html_safe\n end", "def to_diff_summary_string\n to_line_string(@first_location) << @diff_type << to_line_string(@second_location)\n end", "def evaluateDiffResult()\n\n end", "def difference\n end", "def mu_pp_for_diff(obj); end", "def diff(&block); end", "def diff_init(diff, path)\n Smash.new.tap do |di|\n if diff.size > 1\n updated = diff.find_all { |x| x.first == \"+\" }\n original = diff.find_all { |x| x.first == \"-\" }\n di[:original] = Array(original).map(&:last).join(\", \")\n di[:updated] = Array(updated).map(&:last).join(\", \")\n else\n diff_data = diff.first\n di[:path] = path\n if diff_data.size == 3\n di[diff_data.first == \"+\" ? :updated : :original] = diff_data.last\n else\n di[:original] = diff_data[diff_data.size - 2].to_s\n di[:updated] = diff_data.last.to_s\n end\n end\n end\n end", "def ret_summary()\n [:renamed,:added,:deleted,:modified].inject(Summary.new) do |h,cnd|\n res = map{|diff|diff.send(\"file_#{cnd}\".to_sym)}.compact\n res.empty? ? h : h.merge(\"files_#{cnd}\".to_sym => res)\n end\n end", "def diff\n \trespond_in_format Marginalia.diff(params[:id])\n end", "def differences\n @attributes[:differences]\n end", "def to_html \n PrettyDiff::HtmlGenerator.generate_diff(chunks)\n end", "def reload_diffs\n new_attributes = {}\n new_diffs = []\n\n if commits.size.zero?\n new_attributes[:state] = :empty\n else\n diff_collection = unmerged_diffs\n\n if diff_collection.overflow?\n # Set our state to 'overflow' to make the #empty? and #collected?\n # methods (generated by StateMachine) return false.\n new_attributes[:state] = :overflow\n end\n\n new_attributes[:real_size] = diff_collection.real_size\n\n if diff_collection.any?\n new_diffs = dump_diffs(diff_collection)\n new_attributes[:state] = :collected\n end\n end\n\n new_attributes[:st_diffs] = new_diffs\n\n new_attributes[:start_commit_sha] = self.target_branch_sha\n new_attributes[:head_commit_sha] = self.source_branch_sha\n new_attributes[:base_commit_sha] = branch_base_sha\n\n update_columns_serialized(new_attributes)\n\n keep_around_commits\n end", "def PrintDiffInfoAndStats(diff,cmp_diff)\n puts \"********** PrintDiffInfoAndStats BEGIN ***********\"\n puts \"diff stats is = \\n\"\n ap diff.stats\n puts \"diff sha's are = \"\n puts(\"\\{ #{diff.prev_commit_sha} -> #{diff.next_commit_sha} \\}\")\n puts \"diff prev commit message is \"\n puts $rugged_repo.lookup(diff.prev_commit_sha).message\n puts \"diff next commit message is \"\n puts $rugged_repo.lookup(diff.next_commit_sha).message\n puts \"--------------------------------------------------\"\n\n puts \"cmp_diff stats is = \\n\"\n ap cmp_diff.stats\n puts \"cmp_diff sha's are = \"\n puts(\"\\{ #{cmp_diff.prev_commit_sha} -> #{cmp_diff.next_commit_sha} \\}\")\n puts \"cmp_diff prev commit message is \"\n puts $rugged_repo.lookup(cmp_diff.prev_commit_sha).message\n puts \"cmp_diff next commit message is \"\n puts $rugged_repo.lookup(cmp_diff.next_commit_sha).message\n puts \"--------------------------------------------------\"\n puts \"********** PrintDiffInfoAndStats END **************\"\nend", "def review_diff(other)\n diff = {}\n if self.publication_type != other.publication_type\n diff[:publication_type] = {from: I18n.t('publication_types.'+other.publication_type.code+'.label'), to: I18n.t('publication_types.'+self.publication_type.code+'.label')}\n end\n\n unless (self.category_svep_ids & other.category_svep_ids == self.category_svep_ids) && (other.category_svep_ids & self.category_svep_ids == other.category_svep_ids)\n diff[:category_hsv_local] = {from: other.categories, to: self.categories}\n end\n\n if self.ref_value != other.ref_value\n diff[:ref_value] = {from: I18n.t('ref_values.'+other.ref_value.to_s), to: I18n.t('ref_values.'+self.ref_value.to_s)}\n end\n\n return diff\n end", "def output diff\n if diff.keys.empty?\n \"NO Difference detected in #{@filename}\"\n else\n \"SMAPS Difference detected in #{@filename}\\n\".tap do |msg|\n max_lineno = diff.keys.max.to_s.length\n diff.each do |lnum,diff|\n msg << \"#{lnum.to_s.ljust(max_lineno)} => old: #{diff[:old].inspect}\\n\"\n msg << \"#{' '.to_s.ljust(max_lineno)} new: #{diff[:new].inspect}\\n\"\n end\n\n msg << last_few_lines_of_evm_log if @opts[:inspect_evm_log]\n end\n end\n end", "def diff\n return if diffs.empty?\n\n minimized_hunk.diff(:unified) + NEWLINE\n end", "def compare_resources(old, new, unified)\n puts \"Individual Resource differences:\"\n\n old.each do |resource|\n new_resource = new.find{|res| res[:resource_id] == resource[:resource_id]}\n next if new_resource.nil?\n\n\n unless new_resource[:parameters] == resource[:parameters]\n if unified\n #Only print the diff of resources\n puts Diffy::Diff.new( string_resource(resource), string_resource(new_resource), :diff => \"-U 1000\")\n else\n puts \"Old Resource:\"\n puts string_resource(resource)\n \n puts\n \n puts \"New Resource:\"\n puts string_resource(new_resource)\n end\n end\n end\nend", "def diff_lines_for_serializer\n strong_memoize(:diff_lines_for_serializer) do\n lines = highlighted_diff_lines\n\n next if lines.empty?\n next if blob.nil?\n\n last_line = lines.last\n\n if last_line.new_pos < total_blob_lines(blob) && !deleted_file?\n match_line = Gitlab::Diff::Line.new(\"\", 'match', nil, last_line.old_pos, last_line.new_pos)\n lines.push(match_line)\n end\n\n lines\n end\n end", "def diff\n @diff ||= instance.client.createDiffHTML(padID: pad.id, startRev: start_rev, endRev: end_rev)\n end", "def cmd_diff\n print_tree(DiffEditor, nil, true)\n end", "def diff(other)\n if engine != other.engine && @input_engine\n [:engine, engine, other.engine]\n elsif version != other.version\n [:version, version, other.version]\n elsif engine_version != other.engine_version && @input_engine\n [:engine_version, engine_version, other.engine_version]\n elsif patchlevel != other.patchlevel && @patchlevel\n [:patchlevel, patchlevel, other.patchlevel]\n end\n end", "def test_ut_diff_result_02\n original_file = OriginalFile.new(\n :source_name => \"simple 1\",\n :path => \"http\",\n :normal_result_id => 349898,\n :hirisk_result_id => 4564,\n :critical_result_id => 45 )\n assert_equal(\"simple 1\",original_file.source_name)\n assert_equal(349898,original_file.normal_result_id)\n assert_equal(4564,original_file.hirisk_result_id)\n assert_equal(45,original_file.critical_result_id)\n assert_equal(\"http\",original_file.path)\n end", "def test_ut_diff_warning_02\n assert_equal 2,@diff_warning.diff_status_id\n assert_equal 1,@diff_warning.diff_file_id\n assert_equal 1,@diff_warning.rule_set\n assert_equal 1,@diff_warning.warning_id\n assert_equal 1,@diff_warning.original_file_id\n end", "def generate_diff_hash(base_content, revised_content)\n revised_content.compact.collect {|content_key, revised_value|\n current_value = base_content.send(content_key) || ''\n\n # Ignore unchanged contents or nil (not blank!) content attributes\n unless current_value == revised_value\n [content_key, persistable_diff(current_value, revised_value || '').to_json]\n end\n }.compact.to_h\n end", "def diffs_to_api\n return @diffs_to_api if @diffs_to_api\n @diffs_to_api = []\n\n diffs.each do |diff|\n path = diff.delta.new_file[:path]\n # Presumably only the first commit\n next if path.split('.').first.to_s.downcase == \"readme\"\n\n lines = []\n diff.each_hunk.each do |hunk|\n lines += hunk.lines\n end\n\n html = OutputRenderer.diff(lines)\n status = diff.delta.status\n\n @diffs_to_api << {\n status: status,\n path: path,\n html: html,\n content: @repo.lookup(diff.delta.new_file[:oid]).content\n }\n\n end\n\n @diffs_to_api\n end", "def sync_difference(name, diffs)\n aws = Hash[aws_resources.map { |aws| [aws.name, aws] }]\n if diffs.size > 0\n StatusCodes::set_status(StatusCodes::SYNC_DIFFS)\n\n if diffs[0].type == Common::DiffChange::UNMANAGED\n puts diffs[0]\n elsif diffs[0].type == Common::DiffChange::ADD\n puts Colors.added(\"creating #{name}...\")\n resource = create(diffs[0])\n update(resource, diffs)\n else\n puts Colors.blue(\"updating #{name}...\")\n resource = aws[name]\n update(resource, diffs)\n end\n end\n end", "def historic_diff\n # get the two versions to diff\n @new_measure = Measure.by_user(current_user).where({:_id => params[:new_id]}).first\n unless @new_measure\n @new_measure = ArchivedMeasure.where({:measure_db_id => params[:new_id]}).first.to_measure\n end\n\n @old_measure = Measure.by_user(current_user).where({:_id => params[:old_id]}).first\n unless @old_measure\n @old_measure = ArchivedMeasure.where({:measure_db_id => params[:old_id]}).first.to_measure\n end\n\n results = {}\n results['diff'] = []\n results['pre_upload'] = { \n 'cms_id' => @old_measure.cms_id,\n 'updateTime' => (@old_measure.updated_at.tv_sec * 1000),\n 'hqmf_id' => @old_measure.hqmf_id,\n 'hqmf_version_number' => @old_measure.hqmf_version_number }\n results['post_upload'] = { \n 'cms_id' => @new_measure.cms_id,\n 'updateTime' => (@new_measure.updated_at.tv_sec * 1000),\n 'hqmf_id' => @new_measure.hqmf_id,\n 'hqmf_version_number' => @new_measure.hqmf_version_number }\n\n measure_logic_names = HQMF::Measure::LogicExtractor::POPULATION_MAP.clone\n measure_logic_names['VARIABLES'] = 'Variables'\n\n # Walk through the population sets and populations for the measure and create a\n # diffy for each populationm.\n @new_measure.populations.each_with_index do |new_population_set, population_set_index|\n old_population_set = @old_measure.populations[population_set_index]\n population_diff = []\n\n # For each population within the population set, get the population logic and\n # perform the diffy\n measure_logic_names.each_pair do |population_code, population_title|\n # if the code is for VARIABLE, leave it. If it's IPP, etc., then access the actual code name from the\n # population set (e.g. IPP_1).\n code = (population_code == 'VARIABLES') ? 'VARIABLES' : new_population_set[population_code]\n new_logic = @new_measure.measure_logic.find { |logic| logic['code'] == code }\n old_logic = @old_measure.measure_logic.find { |logic| logic['code'] == code }\n\n # skip if both are non existent\n next if !new_logic && !old_logic\n \n # Remove the first line of the measure logic, which is the the name of the population.\n old_logic_text = old_logic ? old_logic['lines'][1..-1].join() : \"\"\n new_logic_text = new_logic ? new_logic['lines'][1..-1].join() : \"\"\n\n logic_diff = Diffy::SplitDiff.new(old_logic_text, new_logic_text,\n format: :html, include_plus_and_minus_in_html: true, allow_empty_diff: false)\n\n population_diff << {code: population_code, title: population_title, pre_upload: logic_diff.left, post_upload: logic_diff.right}\n end\n\n results['diff'] << population_diff\n end\n\n render :json => results\n end", "def createDiffResult(working_dir, channel_cfg, vimapp, isReleaseOperator,backupRoot)\n\n remotedir = readChannelDir(channel_cfg, vimapp) + \"/\"+ File.basename(working_dir)\n puts remotedir.green\n if File.directory?(remotedir) == false\n FileUtils.mkdir_p remotedir\n end\n\n reportFile1 = \"#{remotedir}/report\"\n reportFile2 = \"#{remotedir}/rdetail\"\n lines = File.open(reportFile1, \"r:UTF-8\").each_line.to_a\n\n hashes = Array.new\n lines.each do |line|\n if line.start_with? \"hash=\"\n hashes.push line.gsub(\"hash=\",\"\").strip.chomp\n end\n end\n\n g = gitOpen(working_dir)\n \n logs = getGitLog(g)\n local_branches = getGitBranches(g)[:local]\n diff = compareHashes g, logs, hashes\n \n def getDiffDetails(diffinfo)\n puts \"diffdetails\"\n data = Array.new \n\n diffinfo[:files].each do |file|\n print \"[\"\n print file[0].cyan\n print \"] \"\n print \"[+] #{file[1][:insertions]}\".green\n print \" \"\n print \"[-] #{file[1][:deletions]}\".red\n puts\n # file, insertions, deletions\n data.push \"file=#{file[0]},#{file[1][:insertions]},#{file[1][:deletions]}\"\n end\n\n return data \n end\n\n diff_details = getDiffDetails diff[1]\n \n puts \"\\n\\n|||||||||||||||||||||||||WRITE|||||||||||||||||||||||||||||||||\\n\\n\"\n\n puts \"hash=\"+diff[2]\n puts \"hash=\"+diff[3]\n diff_details.each do |d| \n puts d\n end\n\n diffReportDir = \"#{working_dir}/.diffreport\"\n FileUtils.mkdir_p diffReportDir \n\n #write diff detail to file \n r_detail = \"#{diffReportDir}/detail\"\n\n puts \">> 222\"\n f = File.open(r_detail, \"w:UTF-8\")\n diff[0].each do |l|\n f.puts l\n end\n f.close\n\n f = File.open(r_detail+\".color\", \"w:UTF-8\")\n diff[0].each do |l|\n if isPlus(l)\n f.puts l.green\n elsif isMinus(l)\n f.puts l.red\n else\n f.puts l\n end\n end\n f.close\n\n puts \">> 111\"\n #write diff to file\n diffReport = \"#{diffReportDir}/report\"\n f = File.open(diffReport, \"w:UTF-8\")\n f.puts \"hash=\"+diff[2]\n f.puts \"hash=\"+diff[3]\n diff_details.each do |d| \n f.puts d\n end\n f.close\n puts \"\\n\\nWRITTEN\\n\\n\".green\n\n if isReleaseOperator == false\n FileUtils.cp \"#{diffReport}\", \"#{reportFile1}\"\n FileUtils.cp \"#{r_detail}\", \"#{reportFile2}\"\n else\n metaOK = FileUtils.identical?(diffReport, reportFile1)\n detailOK = FileUtils.identical?(r_detail, reportFile2)\n \n puts \n print \"[ OVERVIEWS ] \" #metaOK.to_s.red\n puts metaOK ? \"IDENTICAL\".green : \"DIFFERENT\".red\n print \"[CODE DETAILS] \"\n puts detailOK ? \"IDENTICAL\".green : \"DIFFERENT\".red\n puts\n def compare(file1, file2)\n puts \">> compare\"\n lines1 = File.open(file1, \"r:UTF-8\").each_line.to_a\n lines2 = File.open(file2, \"r:UTF-8\").each_line.to_a\n def showInclusion(lines1, lines2, i)\n lines1.each do |line|\n if lines2.include?(line) == false\n if i == true\n puts \"[YOURS] \"+ line.chomp.cyan\n else\n puts \"[REMOTE] \"+ line.chomp.yellow\n end\n end\n end\n end\n showInclusion(lines1, lines2, true)\n showInclusion(lines2, lines1, false)\n end\n compare diffReport, reportFile1\n compare r_detail, reportFile2\n end\n\n files = Array.new\n diff_details.each do |d| \n if d.start_with? \"file=\"\n files.push d.gsub(\"file=\",\"\").strip.chomp\n end\n end\n if hashes.size > 0\n #compareBackupsWithOldVersion(g, working_dir, backupRoot, files, hash) \n #compareBackupsWithOldVersion(g, working_dir,backupRoot,files, hash[1]) \n end\n end", "def delta\n deltas = self.class.delta_documents(@parsed)\n self.class.friendly_deltas(deltas, @parsed)\n end", "def unified\n builder = Builder::XmlMarkup.new\n builder.table(class: 'unified-diff diff csv-diff') do\n builder.colgroup do\n builder.col(class: 'line-nr')\n builder.col(class: 'line-nr')\n builder.col(span: @combined_headers.length)\n end\n builder.thead do\n builder.tr do\n builder.th(class: 'line-nr', title: I18n.t('submissions.show.your_output')) do\n builder.i(class: 'mdi mdi-18 mdi-file-account')\n end\n builder.th(class: 'line-nr', title: I18n.t('submissions.show.expected')) do\n builder.i(class: 'mdi mdi-18 mdi-file-check')\n end\n builder.th(colspan: @combined_headers.length)\n end\n builder.tr do\n builder.th(class: 'line-nr')\n builder.th(class: 'line-nr')\n builder << @combined_headers.join\n end\n end\n builder.tbody do\n if @simplified_table\n unified_simple_body builder\n else\n @diff.each do |chunk|\n is_empty, row = old_row chunk\n\n unless is_empty\n full_row = Array.new(@combined_headers.length) { |i| @gen_header_indices.index(i) }.map { |idx| idx.nil? ? '<td></td>' : row[idx] }\n\n builder << %(<tr>\n <td class=\"line-nr\">#{chunk.old_position + 1}</td>\n <td class=\"line-nr\"></td>\n #{full_row.join}\n </tr>)\n end\n\n is_empty, row = new_row chunk\n\n next if is_empty\n\n full_row = Array.new(@combined_headers.length) { |i| @exp_header_indices.index(i) }.map { |idx| idx.nil? ? '<td></td>' : row[idx] }\n\n builder << %(<tr>\n <td class=\"line-nr\"></td>\n <td class=\"line-nr\">#{chunk.new_position + 1}</td>\n #{full_row.join}\n </tr>)\n end\n end\n end\n end.html_safe\n end", "def diff(other_message)\n out = self.class.new\n\n self.class.valid_attrs.each do |attr|\n ours = read(attr)\n theirs = other_message.read(attr)\n\n if ours != theirs\n out.write(attr, ours)\n end\n end\n\n out\n end", "def move_diffs\n \n end", "def changes(start_ref, end_ref)\n check_refs(start_ref, end_ref)\n s = Mixlib::ShellOut.new(\n \"#{@bin} diff -r #{start_ref}:#{end_ref} --summarize #{@repo_path}\")\n s.run_command.error!\n @logger.info(\"Diff between #{start_ref} and #{end_ref}\")\n s.stdout.lines.map do |line|\n m = line.match(/^(\\w)\\w?\\s+(\\S+)$/)\n fail \"Could not parse line: #{line}\" unless m\n\n {\n :status => m[1] == 'D' ? :deleted : :modified,\n :path => m[2].sub(\"#{@repo_path}/\", '')\n }\n end\n end", "def line_diff\n return { :added => @added_lines, :removed => @removed_lines }\n end", "def calculate_differences\n if new_encrypt\n if current_resource.encrypt\n # Both are encrypted, check if the encryption type is the same\n description = \"\"\n if new_secret != current_resource.secret\n description << \" with new secret\"\n end\n if new_resource.encryption_version != current_resource.encryption_version\n description << \" from v#{current_resource.encryption_version} to v#{new_resource.encryption_version} encryption\"\n end\n\n if description != \"\"\n # Encryption is different, we're reencrypting\n differences = [ \"re-encrypt#{description}\"]\n else\n # Encryption is the same, we're just updating\n differences = []\n end\n else\n # New stuff should be encrypted, old is not. Encrypting.\n differences = [ \"encrypt with v#{new_resource.encryption_version} encryption\" ]\n end\n\n # Get differences in the actual json\n if current_resource.secret\n json_differences(current_decrypted, new_decrypted, false, \"\", differences)\n elsif current_resource.encrypt\n # Encryption is different and we can't read the old values. Only allow the change\n # if we're overwriting the data bag item\n unless new_resource.complete\n raise \"Cannot encrypt #{new_resource.name} due to failure to decrypt existing resource. Set 'complete true' to overwrite or add the old secret as old_secret / old_secret_path.\"\n end\n\n _differences = [ \"overwrite data bag item (cannot decrypt old data bag item)\"]\n differences = (new_resource.raw_data.keys & current_resource.raw_data.keys).map { |key| \"overwrite #{key}\" }\n differences += (new_resource.raw_data.keys - current_resource.raw_data.keys).map { |key| \"add #{key}\" }\n differences += (current_resource.raw_data.keys - new_resource.raw_data.keys).map { |key| \"remove #{key}\" }\n else\n json_differences(current_decrypted, new_decrypted, false, \"\", differences)\n end\n else\n if current_resource.encrypt\n # New stuff should not be encrypted, old is. Decrypting.\n differences = [ \"decrypt data bag item to plaintext\" ]\n else\n differences = []\n end\n json_differences(current_decrypted, new_decrypted, true, \"\", differences)\n end\n differences\n end", "def to_html\n diff(@old, @new, @fields).reduce({}) do |diffed_output, (key, val)|\n if val.class == Hash\n diffed_output[key] = val.reduce({}) do |d_o, (k, v)|\n d_o[k] = v.to_s :html\n d_o\n end\n else\n diffed_output[key] = val.to_s :html\n end\n diffed_output\n end\n end", "def serialize_data\n return unless self.version_changes.nil? && previous\n\n db = CouchRest.database(\"http://208.78.99.54:5984/packages\")\n current = db.get(vname)\n prev = db.get(previous.vname)\n\n current_functions = current[\"function_hashes\"].keys\n prev_functions = prev[\"function_hashes\"].keys\n\n changes = {}\n changes[:removed] = (prev_functions - current_functions).sort\n changes[:added] = (current_functions - prev_functions).sort\n changes[:changed] = []\n\n current_functions.each do |f|\n changes[:changed] << f if current[\"function_hashes\"][f] != prev[\"function_hashes\"][f]\n end\n changes[:changed].sort!\n\n self.version_changes = changes\n\n rescue RestClient::ResourceNotFound\n self.version_changes = {}\n ensure\n save!\n end", "def diff(other)\n HQMF::Measure::LogicExtractor.get_measure_logic_diff(self,other,true)\n end", "def diffs \n @diffs ||= begin\n diff = `svn diff`.split(\"\\n\").map {|l| l.chomp}\n _diffs = {}\n in_diff = false\n in_path = false\n path = nil\n diff.each do |line|\n if /Index:/ =~ line \n path = /Index: (.*)/.match(line)[1]\n _diffs[path] = ' '\n in_path = true\n in_diff = false\n next\n end\n\n if in_path and !in_diff and /^@@/ =~ line\n in_diff = true\n next\n end\n\n if in_diff and in_path\n if /^\\+/ =~ line\n _diffs[path] += '+'\n elsif /^-/ =~ line\n _diffs[path] = _diffs[path] + '-'\n end\n end\n end\n _diffs.map do |k, v| \n _diffs[k] = v.split('').map do |chr| \n { '+' => \"#{COLOR_GREEN}+\", \n '-' => \"#{COLOR_RED}-\"}[chr]\n end.join() + \"#{COLOR_NONE}\"\n end\n _diffs\n end\n end", "def diff_hash\n {\n diff: diff_hunk,\n new_path: file_path,\n old_path: file_path,\n\n # These fields are not displayed for LegacyDiffNote notes, so it\n # doesn't really matter what we set them to.\n a_mode: '100644',\n b_mode: '100644',\n new_file: false\n }\n end", "def diff_edits(diff_from_empty=false)\n edit_diffs = Hash.new\n e = Errata.find(errata.id)\n\n # synopsis field needs a special case due to being rewritten before save...\n get_errata = {\n :synopsis => lambda { |e,_| synopsis_preview(e) },\n :default => lambda { |e,field| e.send(field) }\n }\n get_params = {\n :synopsis => lambda { |_| synopsis_preview_from_params },\n :default => lambda { |field| params[:advisory][field] }\n }\n\n # NOTE: Not sure why only these fields are checked, other\n # changes like keywords, cross_references, idsfixed etc might\n # also cause the docs output to change. Is this a feature?\n [:synopsis, :topic, :description, :solution].each do |field|\n errata_read = get_errata[field] || get_errata[:default]\n params_read = get_params[field] || get_params[:default]\n if diff_from_empty\n # This part is a little confusing.\n # Compare the unedited value with an empty string.\n old = ''\n new = errata_read.call(e, field)\n else\n # This part makes more sense.\n # Compare the unedited value with the new edited value.\n old = errata_read.call(e, field)\n new = params_read.call(field)\n end\n next unless new\n text_diff = diff_as_string(old,new)\n unless text_diff.empty?\n edit_diffs[field] = text_diff\n end\n end\n edit_diffs\n end", "def unmerged_diffs\n compare.diffs(Commit.max_diff_options)\n end", "def inspect\n\t\t\told_to_s\n\t\tend", "def diff(model = self.class.find(id), &block)\n collect_differences(\n self.class.diffable_attributes.map { |a| [ a.to_sym, send(a), model.send(a) ] },\n &block\n )\n end", "def diff\n each_difference(local_resources, true, &@@diff)\n end", "def differ\n @differ ||= Differ.new(externals)\n end", "def diff_edits_from_empty\n diff_edits(true)\n end", "def to_s\n res = \"\"\n res += \"branch: [ #{@branch} ]\\n\"\n\n @history.each do |h|\n res += \"#{h[:tags].join(\", \")}\\n\" unless h[:tags].empty?\n res += \" #{Time.parse(h[:date]).strftime(\"%d.%m.%y\")} #{h[:msg]}\\n\"\n end\n\n res += \"diffs: #{@diffs.keys.join(', ')}\"\n end", "def return_resource_diffs(r1, r2)\n only_in_old = []\n (r2 - r1).each do |r|\n only_in_old << r.to_s\n end\n only_in_new = []\n (r1 - r2).each do |r|\n only_in_new << r.to_s\n end\n differences = {\n titles_only_in_old: only_in_old,\n titles_only_in_new: only_in_new\n }\n differences\n end", "def diffable?\n true\n end", "def display_diff(version1, version2)\n version1_text = render_wiki_content(:content => version1)\n version2_text = render_wiki_content(:content => version2)\n diff(version1_text, version2_text)\n end", "def diff\n element_name = happy_path? ? @processor.kind.output_name : @processor.kind.error_name\n html_diff(\n @ciat_file.element(element_name).as_file,\n @ciat_file.element(element_name, :generated).as_file, \n @ciat_file.element(element_name, :diff).as_file)\n end", "def set_diff\n @diff = Diff.find(params[:id])\n end", "def diff\n deprecation_notice!\n downstream = @cisauraus.downstreams(app, 1).first\n verify_downstream! downstream\n\n print_and_flush \"Comparing #{app} to #{downstream}...\"\n\n diff = @cisauraus.diff(app)\n print_and_flush \"done, \"\n\n if diff.size > 0\n display \"#{app} ahead by #{diff.size} #{plural('commit', diff.size)}:\"\n diff.each do |commit|\n commit_detail = `git log -n 1 --pretty=format:\" %h %ad %s (%an)\" --date=short #{commit} 2>/dev/null`\n if $?.exitstatus == 0\n display commit_detail\n else\n display \" #{commit}\"\n end\n end\n else\n display \"everything is up to date\"\n end\n end", "def json\n delta_pack.to_json\n end", "def html\n diff[:html]\n end", "def no_diff_report\n no_diffs.map do |mutation|\n {\n 'node' => mutation.node.inspect,\n 'source' => mutation.source\n }\n end\n end", "def entry_differences\n @entry_differences ||= {}\n end", "def content_diff\n if params[:version] && !params[:version].match?(/^[1-9]\\d*$/)\n render(plain: \"400 Bad Request: version parameter must be positive integer\", status: :bad_request)\n return\n end\n obj_version = params[:version].to_i if params[:version]&.match?(/^[1-9]\\d*$/)\n subset = params[:subset] ||= 'all'\n render(xml: MoabStorageService.content_diff(druid, params[:content_metadata], subset, obj_version).to_xml)\n rescue ArgumentError => e\n render(plain: \"400 Bad Request: #{e}\", status: :bad_request)\n rescue Moab::MoabRuntimeError => e\n render(plain: \"500 Unable to get content diff: #{e}\", status: :internal_server_error)\n Honeybadger.notify(e)\n end", "def patch_lines\n old_line, new_line = old_start, new_start\n \n old_lines = diff.old_object && diff.old_object.data_lines\n new_lines = diff.new_object && diff.new_object.data_lines\n \n diff_data = summary.split(/(\\d+)/)\n lines = []\n i = 0\n while i < diff_data.length\n line_type, line_count = diff_data[i][0], diff_data[i + 1].to_i\n i += 2\n line_count.times do\n case line_type\n when ?+\n line = [nil, new_line, nil, nil]\n new_line += 1\n when ?-\n line = [old_line, nil, nil, nil]\n old_line += 1\n when ?\\\\\n newline_text = '\\\\ No newline at end of file'\n line = [old_line, new_line, newline_text, newline_text]\n else\n line = [old_line, new_line, nil, nil]\n old_line += 1\n new_line += 1\n end\n line[2] ||= line[0] && old_lines[line[0] - 1]\n line[3] ||= line[1] && new_lines[line[1] - 1]\n lines << line\n end\n end\n lines\n end", "def diffed(old, new)\n differ = Differ.diff_by_line(new, old)\n differ.to_s[/\\{[^}]+\\}/][1...-1].gsub(/\\s{2,}/, '')\n end", "def show_diff\n dir = \"/home/deploy/ci_logs_full/\"\n\n result = TestResult.where(:id => params[:id1]).first\n tool_name = Tool.where(:id => result.tool_id).first.name\n target_dir = \"#{dir}#{tool_name}-#{result.date}-#{result.benchmark}/\"\n target = \"#{target_dir}#{result.benchmark}.#{result.date}.#{tool_name}.log\"\n\n target1 = File.read(target).split(\"\\n\")\n @tname_1 = \"#{tool_name}.#{result.benchmark}.#{result.date}\"\n\n result = TestResult.where(:id => params[:id2]).first\n tool_name = Tool.where(:id => result.tool_id).first.name\n target_dir = \"#{dir}#{tool_name}-#{result.date}-#{result.benchmark}/\"\n target = \"#{target_dir}#{result.benchmark}.#{result.date}.#{tool_name}.log\"\n\n target2 = File.read(target).split(\"\\n\")\n @tname_2 = \"#{tool_name}.#{result.benchmark}.#{result.date}\"\n\n\n if target1.length != target2.length\n @error = true\n else\n @error = false\n end\n\n @list = []\n @rlist1 = []\n @rlist2 = []\n\n level = params[:level].to_i\n target1.each_with_index do |value, index|\n if index <= 3\n next\n end\n result1_s = target1[index].split(\", \")\n result2_s = target2[index].split(\", \")\n\n if result1_s[2] != result2_s[2]\n if level == 0\n if result1_s[2].include? \"sat\" and result2_s[2].include? \"sat\" \n @list.append(result1_s[0])\n @rlist1.append(result1_s[2])\n @rlist2.append(result2_s[2])\n end\n elsif level == 1\n if result1_s[2].include? \"timeout\" or result2_s[2].include? \"timeout\" \n @list.append(result1_s[0])\n @rlist1.append(result1_s[2])\n @rlist2.append(result2_s[2])\n end\n else\n @list.append(result1_s[0])\n @rlist1.append(result1_s[2])\n @rlist2.append(result2_s[2])\n end\n end\n end\n\n @display_types = DisplayType.all\n end", "def changes; self.diff @pristine; end", "def compute_diff\n original_content_file = Tempfile.new(rand(1024).to_s)\n original_content_file.open\n original_content_file.write(content)\n original_content_file.flush\n diff = `diff #{original_content_file.path} #{tempfile.path}`\n diff.gsub!(/> (.*\\n)/m, '\\1'.green)\n diff.gsub!(/< (.*\\n)/m, '\\1'.red)\n ensure\n original_content_file.close\n original_content_file.unlink\n diff\n end", "def colorized_diff(&block); end", "def get_content_diff(subset = :all, version = nil)\n if Dor::Config.stacks.local_workspace_root.nil?\n raise Dor::ParameterError, 'Missing Dor::Config.stacks.local_workspace_root' \n end\n unless %w{all shelve preserve publish}.include?(subset.to_s)\n raise Dor::ParameterError, \"Invalid subset value: #{subset}\"\n end\n\n basename = version.nil? ? \"#{DIFF_FILENAME}.#{subset}.xml\" : \"#{DIFF_FILENAME}.#{subset}.#{version}.xml\"\n druid = DruidTools::Druid.new(self.pid, Dor::Config.stacks.local_workspace_root)\n diff_cache = File.join(druid.temp_dir, basename)\n # check for cached copy before contacting SDR\n if File.exists? diff_cache\n File.read(diff_cache)\n else\n # fetch content metadata inventory difference from SDR\n if Dor::Config.sdr.rest_client.nil?\n raise Dor::ParameterError, 'Missing Dor::Config.sdr.rest_client'\n end\n sdr_client = Dor::Config.sdr.rest_client\n current_content = self.datastreams['contentMetadata'].content\n if current_content.nil?\n raise Dor::Exception, \"Missing contentMetadata datastream\"\n end\n query_string = { :subset => subset.to_s }\n query_string[:version] = version.to_s unless version.nil?\n query_string = URI.encode_www_form(query_string)\n sdr_query = \"objects/#{self.pid}/#{DIFF_QUERY}?#{query_string}\"\n response = sdr_client[sdr_query].post(current_content, :content_type => 'application/xml')\n # cache response\n File.open(diff_cache, 'w') { |f| f << response }\n response\n end\n end", "def getDiff(tag1, tag2, timestamps, unique)\n format = timestamps ? \"%ci %s\" : \"%s\"\n uniqpipe = unique ? \"| uniq \" + (timestamps ? \"-s 25\" : \"\") : \"\"\n return Hash[`git log --pretty=\"#{format}\" #{tag1}...#{tag2} #{uniqpipe}`\n .split(\"\\n\")\n .map { |msg|\n ticket = msg.match(/DATA-(\\d+)/)\n if ticket != nil\n if msg.match(/Merge (branch|pull request) .* (into|from)/) == nil\n # Not a merge commit, so include it\n submatch = msg.match(/\\[?(#{PREFIX}-\\d+)\\]?[\\-|_| ]?(.*)/)\n if submatch != nil\n if submatch.captures[1].length > 0\n [submatch.captures[0], submatch.captures[1]]\n end\n else\n [ticket[0], msg]\n end\n end\n end\n }\n .reject { |e| e == nil }\n .group_by(&:first)\n .map { |k, a|\n [k, a.map(&:last).uniq]\n }]\nend", "def index\n @diffs = Diff.all\n end", "def index\n @diffs = Diff.all\n end", "def sync_statistic\n @config[\"added\"] = @added_lines.length\n @config[\"removed\"] = @removed_lines.length\n @config[\"changed\"] = 0\n end", "def serialize_old_format\n buf = [self.version].pack('V')\n buf << Bitcoin.pack_var_int(self.inputs.length) << self.inputs.order(index: :asc).map(&:to_payload).join\n buf << Bitcoin.pack_var_int(self.outputs.length) << self.outputs.order(n: :asc).map(&:to_payload).join\n buf << [self.lock_time].pack('V')\n buf\n end", "def set_diff\n @diff = Diff.find(params[:id])\n end", "def show\n render layout: 'diff'\n end", "def show_difference\n hash = params[\"dates\"]\n datetime_start = get_datetime_from_hash(hash, \"date_start\")\n datetime_end = get_datetime_from_hash(hash, \"date_end\")\n\n snapshot_data_start = get_snapshot_data_at_datetime(datetime_start)\n snapshot_data_end = get_snapshot_data_at_datetime(datetime_end)\n\n @difference_data = snapshot_data_end\n snapshot_data_start.each do |currency, value|\n @difference_data[currency] -= value\n end\n\n @start_date = datetime_start.strftime(\"%m/%d/%Y %I:%M%p\")\n @end_date = datetime_end.strftime(\"%m/%d/%Y %I:%M%p\")\n end", "def current_diff(a_hash, another_hash)\n\n relevant_diffs = a_hash.diff(another_hash)\n @ignored_files = [\"metadata.json\", \".gitignore\"]\n @ignored_files.each do |file|\n relevant_diffs.delete(file)\n end\n relevant_diffs\n\n end", "def transferred_properties; end", "def transferred_properties; end", "def initialize(diff)\n @diff = diff\n @curr_changed_file = nil\n @prev_changed_file = nil\n @changed_lines = []\n @files_and_lines = {}\n build\n end", "def summary; end", "def summary; end", "def summary; end", "def summary; end", "def outdated; end", "def colorized_diff\n diff.lines.map do |line|\n self.class.colorize_line(line)\n end.join\n end", "def diff_output\n `\n git diff \\\n --diff-filter=AM \\\n --ignore-space-at-eol \\\n --no-color \\\n --cached \\\n -p \\\n -- '*.rb' '*.rake'\n `\n end", "def move_diffs\n\n end", "def generate_diff wA, wB\n\n # puts \"---------------------------------> generating diff for #{wA} and #{wB}\"\n # sort by magnitude of id\n # returns w1 has earlier id than w2\n wA < wB ? w1id = wA : w1id = wB\n wA < wB ? w2id = wB : w2id = wA\n\n # get refs to whole works\n w1 = Work.find(w1id)\n w2 = Work.find(w2id)\n\n # check they belong to same project\n errors.add(:project, \"projects don't match\") unless w1.project_id == w2.project_id\n\n project = Project.find(w2.project_id) # same as w1\n\n\n # ----------- make diffs ------------ #\n\n # set values to diff from neighbord\n w1_md = w1.file_content_md.force_encoding(\"UTF-8\") if !w1.file_content_md.nil?\n w1_html = w1.file_content_html.force_encoding(\"UTF-8\") if !w1.file_content_html.nil?\n w1_text = w1.file_content_text.force_encoding(\"UTF-8\") if !w1.file_content_text.nil?\n\n # **note** self.file_content_md is coming from ReverseMarkdown now, instead of PandocRuby\n diff_md_val = Diffy::Diff.new(w1_md ,w2.file_content_md).to_s\n diff_html_val = Diffy::Diff.new(w1_md ,w2.file_content_md).to_s(:html)\n diff_text_val = Diffy::Diff.new(w1_text ,w2.file_content_text).to_s\n\n ### ALWAYS DIFF INTO :HTML FORMAT SO WE CAN DISPLAY IT NEATLY.\n ### ALWAYS DIFF !EMPTY RIGHT/LEFT\n diff_left_val = Diffy::SplitDiff.new(w1_md ,w2.file_content_md, :format => :html, :allow_empty_diff => false).left if !w1_md.nil?\n diff_right_val = Diffy::SplitDiff.new(w1_md ,w2.file_content_md, :format => :html, :allow_empty_diff => false).right if !w1_md.nil?\n\n # _text diffs for pdfs and plain text docs\n diff_left_text_val = Diffy::SplitDiff.new(w1_text ,w2.file_content_text, :format => :html, :allow_empty_diff => false).left if !w1_text.nil?\n diff_right_text_val = Diffy::SplitDiff.new(w1_text ,w2.file_content_text, :format => :html, :allow_empty_diff => false).right if !w1_text.nil?\n\n # ** .scrub! ensures we don't get any fucked up character encoding errors from mysql2\n # if !diff_md_val.nil? ensures we're dealing with a diffable doc (ie not a picture)\n diff_md_val.force_encoding(\"UTF-8\").scrub! if !diff_md_val.nil? #.encode!('UTF-8', :invalid => :replace, :undef => :replace, :replace => '')!diff_md_val.nil?\n diff_html_val.force_encoding(\"UTF-8\").scrub! if !diff_html_val.nil?\n diff_text_val.force_encoding(\"UTF-8\").scrub! if !diff_text_val.nil?\n\n diff_left_val.force_encoding(\"UTF-8\").scrub! if !diff_left_val.nil?\n diff_right_val.force_encoding(\"UTF-8\").scrub! if !diff_right_val.nil?\n\n # diff_left_text_val.force_encoding(\"UTF-8\").scrub! if !diff_left_val.nil?\n # diff_right_text_val.force_encoding(\"UTF-8\").scrub! if !diff_right_val.nil?\n # diff_left_val.force_encoding(\"UTF-8\").scrub! if !diff_left_val.nil?\n # diff_right_val.force_encoding(\"UTF-8\").scrub! if !diff_right_val.nil?\n diff_left_text_val.force_encoding(\"UTF-8\").scrub! if !diff_left_text_val.nil?\n diff_right_text_val.force_encoding(\"UTF-8\").scrub! if !diff_right_text_val.nil?\n\n # ----------- update or create diff ------------ #\n\n # update_or_create for, well, updating or creating\n diff = Diff.where(project_id: project.id, work1: w1id, work2: w2id).first_or_create\n diff.update!(\n diff_md: diff_md_val,\n diff_html: diff_html_val,\n diff_text: diff_text_val,\n left: diff_left_val,\n right: diff_right_val,\n left_text: diff_left_text_val,\n right_text: diff_right_text_val\n )\n\n end", "def print_resource_diffs(r1, r2)\n diffresources = r1 - r2\n diffresources.each {|resource| puts \"\\t#{resource}\"}\nend", "def diff_stats\n JSON.parse(summary) if summary.present? && summary.start_with?('{', '[')\n rescue JSON::ParserError\n nil # Return nil if parsing fails (i.e., not diff_stats)\n end", "def summary\n @filing_1.summary.delete_if { |k, v| @filing_2.summary[k] == v }.merge!(@filing_2.summary.dup.delete_if { |k, v| @filing_1.summary.has_key?(k) })\n end", "def inspect\n original_inspect = super\n original_inspect.split( ' ' ).first << '>'\n end", "def inspect\n original_inspect = super\n original_inspect.split( ' ' ).first << '>'\n end", "def inspect\n original_inspect = super\n original_inspect.split( ' ' ).first << '>'\n end", "def serialize_change(obj)\n if (obj.saved_changes.keys & @opts[:serialize]).any?\n serialize(obj, \"C\")\n end\n end" ]
[ "0.69506544", "0.6941856", "0.68770057", "0.67682993", "0.67010725", "0.66523933", "0.6601903", "0.65986055", "0.65919304", "0.6454654", "0.62909037", "0.62712216", "0.6221042", "0.61422247", "0.61082023", "0.61039174", "0.60487163", "0.59871465", "0.59425485", "0.58664876", "0.5865952", "0.5859819", "0.58528167", "0.5846421", "0.5837235", "0.5823282", "0.5818112", "0.58109087", "0.5802323", "0.57941425", "0.578028", "0.57669044", "0.57517", "0.5748792", "0.5728887", "0.5720609", "0.57007045", "0.56960166", "0.56928945", "0.5687775", "0.56729937", "0.5669888", "0.5658413", "0.5642856", "0.56426775", "0.5628854", "0.56269956", "0.5618221", "0.56174314", "0.561291", "0.5605534", "0.55965257", "0.5596182", "0.558654", "0.55736226", "0.55689514", "0.5558068", "0.5541173", "0.55312425", "0.5519089", "0.55085754", "0.5501416", "0.5498867", "0.5496989", "0.54931355", "0.5490015", "0.54876614", "0.5487308", "0.5476942", "0.5474478", "0.5469302", "0.54671776", "0.54597735", "0.54410774", "0.5440244", "0.5440244", "0.5437551", "0.54300237", "0.5428399", "0.5408774", "0.54061735", "0.54042", "0.5401668", "0.5401668", "0.539655", "0.5392046", "0.5392046", "0.5392046", "0.5392046", "0.53917605", "0.5388376", "0.5383185", "0.53763795", "0.5372946", "0.53719264", "0.53686136", "0.53676325", "0.5366354", "0.5366354", "0.5366354", "0.5358754" ]
0.0
-1
GET /miscellaneous_items GET /miscellaneous_items.xml
def index if params[:from] and params[:to] if params[:from].blank? and params[:to].blank? flash[:error] = "Please choose a valid date" @search = MiscellaneousItem.search(params[:search]) @miscellaneous_items = [] #@search.all(:order => "transaction_date DESC, amount", :limit => 0, :joins => :agent) else from = Date.parse(params[:from]).to_s rescue from = Date.today.to_s to = Date.parse(params[:to]).to_s rescue to = Date.today.to_s @search = MiscellaneousItem.search(params[:search]) @search.transaction_date_greater_than_or_equal_to(from) @search.transaction_date_less_than_or_equal_to(to) if params[:option] unless params[:option][:agent_name].blank? check_name = params[:option][:agent_name] end end if check_name agent_id = MiscellaneousItem.check_agent_name(check_name) @search.agent_id_equals(agent_id) @miscellaneous_items = @search.all else @miscellaneous_items = @search.all end end else @search = MiscellaneousItem.search(params[:search]) @miscellaneous_items = [] #@search.all(:order => "date_paid DESC", :limit => 0) end @miscellaneous_items = @miscellaneous_items.paginate(:page => params[:page], :per_page => 30) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @miscellaneous_item = MiscellaneousItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @miscellaneous_item }\n end\n end", "def new\n @miscellaneous_item = MiscellaneousItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @miscellaneous_item }\n end\n end", "def index\n @items_mobs = ItemsMob.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @items_mobs.to_xml }\n end\n end", "def get_items\n response_xml = http_get(@client, \"#{xero_url}/Items\")\n parse_response(response_xml, {}, {:request_signature => 'GET/items'})\n end", "def index\n @items = @category.blank? ? Item.roots : @category.items\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @items }\n end\n end", "def index\n @items_count = Item.count\n @items = Item.find(:all, { :order => 'items.created_at DESC', :include => :user }.merge(@pagination_options))\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @items }\n format.rss { render :layout => false }\n end\n end", "def items\n \tbegin\n \t@categories = Category.all.includes(items: [:dimensions])\n \t@ingredients = Ingredient.actives\n \trender 'api/v1/home/items', status: :ok\n \trescue Exception => e\n \t\terror_handling_bad_request(e)\n \tend\n\n\tend", "def index\n @items = Item.accessible_by(current_ability)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n format.xml { render xml: @items }\n end\n end", "def index\n @action_items = ActionItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @action_items }\n end\n end", "def items\n # Since we're parsing xml, this will raise an error\n # if the response isn't xml.\n self.response = self.class.get(\"#{record_url}/items?view=full\")\n raise_error_if(\"Error getting items from Aleph REST APIs.\") {\n (response.parsed_response[\"get_item_list\"].nil? or response.parsed_response[\"get_item_list\"][\"items\"].nil?)\n }\n [response.parsed_response[\"get_item_list\"][\"items\"][\"item\"]].flatten\n end", "def index\n @miscellaneous = Miscellaneou.all\n end", "def show\n @request = Request.find(params[:id])\n @items = @request.items\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @request }\n end\n end", "def items\n @document.xpath('//results/page/items/*')\n end", "def index\n @goods_items = Goods::Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @goods_items }\n end\n end", "def show\n @items_mob = ItemsMob.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @items_mob.to_xml }\n end\n end", "def index\n @item_options = ItemOption.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @item_options }\n end\n end", "def index\n @help_items = HelpItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @help_items }\n end\n end", "def index\n if @item\n @inter_library_loans = @item.inter_library_loans.page(params[:page])\n else\n @inter_library_loans = InterLibraryLoan.page(params[:page])\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @inter_library_loans }\n format.rss { render layout: false }\n format.atom\n end\n end", "def index\n @news_items = do_index(NewsItem, params)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @news_items }\n end\n end", "def item(uuid)\n http.get \"/items/#{uuid}\"\n end", "def index_rest\n @entry_items = EntryItem.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entry_items }\n end\n end", "def index\n @items = @project.items.ready\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @items }\n end\n end", "def index\n @menu_items = uhook_find_menu_items\n\n respond_to do |format|\n format.html {} # index.html.erb \n format.xml {\n render :xml => @menu_items\n }\n end\n end", "def show\n @miscellaneous_child = MiscellaneousChild.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @miscellaneous_child }\n end\n end", "def create\n @miscellaneous_item = MiscellaneousItem.new(params[:miscellaneous_item])\n\n respond_to do |format|\n if @miscellaneous_item.save\n flash[:notice] = 'MiscellaneousItem was successfully created.'\n format.html { redirect_to(@miscellaneous_item) }\n format.xml { render :xml => @miscellaneous_item, :status => :created, :location => @miscellaneous_item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @miscellaneous_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def items\n @items ||= items_from_response\n end", "def index\n @news_items = NewsItem.find(:all, :order => 'updated_at desc')\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @news_items.to_xml }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end", "def get_more_items\n @items = Item.page(2)\n\tend", "def index\n @receiving_items = ReceivingItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @receiving_items }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n format.xml { render xml: @item }\n end\n end", "def index\n @items = Item.eager_load(:rss).paginate(page: params[:page], :per_page => 10).order(\"date DESC\")\n end", "def index\n @outlet_goods_receive_note_items = OutletGoodsReceiveNoteItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @outlet_goods_receive_note_items }\n end\n end", "def index \n\t\t@items = Item.all\n\tend", "def item_all(data_version = nil)\n item_list = get(resource_path('item'), @version, itemListData: 'all', version: data_version)\n RiotGamesApi::LOL::Model::StaticData::ItemList.new item_list\n end", "def destroy\n @miscellaneous_item = MiscellaneousItem.find(params[:id])\n @miscellaneous_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(miscellaneous_items_url) }\n format.xml { head :ok }\n end\n end", "def index\n @items = Item.found\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @items }\n end\n end", "def index\n @list = List.find(params[:list_id])\n @list_items = @list.list_items.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @list_items }\n end\n end", "def index\n\t\t @items = Item.find_my_items(current_user) \n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html\n # show.html.erb\n format.xml { render :xml => @item }\n end\n end", "def index\n\t\t@items = Item.all\n end", "def index\n @expense_items = ExpenseItem.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @expense_items }\n end\n end", "def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def index\n @category = params[:category]\n if @category\n @category_s = Item.categories_s(@category)\n @items = @course.items.find(:all, :conditions => [\"lower(category) IN (?)\", @category.downcase.split(' ')])\n else\n @category_s = 'All Items'\n @items = @course.items\n end\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @items }\n end\n end", "def index\n #@items = Item.all\n end", "def index\n @items = Item.all\n end", "def index\n @items = Item.all\n end", "def index\n @items = Item.all\n end", "def index\n @items = Item.all\n end", "def index\n @items = Item.all\n end", "def index\n @items = Item.all\n end", "def index\n @items = Item.all\n end", "def index\n @items = Item.all\n end", "def index\n @items = Item.all\n end", "def index\n @items = Item.all\n end", "def index\n @items = Item.all\n end", "def index\n @items = Item.all\n end", "def index\n @items = Item.all\n end", "def index\n @items = Item.all\n end", "def index\n @items = Item.all\n end", "def index\n @items = Item.all\n end", "def index\n @items = Item.all\n end", "def index\n @items = Item.all\n end", "def index\n @items = Item.all\n end", "def index\n @items = Item.all\n end", "def index\n @items = Item.all\n end", "def index\n @items = Item.all\n end", "def index\n @items = Item.all\n end", "def index\n @items = Item.all\n end", "def index\n @items = Item.all\n end", "def index\n @generic_items = GenericItem.limit(5)\n end", "def get_items(product_id, params={})\n self.client.get(\"products/#{product_id}/items\", params)\n end", "def get_all_items\n items(@nodename)\n end", "def index\n self.identify_user\n @items = @user.items\n @itemlist = @items.map do |item|\n convert_to_json(item)\n end\n respond_to do |format|\n format.json { render :json => @itemlist }\n format.xml { render :xml => @items }\n format.html { render text: \"Unsupported Format\", status: 404 }\n end\n end", "def index \n \n begin\n @menu = @client.search_menu_items(params[:item])\n rescue RuntimeError\n @error = true\n @response = response.status\n end\n end", "def index\n @items = Item.all\n\n end", "def index\n @item_photos = ItemPhoto.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @item_photos }\n end\n end", "def index\n unless params[:type]\n @page = Page.find_by_permalink(\"production\", :order => \"position ASC\")\n #@page_ids = []\n else\n @page = Page.find_by_permalink(\"accessories\", :order => \"position ASC\")\n #@items = Item.find_by_page_id(params[:page_id])\n end\n\n #respond_to do |wants|\n # wants.html # index.html.erb\n # # wants.xml { render :xml => @items }\n # end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end", "def index\n @items = Item.search(params[:search]).page(params[:page]).per(40)\n end", "def index\n @items = Item.all\n end", "def index\n @items = @channel.items\n @items = @query.search(@items)\n @items = @items.order_by_published_at_desc\n @items = @items.page(params[:page]).per(10)\n\n respond_to do |format|\n format.html\n format.json { render json: @items }\n end\n end", "def index\n @meant_it_rels = MeantItRel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @meant_it_rels }\n end\n end", "def index\n @items = current_user.items\n respond_to do |format|\n format.html\n format.json { render json: @items }\n end\n end", "def index\n @items = Item.all\n end", "def getitem\n\n int_parent = params[:parent]\n @items = Item.where(\"manifestation_id = ?\", int_parent).order(\"item_siglum ASC\")\n @items_master = Array.new\n @items.each do |it|\n @holding_institution = HoldingInstitution.find(it.holding_institution_id)\n str_it_string = \"(\" + it.item_siglum + \") \" + @holding_institution.holding_institution_name + \" [\" + it.item_shelfmark + \"]\"\n @it_item = [str_it_string, it.id]\n @items_master.push(@it_item)\n end\n\n\n respond_to do |format|\n format.html { render json: @items_master }\n format.json { render json: @items_master }\n end\n end", "def index\n @front_page = true\n @items_count = Item.count\n @items = Item.all.paginate :page => params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @items }\n format.rss { render :layout => false }\n end\n end", "def get_items(response, item_page)\n items = []\n response = response.to_h\n if response.key?('ItemSearchResponse') &&\n response['ItemSearchResponse'].key?('Items') &&\n response['ItemSearchResponse']['Items'].key?('Item')\n response['ItemSearchResponse']['Items']['Item'].each_with_index do |item, pos|\n items << { position: (item_page - 1) * ITEMS_PER_PAGE + pos + 1, data: item }\n end\n end\n items\n end", "def get(pAuthToken, p_item_id, p_args)\r\n service_uri = \"#{@@m_service_url.path}#{@@m_service_get}#{p_item_id}.#{@@m_content_format}?authToken=#{pAuthToken}\"\r\n\r\n # verify user intention about related items, if :related_items flag is set\r\n # load all related items\r\n if p_args.nil? == false and p_args[:related_items] == true\r\n service_uri += \"&#{PARAM_LOAD_RELATED_ITEMS}=true\"\r\n\r\n # verify whether user has set any offset\r\n offset = p_args[:offset]\r\n unless offset.nil?\r\n service_uri += \"&offset=#{offset.to_s}\"\r\n end\r\n\r\n # verify whether user has set any maximum number of related items\r\n max = p_args[:max]\r\n unless max.nil?\r\n service_uri += \"&max=#{max}\"\r\n end\r\n\r\n # verify whether user has set the accepted relation types\r\n relation_types_array = p_args[:relation_types]\r\n unless relation_types_array.nil? and relation_types_array.empty?\r\n relation_types = \"\"\r\n relation_types_array.each do |relation_type|\r\n if relation_types.size > 0\r\n relation_types += \",\" + relation_type\r\n else\r\n relation_types += relation_type\r\n end\r\n end\r\n service_uri += \"&relation_types=#{relation_types}\"\r\n end\r\n end\r\n debug service_uri\r\n response = Net::HTTP.start(@@m_service_url.host,\r\n @@m_service_url.port) {|http|\r\n http.get(service_uri, {HEADER_COOKIE => @@m_cookies})\r\n }\r\n xml_content = response.body\r\n built_item = build_item(xml_content)\r\n debug(\"built item - #{built_item}\")\r\n return built_item\r\n end", "def show_rest\n @item_usage = ItemUsage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item_usage }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n format.json { render :json => @item }\n end\n end", "def update\n @miscellaneous_item = MiscellaneousItem.find(params[:id])\n\n respond_to do |format|\n if @miscellaneous_item.update_attributes(params[:miscellaneous_item])\n flash[:notice] = 'MiscellaneousItem was successfully updated.'\n format.html { redirect_to(@miscellaneous_item) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @miscellaneous_item.errors, :status => :unprocessable_entity }\n end\n end\n end" ]
[ "0.72636783", "0.66251177", "0.6381508", "0.62261814", "0.61888254", "0.6175204", "0.60594785", "0.6027527", "0.5968608", "0.5913716", "0.589272", "0.588977", "0.58821106", "0.58361715", "0.5831662", "0.5763648", "0.57517284", "0.5750091", "0.57420284", "0.5738643", "0.5731008", "0.5718354", "0.5715454", "0.57143444", "0.56840956", "0.56802493", "0.5656747", "0.56501186", "0.56501186", "0.56501186", "0.56501186", "0.56501186", "0.56501186", "0.5644073", "0.5630671", "0.5628624", "0.5614496", "0.561307", "0.5612111", "0.5603382", "0.5603217", "0.56007445", "0.560045", "0.55978847", "0.55957156", "0.5588517", "0.5577328", "0.55741286", "0.5573054", "0.5573054", "0.5573054", "0.5573054", "0.55695033", "0.55580616", "0.55514497", "0.55514497", "0.55514497", "0.55514497", "0.55514497", "0.55514497", "0.55514497", "0.55514497", "0.55514497", "0.55514497", "0.55514497", "0.55514497", "0.55514497", "0.55514497", "0.55514497", "0.55514497", "0.55514497", "0.55514497", "0.55514497", "0.55514497", "0.55514497", "0.55514497", "0.55514497", "0.55514497", "0.55514497", "0.5550298", "0.55451584", "0.55406135", "0.55389744", "0.5532963", "0.5530024", "0.55083567", "0.55067253", "0.5490876", "0.5483358", "0.54821086", "0.5477325", "0.5476952", "0.5475192", "0.5472724", "0.5472253", "0.5469403", "0.5465468", "0.5464", "0.54631126", "0.545933", "0.5449145" ]
0.0
-1
GET /miscellaneous_items/1 GET /miscellaneous_items/1.xml
def show @miscellaneous_item = MiscellaneousItem.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @miscellaneous_item } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @miscellaneous_item = MiscellaneousItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @miscellaneous_item }\n end\n end", "def index\n @items_mobs = ItemsMob.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @items_mobs.to_xml }\n end\n end", "def index\n @items_count = Item.count\n @items = Item.find(:all, { :order => 'items.created_at DESC', :include => :user }.merge(@pagination_options))\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @items }\n format.rss { render :layout => false }\n end\n end", "def index\n @items = @category.blank? ? Item.roots : @category.items\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @items }\n end\n end", "def show\n @miscellaneous_child = MiscellaneousChild.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @miscellaneous_child }\n end\n end", "def index\n @action_items = ActionItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @action_items }\n end\n end", "def show\n @request = Request.find(params[:id])\n @items = @request.items\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @request }\n end\n end", "def index\n @news_items = do_index(NewsItem, params)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @news_items }\n end\n end", "def get_items\n response_xml = http_get(@client, \"#{xero_url}/Items\")\n parse_response(response_xml, {}, {:request_signature => 'GET/items'})\n end", "def show\n @items_mob = ItemsMob.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @items_mob.to_xml }\n end\n end", "def index\n @goods_items = Goods::Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @goods_items }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end", "def create\n @miscellaneous_item = MiscellaneousItem.new(params[:miscellaneous_item])\n\n respond_to do |format|\n if @miscellaneous_item.save\n flash[:notice] = 'MiscellaneousItem was successfully created.'\n format.html { redirect_to(@miscellaneous_item) }\n format.xml { render :xml => @miscellaneous_item, :status => :created, :location => @miscellaneous_item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @miscellaneous_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n @items = Item.accessible_by(current_ability)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n format.xml { render xml: @items }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html\n # show.html.erb\n format.xml { render :xml => @item }\n end\n end", "def index\n @help_items = HelpItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @help_items }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n format.xml { render xml: @item }\n end\n end", "def index\n @item_options = ItemOption.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @item_options }\n end\n end", "def index\n @news_items = NewsItem.find(:all, :order => 'updated_at desc')\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @news_items.to_xml }\n end\n end", "def index_rest\n @entry_items = EntryItem.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entry_items }\n end\n end", "def item(uuid)\n http.get \"/items/#{uuid}\"\n end", "def destroy\n @miscellaneous_item = MiscellaneousItem.find(params[:id])\n @miscellaneous_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(miscellaneous_items_url) }\n format.xml { head :ok }\n end\n end", "def show_rest\n @item_usage = ItemUsage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item_usage }\n end\n end", "def index\n @items = @project.items.ready\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @items }\n end\n end", "def index\n @list = List.find(params[:list_id])\n @list_items = @list.list_items.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @list_items }\n end\n end", "def xml(item)\n presenter.xml(item)\n end", "def index\n @miscellaneous = Miscellaneou.all\n end", "def items\n \tbegin\n \t@categories = Category.all.includes(items: [:dimensions])\n \t@ingredients = Ingredient.actives\n \trender 'api/v1/home/items', status: :ok\n \trescue Exception => e\n \t\terror_handling_bad_request(e)\n \tend\n\n\tend", "def index\n if @item\n @inter_library_loans = @item.inter_library_loans.page(params[:page])\n else\n @inter_library_loans = InterLibraryLoan.page(params[:page])\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @inter_library_loans }\n format.rss { render layout: false }\n format.atom\n end\n end", "def index\n @receiving_items = ReceivingItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @receiving_items }\n end\n end", "def index\n @expense_items = ExpenseItem.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @expense_items }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end", "def index\n @outlet_goods_receive_note_items = OutletGoodsReceiveNoteItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @outlet_goods_receive_note_items }\n end\n end", "def index\n @item_photos = ItemPhoto.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @item_photos }\n end\n end", "def index\n @menu_items = uhook_find_menu_items\n\n respond_to do |format|\n format.html {} # index.html.erb \n format.xml {\n render :xml => @menu_items\n }\n end\n end", "def update\n @miscellaneous_item = MiscellaneousItem.find(params[:id])\n\n respond_to do |format|\n if @miscellaneous_item.update_attributes(params[:miscellaneous_item])\n flash[:notice] = 'MiscellaneousItem was successfully updated.'\n format.html { redirect_to(@miscellaneous_item) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @miscellaneous_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n format.json { render :json => @item }\n end\n end", "def items\n # Since we're parsing xml, this will raise an error\n # if the response isn't xml.\n self.response = self.class.get(\"#{record_url}/items?view=full\")\n raise_error_if(\"Error getting items from Aleph REST APIs.\") {\n (response.parsed_response[\"get_item_list\"].nil? or response.parsed_response[\"get_item_list\"][\"items\"].nil?)\n }\n [response.parsed_response[\"get_item_list\"][\"items\"][\"item\"]].flatten\n end", "def show\n @actionitem = Actionitem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @actionitem }\n end\n end", "def items\n @document.xpath('//results/page/items/*')\n end", "def index\n @items = Item.eager_load(:rss).paginate(page: params[:page], :per_page => 10).order(\"date DESC\")\n end", "def show\n @material_item = MaterialItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @material_item }\n end\n end", "def show\n @news_item = NewsItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @news_item.to_xml }\n end\n end", "def index\n @front_page = true\n @items_count = Item.count\n @items = Item.all.paginate :page => params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @items }\n format.rss { render :layout => false }\n end\n end", "def show\n @item_type = ItemType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item_type }\n end\n end", "def get_more_items\n @items = Item.page(2)\n\tend", "def item\n @item = Item.find(params[:id])\n end", "def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @line_items }\n end\n end", "def show_items(n_most_recent)\n # Get the 0th item from array and open with Nokogiri\n xml_link = rss_links.first\n @xml_doc = Nokogiri::XML open(xml_link)\n \n\n # Get all the titles, dates, and links from the RSS\n # and strip their XML tag\n titles = strip_xml_tag @xml_doc.xpath(\"//title\")\n pub_dates = strip_xml_tag @xml_doc.xpath(\"//pubDate\")\n links = strip_xml_tag @xml_doc.xpath(\"//link\")\n \n item_list = make_rss_item titles, pub_dates, links, n_most_recent\n\n puts item_list\n\n end", "def index\n unless params[:type]\n @page = Page.find_by_permalink(\"production\", :order => \"position ASC\")\n #@page_ids = []\n else\n @page = Page.find_by_permalink(\"accessories\", :order => \"position ASC\")\n #@items = Item.find_by_page_id(params[:page_id])\n end\n\n #respond_to do |wants|\n # wants.html # index.html.erb\n # # wants.xml { render :xml => @items }\n # end\n end", "def show\n @news_item = NewsItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @news_item }\n end\n end", "def show\n @news_item = NewsItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @news_item }\n end\n end", "def show\n @instancia_item = InstanciaItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @instancia_item }\n end\n end", "def show\n @item_photos = ItemPhoto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item_photos }\n end\n end", "def output_xml(items)\n puts \"<?xml version=\\\"1.0\\\"?><items>\"\n items.each do |item|\n puts \"<item uid=\\\"#{item[\"uid\"]}\\\" arg=\\\"#{item[\"arg\"]}\\\">\n <title>#{item[\"title\"]}</title>\n <icon>icon.png</icon>\n <subtitle>#{item[\"subtitle\"]}</subtitle>\n </item>\"\n end\n puts \"</items>\" \n end", "def index\n @meant_it_rels = MeantItRel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @meant_it_rels }\n end\n end", "def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @line_items }\n end\n end", "def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @line_items }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @news_item }\n end\n end", "def get(pAuthToken, p_item_id, p_args)\r\n service_uri = \"#{@@m_service_url.path}#{@@m_service_get}#{p_item_id}.#{@@m_content_format}?authToken=#{pAuthToken}\"\r\n\r\n # verify user intention about related items, if :related_items flag is set\r\n # load all related items\r\n if p_args.nil? == false and p_args[:related_items] == true\r\n service_uri += \"&#{PARAM_LOAD_RELATED_ITEMS}=true\"\r\n\r\n # verify whether user has set any offset\r\n offset = p_args[:offset]\r\n unless offset.nil?\r\n service_uri += \"&offset=#{offset.to_s}\"\r\n end\r\n\r\n # verify whether user has set any maximum number of related items\r\n max = p_args[:max]\r\n unless max.nil?\r\n service_uri += \"&max=#{max}\"\r\n end\r\n\r\n # verify whether user has set the accepted relation types\r\n relation_types_array = p_args[:relation_types]\r\n unless relation_types_array.nil? and relation_types_array.empty?\r\n relation_types = \"\"\r\n relation_types_array.each do |relation_type|\r\n if relation_types.size > 0\r\n relation_types += \",\" + relation_type\r\n else\r\n relation_types += relation_type\r\n end\r\n end\r\n service_uri += \"&relation_types=#{relation_types}\"\r\n end\r\n end\r\n debug service_uri\r\n response = Net::HTTP.start(@@m_service_url.host,\r\n @@m_service_url.port) {|http|\r\n http.get(service_uri, {HEADER_COOKIE => @@m_cookies})\r\n }\r\n xml_content = response.body\r\n built_item = build_item(xml_content)\r\n debug(\"built item - #{built_item}\")\r\n return built_item\r\n end", "def show\n @media_item = MediaItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @media_item }\n end\n end", "def new_rest\n @item_usage = ItemUsage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item_usage }\n end\n end", "def show\n @m_general = MGeneral.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @m_general }\n end\n end", "def rss\n @headers[\"Content-Type\"] = \"application/xml\"\n @articles = Article.find(:all, \n :order => 'created_at DESC',\n :conditions => [\"articles.approved = ?\", true],\n :limit => 10\n )\n render :layout => false\n end", "def show\n @list = List.find(params[:list_id])\n @list_item = @list.list_items.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @list_item }\n end\n end", "def new\r\n @item = Item.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @item }\r\n end\r\n end", "def index\n @feedback_items = FeedbackItem.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @feedback_items }\n end\n end", "def getitem\n\n int_parent = params[:parent]\n @items = Item.where(\"manifestation_id = ?\", int_parent).order(\"item_siglum ASC\")\n @items_master = Array.new\n @items.each do |it|\n @holding_institution = HoldingInstitution.find(it.holding_institution_id)\n str_it_string = \"(\" + it.item_siglum + \") \" + @holding_institution.holding_institution_name + \" [\" + it.item_shelfmark + \"]\"\n @it_item = [str_it_string, it.id]\n @items_master.push(@it_item)\n end\n\n\n respond_to do |format|\n format.html { render json: @items_master }\n format.json { render json: @items_master }\n end\n end", "def index\n @generic_items = GenericItem.limit(5)\n end", "def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @news_item }\n end\n end", "def index\n @goods_additional_values = Goods::Additional::Value.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @goods_additional_values }\n end\n end", "def get(item)\n self.send(\"GET #{item}\")\n\n # Check for errors\n case @retcode\n when 0 then @retmesg # OK\n when 10 then nil # item doesn't exist\n else\n fail(\"Debconf: debconf-communicate returned #{@retcode}: #{@retmesg}\")\n end\n end", "def show\r\n @item_type = ItemType.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.xml { render :xml => @item_type }\r\n end\r\n end", "def index\n @item_formats = ItemFormat.find(:all, :order => 'position ASC')\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @item_formats.to_xml }\n end\n end", "def get_item( item )\n @session.base_url = \"http://cl.ly\"\n resp = @session.get( \"/\" + item )\n \n raise ItemNotFound if resp.status == 404\n Crack::JSON.parse(resp.body)\n end", "def index \n @kind = 'all'\n @recommands = Recommandation.paginate(:page => params[:page],:order => 'created_at DESC')\n \n respond_to do |format|\n format.html # index.html.erb\n format.rss \n end\n end", "def rss\n @title = t('titles.news', brand: website.brand_name)\n @description = website.value_for(\"default_meta_tag_description\")\n @news = News.all_for_website(website)\n respond_to do |format|\n format.xml # render rss.xml.builder\n end\n end", "def index\n @mriscantasks = Mriscantask.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @mriscantasks }\n end\n end", "def show\n @media_metadata_item = MediaMetadataItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @media_metadata_item }\n end\n end", "def index\n @apiv1_items = Item.all.order(:name)\n end", "def index\n @category = params[:category]\n if @category\n @category_s = Item.categories_s(@category)\n @items = @course.items.find(:all, :conditions => [\"lower(category) IN (?)\", @category.downcase.split(' ')])\n else\n @category_s = 'All Items'\n @items = @course.items\n end\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @items }\n end\n end", "def index\n @stream_items = StreamItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @stream_items }\n end\n end", "def new\n @title = \"New item\"\n @item = ItemTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def index\n @items = Item.found\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def index\n @league_items = LeagueItem.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @league_items }\n end\n end", "def item_all(data_version = nil)\n item_list = get(resource_path('item'), @version, itemListData: 'all', version: data_version)\n RiotGamesApi::LOL::Model::StaticData::ItemList.new item_list\n end", "def index \n\t\t@items = Item.all\n\tend" ]
[ "0.66794676", "0.62437767", "0.605938", "0.6004241", "0.5953134", "0.5914868", "0.588695", "0.5838852", "0.58314127", "0.5811259", "0.5800752", "0.5799038", "0.5799038", "0.5799038", "0.5799038", "0.5799038", "0.5799038", "0.5790172", "0.57844895", "0.5739035", "0.571314", "0.57105553", "0.5701679", "0.56962264", "0.5692919", "0.5669047", "0.5655177", "0.5650744", "0.5646367", "0.5635181", "0.56324196", "0.5628382", "0.5592835", "0.5589737", "0.5582836", "0.5580045", "0.5577282", "0.5569036", "0.55431724", "0.55384105", "0.55351835", "0.55215025", "0.5513523", "0.5483117", "0.5481156", "0.54787165", "0.5478338", "0.54696375", "0.5469029", "0.54467165", "0.54466087", "0.54410124", "0.5440507", "0.5436367", "0.54284346", "0.54268426", "0.54268426", "0.5426214", "0.541906", "0.5413996", "0.54123014", "0.54072124", "0.54072124", "0.540315", "0.540315", "0.540315", "0.540315", "0.540315", "0.540315", "0.540315", "0.540315", "0.53958136", "0.5392131", "0.5392091", "0.53803396", "0.53778046", "0.5377091", "0.5374839", "0.5371195", "0.53654313", "0.536193", "0.53594863", "0.5358334", "0.53520894", "0.53441244", "0.53430015", "0.5339229", "0.5338018", "0.53367305", "0.53315055", "0.533079", "0.532841", "0.53228325", "0.53217757", "0.5317866", "0.53167135", "0.5315216", "0.53099585", "0.5307608", "0.53041416" ]
0.7342621
0
GET /miscellaneous_items/new GET /miscellaneous_items/new.xml
def new @miscellaneous_item = MiscellaneousItem.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @miscellaneous_item } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @miscellaneous_item = MiscellaneousItem.new(params[:miscellaneous_item])\n\n respond_to do |format|\n if @miscellaneous_item.save\n flash[:notice] = 'MiscellaneousItem was successfully created.'\n format.html { redirect_to(@miscellaneous_item) }\n format.xml { render :xml => @miscellaneous_item, :status => :created, :location => @miscellaneous_item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @miscellaneous_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def new\n @title = \"New item\"\n @item = ItemTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def new\r\n @item = Item.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @item }\r\n end\r\n end", "def new\n @item = Item.factory('local')\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n format.xml { render xml: @item }\n end\n end", "def new\n @miscellaneous_child = MiscellaneousChild.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @miscellaneous_child }\n end\n end", "def new_rest\n @item_usage = ItemUsage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item_usage }\n end\n end", "def new\n @clone_item_request = CloneItemRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @clone_item_request }\n end\n end", "def new\n @action_item = ActionItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @action_item }\n end\n end", "def new_rest\n @entry_item = EntryItem.new\n\n respond_to do |format|\n #format.html # new.html.erb\n format.xml { render :xml => @entry_item }\n end\n end", "def new\n @item_type = ItemType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item_type }\n end\n end", "def new\n @content_item = ContentItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @content_item }\n end\n end", "def new\n @news_item = NewsItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @news_item }\n end\n end", "def new\n @news_item = NewsItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @news_item }\n end\n end", "def item\n @new = New.find(params[:id])\n end", "def new\r\n @item_type = ItemType.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @item_type }\r\n end\r\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @item }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => new_vurl }\n end\n end", "def new\n @item = Item.new\n @items = Item.all\n @tags = Tag.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = BudgetItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def new\n @special = Special.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @special }\n end\n end", "def new\r\n @lineitem = Lineitem.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @lineitem }\r\n end\r\n end", "def new\n @item = Item.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n \n end", "def new\n @omatsuri = Omatsuri.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @omatsuri }\n end\n end", "def new\n @instancia_item = InstanciaItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @instancia_item }\n end\n end", "def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @system }\n end\n end", "def new\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item}\n end\n end", "def new\n @ordered_item = OrderedItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ordered_item }\n format.json { render :json => @ordered_item }\n end\n end", "def new\n @thing_list = ThingList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @thing_list }\n end\n end", "def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @line_item }\n end\n end", "def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @line_item }\n end\n end", "def new\n @to_do_item = ToDoItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @to_do_item }\n end\n end", "def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @line_item }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.haml\n format.json { render :json => @news_item }\n end\n end", "def new\n @item = Item.new\n respond_to do |format|\n format.html # new.html.erb\n format.js # new.js.rjs\n format.xml { render :xml => @item }\n end\n end", "def new\n @item_info = ItemInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item_info }\n end\n end", "def set_new_item\n @new_item = NewItem.find(params[:id])\n end", "def new\n @item = Item.new(:list_id => params[:list_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @item }\n end\n end", "def new\n @requisicion = Requisicion.new\n @[email protected]\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @requisicion }\n end\n end", "def new\n @goods_item = Goods::Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @goods_item }\n end\n end", "def new\n @receiving_item = ReceivingItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @receiving_item }\n end\n end", "def item_new\n @brief = Brief.find(params[:brief_id])\n @item = Item.new\n @item.kind = params[:kind]\n @action_to = vendor_item_create_path(@brief,@item.kind)\n end", "def new\n @question_item = QuestionItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @question_item }\n end\n end", "def new\n @inventory_item = InventoryItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @inventory_item }\n end\n end", "def new\n @material_item = MaterialItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @material_item }\n end\n end", "def new\n @item = current_user.items.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ontology }\n end\n end", "def new\n @node = Node.scopied.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end", "def new\n @media_item = MediaItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @media_item }\n end\n end", "def new\n @list = List.find(params[:list_id])\n @item = @list.items.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item_alias = ItemAlias.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item_alias }\n end\n end", "def new\n @mylist = Mylist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @mylist }\n end\n end", "def new\n @tipo_item = TipoItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tipo_item }\n end\n end", "def new\n @additionalinfo = Additionalinfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @additionalinfo }\n end\n end", "def new\n @menu_item = uhook_new_menu_item\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @menu_item }\n end\n end", "def new\n @collection = Collection.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @collection }\n end\n end", "def new\n @nspirefile = Nspirefile.new\n @categories = get_categories\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nspirefile }\n end\n end", "def new\n @item_photos = ItemPhoto.new\n @item_photos.item_id = params[:item_id]\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item_photos }\n end\n end", "def new\n @item = Item.new\n \n @months = Month.where(['publish=?', true]).order('position, calendar_type_id')\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def new\n @user = current_user\n @item = current_user.items.build\n respond_to do |format|\n format.json { render :json => @item }\n format.xml { render :xml => @item }\n format.html\n end\n end", "def new\n @thing = Thing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @thing }\n end\n end", "def new\n @procurementitem = Procurementitem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @procurementitem }\n end\n end", "def new\n @m_general = MGeneral.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @m_general }\n end\n end", "def new\n @mail_item = MailItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @mail_item }\n end\n end", "def create\n @item = Item.new(params[:item])\n\n respond_to do |wants|\n if @item.save\n flash[:notice] = 'Item was successfully created.'\n wants.html { redirect_to(admin_items_url) }\n wants.xml { render :xml => @item, :status => :created, :location => @item }\n else\n wants.html { render :action => \"new\" }\n wants.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @imovel = Imovel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @imovel }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @infraction_type }\n end\n end", "def new\n @content_item = ContentItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content_item }\n end\n end", "def new\n @page_id = \"opinions\"\n @opinion = Opinion.new\n @agents = Agent.all.collect {|item| [ item.name, item.id ]}\n @services = Service.find(:all).collect {|item| [ item.name, item.id ]}\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @opinion }\n end\n end", "def new\n logger.debug 'new_some interesting information'\n @comdty = Comdty.new\n setvariables\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comdty }\n end\n end", "def new\n @menu_item = MenuItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @menu_item }\n end\n end" ]
[ "0.73890924", "0.71475095", "0.71475095", "0.71475095", "0.71475095", "0.71475095", "0.71475095", "0.71475095", "0.71475095", "0.7133957", "0.71129155", "0.71029276", "0.70728016", "0.6927841", "0.68855906", "0.68108475", "0.6793", "0.67912483", "0.67632073", "0.67266023", "0.6722985", "0.6722985", "0.67019016", "0.66548634", "0.6590118", "0.6590118", "0.6590118", "0.6590118", "0.6590118", "0.6590118", "0.6590118", "0.6590118", "0.6590118", "0.6590118", "0.6590118", "0.6590118", "0.6590118", "0.6590118", "0.6590118", "0.6590118", "0.6590118", "0.6590118", "0.6590118", "0.6590118", "0.6569823", "0.6569823", "0.6534874", "0.6533725", "0.6521805", "0.65089923", "0.64997447", "0.6488607", "0.64751416", "0.6469893", "0.64622", "0.645154", "0.64453155", "0.64402324", "0.6426102", "0.6426102", "0.64252627", "0.6413941", "0.64095575", "0.6409491", "0.64091355", "0.64064246", "0.63992554", "0.63896", "0.6367426", "0.6367186", "0.6360529", "0.6359995", "0.63535184", "0.6347218", "0.6329857", "0.63271976", "0.6316359", "0.6316224", "0.6302498", "0.6301828", "0.6294668", "0.6289103", "0.6288117", "0.6285156", "0.6281289", "0.62779754", "0.6270902", "0.6268344", "0.62667847", "0.62627125", "0.62557685", "0.6244659", "0.623664", "0.6230815", "0.6226095", "0.62202245", "0.6219615", "0.6215017", "0.62148553", "0.6207475" ]
0.8019944
0
POST /miscellaneous_items POST /miscellaneous_items.xml
def create @miscellaneous_item = MiscellaneousItem.new(params[:miscellaneous_item]) respond_to do |format| if @miscellaneous_item.save flash[:notice] = 'MiscellaneousItem was successfully created.' format.html { redirect_to(@miscellaneous_item) } format.xml { render :xml => @miscellaneous_item, :status => :created, :location => @miscellaneous_item } else format.html { render :action => "new" } format.xml { render :xml => @miscellaneous_item.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @miscellaneous_item = MiscellaneousItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @miscellaneous_item }\n end\n end", "def create\n item = list.items.create!(item_params)\n render json: item, status: 201\n end", "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to(items_path) }\n format.xml { render :xml => @item, :status => :created, :location => @item }\n else\n format.html { redirect_to(items_path)}\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def item_params\n params.require(:item).permit(:item, :body)\n end", "def update\n @miscellaneous_item = MiscellaneousItem.find(params[:id])\n\n respond_to do |format|\n if @miscellaneous_item.update_attributes(params[:miscellaneous_item])\n flash[:notice] = 'MiscellaneousItem was successfully updated.'\n format.html { redirect_to(@miscellaneous_item) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @miscellaneous_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(params[:item])\n\n respond_to do |wants|\n if @item.save\n flash[:notice] = 'Item was successfully created.'\n wants.html { redirect_to(admin_items_url) }\n wants.xml { render :xml => @item, :status => :created, :location => @item }\n else\n wants.html { render :action => \"new\" }\n wants.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create(item_attrs = {})\n body = { value: item_attrs }\n Iterable.request(conf, base_path).put(body)\n end", "def item_params\n params.require(:item).permit(:name, :tag_list, :type_list, :description)\n end", "def magic_item_params\n params.require(:magic_item).permit(:name, :wondrous, :weight, :tier, :rarity, :attunement, :description)\n end", "def item_params\n params.require(:item).permit(:name, :description, :price, :stock, :image, category_elements: [], animal_elements: [], size_elements: [])\n end", "def item_params\n params.require(:item).permit(:name, :price, :date, :user_id, :group_id, :item_type, { tag_ids: [] })\n end", "def create\n @generic_item = GenericItem.new(generic_item_params)\n\n respond_to do |format|\n if @generic_item.save\n format.html { redirect_to @generic_item, notice: 'Generic item was successfully created.' }\n format.json { render action: 'show', status: :created, location: @generic_item }\n else\n format.html { render action: 'new' }\n format.json { render json: @generic_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def item_params\n params.require(:item).permit(:title, :body)\n end", "def item_params\n params.require(:item).permit(:nombre, :categorium_id)\n end", "def item(data, question_ids)\n xml = xml_root(\"items\")\n\n questions = question_ids.inject(XML::Node.new(\"questions\")) do |doc, id|\n question = XML::Node.new(\"question\")\n question[\"id\"] = id.to_s\n doc << question\n end\n\n arrayed(data).each do |name|\n xml.root << (XML::Node.new(\"item\") << (XML::Node.new(\"data\") << name) << questions.copy(true))\n end\n\n send_and_process('items/add', 'items/item', xml)\n end", "def create\n\n @item = Item.new(item_params)\n #まだView設定がまだのため仮の登録データ、あとでViewからのデータをitem_paramsで定義します。\n atai = 1\n watasi = \"hoge\"\n\n @item.status = atai\n @item.upper_category = watasi\n @item.middle_category = watasi\n @item.lower_category = watasi\n @item.seller = watasi\n @item.size_type = watasi\n \n \n @item.save\n redirect_to root_path\n # respond_to do |format|\n # if @item.save\n # format.html { redirect_to @item, notice: 'Item was successfully created.' }\n # format.json { render :show, status: :created, location: @item }\n # else\n # format.html { render :new }\n # format.json { render json: @item.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def item_params\n params.require(:item).permit!\n end", "def create\n item = Item.new(item_params)\n item.done = \"0\"\n item.trash = \"0\"\n\n if item.save\n render json: {data:item}, status: :created\n else\n render json: {data:item}, status: :unprocessable_entity\n end\n end", "def create\n @item = Item.new(item_params)\n # @item.build_note\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n respond_with(@items)\n end\n end\n end", "def item_params\n params.require(:item).permit(:tagid, :rfid, :category_id, :sub_category_id, :weight, :description, :purchased_at_date, :vendor_id, :warranty_time, :lifetime_until, :serial, :sku, :price, :owner, :last_seen, :service_interval, :tagged, :status_id, :lup, :ancestry, :parent_id, :tag_list, :make, :model, :warranty_time, :life_time, :unit_id, :owner_id, :into_use, :ip, :inspection_interval, :item, :memo, :lup_inc, :search, :department_id, :user_id, :terminate_at_eol)\n end", "def item_params\n params.require(:item).permit(:item, :value, :category, :status, :gst, :multiplier, :date, :identifier, :newcat)\nend", "def create_item()\n\n request_body = {\n 'name' => 'Milkshake',\n 'variations' => [\n {\n 'name' => 'Small',\n 'pricing_type' => 'FIXED_PRICING',\n 'price_money' => {\n 'currency_code' => 'USD',\n 'amount' => 400\n }\n }\n ]\n }\n\n response = Unirest.post CONNECT_HOST + '/v1/' + LOCATION_ID + '/items',\n headers: REQUEST_HEADERS,\n parameters: request_body.to_json\n\n if response.code == 200\n puts 'Successfully created item:'\n puts JSON.pretty_generate(response.body)\n return response.body\n else\n puts 'Item creation failed'\n puts response.body\n return nil\n end\nend", "def create\n @request_item = RequestItem.new(request_item_params)\n @request_item.item = Item.new(name: params[:request_item][:item][:name])\n\n if @request_item.save\n render json: @request_item \n else\n render json: @request_item.errors, status: :bad_request\n end\n end", "def item_params\n params[:item].permit(:iname, :iinfo, :ipictureurl)\n end", "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to(@item, :notice => 'Item was successfully created.') }\n format.xml { render :xml => @item, :status => :created, :location => @item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to(@item, :notice => 'Item was successfully created.') }\n format.xml { render :xml => @item, :status => :created, :location => @item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def item_params\n params.require(:item).permit(:description, :category_id, :user_id,:observations, :status)\n end", "def add_item\n #params[item_id]\n end", "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n flash[:notice] = 'Item was successfully created.'\n format.html { redirect_to(@item) }\n format.xml { render :xml => @item, :status => :created, :location => @item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n flash[:notice] = 'Item was successfully created.'\n format.html { redirect_to(@item) }\n format.xml { render :xml => @item, :status => :created, :location => @item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def action_item_params\n params.require(:action_item).permit(:content, :emotion, :sentiment)\n end", "def create\n @item = Item.new(params[:item])\n @item.save\n respond_with @item\n end", "def create\n puts params\n item_data = {\n :title => params[:title],\n :description => params[:description]\n }\n @item = current_user.items.build(item_data)\n if params[:attachments]\n params[:attachments].each do |att_id|\n @att = Attachment.find(att_id)\n @item.attachments.push(@att)\n if @att.att_type == 'photo'\n @item.photos.build(\n photo_url: @att.url\n )\n end\n end\n end\n if @item.save\n respond_to do |format|\n format.json { render :json => @item.to_json, :status => 200 }\n format.xml { head :ok }\n format.html { redirect_to :action => :index }\n end\n else\n respond_to do |format|\n format.json { render :text => \"Could not create item\", :status => :unprocessable_entity } # placeholder\n format.xml { head :ok }\n format.html { render :action => :new, :status => :unprocessable_entity }\n end\n end\n end", "def item_params\n params.require(:item).permit!\n end", "def godown_item_params\n params.require(:godown_item).permit(:godown_entry_id, :product_id, :terminal_code, :model, :sn_code, :price, :items, :amount, :status)\n end", "def item_params\n params.require(:item).permit(\n :item_name, :item_description, :item_image_id, :item_qr, :item_price, :item_active,\n post_images_images: [],\n stock_attributes: [:id, :item_id, :stock_count],\n tags_attributes: [:id, :tag_name, :_destroy],\n tag_ids: [])\n # 複数画像を投稿できるように[]をつけている\n # フォームにhasoneのstockを含めている\n end", "def destroy\n @miscellaneous_item = MiscellaneousItem.find(params[:id])\n @miscellaneous_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(miscellaneous_items_url) }\n format.xml { head :ok }\n end\n end", "def create\n @item = current_user.items.build(params[:item])\n\n respond_to do |format|\n if @item.save\n flash[:notice] = 'Item was successfully created.'\n format.html { redirect_to home_path }\n format.xml { head :created, :location => item_url(@item) }\n else\n format.html { render :action=>:new }\n format.xml { render :xml=>@item.errors.to_xml }\n end\n end\n end", "def item_params\n params.require(:item).permit(:office_id, :mantis, :client_id, :numProcesso, :nomeServidor, :operacao, :migrado )\n #Rails.logger.debug \"DEBUG: params are #{params}\"\n end", "def item_params\n params.require(:item).permit(:content)\n end", "def item_params\n params.require(:item).permit(:name, :description, :url, :ref_url, :cover, :icon, :is_published, :category_id)\n end", "def item_params\n params.require(:item).permit(:title, :link, :content, :user_id)\n end", "def create\n @item = Item.new(params[:item])\n @item.subjects = Subject.find(params[:subject_ids]) if params[:subject_ids]\n @items = load_items(@item)\n \n @months = Month.where(['publish=?', true]).order('position, calendar_type_id')\n respond_to do |format|\n if @item.save\n format.html { redirect_to(admin_item_url(@item), :notice => 'Item was successfully created.') }\n format.xml { render :xml => @item, :status => :created, :location => @item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def item_params\n params.require(:item).permit(:categoria_id, :nome_ptbr, :nome_en, :descricao)\n end", "def item_params\n params.require(:item).permit(:name, :type_id, :user_id)\n end", "def create\n @item = build_item\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to items_path, notice: 'アップロードしたでー' }\n format.json { render action: 'show', status: :created, location: @item }\n else\n format.html { render action: 'new' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @items_mob = ItemsMob.new(params[:items_mob])\n\n respond_to do |format|\n if @items_mob.save\n flash[:notice] = 'ItemsMob was successfully created.'\n format.html { redirect_to items_mob_url(@items_mob) }\n format.xml { head :created, :location => items_mob_url(@items_mob) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @items_mob.errors.to_xml }\n end\n end\n end", "def item_params\n if !params[:item].nil? && !params[:item].empty?\n params.require(:item).permit(:name, :description, :price, :food_type)\n end\n end", "def create\n @item = Item.new(item_params)\n if @item.save\n @items = Item.all\n render status: 201, :json => @item\n \n else\n render status: 404, json: { message: @item.errors}.to_json\n end\n \n \n end", "def item_params\n params.require(:item).permit(:price, :photo, :name, :currency, :description, :quantity_unit, :category_ids => [])\n end", "def item_params\n params.require(:item).permit(:title, :description, :price, :category, :availability, :user_id, :image, :item_id)\n end", "def item_params\n params.require(:item).permit(:name, :amount_at_a_time, :gram_at_a_time, :price_at_a_time, :price_at_one_amount, :price_at_one_gram, :description, :icon)\n end", "def item_params\n params.require(:item).permit(:name, :value)\n end", "def item_params\r\n params.require(:item).permit(:number, :name, :small_wrap, :big_wrap, :category_id, :active)\r\n end", "def item_params\n params.require(:item).permit(:unique_id, :name, :brand, :category, :description, :image, :special_item, :age_restricted, :quantity, :cost, :tax_slab, :views_count, :search_category, :search_brand, :search_availability)\n end", "def item_params(item)\n\t\titem.permit(:name, :category, :amount, :claimed_by, :potluck_id)\n\tend", "def item_params\n params.require(:item).permit(:pedido_id, :modelo_id, :cantidad)\n end", "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to root_url, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, item: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def item_params\n params.require(:item).permit(:name, :price, :available, :description, :quantity, category_ids: [])\n end", "def create\n \n #debug\n write_log(\n Const::SL::LOG_PATH_SL,\n \"items_controller#create(params[:item] => #{params[:item]})\",\n # __FILE__,\n __FILE__.split(\"/\")[-1],\n __LINE__.to_s)\n\n \n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def item_params\n params.fetch(:item, {}).permit(:position, :lesson_id, :teacher_id, :week_number, :day_number).merge(group_id: params[:group_id])\n end", "def item_params\n params.permit(\n :title,\n :category,\n :detail_tags_1,\n :detail_tags_2,\n :detail_tags_3\n )\n end", "def create\n @item = Item.new(item_save_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def item_params\n params.fetch(:item, {}).permit(\n :name, :is_done\n )\n end", "def create\n @item = current_owner.items.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to items_path, notice: 'Item was created successfully' }\n format.json { render :show, status: :created, location: items_path }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def item_params\n params.require(:item).permit(:product_id, :qnt, :sale_value, :total_value, :intowel_id)\n end", "def item_params\n params.require(:item).permit(:name, :description, :quantity, :category_id)\n end", "def save_items_data\n @parsed[\"order_items\"].each do |i| \n external_code = i['item']['id']\n item = Item.find_or_create_by(external_code: external_code)\n item.order_id = @order.id\n item.external_code = i['item']['id']\n item.name = i['item']['title']\n item.price = i['unit_price']\n item.quantity = i['quantity']\n item.total = i['full_unit_price']\n @subItems = []\n item.save\n end\n end", "def item_params\n params.require(:item).permit(:description, :completed, :priority)\n end", "def create\n @item = Item.new(params[:item])\n\n get_relations_from_params\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def item_params\n params.require(:item).permit(:item_id, :name, :references, :year, :status, :lenght, :height, :width, :thickness, :aquisition_date, :outer_circumference, :inner_circumference, :weight, :conservation_state, :biography, :description, {mediafiles: []})\n end", "def item_params\n params.require(:item).permit(:location, :item_type, :picnum, :oldpicnum, :note, :finished, :unfinished, :customer)\n end", "def item_params\n params.require(:item).permit(:name, :description, :specs, :vendor_id, :vpn, :bootsy_image_gallery_id, :tag_list, :msrp)\n end", "def item_params\n params.require(:item).permit(:name, :price, :quantity, :description, :image, :tag_list)\n end", "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: \"Item was successfully created.\" }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(item_params)\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def api_post(method: nil, item: [], params: {})\n raise ArgumentError, 'Missing method in API request' unless method\n\n login(@host) if Time.new.to_i > @session_timeout\n\n request = {}\n request[:method] = method\n request[:params] = [[item || []], params.to_h]\n # This is how we create request params once all methods use structs\n # request[:params] = [[item || []], params.to_h]\n # We use a StandardError since it is based on the HTTP response code with a JSON payload definition\n begin\n resp = @http.post(@uri, request.to_json, @headers)\n JSON.parse(resp.body)['result']['result']\n rescue StandardError\n puts \"The following error has occurred #{JSON.parse(resp.body)['error']['message']}\"\n end\n end", "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n @item.save_info\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end \n end", "def item_params\n params.fetch(:item, {})\n end", "def item_params\n params.fetch(:item, {})\n end", "def item_params\n params.fetch(:item, {})\n end", "def item_params\n params.fetch(:item, {})\n end", "def create\n upload_item params[params[:item_type]], session['username'], params[:alternative_name], params[:tag_name], params[:item_type], params[:details]\n end", "def api_v1_item_params\n params.require(:item).permit(:plate, :status, :menu_id)\n end", "def item_params\n params.require(:item).permit(:name, :amount, :user_id, :group_id)\n end", "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6374522", "0.59442604", "0.5928585", "0.59123266", "0.5857304", "0.58002025", "0.5746391", "0.5745602", "0.57412714", "0.5695307", "0.56937146", "0.56818205", "0.56773686", "0.5671517", "0.5668003", "0.5636266", "0.56309557", "0.561101", "0.5610839", "0.56086254", "0.56076765", "0.5606744", "0.56001705", "0.55991286", "0.55972916", "0.55972916", "0.5587687", "0.5571156", "0.5557774", "0.5557774", "0.5554846", "0.5548547", "0.5544425", "0.55369294", "0.5524236", "0.55054903", "0.5502467", "0.54997545", "0.5498064", "0.54964", "0.5487525", "0.548183", "0.5479037", "0.5478658", "0.5475592", "0.5475284", "0.5472672", "0.5469379", "0.54646623", "0.5459757", "0.545217", "0.5446992", "0.5443735", "0.5438824", "0.54385763", "0.5436532", "0.5430979", "0.5430292", "0.54277164", "0.5426132", "0.5418036", "0.54134554", "0.5413014", "0.5411451", "0.54113895", "0.5406281", "0.5404435", "0.5400926", "0.54007185", "0.5396988", "0.5396377", "0.5389769", "0.538722", "0.5375072", "0.5371791", "0.5367984", "0.53624415", "0.5362112", "0.53620803", "0.53620803", "0.53620803", "0.53620803", "0.535662", "0.5350605", "0.53475374", "0.53428847", "0.53428847", "0.53428847", "0.53428847", "0.53428847", "0.53428847", "0.53428847", "0.53428847", "0.53428847", "0.53428847", "0.53428847", "0.53428847", "0.53428847", "0.53428847", "0.53428847" ]
0.7085851
0
PUT /miscellaneous_items/1 PUT /miscellaneous_items/1.xml
def update @miscellaneous_item = MiscellaneousItem.find(params[:id]) respond_to do |format| if @miscellaneous_item.update_attributes(params[:miscellaneous_item]) flash[:notice] = 'MiscellaneousItem was successfully updated.' format.html { redirect_to(@miscellaneous_item) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @miscellaneous_item.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @miscellaneous_item = MiscellaneousItem.new(params[:miscellaneous_item])\n\n respond_to do |format|\n if @miscellaneous_item.save\n flash[:notice] = 'MiscellaneousItem was successfully created.'\n format.html { redirect_to(@miscellaneous_item) }\n format.xml { render :xml => @miscellaneous_item, :status => :created, :location => @miscellaneous_item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @miscellaneous_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @item = @user.items.find(params[:id])\n\n @item.update(:type_list => \"\", :tag_list => \"\")\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to [@user, @item], notice: 'item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n\n\n end", "def update\n respond_to do |format|\n if @generic_item.update(generic_item_params)\n format.html { redirect_to \"/catalog/#{@generic_item.id}\", notice: 'Generic item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @generic_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n logger.info \"Item: #{@item}\\nw/ param attr: #{params[:item].inspect}\"\n respond_to do |format|\n @item.attributes = params[:item].select{|k,v| ![:item_photos, :item_photos_attributes, :location].include?(k.to_sym) }\n\n @item.load_item_photos_with_params(params[:item] )\n\n if @item.save\n\n @item.set_by_user(auth_user)\n\n logger.info \" C) after save: attr: #{@item.attributes}\"\n\n if manage_item_photos(@item).present? || @item.changed?\n @item.save\n logger.info \" D) attr: #{@item.attributes}\"\n end\n\n format.html {\n redirect_to inventory_approve_item_path(:user_id => \"#{@item.owner.id}\")\n }\n format.json { render json:{ item: @item, success: true} }\n else\n set_flash_messages_from_errors(@item)\n format.html { render action: \"edit\" }\n format.json { render json: { error: @item.errors.first.join(' ') }, status: :unprocessable_entity }\n end\n end\n end", "def update \n respond_to do |wants|\n if @item.update_attributes(params[:item])\n flash[:notice] = 'Item was successfully updated.'\n wants.html { redirect_to(admin_items_path) }\n wants.xml { head :ok }\n else\n \n wants.html { render :action => \"edit\" }\n wants.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def test_put_expenses_1_xml\n @parameters = {:expense => {:description => 'NewDescription'}}\n if ActiveRecord::VERSION::MAJOR < 4\n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/expenses/1.xml',\n {:expense => {:description => 'NewDescription'}},\n {:success_code => :ok})\n end\n\n assert_no_difference('Expense.count') do\n put '/expenses/1.xml', @parameters, credentials('admin')\n end\n\n expense = Expense.find(1)\n assert_equal \"NewDescription\", expense.description\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to(@item)}\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_rest\n @item_usage = ItemUsage.find(params[:id])\n\n respond_to do |format|\n if @item_usage.update_attributes(params[:item_usage])\n flash[:notice] = 'ItemUsage was successfully updated.'\n format.html { redirect_to(@item_usage) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item_usage.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item }\n format.xml { head :ok }\n else\n \n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n @item.update_attributes(params[:item])\n respond_with @item\n end", "def update_item(item_id)\n request_body = {\n 'name' => 'Malted Milkshake'\n }\n\n response = Unirest.put CONNECT_HOST + '/v1/' + LOCATION_ID + '/items/' + item_id,\n headers: REQUEST_HEADERS,\n parameters: request_body.to_json\n\n if response.code == 200\n puts 'Successfully updated item:'\n puts JSON.pretty_generate(response.body)\n return response.body\n else\n puts 'Item update failed'\n puts response.body\n return nil\n end\nend", "def update\n @item = Item.find(params[:id])\n @statuses = ItemStatus.all\n @tags= Item.all_tags\n \n delete_images \n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n if current_user and current_user.role_id == 1\n Notifier.item_updated(@item).deliver\n format.html { redirect_to(manage_items_url, :notice => 'Item was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { redirect_to(@item, :notice => 'Item was successfully updated.') }\n format.xml { head :ok }\n end\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end", "def destroy\n @miscellaneous_item = MiscellaneousItem.find(params[:id])\n @miscellaneous_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(miscellaneous_items_url) }\n format.xml { head :ok }\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n flash[:notice] = 'Item was successfully updated.'\n format.html { redirect_to(@item) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n flash[:notice] = 'Item was successfully updated.'\n format.html { redirect_to(@item) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n flash[:notice] = 'Item was successfully updated.'\n format.html { redirect_to(@item) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[@item.class.to_s.downcase.to_sym])\n flash[:notice] = 'Item was successfully updated.'\n format.html { redirect_to(@item) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n flash[:notice] = 'Item was successfully updated.'\n format.html { redirect_to(:action => :index) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n respond_to do |format|\n if @item.update_attributes(params[:item])\n flash[:notice] = \"Item has been updated\"\n format.json { render :json => @item.to_json, :status => 200 }\n format.xml { head :ok }\n format.html { render :action => :edit }\n else\n format.json { render :text => \"Could not update item\", :status => :unprocessable_entity } #placeholder\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n format.html { render :action => :edit, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to(@item, :notice => 'Item was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to(@item, :notice => 'Item was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @item ||= Item.find_by_id_or_name(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n flash[:notice] = 'Item was successfully updated.'\n format.html { redirect_to(@item) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\r\n @item = Item.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @item.update_attributes(params[:item])\r\n format.html { redirect_to(@item, :notice => 'Item Successfully updated.') }\r\n format.xml { head :ok }\r\n else\r\n format.html { render :action => \"edit\" }\r\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end", "def update \n respond_to do |format|\n if @item.update_attributes(params[:item])\n flash[:notice] = 'Artikel is succesvol ge-update.'\n format.html { redirect_to(@item) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @item.update!(item_params)\n end", "def new\n @miscellaneous_item = MiscellaneousItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @miscellaneous_item }\n end\n end", "def update_rest\n @entry_item = EntryItem.find(params[:id])\n\n respond_to do |format|\n if @entry_item.update_attributes(params[:entry_item])\n flash[:notice] = 'EntryItem was successfully updated.'\n #format.html { redirect_to(@entry_item) }\n format.xml { head :ok }\n else\n #format.html { render :action => \"edit\" }\n format.xml { render :xml => @entry_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def show\n @miscellaneous_item = MiscellaneousItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @miscellaneous_item }\n end\n end", "def set_apiv1_item\n @apiv1_item = Item.find(params[:id])\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to(retrospective_path(@item.section.retrospective), :notice => 'Item was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_api_v1_item\n @api_v1_item = Item.find(params[:id])\n end", "def update\n respond_to do |format|\n if @convenience_item.update(convenience_item_params)\n format.html { redirect_to @convenience_item, notice: 'Convenience item was successfully updated.' }\n format.json { render :show, status: :ok, location: @convenience_item }\n else\n format.html { render :edit }\n format.json { render json: @convenience_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @item.update_attributes(item_params)\n render json: @item, status: :ok\n else\n render_error(@item, :unprocessable_entity)\n end\n end", "def update\n @item = \"Vger::Resources::#{params[:item][:item_type]}\".constantize.find(params[:id])\n respond_to do |format|\n if @item.class.save_existing(params[:id], params[:item])\n format.html { redirect_to suitability_item_path(params[:id]), notice: 'Suitability Item was successfully updated.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item_type = ItemType.find(params[:id])\n\n respond_to do |format|\n if @item_type.update_attributes(params[:item_type])\n format.html { render :action => 'edit', :notice => 'Item type was successfully updated.' }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n\n #update the item of request_item\n if (params[:request_item].present?)\n @request_item.item = params[:request_item][:item].present? ? Item.new(name: params[:request_item][:item][:name]) : @request_item.item\n end\n #update all other parameters\n if @request_item.update(request_item_params)\n render json: @request_item\n else\n render json: @request_item.errors, status: :bad_request\n end\n\n end", "def update\n @item = Item.find(params[:id])\n\n get_relations_from_params\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @miscellaneous_child = MiscellaneousChild.find(params[:id])\n\n respond_to do |format|\n if @miscellaneous_child.update_attributes(params[:miscellaneous_child])\n format.html { redirect_to(@miscellaneous_child, :notice => 'MiscellaneousChild was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @miscellaneous_child.errors, :status => :unprocessable_entity }\n end\n end\n end", "def test_put_invoices_1_xml\n @parameters = {:invoice => {:number => 'NewNumber'}}\n \n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/invoices/1.xml',\n {:invoice => {:number => 'NewNumber'}},\n {:success_code => :ok})\n \n assert_no_difference('Invoice.count') do\n put '/invoices/1.xml', @parameters, credentials('admin')\n end\n \n invoice = Invoice.find(1)\n assert_equal \"NewNumber\", invoice.number\n \n end", "def update(item_attrs = {})\n body = { update: item_attrs }\n Iterable.request(conf, base_path).patch(body)\n end", "def update\n item = Item.find(params[:item_id])\n\n item.name = params[:name]\n item.details = params[:details]\n item.save\n end", "def update\n respond_to do |format|\n if @toodoo_item.update(toodoo_item_params)\n format.html { redirect_to @toodoo_item, notice: 'Toodoo item was successfully updated.' }\n format.json { render :show, status: :ok, location: @toodoo_item }\n else\n format.html { render :edit }\n format.json { render json: @toodoo_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @apiv1_item.update(apiv1_item_params)\n format.html { redirect_to @apiv1_item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @apiv1_item }\n else\n format.html { render :edit }\n format.json { render json: @apiv1_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n @item.save_info\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n @item_type = ItemType.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @item_type.update_attributes(params[:item_type])\r\n flash[:notice] = 'ItemType was successfully updated.'\r\n format.html { redirect_to(@item_type) }\r\n format.xml { head :ok }\r\n else\r\n format.html { render :action => \"edit\" }\r\n format.xml { render :xml => @item_type.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n @itemtipo = Itemtipo.find(params[:id])\n\n if @itemtipo.update(itemtipo_params)\n head :no_content\n else\n render json: @itemtipo.errors, status: :unprocessable_entity\n end\n end", "def update\n if @item.update(item_params)\n render json: @item, status: :ok\n else\n render json: @item.errors, status: :unprocessable_entity\n end\n end", "def updateItem(app, repo_url, item, id)\n headers = defaultHeaders(app[\"token\"])\n data = id.merge(item).to_json\n response = HTTParty.post(repo_url,\n headers: headers,\n body: data)\n response \nend", "def update\n \n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, :notice => 'Item was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_item\n @item = Item.find(params[:id])\n @item.update(params[:item])\n redirect \"/items/#{@item.id}\"\n end", "def rest_update(uri, method: Net::HTTP::Put)\n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request request\n response.value\n\n doc = REXML::Document.new response.body\n \n doc = strip_class_attributes(yield doc)\n \n request2 = method.new uri\n request2.content_type = 'application/xml'\n auth_admin(request2)\n\n request2.body=doc.to_s\n \n response2 = http.request request2\n response.value\n\n end\n \nend", "def update\n Rails.logger.debug params.inspect\n @item = Item.find(params[:id])\n respond_to do |format|\n if @item.update_attributes(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n respond_with(@items)\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @action_item = ActionItem.find(params[:id])\n\n respond_to do |format|\n if @action_item.update_attributes(params[:action_item])\n format.html { redirect_to(@action_item, :notice => 'Action item was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @action_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @item_info = ItemInfo.find(params[:id])\n\n respond_to do |format|\n if @item_info.update_attributes(params[:item_info])\n format.html { redirect_to @item_info, notice: 'Item info was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @content_item = ContentItem.find(params[:id])\n\n respond_to do |format|\n if @content_item.update_attributes(params[:content_item])\n flash[:notice] = 'ContentItem was successfully updated.'\n format.html { redirect_to(@content_item) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @content_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @magic_item.update(magic_item_params)\n format.html { redirect_to @magic_item, notice: 'Magic item was successfully updated.' }\n format.json { render :show, status: :ok, location: @magic_item }\n else\n format.html { render :edit }\n format.json { render json: @magic_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to items_path, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, :notice => 'Item was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n\n respond_to do |format|\n if @news_item.update_attributes(params[:news_item])\n format.html { redirect_to(news_items_path, :notice => t(\"screens.notice.successfully_updated\")) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @news_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\r\n @item = Item.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @item.update_attributes(params[:item])\r\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\r\n format.json { head :ok }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @item.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def set_generic_item\n @generic_item = GenericItem.find(params[:id])\n end", "def update\n @tipo_item = TipoItem.find(params[:id])\n\n respond_to do |format|\n if @tipo_item.update_attributes(params[:tipo_item])\n format.html { redirect_to @tipo_item, notice: 'Tipo item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tipo_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @items_mob = ItemsMob.find(params[:id])\n\n respond_to do |format|\n if @items_mob.update_attributes(params[:items_mob])\n flash[:notice] = 'ItemsMob was successfully updated.'\n format.html { redirect_to items_mob_url(@items_mob) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @items_mob.errors.to_xml }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def override\n document_id = params[:document_id]\n document = params[:document]\n document_type = params[:document_type]\n ticket = Document.ticket(Alfresco::Document::ALFRESCO_USER, Alfresco::Document::ALFRESCO_PASSWORD)\n\n builder = Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml|\n xml.entry(:xmlns => \"http://www.w3.org/2005/Atom\",\n \"xmlns:cmisra\" => \"http://docs.oasis-open.org/ns/cmis/restatom/200908/\",\n \"xmlns:cmis\" => \"http://docs.oasis-open.org/ns/cmis/core/200908/\") {\n xml.title document.original_filename if document\n xml.summary document_type\n if document\n xml.content(:type => document.content_type) {\n xml.text Base64.encode64(document.read)\n }\n end\n }\n end\n\n url = Document::PATH + \"cmis/i/#{document_id}?alf_ticket=\" + ticket\n\n begin\n RestClient.put url, builder.to_xml, {:content_type => 'application/atom+xml;type=entry'}\n rescue => e\n Rails.logger.info \"#\"*50\n Rails.logger.info \"Error updating file\"\n Rails.logger.info e.message\n Rails.logger.info \"#\"*50\n end\n\n redirect_to :controller => 'related_service_requests', :action => 'show', :anchor => 'documents', :service_request_id => params[:friendly_id], :id => params[:ssr_id]\n end", "def update\n @mostsmalliteminfo = Mostsmalliteminfo.find(params[:id])\n\n respond_to do |format|\n if @mostsmalliteminfo.update_attributes(params[:mostsmalliteminfo])\n format.html { redirect_to @mostsmalliteminfo, notice: 'Mostsmalliteminfo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mostsmalliteminfo.errors, status: :unprocessable_entity }\n end\n end\n end", "def item_update\n @item = Item.find(params[:id])\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to item_show_path(@item), notice: 'O item foi atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_item(item_id)\n @kind = 2\n @item_id = item_id\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { respond_with_bip(@item) }\n else\n format.html { render action: 'edit' }\n format.json { respond_with_bip(@item) }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n if (!params[:transport].blank? and [email protected]?(params[:transport]))\t then\n \t\t@transport = Transport.find((params[:transport])) \n\t\t\t\tbegin\n\t\t\t\t\t@itemtransports = @item.transports << @transport\n\t\t\t\t\t@wagon = @itemtransports.find(@transport).wagons.find_by_item_id(@item)\n\t\t\t\t\[email protected] = params[:wagon_vrn]\n\t\t\t\t\[email protected]_type = \"train\"\n\t\t\t\t\[email protected]\n\t\t\t\trescue Exception => e \n\t\t\t\t\t\tflash[:notice] = e.message \n \t\t\tend\t\n\t\tend\t\n respond_to do |format|\n if @item.update_attributes(params[:item]) \n flash[:notice] = 'Item was successfully updated.' if flash[:notice] == \"\"\n format.html { redirect_to(@item) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_save_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @defaultitem.update(defaultitem_params)\n format.html { redirect_to @defaultitem, notice: 'Defaultitem was successfully updated.' }\n format.json { render :show, status: :ok, location: @defaultitem }\n else\n format.html { render :edit }\n format.json { render json: @defaultitem.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_should_update_link_via_API_XML\r\n get \"/logout\"\r\n put \"/links/1.xml\", :link => {:user_id => 1,\r\n :title => 'API Link 1',\r\n :url => 'http://www.api.com'}\r\n assert_response 401\r\n end", "def test_putpoi_update_valid\n nd = create(:node)\n cs_id = nd.changeset.id\n user = nd.changeset.user\n amf_content \"putpoi\", \"/1\", [\"#{user.email}:test\", cs_id, nd.version, nd.id, nd.lon, nd.lat, nd.tags, nd.visible]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n\n assert_equal 5, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal nd.id, result[2]\n assert_equal nd.id, result[3]\n assert_equal nd.version + 1, result[4]\n\n # Now try to update again, with a different lat/lon, using the updated version number\n lat = nd.lat + 0.1\n lon = nd.lon - 0.1\n amf_content \"putpoi\", \"/2\", [\"#{user.email}:test\", cs_id, nd.version + 1, nd.id, lon, lat, nd.tags, nd.visible]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/2\")\n\n assert_equal 5, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal nd.id, result[2]\n assert_equal nd.id, result[3]\n assert_equal nd.version + 2, result[4]\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n @item.images.delete_all\n unless params.require(:item)[:images_id].nil?\n params.require(:item)[:images_id].each do |id|\n image = Image.find_by_id(id)\n (@item.images << image) unless image.nil?\n end\n end\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @instancia_item = InstanciaItem.find(params[:id])\n\n respond_to do |format|\n if @instancia_item.update_attributes(params[:instancia_item])\n format.html { redirect_to(@instancia_item, :notice => 'Instancia item was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @instancia_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: \"Item was successfully updated.\" }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: \"Item was successfully updated.\" }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: \"Item was successfully updated.\" }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: \"Item was successfully updated.\" }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @news_item = NewsItem.find(params[:id])\n\n respond_to do |format|\n if @news_item.update_attributes(params[:news_item])\n flash[:notice] = 'NewsItem was successfully updated.'\n format.html { redirect_to(@news_item) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @news_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @rackitem = Rackitem.find(params[:id])\n\n respond_to do |format|\n if @rackitem.update_attributes(params[:rackitem])\n format.html { redirect_to @rackitem, notice: 'Rackitem was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rackitem.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @goods_item = Goods::Item.find(params[:id])\n\n respond_to do |format|\n if @goods_item.update_attributes(params[:goods_item])\n format.html { redirect_to(@goods_item, :notice => 'Item was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @goods_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @inventory = Inventory.find(params[:id])\n @inventory.subtotal = (params[:inventory][:qty].to_f*@inventory.unit_price) if params[:inventory][:qty].present?\n if @inventory.update_attributes(params[:inventory])\n @inventories = current_company.inventories\n response_message = {:message => \"Item was updated successfully.\", :inventory => @inventory}\n else\n response_message = {:message => \"Please try again\"}\n end\n respond_to do |format|\n format.xml{render :xml => response_message }\n format.json{ render :json => response_message }\n end\n end" ]
[ "0.5891184", "0.588577", "0.58823144", "0.58461684", "0.5809623", "0.5789424", "0.5781747", "0.5779316", "0.577845", "0.57597697", "0.5738083", "0.57321125", "0.57308215", "0.57302815", "0.57264614", "0.57264614", "0.57264614", "0.5719591", "0.57094854", "0.56950957", "0.5693519", "0.5693519", "0.5673609", "0.56351215", "0.5635002", "0.5618637", "0.5616109", "0.56097746", "0.5602684", "0.55771804", "0.55556947", "0.554912", "0.5542352", "0.55041385", "0.54910386", "0.54798406", "0.5478684", "0.54778105", "0.5473467", "0.54710066", "0.54685974", "0.54263073", "0.54247606", "0.54190165", "0.5414157", "0.54110855", "0.5410036", "0.5409753", "0.54037625", "0.5395414", "0.53886914", "0.53868204", "0.538579", "0.53853315", "0.5384171", "0.5384171", "0.5384171", "0.5384171", "0.5384171", "0.5384171", "0.5384171", "0.5384171", "0.5384171", "0.5384171", "0.5384171", "0.53833944", "0.53802884", "0.5378445", "0.53764176", "0.537258", "0.537142", "0.5361525", "0.53604555", "0.5359547", "0.5358708", "0.5357882", "0.53543335", "0.53436357", "0.53388613", "0.53388613", "0.5334615", "0.5334383", "0.53277105", "0.53168756", "0.53117734", "0.5310333", "0.53081274", "0.5298803", "0.5286216", "0.5283837", "0.5280694", "0.5269028", "0.5262742", "0.5262742", "0.5262742", "0.5262742", "0.526264", "0.5261863", "0.5253218", "0.52473724" ]
0.7045057
0
DELETE /miscellaneous_items/1 DELETE /miscellaneous_items/1.xml
def destroy @miscellaneous_item = MiscellaneousItem.find(params[:id]) @miscellaneous_item.destroy respond_to do |format| format.html { redirect_to(miscellaneous_items_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @miscellaneous_child = MiscellaneousChild.find(params[:id])\n @miscellaneous_child.destroy\n\n respond_to do |format|\n format.html { redirect_to(miscellaneous_children_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end", "def delete_item(item)\n @get_items.delete(item)\n end", "def delete_item(item_id)\n response = Unirest.delete CONNECT_HOST + '/v1/' + LOCATION_ID + '/items/' + item_id,\n headers: REQUEST_HEADERS\n\n if response.code == 200\n puts 'Successfully deleted item'\n return response.body\n else\n puts 'Item deletion failed'\n puts response.body\n return nil\n end\nend", "def delete_all(xpath); end", "def delete_item\n\nend", "def remove_item(id)\n return nil if self.class.mode == :sandbox\n\n query = { \"type\" => \"delete\", \"id\" => id.to_s, \"version\" => Time.now.to_i }\n doc_request query\n end", "def delete\n blacklight_items.each do |r|\n solr.delete_by_id r[\"id\"]\n solr.commit\n end\n end", "def destroy\n @content_item = ContentItem.find(params[:id])\n @content_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(content_items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @actionitem = Actionitem.find(params[:id])\n @actionitem.destroy\n\n respond_to do |format|\n format.html { redirect_to(actionitems_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_items_url, :notice => 'Item was deleted.') }\n format.xml { head :ok }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\r\n @item = Item.find(params[:id])\r\n\r\n @item.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(items_url) }\r\n format.xml { head :ok }\r\n end\r\n end", "def delete\n Iterable.request(conf, base_path).delete\n end", "def destroy\n @item.destroy\n\n respond_to do |wants|\n wants.html { redirect_to(admin_items_url) }\n wants.xml { head :ok }\n end\n end", "def destroy\n\t\[email protected]\n\t\thead :no_content\n\tend", "def delete_data(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = 'text/xml'\n req.body = '<delete><query>*:*</query></delete>'\n response = @client.send_http(req, true, ['200'])\n end", "def delete\n @@all_items.delete(@id)\n end", "def destroy\n @item.destroy\n head :no_content\n end", "def destroy\n @action_item = ActionItem.find(params[:id])\n @action_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(action_items_url) }\n format.xml { head :ok }\n end\n end", "def destroy(item)\n raise StandardError unless @mode == :update\n @attached.delete(item)\n @remove_file.puts(XML.generate({ :id => item.is_a?(String) ? item : item.id }, false))\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(manage_items_url, :notice => 'Item was successfully deleted.') }\n format.xml { head :ok }\n end\n end", "def deleteItems\n self.items.each do |item|\n item.delete\n end\n end", "def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end", "def destroy\n @item = @course.items.find(:first, :conditions => ['lower(name) = ?', params[:id].downcase.gsub('_', ' ')])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(course_items_url(@course)) }\n format.xml { head :ok }\n end\n end", "def delete_item\n item_id = params[\"item_id\"]\n\n item = TextItem.find_by_id(item_id)\n item = Image.find_by_id(item_id) if item.nil?\n item = Collection.find_by_id(item_id) if item.nil?\n render_json :status => :not_found, :messages => \"Could not find the item with id #{item_id}.\" and return if item.nil?\n\n if item.class == Collection\n if params[\"id\"].nil?\n render_json :status => :bad_request, :messages => \"Can't delete a collection reference without providing the parent collection id. Please use the longer url for item deletion.\" and return\n end\n collection = Collection.find_by_id(params[\"id\"])\n else\n collection = Ownership.find_by_item_id(item_id).parent\n end\n;\n render_json :status => :not_found, :messages => \"Could not find parent collection for the item.\" and return if (collection.nil?)\n render_json :status => :forbidden, :messages => \"The user is not allowed to delete from this collection.\" and return if (!collection.delete?(@user, @client))\n\n collection.delete_item(item_id)\n render_json :entry => {} and return\n end", "def delete(items)\n item_ids = items.collect { |item| item.id }\n args = {ids: item_ids.to_json}\n return @client.api_helper.command(args, \"item_delete\")\n end", "def destroy\n @item = item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(budget_items_url) }\n format.xml { head :ok }\n end\n end", "def delete_item(id)\n record \"/todos/delete_item/#{id}\"\n end", "def destroy\n @instancia_item = InstanciaItem.find(params[:id])\n @instancia_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(instancia_items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @itemtipo.destroy\n\n head :no_content\n end", "def destroy_rest\n @item_usage = ItemUsage.find(params[:id])\n @item_usage.destroy\n\n respond_to do |format|\n format.html { redirect_to(item_usages_url) }\n format.xml { head :ok }\n end\n end", "def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end", "def destroy_rest\n @entry_item = EntryItem.find(params[:id])\n @entry_item.destroy\n\n respond_to do |format|\n #format.html { redirect_to(entry_items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @request = Request.find(params[:id])\n @request_items = @request.request_items\n @request_items.each do |ri|\n ri.destroy\n end\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to(requests_url) }\n format.xml { head :ok }\n end\n end", "def delete(*uris); end", "def test_delete\n ir = ItemRepository.new('./data/items_tiny.csv')\n assert_equal 1367, ir.collection.length\n ir.delete(263396013)\n actual = ir.collection.length\n expected = 1366\n assert_equal expected, actual\n end", "def destroy\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(items_url) }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end", "def delete_item(item)\n @chores.delete(item)\n end", "def destroy\n @items_mob = ItemsMob.find(params[:id])\n @items_mob.destroy\n\n respond_to do |format|\n format.html { redirect_to items_mobs_url }\n format.xml { head :ok }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(current_user) }\n format.xml { head :ok }\n end\n end", "def destroy\n @media_metadata_item = MediaMetadataItems.find(params[:id])\n @media_metadata_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(media_metadata_items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @item = @project.items.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(project_items_path(@project, :subdomain => @user.subdomain)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @news_items = NewsItem.find(params[:id])\n @news_items.destroy\n\n respond_to do |format|\n format.html { redirect_to(news_items_url) }\n format.xml { head :ok }\n end\n end", "def delete; rest_delete(link('self')); end", "def delete; rest_delete(link('self')); end", "def destroy\n @goods_item = Goods::Item.find(params[:id])\n @goods_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(goods_items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @listitem.destroy\n head :no_content\nend", "def deleted(item)\n end", "def destroy\n @question_item = QuestionItem.find(params[:id])\n @question_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(question_items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @item ||= Item.find_by_id_or_name(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(items_url) }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :ok }\n format.xml { head :ok }\n end\n end", "def destroy\r\n @lineitem = Lineitem.find(params[:id])\r\n @lineitem.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(lineitems_url) }\r\n format.xml { head :ok }\r\n end\r\n end", "def destroy\n @defaultitem.destroy\n respond_to do |format|\n format.html { redirect_to defaultitems_url, notice: 'Defaultitem was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @metabolite = Metabolite.find(params[:id])\n @metabolite.destroy\n\n respond_to do |format|\n format.html { redirect_to(metabolites_url) }\n format.xml { head :ok }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @media_item = MediaItem.find(params[:id])\n @media_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(media_items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @item = ItemTemplate.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(item_templates_url) }\n format.xml { head :ok }\n end\n end", "def destroy\r\n @item_type = ItemType.find(params[:id])\r\n @item_type.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(item_types_url) }\r\n format.xml { head :ok }\r\n end\r\n end", "def delete(item_ids = [])\n body = { itemIds: item_ids }\n Iterable.request(conf, base_path).delete(body)\n end", "def item_destroy\n @item = Item.find(params[:id])\n @item.destroy\n respond_to do |format|\n format.html { redirect_to item_index_path, notice: 'O item foi removido com sucesso.' }\n format.json { head :no_content }\n end\n end", "def delete_item(iid)\n params = {'pio_iid' => iid}.merge(default_params)\n @connection.delete(:items, iid, params).body\n end", "def remove_item\n\n end", "def destroy\n item = @item.name\n @item.deleted = true\n @item.deleted_at = Time.now\n @item.save\n\n respond_to do |format|\n format.html { redirect_to items_url, notice: \"#{item} was successfully deleted.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @news_item = NewsItem.find(params[:id])\n @news_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(news_items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n Item.all.each do |i|\n r = i.related_modules\n r = r.blank? ? [] : r.split(\",\").collect(&:strip)\n if r.include?(@item.id.to_s)\n r.delete(@item.id.to_s)\n i.update_attribute(\"related_modules\", r.join(\",\"))\n end\n end\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def delete_questions\n items = get_items\n\n\n keys = []\n items.map do |item|\n keys << {\n 'Question' => item['Question'],\n 'Answer' => item['Answer'].to_i\n }\n end\n\n keys.each do |key|\n DYNAMODB.delete_item({\n table_name: TABLE_NAME,\n key: key\n })\n end\n\n make_response(HttpStatus::OK, {meesage: 'questions deleted'})\nend", "def delete\n end", "def destroy\n @content_item = ContentItem.find(params[:id])\n @content_item.destroy\n\n respond_to do |format|\n format.html { redirect_to content_items_url }\n format.json { head :ok }\n end\n end", "def destroy\n @convenience_item.destroy\n respond_to do |format|\n format.html { redirect_to convenience_items_url, notice: 'Convenience item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n \n end", "def rm(*path)\n super; on_success{ nil }\n end", "def delete_item(item_id)\n raise \"implemented in subclass\"\n end", "def destroy\n @apiv1_item.destroy\n respond_to do |format|\n format.html { redirect_to apiv1_items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n \n end", "def delete_item(item)\r\n @list.delete(item)\r\n end", "def destroy\n @item.destroy!\n end", "def test_putpoi_delete_already_deleted\n nd = create(:node, :deleted)\n cs_id = nd.changeset.id\n user = nd.changeset.user\n\n amf_content \"putpoi\", \"/1\", [\"#{user.email}:test\", cs_id, nd.version, nd.id, nd.lon, nd.lat, nd.tags, false]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n\n assert_equal 3, result.size\n assert_equal -4, result[0]\n assert_equal \"node\", result[1]\n assert_equal nd.id, result[2]\n end", "def destroy\n @alfresco = Alfresco.find(params[:id])\n @alfresco.destroy\n\n respond_to do |format|\n format.html { redirect_to(alfrescos_url) }\n format.xml { head :ok }\n end\n end", "def delete\n\n end", "def delete(root, data)\n if data == nil\n return nil\n else\n item = self.find(root, data)\n item.title = nil\n item.rating = nil\n end\n end", "def destroy\n @news_item = NewsItem.find(params[:id])\n @news_item.destroy\n\n respond_to do |format|\n format.html { redirect_to news_items_url }\n format.xml { head :ok }\n end\n end", "def delete_item(db, item_name, current_user)\r\n db.execute(\"DELETE FROM items WHERE item_name = ? AND user_id = ?\", [item_name, current_user])\r\nend", "def destroy\n @transaction_group_item = TransactionGroupItem.find(params[:id])\n @transaction_group_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(transaction_group_transaction_group_items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @gallery_item = GalleryItem.find(params[:id])\n @gallery_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(gallery_items_url) }\n format.xml { head :ok }\n end\n end", "def delete\n end", "def delete\n end", "def delete\n end", "def delete\n end", "def delete\n end", "def delete\n end", "def delete\n end", "def destroy\n @list_item.destroy\n\n head :no_content\n end", "def destroy\n @item_alias = ItemAlias.find(params[:id])\n @item_alias.destroy\n\n respond_to do |format|\n format.html { redirect_to(item_aliases_url) }\n format.xml { head :ok }\n end\n end" ]
[ "0.65647507", "0.65392745", "0.6398129", "0.63070196", "0.6306006", "0.62958527", "0.62775135", "0.6276724", "0.62676466", "0.62266654", "0.6207234", "0.6201764", "0.61872166", "0.61872166", "0.61872166", "0.61872166", "0.61872166", "0.61872166", "0.61838245", "0.61692387", "0.6168736", "0.6160148", "0.61249673", "0.6114645", "0.6109459", "0.6105683", "0.6095095", "0.6092604", "0.60739136", "0.6069822", "0.6059881", "0.60546947", "0.6041761", "0.60311884", "0.60267186", "0.60186166", "0.59933835", "0.5990301", "0.5987272", "0.59841335", "0.5943201", "0.5936378", "0.5930822", "0.5926672", "0.59242666", "0.5916388", "0.5912306", "0.5907463", "0.59054387", "0.5903592", "0.58943915", "0.58943915", "0.588936", "0.5888354", "0.588658", "0.58858675", "0.58854425", "0.5882654", "0.5878693", "0.58635914", "0.58531666", "0.58439744", "0.584081", "0.5839273", "0.58319813", "0.5824287", "0.58228815", "0.58221656", "0.58179915", "0.5817667", "0.5810135", "0.5800211", "0.5799298", "0.5799213", "0.57943845", "0.5793913", "0.57934016", "0.57897395", "0.57894075", "0.5786728", "0.5782154", "0.57716775", "0.57713175", "0.57696223", "0.5767149", "0.57658315", "0.5757224", "0.575489", "0.57485473", "0.5747211", "0.57448477", "0.5744461", "0.5744461", "0.5744461", "0.5744461", "0.5744461", "0.5744461", "0.5744461", "0.5743822", "0.5742447" ]
0.73356366
0
GET /profiles GET /profiles.json
def index @profiles = Profile.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n authorize Profile\n @profiles = ProfilePolicy::Scope.new(current_user, @user.profiles).resolve\n render json: @profiles\n end", "def get_default_profile \n get(\"/profiles.json/default\")\nend", "def profiles \n personid = params[:id]\n @response = JSON.parse(current_user.access_token.token.get('/api/v0/aspects/profiles?ids=['+params[:id]+']'))\n respond_to do |format|\n format.html\n format.json {render :json=> @response, :callback=>params[:callback]}#{render json: @response}\n end\n end", "def index\n @profiles = Profile.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @profiles }\n end\n end", "def profiles\n collection(\"profiles\", paged: true)\n end", "def my_profiles\n @user = User.find(params[:user_id])\n @profiles = @user.profiles\n end", "def index\n @profiles = current_user.profiles\n end", "def index\n @profiles = current_user.profiles\n end", "def profiles(fields: nil)\n params = build_fields_params fields\n res = @connection.get profile_path, params\n map_as_collection res, Profile\n end", "def index\n @profiles = Profile.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @profiles }\n end\n end", "def show\n profile = Profile.find(params[:id])\n render status: 200, json: profile\n end", "def profile\n check_auth :profile\n \n response = connection.post do |req|\n req.url '/user/profile'\n req.body = { :format => @format }\n end\n response.body[0]\n end", "def show\n @profile = @user.profile\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end", "def index\n @profiles = Profile.all.paginate :page => params[:page], :per_page => 3\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @profiles }\n end\n end", "def profile(user_id: '-')\n return get(\"#{API_URI}/#{PROFILE_API_VERSION}/user/#{user_id}/profile.json\")\n end", "def show\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end", "def show\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end", "def show\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end", "def get_profile\n \n profil =\n Excon.get(\n 'https://eastus.api.cognitive.microsoft.com/speaker/identification/v2.0/text-independent/profiles',\n headers: {\n 'Content-Type' => 'application/json',\n 'Ocp-Apim-Subscription-Key' => \"3c43bca9ad884fe39518a5cf3925e707\"\n },\n body: JSON.generate(\"locale\": 'en-us')\n )\n return profil.body\n parsed = JSON.parse(profil.body)\n return parsed['profiles']\n rescue Excon::Error => e\n puts \"Error: #{e}\"\n\n end", "def show\n @profile = Profile.find(params[:id])\n render json: @profile.to_json(include_hash)\n end", "def show\n @profile = current_user.profile\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end", "def profile\n p @user.as_json\n render json: @user.as_json\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @user_profiles }\n end\n end", "def index\n @profiles = Profile.all\n @profile = Profile.find_by_id(params[:profile_id])\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end", "def index\n @profiles = Profile.all\n @original_niche = get_subscriber_details(@profiles, \"niche\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @profiles }\n end\n end", "def users_profile\n @usersProfile = User.find(params[:id]).to_json(:include => :user_connections)\n render json: { data: @usersProfile }\n end", "def get_profile_configuration(args = {}) \n get(\"/profiles.json/#{args[:profileId]}/configuration\", args)\nend", "def retrieve_profile(id, content_type)\n call(:get, path(\"#{id}/profiles/#{content_type}/\"))\n end", "def get_profile\n path = self.api_root + '/register/profile'\n process_firecloud_request(:get, path)\n end", "def profile(profile_name:)\n claim_url = \"#{@@profile_service_url}/profile/#{profile_name}/next\"\n response = Faraday.get claim_url\n profile = JSON.parse(response.body)\n raise \"No profile available for #{profile_name}\" unless profile\n profile\n end", "def index\n @skill_user_profiles = SkillUserProfile.all\n\n render json: @skill_user_profiles\n end", "def index\n @profiles = Profile.all\n respond_to do |format|\n format.html\n format.json do\n @profiles = Profile.near(\n [\n current_user.profile.latitude,\n current_user.profile.longitude\n ], params[:radius]\n ).distinct\n @profiles = @profiles.where.not(id: current_user.profile.id)\n @profiles = @profiles.min_age(params[:min_age]) if params[:min_age].present?\n @profiles = @profiles.max_age(params[:max_age]) if params[:max_age].present?\n @profiles = @profiles.by_gender(params[:gender]) if params[:gender].present?\n @profiles = @profiles.by_activity(params[:activity])\n\n render json: @profiles.map{|profile| profile.attributes.merge(image: profile.image.url(:medium))}\n end\n end\n end", "def index\n @profiles = current_user\n end", "def show\n @user_profile = UserProfile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_profile }\n end\n end", "def index\n @profiles = Profile.all\n\n end", "def index\r\n @profiles = Profile.all\r\n end", "def index\r\n @profiles = Profile.all\r\n end", "def index \n @profiles = Profile.all\n end", "def show\n\t\t# begin\n\t\t\tprofile = Profile.find(params[:id])\n\t @conversation = current_profile.find_conversation(profile)\n\t respond_to do |format|\n\t format.html {render \"profiles/#{profile._type.underscore}_show\"}\n\t format.json { render :json => @profile }\n\t end\n\t\t# rescue => error\n\t\t# \trender \"profiles/not_found\"\n\t\t# \tputs error.message\n\t\t# end\n end", "def index\n @profiles = Profile.all\n end", "def profile\n raw = client.get @json['user']['links']['self']\n client.factory.create(GoodData::Profile, raw)\n end", "def show\n @profile = current_user.profile\n\n # ToDo: error message if no profile is found for user\n\n puts 'Got profile='\n pp @profile\n \n\n puts 'got other_names='\n pp @profile.other_names\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @profile }\n format.json { render :json => @profile }\n end\n \n end", "def show\n @providers = @profile.providers_data\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @profile }\n end\n end", "def team_profile_get(options={})\n post(\"team.profile.get\", options)\n end", "def pull_profiles\n \tprofiles_from_api = self.client.profiles\n\t\tprofiles_array = []\n\t\tprofiles_from_api.each do |p|\n\t\t\tif p.service == \"twitter\"\n\t\t\t\tprofiles_array << p\n\t\t\tend\n\t\tend\n\t\tprofiles_array\n end", "def get_profile_information\n # body = {\n # cmd: \"get_profile_information\"\n # }\n\n end", "def profile\n # (1) the request go into the headers and grab the key authorization and give us the value back (this's the token our server gave us originally)\n # the server only knows about the system\n # byebug/\n token = request.headers[\"Authorization\"]\n # what makes it secure? only the server knows about the secret 'pegasuscode'; the data is encoded using this secret, only server knows it so when server gets the information back, it must be the same information server encoded using the secret. Otherwise, it will break.\n # server uses the secret to encode and decode information\n decoded_token = JWT.decode(token, 'pegasuscode', true, { algorithm: 'HS256' })\n\n user_id = decoded_token[0][\"user_id\"] # user id\n\n user = User.find(user_id)\n\n # get the user back\n render json: user\n end", "def show\n @profile = Profile.find_by_user_id(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile.to_json(:include => [:faculty, :course]) }\n end\n end", "def show\n @profiles = @grab.profiles\n end", "def user_profile(id)\n users(request(\"users/profile/#{id}.xml\", :auth => true))\n end", "def show_current\n user = current_user\n profile = Profile.find_by user_id: user.id\n\n render json: profile\n end", "def get_profile\n begin\n client.profile(fields: PROFILE_FIELDS)\n rescue Exception => e\n logger.error \"Linkedin #get_profile error #{e}\"\n end\n end", "def get_profile\n\n # Auth\n token = auth\n\n # Get Client info based on fields provided\n client = LinkedIn::Client.new(API_KEY, API_SECRET, token)\n client.profile(:fields => @profile_fields)\n end", "def profiles\n Management::Profile.all(self)\n end", "def profile(profile_id, fields: nil)\n check_not_empty profile_id, 'profile_id'\n params = build_fields_params fields\n res = @connection.get profile_path(profile_id), params\n Profile.new res.body, self\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @user_profile }\n end\n end", "def details\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n format.html # details.html.erb\n format.json { render json: @profile }\n end\n end", "def profile\n render_json 0,\"ok\",current_member.as_profile\n end", "def index\n @profile_attributes = current_user.profile_attributes\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @profile_attributes }\n format.json { render :json => @profile_attributes }\n end\n end", "def show\n @private_profile = PrivateProfile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @private_profile }\n end\n end", "def friend_requests\n friends = current_user.friends.where accepted: false\n profiles = friends.map{ |friend| Profile.find(friend.profile_id)}\n render json: profiles\n end", "def index\n @github_profiles = GithubProfile.all\n end", "def profiles; end", "def index\n @student_profiles = StudentProfile.all \n render json: @student_profiles\n end", "def profile\n service_response = UserManagement::ProfileDetail.new(params).perform\n render_api_response(service_response)\n end", "def GetProfileData()\n uri = URI(API_URL + 'me')\n\n return PerformRestrictedGet(uri)\n end", "def index\n @userprofiles = Userprofile.all\n end", "def show\n @profile = Profile.find(params[:id])\n @checkin = CheckIn.find_last_by_user_id(@profile.user_id)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end", "def show\n @profile = Profile.find(params[:id])\n @checkin = CheckIn.find_last_by_user_id(@profile.user_id)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end", "def profile_data(access_token)\n response = uphold_conn.get do |req|\n req.url UPHOLD_PROFILE_PATH\n req.respond_to? :json, content_type: /\\b(?i:json)$/\n req.headers[:Authorization] = \"Bearer #{access_token}\"\n end\n JSON.parse(response.body, symbolize_names: true)\n end", "def get_profile\n self.class.get '/members/private', @options\n end", "def profile\n render json: @current_user\n end", "def profile\n if object = send(:\"current_#{resource_name}\")\n self.resource = resource_class.to_adapter.get!(object.to_key)\n respond_with self.resource\n else\n render json: '', status: 404\n end\n end", "def index\n @user_profiles = UserProfile.paginate(page: params[:page])\n end", "def get_user_detail\n user_id = params[:id]\n user = User.find(user_id)\n\n render json: UserSerializer.new(user).profile_detail_hash\n end", "def fetch_profiles\n UI.message \"Fetching profiles...#{Sigh.config[:app_identifier]}\"\n results = profile_type.find_by_bundle_id(Sigh.config[:app_identifier])\n\n #Take the provisioning profile name into account\n #if Sigh.config[:provisioning_name].to_s.length > 0\n #filtered = results.select { |p| p.name.strip == Sigh.config[:provisioning_name].strip }\n #if Sigh.config[:ignore_profiles_with_different_name]\n #results = filtered\n #else\n #results = filtered if (filtered || []).count > 0\n #end\n #end\n\n if results \n return [results]\n else\n return []\n end\n \n\n\n #return results if Sigh.config[:skip_certificate_verification]\n\n #return results.find_all do |a|\n ## Also make sure we have the certificate installed on the local machine\n #installed = false\n #a.certificates.each do |cert|\n #file = Tempfile.new('cert')\n #file.write(cert.download_raw)\n #file.close\n #installed = true if FastlaneCore::CertChecker.installed?(file.path)\n #end\n #installed\n #end\n end", "def profile; Profile.get(self.profile_id); end", "def index\n @user_profiles = UserProfile.all\n end", "def index\n @user_profiles = UserProfile.all\n end", "def index\n @user_profiles = UserProfile.all\n end", "def index\n @user_profiles = UserProfile.all\n end", "def show\n @spot = Spot.find(params[:id])\n @users = UserSpots.find_all_by_spot_id(params[:id])\n @profiles = []\n @users.each { |item| @profiles << Profile.find_by_user_id(item.user_id) }\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: [@spot, @profiles] }\n end\n end", "def load_profiles()\n # read profiles\n puts \"Loading configs from #{@server_host}:#{@server_port}\" # Rails.logger.info\n\n res = Net::HTTP.start(@server_host, @server_port) {|http|\n http.open_timeout = 5\n http.read_timeout = 10\n http.get('/api/profiles')\n }\n raise \"HTTP status is not succeeded\" if res.code != '200'\n\n profiles_arr = JSON.parse(res.body)\n @table = ProfileTable.new(profiles_arr)\n end", "def show\n @profile = Profile.find(params[:id])\n end" ]
[ "0.77193916", "0.75128365", "0.7509529", "0.7472739", "0.7472042", "0.7427816", "0.7366555", "0.7366555", "0.72750694", "0.7274087", "0.72641665", "0.7193044", "0.7188361", "0.7108386", "0.7067094", "0.7061127", "0.7061127", "0.7061127", "0.70376235", "0.70244056", "0.6998496", "0.69944596", "0.69868696", "0.6953941", "0.6945046", "0.69386905", "0.68857354", "0.68722856", "0.68290424", "0.68181676", "0.67994905", "0.6797626", "0.67880327", "0.6787315", "0.6784548", "0.678381", "0.6768188", "0.6768188", "0.676778", "0.674113", "0.6739919", "0.6731092", "0.67164505", "0.66918886", "0.66899264", "0.66820556", "0.66730726", "0.6658243", "0.66564393", "0.665602", "0.66389567", "0.6624315", "0.6621164", "0.6606961", "0.6588223", "0.65740865", "0.65699077", "0.6564164", "0.6536532", "0.65364194", "0.6535799", "0.65349144", "0.65216404", "0.65155125", "0.64942306", "0.6490848", "0.6479874", "0.6478743", "0.64773226", "0.64773226", "0.6475865", "0.64756036", "0.64719605", "0.64664304", "0.646492", "0.6458085", "0.6454378", "0.64540434", "0.6445137", "0.6445137", "0.6445137", "0.6445137", "0.644153", "0.64351654", "0.64343166" ]
0.6856475
43
GET /profiles/1 GET /profiles/1.json
def show @posts = Post.where(hidden: false).where(:user_id => @profile.user.id).order('created_at DESC').page params[:page] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_default_profile \n get(\"/profiles.json/default\")\nend", "def my_profiles\n @user = User.find(params[:user_id])\n @profiles = @user.profiles\n end", "def show\n profile = Profile.find(params[:id])\n render status: 200, json: profile\n end", "def index\n authorize Profile\n @profiles = ProfilePolicy::Scope.new(current_user, @user.profiles).resolve\n render json: @profiles\n end", "def profiles \n personid = params[:id]\n @response = JSON.parse(current_user.access_token.token.get('/api/v0/aspects/profiles?ids=['+params[:id]+']'))\n respond_to do |format|\n format.html\n format.json {render :json=> @response, :callback=>params[:callback]}#{render json: @response}\n end\n end", "def index\n @profiles = Profile.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @profiles }\n end\n end", "def profile\n check_auth :profile\n \n response = connection.post do |req|\n req.url '/user/profile'\n req.body = { :format => @format }\n end\n response.body[0]\n end", "def show\n @profile = @user.profile\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end", "def show\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end", "def show\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end", "def show\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end", "def index\n @profiles = current_user.profiles\n end", "def index\n @profiles = current_user.profiles\n end", "def index\n @profiles = Profile.all\n @profile = Profile.find_by_id(params[:profile_id])\n end", "def profile(user_id: '-')\n return get(\"#{API_URI}/#{PROFILE_API_VERSION}/user/#{user_id}/profile.json\")\n end", "def index\n @profiles = Profile.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @profiles }\n end\n end", "def get_profile_configuration(args = {}) \n get(\"/profiles.json/#{args[:profileId]}/configuration\", args)\nend", "def retrieve_profile(id, content_type)\n call(:get, path(\"#{id}/profiles/#{content_type}/\"))\n end", "def show\n @profile = current_user.profile\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end", "def profile(profile_name:)\n claim_url = \"#{@@profile_service_url}/profile/#{profile_name}/next\"\n response = Faraday.get claim_url\n profile = JSON.parse(response.body)\n raise \"No profile available for #{profile_name}\" unless profile\n profile\n end", "def show\n @profile = Profile.find(params[:id])\n render json: @profile.to_json(include_hash)\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end", "def index\n @profiles = Profile.all.paginate :page => params[:page], :per_page => 3\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @profiles }\n end\n end", "def show\n @user_profile = UserProfile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_profile }\n end\n end", "def profile\n p @user.as_json\n render json: @user.as_json\n end", "def index\n @profiles = Profile.all\n @original_niche = get_subscriber_details(@profiles, \"niche\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @profiles }\n end\n end", "def show\n\t\t# begin\n\t\t\tprofile = Profile.find(params[:id])\n\t @conversation = current_profile.find_conversation(profile)\n\t respond_to do |format|\n\t format.html {render \"profiles/#{profile._type.underscore}_show\"}\n\t format.json { render :json => @profile }\n\t end\n\t\t# rescue => error\n\t\t# \trender \"profiles/not_found\"\n\t\t# \tputs error.message\n\t\t# end\n end", "def get_profile\n path = self.api_root + '/register/profile'\n process_firecloud_request(:get, path)\n end", "def profile; Profile.get(self.profile_id); end", "def get_profile\n \n profil =\n Excon.get(\n 'https://eastus.api.cognitive.microsoft.com/speaker/identification/v2.0/text-independent/profiles',\n headers: {\n 'Content-Type' => 'application/json',\n 'Ocp-Apim-Subscription-Key' => \"3c43bca9ad884fe39518a5cf3925e707\"\n },\n body: JSON.generate(\"locale\": 'en-us')\n )\n return profil.body\n parsed = JSON.parse(profil.body)\n return parsed['profiles']\n rescue Excon::Error => e\n puts \"Error: #{e}\"\n\n end", "def profiles\n collection(\"profiles\", paged: true)\n end", "def profile\n raw = client.get @json['user']['links']['self']\n client.factory.create(GoodData::Profile, raw)\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @user_profiles }\n end\n end", "def show\n @profile = Profile.find(params[:id])\n end", "def show\n @profile = Profile.find(params[:id])\n end", "def show\n @profile = Profile.find(params[:id])\n end", "def show\n @profile = Profile.find(params[:id])\n end", "def show\n @profile = Profile.find(params[:id])\n end", "def show\n @profile = Profile.find(params[:id])\n end", "def index\n @profiles = Profile.all\n end", "def index\n @profiles = Profile.all\n end", "def index\n @profiles = Profile.all\n end", "def index\n @profiles = Profile.all\n end", "def index\n @profiles = Profile.all\n end", "def index\n @profiles = Profile.all\n end", "def index\n @profiles = Profile.all\n end", "def index\n @profiles = Profile.all\n end", "def index\n @profiles = Profile.all\n end", "def index\n @profiles = Profile.all\n end", "def index\n @profiles = Profile.all\n end", "def index\n @profiles = Profile.all\n end", "def index\n @profiles = Profile.all\n end", "def index\n @profiles = Profile.all\n end", "def index\n @profiles = Profile.all\n end", "def index\n @profiles = Profile.all\n end", "def show\n @profile = Profile.find(params[:id])\n @checkin = CheckIn.find_last_by_user_id(@profile.user_id)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end", "def show\n @profile = Profile.find(params[:id])\n @checkin = CheckIn.find_last_by_user_id(@profile.user_id)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end", "def show\n @profile = current_user.profile\n\n # ToDo: error message if no profile is found for user\n\n puts 'Got profile='\n pp @profile\n \n\n puts 'got other_names='\n pp @profile.other_names\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @profile }\n format.json { render :json => @profile }\n end\n \n end", "def details\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n format.html # details.html.erb\n format.json { render json: @profile }\n end\n end", "def index\n @profiles = Profile.all\n\n end", "def index\n @profiles = current_user\n end", "def index \n @profiles = Profile.all\n end", "def profile\n @oneuser = User.find_by(username: params[:username]) \n profile = user_profile(@oneuser.id, @oneuser.username, @oneuser.email, @oneuser.first_name, @oneuser.last_name, @oneuser.avatar_img, @oneuser.created_at) \n render json: profile\n end", "def show\n @private_profile = PrivateProfile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @private_profile }\n end\n end", "def user_profile(id)\n users(request(\"users/profile/#{id}.xml\", :auth => true))\n end", "def index\r\n @profiles = Profile.all\r\n end", "def index\r\n @profiles = Profile.all\r\n end", "def index\n @profiles = Profile.all\n end", "def users_profile\n @usersProfile = User.find(params[:id]).to_json(:include => :user_connections)\n render json: { data: @usersProfile }\n end", "def find_profile\n\t\t# Find particular Profile \n\t\t@profile = Profile.where(id:params[:id])[0]\n\t\trender json: {success: false, message: 'Invalid Profile ID !'}, status: 400 if @profile.nil?\n\tend", "def profile\n @profile ||= GATEWAY.get_profile_details(self.profile_id) unless profile_id.nil?\n end", "def get_profile\n begin\n client.profile(fields: PROFILE_FIELDS)\n rescue Exception => e\n logger.error \"Linkedin #get_profile error #{e}\"\n end\n end", "def profile\n render_json 0,\"ok\",current_member.as_profile\n end", "def show\n @profiles = @grab.profiles\n end", "def show_current\n user = current_user\n profile = Profile.find_by user_id: user.id\n\n render json: profile\n end", "def profile\n if object = send(:\"current_#{resource_name}\")\n self.resource = resource_class.to_adapter.get!(object.to_key)\n respond_with self.resource\n else\n render json: '', status: 404\n end\n end", "def get_profile_information\n # body = {\n # cmd: \"get_profile_information\"\n # }\n\n end", "def getUserProfile(uid)\r\n uri = sprintf(\"/api/v1/users/%d/profile\",uid)\r\n dbg(uri)\r\n profile = $canvas.get(uri)\r\n return profile\r\nend", "def getUserProfile(uid)\r\n uri = sprintf(\"/api/v1/users/%d/profile\",uid)\r\n dbg(uri)\r\n profile = $canvas.get(uri)\r\n return profile\r\nend", "def show\n \t@profile = Profile.where(profile_name: params[:id]).first\n end", "def profile\n service_response = UserManagement::ProfileDetail.new(params).perform\n render_api_response(service_response)\n end", "def profile(profile_id, fields: nil)\n check_not_empty profile_id, 'profile_id'\n params = build_fields_params fields\n res = @connection.get profile_path(profile_id), params\n Profile.new res.body, self\n end", "def profile\n @user = UserService.getUserById(params[:id])\n end", "def profile\n # (1) the request go into the headers and grab the key authorization and give us the value back (this's the token our server gave us originally)\n # the server only knows about the system\n # byebug/\n token = request.headers[\"Authorization\"]\n # what makes it secure? only the server knows about the secret 'pegasuscode'; the data is encoded using this secret, only server knows it so when server gets the information back, it must be the same information server encoded using the secret. Otherwise, it will break.\n # server uses the secret to encode and decode information\n decoded_token = JWT.decode(token, 'pegasuscode', true, { algorithm: 'HS256' })\n\n user_id = decoded_token[0][\"user_id\"] # user id\n\n user = User.find(user_id)\n\n # get the user back\n render json: user\n end", "def profiles(fields: nil)\n params = build_fields_params fields\n res = @connection.get profile_path, params\n map_as_collection res, Profile\n end", "def index\n @skill_user_profiles = SkillUserProfile.all\n\n render json: @skill_user_profiles\n end", "def get_user_detail\n user_id = params[:id]\n user = User.find(user_id)\n\n render json: UserSerializer.new(user).profile_detail_hash\n end", "def index\n @github_profiles = GithubProfile.all\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @user_profile }\n end\n end", "def show\n @providers = @profile.providers_data\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @profile }\n end\n end", "def show\n @profile = @user.profile\n end", "def get_profile\n\n # Auth\n token = auth\n\n # Get Client info based on fields provided\n client = LinkedIn::Client.new(API_KEY, API_SECRET, token)\n client.profile(:fields => @profile_fields)\n end", "def get_profile\n self.class.get '/members/private', @options\n end", "def profile\n @user = User.find(params[:id])\n end", "def show\n @profile_attribute = current_user.profile_attributes.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @profile_attribute }\n format.json { render :json => @profile_attribute }\n end\n end", "def profile_url\n @json['profile']['url'] rescue nil\n end", "def user\n\n \n @profile = Profile.find_by_user_id(params[:id])\n\n\nend", "def profile\n\n end", "def show\n @profile = Profile.find(params[:id]) || current_user.profile\n end", "def profile\n \t@user = UsersService.findUserById(params[:id])\n end", "def show\n @pay_profile = PayProfile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pay_profile }\n end\n end" ]
[ "0.7775649", "0.74931335", "0.74876684", "0.736598", "0.7305961", "0.7302657", "0.7301793", "0.72450936", "0.72319347", "0.72319347", "0.72319347", "0.72181976", "0.72181976", "0.71651715", "0.71410364", "0.7114219", "0.70800215", "0.7046293", "0.70175827", "0.69905627", "0.6979416", "0.6963506", "0.6949695", "0.6949417", "0.6944366", "0.69396454", "0.6939536", "0.693113", "0.689453", "0.68904406", "0.68776876", "0.6877267", "0.68713915", "0.68072224", "0.68072224", "0.68072224", "0.68072224", "0.68072224", "0.68072224", "0.68003213", "0.68003213", "0.68003213", "0.68003213", "0.68003213", "0.68003213", "0.68003213", "0.68003213", "0.68003213", "0.68003213", "0.68003213", "0.68003213", "0.68003213", "0.68003213", "0.68003213", "0.68003213", "0.6794084", "0.6794084", "0.6785742", "0.6778292", "0.6747371", "0.6733857", "0.673254", "0.6726048", "0.6722431", "0.6712619", "0.67064255", "0.67064255", "0.6694039", "0.66878724", "0.6684493", "0.66746897", "0.66709715", "0.6670069", "0.66673183", "0.66668266", "0.6663944", "0.6662953", "0.66600823", "0.66600823", "0.6630042", "0.6615606", "0.66123694", "0.66001725", "0.65985155", "0.65976495", "0.6587206", "0.65623456", "0.65559983", "0.6549218", "0.65359396", "0.65318197", "0.65105855", "0.65088606", "0.6495757", "0.64841706", "0.64789206", "0.6470903", "0.6460017", "0.64593554", "0.6449851", "0.64454615" ]
0.0
-1
POST /profiles POST /profiles.json
def create @profile = Profile.new(profile_params) authorize @profile respond_to do |format| if @profile.save format.html { redirect_to @profile, notice: 'Profile was successfully created.' } format.json { render :show, status: :created, location: @profile } else format.html { render :new } format.json { render json: @profile.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @profile = current_user.profiles.build(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render action: 'show', status: :created, location: @profile }\n else\n format.html { render action: 'new' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n\n if @profile.save\n render json: @profile, status: :created\n else\n render json: @profile.errors, status: :unprocessable_entity\n end\n end", "def create\n @profile = Profile.create({\n name: params['profile']['name'],\n speciality: params['profile']['speciality'],\n city: params['profile']['city'],\n user_id: current_user['id']\n })\n @profile.save\n respond_with(@profile)\n end", "def create\n logger.info(\"CREATE PROFILE #{params[:profile].inspect}\")\n @profile = Profile.new(params[:profile])\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(params[:profile])\n @profile.profile_id = UUIDTools::UUID.timestamp_create().to_s\n @profile.user_id = current_user.id\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to users_profile_index_path, notice: t(:profile_successfully_created) }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(params[:profile])\n \n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, :notice => 'Profile was successfully created.' }\n format.json { render :json => @profile, :status => :created, :location => @profile }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @profiles = current_user.profiles.new(profile_params)\n\n if @profiles.save\n redirect_to profiles_path, notice: 'Profile was successfully created.'\n else\n render :new\n end\n end", "def create\n # Buidles a profile in association witht eh user\n @user = User.find(current_user.id)\n @profile = @user.build_profile(params[:user])\n @profile.update_attributes(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n\n @profile.user = current_user\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to root_path, notice: t('controller.profiles.create.success') }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n respond_to do |format|\n if @profile.save\n format.html do\n redirect_to @profile, notice:\n \"Profile was successfully created.\"\n end\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json do\n render json: @profile.errors,\n status: :unprocessable_entity\n end\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to root_path, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to '/', notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = current_user.build_profile\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, :notice => 'Profile was successfully created.' }\n format.json { render :json => @profile, :status => :created, :location => @profile }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n\n @profile.user = current_user\n \n respond_to do |format|\n if @profile.save\n \n # Get photos directly from the params and save them to the database one by one\n if params[:profile][:photos]\n params[:profile][:photos].each { |photo|\n ProfilePhoto.create!(profile: @profile, photo: photo)\n }\n end\n \n format.html { redirect_to @profile, notice: 'profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render action: 'show', status: :created, location: @profile }\n else\n format.html { render action: 'new' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n @profile.save\n \n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n @user = current_user\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n params[:profile][:tag_list] = params[:profile][:tag_list]\n @profile = Profile.new(profile_params)\n @profile.user_id = current_user.id\n\n # Store friendly profile URI\n current_user.profile_uri = getUniqueURI(current_user) \n current_user.save\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to profile_path(@profile), notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n @profile.user_id = current_user.id\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n @profile.user_id = current_user.id\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n @profile.user_id = current_user.id\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @profile = Profile.new(profile_params)\r\n\r\n respond_to do |format|\r\n if @profile.save\r\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\r\n format.json { render :show, status: :created, location: @profile }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @profile.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @profile = Profile.new(profile_params)\n authorize @profile\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to quit_user_profile_path, notice: \"Profile: #{I18n.t('helpers.saved')}\" }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n respond_to do |format|\n if @profile.save\n format.html { redirect_to manage_profile_path(@profile), notice: 'Profile was successfully created.' }\n format.json { render action: 'show', status: :created, location: @profile }\n else\n format.html { render action: 'new' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n @profile.user_id = current_user.id\n\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n @profile.my_id = current_user.id\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to profiles_path, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = current_user.build_profile(pro_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { redirect_to new_profile_path, alert: 'Please fill all fields' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = @account.build_profile(profile_attributes)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to root_path, notice: 'Анкета успешно сохранена. Ваш магазин добавлен в очередь на оптимизацию.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: 'new' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n \n @profile.user_id = current_user.id\n @profile.full_name = @profile.first_name + @profile.last_name\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, :notice => t('alerts.profiles.create') }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n @profile.user=current_user\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # TO DO: make this for just generic creation.\n @profile = Profile.find_by_email(params[:profile][:email])\n @profile.user_id = current_user.id\n\n if @profile.nil?\n @profile = Profile.new(params[:profile])\n add_to_list_niche(params[:profile][:fname], params[:profile][:email], params[:profile][:niche], list_id=ENV[\"MAILCHIMP_LISTID\"])\n @profile.save\n else\n @profile.update_attributes(params[:profile])\n end\n\n redirect_to profiles_path, notice: 'Profile was successfully created.' \n # format.json { render json: @profile, status: :created, location: @profile }\n end", "def create\n @profile = Profile.new(params[:profile])\n @profile.user_id = current_user.id\n authorize! :create, @profile\n \n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @security_profile = Security::Profile.new(security_profile_params)\n @security_profile.user_created_id = current_user.id\n respond_to do |format|\n if @security_profile.save\n format.html { redirect_to security_profiles_path, notice: I18n.t('profiles.controller.create')}\n format.json { render :show, status: :created, location: @security_profile }\n else\n format.html { render :new }\n format.json { render json: @security_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user_profile = UserProfile.new(params[:user_profile])\n\n respond_to do |format|\n if @user_profile.save\n format.html { redirect_to @user_profile, notice: 'User profile was successfully created.' }\n format.json { render json: @user_profile, status: :created, location: @user_profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user_profile = UserProfile.new(params[:user_profile])\n\n respond_to do |format|\n if @user_profile.save\n format.html { redirect_to @user_profile, notice: 'User profile was successfully created.' }\n format.json { render json: @user_profile, status: :created, location: @user_profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n respond_to do |format|\n @profile = current_user.create_profile(params[:profile])\n if @profile \n format.html { redirect_to(profile_url(@profile.user_id), :notice => 'Profile was successfully created.') }\n format.xml { render :xml => @profile, :status => :created, :location => @profile }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n profile = Payments::Profile.new(profile_params)\n profile.user = current_user\n\n respond_to do |format|\n if profile.save\n format.html {redirect_to payments_profiles_path}\n else\n format.html {redirect_to :back, flash: {error: \"Error saving payment profile\"}}\n end\n end\n end", "def create\n @profile = Profile.new(params[:profile])\n authorize! :update, @profile\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n current_user.profile = Profile.new(params[:profile])\n @profile = current_user.profile\n\n if [email protected]?\n flash[:error_created] = @profile.errors.full_messages.join(\"<br>\").html_safe\n redirect_to new_user_profile_path(current_user)\n else\n respond_to do |format|\n if @profile.save\n format.html { redirect_to user_profile_path(current_user), notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end \n end\n end", "def create\n @userprofile = Userprofile.new(userprofile_params)\n\n respond_to do |format|\n if @userprofile.save\n format.html { redirect_to @userprofile, notice: 'Userprofile was successfully created.' }\n format.json { render :show, status: :created, location: @userprofile }\n else\n format.html { render :new }\n format.json { render json: @userprofile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_profile\n new_profile = Profile.new\n new_profile.user_id = self.id\n new_profile.save!\n end", "def create\n if current_user.profile.nil?\n profile = Profile.new(profile_params)\n profile.user = current_user\n if profile.save\n redirect_to profiles_path\n return\n end\n end\n redirect_to profiles_path\n end", "def create\n \n @user.profile = Profile.new(params[:profile])\n if params[:goal_worth]\n @goal = @user.goals.create do |g|\n g.goal_type = \"recurring\"\n g.started_on = Date.today\n g.name = \"What my time is worth\"\n g.goal_amount_score = params[:goal_worth].to_i\n end\n else\n @goal = nil\n end\n \n respond_to do |format|\n \n if @user.profile && @goal\n \n format.html { redirect_to user_profiles_path, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n user = User.find(params[:user_id])\n @profile = Profile.new(params[:profile])\n @profile.user = user\n\n if @profile.save\n redirect_to user_profile_path(params[:user_id])\n else\n flash[:alert] = @profile.errors.full_messages.join(\",\")\n render :template => \"profiles/new\"\n end\n\n end", "def create\n @profile = Profile.new(req_params)\n if @profile.save\n redirect_to new_partnership_path(p_id: @profile.id)\n else\n flash[:profile_attempt] = req_params\n respond_with_submission_error(@profile.errors.messages, new_dummy_profile_path)\n end\n end", "def add_profile(post, profile)\n post[:profile] = profile\n post[:profileupdate] = 'Y'\n end", "def create\n @admin_profile = Admin::Profile.new(admin_profile_params)\n\n respond_to do |format|\n if @admin_profile.save\n unless params[:admin_profile][:avatar].blank?\n preloaded = Cloudinary::Uploader.upload(params[:admin_profile][:avatar], :use_filename => true, :public_id => \"profiles/#{@admin_profile.id}\")\n end\n\n unless params[:admin_profile][:profile_skills_attributes].blank?\n params[:admin_profile][:profile_skills_attributes].each do |skill|\n admin_skill = Admin::ProfileSkill.create({profile_id: @admin_profile.id, name: skill[1][:name], skill: skill[1][:skill]})\n admin_skill.save\n end\n end\n\n unless params[:admin_profile][:profile_hobbies_attributes].blank?\n params[:admin_profile][:profile_hobbies_attributes].each do |hobby|\n admin_hobby = Admin::ProfileHobby.create({profile_id: @admin_profile.id, name: hobby[1][:name]})\n admin_hobby.save\n end\n end\n\n format.html { redirect_to admin_root_path, notice: 'Profile was successfully created.' }\n format.json { render action: 'show', status: :created, location: @admin_profile }\n else\n format.html { render action: 'new'}\n format.json { render json: @admin_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n Userprofile.create(\"name\" => params[\"full_name\"], \"photo_url\" => params[\"url\"])\n redirect_to \"/userprofiles\"\n end", "def set_profile(profile_contents)\n path = self.api_root + '/register/profile'\n process_firecloud_request(:post, path, profile_contents.to_json)\n end", "def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n flash[:notice] = 'Profile was successfully created.'\n format.html { redirect_to profile_url(@profile) }\n format.xml { head :created, :location => profile_url(@profile) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @profile.errors.to_xml }\n end\n end\n end", "def create\n \t@profile = Profile.new(profile_params)\n\n \trespond_to do |format|\n if @profile.save\n UserMailer.delay.registration_confirmation(@profile)\n format.json { render action: 'show', status: :create, location: @profile }\n else\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user_profile = UserProfile.new(user_profile_params)\n\n respond_to do |format|\n if @user_profile.save\n format.html { redirect_to @user_profile, notice: 'User profile was successfully created.' }\n format.json { render :show, status: :created, location: @user_profile }\n else\n format.html { render :new }\n format.json { render json: @user_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def my_profiles\n @user = User.find(params[:user_id])\n @profiles = @user.profiles\n end", "def create\n @profile = Profile.new(profile_params)\n if params['internal_setting_ids'].present?\n params['internal_setting_ids'].each do |internal_setting_id|\n @profile_internal_setting = @profile.profile_internal_settings.build(:internal_setting_id => internal_setting_id)\n @profile_internal_setting.save\n end \n end\n\n if params['email_access_ids'].present?\n params['email_access_ids'].each do |email_access_id|\n @profile_email_access = @profile.profile_email_accesses.build(:email_access_id => email_access_id)\n @profile_email_access.save\n end \n end\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n @profile.user_id = current_user.id\n\n respond_to do |format|\n if @profile.save\n good_change(format, :created)\n else\n bad_change(format, :new)\n end\n end\n end", "def create\n @user_profile = UserProfile.new(user_profile_params) \n\n respond_to do |format| \n if @user_profile.save\n format.html { redirect_to @user_profile, notice: 'User profile was successfully created.' }\n format.json { render :show, status: :created, location: @user_profile }\n else\n format.html { render :new }\n format.json { render json: @user_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile_user = ProfileUser.new(profile_user_params)\n\n respond_to do |format|\n if @profile_user.save\n format.html { redirect_to @profile_user, notice: 'Profile user was successfully created.' }\n format.json { render :show, status: :created, location: @profile_user }\n else\n format.html { render :new }\n format.json { render json: @profile_user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @github_profile = GithubProfile.new(github_profile_params)\n\n respond_to do |format|\n if @github_profile.save\n format.html { redirect_to @github_profile, notice: 'Github profile was successfully created.' }\n format.json { render :show, status: :created, location: @github_profile }\n else\n format.html { render :new }\n format.json { render json: @github_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n flash[:notice] = 'Profile was successfully created.'\n format.html { redirect_to(@profile) }\n format.xml { render :xml => @profile, :status => :created, :location => @profile }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n flash[:notice] = 'Profile was successfully created.'\n format.html { redirect_to(@profile) }\n format.xml { render :xml => @profile, :status => :created, :location => @profile }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n flash[:notice] = 'Profile was successfully created.'\n format.html { redirect_to(@profile) }\n format.xml { render :xml => @profile, :status => :created, :location => @profile }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end", "def profile_params\n params.require(:profile).permit(:user_id, :name, :surname, :age, :profile_picture, :gender, :relationship_status)\n end", "def create\n @cleaners_profile = Cleaners::Profile.new(cleaners_profile_params)\n\n respond_to do |format|\n if @cleaners_profile.save\n format.html { redirect_to after_signup_path(:preference) }\n format.json { render action: 'show', status: :created, location: @cleaners_profile }\n else\n format.html { render action: 'new' }\n format.json { render json: @cleaners_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n\n @user = current_user\n\n @user.profile = @profile\n @profile.save\n\n\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to profile, notice: 'Profile was successfully created.' }\n format.json { render :show, profile: :created, location: profile }\n @profile.create(profile_image: image)\n\n else\n format.html { render :new }\n format.json { render json: status.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @representative_profile = RepresentativeProfile.new(representative_profile_params)\n\n respond_to do |format|\n if @representative_profile.save\n format.html { redirect_to @representative_profile, notice: 'Representative profile was successfully created.' }\n format.json { render :show, status: :created, location: @representative_profile }\n else\n format.html { render :new }\n format.json { render json: @representative_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(params[:profile])\n @profile.user = current_user\n respond_to do |format|\n if @profile.save\n flash[:notice] = t('profiles.new.success')\n format.html { redirect_to(@user) }\n format.xml { render :xml => @profile, :status => :created, :location => @user }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @personal_profile = PersonalProfile.new(personal_profile_params)\n @personal_profile.user_id=current_user.id\n respond_to do |format|\n if @personal_profile.save\n format.html { redirect_to resume_path, notice: 'Personal profile was successfully created.' }\n format.json { render :show, status: :created, location: resume_path }\n else\n format.html { render :new }\n format.json { render json: @personal_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @profile = Profile.new\n @profile.build_user\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @profile }\n end\n end", "def profile_params\n params.require(:profile).permit(:name, :bio, :country_id, :picture, interest_ids: [])\n end", "def profiles \n personid = params[:id]\n @response = JSON.parse(current_user.access_token.token.get('/api/v0/aspects/profiles?ids=['+params[:id]+']'))\n respond_to do |format|\n format.html\n format.json {render :json=> @response, :callback=>params[:callback]}#{render json: @response}\n end\n end", "def update_profile(params)\n post 'account/update_profile', :post => params\n end", "def create_profile\n Profile.create(user_id: self.id)\n end", "def create\n respond_to do |format|\n if @user_profile.save\n format.html { redirect_to @user_profile, :notice => 'Корисничкиот профил е успешно создаден.' }\n format.json { render :json => @user_profile, :status => :created, :location => @user_profile }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @user_profile.errors, :status => :unprocessable_entity }\n end\n end\n end", "def assign_default_profile(args = {}) \n put(\"/profiles.json/#{args[:profileId]}/default\", args)\nend", "def create\n @client_profile = ClientProfile.new(client_profile_params)\n\n respond_to do |format|\n if @client_profile.save\n format.json { render :show, status: :created, location: @client_profile }\n else\n format.json { render json: @client_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user_profile = UserProfile.new(user_profile_params)\n\n respond_to do |format|\n if @user_profile.save\n flash[:success] = 'User profile was successfully created.'\n format.html { redirect_to @user_profile}\n format.json { render :show, status: :created, location: @user_profile }\n else\n flash[:danger] = \"There are some mistakes, please try again\"\n format.html { render :new }\n format.json { render json: @user_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n authorize Profile\n @profiles = ProfilePolicy::Scope.new(current_user, @user.profiles).resolve\n render json: @profiles\n end", "def create\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n @profile.site_identifier = params[:profile][:site_identifier]\n\n respond_to do |format|\n if @profile.save\n# current_user.default_profile = @profile\n set_banner\n format.html do\n redirect_to profile_home_path(@profile.site_identifier), notice: 'Profile was successfully created.'\n end\n format.json { render action: 'show', status: :created, location: profile_home_path(@profile.site_identifier) }\n else\n format.html { render action: 'new' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # Ensure that we have the right user\n @user = User.find( params[:user_id] )\n # Create profile linked to this specific user\n @profile = @user.build_profile( profile_params )\n @profile.save\n if @profile.save\n flash[:success] = \"Profile updated!\"\n # TODO: Redirect to profile page, once there is one. \n redirect_to user_path(params[:user_id])\n else\n # TODO: don't dump the user's inputs if save to database fails. \n render action: :new\n end\n end", "def create\n assign_params_to_attributes\n @profile = Profile.new(params[:profile])\n @profile.user_id = current_user.id\n if @profile.save\n flash[:notice] = I18n.t('profile.create.notice')\n redirect_to user_path(current_user)\n else\n @user = current_user\n assing_attributes_to_params\n flash.now[:error] = I18n.t('profile.create.error')\n render :action => \"new\"\n end\n end" ]
[ "0.73701555", "0.7367171", "0.72288865", "0.71786684", "0.7172963", "0.7170674", "0.71145105", "0.7096289", "0.707034", "0.7002038", "0.7002038", "0.7002038", "0.7002038", "0.7002038", "0.7002038", "0.7002038", "0.6997514", "0.69700205", "0.69617796", "0.6937631", "0.6937631", "0.6937631", "0.6937631", "0.6937631", "0.6937631", "0.6937631", "0.6937631", "0.69146293", "0.69033545", "0.6885607", "0.68802375", "0.6870222", "0.68624455", "0.6859433", "0.6858937", "0.6858937", "0.6858937", "0.68550336", "0.6835788", "0.683444", "0.683444", "0.6829081", "0.68168384", "0.6766037", "0.67580324", "0.6755173", "0.6739768", "0.6721227", "0.66896856", "0.6656213", "0.6624241", "0.66153675", "0.6593402", "0.658363", "0.658363", "0.6582606", "0.65731853", "0.6565113", "0.6556708", "0.65421325", "0.6523615", "0.6523474", "0.65118587", "0.649321", "0.6491338", "0.6482218", "0.6480695", "0.6472119", "0.6464902", "0.6459156", "0.6436519", "0.6423614", "0.6421916", "0.638889", "0.63844866", "0.63807064", "0.6350672", "0.6344352", "0.6339668", "0.6339668", "0.6339668", "0.6338429", "0.63312715", "0.63294077", "0.63256717", "0.6323012", "0.63147956", "0.6311688", "0.62725914", "0.62598944", "0.62459344", "0.624297", "0.6238812", "0.6235083", "0.6233593", "0.62270284", "0.6220057", "0.6217489", "0.6204191", "0.6203904" ]
0.62169695
98
PATCH/PUT /profiles/1 PATCH/PUT /profiles/1.json
def update respond_to do |format| if @profile.update(profile_params) format.html { redirect_to vanity_profile_path(:id => @profile.user.name), notice: 'Profile was successfully updated.' } format.json { render :show, status: :ok, location: @profile } else format.html { render :edit } format.json { render json: @profile.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @profiles = current_user.profiles.find(params[:id])\n\n respond_to do |format|\n if @profiles.update(profile_params)\n format.html { redirect_to profiles_path, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profiles }\n else\n format.html { render :edit }\n format.json { render json: @profiles.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @profile = Profile.find(params[:id])\n logger.debug(\"UPDATE PROFILE @profile = #{@profile.inspect}\")\n logger.debug(\"UPDATE PROFILE params = #{params[:profile].inspect}\")\n logger.debug(\"UPDATE PROFILE update_attributes #{@profile.update_attributes(params[:profile]).inspect}\")\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @profile.update(profile_params)\n respond_with(@profile)\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to edit_profile_path(current_user.profile), notice: t('controller.profiles.update.success') }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @profile = current_user.profile\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to @profile, :notice => 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to user_path, notice: 'Profile was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_profile(body={})\n perform_post(\"/account/update_profile.json\", :body => body)\nend", "def update\n if user_signed_in?\n if @profile.update(profile_params)\n render json: @profile, status: :ok\n else\n render json: @profile.errors, status: :unprocessable_entity\n end\n end\n end", "def update\n @profile = Profile.find(current_user.id)\n @profile.update_attributes(params[:profile])\n respond_with @profile\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n Rails.logger.info(\"PARAMS: #{profile_params}\")\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @profile = current_user.profile\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to (user_profile_path(current_user)), notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n #format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n #format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to root_url, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n #@profile = UsersDisciplines.find(params[:id])\n @profile = Profile.find_by_user_id(current_user.id)\n \n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to users_profile_index_path, notice: t(:profile_successfully_updated) }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to root_path, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n new_properties = params[:d]\n profile = Profile[params[:id]]\n profile.update_with(new_properties)\n\n respond_with(profile) do |format|\n format.json { render json: profile.stripped }\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to '/', notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to edit_profile_path(), notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html do\n redirect_to @profile,\n notice: \"Profile was successfully updated.\"\n end\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json do\n render json: @profile.errors,\n status: :unprocessable_entity\n end\n end\n end\n end", "def update\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n if @profile.update_attributes(profile_attributes)\n format.html { redirect_to root_path, notice: 'Анкета успешно обновлена.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n params = profile_params\r\n params.delete(\"id\")\r\n params.delete(\"user\")\r\n respond_to do |format|\r\n if @profile.update(params)\r\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @profile }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @profile.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n current_user.admin? ? true : params[:profile][:id] = current_user.id\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n current_user.admin? ? true : params[:profile][:id] = current_user.id\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n respond_to do |format|\r\n if @profile.update(profile_params)\r\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @profile }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @profile.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n good_change(format, :ok)\n else\n bad_change(format, :edit)\n end\n end\n end", "def update\n @profile = @user.profile \n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n flash[:notice] = t('profiles.new.success')\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end", "def assign_default_profile(args = {}) \n put(\"/profiles.json/#{args[:profileId]}/default\", args)\nend", "def update_profile! (data = {})\n check_auth :update\n \n response = connection.put do |req|\n req.url '/user/update'\n req.body = { :format => @format }.merge(data)\n end\n response\n end", "def update\n @profile = @user.profile\n @profile.update_attributes(params[:profile])\n if params[\"starting\"] == \"pending\"\n @profile.started_on = nil\n @profile.target_completion_date = nil\n end\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to user_profile_path, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update_attributes profile_params\n format.html { redirect_to(@profile, notice: 'Profile was successfully updated.') }\n format.xml { head :ok }\n else\n @original_profile = Profile.find(@profile.id)\n format.html { render action: \"edit\" }\n format.xml { render xml: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\t\t@user = current_user\n\t\t@profile = @user.profile\n\t\[email protected]_columns(profile_params)\n\t\trespond_with @profile \n\tend", "def update\n respond_to do |format|\n if @profile.update(pro_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n # This must be update_attributes, to do validations\n if @profile.update(profile_params)\n format.html { redirect_to profile_home_path(@profile.site_identifier), notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @profile = Profile.find_by_user_id(current_user.id)\n authorize! :update, @profile\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update_attributes(profile_params)\n format.html {\n flash[:notice] = t('Profile was successfully update.')\n redirect_to home_path\n }\n format.json { render json: {ok: true}, status: :ok }\n else\n format.html { redirect_to profile_edit_url, notice: t('Profile not saved !') }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n @profile.photo.data.blank? ? @profile.photo.update_attributes(photo_type: 2) : @profile.photo.update_attributes(photo_type: 1)\n\n current_user.user_tries.last.state_machine.transition_to(:pending)\n format.html { redirect_to root_path, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n flash[:notice] = 'Profile was successfully updated.'\n format.html { redirect_to profile_path(@profile.user_id) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n \n # Get photos directly from the params and save them to the database one by one\n if params[:profile][:photos]\n params[:profile][:photos].each { |photo|\n ProfilePhoto.create(profile: @profile, photo: photo)\n }\n end\n \n format.html { redirect_to @profile, notice: 'profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def clear_default_profile \n put(\"/profiles.json/default/clear\")\nend", "def update\n # FIXME There's probably a better way to manage STI.\n profile_params = (@profile.type == DeveloperProfile.to_s ? params[:developer_profile] : params[:contractor_profile])\n profile_params[:project_type_ids] ||= []\n\n respond_to do |format|\n if @profile.update_attributes(profile_params)\n format.html { redirect_to(profile_path(@profile), :notice => 'Profile was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_profile(params)\n post 'account/update_profile', :post => params\n end", "def update_profile(params)\n post('/account/update_profile.json', params)\n end", "def update\n respond_to do |format|\n if @profile.update_attributes params[:profile]\n @profile.user.index!\n format.html { redirect_to get_stored_location, :notice => t('profile.profile_updated') }\n else\n format.html { render :action => :edit }\n end\n end\n end", "def update\n @profile = current_user.profile\n respond_to do |format|\n if @profile\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to(@profile, :notice => 'Profile was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n else\n format.html { render :text => \"You currently do not have a profile.\" }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to profile_path, notice: \"Book was successfully updated.\" }\n format.json { render profile_path, status: :ok, location: @profile }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @personal_profile.update(personal_profile_params)\n format.html { redirect_to resume_path, notice: 'Your Personal profile was successfully updated.' }\n format.json { render :show, status: :ok, location: resume_path }\n else\n format.html { render :edit }\n format.json { render json: @personal_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user_profile = UserProfile.find(params[:id])\n\n respond_to do |format|\n if @user_profile.update_attributes(params[:user_profile])\n format.html { redirect_to @user_profile, notice: 'User profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user_profile = UserProfile.find(params[:id])\n\n respond_to do |format|\n if @user_profile.update_attributes(params[:user_profile])\n format.html { redirect_to @user_profile, notice: 'User profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Din profil uppdaterades!' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to [@stakeholder, @profile], notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: [@stakeholder, @profile] }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n flash[:notice] = 'Profile was successfully updated.'\n format.html { redirect_to(@profile) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n # render :text => \"<pre>#{params.to_yaml}</pre>\" and return\n @profile = Profile.find(params[:id])\n # @profile = Profile.find_or_create_by_user_id(@user.id)\n unless params.empty?\n @profile.update_attributes(params[:profile])\n @profile.user.update_attributes(params[:user])\n end\n respond_to do |format|\n if @profile.errors.empty? && @profile.user.errors.empty?\n flash[:notice] = 'Profile was successfully updated.'\n format.html { redirect_to(@profile) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @profile.errors + @profile.user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n authorize @profile\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to quit_user_profile_path , notice: \"Profile: #{I18n.t('helpers.saved')}\" }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @profile = Profile.find(params[:id])\n @profile.user_id = current_user.id\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n flash[:notice] = 'Profile was successfully updated.'\n format.html { redirect_to(show_user_path(current_user.username)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_profile(body)\n post(\"user/#{user_id}/profile.json\", body)\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n format.js\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @profile = current_user.profile\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n flash[:notice] = \"Ваш профиль успешно обновлён\"\n format.html { redirect_to(profile_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @profile = Profile.find(params[:id])\n\t\t\n\t\t# Check to see if this user matches the profile, if not don't let them do anything\n\t\tif @profile.id != Profile.find_by_user_id(current_user.id).id\n \tredirect_to :permission_error\n end\n\t\t\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n flash[:notice] = 'Your profile was successfully updated'\n format.html { render action: 'edit', notice: 'Profile was successfully updated' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n # byebug\n if @profile.update(profile_params)\n format.html { redirect_to vendor_path(current_user.username), notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: t(\"controller.shared.flash.update.notice\", model: pick_model_from_locale(:profile)) }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n current_user.profile.update_attributes(profile_params)\n redirect_to '/profiles'\n end", "def update\n @profile_attribute = current_user.profile_attributes.find(params[:id])\n\n respond_to do |format|\n if @profile_attribute.update_attributes(params[:profile_attribute])\n format.html { redirect_to(@profile_attribute, :notice => 'Profile attribute was successfully updated.') }\n format.xml { head :ok }\n format.json { render :json => {:profile_attribute => @profile_attribute} }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @profile_attribute.errors, :status => :unprocessable_entity }\n format.json { render :json => {:error => @profile_attribute.errors.full_messages} }\n end\n end\n end", "def update_profile\n \t@user = User.find_by_id(params[:id])\n \tif @user.nil?\n render :json => {:message => \"User not exists\"}, :status => :not_acceptable\n else\n \tbegin\n\t @user.update_attributes(params[:user])\n\t @user.save!\n\t render :json => {:success => true, :message => \"User updated\", :user =>@user}, :status => :ok\n\t rescue Exception => e\n\t \tp e.backtrace\n\t render :json => {:success => false, :message => e.backtrace}, :status => :not_acceptable\n\t end\n end\n end", "def update\n respond_to do |format|\n if @client_profile.update(client_profile_params)\n format.json { render :show, status: :ok, location: @client_profile }\n else\n format.json { render json: @client_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize! :update, @profile\n respond_to do |format|\n if @user.update_attributes(params[:user].permit(:username)) && @profile.update_attributes(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # puts \"profile_params: #{profile_params[:sport_ids]}\"\n\n respond_to do |format|\n begin\n if current_user != @profile.user\n performing_follow?\n @profile.user.toggle_followed_by(current_user)\n # the next two lines are all about the redirecting or the 'resheshing' of a page so that you can see the result of follow and unfollow without having to refresh.\n format.html { redirect_to @profile.user }\n format.json { render :show, status: :ok, location: @profile }\n end\n\n @profile.update(profile_params)\n # add skill objects and save to db\n # profile_params[:sport_ids].each do |sport_id|\n # Skill.create!(profile_id: @profile.user.id, sport_id: sport_id)\n # end\n format.html { redirect_to profile_url, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n rescue\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @profile = Profile.find_by_user_id(params[:user_id])\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n flash[:notice] = 'Profile was successfully updated.'\n format.html { redirect_to profile_url(@profile) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @profile.errors.to_xml }\n end\n end\n end", "def update\n @profile = Profile.find(params[:id])\n @profile.update_attributes(profile_params)\n @profile = Profile.all\n respond_to do |page|\n page.js\n end\n end", "def update_profile(options = {}) \n # query profile info\n response = HTTP.auth('Bearer ' + Asca::Tools::Token.new_token).get(URI_PROFILES, :params => { 'filter[name]' => options[:name] })\n if response.status.success?\n responseObj = JSON.parse(response.body)\n queried_profile_list = responseObj[\"data\"]\n if queried_profile_list.length() > 0\n profile = queried_profile_list[0]\n end\n else\n Asca::Tools::Log.error(response.body)\n return\n end\n \n if !profile\n Asca::Tools::Log.error(\"No profile named #{options[:name]} found\")\n return\n end\n # create new profile\n profile_type = profile[\"attributes\"][\"profileType\"]\n \n # get bundle id\n response = HTTP.auth('Bearer ' + Asca::Tools::Token.new_token).get(profile[\"relationships\"][\"bundleId\"][\"links\"][\"self\"])\n bundle_id = JSON.parse(response.body)[\"data\"][\"id\"]\n response = HTTP.auth('Bearer ' + Asca::Tools::Token.new_token).get(profile[\"relationships\"][\"certificates\"][\"links\"][\"self\"])\n certificate_ids = JSON.parse(response.body)[\"data\"].map { |cer| cer[\"id\"] }\n \n # get all device ids\n device_ids = Asca::REST::Provisioning::Devices.list_devices.map { |device|\n device[\"id\"]\n }\n \n # delete old prifile\n delete_profile :name => options[:name]\n \n if profile_type.include? 'APP_STORE'\n create_new_profile :name => options[:name], :type => profile_type, :bundle_id => bundle_id, :certificate_ids => certificate_ids\n else\n create_new_profile :name => options[:name], :type => profile_type, :bundle_id => bundle_id, :device_ids => device_ids, :certificate_ids => certificate_ids\n end\n \n return true\n end", "def update\n respond_to do |format|\n if @user_profile.update(user_profile_params)\n format.html { redirect_to @user_profile, notice: 'User profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_profile }\n else\n format.html { render :edit }\n format.json { render json: @user_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @user_profile.update(user_profile_params)\n format.html { redirect_to @user_profile, notice: 'User profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_profile }\n else\n format.html { render :edit }\n format.json { render json: @user_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @profile = Profile.find(params[:id])\n\n if @profile.update_attributes(params[:profile])\n redirect_to @profile, notice: 'Profile was successfully updated.'\n else\n render action: \"edit\"\n end\n end", "def update\n begin\n @profile.update!(metadata_profile_params)\n rescue => e\n render partial: \"shared/validation_messages\",\n locals: { object: @profile.errors.any? ? @profile : e },\n status: :bad_request\n else\n toast!(title: \"Profile updated\",\n message: \"The metadata profile \\\"#{@profile.name}\\\" has been \"\\\n \"updated.\")\n render \"shared/reload\"\n end\n end", "def update\n @profile = Profile.find(params[:id])\n work_name\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to(@profile, :notice => 'Profile ha sido modificado.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @user_profile.update(user_profile_params)\n format.html { redirect_to @user_profile, notice: \"User profile was successfully updated.\" }\n format.json { render :show, status: :ok, location: @user_profile }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @user_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @profile.update(req_params)\n redirect_to show_path, notice: 'Profile was successfully updated.'\n else\n respond_with_submission_error(@profile.errors.messages, edit_path)\n end\n end", "def create_or_update_profile_configuration(args = {}) \n id = args['profileId']\n temp_path = \"/profiles.json/{profileId}/configuration\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"profileId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend" ]
[ "0.7386528", "0.7121499", "0.711318", "0.7097071", "0.709138", "0.709138", "0.709138", "0.70766556", "0.70632905", "0.70601624", "0.7022545", "0.7013014", "0.69967467", "0.69850945", "0.69850945", "0.69850945", "0.69850945", "0.69791424", "0.69747424", "0.69681233", "0.69671464", "0.69605917", "0.6953953", "0.69490415", "0.69403267", "0.69403267", "0.69403267", "0.69403267", "0.69403267", "0.69403267", "0.69403267", "0.69403267", "0.69403267", "0.69403267", "0.69403267", "0.69403267", "0.69403267", "0.69403267", "0.69403267", "0.69284284", "0.69264", "0.6924001", "0.69150996", "0.6912262", "0.6905045", "0.6905045", "0.6870392", "0.6862952", "0.68530697", "0.6843191", "0.6835309", "0.6822894", "0.6817279", "0.68145174", "0.6809094", "0.6805991", "0.6782728", "0.67603743", "0.67586553", "0.67430556", "0.673675", "0.67353773", "0.6733912", "0.67284787", "0.67152846", "0.67125946", "0.6702125", "0.66917264", "0.66729105", "0.66572434", "0.66572434", "0.665593", "0.66520846", "0.6642918", "0.66244566", "0.661496", "0.6586954", "0.65655893", "0.65604573", "0.6552024", "0.65432507", "0.653926", "0.6537456", "0.6535197", "0.65335125", "0.6527844", "0.6524451", "0.651059", "0.65013325", "0.6499231", "0.64982134", "0.64878976", "0.64701885", "0.64701885", "0.64594287", "0.64586645", "0.64423394", "0.6437", "0.6430338", "0.6425869" ]
0.70704883
8
DELETE /profiles/1 DELETE /profiles/1.json
def destroy @profile.destroy respond_to do |format| format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :ok }\n end\n end", "def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :ok }\n end\n end", "def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :ok }\n end\n end", "def destroy\n # @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_path, :notice => \"profile was successfully delete.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, :notice => t('alerts.profiles.destroy') }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile = current_user.profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n \[email protected]\n\n \trespond_to do |format|\n \t\tprofiles = Profile.all\n \t\tformat.json { render json: profiles}\n \tend\n end", "def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n end", "def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: \"Profile was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n # @profile = Profile.find(params[:id])\n # authorize! :destroy, @profile\n\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: '*Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to(profiles_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to(profiles_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user_profile = UserProfile.find(params[:id])\n @user_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to user_profiles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_profile = UserProfile.find(params[:id])\n @user_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to user_profiles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to(profiles_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to(profiles_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to(profiles_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to(profiles_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to(profiles_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to user_profiles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile.destroy\n end", "def destroy\n raise params.inspect\n @user_profile = UserProfile.find(params[:id])\n @user_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to user_profiles_url }\n format.json { head :ok }\n end\n end", "def destroy\n @profile.destroy\n @profile.requests.destroy_all\n @profile.member.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'El perfil fue eliminado exitosamente.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.xml { head :ok }\n end\n end", "def destroy\n @user.profile.destroy\n respond_to do |format|\n format.html { redirect_to(profiles_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @profile.destroy\n respond_to do |format|\n\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to disciplines_url }\n format.json { head :ok }\n end\n end", "def destroy\n # Delete profile\n @profil.destroy\n respond_to do |format|\n format.html { redirect_to profils_url, notice: 'Profil was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile.destroy\n respond_to do |format|\n format.html do\n redirect_to profiles_url, notice:\n \"Profile was successfully destroyed.\"\n end\n format.json { head :no_content }\n end\n end", "def destroy\n @users_profile = Users::Profile.find(params[:id])\n @users_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_profiles_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profile_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n redirect_to profiles_url\n end", "def destroy\r\n @profile.destroy\r\n respond_to do |format|\r\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @profile = @user.profile\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to user_path(@user) }\n format.json { head :no_content }\n end\n #redirect_to user_path(@user)\n end", "def destroy\n authorize @profile\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: \"Profile: #{I18n.t('helpers.deleted')}\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile.destroy\n redirect_to '/'\n end", "def destroy\n @profile.destroy\n respond_with(@profile)\n end", "def destroy\n @profile.destroy\n session[:profile_id] = nil\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to partnerships_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @pay_profile = PayProfile.find(params[:id])\n @pay_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to pay_profiles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @client_profile.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @personal_profile.destroy\n respond_to do |format|\n format.html { redirect_to resume_path, notice: 'Personal profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_profile = UserProfile.find(params[:id])\n @user_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_profiles_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user_profile.destroy\n respond_to do |format|\n format.html { redirect_to user_profiles_url, notice: 'User profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Perfil destruido correctamente.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile_detail.destroy\n respond_to do |format|\n format.html { redirect_to profile_details_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_profile.destroy\n respond_to do |format|\n format.html { redirect_to admin_profiles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n if current_profile!=@profile\n redirect_to root_url, notice: 'Permission denied'\n end\n\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @private_profile = PrivateProfile.find(params[:id])\n @private_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to private_profiles_url }\n format.json { head :no_content }\n end\n end", "def clear_default_profile \n put(\"/profiles.json/default/clear\")\nend", "def destroy\n @project_profile.destroy\n respond_to do |format|\n format.html { redirect_to project_profiles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n authorize @client_profile\n \n @client_profile.destroy\n respond_to do |format|\n format.html { redirect_to client_profiles_url, notice: 'Client profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @retailer_profile.destroy\n respond_to do |format|\n format.html { redirect_to retailer_profiles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @userprofile.destroy\n respond_to do |format|\n format.html { redirect_to userprofiles_url, notice: 'Userprofile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @github_profile.destroy\n respond_to do |format|\n format.html { redirect_to github_profiles_url, notice: 'Github profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_profile = UserProfile.find(params[:id])\n @user_profile.destroy\n\n format.html { redirect_to(user_profiles_url) }\n end", "def destroy\n @vet_profile.destroy\n respond_to do |format|\n format.html { redirect_to vet_profiles_url, notice: 'Vet profile was successfully removed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @monitor_profile = MonitorProfile.find(params[:id])\n @monitor_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to monitor_profiles_url }\n format.json { head :ok }\n end\n end" ]
[ "0.7739456", "0.7739456", "0.7739456", "0.7707937", "0.77065504", "0.77065504", "0.77065504", "0.77065504", "0.77065504", "0.77065504", "0.77065504", "0.77065504", "0.7706363", "0.7704212", "0.769637", "0.7687797", "0.7687588", "0.7687588", "0.76273435", "0.7588475", "0.75627995", "0.75245315", "0.7503449", "0.75018144", "0.7498817", "0.7498817", "0.74581385", "0.74581385", "0.7456729", "0.7456729", "0.7456729", "0.7456729", "0.7456729", "0.7454245", "0.742901", "0.7427498", "0.7422489", "0.74219066", "0.74209017", "0.7410241", "0.7405282", "0.7403725", "0.7402013", "0.73968756", "0.7396158", "0.7385945", "0.73832124", "0.7320039", "0.73195565", "0.73191196", "0.7318569", "0.72908765", "0.7288395", "0.72759897", "0.72652495", "0.7219208", "0.7190267", "0.71853673", "0.717773", "0.7173035", "0.7170404", "0.71691376", "0.7147211", "0.71275276", "0.7123824", "0.71233344", "0.71214837", "0.7120485", "0.7112716", "0.70621276", "0.7058789", "0.70282286" ]
0.74744916
48
Use callbacks to share common setup or constraints between actions.
def set_profile @profile = Profile.friendly.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def profile_params params.require(:profile).permit(:user_id, :display_name, :image, :banner, :slug, :bio, :website, :twitter) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def safe_params\n params.require(:user).permit(:name)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def active_code_params\n params[:active_code].permit\n end", "def filtering_params\n params.permit(:email)\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def list_params\n params.permit(:name)\n end", "def filter_parameters; end", "def filter_parameters; end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def url_whitelist; end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def permit_request_params\n params.permit(:address)\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def url_params\n params[:url].permit(:full)\n end", "def backend_user_params\n params.permit!\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076", "0.62894756", "0.6283177", "0.6242471", "0.62382483", "0.6217549", "0.6214457", "0.6209053", "0.6193042", "0.6177802", "0.6174604", "0.61714715", "0.6161512", "0.6151757", "0.6150663", "0.61461", "0.61213595", "0.611406", "0.6106206", "0.6105114", "0.6089039", "0.6081015", "0.6071004", "0.60620916", "0.6019971", "0.601788", "0.6011056", "0.6010898", "0.6005122", "0.6005122", "0.6001556", "0.6001049", "0.59943926", "0.5992201", "0.59909594", "0.5990628", "0.5980841", "0.59669393", "0.59589154", "0.5958826", "0.5957911", "0.5957385", "0.5953072", "0.59526145", "0.5943361", "0.59386164", "0.59375334", "0.59375334", "0.5933856", "0.59292704", "0.59254247", "0.5924164", "0.59167904", "0.59088355", "0.5907542", "0.59064597", "0.5906243", "0.5898226", "0.589687", "0.5896091", "0.5894501", "0.5894289", "0.5891739", "0.58860534", "0.5882406", "0.587974", "0.58738774", "0.5869024", "0.58679986", "0.5867561", "0.5865932", "0.5864461", "0.58639693", "0.58617616", "0.5861436", "0.5860451", "0.58602303", "0.5854586", "0.58537364", "0.5850427", "0.5850199" ]
0.0
-1
Make sure these word lists exist
def word_list_exists(name) begin $current_case.count("word-list:\"#{name}\"") return true rescue Exception => exc return false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_for_definitions\n @words.each do |word|\n @lemma ? lemma = \" - #{@lemmas[word]}\" : lemma = \"\"\n\n # Strip characters - mimics trimWordLowerCase in texts.js\n regex = /[\\u200B-\\u200D\\uFEFF\\u00A0]/\n word.gsub!(regex, \"\")\n regex = /^[.,!¡?¿:;\\/|\\\\'\"“”‘’‚„«»‹›()\\[\\]\\-_]+|[.,!¡?¿:;\\/|\\\\'\"“”‘’‚„«»‹›()\\[\\]\\-_]+$/\n word.gsub!(regex, \"\")\n \n next if word.length == 0\n \n # Convert to lowercase\n word = word.mb_chars.downcase.to_s\n current_word = word\n \n while word.length > 0 do\n if Match.find_by_word_and_text_id(word, @text)\n break\n else\n if word.length == 1\n @missing.push(\"#{current_word}#{lemma}\")\n break\n else\n if word.last == \"*\"\n word.chomp!(\"*\") # Remove wildcard character, if present\n word = word[0..-2] # Remove last character\n end\n word << \"*\" # Add wildcard character\n end\n end\n end\n end\n end", "def test\n dict_list = make_list\n #make sure they're the same length\n if @word1.length != @word2.length\n puts \"Error: Words of different lengths\"\n false\n #make sure it is in the dictionary file\n elsif (!dict_list.include?(@word1)||!dict_list.include?(@word2))\n puts \"Error: Word does not exist\"\n false\n else\n true\n end\n end", "def check(words:)\n dictionary = Set.new([\"hello\", \"my\", \"name\", \"is\", \"orange\"])\n corrected = []\n words.each do | word |\n dictionary.include?(word) ? corrected.push(word) : corrected.push(\"~#{word}~\")\n end\n corrected\nend", "def valid_words(rack)\n # Load the words\n list_of_words = load_words\n array_of_valid_words = []\n # for each word check if all the letters of word are in rack\n list_of_words.each do |word|\n array_of_valid_words << word if check_word(word, rack)\n end\n array_of_valid_words\nend", "def real_words(permutations, wordlist)\n validwords = []\n wordlist = wordlist.to_set\n permutations.each { |x| validwords << x if wordlist.include?(x) }\n validwords\nend", "def load_necessary_words\n necessary_words = []\n\n necessary_spellings.each do |spelling|\n if @table.key?(spelling)\n necessary_words << @table[spelling]\n else\n $stderr.puts \"Warning! #{spelling} is a necessary word but it is not in the corpus.\"\n end\n end\n\n necessary_words\n end", "def set_word_list\n word_list = []\n min_length = 5\n max_length = 12\n # Fixed external word_list file has only one word per line\n if File.exist? \"../word_list.txt\"\n File.open(\"../word_list.txt\").each do |line|\n line_clean = line.chomp\n if (line_clean.length >= min_length && line_clean.length <= max_length)\n word_list.push(line_clean)\n end\n end\n else\n word_list.push(\"FileWordListTextDoesNotExist\")\n end\n return word_list\n end", "def test_standard_words\n @words = @tester.words(42)\n @words.each {|w| assert @standard_wordlist.include?(w) }\n end", "def check_against_bad_word_list(attrs_to_check)\n attrs_to_check.each do |attribute|\n check = check_bad_word_list(attribute)\n model.errors.add(attribute, I18n.translate('activerecord.errors.messages')[check]) unless check.nil?\n end\n end", "def invalid_word? word\n\t\tstopwords_list.collect{ |w| w if w.include? word.to_s.strip }.uniq.any?\n\tend", "def test_find_words_none_exist\n words =['apple', 'candy']\n dict = Set['zebra','ultra']\n assert_equal Set[], @grapher.find_words(words, dict)\n end", "def valid_words\n return @valid_words if @valid_words && @valid_words.length > 0\n\n @valid_words = Set.new\n @io.each_line do |l|\n l.encode!('UTF-8', 'UTF-8', invalid: :replace, undef: :replace, replace: '')\n # Funny story, in place methods are faster.\n l.gsub!(/[^[:alnum:]^[:blank:]]/, \"\")\n l.downcase!\n l.strip!\n # Only 'short' words (discard numbers only)\n l.split(\" \").reject{|w| /\\A\\d+\\z/.match(w) || w.length < 3 || w.length > 10}.each do |w|\n @valid_words.add(w)\n end\n end\n @valid_words\n end", "def test_supplemental_words\n @words = @tester.words(number: 10_000, supplemental: true)\n\n @words.each { |w| assert_includes @complete_wordlist, w }\n end", "def test_supplemental_words\n @words = @tester.words(number: 10_000, supplemental: true)\n\n @words.each { |w| assert_includes @complete_wordlist, w }\n end", "def phrases_not_found\n @phrases_not_found ||= Set.new\n end", "def word_list\n @word_list ||= Set.new File.read(\"dictionary.txt\").split(\"\\n\").map(&:downcase)\n end", "def test_standard_words\n @words = @tester.words(number: 1000)\n\n @words.each { |w| assert_includes @standard_wordlist, w }\n end", "def checking_dictionary_for_word_match\n valid_word?(@prefix)\n end", "def test_find_words_words_empty\n words = []\n dict = Set['apple','bat','candy']\n assert_equal [], @grapher.find_words(words, dict)\n end", "def setup\n to_delete = []\n @word_list.each do |word|\n\n # Run the word through the validator and return if it is valid or not\n status = validate_word(word)\n\n # If the words invalid add it to the list of words to delete.\n to_delete.push(word) if status\n end\n\n # Remove all the invalid words\n to_delete.each do |invalid_word|\n @word_list.delete(invalid_word)\n end\n\n # Generate a random number in range of the world list length, the word at this\n # index is the game word, split that into an array of chars, using strip incase there is random\n # whitespace for whatever reason\n word_index = rand(@word_list.length)\n @whole_word = @word_list[word_index]\n @word_to_guess = @word_list[word_index].strip.split('')\n\n home\n end", "def test_words\n @words = @tester.words(number: 1000)\n\n @words.each { |w| assert_includes @standard_wordlist, w }\n end", "def initialize words\n @word_list = words\n end", "def word_list=(list)\n end", "def test_words\n @words = @tester.words(number: 1000)\n\n @words.each { |w| assert_includes @wordlist, w }\n end", "def known words\n known_words = words.find_all { |w| @dict_frequency.has_key? w }\n known_words.empty? ? nil : known_words\n end", "def test_word\n 42.times { assert @standard_wordlist.include?(@tester.word) }\n end", "def spelled_correctly?(word)\n if @word_list.is_a? Hash\n @word_list.keys.include?(word)\n else\n @word_list.include?(word)\n end\n end", "def all_words_valid? set\n (set & DICTIONARY) == set\n end", "def is_valid_word?(word)\n DICTIONARY.include?(word)\n end", "def test_find_words_dict_empty\n words = ['apple','bat','candy']\n dict = Set.new\n assert_equal [], @grapher.find_words(words, dict)\n end", "def test_find_words_valid\n words = ['apple','bat','cat']\n dict = Set['apple','bat','cat']\n assert_equal Set[\"apple\"], @grapher.find_words(words, dict)\n end", "def test_word\n @tester = Faker::Hipster\n @standard_wordlist = I18n.translate('faker.hipster.words')\n\n 1000.times { assert_includes @standard_wordlist, @tester.word }\n end", "def word_checker(word_possibility)\n valid_words=[]\n word_possibility.each{ |word|\n if (system(\"look #{word} > new.txt\"))\n if response(word)[0] !=nil\n valid_words << word\n break\n end\n end\n }\n valid_words\n end", "def does_not_include_badwords\n\n badwords = %w(\n aloha!\n href=\n -online\n 1freewebspace.com\n 4u\n 5gighost.com\n accutane\n adipex\n adultsex\n advicer\n alprazolam\n amoxil\n arcadepages\n arimidex\n associations.missouristate.edu\n ativan\n augmentin\n baccarrat\n baclofen\n beaver\n blackjack\n bllogspot\n blogs.blackmarble.co.uk\n blowjob\n booker\n buspar\n byob\n car-rental-e-site\n car-rentals-e-site\n carisoprodol\n casino\n casinos\n chatroom\n cialis\n cipro\n citalopram\n clomid\n clonazepam\n comment1\n comment2\n comment3\n comment4\n comment5\n comment6\n coolcoolhu\n coolhu\n credit-card-debt\n credit-report-4u\n creditonlinepersonalloans\n cwas\n cyclen\n cyclobenzaprine\n dating-e-site\n day-trading\n debt-consolidation\n debt-consolidation-consultant\n diazepam\n diovan\n discreetordering\n dostinex\n duty-free\n dutyfree\n dvxuser.com\n equityloans\n fanreach.com\n fioricet\n flagyl\n flowers-leading-site\n fosamax\n freenet\n freenet-shopping\n gambling-\n hair-loss\n health-insurancedeals-4u\n hi5.com\n holdem\n holdempoker\n holdemsoftware\n holdemtexasturbowilson\n homeequityloans\n homefinance\n hotel-dealse-site\n hotele-site\n hotelse-site\n hydrocodone\n hyves.mn\n incest\n insurance-quotesdeals-4u\n insurancedeals-4u\n isuzuforums.com\n jestmaster\n jizz\n jrcreations\n kaboodle.com\n kamagra\n klonopin\n lamictal\n lesbian\n levaquin\n levitra\n lezbian\n loans\n lorazepam\n lycos\n macinstruct\n metformin\n metronidazole\n mortgage-4-u\n mortgagequotes\n musicstation\n nojazzfest\n nolvadex\n online-gambling\n onlinegambling-4u\n ottawavalleyag\n ownsthis\n palm-texas-holdem-game\n paxil\n paydal\n penguinforum\n penis\n personalloansbad\n pharmacy\n phenergan\n phentermine\n poker-chip\n porn\n poze\n profiles.friendster.com\n propecia\n proscar\n pussy\n remeron\n rental-car-e-site\n ringtone\n ringtones\n roulette\n shemale\n shoes\n slot-machine\n Staphcillin\n tamiflu\n tegretol\n texas-holdem\n thorcarlson\n top-e-site\n top-site\n toprol\n toradol\n tramadol\n tramodal\n tramodol\n trim-spa\n ultram\n valeofglamorganconservatives\n valium\n viagra\n vibramycin\n vicodin\n vioxx\n voltaren\n vytorin\n xanax\n zantac\n zithromax\n zofran\n zolpidem\n zolus\n )\n badwords.each do |bw|\n if !comment.nil? && comment.downcase.include?(bw) \n errors.add_to_base(\"Comment Rejected\") \n break\n end\n end\n end", "def test_word\n @standard_wordlist = I18n.translate('faker.lorem.words')\n\n 100.times { assert_includes @standard_wordlist, @tester.word }\n end", "def word_exists?(word)\n @wordlist.key?(word)\n end", "def get_words(text) #no!, two methods named get_words, see word_search.rb\n \twords = text.split('')\n \twords.each do |word|\n \t\t#how to check if word is correct or not?\n \t\tWord.new(name: word, ngsl: false, list: self.id )\n \t\t# example = Wordnik.word.get_top_example(word)['text']\n \tend\n end", "def known(words)\n #find all words for which condition is true,you need to figure out this condition\n known_words = words.find_all {|w| @dictionary.has_key?(w)} \n return known_words\n end", "def load_word_list\n @word_list = []\n puts \"Loading word list...\"\n File.readlines(WORDLIST_FILE).each{|word|\n word.gsub!(/[\\r\\n]+/,\"\")\n if valid_word?(word, @inner_letter, @outer_letters)\n @word_list << word\n end\n }\n @word_list.sort!\n puts \"Word list loaded.\"\n end", "def mispelled_words\n Spellchecker.check(@text, LANG).reject do |word|\n word[:correct]\n end\n end", "def verify( *suspect_words )\n suspect_words.flatten.sort == @banned_words\n end", "def create_codeword_matches(words)\n set = Set.new\n\t\twords.each do |word|\n\t\t\tset.add(word) if word.length == @codeword.length \n\t\tend\n set\n\tend", "def verify( *suspect_words )\n\t\tsuspect_words.flatten.sort == @banned_words\n\tend", "def add_all(words)\n end", "def verify( *suspect_words )\n suspect_words.flatten.sort == @banned_words\n end", "def get_valid_words(word)\n [word, word.downcase, word.capitalize, word.pluralize].uniq\n end", "def all_valid \n h = @horizontal.reject { |(x,y),r| x==r }\n v = @vertical.reject { |(x,y),r| y==r }\n\n words = h.map { |position,right|\n x,y = position\n (x..right).map { |x| @board.tile_at([x,y]) }\n }\n words.concat v.map {|position, bottom|\n x,y = position\n (y..bottom).map { |y| @board.tile_at([x,y]) }\n }\n\n FFI::Hunspell.dict do |dict|\n for word in words do\n word = (word.map {|tile| tile.letter}).join.downcase\n return false unless dict.check? word\n end\n end\n return true\n end", "def check_dictionary(dict)\n dictionary_redux = []\n for word in dict\n result = check_word(word)\n if result\n dictionary_redux << word\n end\n end\n new_dict = add_reversals(dictionary_redux)\n return new_dict\n end", "def test_load_dictionaries\n spellchecker = AlfonsoX::SpellChecker::Main.from_config(\"#{RESOURCES_PATH}/config.yml\")\n assert_equal 6, spellchecker.dictionaries.length\n\n word_list_file_dictionary = spellchecker.dictionaries[3]\n word_list_dictionary = spellchecker.dictionaries[4]\n\n assert word_list_file_dictionary.is_a?(AlfonsoX::SpellChecker::Dictionary::WordListFile)\n assert_equal 59, word_list_file_dictionary.words.length\n assert word_list_dictionary.is_a?(AlfonsoX::SpellChecker::Dictionary::WordList)\n assert_equal 4, word_list_dictionary.words.length\n end", "def dictionary_words? set\n (set & DICTIONARY) == set\n end", "def enough_flippable_words?\n (words - all_excluded_words).size > 1\n end", "def create_tables\n unless MinWords::DB.table_exists?(:words)\n MinWords::DB.create_table :words do\n primary_key :id\n varchar :word_text, unique: true\n end\n end\n unless MinWords::DB.table_exists?(:defines)\n MinWords::DB.create_table :defines do\n primary_key :id\n foreign_key :word_id, :words\n varchar :definition_text\n end\n end\n end", "def wordlist\n unless @whitelist.nil?\n @whitelist\n else\n @blacklist\n end\n end", "def check_word(word)\n valid_words.include?(word)\n end", "def check_add_to_existing player, board, word_list\n\t\t\tbest =ScrabbleWord.new('', 0, 0, 0, 0)\n\t\t\tscore = 0\n\t\t\tword_list.each do |word|\n\t\t\t\tlist = DICTIONARY.get_all(player.tiles, word.word)\n\t\t\t\tlist.each do |x|\n\t\t\t\t\tval = x.partition(word.word)[0].length\n\t\t\t\t\trow = word.row\n\t\t\t\t\tcol = word.col\n\t\t\t\t\tif(word.dir == :down)\n\t\t\t\t\t\trow -= val\n\t\t\t\t\telse\n\t\t\t\t\t\tcol -= val\n\t\t\t\t\tend\n\t\t\t\t\tscore = 0\n\t\t\t\t\tscore = attempt_score(x, board, row, col, word.dir) if (0..14).cover?(row) && (0..14).cover?(col)\n\t\t\t\t\tif score[0]\n\t\t\t\t\t\tnew_word = ScrabbleWord.new(x, score[0], row, col, word.dir)\n\t\t\t\t\t\tbest = new_word if score[0] > best.score && !Scrabble.same_word(new_word, word)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\t[best, score.inject(:+)]\n\t\tend", "def test_rack_contains_a_word_with_duplicate_letters\n [:A,:B,:A,:C].each{|x| @newTileRack.append(x)}\n assert_equal(true,@newTileRack.has_tiles_for?('AAB'))\n end", "def new_illegal_words(board, dict)\n new_words(board).reject {|word| dict.legal_word?(word.to_s)}\n end", "def test_word\n 1000.times { assert_includes @wordlist, @tester.word }\n end", "def possible_words\n\t\t\[email protected] to_r\n\t\tend", "def find_words \n # breaks the story_template into keywords using .split, which inherently splits at spaces\n keywords = @story_template.split()\n # Using a for loop, looks at each word in the story_template and identifies if it is not empty and has a staple []\n keywords.each do |word|\n if (word != \"\") && (word[0] == \"[\")\n @story_keywords << word[1..-2] # This line takes every char from after the [ until the ]\n end\n end\n @story_keywords \n end", "def word_list\n @word_list\n end", "def known(words)\n return words.find_all {true } #find all words for which condition is true,\n #you need to figure out this condition\n \n end", "def set_WordList(value)\n set_input(\"WordList\", value)\n end", "def set_WordList(value)\n set_input(\"WordList\", value)\n end", "def set_WordList(value)\n set_input(\"WordList\", value)\n end", "def test_find_words_multiple\n words = ['apple','candy','bat']\n dict = Set['apple','bat','candy','cat']\n assert_equal Set[\"apple\",\"candy\"], @grapher.find_words(words, dict)\n end", "def test_rack_doesnt_contain_any_needed_letters\n [:A,:B,:C,:D].each{|x| @newTileRack.append(x)}\n assert_equal(false,@newTileRack.has_tiles_for?('IKL'))\n end", "def safelists; end", "def words\n []\n end", "def find_words(words, dict)\n return nil if words.nil? || dict.nil?\n return [] if words.empty? || dict.empty?\n\n size = -1\n list = Set.new\n\n words.each do |w|\n if dict.include? w.downcase\n break if w.length < size\n\n size = w.length\n list << w\n end\n end\n list\n end", "def missingWords(s, t)\n res = []\n s_words = s.split(\" \")\n t_words = t.split(\" \")\n i = 0\n j = 0\n while i < s_words.length\n if s_words[i] != t_words[j]\n res.push(s_words[i])\n else \n j += 1\n end\n i += 1\n end\n res\nend", "def existing_words\n draw_current = draw\n p \"The 7 letters drawn are:\"\n p draw_current\n p \"-\"*70\n\n combinations = combine(draw_current).flat_map{ |w| w.permutation.to_a}.uniq.map { |e| e.join }\n combinations.map{|i| search(i, UPPER_BOUND_INI, LOWER_BOUND_INI, NO_ITERATION_INI)}.flatten.reject{|x| x==nil}\nend", "def word_list\n # Returning only the terms of each definition as an array.\n list_of_terms = @words.map do |key, definition_instance|\n definition_instance.term\n end\n end", "def test_lookup_all_by_headword_removes_duplicates\n results = Lexeme.lookup_all_by_headword('lit', matchtype: Lexeme::SUBSTRING)\n\n assert results.any? { |lexeme| lexeme.headword_forms.count { |form| form =~ /lit/ } > 1 },\n 'For this test there needs to be a lexeme with multiple headwords matching the pattern'\n\n assert_equal results.collect(&:id), results.distinct.collect(&:id),\n 'lookup_all_by_headword should remove duplicates in substring search'\n end", "def all_empty?(words = [])\nend", "def complex_words\n @complex_words ||= unique_words.select { |word| syllables_in(word) >= 3 }\n end", "def generate_letter_word_collections\n Word.all.each {|word|\n self.two_letter_word_collection << word.two_letter_words\n self.three_letter_word_collection << word.three_letter_words\n self.four_letter_word_collection << word.four_letter_words\n self.five_letter_word_collection << word.five_letter_words\n self.six_letter_word_collection << word.six_letter_words\n self.seven_letter_word_collection << word.seven_letter_words\n self.eight_letter_word_collection << word.eight_letter_words\n self.nine_letter_word_collection << word.nine_letter_words\n }\n self.two_letter_word_collection = self.two_letter_word_collection.flatten.sort.uniq\n self.three_letter_word_collection = self.three_letter_word_collection.flatten.sort.uniq\n self.four_letter_word_collection = self.four_letter_word_collection.flatten.sort.uniq\n self.five_letter_word_collection = self.five_letter_word_collection.flatten.sort.uniq\n self.six_letter_word_collection = self.six_letter_word_collection.flatten.sort.uniq\n self.seven_letter_word_collection = self.seven_letter_word_collection.flatten.sort.uniq\n self.eight_letter_word_collection = self.eight_letter_word_collection.flatten.sort.uniq\n self.nine_letter_word_collection = self.nine_letter_word_collection.flatten.sort.uniq\n self\n end", "def require_if_present(names); end", "def spell_check\n #Temp has to get around iterating blocking hash editing\n temp_hash = Hash.new\n #For each word hash pair\n $words.each do |word|\n #Sets values for lexicon reading\n first_char = word[0][0]\n len = word[0].length\n\n #Searches lexicon for match, default is false\n match = false\n #For each word in the lexicon with the same first and second characters checks for equality\n $lexicon[first_char][len].each do |check|\n #If the words are the same sets spelling to true, or correct and breaks out of loop\n if check[0] == word[0]\n match = true\n break;\n end\n end\n #Sets temp hash to proper values, to be reassigned to word hash after full iterations\n temp_hash[word[0]] = match\n end\n #Sets words hash with proper values\n temp_hash.each do |temp|\n $words[temp[0]] = temp[1]\n end\nend", "def word_present?(word)\n @words.include?(word.downcase)\n end", "def word_present?(word)\n @words.include?(word.downcase)\n end", "def get_word_list\n @word_list = @lines.reject do |line|\n line.length < 5 || line.length > 12\n end\n end", "def is_existential_type\n @phrases.size == 1 and\n @phrases[0].is_a?(NounPhrase) and\n !@phrases[0].literal\n end", "def check_hooking player, board, word_list\n\t\t\tbest =Array.new(2, ScrabbleWord.new('', 0, 0, 0, 0))\n\t\t\twords = DICTIONARY.get_all(player.tiles)\n\t\t\tword_hash = Hash.new\n\t\t\twords.each do |word|\n\t\t\t\tword.each_char do |char|\n\t\t\t\t\tword_hash[char] ||= Set.new\n\t\t\t\t\tword_hash[char] << word\n\t\t\t\tend\n\t\t\tend\n\t\t\tword_list.each do |word|\n\t\t\t\tplayer.tiles.each do |char|\n\t\t\t\t\tif DICTIONARY.word?(word.word + char) || DICTIONARY.word?(char + word.word)\n\t\t\t\t\t\tword_hash[char].each do |new_word|\n\t\t\t\t\t\t\trow = word.row\n\t\t\t\t\t\t\tcol = word.col\n\t\t\t\t\t\t \tword.dir == :across ? col -=1 : row -= 1\n\t\t\t\t\t\t\tbest = hook_helper(new_word, word.word.length , word, board, char, word.row , word.col, best, word.word + char) if DICTIONARY.word?(word.word + char)\n\t\t\t\t\t\t\tbest = hook_helper(new_word, 0 , word, board, char, row, col, best, char + word.word) if DICTIONARY.word?(char + word.word)\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t[best, best.inject(0){|sum, i| sum + i.score}]\n\t\tend", "def recursive_hypernyms(word, part_of_speech)\n if Relations.map.keys.include? word\n return [word]\n else\n # look in wordnet\n synsets = @wordnet.lookup_synsets(word, part_of_speech) \n \n hypernyms = Set.new\n \n synsets.each { |ss|\n ss.traverse(:hypernyms).each { |synset|\n synset.words.each { |w|\n hypernyms << w.lemma\n }\n }\n }\n \n #check these with the mappings\n return hypernyms.to_a & Relations.map.keys.to_a\n end\n end", "def load_used_phrases\n\t@used_phrases = load_collection_from_file(@phrase_file_name, {});\nend", "def tool_defined?(words)\n @tool_data.key?(words)\n end", "def phrase_has_definitely_been_checked?(phrase, existing_article_titles)\n phrase_string = phrase.to_s\n #return false #This causes unit tests to fail\n #return existing_article_titles.any?{|existing_article_title| existing_article_title.chars.downcase.to_s.include?(phrase_string.chars.downcase)} #Unicode safe, too slow? :(\n return existing_article_titles.any?{|existing_article_title| existing_article_title.downcase.include?(phrase_string.downcase)} #Not unicode safe?\n end", "def valid_path_exists?(word)\n if (word.length < MIN_WORD_LENGTH)\n puts \"Words must be greater than three letters long\"\n return nil\n end\n\n tail = word[1, word.length]\n (0..15).each do |i|\n if (@b[i].die.getLetter.casecmp(word[0,1]) == 0) # if the letter matches the first in word\n @b[i].used = true\n return true if dfs(@b[i], tail) # need to check all instances of that letter\n @b[i].used = nil\n end\n unmark_used_nodes \n end\n return nil\n end", "def possible_words?(q)\n\tresults = $wordnik.search_words_new(q)[\"searchResults\"]\n\tresults.map { |w| w[\"word\"] }\nend", "def yelled?(words)\n words == words.upcase unless words.empty?\n end", "def legal_words?(board, dict, raise_exception = false)\n\n if can_play_letters?(board, raise_exception) \n bad_words = self.new_illegal_words(board, dict)\n if bad_words.empty?\n return true\n elsif raise_exception\n raise IllegalMove, \"#{bad_words.join(', ')} #{bad_words.size==1 ? 'is not a legal word' : 'are not legal words'}!\" \n end\n end\n\n return false\n end", "def valid_word?(spelling)\n return false unless super(spelling)\n\n return true if lexicon.member?(spelling)\n\n STEM_ENDINGS.each do |e|\n stem = spelling.chomp(e)\n return true if lexicon.member?(stem)\n end\n\n false\n end", "def insert_words(words)\n words.each do |word|\n insert(word)\n end\n end", "def has_subtools?(words) # rubocop:disable Naming/PredicateName\n load_for_prefix(words)\n len = words.length\n all_cur_definitions.any? do |tool|\n name = tool.full_name\n name.length > len && name.slice(0, len) == words\n end\n end", "def build(words)\n words.each do |word|\n self.add(word)\n end\n end", "def store_valid_word(word)\n @words << word\n @word_index[word] = @last_letter\n end", "def initialize\n @words = (KEYWORDS + OTHERS).map(&:downcase)\n end", "def find_words(words)\n @words = words.map { |w| MatrixWord.new(w) }\n @words.each { |mw| place mw if (!mw.word.nil? && mw.word.size <= @width) }\n @words.select { |w| !w.place.nil? }\n end", "def err_for_list_name(name)\n # if session[:lists].any? { |list| list[:name] == name }\n if @storage.all_lists.any? { |list| list[:name] == name }\n 'The list name must be unique'\n elsif !(1..50).cover?(name.size)\n 'The list name must have between 1 and 50 characters'\n # else\n # nil # don't explicitly need this, but it's good to show intent\n end\nend" ]
[ "0.7391479", "0.6668344", "0.6659616", "0.6642127", "0.6545326", "0.64692163", "0.6361747", "0.63507783", "0.63425034", "0.6310698", "0.62760085", "0.6251572", "0.6245987", "0.6245987", "0.62399167", "0.6222771", "0.6193846", "0.6169626", "0.615987", "0.61499333", "0.614836", "0.6104624", "0.6082078", "0.6080327", "0.6067246", "0.60630274", "0.6052275", "0.60519624", "0.6036706", "0.59959006", "0.59920746", "0.59853727", "0.5962669", "0.5957615", "0.5942982", "0.5935008", "0.59327847", "0.5931915", "0.59129584", "0.59096396", "0.586179", "0.5856259", "0.5852062", "0.58358", "0.58247936", "0.58222413", "0.579395", "0.5779485", "0.57746047", "0.57427514", "0.57278746", "0.5725548", "0.57050997", "0.5699531", "0.56969976", "0.5667621", "0.5657598", "0.5657073", "0.5655522", "0.564681", "0.5628224", "0.56246066", "0.56018794", "0.56018794", "0.56018794", "0.5598978", "0.5577903", "0.5577726", "0.55713344", "0.5557158", "0.5552923", "0.55512583", "0.5541241", "0.55390674", "0.5534794", "0.5529242", "0.5517668", "0.5493056", "0.54911715", "0.5489431", "0.5489431", "0.54829353", "0.5480265", "0.5480121", "0.5478525", "0.54739124", "0.5472812", "0.54701364", "0.54688877", "0.5467228", "0.5462726", "0.54598963", "0.545797", "0.5454855", "0.54511654", "0.54502326", "0.5449982", "0.5446164", "0.54461217", "0.54448444" ]
0.70371914
1
Use callbacks to share common setup or constraints between actions.
def set_account @account = Account.find(params[:id]) rescue ActiveRecord::RecordNotFound render json: { error: $ERROR_INFO.message }, status: :not_found end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def setup_handler\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def workflow\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def default_action; end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163927", "0.6046165", "0.59465253", "0.59167755", "0.58904207", "0.58346355", "0.577713", "0.5703502", "0.5703502", "0.56531286", "0.56215113", "0.54224145", "0.5410795", "0.5410795", "0.5410795", "0.53924775", "0.5379919", "0.53580743", "0.53401667", "0.53397506", "0.5332605", "0.5312215", "0.5296594", "0.52965283", "0.52957606", "0.5259903", "0.52443177", "0.523896", "0.523896", "0.523896", "0.523896", "0.523896", "0.52329034", "0.52322394", "0.5227445", "0.5222394", "0.5220348", "0.5212759", "0.5207747", "0.5205933", "0.5176468", "0.5173833", "0.5171983", "0.51663405", "0.5159596", "0.5158247", "0.51526845", "0.5152398", "0.5151361", "0.5145775", "0.5140135", "0.51338995", "0.51127726", "0.5112607", "0.5112607", "0.5110613", "0.51067513", "0.5092337", "0.508788", "0.5081578", "0.5080434", "0.50679874", "0.50567716", "0.5051213", "0.5048352", "0.5048352", "0.5035347", "0.5026666", "0.5023127", "0.5016081", "0.50129867", "0.5000684", "0.4999752", "0.49979812", "0.499026", "0.499026", "0.49866846", "0.49800366", "0.49795717", "0.49771172", "0.4968475", "0.4965813", "0.4958072", "0.49561292", "0.4954901", "0.49536785", "0.4953058", "0.49468648", "0.49424478", "0.4932989", "0.49291888", "0.49273813", "0.49271655", "0.4925948", "0.49236968", "0.49203572", "0.49181753", "0.49173692", "0.4916862", "0.49161318", "0.49155986" ]
0.0
-1
Only allow a trusted parameter "white list" through.
def account_params params.require(:account).permit(:email, :password, :current_password) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def filtered_parameters; end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n [:rating, :review]\n end", "def valid_params?; end", "def permitted_params\n declared(params, include_missing: false)\n end", "def permitted_params\n declared(params, include_missing: false)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def filter_parameters; end", "def filter_parameters; end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def check_params; true; end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def list_params\n params.permit(:name)\n end", "def check_params\n true\n end", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def additional_permitted_params\n []\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end", "def allow_params_authentication!; end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def param_params\n params.require(:param).permit(:param_category_id, :param_table_id, :name, :english_name, :weighting, :description)\n end", "def quote_params\n params.permit!\n end", "def list_params\n params.permit(:list_name)\n end", "def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end", "def all_params; end", "def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end", "def source_params\n params.require(:source).permit(all_allowed_params)\n end", "def user_params\n end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def get_allowed_parameters\n return _get_specific_action_config(:allowed_action_parameters, :allowed_parameters)&.map(&:to_s)\n end", "def permitted_params\n @wfd_edit_parameters\n end", "def user_params\r\n end", "def param_whitelist\n whitelist = [\n :comment,\n :old_progress, :new_progress,\n :metric_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:metric_id)\n end\n \n whitelist\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def get_params\n\t\t\n\t\treturn ActionController::Parameters.new(self.attributes).permit(:first_name, :last_name, :email, :provider)\n\n\tend", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end", "def params_permit\n params.permit(:id)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def filter_params\n params.permit(*resource_filter_permitted_params)\n end", "def community_params\n params.permit(:profile_image, :name, :description, :privacy_type, :viewed_by, {tags: []}, {features: []}, {admins: []}, :members, :location, :beacon, :creator, :ambassadors, :current_events, :past_events, :feed, :category, :address, :allow_member_post_to_feed, :allow_member_post_to_events)\n end", "def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend", "def authorize_params\n super.tap do |params|\n %w[display scope auth_type].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end", "def feature_params_filter\n params.require(:feature).permit(:name, :cat, :lower, :upper, :opts, :category, :description, :company, :active, :unit, :icon)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def argument_params\n params.require(:argument).permit(:name)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def property_params\n params.permit(:name, :is_available, :is_approved, :owner_id)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end", "def whitelist_person_params\n params.require(:person).permit(:family, :pre_title, :given_name, :dates, :post_title, :epithet, :dates_of_office, same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end", "def parameters\n nil\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def sequence_param_whitelist\n default_param_whitelist << \"show_index\"\n end", "def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end", "def normal_params\n reject{|param, val| param_definitions[param][:internal] }\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def special_device_list_params\n params.require(:special_device_list).permit(:name)\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end" ]
[ "0.7121987", "0.70541996", "0.69483954", "0.6902367", "0.6733912", "0.6717838", "0.6687021", "0.6676254", "0.66612333", "0.6555296", "0.6527056", "0.6456324", "0.6450841", "0.6450127", "0.6447226", "0.6434961", "0.64121825", "0.64121825", "0.63913447", "0.63804525", "0.63804525", "0.6373396", "0.6360051", "0.6355191", "0.62856233", "0.627813", "0.62451434", "0.6228103", "0.6224965", "0.6222941", "0.6210244", "0.62077755", "0.61762565", "0.61711127", "0.6168448", "0.6160164", "0.61446255", "0.6134175", "0.6120522", "0.6106709", "0.60981655", "0.6076113", "0.60534036", "0.60410434", "0.6034582", "0.6029977", "0.6019861", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.60184896", "0.60157263", "0.6005857", "0.6003803", "0.60012573", "0.59955895", "0.5994598", "0.5993604", "0.5983824", "0.5983166", "0.5977431", "0.597591", "0.5968824", "0.5965953", "0.59647584", "0.59647584", "0.59566855", "0.59506303", "0.5950375", "0.59485626", "0.59440875", "0.5930872", "0.5930206", "0.5925668", "0.59235454", "0.5917905", "0.59164816", "0.5913821", "0.59128743", "0.5906617", "0.59053683", "0.59052664", "0.5901591", "0.58987755", "0.5897456", "0.58970183", "0.58942604" ]
0.0
-1
memmap method is based on
def memmap pid = $$ f= File.open "/proc/#{pid}/cmdline" cmd= f.read.split "\0" f= File.open "/proc/#{pid}/maps" stack = heap = nil data = Array.new f.each_line do |line| data << line.split(' ').first.split('-') if line.match cmd.first stack = line.split(' ').first.split('-') if line.match "stack" heap = line.split(' ').first.split('-') if line.match "heap" end unless data.empty? @data= data.map do |a| a= a.map do |e| e.to_i(16) end end end unless stack.nil? @stack= stack.map do |e| e.to_i(16) end end unless heap.nil? @heap= heap.map do |e| e.to_i(16) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def memos; end", "def memos; end", "def mem(*) end", "def make_memory_addressable\n hash = {}\n @data.length.times do |index|\n key = HumanComputer::Processor.eight_bitify index\n hash[key] = @data[index]\n end\n @data = hash\n end", "def read(off, sz=4096); Ragweed::Wrap32::read_process_memory(@h, off, sz); end", "def mem=(p0) end", "def write_rmap rmap\n\nend", "def get_memory(i, opts={})\r\n refresh opts\r\n read(@memlist[i][0], @memlist[i][1])\r\n end", "def get_mem\n lines = `free -m`.split(\"\\n\")\n header = lines[0]\n w_cache = lines[1].split(/\\s+/)[2].to_i\n mem = lines[2].split(/\\s+/)[2].to_i\n [mem, w_cache]\n end", "def mmap?\n @m.nil? == false\n end", "def memsize\n end", "def write(memory, address, process)\n memory[address, process.memory_blocks] = Concurrent::Array.new(process.memory_blocks, process.id)\n end", "def dump_mem(pid,name, toggle)\n\thost,port = @client.tunnel_peer.split(':')\n\t# Create Filename info to be appended to created files\n\tfilenameinfo = \"_#{name}_#{pid}_\" + ::Time.now.strftime(\"%Y%m%d.%M%S\")\n\t# Create a directory for the logs\n\tlogs = ::File.join(Msf::Config.log_directory, 'scripts', 'proc_memdump')\n\t# Create the log directory\n\t::FileUtils.mkdir_p(logs)\n\t#Dump file name\n\tdumpfile = logs + ::File::Separator + host + filenameinfo + \".dmp\"\n\tprint_status(\"\\tDumping Memory of #{name} with PID: #{pid.to_s}\")\n\tbegin\n\t\tdump_process = @client.sys.process.open(pid.to_i, PROCESS_READ)\n\trescue\n\t\tprint_error(\"Could not open process for reading memory!\")\n\t\traise Rex::Script::Completed\n\tend\n\t# MaximumApplicationAddress for 32bit or close enough\n\tmaximumapplicationaddress = 2147418111\n\tbase_size = 0\n\twhile base_size < maximumapplicationaddress\n\t\tmbi = dump_process.memory.query(base_size)\n\t\t# Check if Allocated\n\t\tif mbi[\"Available\"].to_s == \"false\"\n\t\t\tfile_local_write(dumpfile,mbi.inspect) if toggle\n\t\t\tfile_local_write(dumpfile,dump_process.memory.read(mbi[\"BaseAddress\"],mbi[\"RegionSize\"]))\n\t\t\tprint_status(\"\\tbase size = #{base_size/1024}\")\n\t\tend\n\t\tbase_size += mbi[\"RegionSize\"]\n\tend\n\tprint_status(\"Saving Dumped Memory to #{dumpfile}\")\n\nend", "def proc_meminfo\n\n unless defined?(@proc_meminfo)\n\n @proc_meminfo = {}\n\n meminfo = IO.readlines('/proc/meminfo')\n meminfo.each do |meminfo_line|\n\n pairs = meminfo_line.strip.split(':', 2)\n key = pairs[0].strip\n value = pairs[1].strip\n\n # Remove \"kB\" from the value and multiply it by 1024.\n value = value.to_i * 1024\n\n @proc_meminfo[key] = value\n\n end\n\n end\n @proc_meminfo\n\n end", "def image_offset_vma(offset)\n offset_vma(offset - image_offset)\n end", "def memory\n hash = {}\n page_size = 4096 # Possibly changed later\n\n begin\n optr = FFI::MemoryPointer.new(:uint64_t)\n size = FFI::MemoryPointer.new(:size_t)\n size.write_int(optr.size)\n\n if sysctlbyname('hw.memsize', optr, size, nil, 0) < 0\n raise SystemCallError.new('sysctlbyname', FFI.errno)\n end\n\n hash[:total] = optr.read_uint64\n ensure\n optr.free if optr && !optr.null?\n size.clear\n end\n\n begin\n swap = Swap.new\n size.write_int(swap.size)\n\n if sysctlbyname('vm.swapusage', swap, size, nil, 0) < 0\n raise SystemCallError.new('sysctlbyname', FFI.errno)\n end\n\n hash[:swap_total] = swap[:xsu_total]\n hash[:swap_available] = swap[:xsu_avail]\n hash[:swap_used] = swap[:xsu_used]\n page_size = swap[:xsu_pagesize]\n ensure\n size.free if size && !size.null?\n end\n\n host_self = mach_host_self()\n vmstat = VmStat.new\n count = FFI::MemoryPointer.new(:size_t)\n count.write_int(vmstat.size)\n\n rv = host_statistics64(host_self, HOST_VM_INFO64, vmstat, count)\n raise SystemCallError.new('host_statistics64', rv) if rv != 0\n\n hash[:free] = vmstat[:free_count] * page_size\n hash[:active] = vmstat[:active_count] * page_size\n hash[:inactive] = vmstat[:inactive_count] * page_size\n hash[:speculative] = vmstat[:speculative_count] * page_size\n hash[:wire] = vmstat[:wire_count] * page_size\n hash[:compressed] = vmstat[:compressor_page_count] * page_size\n\n hash\n ensure\n count.free if count && !count.null?\n end", "def write_to_memory\n len = Vips::SizeStruct.new\n ptr = Vips.vips_image_write_to_memory self, len\n raise Vips::Error if ptr.nil?\n\n # wrap up as an autopointer\n ptr = FFI::AutoPointer.new(ptr, GLib::G_FREE)\n\n ptr.get_bytes 0, len[:value]\n end", "def pid_memory\n file_format.pids[self[:pid]] ||= { :last_memory_reading => -1, :current_memory_reading => -1 }\n end", "def print_pointer_location(ptr, t)\n if t.respond_to? :get_area_memlocation\n page_number = (ptr.size.to_f / $page_size).ceil\n base_address = ptr.address - ( ptr.address % $page_size )\n ptrs = page_number.times.collect { |i|\n FFI::Pointer::new(base_address + i*$page_size).slice(0, $page_size)\n }\n ptrs.each { |ptr|\n p t.get_area_memlocation(ptr, :MEMBIND_BYNODESET)\n }\n else\n puts \"pagemap #{Process::pid} -n #{ptr.address.to_s(16)}-#{(ptr.address+ptr.size-1).to_s(16)}\"\n puts `pagemap #{Process::pid} -n #{ptr.address.to_s(16)}-#{(ptr.address+ptr.size-1).to_s(16)}`\n end\nend", "def create_data_space_map\n v_stream = [8,1,104, 1,0, 32, \"EncryptedPackage\".bytes.to_a, 50, \"StrongEncryptionDataSpace\".bytes.to_a].flatten!.pack DATA_SPACE_MAP_PACKING \n Storage.new('DataSpaceMap', :data=>v_stream, :left => 4, :right => 6, :size=>v_stream.size)\n end", "def list_memory(&block)\r\n ret = []\r\n i = 0\r\n while (mbi = Ragweed::Wrap32::virtual_query_ex(@h, i))\r\n break if (not ret.empty? and mbi.BaseAddress == 0)\r\n if block_given?\r\n yield mbi\r\n else\r\n base = mbi.BaseAddress || 0\r\n size = mbi.RegionSize || 0\r\n ret << [base,size] if mbi.State & 0x1000 # MEM_COMMIT\r\n i = base + size\r\n end\r\n end\r\n ret\r\n end", "def memory_footprint\n BULK_APIS.keys.map do |key| \n size = nil\n if redis.exists(redis_key(key))\n size = redis.debug(\"object\", redis_key(key)).match(/serializedlength:(\\d+)/)[1].to_i / 1024.0\n end\n [key, size]\n end.to_h.compact\n end", "def fetch_memory(address)\n # カートリッジのアドレス空間から取得\n if address < 0x8000\n @cartridge[address]\n elsif 0x8000 <= address && \n end\n end\n end", "def memory\n @pagesize ||= Vmstat.pagesize\n has_available = false\n\n total = free = active = inactive = pageins = pageouts = available = 0\n procfs_file(\"meminfo\") do |file|\n content = file.read(2048) # the requested information is in the first bytes\n\n content.scan(/(\\w+):\\s+(\\d+) kB/) do |name, kbytes|\n pages = (kbytes.to_i * 1024) / @pagesize\n\n case name\n when \"MemTotal\" then total = pages\n when \"MemFree\" then free = pages\n when \"MemAvailable\"\n available = pages\n has_available = true\n when \"Active\" then active = pages\n when \"Inactive\" then inactive = pages\n end\n end\n end\n\n procfs_file(\"vmstat\") do |file|\n content = file.read\n\n if content =~ /pgpgin\\s+(\\d+)/\n pageins = $1.to_i\n end\n\n if content =~ /pgpgout\\s+(\\d+)/\n pageouts = $1.to_i\n end\n end\n\n mem_klass = has_available ? LinuxMemory : Memory\n mem_klass.new(@pagesize, total-free-active-inactive, active,\n inactive, free, pageins, pageouts).tap do |mem|\n mem.available = available if has_available\n end\n end", "def dump_memory(i, opts={}); get_memory(i, opts).hexdump; end", "def memory_view(cols = nil,start_at = 8,end_at = 43808,skip_empties = false)\n cols = @memory_view_width\n str = \"\"\n puts Benchmark.measure {\n tag_open = \"\"\n bytes_left = -1\n empty_row = Array.new(cols,0)\n mem_address = start_at\n row_index = 0\n while mem_address <= end_at\n #row = @vm.memory[mem_address..(mem_address+cols)]\n row = @vm.memory.raw_read(mem_address...(mem_address+cols))\n next if skip_empties && row == empty_row\n row_address = start_at + (row_index * cols)\n mem_hex = \"\"\n str << %(<tr class=\"memory_row_address_#{row_address}\"><td class=\"address\">#{row_address}</td><td>)\n row.bytes.each_with_index{ |b,i|\n address = row_address + i\n\n if @vm.allocations[address]\n #bytes_left = Vm::TYPE_SIZES[ @vm.allocations[address][0] ]\n bytes_left = 4 # vars in memory are always 32-bit ints/floats?\n classes = \"allocated hl_address hl_address_#{address} data_type_#{@vm.allocations[address][0]} allocation_id_#{@vm.allocations[address][1]}\"\n bytes = @vm.read(address,bytes_left)\n native = @vm.arg_to_native(@vm.allocations[address][0],bytes)\n tag_open = %(<a class=\"#{classes}\" href=\"#\" data-native=\"#{native}\" data-bytes=\"#{hex(bytes)}\" data-data_type=\"#{@vm.allocations[address][0]}\" data-allocation_id=\"#{@vm.allocations[address][1]}\" data-address=\"#{address}\">)\n str << tag_open\n elsif i == 0 && bytes_left > 0\n str << tag_open\n end\n\n bytes_left -= 1\n str << %(<span class=\"address_#{address} hl_address hl_address_#{address}\">) << hex(b) << %(</span>)\n\n if bytes_left == 0 || bytes_left > 0 && i == cols-1\n str << \"</a>\"\n end\n\n str << \" \"\n }\n str << %(</td></tr>\\n)\n mem_address += cols\n row_index += 1\n end\n }\n str\n end", "def free_bytes\n free * pagesize\n end", "def malloc(bytes)\n if (bytes % WORD_SIZE) != 0\n raise (\n \"this is a #{8*WORD_SIZE} bit machine; \" +\n \"must allocate in multiples of #{WORD_SIZE} bytes\"\n )\n end\n\n start_ptr = @current_address\n (bytes / WORD_SIZE).times do |i|\n @store[start_ptr + WORD_SIZE * i] = nil\n end\n\n start_ptr\n end", "def reserve!\n memory_map.transform_values! { |_| RESERVED }\n end", "def main\n\trun \"100011 00000 10001 0000000000000100\"\n\trun \"100011 00000 10010 0000000000010000\"\n\trun \"100011 00000 10011 0000000000100000\"\n\trun \"100011 00000 10100 0000000000010100\"\n\trun \"101011 00000 10001 0000000001010000\"\n\trun \"101011 00000 10010 0000000001000100\"\n\trun \"101011 00000 10011 0000000001001100\"\n\trun \"101011 00000 10100 0000000011100000\"\n\trun \"100011 00000 10001 0000000000100100\"\n\trun \"100011 00000 10010 0000000000101100\"\n\trun \"100011 00000 10011 0000000000010000\"\n\trun \"100011 00000 10100 0000000010101100\"\n\trun \"101011 00000 10001 0000000000010100\"\n\trun \"101011 00000 10010 0000000000011000\"\n\trun \"101011 00000 10011 0000000000100100\"\n\trun \"101011 00000 10100 0000000001000100\"\n\trun \"100011 00000 10001 0000000000100100\"\n\trun \"100011 00000 10010 0000000000101100\"\n\trun \"100011 00000 10011 0000000000010000\"\n\trun \"100011 00000 10100 0000000010101100\"\n\trun \"101011 00000 10001 0000000001100000\"\n\trun \"101011 00000 10010 0000000001010100\"\n\trun \"101011 00000 10011 0000000001011100\"\n\trun \"101011 00000 10100 0000000011110000\"\n\tprint \"\\n\\nRegisters \\n\" + REGISTERS.to_s\n\tprint \"\\n\\nCACHE \\n\"\n\tcounter = 0\n\t(CACHE.to_s.gsub(\"],\",\"\\n\").split(\">\\n\")).each{|i| print \"Set \" + ((counter+=1)-1).to_s + i + \"\\n\"}\n\tcounter = 0\n\tprint \"\\n\\nMAIN MEMORY\\n\"\n\tMAIN_MEMORY.each{|i| print \"Memory Cell \" + ((counter+=1)-1).to_s + \" has \" + i.to_s + \"\\n\"}\n\t\"\"\nend", "def memread(address, size, buffer = nil)\n if buffer.nil?\n return railgun.memread(address, size)\n else\n return buffer[address .. (address + size - 1)]\n end\n end", "def populate_memory\n File.foreach(@file_name) do |line|\n @memory[@memory_counter] = line.chomp\n @memory_counter += 1\n\n @done = true if @memory_counter > 255\n end\n end", "def get_process_memory(pid)\n case @platform ||= Gem::Platform.local.os\n when \"linux\"\n begin\n file = Pathname.new \"/proc/#{pid}/smaps\"\n return 0 unless file.exist?\n\n lines = file.each_line.select { |line| line.match(/^Pss/) }\n return 0 if lines.empty?\n\n lines.reduce(0) do |sum, line|\n line.match(/(?<value>(\\d*\\.{0,1}\\d+))\\s+(?<unit>\\w\\w)/) do |m|\n sum += m[:value].to_i\n end\n\n sum\n end\n rescue Errno::EACCES\n 0\n end\n when \"darwin\"\n mem = `ps -o rss= -p #{pid}`.strip\n mem.empty? ? 0 : mem.to_i\n else\n raise \"Can't check process memory, wrong type of platform: #{@platform}\"\n end\n end", "def memadr; RAtlas::memadr(@storage);end", "def ibuf_bitmap_page_for_page(page_number)\n page_number - (page_number % pages_per_bookkeeping_page) + 1\n end", "def lmap; end", "def meminfo\n File.read(\"/proc/meminfo\").split(\"\\n\").map{ |f| f.split(':') }\n .map{ |name, value| [name, value.to_i / 1024.0] }.to_h\nrescue\n {}\nend", "def memsize; RAtlas::memsize(@storage);end", "def memory_zero(start_addr,char4_size)\n log(\"memory_zero\")\n log_int(start_addr)\n log_int(char4_size)\n\n $memory_zero_addr = start_addr\n $memory_zero_addr /= 4\n $memory_zero_end_addr = $memory_zero_addr\n $memory_zero_end_addr += char4_size\n\n loop do\n break if $memory_zero_addr >= $memory_zero_end_addr\n $0[ $memory_zero_addr ] = 0\n $memory_zero_addr += 1\n end\n end", "def read_process_memory(h, ptr, len)\r\n val = \"\\x00\" * len\r\n r = CALLS[\"kernel32!ReadProcessMemory:LLPLL=L\"].call(h, ptr.to_i, val, len, NULL)\r\n raise WinX.new(:read_process_memory) if r == 0\r\n return val ## don't handle short reads XXX\r\n end", "def rebase_map(old_vma, new_vma)\n m = @maps[old_vma]\n raise(\"VMA %X not found!\" % [old_vma]) if ! m\n check_map_overlap(new_vma, m.size)\n m.vma = new_vma\n @maps[new_vma] = m\n remove_map(old_vma)\n end", "def offset_vma(offset)\n return nil if (offset < 0 || offset >= size)\n start_addr + offset\n end", "def alloc_buffer\n ByteArray.new(@block_size)\n end", "def write(block_name, src_buffer)\n if block_name == @mem_file.size\n @mem_file << alloc_buffer\n end\n dest = @mem_file[block_name]\n ByteArray.copy(src_buffer,0,@block_size,dest,0)\n end", "def to_mem( source , from )\n reg_to_slot = Risc.reg_to_slot(source , from , register, index)\n compiler.add_code(reg_to_slot) if compiler\n reg_to_slot.register\n end", "def read_memory(address)\n # nes.memory.readWord(address)\n # Memory Manager readWord above\n # return read(address) | (read(address + 1) << 8);\n end", "def report_mem\n self.report('mem_report')\n end", "def vma_image_offset(vma)\n vma_offset(vma) + image_offset\n end", "def write_process_memory(h, dst, val)\r\n val = val.to_s if not val.kind_of? String\r\n r = CALLS[\"kernel32!WriteProcessMemory:LLPLL=L\"].call(h, dst.to_i, val, val.size, NULL)\r\n raise WinX.new(:write_process_memory) if r == 0\r\n return r\r\n end", "def _get_allocated_size; GC.stat(:malloc_increase_bytes); end", "def data_space_map\n @data_space_map ||= create_data_space_map\n end", "def read r\n if @m\n res = @m[r]\n return res if res\n \n # Falling back on IO.read - mmap failed\"\n @m = nil\n end\n \n @io.sysseek(r.first, IO::SEEK_SET)\n return @io.sysread(r.last-r.first+1)\n end", "def memory()\n\n instructions = 'free -h'\n\n puts ('instructions: ' + instructions.inspect).debug if @debug\n r = @ssh ? @ssh.exec!(instructions) : `#{instructions}`\n puts ('memory: ' + r.inspect).debug if @debug\n a = r.lines\n total, used, avail = a[1].split.values_at(1,2,-1) \n @results[:memory] = {total: total, used: used, available: avail}\n\n end", "def memory\n mem = @memory\n @memory = nil\n return mem\n end", "def pointers_to(src, dst, opts={})\r\n refresh opts\r\n ret = {}\r\n range = ((opts[:range_start] || @memlist[dst][0])..(opts[:range_stop] || @memlist[dst][0]+@memlist[dst][1]))\r\n scan(src, opts) do |block, soff|\r\n 0.stepwith(block.size, 4) do |off, len|\r\n if len == 4\r\n if range.member? block[off,4].to_l32\r\n ret[soff + off] = block[off,4].to_l32\r\n end\r\n end\r\n end\r\n end\r\n return ret\r\n end", "def determine_memory\n result = @info[:memory] = {}\n\n free_cmd = \"free -m|awk '$1 ~ /Mem/ {print $2, $2-$6-$7}; $1 ~ /Swap/ \" \\\n \"{print $3}'|xargs\"\n mem = @shell.query('MEMORY', free_cmd)\n total, used, swap = mem.split(/\\s+/)\n\n result[:total] = total.to_i\n result[:mem_used] = used.to_i\n result[:swap_used] = swap.to_i\n result[:swapping?] = swqp.to_i > 0\n end", "def dd_map(arr)\n\n end", "def map(uuid, delete = true)\n log(\"image map #{uuid}\")\n lock(:map) do\n delete ? @cache[:map].delete(uuid) : @cache[:map].fetch(uuid, nil)\n end\n end", "def get_system_memory_info_mb\n key_name = redis_record.support_key(get_server_hostname, [get_server_hostname, \"memory\"].join(\"_\"))\n value = ActiveSupport::HashWithIndifferentAccess.new(redis_record.parsed_get key_name)\n return_value = if value == {}\n mem_info = (`free -ml`).split(\" \") rescue []\n used_memory = mem_info[8].strip.to_i rescue 0\n used_swap_memory = mem_info[27].strip.to_i rescue 0\n data = {used_memory: used_memory, used_swap_memory: used_swap_memory}\n redis_record.set(key_name, data.to_json, {ex: SYS_CALL_FREQ})\n data\n else\n value\n end\n\n return_value\n end", "def physical_memory_info\n\n if PlatformInfo.linux?\n\n {\n :total => proc_meminfo['MemTotal'],\n :used => proc_meminfo['MemTotal'] - proc_meminfo['MemFree'],\n :cached => proc_meminfo['Cached'],\n :free => proc_meminfo['MemFree'] \n }\n\n elsif PlatformInfo.osx?\n\n hw_memsize = capture_command_output('sysctl', 'hw.memsize')[0]\n total_memory = hw_memsize.split(':')[1].strip.to_i\n\n # Parse the header information produced by top -l 1 to figure out the\n # physical memory stats.\n top = capture_command_output('top', '-l', '1')\n top_phys_mem = top.select { |t| t =~ /^PhysMem\\:/ }.first.strip.gsub(/^PhysMem\\:\\s+/, '')\n top_phys_mem_pairs = top_phys_mem.split(',')\n\n phys_mem = {}\n top_phys_mem_pairs.each do |top_phys_mem_pair|\n items = top_phys_mem_pair.strip.split(/\\s+/)\n key = items[1].gsub(/\\W/, '')\n value = items[0].to_i * 1024 * 1024 # Convert MB to bytes\n phys_mem[key] = value\n end\n\n {\n :total => total_memory,\n :used => phys_mem['used'],\n :free => phys_mem['free']\n }\n\n else\n unsupported_platform\n end\n\n end", "def syscall_alloc(sz); ptr(Ragweed::Wrap32::virtual_alloc_ex(@h, sz)); end", "def guest_memory\n begin\n host_memory / 2\n rescue\n 8192\n end\nend", "def assemble_buffer(direction, function, args)\n\t\t\t\t\t\t\tlayout = {} # paramName => BufferItem\n\t\t\t\t\t\t\tblob = \"\"\n\t\t\t\t\t\t\t#puts \" building buffer: #{direction}\"\n\t\t\t\t\t\t\tfunction.params.each_with_index do |param_desc, param_idx|\n\t\t\t\t\t\t\t\t#puts \" processing #{param_desc[0]} #{param_desc[1]} #{param_desc[2]}\"\n\t\t\t\t\t\t\t\t# we care only about inout buffers\n\t\t\t\t\t\t\t\tif param_desc[2] == direction\n\t\t\t\t\t\t\t\t\tbuffer = nil\n\n\t\t\t\t\t\t\t\t\t# Special case:\n\t\t\t\t\t\t\t\t\t# The user can choose to supply a Null pointer instead of a buffer\n\t\t\t\t\t\t\t\t\t# in this case we don't need space in any heap buffer\n\t\t\t\t\t\t\t\t\tif param_desc[0][0,1] == 'P' # type is a pointer\n\t\t\t\t\t\t\t\t\t\tif args[param_idx] == nil\n\t\t\t\t\t\t\t\t\t\t\tnext\n\t\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\t\tend\n\n\t\t\t\t\t\t\t\t\tcase param_desc[0] # required argument type\n\t\t\t\t\t\t\t\t\t\twhen \"PDWORD\"\n\t\t\t\t\t\t\t\t\t\t\tdw = param_to_dword(args[param_idx])\n\t\t\t\t\t\t\t\t\t\t\tbuffer = [dw].pack('V')\n\t\t\t\t\t\t\t\t\t\twhen \"PWCHAR\"\n\t\t\t\t\t\t\t\t\t\t\traise \"param #{param_desc[1]}: string expected\" unless args[param_idx].class == String\n\t\t\t\t\t\t\t\t\t\t\tbuffer = str_to_uni_z(args[param_idx])\n\t\t\t\t\t\t\t\t\t\twhen \"PCHAR\"\n\t\t\t\t\t\t\t\t\t\t\traise \"param #{param_desc[1]}: string expected\" unless args[param_idx].class == String\n\t\t\t\t\t\t\t\t\t\t\tbuffer = str_to_ascii_z(args[param_idx])\n\t\t\t\t\t\t\t\t\t\twhen \"PBLOB\"\n\t\t\t\t\t\t\t\t\t\t\traise \"param #{param_desc[1]}: please supply your BLOB as string!\" unless args[param_idx].class == String\n\t\t\t\t\t\t\t\t\t\t\tbuffer = args[param_idx]\n\t\t\t\t\t\t\t\t\t\t# other types (non-pointers) don't reference buffers\n\t\t\t\t\t\t\t\t\t\t# and don't need any treatment here\n\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\t\tif buffer != nil\n\t\t\t\t\t\t\t\t\t\t#puts \" adding #{buffer.length} bytes to heap blob\"\n\t\t\t\t\t\t\t\t\t\tlayout[param_desc[1]] = BufferItem.new(param_idx, blob.length, buffer.length, param_desc[0])\n\t\t\t\t\t\t\t\t\t\tblob += buffer\n\t\t\t\t\t\t\t\t\t\t#puts \" heap blob size now #{blob.length}\"\n\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t#puts \" built buffer: #{direction}\"\n\t\t\t\t\t\t\treturn [layout, blob]\n\t\t\t\t\t\tend", "def scan(i, opts={})\r\n refresh opts\r\n memt = @memlist[i]\r\n if memt[1] > 4096\r\n 0.step(memt[1], 4096) do |i|\r\n block = (memt[1] - i).cap(4096)\r\n yield read(memt[0] + i, block), memt[0]+i\r\n end\r\n else\r\n yield read(memt[0], memt[1]), memt[0]\r\n end\r\n end", "def resource_map\n return @resource_map unless @resource_map.nil?\n _pos = @_io.pos\n @_io.seek(header.ofs_resource_map)\n @_raw_resource_map = @_io.read_bytes(header.len_resource_map)\n _io__raw_resource_map = Kaitai::Struct::Stream.new(@_raw_resource_map)\n @resource_map = ResourceMap.new(_io__raw_resource_map, self, @_root)\n @_io.seek(_pos)\n @resource_map\n end", "def get_large_mapping( indicator )\n\treturn 0\t\tif indicator <= 1\n\t3 + get_large_mapping( indicator / 1000 )\nend", "def write(base, data)\n request = Packet.create_request(COMMAND_ID_STDAPI_SYS_PROCESS_MEMORY_WRITE)\n\n request.add_tlv(TLV_TYPE_HANDLE, process.handle)\n request.add_tlv(TLV_TYPE_BASE_ADDRESS, base)\n request.add_tlv(TLV_TYPE_PROCESS_MEMORY, data)\n\n response = process.client.send_request(request)\n\n return response.get_tlv_value(TLV_TYPE_LENGTH)\n end", "def in_memory\n []\n end", "def in_memory\n []\n end", "def calculate_offsets\n\n # Maintain the offset into the the file on disk. This is used\n # to update the various structures.\n offset = @header.bytesize\n\n # First pass over load commands. Most sizes are filled in here.\n @load_commands.each do |cmd|\n case cmd[:cmd]\n\n when LC_SEGMENT\n seg = cmd\n sections = @sections[seg[:segname]]\n section_size = sections.size * Section.bytesize\n section_vm_size = sections.inject(0) { |total, sect| total + sect[:size] }\n section_disk_size = sections.inject(0) do |total, sect|\n total + @section_disk_size[sect[:sectname]]\n end\n\n ### TODO this should be redundant. try commenting it out one day.\n seg[:nsects] = sections.size\n seg[:cmdsize] = seg.bytesize + section_size\n ###\n\n seg[:vmsize] = section_vm_size\n seg[:filesize] = section_disk_size\n\n when LC_SYMTAB\n # nop\n\n else\n raise \"unsupported load command: #{cmd.inspect}\"\n end\n\n offset += cmd[:cmdsize]\n end\n\n\n # offset now points to the end of the Mach-O headers, or the beginning\n # of the binary blobs of section data at the end.\n\n # Second pass over load commands. Fill in file offsets.\n @load_commands.each do |cmd|\n case cmd[:cmd]\n\n when LC_SEGMENT\n seg = cmd\n sections = @sections[seg[:segname]]\n seg[:fileoff] = offset\n sections.each do |sect|\n sect[:offset] = offset\n offset += @section_disk_size[sect[:sectname]]\n end\n\n when LC_SYMTAB\n if @reloc_info\n # update text section with relocation info\n __text = @sections[@text_segname][@text_sect_index]\n __text[:reloff] = offset\n __text[:nreloc] = @reloc_info.length\n offset += @reloc_info.first.bytesize * @reloc_info.length\n end\n st = cmd\n st[:symoff] = offset\n offset += st[:nsyms] * Nlist.bytesize\n st[:stroff] = offset\n offset += st[:strsize]\n\n\n # No else clause is necessary, the first iteration should have caught them.\n\n end\n\n end # @load_commands.each\n\n end", "def free!\n memory_map.transform_values! { |_| FREE }\n end", "def read_memory(addr, num_elements, options = {}, &block)\n check_alive! # this would set @pid\n options[:as] = block if block_given?\n MemoryIO.attach(@pid).read(addr, num_elements, **options)\n end", "def [] index\n if index.class != Fixnum or index >= 2**(@mar.length) or index < 0\n raise ArgumentError.new \"wrong address #{ index.inspect }\"\n end\n\n return Array.new(@mdr.length, 0) if @memory[index].nil?\n @memory[index]\n end", "def entry_size; BLOCK_SIZE; end", "def entry_size; BLOCK_SIZE; end", "def in_memory\n []\n end", "def get_object(offset)\n io = to_shm_io\n io.seek(offset)\n Marshal.load(io)\n end", "def load_page(id)\n @file.sysseek id * PAGE_SIZE, IO::SEEK_SET\n binary = @file.sysread(PAGE_SIZE)\n @page_raw = binary.unpack('L*')\n load_page_from_raw\n end", "def map(disk)\n file = source(disk)\n cmd = \"#{COMMANDS[:map]} #{file}\"\n\n rc, stdout, = Command.execute_log(cmd, false)\n\n if rc == 0\n return stdout.strip # device used, ex. /dev/loop0\n end\n\n nil\n end", "def load_map_chunk_column column_x, column_z; end", "def assemble_buffer(direction, function, args)\n layout = {} # paramName => BufferItem\n blob = \"\"\n #puts \" building buffer: #{direction}\"\n function.params.each_with_index do |param_desc, param_idx|\n #puts \" processing #{param_desc[0]} #{param_desc[1]} #{param_desc[2]}\"\n # we care only about inout buffers\n if param_desc[2] == direction\n buffer = nil\n # Special case:\n # The user can choose to supply a Null pointer instead of a buffer\n # in this case we don't need space in any heap buffer\n if param_desc[0][0,1] == 'P' # type is a pointer\n if args[param_idx] == nil\n next\n end\n end\n\n case param_desc[0] # required argument type\n when \"PDWORD\"\n dw = param_to_number(args[param_idx])\n buffer = [dw].pack('V')\n when \"PWCHAR\"\n raise \"param #{param_desc[1]}: string expected\" unless args[param_idx].class == String\n buffer = str_to_uni_z(args[param_idx])\n when \"PCHAR\"\n raise \"param #{param_desc[1]}: string expected\" unless args[param_idx].class == String\n buffer = str_to_ascii_z(args[param_idx])\n when \"PBLOB\"\n raise \"param #{param_desc[1]}: please supply your BLOB as string!\" unless args[param_idx].class == String\n buffer = args[param_idx]\n # other types (non-pointers) don't reference buffers\n # and don't need any treatment here\n end\n\n if buffer != nil\n #puts \" adding #{buffer.length} bytes to heap blob\"\n layout[param_desc[1]] = BufferItem.new(param_idx, blob.length, buffer.length, param_desc[0])\n blob += buffer\n # sf: force 8 byte alignment to satisfy x64, wont matter on x86.\n while( blob.length % 8 != 0 )\n blob += \"\\x00\"\n end\n #puts \" heap blob size now #{blob.length}\"\n end\n end\n end\n #puts \" built buffer: #{direction}\"\n return [layout, blob]\n end", "def get_mem_usage( pid )\n\tp = @client.sys.process.open( pid.to_i, PROCESS_QUERY_INFORMATION | PROCESS_VM_READ )\n\tif( p )\n\t\tbegin\n\n\t\t\tif( not @client.railgun.get_dll( 'psapi' ) )\n\t\t\t\[email protected]_dll( 'psapi' )\n\t\t\tend\n\n\t\t\t# http://msdn.microsoft.com/en-us/library/ms683219%28v=VS.85%29.aspx\n\t\t\tif( not @client.railgun.psapi.functions['GetProcessMemoryInfo'] )\n\t\t\t\[email protected]_function( 'GetProcessMemoryInfo', 'BOOL', [\n\t\t\t\t\t[ \"HANDLE\", \"hProcess\", \"in\" ],\n\t\t\t\t\t[ \"PBLOB\", \"ProcessMemoryCounters\", \"out\" ],\n\t\t\t\t\t[ \"DWORD\", \"Size\", \"in\" ]\n\t\t\t\t\t]\n\t\t\t\t)\n\t\t\tend\n\n\t\t\tr = @client.railgun.psapi.GetProcessMemoryInfo( p.handle, 72, 72 )\n\t\t\tif( r['return'] )\n\t\t\t\tpmc = r['ProcessMemoryCounters']\n\t\t\t\t# unpack the PROCESS_MEMORY_COUNTERS structure (http://msdn.microsoft.com/en-us/library/ms684877%28v=VS.85%29.aspx)\n\t\t\t\t# Note: As we get the raw structure back from railgun we need to account\n\t\t\t\t# for SIZE_T variables being 32bit on x86 and 64bit on x64\n\t\t\t\tmem = nil\n\t\t\t\tif( @client.platform =~ /win32/ )\n\t\t\t\t\tmem = pmc[12..15].unpack('V').first\n\t\t\t\telsif( @client.platform =~ /win64/ )\n\t\t\t\t\tmem = pmc[16..23].unpack('Q').first\n\t\t\t\tend\n\t\t\t\treturn (mem/1024)\n\t\t\tend\n\t\trescue\n\t\t\tp \"Exception - #{$!}\"\n\t\tend\n\n\t\tp.close\n\tend\n\n\treturn nil\nend", "def memory\n\t\treturn self.class.instance_variable_get(:@memory)\n\tend", "def memory\n configuration.memory\n end", "def get_physical_memory\n # only support Linux and FreeBSD right now\n os = Facter['kernel']\n return if os.nil? or (os.value != 'Linux' and os.value != 'FreeBSD')\n\n physical_memory = 0\n dmi_data = get_dmi_data\n\n return if dmi_data.nil? or dmi_data['Memory Device'].nil?\n\n dmi_data['Memory Device'].each do |mem_dev|\n\n size = mem_dev['Size']\n form_factor = mem_dev['Form Factor']\n locator = mem_dev['Locator']\n # Some systems report little chunks of memory other than\n # main system memory as Memory Devices, the 'DIMM' as\n # form factor seems to indicate main system memory.\n # Unfortunately some DIMMs are reported with a form\n # factor of '<OUT OF SPEC>'. In that case fall back to\n # checking for signs of it being a DIMM in the locator\n # field.\n if (size != 'No Module Installed' &&\n ((form_factor == 'DIMM' || form_factor == 'FB-DIMM' || form_factor == 'SODIMM') ||\n (form_factor == '<OUT OF SPEC>' && locator =~ /DIMM/)))\n megs, units = size.split(' ')\n\n next if units != 'MB'\n physical_memory += megs.to_i;\n end\n end\n physical_memory\n end", "def get_memory_rasd_item(id)\n request(\n :expects => 200,\n :idempotent => true,\n :method => 'GET',\n :parser => Fog::ToHashDocument.new,\n :path => \"vApp/#{id}/virtualHardwareSection/memory\"\n )\n end", "def set_memory_mode()\n send_com(0x08)\n end", "def initial_address(memory, process)\n initial_address = nil\n memory.each_with_index {|elem, index|\n next unless elem.nil?\n memory_slot = memory[index, process.memory_blocks]\n break if memory_slot.size < process.memory_blocks\n return index if memory_slot.all?(&:nil?)\n }\n initial_address\n end", "def update\n return unless info = read_meminfo\n @ram_total = convert_to_bytes(info[MEM_TOTAL])\n @ram_free = convert_to_bytes(info[MEM_FREE])\n @ram_available = convert_to_bytes(info[MEM_AVAILABLE])\n @ram_buffers = convert_to_bytes(info[BUFFERS])\n @ram_cached = convert_to_bytes(info[CACHED])\n @swap_total = convert_to_bytes(info[SWAP_TOTAL])\n @swap_free = convert_to_bytes(info[SWAP_FREE])\n end", "def memory\n case @game.view\n when :world_map\n current_memory = :world_map\n when :current_map\n current_memory = @game.world_map.current_seed\n end\n \n if !@memory[current_memory]\n map = @game.map\n @memory[current_memory] = Matriz.new(map.width, map.height, false) \n end\n\n return @memory[current_memory]\n end", "def initTableMapping\n $map = Array.new(2000) { Array.new(2000,\"\") }\n $final_map = Array.new(2000) { Array.new(2000,\"\") }\n $hash = Hash.new(0)\nend", "def sys_mem( type , amount)\n r_class = eval( \"Parfait::#{type.object_class.name}\" )\n obj = r_class.allocate\n obj.set_type(type)\n obj\n end", "def current_memory\n nil\n end", "def run\n\t\tbitmask_or = 0\n\t\tbitmask_and = 2**36 - 1\n\t\[email protected] do |l|\n\t\t\tif l.start_with?(\"mask\")\n\t\t\t\tm = l.split(\" \")[2]\n\t\t\t\tbitmask_or = m.gsub(\"X\", \"0\").to_i(2)\n\t\t\t\tbitmask_and = m.gsub(\"X\", \"1\").to_i(2)\n\t\t\telsif m = /mem\\[(\\d+)\\]\\s+=\\s(\\d+)/.match(l)\n\t\t\t\taddr = m[1].to_i\n\t\t\t\tvalue = m[2].to_i\n\t\t\t\tmvalue = value & bitmask_and | bitmask_or\n\t\t\t\t@memory[addr] = mvalue\n\t\t\tend\n\t\tend\n\tend", "def index_psm_positions\n # create an in-memroy index of PSM byteoffsets\n q,p = 0,0\n # move the cursor past the boundary line\n @filehandle.readline\n @filehandle.each do |line|\n break if line =~ @dat.boundary\n line =~ /q(\\d+)_p(\\d+)/\n qq,pp= $1.to_i, $2.to_i\n next if q == qq && p == pp\n q,p = qq,pp\n unless @psmidx.has_key?(q)\n @psmidx[q] = {}\n end\n @psmidx[q][p] = @filehandle.pos - line.length\n end\n @endbytepos = @filehandle.pos - @dat.boundary_string.length\n self.rewind\n end", "def offsetsAndConfigurationIndex(file)\n endiannessMarkerBytes = nil\n result = {}\n \n def readInt(endianness, bytes)\n if endianness == :little\n # Little endian\n (bytes[0] << 0 |\n bytes[1] << 8 |\n bytes[2] << 16 |\n bytes[3] << 24)\n else\n # Big endian\n (bytes[0] << 24 |\n bytes[1] << 16 |\n bytes[2] << 8 |\n bytes[3] << 0)\n end\n end\n \n def prepareMagic(endianness, numbers)\n magicBytes = []\n numbers.each {\n | number |\n currentBytes = []\n 4.times {\n currentBytes << (number & 0xff)\n number >>= 8\n }\n if endianness == :big\n currentBytes.reverse!\n end\n magicBytes += currentBytes\n }\n magicBytes\n end\n \n fileBytes = []\n \n File.open(file, \"rb\") {\n | inp |\n loop {\n byte = inp.getbyte\n break unless byte\n fileBytes << byte\n }\n }\n \n def sliceByteArrays(byteArray, pattern)\n result = []\n lastSlicePoint = 0\n (byteArray.length - pattern.length + 1).times {\n | index |\n foundOne = true\n pattern.length.times {\n | subIndex |\n if byteArray[index + subIndex] != pattern[subIndex]\n foundOne = false\n break\n end\n }\n if foundOne\n result << byteArray[lastSlicePoint...index]\n lastSlicePoint = index + pattern.length\n end\n }\n \n result << byteArray[lastSlicePoint...(byteArray.length)]\n \n result\n end\n \n [:little, :big].each {\n | endianness |\n headerMagicBytes = prepareMagic(endianness, OFFSET_HEADER_MAGIC_NUMBERS)\n magicBytes = prepareMagic(endianness, OFFSET_MAGIC_NUMBERS)\n \n bigArray = sliceByteArrays(fileBytes, headerMagicBytes)\n unless bigArray.size <= 1\n bigArray[1..-1].each {\n | configArray |\n array = sliceByteArrays(configArray, magicBytes)\n index = readInt(endianness, array[1])\n offsets = []\n array[2..-1].each {\n | data |\n offsets << readInt(endianness, data)\n }\n result[index] = offsets\n }\n end\n }\n \n raise MissingMagicValuesException unless result.length >= 1\n \n # result is {index1=>offsets1, index2=>offsets2} but we want to return\n # [[offsets1, index1], [offsets2, index2]].\n return result.map {\n | pair |\n pair.reverse\n }\nend", "def out_buffers; @out_buffers; end", "def lmap(&block); end", "def add_map(image, load_address, offset=0, sz=nil, flags=nil,\n arch_info=nil)\n sz ||= image.size\n check_map_overlap(load_address, sz)\n m = Bgo::Map.new(load_address, image, offset, sz, flags, arch_info)\n @arch_info ||= m.arch_info\n add_map_object m\n end", "def memorize_bitmap(bitmap = nil)\n @storedBitmap = bitmap if !bitmap.nil?\n @storedBitmap = self.bitmap.clone if bitmap.nil?\n end" ]
[ "0.6622615", "0.6622615", "0.6399159", "0.60531455", "0.601997", "0.58994913", "0.5898935", "0.58432436", "0.5770079", "0.56304926", "0.56276196", "0.56069815", "0.55884534", "0.5577522", "0.5572116", "0.55376565", "0.5536974", "0.5507512", "0.55058056", "0.54760176", "0.54751265", "0.5449174", "0.54275143", "0.5417555", "0.54158044", "0.5394523", "0.53798604", "0.53536224", "0.53388655", "0.52925247", "0.52766526", "0.52599114", "0.5242592", "0.52397805", "0.52296156", "0.5229033", "0.5226785", "0.51902497", "0.51878065", "0.5172606", "0.51619416", "0.51459414", "0.51370364", "0.51136565", "0.5087821", "0.507007", "0.5062836", "0.5053048", "0.5051825", "0.50492024", "0.50402325", "0.50359374", "0.5034569", "0.50268584", "0.50213456", "0.5020805", "0.5006777", "0.498255", "0.49683192", "0.49677792", "0.49581376", "0.49570075", "0.4949636", "0.4942335", "0.49407944", "0.49355036", "0.4920322", "0.4908213", "0.4908213", "0.49042103", "0.4900565", "0.48905918", "0.48880303", "0.4877045", "0.4877045", "0.48765394", "0.48764396", "0.48731154", "0.48704982", "0.4863863", "0.48567146", "0.48531345", "0.48420143", "0.48411185", "0.48359612", "0.48194203", "0.48154813", "0.4810796", "0.48090538", "0.48004007", "0.47910962", "0.47906458", "0.4788024", "0.47869736", "0.47849122", "0.47785407", "0.4777961", "0.47734165", "0.4770591", "0.4765525" ]
0.71156275
0
GET /line_items GET /line_items.json
def index @line_items = LineItem.all respond_to do |format| format.html # index.html.erb format.json { render json: @line_items } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json {\n render json: @line_items \n }\n end\n end", "def index\n @line_items = @order.line_items\n\n render json: @line_items\n end", "def line_items(account_id, options = {})\n get(\"/accounts/#{account_id}/line_items\", options)\n end", "def show\n @line_item = @order.line_items.find(params[:id])\n\n render json: @line_item\n end", "def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @line_items }\n end\n end", "def show\n puts params.inspect.green\n\n @line_item = LineItem.find(params[:id])\n\n puts @line_items.inspect.magenta\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @line_item }\n end\n end", "def index\n @line_items = LineItem.all\n end", "def index\n @line_items = LineItem.all\n end", "def index\n @line_items = LineItem.all\n end", "def index\n @line_items = LineItem.all\n end", "def index\n @line_items = LineItem.all\n end", "def index\n @line_items = LineItem.all\n end", "def index\n @line_items = LineItem.all\n end", "def index\n @line_items = LineItem.all\n end", "def index\n @line_items = LineItem.all\n end", "def index\n @line_items = LineItem.all\n end", "def index\n @line_items = LineItem.all\n end", "def index\n @line_items = LineItem.all\n end", "def show\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @line_item }\n end\n end", "def show\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @line_item }\n end\n end", "def show\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @line_item }\n end\n end", "def show\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @line_item }\n end\n end", "def show\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @line_item }\n end\n end", "def show\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @line_item }\n end\n end", "def show\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @line_item }\n end\n end", "def show\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @line_item }\n end\n end", "def show\n @lineitem = Lineitem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lineitem }\n end\n end", "def index\n @line_items = LineItem.all\nend", "def index\n @line_items = LineItem.all\nend", "def show\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @line_item }\n end\n end", "def show\n @item_line = ItemLine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item_line }\n end\n end", "def index\n @order_line_items = @order.order_line_items\n\n render json: @order_line_items\n end", "def index\n @lineitems = Lineitem.all\n end", "def line_items(id = nil, opts = {})\n load_resource(LineItem, id, opts)\n end", "def index #index defines line_items then query all the line items then pass it to it\n @line_items = LineItem.all\n end", "def show\n render json: @order_line_item\n end", "def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @line_item }\n end\n end", "def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @line_item }\n end\n end", "def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @line_item }\n end\n end", "def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @line_item }\n end\n end", "def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @line_item }\n end\n end", "def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @line_item }\n end\n end", "def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @line_item }\n end\n end", "def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @line_item }\n end\n end", "def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @line_item }\n end\n end", "def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @line_item }\n end\n end", "def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @line_item }\n end\n end", "def create\n @line_item = @order.line_items.new(line_item_params)\n\n if @line_item.save\n render json: @line_item, status: :created, location: [@order, @line_item]\n else\n render json: @line_item.errors, status: :unprocessable_entity\n end\n end", "def index\n @invoice_line_items = current_brand.invoice_line_items.all\n puts @invoice_line_items.as_json\n @invoice_line_item = InvoiceLineItem.new\n end", "def index\n # @line_items = LineItem.all\n @line_items = LineItem.where(order_id:@order.id)\n end", "def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @line_items }\n end\n end", "def show\n @line_item1 = LineItem1.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @line_item1 }\n end\n end", "def set_line_item\n @line_items = LineItem.find(params[:id])\n end", "def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @line_items }\n end\n end", "def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @line_items }\n end\n end", "def new\n @lineitem = Lineitem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lineitem }\n end\n end", "def show\n @line_items = @order.line_items\n end", "def line_item_params\n params[:line_item]\n end", "def new\n @item_line = ItemLine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item_line }\n end\n end", "def index\n @invoice_line_items = InvoiceLineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invoice_line_items }\n end\n end", "def lineitem\n if @lineitem.nil?\n @lineitem = {}\n lineitems.each { |li| @lineitem[li.lineitem_id] = li }\n @lineitem.freeze\n end\n return @lineitem\n end", "def lineitems\n if @lineitems.nil?\n @lineitems = @hash['lineitems'].map { |li| Twocheckout::LineItem.new(li) }\n @lineitems.freeze\n end\n @lineitems\n end", "def show\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @line_item }\n end\n end", "def line_items\n move_down 20\n data = line_item_data\n options = { width: bounds.width }\n header_styles = {\n border_width: 2,\n border_color: \"333333\"\n }\n table data, options do |table|\n table.rows(0).style(table_style.merge(header_styles))\n table.rows(1).style(table_style.merge(padding_top: 30))\n table.rows(2..data.length-1).style(table_style)\n end\n move_down 10\n stroke_color \"999999\"\n stroke_horizontal_rule\n end", "def show\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @line_item }\n end\n end", "def show\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @line_item }\n end\n end", "def show\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @line_item }\n end\n end", "def index\n @line_property_items = LinePropertyItem.all\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end", "def show\n @popularty_line_item = PopulartyLineItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @popularty_line_item }\n end\n end", "def _line_items(order)\n params.require(:orders).each do |variant_id, info|\n count = info.require(:count)\n price = info.require(:price)\n variant = Variant.find variant_id\n LineItem.create(variant_id: variant_id, order: order, quantity: count,\n price: price).ready_to_pay!\n end\n end", "def create \n @line_item = LineItem.new(line_item_params)\n respond_to do |format|\n if @line_item.save\n format.html { redirect_to '/line_items', notice: \"Line item was successfully created.\" }\n format.json { render :show, status: :created, location: @line_item }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_line_item\n @line_item = order.line_items.find(params[:id])\n end", "def line_items\n if line_items_downloaded?\n @line_items\n\n # There is an credit_note_is so we can assume this record was loaded from Xero.\n # attempt to download the line_item records.\n elsif credit_note_id =~ GUID_REGEX\n raise NoGatewayError unless @gateway\n\n response = @gateway.get_credit_note(credit_note_id)\n raise CreditNoteNotFoundError, \"CreditNote with ID #{credit_note_id} not found in Xero.\" unless response.success? && response.credit_note.is_a?(XeroGateway::CreditNote)\n\n @line_items = response.credit_note.line_items\n @line_items_downloaded = true\n\n @line_items\n\n # Otherwise, this is a new credit_note, so return the line_items reference.\n else\n @line_items\n end\n end", "def items\n @items ||= line_items.to_a\n end", "def set_line_item\n @line_item = LineItem.find_by(params[:id])\n end", "def show\n @purchase_order_item_line = PurchaseOrderItemLine.find(params[:id])\n\n# respond_to do |format|\n# format.html # show.html.erb\n# format.json { render json: @purchase_order_item_line }\n# end\n end", "def show\n @product = Product.find(params[:id])\n @line_item = LineItem.create!\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end" ]
[ "0.7619621", "0.7579001", "0.74959284", "0.7447879", "0.74131817", "0.7400883", "0.73949015", "0.73949015", "0.73949015", "0.73949015", "0.73949015", "0.73949015", "0.73949015", "0.73949015", "0.73949015", "0.73949015", "0.73949015", "0.7394513", "0.72700405", "0.7269355", "0.7269355", "0.7269355", "0.7269355", "0.7269355", "0.7269355", "0.7269355", "0.7198663", "0.7197404", "0.7197404", "0.71949315", "0.71695495", "0.71667475", "0.7165908", "0.68659765", "0.6834166", "0.66837156", "0.6679472", "0.6679472", "0.6679472", "0.6679472", "0.6679472", "0.6679472", "0.6679472", "0.6679472", "0.6679472", "0.6679472", "0.6636879", "0.6632556", "0.65871763", "0.65868145", "0.6580055", "0.6565131", "0.65644604", "0.65585023", "0.65585023", "0.65303886", "0.65184087", "0.6515762", "0.65109766", "0.6486542", "0.6366651", "0.6352595", "0.63398015", "0.6335589", "0.63056654", "0.63056654", "0.63056654", "0.6295816", "0.6288563", "0.6288563", "0.6288563", "0.6288563", "0.6288563", "0.6288563", "0.6288563", "0.6288563", "0.62570864", "0.62469476", "0.6239205", "0.62327987", "0.6232405", "0.62253815", "0.6223375", "0.6222755", "0.6178819", "0.6177394", "0.6177394", "0.6177394", "0.6177394", "0.6177394", "0.6177394", "0.6177394", "0.6177394", "0.6177394", "0.6177394", "0.6177394", "0.6177394" ]
0.74669135
6
GET /line_items/1 GET /line_items/1.json
def show @line_item = LineItem.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @line_item } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @line_item = @order.line_items.find(params[:id])\n\n render json: @line_item\n end", "def show\n puts params.inspect.green\n\n @line_item = LineItem.find(params[:id])\n\n puts @line_items.inspect.magenta\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @line_item }\n end\n end", "def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json {\n render json: @line_items \n }\n end\n end", "def show\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @line_item }\n end\n end", "def show\n @item_line = ItemLine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item_line }\n end\n end", "def show\n @lineitem = Lineitem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lineitem }\n end\n end", "def index\n @line_items = @order.line_items\n\n render json: @line_items\n end", "def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @line_items }\n end\n end", "def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @line_items }\n end\n end", "def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @line_items }\n end\n end", "def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @line_items }\n end\n end", "def show\n @line_item1 = LineItem1.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @line_item1 }\n end\n end", "def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @line_items }\n end\n end", "def index\n @line_items = LineItem.all\n end", "def index\n @line_items = LineItem.all\n end", "def index\n @line_items = LineItem.all\n end", "def index\n @line_items = LineItem.all\n end", "def index\n @line_items = LineItem.all\n end", "def index\n @line_items = LineItem.all\n end", "def index\n @line_items = LineItem.all\n end", "def index\n @line_items = LineItem.all\n end", "def index\n @line_items = LineItem.all\n end", "def index\n @line_items = LineItem.all\n end", "def index\n @line_items = LineItem.all\n end", "def index\n @line_items = LineItem.all\n end", "def index\n @line_items = LineItem.all\nend", "def index\n @line_items = LineItem.all\nend", "def line_items(account_id, options = {})\n get(\"/accounts/#{account_id}/line_items\", options)\n end", "def index\n @order_line_items = @order.order_line_items\n\n render json: @order_line_items\n end", "def index\n @lineitems = Lineitem.all\n end", "def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @line_item }\n end\n end", "def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @line_item }\n end\n end", "def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @line_item }\n end\n end", "def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @line_item }\n end\n end", "def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @line_item }\n end\n end", "def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @line_item }\n end\n end", "def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @line_item }\n end\n end", "def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @line_item }\n end\n end", "def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @line_item }\n end\n end", "def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @line_item }\n end\n end", "def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @line_item }\n end\n end", "def index #index defines line_items then query all the line items then pass it to it\n @line_items = LineItem.all\n end", "def new\n @line_item1 = LineItem1.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @line_item1 }\n end\n end", "def show\n render json: @order_line_item\n end", "def new\n @item_line = ItemLine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item_line }\n end\n end", "def new\n @lineitem = Lineitem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lineitem }\n end\n end", "def set_line_item\n @line_items = LineItem.find(params[:id])\n end", "def show\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @line_item }\n end\n end", "def index\n # @line_items = LineItem.all\n @line_items = LineItem.where(order_id:@order.id)\n end", "def index\n @invoice_line_items = current_brand.invoice_line_items.all\n puts @invoice_line_items.as_json\n @invoice_line_item = InvoiceLineItem.new\n end", "def show\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @line_item }\n end\n end", "def show\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @line_item }\n end\n end", "def show\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @line_item }\n end\n end", "def show\n @line = Line.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @line }\n end\n end", "def show\n @purchase_order_item_line = PurchaseOrderItemLine.find(params[:id])\n\n# respond_to do |format|\n# format.html # show.html.erb\n# format.json { render json: @purchase_order_item_line }\n# end\n end", "def get_item( item )\n @session.base_url = \"http://cl.ly\"\n resp = @session.get( \"/\" + item )\n \n raise ItemNotFound if resp.status == 404\n Crack::JSON.parse(resp.body)\n end", "def create\n @line_item = @order.line_items.new(line_item_params)\n\n if @line_item.save\n render json: @line_item, status: :created, location: [@order, @line_item]\n else\n render json: @line_item.errors, status: :unprocessable_entity\n end\n end", "def line_items(id = nil, opts = {})\n load_resource(LineItem, id, opts)\n end", "def show\n @popularty_line_item = PopulartyLineItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @popularty_line_item }\n end\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end", "def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @line_items }\n end\n end", "def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @line_items }\n end\n end", "def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @line_items }\n end\n end", "def set_line_item\n @line_item = LineItem.find_by(params[:id])\n end", "def set_line_item\n @line_item = order.line_items.find(params[:id])\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\nend", "def show\n @product = Product.find(params[:id])\n @line_item = LineItem.create!\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "def line_item_params\n params[:line_item]\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end" ]
[ "0.7516723", "0.7455819", "0.7342249", "0.7341003", "0.73255855", "0.73170966", "0.72770566", "0.7244238", "0.7244238", "0.7244238", "0.7244238", "0.72067314", "0.71952313", "0.7064094", "0.70640516", "0.70640516", "0.70640516", "0.70640516", "0.70640516", "0.70640516", "0.70640516", "0.70640516", "0.70640516", "0.70640516", "0.70640516", "0.6933103", "0.6933103", "0.687378", "0.68702805", "0.68492264", "0.6779435", "0.6779435", "0.6779435", "0.6779435", "0.6779435", "0.6779435", "0.6779435", "0.6779435", "0.6779435", "0.6779435", "0.6740784", "0.6734606", "0.6686897", "0.6667432", "0.661852", "0.6617807", "0.6494434", "0.64784837", "0.6454664", "0.6452518", "0.6446566", "0.6446566", "0.6446566", "0.64348376", "0.6431251", "0.6426942", "0.64164585", "0.640508", "0.6386478", "0.63712525", "0.63712525", "0.63712525", "0.63712525", "0.63712525", "0.63712525", "0.63712525", "0.63712525", "0.63535243", "0.6336876", "0.6336876", "0.63176185", "0.6303481", "0.628269", "0.6254375", "0.6248865", "0.62437624", "0.62437624", "0.62437624", "0.62437624", "0.62437624", "0.62437624", "0.62437624", "0.62437624", "0.62437624", "0.62437624", "0.62437624", "0.62437624", "0.62437624", "0.62437624", "0.62437624", "0.62437624", "0.62437624", "0.62437624" ]
0.74113274
8
GET /line_items/new GET /line_items/new.json
def new @line_item = LineItem.new respond_to do |format| format.html # new.html.erb format.json { render json: @line_item } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @lineitem = Lineitem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lineitem }\n end\n end", "def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @line_item }\n end\n end", "def new\n @item_line = ItemLine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item_line }\n end\n end", "def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n end\n end", "def new\n @line_item1 = LineItem1.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @line_item1 }\n end\n end", "def new\n @line = Line.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @line }\n end\n end", "def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @line_item }\n end\n end", "def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @line_item }\n end\n end", "def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @line_item }\n end\n end", "def new\r\n @lineitem = Lineitem.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @lineitem }\r\n end\r\n end", "def new\n @popularty_line_item = PopulartyLineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @popularty_line_item }\n end\n end", "def new\n @line_item = LineItem.new(:order_id => params[:order_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @line_item }\n end\n end", "def new\n @purchase_order_item_line = PurchaseOrderItemLine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @purchase_order_item_line }\n end\n end", "def create\n @line_item = LineItem.new(params[:line_item])\n\n respond_to do |format|\n if @line_item.save\n format.html { redirect_to @line_item, notice: 'Line item was successfully created.' }\n format.json { render json: @line_item, status: :created, location: @line_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @line = Line.new\n authorize! :new, @line\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @line }\n end\n end", "def new\n @lineup = Lineup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lineup }\n end\n end", "def create\n @item_line = ItemLine.new(params[:item_line])\n\n respond_to do |format|\n if @item_line.save\n format.html { redirect_to @item_line, notice: 'Item line was successfully created.' }\n format.json { render json: @item_line, status: :created, location: @item_line }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item_line.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @line_item = @order.line_items.new(line_item_params)\n\n if @line_item.save\n render json: @line_item, status: :created, location: [@order, @line_item]\n else\n render json: @line_item.errors, status: :unprocessable_entity\n end\n end", "def new\n @invoice_line_item = InvoiceLineItem.new\n prepFormVariables\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invoice_line_item }\n end\n end", "def new\n @order_line = OrderLine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order_line }\n end\n end", "def create \n @line_item = LineItem.new(line_item_params)\n respond_to do |format|\n if @line_item.save\n format.html { redirect_to '/line_items', notice: \"Line item was successfully created.\" }\n format.json { render :show, status: :created, location: @line_item }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @item = Item.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n \n end", "def new\n @product_line = ProductLine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product_line }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def create\n parent_line_item = get_parent_line_item\n if parent_line_item\n @line_item = parent_line_item.dup\n @line_item.line_item = parent_line_item\n @line_item.searchable = false\n @line_item.admin_verified = false\n @line_item.section_id = line_item_params[\"section_id\"]\n else\n @line_item = LineItem.new(line_item_params);\n end\n\n if @line_item.save\n render json: @line_item, status: :created, location: @line_item\n else\n render nothing: true, status: :bad_request\n end\n end", "def new\n @product = Product.find(params[:product_id])\n @line_item = LineItem.new(:product_id => @product.id)\n end", "def new_line_items\n # called to render modal to mass create line items\n @protocol = Protocol.find(params[:protocol_id])\n @services = @protocol.organization.inclusive_child_services(:per_participant)\n @page_hash = params[:page_hash]\n @schedule_tab = params[:schedule_tab]\n @first_line_item = params[:first_line_item] || false\n end", "def new\n @sample_line = SampleLine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sample_line }\n end\n end", "def new\n if session[:role]==\"Manager\"\n inbox\n elsif session[:role]==\"Admin\"\n unread\n end\n \n @item = Item.new\n @order = Order.find(params[:id])\n @line_items = LineItem.find_by_order_id(@order)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @item }\n end\n end", "def new\n @line_station = LineStation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @line_station }\n end\n end", "def new\n get_projects\n\n\n @breadcrumb = 'create'\n @billable_item = BillableItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @billable_item }\n end\n end", "def new\n @sundry_grn = SundryGrn.new\n\n 3.times do\n line= @sundry_grn.line_items.build\n end\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @sundry_grn }\n end\n end", "def new\n @item = Item.new(:list_id => params[:list_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @item }\n end\n end", "def new\n @invoice = Invoice.new\n @counter = InvoiceNumbers.first\n @items = Item.find_all_by_invoice_id(@invoice.invoice_id)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invoice }\n end\n end", "def new\n @trip_item = TripItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trip_item }\n end\n end", "def new\n @purchase_return_line_item = PurchaseReturnLineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @purchase_return_line_item }\n end\n end", "def new\n @shipping_line = ShippingLine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @shipping_line }\n end\n end", "def new\n @invent_journal_line = InventJournalLine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invent_journal_line }\n end\n end", "def new\n @launch_item = LaunchItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @launch_item }\n end\n end", "def new\n @itemstable = Itemstable.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @itemstable }\n end\n end", "def new\n @order_item = OrderItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order_item }\n end\n end", "def new\n @order_item = OrderItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order_item }\n end\n end", "def new\n @closet_item = ClosetItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @closet_item }\n end\n end", "def new\n @order_item = OrderItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order_item}\n end\n end", "def create\r\n @lineitem = Lineitem.new(params[:lineitem])\r\n\r\n respond_to do |format|\r\n if @lineitem.save\r\n flash[:notice] = 'Lineitem was successfully created.'\r\n format.html { redirect_to(@lineitem) }\r\n format.xml { render :xml => @lineitem, :status => :created, :location => @lineitem }\r\n else\r\n format.html { render :action => \"new\" }\r\n format.xml { render :xml => @lineitem.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end", "def new\n @line = ReportingForms::Tanimoto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @line }\n end\n end", "def new\n @item_print = ItemPrint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item_print }\n end\n end", "def new\n @item = current_user.items.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @list = List.find(params[:list_id])\n @item = @list.items.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n format.xml { render xml: @item }\n end\n end", "def new\n @item_process = ItemProcess.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item_process }\n end\n end", "def new\n @tipo_item = TipoItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tipo_item }\n end\n end", "def new\n @activity_item = ActivityItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activity_item }\n end\n end", "def new\n @weekline = Weekline.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @weekline }\n end\n end", "def create_line_item\n\t\tset_sale\n\t\tpopulate_products\n\n\t\texisting_line_item = Item.where('product_id = ? AND sale_id = ?', params[:product_id], @sale.id).first\n\n\t\tif existing_line_item.blank?\n\t\t\tline_item = Item.new(product_id: params[:product_id], sale_id: params[:sale_id], quantity: params[:quantity])\n\t\t\tline_item.price = line_item.product.price\n\t\t\tline_item.save\n\n\t\t\tremove_item_from_stock(params[:product_id])\n\t\t\tupdate_line_item_totals(line_item)\n\t\telse\n\t\t\texisting_line_item.quantity += 1\n\t\t\texisting_line_item.save\n\n\t\t\tremove_item_from_stock(params[:product_id])\n\t\t\tupdate_line_item_totals(existing_line_item)\n\t\tend\n\n\t\tupdate_totals\n\n\t\trespond_to do |format|\n\t\t\tformat.js { ajax_refresh }\n\t\tend\n\tend", "def new\n @batting_line = BattingLine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @batting_line }\n end\n end", "def create\n logger.info 'line_items_controller.create'\n @cart = current_cart\n product = Product.find(params[:product_id]) #The params object is important inside Rails applications.\n #It holds all of the parameters passed in a browser request\n @line_item = @cart.add_product(product.id)\n\n session[:counter] = 0\n\n respond_to do |format|\n if @line_item.save\n format.html { redirect_to(store_url) }\n format.js { @current_item = @line_item } #see view/line_items/create.js.rjs\n format.json { render json: @line_item, status: :created, location: @line_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @item_datum = ItemData.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item_datum }\n end\n end", "def new\n @to_do_item = ToDoItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @to_do_item }\n end\n end", "def new\n @received_item_and_qty = ReceivedItemAndQty.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @received_item_and_qty }\n end\n end", "def new\n @itemstatus = Itemstatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @itemstatus }\n end\n end", "def new\n @item = Item.new\n \n @order = Order.new\n @order.order_number = 'NEW ORDER'\n \n @customer = Customer.new\n @address = Address.new\n @address.state = 'IL'\n \n # Ledgers\n @deposit_ledger = Ledger.new\n @payment_ledger = Ledger.new\n \n # Remaining balance\n @remaining_balance = 'NEW ORDER'\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order }\n end\n end", "def new\n add_breadcrumb t('model.create', model: Client.model_name.human)\n @client = Client.new\n @client.created_by_id = current_user.id\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @client }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.haml\n format.json { render :json => @news_item }\n end\n end", "def new\n @item_info = ItemInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item_info }\n end\n end", "def new\n @command_item = CommandItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @command_item }\n end\n end", "def new\n @estimate_line_item = EstimateLineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @estimate_line_item }\n end\n end", "def new\n @order = Order.find(request[:order_id])\n @order_item = @order.order_items.new\n @order_item.owner = current_user\n item_id = request[:item_id]\n unless item_id.nil?\n @order_item.item_id = item_id\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order_item }\n end\n end", "def new\n @research_item = ResearchItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @research_item }\n end\n end", "def new\n @item = Item.new\n respond_to do |format|\n format.html # new.html.erb\n format.js # new.js.rjs\n format.xml { render :xml => @item }\n end\n end" ]
[ "0.8266442", "0.822149", "0.8160804", "0.7782807", "0.7768962", "0.7549798", "0.7548422", "0.75240606", "0.75240606", "0.74592066", "0.7284249", "0.7238863", "0.72111607", "0.71894693", "0.7175733", "0.70911485", "0.708704", "0.7046844", "0.70398986", "0.70121247", "0.699105", "0.69759995", "0.6930558", "0.68970376", "0.68970376", "0.68970376", "0.68970376", "0.68970376", "0.68970376", "0.68970376", "0.68970376", "0.68970376", "0.68970376", "0.68970376", "0.68970376", "0.68970376", "0.68970376", "0.68970376", "0.68970376", "0.68970376", "0.68970376", "0.68970376", "0.68970376", "0.68905556", "0.68871325", "0.6864993", "0.6846585", "0.6843382", "0.6825287", "0.6825287", "0.67821634", "0.6728421", "0.6706105", "0.66997546", "0.66831577", "0.6679761", "0.6653851", "0.664068", "0.6632161", "0.6627365", "0.66017836", "0.6580467", "0.6580467", "0.65727854", "0.65690917", "0.6566883", "0.6552475", "0.65468353", "0.65385574", "0.6528062", "0.6516867", "0.6505923", "0.64994085", "0.64992636", "0.64958024", "0.6493749", "0.6492102", "0.6486506", "0.6485543", "0.6482436", "0.6471639", "0.64679444", "0.6464707", "0.64616", "0.64538544", "0.6443195", "0.6431298", "0.6428724", "0.64274716", "0.6425783", "0.6423524" ]
0.8297957
8
POST /line_items POST /line_items.json Creates a new LineItem when a product is added to cart. Calls method in cart model that adds product to the cart listing. Subtracts from quantity of product. If quantity is 0, customer is informed that product is out of stock.
def create @cart = current_cart product = Product.find(params[:product_id]) if product.quantity > 0 @line_item = @cart.add_product(product.id) product.update_attributes(:quantity => product.quantity - 1) end respond_to do |format| if @line_item if @line_item.save format.html { redirect_to store_url} format.js { @current_item = @line_item} format.json { render json: @line_item, status: :created, location: @line_item } else format.html { render action: "new" } format.json { render json: @line_item.errors, status: :unprocessable_entity } end else format.html {redirect_to store_url, :notice => 'Sorry! Looks like that product is out of stock'} end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_line_item\n\t\tset_sale\n\t\tpopulate_products\n\n\t\texisting_line_item = Item.where('product_id = ? AND sale_id = ?', params[:product_id], @sale.id).first\n\n\t\tif existing_line_item.blank?\n\t\t\tline_item = Item.new(product_id: params[:product_id], sale_id: params[:sale_id], quantity: params[:quantity])\n\t\t\tline_item.price = line_item.product.price\n\t\t\tline_item.save\n\n\t\t\tremove_item_from_stock(params[:product_id])\n\t\t\tupdate_line_item_totals(line_item)\n\t\telse\n\t\t\texisting_line_item.quantity += 1\n\t\t\texisting_line_item.save\n\n\t\t\tremove_item_from_stock(params[:product_id])\n\t\t\tupdate_line_item_totals(existing_line_item)\n\t\tend\n\n\t\tupdate_totals\n\n\t\trespond_to do |format|\n\t\t\tformat.js { ajax_refresh }\n\t\tend\n\tend", "def create\n\t\t@product = Product.find(params[:product_id])\n\t\t@line_item = @cart.add_product(@product)\n\n\t\trespond_to do |format|\n\t\t\tif @line_item.update(line_item_params)\n\t\t\t\tformat.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n\t\t\t\tformat.json { render :show, status: :ok, location: @line_item }\n\t\t\telse\n\t\t\t\tformat.html { render :edit }\n\t\t\t\tformat.json { render json: @line_item.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def create\n product = Product.find(params['product_id'])\n @line_item = @cart.line_items.build(product: product)\n\n respond_to do |format|\n if @line_item.save\n format.html { redirect_to @line_item.cart, notice: 'Line item was successfully created.' }\n format.json { render :show, status: :created, location: @line_item }\n else\n format.html { render :new }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n product = Product.find(params[:product_id])\n @line_item = @cart.add_product(product)\n\n respond_to do |format|\n if @line_item.save\n format.html { redirect_to @line_item.cart, notice: 'Line item was successfully created.' }\n format.json { render :show, status: :created, location: @line_item }\n else\n format.html { render :new }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n session[:cart_id] = @cart.id\n @cart.line_items.create(cart_params[:line_items_attributes])\n end", "def create\n logger.info 'line_items_controller.create'\n @cart = current_cart\n product = Product.find(params[:product_id]) #The params object is important inside Rails applications.\n #It holds all of the parameters passed in a browser request\n @line_item = @cart.add_product(product.id)\n\n session[:counter] = 0\n\n respond_to do |format|\n if @line_item.save\n format.html { redirect_to(store_url) }\n format.js { @current_item = @line_item } #see view/line_items/create.js.rjs\n format.json { render json: @line_item, status: :created, location: @line_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_to_cart\n \tline_item = LineItem.create(product_id: params[:product_id], quantity: params[:quantity])\n \tline_item.update(line_item_total: (line_item.quantity * line_item.product.price))\n \tredirect_back(fallback_location: root_path)\n end", "def create\n chosen_product = Product.find(params[:line_item][:product_id])\n if @current_cart.products.include?(chosen_product)\n @line_item = @current_cart.line_items.find_by(product_id: chosen_product)\n @line_item.quantity += 1\n else\n @line_item = LineItem.create!(line_item_params)\n end\n\n @line_item.save\n respond_to do |format|\n format.html { redirect_to cart_path(@current_cart), notice: 'Item successfully added to cart!' }\n format.json { head :no_content }\n end\n end", "def create\n item = Item.find(params[:item_id])\n @line_item = @cart.line_items.find_by(item: item)\n if @line_item\n @line_item.quantity += 1\n else\n @line_item = @cart.line_items.new(item: item)\n end\n\n respond_to do |format|\n if @line_item.save\n format.html { redirect_to @line_item.cart, notice: 'Line item was successfully created.' }\n format.json { render :show, status: :created, location: @line_item }\n else\n format.html { render :new }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\nend", "def add_item_to_cart\n product_id = params[:product_id]\n @item = LineItem.create!(product_id: product_id, cart_id: @current_cart.id)\n redirect_to checkout_carts_path, notice: 'The Item was added to your cart'\n end", "def create\n # Find the item in the user's cart, if the user does not already\n # have the item in their cart, create a new line_item\n current_item = LineItem.find_or_create_by product_size_id: params[:product_size_id], cart_id: @cart.id\n\n # Increment the item's quantity by one\n requested_qty = current_item.quantity + 1\n\n # Invoke method in line_item.rb that checks the\n # requested qty against current stock levels\n update_qty = current_item.get_update_qty requested_qty\n\n # If the user's requested quantity can not be fulfilled, set a flash error\n unless update_qty == requested_qty\n flash[:item_error] = \"Sorry, not enough stock. Your shopping basket has been adjusted accordingly.\"\n end\n\n # Save the line_item update\n current_item.update quantity: update_qty\n\n # Redirect to My Basket page\n redirect_to cart_path\n end", "def create\n product = Product.find(params[:product_id])\n @line_item = @cart.add_product(product)\n\n respond_to do |format|\n if @line_item.save\n format.html { redirect_to @line_item.cart, notice: 'Line item was successfully created.' }\n format.json { render :show, status: :created, location: @line_item }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\nend", "def add_to_cart\n @cart = current_user.carts.find_or_create_by(completed: false)\n @line_item = @cart.line_items.find_or_create_by(product_id: params[:product_id])\n @line_item.update quantity: @line_item.quantity + 1\n end", "def create\n @cart = current_cart\n product = Product.find_by_id(params[:product_id])\n\n if product.nil?\n flash[:alert] = \"Product not found.\"\n redirect_to orders_path\n return\n end\n\n if not params[:qnt].present?\n flash[:alert] = \"Quantity cannot be empty.\"\n redirect_to orders_path\n return\n end\n\n if product.remaining_quantity < params[:qnt].to_i\n flash[:alert] = \"Quantity not avalable.\"\n redirect_to orders_path\n return\n end\n\n if params[:qnt].to_i <= 0\n flash[:alert] = \"Quantity should be greater than 0.\"\n redirect_to orders_path\n return\n end\n\n @line_item = @cart.add_product(product.id, params[:qnt])\n product.update_attributes(:remaining_quantity => (product.remaining_quantity - params[:qnt].to_i))\n\n respond_to do |format|\n if @line_item.save\n format.html { redirect_to orders_path }\n format.js {@current_item = @line_item}\n format.json { render json: @line_item, status: :created, location: @line_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n product = Product.find(params[:product_id])\n qty = (params[:qty] || '1').to_i\n @line_item = @cart.add_product(product, qty)\n\n respond_to do |format|\n if @line_item.save\n format.html { redirect_to cart_url,\n notice: \"#{product.title} wurde in Deinen Warenkorb gelegt.\" }\n else\n format.html { render action: 'new' }\n end\n end\n end", "def create\n\n lineItem_details = line_item_params\n item = Item.find_by(:id => lineItem_details['item_id'])\n\n \n if ( !session[:shopping_cart_id] || !ShoppingCart.find(session[:shopping_cart_id]).active )\n @shopping_cart = ShoppingCart.new(:user_id => @current_user.id, :active => true)\n @shopping_cart.save\n session[:shopping_cart_id] = @shopping_cart.id\n end\n\n @shopping_cart = ShoppingCart.find(session[:shopping_cart_id])\n lineItem_details[\"shopping_cart_id\"] = @shopping_cart.id\n lineItem_details[\"quantity_purchased\"] = params[:quantity]\n\n @line_item = LineItem.new lineItem_details\n\n # Update cart\n @cart = ShoppingCart.find(session[:shopping_cart_id])\n\n\n # @li = LineItem.find_by(:shopping_cart_id => session[:shopping_cart_id])\n \n # gon.address = []\n # gon.address << @li.item.user.address\n\n\n respond_to do |format|\n if @line_item.save\n format.html { redirect_to shopping_cart_path(session[:shopping_cart_id]), notice: 'Line item was successfully created.' }\n format.json { render :show, status: :created, location: @line_item }\n else\n format.html { render :new }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if cookies[:cart_id].nil?\n cart = Cart.create\n cookies[:cart_id] = { value: cart.id, expires: 1.week.from_now }\n end\n product = Product.find(params[:product_id])\n @line_item = current_cart.add_product(product.id, product.price)\n respond_to do |format|\n if @line_item.save\n format.html { redirect_to :back }\n format.js\n else\n format.html { redirect_to store_path flash[:error] = \"Can't create line item\" }\n end\n end\n end", "def add_item\n item = params[:item]\n image = Image.find(item[:image_id])\n\n order = current_user.init_cart.order\n line_item = order.line_items.where(\n image_id: image.id,\n product_id: item[:product_id],\n product_option_id: item[:product_option_id]\n ).first\n\n if line_item.present?\n line_item.quantity += item[:quantity].to_i\n else\n line_item = order.line_items.build(item)\n end\n\n line_item.price = Product.find(line_item.product_id).price_for_tier(image.tier_id, image.owner?(current_user))\n line_item.tax = line_item.price * PER_TAX\n\n if line_item.save\n render json: line_item, status: :created\n else\n render json: { msg: line_item.errors.full_messages.to_sentence }, status: :bad_request\n end\n end", "def create\n product=Product.find(params[:product_id])\n\t # @line_item= @cart.line_items.build(product: product)#from set_cart we'l get @cart cart and build is use for building new lineitems for product\n\t @line_item = @cart.add_product(product.id) # call from Cart.rb\n \trespond_to do |format|\n\t\t if @line_item.save\n\t\t\t format.html { redirect_to store_url,\n\t\t\t\t\tnotice: 'Line item was successfully created.' }\n\n\t\t\t\t\tformat.js { @current_item = @line_item }\n\t\t\t\t\tformat.json { render action: 'show',\n\t\t\t\t\tstatus: :created, location: @line_item }\n\t\t\t else\n\t\t\t\t\tformat.html { render action: 'new' }\n\t\t\t\t\tformat.json { render json: @line_item.errors,\n\t\t\t\t\tstatus: :unprocessable_entity }\n\t\t\t end\n end\n session[:counter] = 0\n end", "def create\n\t\tproduct = Product.friendly.find(params[:product_id])\n\t\t@line_item = @cart.add_product(product)\n\n\t\trespond_to do |format|\n\t\t\tif @line_item.save\n\t\t\t\tformat.html { redirect_to @line_item.cart,\n\t\t\t\t\tnotice: \"Product was successfully added to your cart.\"}\n\t\t\t\tformat.js\n\t\t\t\tformat.json { render :show, status: :created, location: @line_item}\n\t\t\tend\n\t\tend\n\tend", "def create\n @cart = current_cart\n product = Product.find(line_item_params[:product_id])\n @line_item = @cart.add_product(product.id)\n\n respond_to do |format|\n if @line_item.save\n format.html { redirect_to root_path, notice: 'Line item was successfully created.' }\n format.js { @current_item = @line_item }\n format.json { render :show, status: :created, location: @line_item }\n else\n format.html { render :new }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # clear_cart param can be added if restaurant or location changed for initial\n # this means that we need to clear the cart before add anything to it\n if params[:clear_cart] == '1'\n @current_cart.clear!\n @current_cart.force_location session[:current_location]\n end\n # add item to cart\n @current_cart.add_product line_item_params[:product_id], line_item_params[:count], line_item_params[:note], line_item_params[:product_option_ids]\n # add related products if exists\n for i in 0..2\n unless params[\"related_product_#{i}\"].nil?\n @current_cart.add_product params[\"related_product_#{i}\"], params[\"related_product_count_#{i}\"] || 1\n end\n end\n end", "def create\n # Protect the application and prevent the use of an invalid product \n begin\n # Search for the product to be linked (add) to the item line.\n product = Product.find(params[:product_id])\n rescue\n logger.error(\"Attempt to access an invalid product #(product_id)\")\n redirect_to index(\"invalid product\")\n else\n # Add the product. \n @line_item = @cart.add_product(product.id)\n\n respond_to do |format|\n if @line_item.save\n format.html { redirect_to store_url}\n format.js { @current_item = @line_item }\n format.json { render json: @line_item, status: :created, location: @line_item }\n else\n puts \"new line item #{@cart.id} with product #{@cart.product_id}.\"\n format.html { render action: \"new\" }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def create\n @cart = current_cart\n item = Item.find(params[:item_id])\n quantity = params[:quantity] || 1\n @line_item = @cart.add_item(item.id,quantity.to_i)\n\n\n respond_to do |format|\n if @line_item.save\n # to come back not to the beginning of the page, but to the place where\n # the click was done\n env[\"HTTP_REFERER\"] += '#' + item.id.to_s\n format.html { redirect_to :back, notice: \"L'oggetto è stato aggiunto con successo\" }\n format.json { render json: @line_item, status: :created, location: @line_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_item\n\t\tset_sale\n\t\tpopulate_products\n\n\t\tline_item = Item.where(sale_id: params[:sale_id], product_id: params[:product_id]).first\n\t\tline_item.quantity += 1\n\t\tline_item.save\n\n\t\t# Llama método que reduce cantidad de stock\n\t\tremove_item_from_stock(params[:product_id])\n\t\tupdate_line_item_totals(line_item)\n\n\t\tupdate_totals\n\n\t\trespond_to do |format|\n\t\t\tformat.js { ajax_refresh }\n\t\tend\n\tend", "def create\n # create or increment existing CartLineItem\n @line_item = add_line_item\n # save CartLineItem and create flash message indicating result\n if @line_item.save\n flash[:success] = \"#{params[:desc]} Successfully Added to Cart\"\n else\n flash[:error] = \"#{params[:desc]} not Added to Cart - Please contact Support\"\n end\n # redirect back to Products page to allow user to continue shopping\n if params[:current_page] == 1\n logger.debug \"*** Redirecting to First Products Page...\"\n redirect_to products_path\n else\n logger.debug \"Redirecting to Products Page #{params[:current_page]}\"\n redirect_to products_path(page: params[:current_page])\n end\n end", "def add_product(product_id)\n \t#current_item = line_items.where(product_id: product_id).first\n\n \t# if current_item\n \t# if (current_item.quantity == nil) \n # current_item.quantity = 0\n # end\n # current_item.quantity = 1\n \t# else\n \t# current_item = line_items.build(:product_id => product_id)\n # current_item.quantity += 1\n # end\n #current_item\n line_items.create(:product_id => product_id, :quantity => 1)\n end", "def add_product(product_id)\n current_item = line_items.where(:product_id => product_id).first\n if current_item\n current_item.quantity += 1\n # Otherwise create a new line_item\n else\n current_item = LineItem.new(:product_id => product_id)\n line_items << current_item # add the current_item to the end of the line_items\n end\n current_item\n end", "def add_item(product_id)\n item = line_items.where(product_id: product_id).first\n if item.present?\n item.quantity += 1\n item\n else\n line_items.new(product_id: product_id)\n end\n end", "def add_product(product)\n current_item = line_items.where(:product_id => product.id).first\n if current_item\n current_item.quantity += 1\n else\n current_item = LineItem.new(:product_id => product_id)\n line_items << current_item\n end\n current_item\n end", "def create\n \n @cart = current_cart\n product = Product.find(params[:product_id])\t\n @lineitem = @cart.add_product(product, @cart)\n respond_to do |format|\n if @lineitem.save\n format.html { redirect_to @lineitem.cart, notice: 'Lineitem was successfully created.' }\n\n format.js \n\t\t else\n format.html { render action: \"new\" }\n format.json { render json: @lineitem.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if @cart_item = CartItem.find_by(cart_id: cart_item_params[:cart_id], product_id: cart_item_params[:product_id])\n @cart_item.quantity += cart_item_params[:quantity] || 1\n else\n @cart_item = CartItem.new(cart_item_params)\n end\n\n if @cart_item.save\n form = nil\n view_context.form_for(@cart_item.cart) { |f| form = f }\n\n render json: {\n html: render_to_string(\n \"_cart_items\",\n layout: false,\n locals: {\n cart_items: @cart_item.cart.cart_items,\n f: form\n }\n )\n }\n else\n render json: @cart_item.errors, status: :unprocessable_entity\n end\n end", "def add_product(product_id)\n current_item = line_item.find_by_product_id(product_id)\n if current_item\n current_item.quantity += 1\n else\n current_item = line_items.build(product_id: product_id)\n end\t\n current_item\nend", "def create\n #@cart = current_cart\n product = Product.find(params[:product_id])\n #@line_items = @cart.line_items.build(product: product)\n @line_items = @cart.add_item(product.id)\n \n respond_to do |format|\n if @line_items.save\n format.html { redirect_to store_url,\n notice: 'your cart was successfully created.'}\n format.js { @current_item = @line_items }\n format.json {render :show,\n status: :created, location: @line_items }\n else\n format.html {render action: \"new\" }\n format.json { render json: @line_items.errors, status: unprocessable_entity }\n end\n end\n end", "def create\n if params[:line_item].has_key? \"option_id\"\n if !params[:line_item][:option_id].eql?(\"\")\n @option = Option.find(params[:line_item][:option_id])\n @line_item = LineItem.find_by_cart_id_and_option_id(current_cart.id, @option.id)\n if @line_item == nil\n # Didn't find existing line_item, create new one\n @line_item = LineItem.create!(:cart => current_cart, :option => @option, :quantity => ((params.has_key? \"quantity\") ? params[:quantity].to_i : 1), :unit_price => @option.price)\n flash[:notice] = \"Added #{@line_item.quantity} #{@option.item.name} - #{@option.details} to cart.\"\n else\n #Found existing line_item, increment quantity\n @line_item.update_attribute(:quantity, @line_item.quantity + ((params.has_key? \"quantity\") ? params[:quantity].to_i : 1))\n flash[:notice] = \"Updated #{@option.item.name} - #{@option.details} in cart to #{@line_item.quantity}.\"\n end\n end\n end\n \n respond_to do |format|\n format.html { redirect_to current_cart_url }\n format.js # create.rjs\n end\n end", "def create\n @cart = current_cart\n product = Product.find(params[:product_id])\n @line_item = @cart.line_items.find_by_product_id(product.id)\n if @line_item\n if params[:quantity].to_i < @line_item.product.stock\n if !params[:option].nil?\n @line_item.option = params[:option]\n end\n @line_item.quantity = params[:quantity]\n end\n else\n if params[:option].nil?\n @line_item = @cart.line_items.build(:product_id => product.id, :quantity => params[:quantity])\n else\n @line_item = @cart.line_items.build(:product_id => product.id, :quantity => params[:quantity], :option => params[:option])\n end\n end\n \n# @retval = Hash.new\n# @retval = @cart.add_product(product.id) \n\n# @line_item = @retval[\"current_item\"]\n# if @retval[\"notice\"]\n# flash[:notice] = @retval[\"notice\"]\n# end\n respond_to do |format|\n if @line_item.save\n format.html { redirect_to(:action => 'index', :controller => 'store') }\n format.js { @current_item = @line_item }\n format.xml { render :xml => @line_item, :status => :created, :location => @line_item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @line_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def add(product, qty)\n l = LineItem.new\n l.set_from_product(product, qty)\n @lines << l\n end", "def add_product(product)\n current_item = line_items.find_by(product_id: product.id) # find the current item in the line items. find_by() returns an existing LineItem or nil.\n if current_item # if the current item is present...\n current_item.quantity += 1 # ...increment by one.\n else\n current_item = line_items.build(product_id: product.id) # If the item isn't present then build the line_item.\n current_item.price = product.price # Take the current_item and capture the price attribute.\n end\n current_item # Return the current item.\n end", "def create\n @line_item = @order.line_items.new(line_item_params)\n\n if @line_item.save\n render json: @line_item, status: :created, location: [@order, @line_item]\n else\n render json: @line_item.errors, status: :unprocessable_entity\n end\n end", "def add_product(product)\n current_item = line_items.find_by(product_id: product.id)\n if current_item\n current_item.quantity += 1\n else\n current_item = line_items.build(product_id: product.id)\n end\n current_item\n end", "def create\n #Now let’s modify the LineItemsController to find the shopping cart for the current\n #session (creating one if there isn’t one there already), add the selected product\n #to that cart, and display the cart contents.\n\n # Line item will be created from adding Product to the Cart\n #@line_item = LineItem.new(params[:line_item])\n\n #current_cart is the function/method define n the ApplicationController\n @cart = current_cart\n product = Product.find(params[:product_id])\n=begin\n We then pass that product we found into @cart.line_items.build. This causes a\n new line item relationship to be built between the @cart object and the product.\n You can build the relationship from either end, and Rails will take care of\n establishing the connections on both sides.\n\n=end\n # *** Here :product_id reference the cart product_id. So that we an find out the specific product from the cart\n #@line_item = @cart.line_items.build(:product_id => product)\n #p(\"Product Id : \"+product.id)\n @line_item = @cart.add_product(product.id)\n\n respond_to do |format|\n if @line_item.save\n #format.html { redirect_to @line_item, :notice => 'Line item was successfully created.' }\n # Redirect t line_item cart after saving it\n #format.html { redirect_to(@line_item.cart, :notice => 'Line item was successfully created.') }\n # This function is used to redirect to store_url after saving\n format.html { redirect_to(store_url) }\n #For ajax calling , The first change is to stop the create action from redirecting to the index dis-\n #play if the request is for JavaScript. We do this by adding a call to respond_to\n #telling it that we want to respond with a format of .js.\n\n format.js { @current_item = @line_item }\n\n format.xml { render :xml => @line_item,\n :status => :created, :location => @line_item }\n\n # For rendering no template\n #render :nothing => true\n #format.json { render :json => @line_item, :status => :created, :location => @line_item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @line_item.errors,\n :status => :unprocessable_entity }\n\n #format.json { render :json => @line_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @cart = current_cart\n if params[:bow_id]\n bow = Bow.find(params[:bow_id])\n end\n \n if params[:crossbow_id]\n crossbow = Crossbow.find(params[:crossbow_id])\n end\n \n @line_item = @cart.line_items.build(:bow => bow, :crossbow => crossbow)\n\n\n respond_to do |format|\n if @line_item.save\n format.html { redirect_to @line_item, notice: 'Line item was successfully created.' }\n format.json { render action: 'show', status: :created, location: @line_item }\n else\n format.html { render action: 'new' }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_item(line_item_from_cart)\n current_item = cart.line_items.find_by(line_item_id: line_item.id)\n\n if current_item\n current_item = cart.line_items.find_by(line_item_id: line_item.id)\n else\n current_item = cart.line_items.find_by(line_item_id: line_item.id)\n end\n\n current_item\n end", "def create\n \n meal = Meal.find(params[:meal_id])\n\n @line_item = @cart.add_product(meal.id)\n\n puts \"*\"*50\n puts params\n puts \"*\"*50\n @line_item.quantity = params[:plate_qty]\n @line_item.plate_qty = @line_item.quantity\n\n\n \n # if params[:plate_qty].present?\n # @line_item.quantity = params[:plate_qty]\n # @line_item.plate_qty = @line_item.quantity\n # else\n # @line_item.quantity = 6\n # @line_item.plate_qty = 6\n # end\n\n Rails.logger.debug params.inspect\n\n #Rails.logger.info(\"PARAMS: #{params.inspect}\")\n\n #@line_item = @cart.line_items.build(meal: meal)\n\n if user_signed_in? \n @line_item.user_id = current_user.id\n else\n @line_item.user_id = 0\n end\n\n @line_item.image_url = meal.image_url\n @line_item.name = meal.name\n @line_item.delivery_date = Time.now\n\n respond_to do |format|\n if @line_item.save\n format.html { redirect_to store_index_path, notice: 'Meal item was successfully added onto the CART. '}\n # format.html { redirect_to @line_item.cart, notice: 'Meal item was successfully added onto the cart. '}\n format.json { render :show, status: :created, location: @line_item }\n else\n format.html { render :new }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cart = current_cart\n product = Product.find(params[:product_id])\n @line_item = @cart.add_product(product.id)\n\n respond_to do |format|\n if @line_item.save\n format.html { redirect_to(store_url) }\n format.js { @current_item = @line_item }\n format.xml { render :xml => @line_item,\n :status => :created, :location => @line_item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @line_item.errors,\n :status => :unprocessable_entity }\n end\n end\n end", "def add_line_items_from_cart(cart)\n cart.line_items.each do |item|\n item.cart_id = nil\n order_item = OrderLineItem.new(quantity: item.quantity,\n price: item.price,\n discount: item.discount,\n product_id: item.product_id)\n order_line_items << order_item\n end\n end", "def add_line_items_from_cart(cart)\n cart.line_items.each do |item|\n # remove the cart id\n item.cart_id = nil\n # add the order line items\n line_items << item\n end\n\n end", "def create\n product = Product.find params[:product_id]\n @line_item = @cart.add_product(product)\n respond_to do |format|\n if @line_item.save\n format.html { redirect_to @cart, notice: 'Line item was successfully created.' }\n format.json { render :show, status: :created, location: @line_item }\n format.js\n end\n end\n end", "def create\n #This will find or create a cart based on applications controller method\n @cart = current_cart\n #We use params to get the product ID from the request\n #This is stored locally as no need to let view see it\n product = Product.find(params[:product_id])\n \n #Adds an item to the cart using the \"add_product\" \n #function in the \"cart.rb\" file.\n @line_item = @cart.add_product(product.id)\n\n respond_to do |format|\n if @line_item.save\n format.html { redirect_to(store_url) }\n #.js is added to stop the create action from \n #redirecting to the index display if the request is \n #from javascript\n format.js { @current_item = @line_item }\n format.json { render json: @line_item, status: :created, location: @line_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_or_create_line_item(item_id)\n if line_item = self.line_items.find_by(item_id: item_id)\n line_item.increment\n line_item\n else\n LineItem.new(cart_id: self.id, item_id: item_id)\n end\n end", "def create\n product = Product.find(params[:product_id])\n # '.build' makes the relationships between two objects\n @line_item = @cart.add_product(product.id)\n\n respond_to do |format|\n if @line_item.save\n # redirect back to cart now - if non-JS request\n format.html { redirect_to store_url }\n # .js stops redirect if the request is for JS (i.e. if remote: true in params)\n # JS will then look instead for a create.js template in views/line_items..\n # @current_item used in JS UI effects to apply to latest created item\n format.js { @current_item = @line_item }\n format.json { render action: 'show', status: :created, location: @line_item }\n else\n format.html { render action: 'new' }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n product = Product.find(params[:product_id])\n @line_item = @cart.add_product(product)\n\n respond_to do |format|\n if @line_item.save\n session[:counter] = 0\n format.html { redirect_to store_index_url }\n format.js { @current_item = @line_item }\n format.json { render :show, status: :created, location: @line_item }\n else\n format.html { render :new }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_product(product)\n\t\titem_to_add = line_items.find_by(product_id: product.id)\n\t\tif item_to_add\n\t\t\titem_to_add.quantity += 1\n\t\telse\n\t\t\t# in this case we create the line_item, the quantity default is 1\n\t\t\titem_to_add = line_items.build(product_id: product.id)\n\t\t\titem_to_add.order = nil\n\t\tend\n\t\titem_to_add\n\tend", "def add_product(product)\n current_item = line_items.find_by(product_id: product.id)\n if current_item\n current_item.quantity += 1\n else\n current_item = line_items.build(product_id: product.id)\n end\n current_item\n end", "def add_line_items_from_cart(cart)\n cart.line_items.each do |item|\n item.cart_id = nil\n line_items << item\n end\n end", "def add_line_items_from_cart(cart)\n cart.line_items.each do |item|\n item.cart_id = nil\n line_items << item\n end\n end", "def add_line_items_from_cart(cart)\n cart.line_items.each do |item|\n item.cart_id = nil\n line_items << item\n end\n end", "def add_line_items_from_cart(cart)\n cart.line_items.each do |item|\n item.cart_id = nil\n line_items << item\n end\n end", "def create \n @product = Product.find_by_title(params[:product]) \n @line_item = LineItem.new(params[:line_item])\n @line_item.product_id = @product.id\n @line_items= LineItem.where(:demand_id => @line_item.demand_id, :product_id => @line_item.product_id)\n \n @quantity = @line_item.quantity\n \n if @line_items != nil\n @line_items.each do |item|\n @quantity += item.quantity\n LineItem.find(item.id).destroy\n end\n @line_item.update_attributes(:quantity => @quantity)\n end\n \n respond_to do |format|\n if @line_item.save\n format.js\n else\n format.html { render action: \"new\" }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_product(product_id)\n \tcurrent_item = line_items.find_by(product_id: product_id)\n if current_item\n current_item.quantity += 1\n else\n current_item = line_items.build(product_id: product_id)\n end\n current_item\n end", "def add_line_items_from_cart(cart)\n cart.line_items.each do |item|\n\t item.cart_id = nil\n \t line_items << item\n end\n end", "def create \n \n @cart = current_cart\n product = Product.find(params[:product_id])\n @line_item = @cart.add_product(product.id)\n \n respond_to do |format|\n if @line_item.save\n format.html { redirect_to store_url }\n format.js {@current_item = @line_item}\n format.json { render json: @line_item, status: :created, location: @line_item }\n\n else\n format.html { render action: \"new\" }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_product (product_id)\n current_item = line_items.find_by_product_id(product_id)\n if current_item\n current_item.quantity += 1\n else\n # The default quantity is 1. \n current_item = line_items.build(product_id: product_id)\n end\n current_item\n end", "def add_items_from_cart(cart)\n cart.line_items.each do |item|\n self.line_items << item if item.sufficient_stock?\n end\n end", "def add_item(item_id)\n line_item = self.line_items.find_by(item_id: item_id)\n if line_item\n line_item.quantity += 1\n else\n line_item=self.line_items.build(item_id: item_id)\n end\n line_item\n end", "def create\n product = Product.find(params[:product_id])\n @line_item = @cart.add_product(product.id)\n\n respond_to do |format|\n if @line_item.save\n format.html { redirect_to store_url }\n format.js { @current_item = @line_item}\n format.json { render action: 'show', status: :created, location: @line_item }\n else\n format.html { render action: 'new' }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @line_item = LineItem.new(params[:line_item])\n @line_item.price = @line_item.catalog_item.unit_price\n \n respond_to do |format|\n if @line_item.save\n \n flash[:notice] = 'LineItem was successfully created.'\n format.html { redirect_to(@line_item) }\n format.xml { render :xml => @line_item, :status => :created, :location => @line_item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @line_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def add_item(item_id)\n if line_item = line_items.find_by(item_id: item_id)\n line_item.quantity += 1\n else\n line_item = line_items.build(item_id: item_id)\n end\n line_item\n end", "def add_line_items_from_cart(cart)\n cart.line_items.each do |item|\n item.cart_id = nil\n line_items << item\n end\n end", "def add_product(product_id)\n \tcurrent_item = line_items.find_by(product_id: product_id)\n \tif current_item\n \t\tcurrent_item.quantity += 1\n \telse\n \t\tcurrent_item = line_items.build(product_id: product_id)\n current_item.product_price = Product.find(product_id).price\n \tend\n \tcurrent_item\n end", "def add_line_items_from_cart(cart)\n #for each lineitem added to the cart we remove the cart id and add to the order (loop)\n cart.line_items.each do |item|\n item.cart_id = nil\n line_items << item\n end\n end", "def add_line_items_from_cart(cart)\n \tcart.line_items.each do |item|\n \t\titem.cart_id = nil\n \t\tline_items << item\n \tend \t\n end", "def create\n @menu_product = MenuProduct.find(params[:menu_product_id])\n @line_item = @cart.add_menu_product(@menu_product.id)\n\n respond_to do |format|\n if @line_item.save\n format.html { redirect_to request.referrer }\n format.js { render 'update.js' }\n else\n format.html { render action: 'new' }\n format.json { render json: @line_item.errors,\n status: :unprocessable_entity }\n end\n end\n end", "def create\n @popularty = current_popularty\n product = Product.find(params[:product_id])\n @popularty_line_item = @popularty.add_product(product.id)\n\n respond_to do |format|\n if @popularty_line_item.save\n format.html { redirect_to @popularty_line_item.popularty, notice: 'Popularty line item was successfully created.' }\n format.json { render json: @popularty_line_item, status: :created, location: @popularty_line_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @popularty_line_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_product(product_id)\n \n #Check if the current item is in our current line items\n current_item = line_items.find_by_product_id(product_id)\n if current_item\n #If it is already in our line items, increment the quantity\n current_item.quantity += 1\n else\n #Otherwise, build the relationship\n current_item = line_items.build(product_id: product_id)\n end\n \n #return the current item\n current_item\n end", "def create \n @line_item = LineItem.new(line_item_params)\n respond_to do |format|\n if @line_item.save\n format.html { redirect_to '/line_items', notice: \"Line item was successfully created.\" }\n format.json { render :show, status: :created, location: @line_item }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #@line_item1 = LineItem1.new(params[:line_item1])\n @cart = current_cart\n p 111111111111111111111111111111\n #a= params\n # p params[:line_item1]\n #a =params[:line_item1][:product_id]\n \n product = Product.find(params[:product_id])\n #@line_item1 = @cart.line_item1s.build(:product => product)\n p 11111111111111111111111111111111111111111111111111111\n p product.id\n p product.name\n @line_item1= @cart.add_product(product.id)\n\n\n respond_to do |format|\n if @line_item1.save\n format.html { redirect_to(@line_item1.cart,\n :notice => 'Line item was successfully created.' ) }\n\n #format.html { redirect_to @line_item1, :notice => 'Line item1 was successfully created.' }\n format.json { render :json => @line_item1, :status => :created, :location => @line_item1 }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @line_item1.errors, :status => :unprocessable_entity }\n end\n end\n end", "def add_product(product)\n\t\tcurrent_item = line_items.find_by(product_id: product.id)\n\t\tif current_item\n\t\t\tcurrent_item.quantity += 1\n\t\telse\n\t\t\tcurrent_item = line_items.build(product_id: product.id)\n\t\tend\n\t\tcurrent_item\n\tend", "def add_product(product_id)\n\t\tcurrent_item = line_items.find_by(product_id: product_id)\n\t\tif current_item\n\t\t\tcurrent_item.quantity += 1\n\t\telse\n\t\t\tcurrent_item = line_items.build(product_id: product_id)\n\t\tend\n\t\tcurrent_item\n\tend", "def add_product(product)\n # @type [LineItem, NilClass]\n item = line_items.find_by(product: product)\n if item.present?\n item.quantity += 1\n else\n item = line_items.build(product: product)\n end\n\n item\n end", "def add_cart_line_item(newitem, options={})\n return nil if newitem.nil?\n item = find(:first, newitem)\n if item\n # existing item found, update item quantity and add total_price\n item.quantity += newitem.quantity\n else\n # not in cart yet\n item = newitem\n @line_items << item\n end\n item\n end", "def add_item(product_id:, quantity: 1)\n product = Product.find(product_id)\n\n order_item = order.items.find_or_create_by(\n product_id: product_id\n )\n\n order_item.price = product.price\n order_item.quantity = 1\n order_item.save\n end", "def add_to_cart(client_id, product_id, quantity)\n # Get the clients cart\n cart = Cart.find(client_id)\n \n # Add a new cart_item to the cart with product_id and quantity\n cart.cart_items.create(product_id: product_id, quantity: quantity)\n end", "def create\n product = Product.find(params[:product_id])\n @liner_item = @cart.add_product(product)\n\n respond_to do |format|\n if @liner_item.save\n format.html { redirect_to store_index_url }\n format.js { @current_item = @liner_item }\n format.json { render :show, status: :created, location: @liner_item }\n else\n format.html { render :new }\n format.json { render json: @liner_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_line_items_from_cart(cart)\n\t\tcart.items.each do |item|\n\t\t\t#li = LineItem.from_cart_item(item)\n\t\t\t#li.quantity.times{line_items << li}\n\t\t\titem.quantity.times{line_items << LineItem.new( :price => item.price,\n \t\t\t\t\t\t\t\t\t\t\t\t\t :product_id => item.product_id)}\n\t\t\t#LineItem.new(:order_id => order_id, :product_id => li.product_id )\n\t\tend\n\t\tlogger.info line_items.inspect + \"These are the line items\"\n\t\t#line_items\n\tend", "def line_item_params\n params.require(:line_item).permit(:cart_id, :product_id, :quantity)\n end", "def add_product(product_id)\n\t\tcurrent_item = line_items.find_by_product_id(product_id)\n\t\tif current_item\n\t\t\tcurrent_item.quantity += 1\n\t\telse\n\t\t\tcurrent_item = line_items.build(:product_id => product_id)\n\t\tend\n\t\tcurrent_item\n\tend", "def add_product(product_id) #a method that accumulates the quantity of a product that has been added more than twice, using its id\n\t\tcurrent_item = line_items.where(:product_id => product_id).first\n\n\t\tif current_item\n\n\t\t\tcurrent_item.quantity += 1 rescue current_item.quantity\n\t\telse\n\t\t\tcurrent_item = LineItem.new(:product_id=>product_id) #adding a new product to the order line, since its unique to this cart\n\t\t\tline_items << current_item\n\t\tend\n\n\t\tcurrent_item\n\tend", "def create\n # Find associated product and current cart\n chosen_cabinet = CabConfig.find(params[:cab_config_id])\n current_cart = @current_cart\n \n # If cart already has this product then find the relevant line_item and iterate quantity otherwise create a new line_item for this product\n if current_cart.cab_configs.include?(chosen_cabinet)\n # Find the line_item with the chosen_product\n @cart_item = current_cart.cart_items.find_by(cab_config_id: chosen_cabinet)\n # Iterate the line_item's quantity by one\n @cart_item.quantity += 1\n else\n @cart_item = CartItem.new\n \n @cart_item.cart = current_cart\n @cart_item.cab_config = chosen_cabinet\n end\n \n\n # Save and redirect to cart show path\n @cart_item.save\n redirect_to cart_path(current_cart)\n end", "def create\n @line_item = LineItem.new(params[:line_item])\n\n respond_to do |format|\n if @line_item.save\n format.html { redirect_to @line_item, notice: 'Line item was successfully created.' }\n format.json { render json: @line_item, status: :created, location: @line_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item_line = ItemLine.new(params[:item_line])\n\n respond_to do |format|\n if @item_line.save\n format.html { redirect_to @item_line, notice: 'Item line was successfully created.' }\n format.json { render json: @item_line, status: :created, location: @item_line }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item_line.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_product(product)\n item = @items.find {|i| i.product_id == product.id}\n if item\n item.quantity += 1\n else\n item = LineItem.for_product(product)\n @items << item\n end\n @total_price += product.price\n end", "def add\n @cart = current_cart\n @line_item_product = @cart.add(params[:id])\n\n respond_to do |format|\n if @line_item_product.save\n format.html { redirect_to store_products_path, notice: 'Line item was successfully updated.' }\n format.js { @current_item = @line_item_product }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @line_item_product.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_product(product_id) #why methid in model? not in controller?\n\t\tcurrent_item = line_items.find_by(product_id: product_id) #find_by returns one object, where return array\n\t\tif current_item\n\t\t\tcurrent_item.quantity += 1\n\t\telse\n\t\t\tcurrent_item = line_items.build(product_id: product_id) #you could build it from \"cart\" side as well\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t#rails establishes connections for you\n\t\tend\n\n\t\tcurrent_item\n\tend", "def create_line_item_from_inventory_item_id inventory_item_id, qty, include_price_in_expense, include_price_in_revenue, notes\n # Inventory item\n inventory_item = InventoryItem.find(inventory_item_id)\n line_items.push(create_line_item_from_inventory_item(\n inventory_item, qty,\n inventory_item.vendor, account,\n include_price_in_expense, include_price_in_revenue, notes))\n end", "def create\n order = Order.find_by(id: session[:order_id])\n \n if session[:order_id].nil? || order.nil?\n order = Order.create\n session[:order_id] = order.id\n end\n \n order_items = {\n product_id: params[:product_id].to_i,\n quantity: params[:quantity].to_i,\n order_id: session[:order_id],\n }\n \n order = Order.find(session[:order_id])\n # if order item already exists in cart, increase quantity.\n order.order_items.each do |oi|\n if oi.product.id == order_items[:product_id]\n if oi.quantity + order_items[:quantity] > oi.product.stock\n flash[:failure] = \"Sorry, there are not enough items in stock.\"\n redirect_to product_path(order_items[:product_id])\n return\n else\n oi.quantity += order_items[:quantity]\n oi.save\n \n flash[:success] = \"Successfully updated quantity.\"\n redirect_to product_path(order_items[:product_id])\n return\n end\n end\n end\n \n order_item = OrderItem.new(order_items)\n if order_item.save\n flash[:success] = \"Successfully added item to your cart.\"\n redirect_to product_path(order_items[:product_id])\n return\n else\n flash[:failure] = \"Item could not be added to your cart.\"\n redirect_to product_path(order_items[:product_id])\n return\n end\nend", "def create\n @order = Order.new(:customer_id => order_params[:customer_id])\n\n order_params[:line_items].each do |item|\n if !item.empty?\n @order.line_items.new(:product_id => item, :order_id => @order.id)\n @order.update(cost: @order.cost + @order.line_items[0].product.price)\n end\n end\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n puts params.inspect.green\n puts params[:remove].inspect.yellow\n\n @cart = current_cart\n\n product = Product.find_by_id(params[:line_item][:product_id])\n\n location = Location.find_by_id(session[:current_location_id])\n\n if !params[:remove]\n puts \"Add\".yellow\n restaurant = product.menu.restaurant\n @line_item = LineItem.where(cart_id: @cart.id, :product_id => product.id).first_or_create\n @line_item.update_attributes(params[:line_item])\n\n\n if @line_item.save\n\n render partial: 'restaurants/cart', locals:{location: location}\n else\n render partial: 'restaurants/cart'\n end\n\n else\n puts \"Remove\".yellow\n\n puts\n @line_item = LineItem.where(cart_id: @cart.id, :product_id => product.id).first\n\n puts @line_item.inspect.magenta\n\n @line_item.destroy\n\n render partial: 'restaurants/cart', locals:{location: location}\n end\n end", "def add_to_line_item(line_item, variant, quantity, currency=nil, shipment=nil, price=nil)\n if line_item\n line_item.target_shipment = shipment\n line_item.quantity += quantity.to_i\n line_item.currency = currency unless currency.nil?\n line_item.save\n else\n line_item = order.line_items.new(quantity: quantity, variant: variant)\n # line_item = Spree::LineItem.new(quantity: quantity)\n line_item.target_shipment = shipment\n line_item.variant = variant\n if currency\n line_item.currency = currency unless currency.nil?\n line_item.price = price || variant.price_in(currency).amount\n else\n line_item.price = price || variant.price\n end\n # order.line_items << line_item\n # line_item\n end\n \n line_item.save\n order.reload\n line_item\n end", "def add_cart_item\n current_cart.cart_items.new\n end" ]
[ "0.80490047", "0.79378974", "0.78989446", "0.78562003", "0.7829388", "0.77694505", "0.7760947", "0.7750323", "0.7719439", "0.76808935", "0.76739484", "0.7672433", "0.7634859", "0.76076436", "0.75617236", "0.75553215", "0.7540249", "0.7511087", "0.7490194", "0.7471138", "0.7401323", "0.7367919", "0.73506796", "0.7332613", "0.73241717", "0.7323128", "0.7318032", "0.72972226", "0.72908324", "0.72889054", "0.72700846", "0.7250118", "0.7238631", "0.72306937", "0.72001976", "0.7176049", "0.71711415", "0.71626866", "0.71605945", "0.71573424", "0.714599", "0.7143489", "0.7134271", "0.71088105", "0.71007156", "0.7095542", "0.70950943", "0.7082349", "0.70789295", "0.70673174", "0.70650834", "0.70569533", "0.70537704", "0.7047233", "0.7039547", "0.7039547", "0.7039547", "0.7039547", "0.70326656", "0.7026985", "0.70169353", "0.70120203", "0.7011407", "0.70095295", "0.7008699", "0.7006575", "0.7005382", "0.69859403", "0.69835114", "0.69805264", "0.69637215", "0.6958113", "0.6954431", "0.6953452", "0.69515586", "0.6915059", "0.6913274", "0.69112015", "0.6903014", "0.6897805", "0.6894717", "0.68903345", "0.6878316", "0.6870442", "0.68691915", "0.6864522", "0.6848903", "0.68464845", "0.68437755", "0.68299294", "0.6829884", "0.68256915", "0.68022704", "0.67921364", "0.67915833", "0.6790602", "0.67884576", "0.6781737", "0.6779757", "0.67721707" ]
0.7716445
9
DELETE /line_items/1 DELETE /line_items/1.json Removes product from cart; calls remove_product method in cart. When product is moved, quantity attribute is updated so that the product in cart is "returned" to the main inventory.
def destroy @cart = current_cart product = Product.find(params[:product_id]) #@line_item = LineItem.find(params[:id]) @line_item = @cart.remove_product(product.id) product.update_attributes(:quantity => product.quantity + 1) respond_to do |format| format.html { redirect_to store_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n\n if params[:product_id] then\n# TODO need to use @cart.id to ensure only this users line_item is accessed.\n current_item = LineItem.find_by_product_id(params[:product_id] )\n else\n current_item = LineItem.find(params[:id])\n end\n\n if current_item\n current_item.quantity -= 1\n puts current_item.quantity\n if current_item.quantity <= 0\n current_item.destroy\n else\n current_item.save\n end\n else\n current_item.destroy\n end\n\n respond_to do |format|\n format.html { redirect_to store_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @line_item = LineItem.find(params[:id])\n product = Product.find_by_id(@line_item.product.id)\n product.update_attributes(:remaining_quantity => (product.remaining_quantity + @line_item.quantity))\n @line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(orders_path) }\n format.json { head :ok }\n end\n end", "def destroy\n\n @cart = current_cart\n @line_item = @cart.remove_product(@cart.line_items.find(params[:id]))\n #the @cart is a security measure to ensure that the item is within\n # the current cart; I'm not certain if this is needed\n\n\n respond_to do |format|\n format.html { redirect_to store_url }\n format.json { head :no_content }\n end\n end", "def destroy\n if params[:line_item_id]\n @cart.line_items.find(params[:line_item_id]).destroy\n else\n @cart.destroy\n end\n end", "def destroy\n line_item = LineItem.find params[:id]\n line_item.destroy\n\n redirect_to cart_path\n end", "def destroy\n @line_item = LineItem.find(params[:id])\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to cart_path }\n format.json { head :no_content }\n end\n end", "def destroy\n # @line_item = LineItem.find(params[:id])\n # @line_item.destroy\n\n @cart = current_cart\n #We use params to get the product ID from the request\n #This is stored locally as no need to let view see it\n @line_item = LineItem.find(params[:id])\n @line_item.destroy\n \n #Adds an item to the cart using the \"add_product\" \n #function in the \"cart.rb\" file.\n\n\n respond_to do |format|\n format.html { redirect_to(store_url) }\n format.js { @current_item = @line_item }\n format.json { head :no_content }\n end\n end", "def destroy\n @line_item = @current_cart.line_items.where(:id => params[:id]).first\n unless @line_item.nil?\n @line_item.destroy\n end\n end", "def destroy\n # @line_item = LineItem.find(params[:id])\n # @line_item.destroy\n @cart = current_cart\n# item = Item.find(params[:item_id])\n quantity = params[:quantity] || 1\n item_id=params[:item_id]\n @line_item = @cart.delete_item(item_id,quantity.to_i)\n\n respond_to do |format|\n format.html { redirect_to :back, notice: \"L'oggetto è stato rimosso dal carrello!\" }\n format.json { head :ok }\n end\n end", "def decrement_line_item_quantity(line_item_id)\n current_item = line_items.find(line_item_id)\n if current_item.quantity > 1\n current_item.quantity -= 1\n else\n current_item.destroy\n end\n current_item\n end", "def destroy\n @line_item = LineItem.find(params[:id])\n # @line_item.destroy\n #if @line_item.quantity > 1\n # @line_item.update_attributes(:quantity => @line_item.quantity-1)\n #else\n @line_item.destroy\n #end\n respond_to do |format|\n #format.html {redirect_to (cart_url(session[:cart_id]))}\n format.html {redirect_to (store_url(session[:cart_id]))}\n #format.html { redirect_to line_items_url }\n #format.json { head :ok }\n #format.html {redirect_to(store_url, :notice => 'Line Item Removed')}\n #if current_cart.line_items.empty?\n # format.html { redirect_to(store_url, notice: 'Your cart is empty') }\n #else\n # format.html { redirect_to(@line_item.cart, :notice => 'Item has been removed from your cart.') } # format.html { redirect_to(current_cart, notice: 'Item Removed') }\n #end\n\n # if LineItem.find_by_cart_id (@line_item.cart_id).nil?\n # format.html {redirect_to store_url, notice: 'your cart is currently empty'}\n #else format.html {redirect_to current_cart, notice: 'Line item removed'}\n #end\n\n #format.html {redirect_to :back}\n format.json {head :ok}\n end\n end", "def destroy\n @cart = Cart.find(session[:cart_id])\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to cart_path(@cart), notice: 'Line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def remove_item\n\t\tset_sale\n\t\tpopulate_products\n\n\t\tline_item = Item.where(sale_id: params[:sale_id], product_id: params[:product_id]).first\n\t\tline_item.quantity -= 1\n\n\t\tif line_item.quantity == 0\n\t\t\tline_item.destroy\n\t\telse\n\t\t\tline_item.save\n\t\t\tupdate_line_item_totals(line_item)\n\t\tend\n\n\t\t# Llama método que devuelve cantidad al stock\n\t\treturn_item_to_stock(params[:product_id])\n\n\t\tupdate_totals\n\n\t\trespond_to do |format|\n\t\t\tformat.js { ajax_refresh }\n\t\tend\n\tend", "def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to cart_path(@current_cart), notice: 'Line item was successfully removed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n li = @cart.line_items.find_by_id!(params[:id])\n li.destroy\n render json: {}, status: :ok\n end", "def deduct_quantity\n line_items.each do |i|\n i.product.current_stock -= i.quantity\n i.product.save\n end\n end", "def destroy\n # make sure user is accessing cart currently\n # held in their session\n if params[:id].to_i == session[:cart_id].to_i\n logger.debug \"***Destroying line item #{params[:line_id]}...\"\n @cart_line_item.destroy\n flash[:success] = \"Item successfully removed from Cart\"\n redirect_to cart_path(session[:cart_id])\n else\n logger.debug \"***Cart id Supplied does NOT match session cart id\"\n no_cart_line_item_found\n end\n end", "def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to @line_item.cart, notice: t('line_items.destroy.lineDelete') }\n format.json { head :no_content }\n end\n end", "def destroy\n @lineitem = Lineitem.find(params[:id])\n @lineitem.destroy\n respond_to do |format|\n format.html { redirect_to 'http://localhost:3000/carts/show' }\n format.json { head :no_content }\n end\n end", "def decrease\n @line_item = @current_cart.line_items.where(:id => params[:line_item_id]).first\n if @line_item.count > 0\n @line_item.update_attribute :count, @line_item.count - 1\n else\n @line_item.destroy # destroy database record if quantity was decreased to 0\n end\n end", "def remove_lineitem\n line_item = @sale.line_items.find_by_id(params[:line_item])\n respond_to do |format|\n if line_item.present?\n line_item.item.stock_amount = line_item.item.stock_amount + line_item.quantity\n line_item.item.save\n line_item.destroy\n end\n update_totals\n\n format.js { ajax_refresh }\n end\n end", "def destroy\n @cart = current_cart\n @line_item = LineItem.find(params[:id])\n @line_item.destroy\n \n respond_to do |format|\n flash[:notice] = \"Successfully removed item from cart.\"\n format.html { redirect_to(current_cart_url) }\n format.js # destroy.rjs\n end\n end", "def create\n\n puts params.inspect.green\n puts params[:remove].inspect.yellow\n\n @cart = current_cart\n\n product = Product.find_by_id(params[:line_item][:product_id])\n\n location = Location.find_by_id(session[:current_location_id])\n\n if !params[:remove]\n puts \"Add\".yellow\n restaurant = product.menu.restaurant\n @line_item = LineItem.where(cart_id: @cart.id, :product_id => product.id).first_or_create\n @line_item.update_attributes(params[:line_item])\n\n\n if @line_item.save\n\n render partial: 'restaurants/cart', locals:{location: location}\n else\n render partial: 'restaurants/cart'\n end\n\n else\n puts \"Remove\".yellow\n\n puts\n @line_item = LineItem.where(cart_id: @cart.id, :product_id => product.id).first\n\n puts @line_item.inspect.magenta\n\n @line_item.destroy\n\n render partial: 'restaurants/cart', locals:{location: location}\n end\n end", "def destroy\n @cart_item.destroy\n Product.update(@cart_item.product.id, :quantity => @cart_item.product.quantity + @cart_item.quantity)\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Cart item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def remove_item\n product_id = params[:product_id].to_s\n modify_cart_delta(product_id, -1)\n redirect_to :back\n end", "def destroy\n @line_item = Spree::LineItem.find_by_id(params[:id])\n @order = Spree::Order.find_by_number(params[:order_id])\n # code to find the order_total\n if @order.market_place.present?\n case @order.market_place.code\n when \"qoo10\"\n order_total = @order.market_place_details.present? ? @order.market_place_details[\"total\"] : @order.total\n when \"lazada\" , \"zalora\"\n order_total = @order.total\n end\n end\n if @line_item.present?\n increased_qty = @line_item.quantity\n @variant = @line_item.variant\n @product = @variant.product if @variant.present?\n @line_item.destroy\n @sellers_market_places_product = Spree::SellersMarketPlacesProduct.where(\"seller_id=? AND market_place_id=? AND product_id=?\", @order.seller_id, @order.market_place_id, @product.id).try(:first)\n if @sellers_market_places_product.present?\n @stock_product = Spree::StockProduct.where(\"sellers_market_places_product_id=? AND variant_id=?\", @sellers_market_places_product.id, @variant.id).try(:first)\n if @stock_product.present?\n @stock_product.update_attributes(:count_on_hand=>@stock_product.count_on_hand + increased_qty.to_i)\n @variant.update_attributes(:fba_quantity=>@variant.fba_quantity + increased_qty.to_i) if [email protected]_inflations.present?\n msg = 'Line Items Controller destroy'\n @variant.add_log_on_update(msg) rescue QTY_LOG.error \"#{Time.zone.now} Error -- #{msg}\"\n end\n end\n end\n # code to update order total after creating line item for order\n @order.update_column(:total, order_total)\n @order.reload\n respond_to do |format|\n format.html { redirect_to modify_order_admin_order_path(@order), notice: 'Product is successfully deleted' }\n end\n end", "def destroy_or_save(line_item, line_item_quantity)\n line_item_quantity.zero? ? line_item.destroy! : line_item.save!\n end", "def remove_item\n prod_id = params[:product_id].to_s\n item = cart[prod_id] || {\"Num\" => 0}\n item[\"Num\"] -=1\n cart[prod_id] = item\n cart.delete(prod_id) if item[\"Num\"] < 1\n update_cart cart\n flash[:success] = t('itm_removed')\n redirect_back fallback_location: :root\n end", "def remove\n if @item.quantity == 1\n @item.destroy!\n else\n @item.decrement(:quantity)\n @item.save!\n end\n\n refresh\n end", "def destroy\n @line_item.destroy\n @line_items = @cart.line_items\n respond_to do |format|\n format.html { redirect_to @line_item.cart, notice: 'Line item was successfully destroyed.' }\n format.json { head :no_content }\n format.js\n end\n end", "def destroy\n @line_item = LineItem.find(params[:id])\n @line_item.destroy\n\n respond_to do |format|\n if current_cart.line_items.count == 0 \n format.html { redirect_to root_path }\n else \n format.html { redirect_to current_cart }\n end\n end\n end", "def destroy\n @line_item = LineItem.find(params[:id])\n @line_item.destroy\n @cart = current_cart\n respond_to do |format|\n # format.html { redirect_to(line_items_url) }\n format.html { redirect_to(@cart, :notice => 'Cart was successfully updated.') }\n format.js\n format.xml { head :ok }\n end\n end", "def destroy\n @line_item.destroy\n destroy_line_item_response\n end", "def remove_items_from_cart\n line_items.each { |i| i.cart = nil }\n end", "def destroy\n @line_item_product.destroy\n respond_to do |format|\n format.html { redirect_to line_item_products_url, notice: 'Line item product was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url, notice: \"カートから商品が削除されました\" }\n format.json { head :no_content }\n end\n end", "def update\n @cart = current_cart\n #We use params to get the product ID from the request\n #This is stored locally as no need to let view see it\n product = Product.find(params[:product_id])\n \n #Adds an item to the cart using the \"add_product\" \n #function in the \"cart.rb\" file.\n @line_item = @cart.delete_product(product.id)\n\n respond_to do |format|\n if @line_item.update_attributes(params[:line_item])\n format.html { redirect_to(store_url) }\n format.js { @current_item = @line_item }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @line_item = LineItem.find(params[:id])\n @order = @line_item.order\n @line_item.destroy\n \n @order.total = @order.line_items.sum(:line_total)\n @order.update_attribute(:total, @order.total)\n\n respond_to do |format|\n format.html { redirect_to request.env[\"HTTP_REFERER\"] }\n format.xml { head :ok }\n end\n end", "def remove_product(a_product, options={})\n deleted_line_item = nil\n item_to_remove = find(:first, a_product)\n deleted_line_item = @line_items.delete(item_to_remove) if item_to_remove\n deleted_line_item\n end", "def checkout_cart\n self.line_items.each do |li|\n li.item.inventory -= li.quantity\n li.item.save\n end\n self.line_items.clear\n self.status = \"submitted\"\n self.user.current_cart_id = nil\n self.user.save\n end", "def destroy\n\t\t@line_item.destroy\n\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to line_items_url, notice: \"Req ID: #{@line_item.id} removed.\" }\n\t\t\tformat.json { head :no_content }\n\t\tend\n\tend", "def remove_product(name)\n @products_in_cart.delete(Product)\nend", "def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to location_cart_path(@location = params[:location_id], @cart = session[:cart_id]), notice: 'Medicina elimnada de tu carrito' }\n format.json { head :no_content }\n end\n end", "def remove(variant, quantity, shipment=nil)\n line_item = order.find_line_item_by_variant(variant)\n\n unless line_item\n raise ActiveRecord::RecordNotFound, \"Line item not found for variant #{variant.sku}\"\n end\n\n remove_from_line_item(line_item, variant, quantity, shipment)\n end", "def destroy\n @item = Item.find(@ordered_item.item_id)\n @item.quantity += @ordered_item.quantity\n @item.update(quantity: @item.quantity )\n @ordered_item.destroy\n respond_to do |format|\n format.html { redirect_to ordered_items_url, notice: 'Ordered item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @line_item = LineItem.find(params[:id])\n @line_item.destroy\n\n respond_to do |format|\n if current_cart.line_items.empty?\n format.html { redirect_to(bikes_path, :notice=> 'Your cart is empty') }\n else \n format.html { redirect_to(current_cart, :notice=> 'Item Removed') } \n end\n\n format.xml { head :ok }\n end\n \n end", "def update_cart_line_item(a_line_item, quantity, options={})\n return remove(a_line_item, options) if quantity <= 0\n item = find(:first, a_line_item)\n item.quantity = quantity if item\n item\n end", "def destroy\n @line_item = LineItem.find(params[:id])\n @line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :ok }\n end\n end", "def destroy\n @purchase_order_item_line = PurchaseOrderItemLine.find(params[:id])\n @purchase_order_item_line.destroy\n\n respond_to do |format|\n format.html { redirect_to purchase_order_item_lines_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @line_item = @order.line_items.find(params[:id])\n @line_item.destroy\n\n head :no_content\n end", "def create \n @product = Product.find_by_title(params[:product]) \n @line_item = LineItem.new(params[:line_item])\n @line_item.product_id = @product.id\n @line_items= LineItem.where(:demand_id => @line_item.demand_id, :product_id => @line_item.product_id)\n \n @quantity = @line_item.quantity\n \n if @line_items != nil\n @line_items.each do |item|\n @quantity += item.quantity\n LineItem.find(item.id).destroy\n end\n @line_item.update_attributes(:quantity => @quantity)\n end\n \n respond_to do |format|\n if @line_item.save\n format.js\n else\n format.html { render action: \"new\" }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @product_line = ProductLine.find(params[:id])\n @product_line.destroy\n\n respond_to do |format|\n format.html { redirect_to product_lines_url }\n format.json { head :ok }\n end\n end", "def destroy\n @line_item = LineItem.find(params[:id])\n @line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @line_item = LineItem.find(params[:id])\n @line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @line_item = LineItem.find(params[:id])\n @line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @line_item = LineItem.find(params[:id])\n @line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url, notice: 'Line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @line_item = line_items.find(params[:id])\n @line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to line_items_url }\n end\n end", "def delete\n\t\[email protected](:item_id)\n end", "def call(_obj, args, _ctx)\n cart = ShoppingCart.find_by(user_id: args[:user_id])\n product = Product.find_by(product_id: args[:product_id])\n item = CartItem.find_by(product_id: args[product_id])\n cart.cart_items.delete(item)\n cart.total_cost -= product.price * item.quantity + product.shipping\n cart.save\n cart\n end", "def destroy\n @lineitem = Lineitem.find(params[:id])\n @lineitem.destroy\n\n respond_to do |format|\n format.html { redirect_to lineitems_url }\n format.json { head :ok }\n end\n end", "def destroy\n OrderItem.find_by(product: Product.find_by_title(params[:product_title]))\n .destroy_product(params[:quantity_of_products])\n order = Order.find_by_user_session_id(session['session_id'])\n if order.present?\n order.update_total_price_cents(nil)\n end\n redirect_to cart_path, notice: \"Вы убрали из корзины #{params[:product_title]}\"\n end", "def remove(variant, quantity = 1, shipment = nil)\n line_item = order.find_line_item_by_variant(variant)\n\n unless line_item\n raise ActiveRecord::RecordNotFound, \"Line item not found for variant #{variant.sku}\"\n end\n\n remove_from_line_item(line_item, variant, quantity, shipment)\n end", "def remove_product(product, quantity=1, payment_method='deposit')\n item = @items.find { |i| i.product_id == product.id && i.payment_method == payment_method }\n if item\n if item.quantity > quantity then\n item.quantity -= quantity\n else\n @items.delete(item)\n end\n end\n end", "def destroy\n @item_line = ItemLine.find(params[:id])\n @item_line.destroy\n\n respond_to do |format|\n format.html { redirect_to item_lines_url }\n format.json { head :no_content }\n end\n end", "def down\n # Find, then split, items with quantity > 1 into multiple items.\n LineItem.where(\"quantity > 1\").each do |line_item|\n\n # Add individual items as new line items for this cart and product,\n # each with a quantity of 1\n line_item.quantity.times do\n LineItem.create cart_id: line_item.cart_id,\n product_id: line_item.product_id, quantity: 1\n end # End of: line_item.quantity.times do\n\n # Delete the line item, i.e., the original item.\n line_item.destroy\n end # End of: LineItem.where(\"quantity>1\").each do |line_item|\n\n end", "def remove_from_cart\n render json: CartProduct.find(params[:id]).destroy\n end", "def remove_product(index)\n @cart.delete_at(index)\n puts \"**Product removed from cart.**\"\n view_cart\nend", "def destroy\n @cart = current_cart\n if params[:check_one]\n @line_items = LineItem.find(params[:check_one])\n @line_items.each do |line_item|\n line_item.destroy\n end\n end\n# @line_item.destroy\n\n# @line_item = @cart.sub_line_item(params[:id])\n\n\n respond_to do |format|\n format.html { redirect_to(:action => 'index', :controller => 'store') }\n format.js \n format.xml { render :xml => @line_item, :status => :deleted, :location => @line_item }\n end\n end", "def destroy\n @line_items.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url, notice: 'Line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def remove_product(index)\n @cart.delete_at(index)\n puts \"Product removed from cart.\"\n view_cart\nend", "def remove_cart_line_item(a_cart_line_item, options={})\n deleted_line_item = nil\n item_to_remove = find(:first, a_cart_line_item)\n deleted_line_item = @line_items.delete(item_to_remove) if item_to_remove\n deleted_line_item\n end", "def deduct_quantities_from_products\n line_items.each do |item|\n item.product_or_variant.deduct_quantity(item.quantity)\n end\n end", "def delete_from_cart\n cart_op {|cart| cart.delete(params[:id].to_i); cart }\n render_cart_size\n end", "def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url, notice: 'Line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url, notice: 'Line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url, notice: 'Line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url, notice: 'Line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url, notice: 'Line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url, notice: 'Line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @product_id = params[:product_id].to_s\n\n # remove the item from the session\n session[:shopping_cart].delete(@product_id)\n\n calculate_order_total\n end", "def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url, notice: \"Line item was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @lineitem.destroy\n respond_to do |format|\n format.html { redirect_to lineitems_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @order.line_items.clear\n respond_to do |format| \n format.html { redirect_to(edit_object_url) } \n end\n end", "def destroy\n @popularty_line_item = PopulartyLineItem.find(params[:id])\n @popularty_line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to popularty_line_items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @order_detail = OrderDetail.find(params[:id])\n product_detail = ProductDetail.find_by_id(@order_detail.product_detail_id)\n if product_detail.product_quantity.nil?\n details = 0\n else\n details = product_detail.product_quantity\n end\n @order_detail.destroy\n details +=1\n product_detail.update_attributes(:product_quantity => details)\n respond_to do |format|\n format.html {\n unless params[:cart_id].blank?\n redirect_to carts_url\n else\n redirect_to carts_url\n end\n }\n format.json { head :ok }\n end\n end", "def destroy\n @product_line = ProductLine.find(params[:id])\n @product_line.destroy\n\n respond_to do |format|\n format.html { redirect_to(product_lines_url) }\n format.xml { head :ok }\n end\n end", "def remove_quantity(inventory_item_id, quantity, concept = 3)\n item_location = ItemLocation.find_by(\n inventory_item_id: inventory_item_id,\n warehouse_location_id: id\n )\n\n return NOT_ENOUGH_STOCKS if quantity > item_location.quantity\n\n item_location.quantity -= quantity\n quantity = item_location.quantity if item_location.quantity.negative?\n\n item_location.save\n WarehouseTransaction.create(\n inventory_item_id: inventory_item_id,\n warehouse_location_id: id,\n quantity: quantity,\n concept: concept\n )\n\n if item_location.quantity <= 0\n item_location.destroy\n return 0\n end\n update_status\n item_location.quantity\n end", "def destroy\n @cart = current_cart\n @item = @cart.find_cart_item(params[:id])\n @product = @item.product\n @item.destroy\n flash[:warning] = \"#{@product.name} removed with success!\"\n redirect_to :back\n end", "def remove_item\n product = Product.find_by_cs_sku(params[:sku])\n item = ReservedItem.find_by_sql(['SELECT qty FROM reserved_items where user_id = ? and product_id = ? and session_id = ?',\n current_user.id,\n product.id,\n session.id]).first\n unless item.nil?\n product.update_attribute(:qty, product.qty + item.qty)\n ReservedItem.delete_all(['user_id = ? and product_id = ? and session_id = ?', current_user.id,\n product.id,\n session.id])\n end\n\n respond_with_format { @cart.remove_item params[:sku] }\n end", "def destroy\n @line_item1 = LineItem1.find(params[:id])\n @line_item1.destroy\n\n respond_to do |format|\n format.html { redirect_to line_item1s_url }\n format.json { head :no_content }\n end\n end", "def delete\n @product = Kernel.const_get(params[:type].camelize)[params[:id].to_i]\n\n\n cart = get_cart()\n cart.delete_product(@product)\n rescue Exception => e\n flash[:message] = 'Error: Delete from cart operation failed'\n ExceptionNotifier::Notifier.exception_notification(request.env, e).deliver\n ensure\n redirect_to(:action => '')\n end", "def decrease\n @cart = current_cart\n @line_item = @cart.decrease(params[:id])\n\n respond_to do |format|\n if @line_item.save\n format.html { redirect_to(store_url) }\n format.js { @current_item = @line_item }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def remove(item)\n cart_items.where(item_id: item.id).first.try(:destroy)\n end", "def destroy\n @line_item = current_member.seller.line_items.find(params[:id])\n @line_item.destroy\n \n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.xml { render :nothing => true }\n end\n end", "def purchase\n @cart_items = CartItem.where(cart: Cart.last)\n \n @cart_items.each do |cart_item|\n @product = cart_item.product\n if (@product.inventory_count > 0)\n cart_item.product.update(title: @product.title, \n description: @product.description,\n price: @product.price,\n inventory_count: @product.inventory_count - cart_item.quantity)\n cart_item.destroy\n else\n flash[:notice] = \"Item in cart had no inventory left\"\n next\n end\n end\n if @cart = Cart.last\n @cart.destroy\n respond_to do |format|\n format.html { redirect_to products_url, notice: 'Cart was successfully purchased.'}\n format.json { head :no_content }\n end\n else\n respond_to do |format|\n format.html { redirect_to products_url, notice: \"A cart must exist for products to be added to\" }\n format.json { head :no_content }\n end\n end\n Cart.create()\n end", "def remove(stuff, options={})\n if stuff.is_a?(MerchantSidekick::ShoppingCart::LineItem)\n self.remove_cart_line_item(stuff, options)\n else\n self.remove_product(stuff, options)\n end\n end" ]
[ "0.82011235", "0.7937417", "0.7804881", "0.77042943", "0.76757544", "0.7641766", "0.7544792", "0.7535273", "0.7512755", "0.74975467", "0.7463813", "0.74611145", "0.7449174", "0.74490124", "0.74416757", "0.7307449", "0.72973126", "0.7224416", "0.7153994", "0.71281266", "0.71236604", "0.70210874", "0.7019035", "0.70131785", "0.7009696", "0.69946337", "0.6992211", "0.69824916", "0.69658625", "0.6959308", "0.69177526", "0.69039756", "0.69038355", "0.6890065", "0.68827325", "0.68382335", "0.68202996", "0.6808146", "0.68024653", "0.67946124", "0.678364", "0.67765886", "0.67653346", "0.6759605", "0.6748962", "0.6740192", "0.6739126", "0.67338526", "0.67203593", "0.6718496", "0.6711574", "0.669775", "0.6693194", "0.6693194", "0.6693194", "0.6693194", "0.6690728", "0.66907054", "0.6669225", "0.66688675", "0.66614074", "0.6606948", "0.66039985", "0.65998596", "0.65789384", "0.65760905", "0.65736824", "0.6561289", "0.65555567", "0.65531546", "0.65411854", "0.6529233", "0.65253824", "0.6522014", "0.650657", "0.650657", "0.650657", "0.650657", "0.650657", "0.650657", "0.65064555", "0.6492037", "0.6492037", "0.64913654", "0.6484885", "0.64758337", "0.6473963", "0.64633673", "0.64608896", "0.6458534", "0.6453153", "0.64472616", "0.64247936", "0.64102334", "0.6391613", "0.636617", "0.6359386", "0.6355433", "0.6351047", "0.63489795" ]
0.81706566
1
PUT /line_items/1 PUT /line_items/1.json
def update @line_item = LineItem.find(params[:id]) respond_to do |format| if @line_item.update_attributes(params[:line_item]) format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @line_item.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @line_item = @order.line_items.find(params[:id])\n\n if @line_item.update(line_item_params)\n head :no_content\n else\n render json: @line_item.errors, status: :unprocessable_entity\n end\n end", "def update\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n if @line_item.update_attributes(params[:line_item])\n format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n if @line_item.update_attributes(params[:line_item])\n format.html { redirect_to @line_item, :notice => 'Line item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @line_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @item_line = ItemLine.find(params[:id])\n\n respond_to do |format|\n if @item_line.update_attributes(params[:item_line])\n format.html { redirect_to @item_line, notice: 'Item line was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item_line.errors, status: :unprocessable_entity }\n end\n end\n end", "def update #saves and redirects, saves changes\n @line_item = LineItem.find(params[:id])\n @line_item.quantity = params[:quantity]\n @line_item.size_id = params[:size_id]\n @line_item.save\n render json: @line_item\n end", "def update\n @lineitem = Lineitem.find(params[:id])\n\n respond_to do |format|\n if @lineitem.update_attributes(params[:lineitem])\n format.html { redirect_to @lineitem, notice: 'Lineitem was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lineitem.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\t\trespond_to do |format|\n\t\t\tif @line_item.update(line_item_params)\n\t\t\t\tformat.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n\t\t\t\tformat.json { render :show, status: :ok, location: @line_item }\n\t\t\telse\n\t\t\t\tformat.html { render :edit }\n\t\t\t\tformat.json { render json: @line_item.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def update\n respond_to do |format|\n if @line_items.update(line_item_params)\n format.html { redirect_to @line_items, notice: 'Line item was successfully updated.' }\n format.json { render json: :show, status: :ok, location: @line_item }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @line_items.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @line_item.update(line_item_params)\n format.html { redirect_to @line_item, notice: \"Line item was successfully updated.\" }\n format.json { render :show, status: :ok, location: @line_item }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @line_item.update(line_item_params)\n format.html { redirect_to @line_item, notice: \"Line item was successfully updated.\" }\n format.json { render :show, status: :ok, location: @line_item }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @line_item.update(line_item_params)\n format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n format.json { render :show, status: :ok, location: @line_item }\n else\n format.html { render :edit }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @line_item.update(line_item_params)\n format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n format.json { render :show, status: :ok, location: @line_item }\n else\n format.html { render :edit }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @line_item.update(line_item_params)\n format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n format.json { render :show, status: :ok, location: @line_item }\n else\n format.html { render :edit }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @line_item.update(line_item_params)\n format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n format.json { render :show, status: :ok, location: @line_item }\n else\n format.html { render :edit }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @line_item.update(line_item_params)\n format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n format.json { render :show, status: :ok, location: @line_item }\n else\n format.html { render :edit }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @line_item.update(line_item_params)\n format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n format.json { render :show, status: :ok, location: @line_item }\n else\n format.html { render :edit }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @line_item.update(line_item_params)\n format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n format.json { render :show, status: :ok, location: @line_item }\n else\n format.html { render :edit }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @line_item.update(line_item_params)\n format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n format.json { render :show, status: :ok, location: @line_item }\n else\n format.html { render :edit }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @line_item1 = LineItem1.find(params[:id])\n\n respond_to do |format|\n if @line_item1.update_attributes(params[:line_item1])\n format.html { redirect_to @line_item1, :notice => 'Line item1 was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @line_item1.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n if @line_item.update_attributes(params[:line_item])\n env[\"HTTP_REFERER\"] += '#' + item.id.to_s\n format.html { redirect_to :back, notice: \"Aggiornato con successo.\" }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @line_item.update(line_item_params)\n format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @line_item.update(line_item_params)\n format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @line_item.update(line_item_params)\n format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n if @line_item.update_attributes(params[:line_item])\n format.html { redirect_to(@line_item, :notice => 'Line item was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @line_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @line_item = @line_items.find(params[:id])\n\n respond_to do |format|\n if @line_item.update_attributes(params[:line_item])\n format.html { redirect_to @cart.shop, notice: t(\"line_items.update.notice_success\") }\n else\n format.html { render action: \"edit\" }\n end\n end\n end", "def update\n respond_to do |format|\n if @line_item.update(line_item_params)\n format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n format.json { render :show, status: :ok, location: @line_item }\n else\n format.html { render :edit } \n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_line_item\n @line_items = LineItem.find(params[:id])\n end", "def update\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n if @line_item.update_attributes(params[:line_item])\n format.html { redirect_to(@line_item, :notice => 'Line item was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @line_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end", "def update_item\n order = current_user.init_cart.order\n line_item = order.line_items.find(params[:id])\n line_item.attributes = params[:item]\n image = line_item.image\n line_item.price = Product.find(line_item.product_id).price_for_tier(image.tier_id, image.owner?(current_user))\n line_item.tax = line_item.price * PER_TAX\n\n if line_item.save\n render json: line_item, status: :created\n else\n render json: { msg: line_item.errors.full_messages.to_sentence }, status: :bad_request\n end\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\nend", "def set_line_item\n @line_item = LineItem.find_by(params[:id])\n end", "def update\n @order.line_items.destroy_all\n @order.update(cost: 0)\n\n order_params[:line_items].each do |item|\n if !item.empty?\n @order.line_items.create(:product_id => item, :order_id => @order.id)\n @order.update(cost: @order.cost + @order.line_items[0].product.price)\n end\n end\n\n respond_to do |format|\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n end\n end", "def set_line_item\n @line_item = order.line_items.find(params[:id])\n end", "def update\n respond_to do |format|\n if @line_item.update(line_item_params)\n format.html { redirect_to @line_item, notice: 'Line item was added to your cart' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_lineitem\n @lineitem = LineItem.find(params[:id])\n end", "def set_lineitem\n @lineitem = Lineitem.find(params[:id])\n end", "def update\n respond_to do |format|\n if @line_item.update(line_item_params)\n format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n format.json { render :show, status: :ok, location: @line_item }\n else\n format.html { render :edit }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\nend", "def line_item_update(h)\n\t\trows = @database.execute <<-SQL\n\t\tUPDATE invoice_lines\n\t\tSET\n\t\t\t\t_order = '#{h['order']}'\n\t\t\t, invoice_id = '#{h['invoice_id']}'\n\t\t\t, name = '#{h['name']}'\n\t\t\t, matter = '#{h['matter']}'\n\t\t\t, description = '#{h['description']}'\n\t\t\t, amount = '#{h['amount']}'\n\t\t\t, first_expense_id = '#{h['first_expense_id']}'\n\t\t\t, first_time_entry_id = '#{h['first_time_entry_id']}'\n\t\t\t, line_item_date = '#{h['line_item_date']}'\n\t\t\t, person = '#{h['person']}'\n\t\t\t, unit_cost = '#{h['unit_cost']}'\n\t\t\t, quantity = '#{h['quantity']}'\n\t\t\t, type = '#{h['type']}'\n\t\t\t, updated = '#{h['updated']}'\n\t\tWHERE (number = '#{h['number']}' AND line_id = '#{h['line_id']}');\n\t\tSQL\n\tend", "def update\r\n @lineitem = Lineitem.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @lineitem.update_attributes(params[:lineitem])\r\n flash[:notice] = 'Lineitem was successfully updated.'\r\n format.html { redirect_to(@lineitem) }\r\n format.xml { head :ok }\r\n else\r\n format.html { render :action => \"edit\" }\r\n format.xml { render :xml => @lineitem.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n @order_line_item = OrderLineItem.find(params[:id])\n\n if @order_line_item.update(order_line_item_params)\n # set to manually completd\n @order_line_item.status = \"Manually Completed\"\n @order_line_item.save\n render json: @order_line_item\n else\n render json: @order_line_item.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @line_item.update(line_item_params)\n format.html { redirect_to @line_item, notice: \"Line item was successfully updated.\" }\n format.json { render :show, status: :ok, location: @line_item }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\nend", "def set_line_item\n\t\t\t@line_item = LineItem.find(params[:id])\n\t\tend", "def create\n @line_item = @order.line_items.new(line_item_params)\n\n if @line_item.save\n render json: @line_item, status: :created, location: [@order, @line_item]\n else\n render json: @line_item.errors, status: :unprocessable_entity\n end\n end", "def update\n @purchase_order_item_line = PurchaseOrderItemLine.find(params[:id])\n\n respond_to do |format|\n if @purchase_order_item_line.update_attributes(params[:purchase_order_item_line])\n format.html { redirect_to @purchase_order_item_line, notice: 'Purchase order item line was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @purchase_order_item_line.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sub1_line_item.update(sub1_line_item_params)\n format.html { redirect_to @sub1_line_item, notice: 'Sub1 line item was successfully updated.' }\n format.json { render :show, status: :ok, location: @sub1_line_item }\n else\n format.html { render :edit }\n format.json { render json: @sub1_line_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @invoice_line_item.update(invoice_line_item_params)\n format.html { redirect_to @invoice_line_item, notice: 'Invoice line item was successfully updated.' }\n format.json { render :show, status: :ok, location: @invoice_line_item }\n else\n format.html { render :edit }\n format.json { render json: @invoice_line_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n @participants = Participant.all\n @users = User.all\n if @lineitem.update(lineitem_params)\n format.html { redirect_to @lineitem, notice: 'Lineitem was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @lineitem.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n if @line_item.update_attributes(params[:line_item])\n format.html { redirect_to(@line_item, :notice => 'A bike was updated in your cart.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @line_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @line_item = LineItem.find(params[:id])\n @line_item.price = @line_item.catalog_item.unit_price\n respond_to do |format|\n if @line_item.update_attributes(params[:line_item])\n flash[:notice] = 'LineItem was successfully updated.'\n format.html { redirect_to(@line_item) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @line_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @lineitem = Lineitem.find(params[:id])\n @item = Item.find(@lineitem.item_id)\n @lineitem_quantity_temp = @lineitem.quantity\n respond_to do |format|\n if @lineitem.update_attributes(params[:lineitem])\n if @item.amount > 0\n format.html { redirect_to 'http://localhost:3000/carts/show'}\n format.json { head :no_content }\n else\n @lineitem.quantity = @lineitem_quantity_temp\n @lineitem.save\n format.html {redirect_to 'http://localhost:3000/itemnotfound.html/' }\n end\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lineitem.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @line_item_id = args[:line_item_id] if args.key?(:line_item_id)\n @product_id = args[:product_id] if args.key?(:product_id)\n @quantity = args[:quantity] if args.key?(:quantity)\n end", "def update_cart_line_item(a_line_item, quantity, options={})\n return remove(a_line_item, options) if quantity <= 0\n item = find(:first, a_line_item)\n item.quantity = quantity if item\n item\n end", "def create \n @line_item = LineItem.new(line_item_params)\n respond_to do |format|\n if @line_item.save\n format.html { redirect_to '/line_items', notice: \"Line item was successfully created.\" }\n format.json { render :show, status: :created, location: @line_item }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n item = Item.find(params[:item_id])\n @line_item = @cart.line_items.find_by(item: item)\n if @line_item\n @line_item.quantity += 1\n else\n @line_item = @cart.line_items.new(item: item)\n end\n\n respond_to do |format|\n if @line_item.save\n format.html { redirect_to @line_item.cart, notice: 'Line item was successfully created.' }\n format.json { render :show, status: :created, location: @line_item }\n else\n format.html { render :new }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\nend", "def create\n @line_item = LineItem.new(params[:line_item])\n\n respond_to do |format|\n if @line_item.save\n format.html { redirect_to @line_item, notice: 'Line item was successfully created.' }\n format.json { render json: @line_item, status: :created, location: @line_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def line_item_params\n params.require(:line_item).permit(:quantity, :product_id, :order_id)\n end", "def update\n respond_to do |format|\n if @liner_item.update(liner_item_params)\n format.html { redirect_to @liner_item, notice: 'Liner item was successfully updated.' }\n format.json { render :show, status: :ok, location: @liner_item }\n else\n format.html { render :edit }\n format.json { render json: @liner_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @invoice_line_item = InvoiceLineItem.find(params[:id])\n\n respond_to do |format|\n if @invoice_line_item.update_attributes(params.require(:invoice_line_item).permit(:amount, :description, :invoice_id, :line_item_purpose_id, :service_visit_id, :vehicle_id))\n format.html { redirect_to invoice_line_items_url,\n notice: 'InvoiceLineItem was successfully updated.' }\n format.json { head :no_content }\n else\n prepFormVariables\n format.html { render action: \"edit\" }\n format.json { render json: @invoice_line_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @line = Line.find(params[:id])\n\n respond_to do |format|\n if @line.update_attributes(line_params)\n format.html { redirect_to new_line_path, notice: 'Line was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render verb: \"edit\" }\n format.json { render json: @line.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @estimate_line_item = EstimateLineItem.find(params[:id])\n\n respond_to do |format|\n if @estimate_line_item.update_attributes(params[:estimate_line_item])\n format.html { redirect_to(@estimate_line_item, :notice => 'Estimate line item was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @estimate_line_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n order_changed = false\n @errors = Array.new #holds error objects\n @line_items = Array.new #holds existing_line items in case of errors\n line_items = params[:line_items]\n #Loop through @line_items first to validate but NOT to persist. If any is invalid, then render the order edit\n #view to display @errors without saving. Otherwise save them and redirect to order show page.\n \n line_items.each do |li|\n line_item = LineItem.new(li)\n if ! li[:id].empty? #has value for id\n existing_line_item = LineItem.find(li[:id]) #line item already exists\n if line_item.quantity == 0 || line_item.quantity.nil? #quantity changed to 0\n #existing_line_item.destroy\n #order_changed = true\n @line_items << existing_line_item\n elsif existing_line_item.quantity == line_item.quantity #quantity not changed\n #do nothing if quantity not changed\n @line_items << existing_line_item\n else #quantity changed to something other than 0\n #existing_line_item.update_attributes(li)\n @errors << line_item.errors if line_item.invalid?\n @line_items << existing_line_item\n #order_changed = true\n end\n elsif line_item.quantity != 0 && line_item.id.nil? && ! line_item.quantity.nil? #line item does not already exist, so need to create a new one\n #@line_item = line_item\n line_item.order_id = params[:order_id]\n #@line_item.save\n #order_changed = true\n @errors << line_item.errors if line_item.invalid?\n @line_items << line_item\n else\n @line_items << line_item\n end\n end #each to validate\n if ! @errors.empty?\n @order = Order.find(params[:order_id])\n render \"orders/edit\"\n else\n line_items.each do |li|\n line_item = LineItem.new(li)\n if ! li[:id].empty? #has value for id\n existing_line_item = LineItem.find(li[:id]) #line item already exists\n if line_item.quantity == 0 || line_item.quantity.nil? #quantity changed to 0\n existing_line_item.destroy\n order_changed = true\n elsif existing_line_item.quantity == line_item.quantity #quantity not changed\n #do nothing if quantity not changed\n else #quantity changed to something other than 0\n existing_line_item.update_attributes(li)\n \n order_changed = true\n end\n elsif line_item.quantity != 0 && line_item.id.nil? && ! line_item.quantity.nil? #line item does not already exist, so need to create a new one\n line_item = line_item\n line_item.order_id = params[:order_id]\n line_item.save\n order_changed = true\n end\n end #each to save\n \n UserMailer.send_invoice(current_user, Order.find(params[:order_id]), true).deliver if order_changed\n notice = order_changed ? 'Order was successfully updated' : 'Order was not changed'\n redirect_to Order.find(params[:order_id]), notice: notice\n end\n end", "def line_item_params\n params.permit(line_item: [:item_id, :quantity])\n end", "def issue_refer_line_items\n line_items.each do |line|\n logger.debug \"==@@@@==SalesOrder refer_line_id== #{line.refer_line_id}\"\n po_line = LineItem.find(line.refer_line_id)\n po_line.update_attribute(:quantity_issued, po_line.quantity_issued + line.quantity)\n\n line.update_attribute(:cart_id, nil)\n end\n end", "def create\n parent_line_item = get_parent_line_item\n if parent_line_item\n @line_item = parent_line_item.dup\n @line_item.line_item = parent_line_item\n @line_item.searchable = false\n @line_item.admin_verified = false\n @line_item.section_id = line_item_params[\"section_id\"]\n else\n @line_item = LineItem.new(line_item_params);\n end\n\n if @line_item.save\n render json: @line_item, status: :created, location: @line_item\n else\n render nothing: true, status: :bad_request\n end\n end", "def create\n @item_line = ItemLine.new(params[:item_line])\n\n respond_to do |format|\n if @item_line.save\n format.html { redirect_to @item_line, notice: 'Item line was successfully created.' }\n format.json { render json: @item_line, status: :created, location: @item_line }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item_line.errors, status: :unprocessable_entity }\n end\n end\n end", "def link_line_item(line_item)\n self.spree_line_item_id = line_item.id\n self.save!\n end", "def update\n respond_to do |format|\n if @line_property_item.update(line_property_item_params)\n format.html { redirect_to @line_property_item, notice: 'Line property item was successfully updated.' }\n format.json { render :show, status: :ok, location: @line_property_item }\n else\n format.html { render :edit }\n format.json { render json: @line_property_item.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.75274915", "0.7351354", "0.73112833", "0.7279287", "0.7242768", "0.7206155", "0.7196351", "0.7190699", "0.7104807", "0.7104807", "0.71046823", "0.71046823", "0.71046823", "0.71046823", "0.71046823", "0.71046823", "0.71046823", "0.7080236", "0.70737576", "0.70631504", "0.70331806", "0.70331806", "0.70331806", "0.7030651", "0.70298755", "0.70153296", "0.69971573", "0.69967633", "0.6978854", "0.6978854", "0.6978854", "0.6978854", "0.6978854", "0.6978854", "0.6978854", "0.6978854", "0.68993837", "0.68808335", "0.68808335", "0.68808335", "0.68808335", "0.68808335", "0.68808335", "0.68808335", "0.68808335", "0.68808335", "0.68808335", "0.68808335", "0.68808335", "0.68808335", "0.68808335", "0.68808335", "0.68808335", "0.68808335", "0.68808335", "0.68808335", "0.68808335", "0.68808335", "0.6869377", "0.68594515", "0.68373895", "0.67928827", "0.67719084", "0.676184", "0.67462593", "0.67370176", "0.6732415", "0.6725218", "0.6721659", "0.66727936", "0.6667183", "0.665667", "0.6637227", "0.65933484", "0.6562617", "0.6556614", "0.65308046", "0.6518257", "0.64765805", "0.6468897", "0.64233565", "0.6421809", "0.6390915", "0.6373598", "0.6371993", "0.63508064", "0.6323154", "0.63227624", "0.63077927", "0.63029736", "0.6297056", "0.6288692", "0.62886155", "0.6288318", "0.62872744", "0.628468" ]
0.7309161
6
p encrypt("abc") p encrypt("zed")
def decrypt(encoded_phrase) alphabet = "abcdefghijklmnopqrstuvwxyz" loop_counter = 0 decrypted_result = "" while loop_counter < encoded_phrase.length current_index = alphabet.index(encoded_phrase[loop_counter]) current_letter = encoded_phrase[loop_counter] if current_letter == 'a' decrypted_result += 'z' elsif current_letter == " " decrypted_result += " " else previous_letter = alphabet[current_index - 1] decrypted_result += previous_letter end loop_counter += 1 end decrypted_result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encrypt; end", "def test_it_encrypts_a_single_letter\n cryptographer = Cryptographer.new\n assert_equal \"n\", cryptographer.encrypt(\"a\")\n end", "def test_it_encrypts_a_single_char ###\n cryptographer = Cryptographer.new\n assert_equal \"n\", cryptographer.encrypt_1(\"a\")\n end", "def encrypt string\n string\n end", "def crypt(text,key,operator = :+)\n index = 0\n text.upcase.each_byte.reduce(\"\") do |res, c|\n res << (65 + (c.send(operator, key[index % key.length].ord)) % 26).chr\n index += 1\n res\n end\nend", "def crypt(p0) end", "def encrypt phrase, key\n alphabet = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\".split(\"\")\n cipherbet = get_cipherbet key\n result = \"\"\n phrase.each_char do |letter|\n encrypted_letter = encrypt_letter alphabet, cipherbet, letter\n result = result + encrypted_letter\n end\n return result\nend", "def encrypt (password)\n # Uppercase and spaces will be ignored!\n ## Because we are getting rid of them...\n password.delete!(\" \")\n password.downcase!\n encrypted_password = \"\"\n while password != \"\"\n ## We're retrieving the next letter\n pass_var = password[0].next\n ## Creating our exception for 'z'\n if pass_var == \"aa\"\n pass_var = \"a\"\n end\n ## Recycling our old letters\n password = password[1..-1]\n ## Now adding them with our new letter!\n encrypted_password += pass_var\n end\n ## And now we're implicitly returning it\n encrypted_password\nend", "def vigenere_cipher(string, key_sequence, alphabet)\n #\n # your code goes here\n #\nend", "def vigenere_cipher(string, key_sequence, alphabet)\r\n\r\nend", "def encrypt(*args, &block)\n crypt :encrypt, *args, &block\n end", "def cipher; end", "def encrypt(password)\n end_password = password.length\n encrypt_counter = 0\n e_string = \"\"\n while encrypt_counter < end_password\n if password[encrypt_counter].next == \"aa\"\n e_string += \"a\"\n elsif password[encrypt_counter].next == \"!\"\n \t\te_string += \" \"\n else \n e_string += \"#{password[encrypt_counter]}\".next\n end\n encrypt_counter += 1\n end\n e_string\nend", "def encrypt (password)\n output = ''\n for i in 0.. ( password.length - 1) do\n if password[i] == ' '\n output += ' '\n elsif password[i] == 'z'\n output += 'a'\n else\n output += password[i].to_s.next\n end\n end\n output\nend", "def encrypt(string)\n CRYPTO.encrypt_string(string).to_64\nend", "def encrypt(password)\r\n #needs to be a string when being nested in another method\r\n\tindex = password.to_s.length\r\n\ti = 0\r\n\twhile i < index\r\n #conditional for edge cases\r\n\t\tif password[i] == \"z\"\r\n\t\t\tpassword[i] = \"a\"\r\n elsif password[i] == \" \"\r\n password[i] = \" \"\r\n\t\telse\r\n\t\t\tpassword[i] = password[i].next!\r\n\t\tend\r\n\t\ti += 1\r\n\tend\r\n<<<<<<< HEAD\n\treturn password\r\n=======\n\tp password\r\n>>>>>>> 0c7a712b88e73bdee1929aa9db36019c3903c448\nend", "def encrypt (string)\n\treturnarray = []\n\tkey_hash =\n {\t\"a\"=> \"e\",\"e\" =>\"i\", \"i\"=> \"o\", \"o\" =>\"u\", \"u\" =>\"a\",'b' =>'c','c' =>'d','d' =>'f','f' =>'g','g' =>'h','h' =>'j','j' =>'k','k' =>'l','l' =>'m','m' =>'n','n' =>'p','p' =>'q','q' =>'r','r' =>'s','s' =>'t','t'=> 'v','v' =>'w','w'=> 'x','x' =>'y','y' =>'z','z'=>'b' }\n\tencode = string.downcase.split('')\n\t#p encode\n\n\n\tencode.each_index do |x|\n\t\t\tif key_hash.has_key?(encode[x])\n\t\t\t\t#p key_hash[encode[x]]\n\t\t\t\treturnarray.push( key_hash[encode[x]])\n\t\t\t\t#p returnarray\n\t\t\telse\n\t\t\t\treturnarray.push(encode[x])\n\t\t end\n \tend\n\treturn returnarray.join\nend", "def vigenere_cipher(str,keys)\n alpha = (\"a\"..\"z\").to_a\n new_str = \"\"\n\n str.each_char.with_index do |char,idx|\n old_pos = alpha.index(char)\n new_pos = old_pos + keys[idx % keys.length]\n new_str += alpha[new_pos % alpha.length]\n end\n\n new_str\n\nend", "def vigenere_cipher(string, key_sequence)\n\nend", "def encrypt(string)\n secure_hash(\"#{salt}--#{string}\") \n\tend", "def encrypt(password)\n counter = 0\n result = \"\"\n while counter < password.length\n letter = password[counter]\n \n if letter == \" \"\n result << \" \"\n elsif letter == \"z\"\n result << \"a\"\n else\n result << letter.next\n end\n counter += 1\n end\n result\nend", "def encrypt(pass)\n counter = 0\n password = \"\"\n\n until counter == pass.length\n alphabet = \"abcdefghijklmnopqrstuvwxyza\"\n letter = alphabet.index(pass[counter]) + 1\n counter += 1\n password = alphabet[letter] + password\n\n end\n password.reverse\n end", "def vigenere_cipher(message, keys)\n alphabetic = (\"a\"..\"z\").to_a\n encrypted = \"\"\n\n message.each_char.with_index do |char, i|\n num = keys[i % keys.length]\n index = alphabetic.index(char)\n encrypted += alphabetic[(index + num) % 26]\n end\n \n encrypted\nend", "def encrypt(password)\n\tcounter = 0\n\twhile counter < password.length\n\tif password[counter] == \" \"\n\t\tpassword[counter] = \" \"\n\t\tcounter += 1\n\telse\n\t\talphabet = \"abcdefghijklmnopqrstuvwxyz\"\n\t\talphabet.reverse!\n\t\tinstance_in_alphabet = alphabet[alphabet.index(password[counter])]\n\t\tpassword[counter] = alphabet[(alphabet.index(instance_in_alphabet)) - 1] \n\t\tcounter += 1 \n\tend\n\tend\nreturn password \nend", "def encrypt(str)\n len=str.length\n i = 0\n #declare empty string\n answer=\"\"\n #loop to go over each character in the string\n while i < len\n if str[i]==\"z\"\n answer=answer+\"a\"\n else\n answer= answer+str[i].next\n end\n i+=1\n end\n return answer\nend", "def encrypt(string)\n secure_hash(\"#{salt}--#{string}\")\n end", "def encode(plaintext, key)\n cipher = key.chars.uniq + (('a'..'z').to_a - key.chars)\n ciphertext_chars = plaintext.chars.map do |char|\n (65 + cipher.find_index(char)).chr\n end\n puts ciphertext_chars.join\nend", "def encrypt (word)\r\n\t# Stores how many characters are in the word to the variable: length\r\n\tlength = word.length\r\n\t# Initializes the encryption result as nothing before loop\r\n\tencryptedresult = \"\"\r\n\t# Initializes the counter to zero before the loop\r\n\tcounter = 0\r\n\t# Keeps looping until counter does every character of the word to be encrypted\r\n\twhile counter < length\r\n\t\t# Special end case for z to go back to a rather than aa\r\n\t\tif word[counter] == 'z'\r\n\t\t\tencryptedresult += \"a\"\r\n\t\t# If the character is a space then do nothing to it\r\n\t\telsif word[counter] == ' '\r\n\t\t\tencryptedresult += \" \"\r\n\t\t# Proceed with the regular encryption\r\n\t\telse\r\n\t\t\tencryptedresult += word[counter].next\r\n\t\tend\r\n\t\t# Adds to counter to avoid infinite loop\r\n\t\tcounter += 1\r\n\tend\r\n\t# Shows the word after encryption and uses P because puts will return 'nil'\r\n\tp encryptedresult\r\nend", "def vigenere_cipher(string, key_sequence)\n result = \"\"\n alphabet = (\"a\"..\"z\").to_a\n string.each_char.with_index do |ch, idx|\n key_idx = idx % key_sequence.length\n char_idx = (alphabet.index(ch) + key_sequence[key_idx]) % alphabet.length\n result << alphabet[char_idx]\n end\n result\nend", "def encrypt(plaintext)\n ciphertext = \"\"\n for i in 0...plaintext.length\n key = @alphabet.index(plaintext[i]);\n key = mod(key+@shift, @alphabet.length)\n ciphertext = ciphertext + @alphabet.at(key)[0]\n end\n return ciphertext\n end", "def encrypt(string)\n length = string.length\n\n\n encrypt_string = \"\"\n count = 0\n until count >= length\n if string[count] == \"z\"\n encrypt_string = encrypt_string + \"a\"\n\n else\n encrypt_string = encrypt_string + string[count].next\n end\n count += 1\n end\n p encrypt_string\nend", "def vigenere_cipher(message, keys)\n alpha = (\"a\"..\"z\").to_a\n new_string = \"\"\n message.each_char.with_index do |char, i|\n old_i = alpha.index(char)\n new_i = (old_i + keys[i % keys.length]) % 26\n new_string += alpha[new_i]\n end\n new_string\nend", "def caesar_cipher(str, shift)\n\nend", "def encrypt(password)\r\n\tfor i in 0...password.length\r\n\t\tif password[i] == \" \"\r\n\t\telse\r\n\t\t\tif password[i] == \"z\"\r\n\t\t\t\tpassword[i] = \"a\"\r\n\t\t\telse\r\n\t\t\t\tpassword[i] = password[i].next\r\n\t\t\tend\r\n\t\tend\r\n\tend\r\n\treturn password\r\nend", "def encrypt(str)\n str_count = 0\n str_actual = \"\"\n until str_count == str.length\n if str[str_count] == \"z\"\n str_actual += \"a\"\n else\n str_actual += str[str_count].next\n end\n str_count += 1\n end\n encrypt = str_actual\nend", "def encrypt(code)\n\ti = 0\n\t#declare empty string we will add to\n\toutput = \"\"\n\t#loop over the string's letters\n\twhile i < code.length\n\t\t letter = code[i].next\n\t\t if letter == \"aa\" \n\t\t \tletter = \"a\"\n\t\t end\n\t\t output = output + letter\n\t\ti += 1\t\n\tend\n\tputs output\nend", "def vigenere_cipher(string, key_sequence)\n alphabet = ('a'..'z').to_a\n keys = key_sequence.dup\n result = \"\"\n while result.length < string.length\n c = string[result.length] \n offset = (alphabet.index(c) + keys.first) % 26 \n result += alphabet[offset]\n keys.push(keys.shift)\n end\n result\nend", "def encrypt(password)\n\tsplit_string = string.password(//)\n\tsplit_string.each do |letter|\n\t\tletter.next\n\tend\n\nend", "def vigenere_cipher(message, keys)\n alphabet = (\"a\"..\"z\").to_a\n encrypted = \"\"\n\n message.each_char.with_index do |char, idx|\n shift = keys[idx % keys.length]\n encrypted += alphabet[(alphabet.index(char) + shift) % 26]\n end\n\n encrypted\nend", "def caesarCipherEncryptor(string, key)\n new_letters = []\n new_key = key % 26\n alphabet = (\"abcdefghijklmnopqrstuvwxyz\").chars\n\n string.each_char do |letter|\n new_letters.append(get_new_letter(letter, new_key, alphabet))\n end\n return new_letters.join\nend", "def decrypt_letter alphabet, cipherbet, letter\ndecrypt_letter = encrypt_letter cipherbet, alphabet, letter\nreturn decrypt_letter\nend", "def vigenere_cipher(message, keys)\n alphabet = \"abcdefghijklmnopqrstuvwxyz\"\n cycle = 0\n result = \"\"\n\n message.each_char do |char|\n result += alphabet[(alphabet.index(char) + keys[cycle % keys.length]) % alphabet.length]\n cycle += 1\n end\n\n return result\nend", "def encrypt(plaintext)\n box.encrypt(plaintext)\n end", "def encrypt(string)\n secure_hash(\"#{salt}--#{string}\")\n end", "def vigenere_cipher(message, key)\n key_index = 0 \n alpha = (\"a\"..\"z\").to_a\n new_str = \"\"\n\n message.each_char.with_index do|char,idx|\n new_str += alpha[(alpha.index(char) + key[key_index % key.length])%26]\n key_index += 1\n end\n new_str\nend", "def vigenere_cipher(message, keys)\n chars = message.split('')\n i = -1\n enc_chars = chars.map do |char|\n i = (i + 1) % keys.length\n encrypt_char(char, keys[i])\n end\n enc_chars.join\nend", "def encrypt_string(string)\n\n return string.tr(\"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\", \"9nopqrs8tuvwxy7zabcde6fghijk5lmNOPQ4RSTUVW3XYZABC2DEFGHI1JKLM0\")\n\nend", "def encrypt_string(string)\n\n return string.tr(\"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\", \"9nopqrs8tuvwxy7zabcde6fghijk5lmNOPQ4RSTUVW3XYZABC2DEFGHI1JKLM0\")\n\nend", "def encrypt(secret_password)\n# Create a character index\n index = 0\n# Create an empty string to have a return value\n encrypted_string = \"\"\n# Loop until you get to the last letter in the password\n while index < secret_password.length do\n encrypted_string += secret_password[index].next\n# Call the index plus 1\n index += 1\n end\n #return the implicit empty response at the end\n encrypted_string\n# end encryption method\nend", "def encrypt(str)\r\n\ti = 0\r\n\toutput = \"\"\r\n while i < str.length\r\n\t output = output + str[i].next\r\n\t i += 1\r\n\tend\r\noutput\r\nend", "def caesar_cipher(string, shift)\nend", "def encrypt (password)\n\ti = 0\n\tconvert = \"\"\n\tlength = password.length\n\n\tfor i in 0...length\n\t\tconvert += password[i].next\n\t\tif password[i] == \"z\"\n\t\t\tconvert = convert.chomp(\"a\")\n\t\tend\n\tend\n\treturn convert\nend", "def decrypt(sentence, combination)\n encrypt(sentence, combination)\nend", "def encrypt(string)\n index=0\n while index < string.length\n letter=string[index].next\n if letter==\"aa\"\n p \"a\"\n else\n p letter\n end\n index +=1\n end\n end", "def decrypt phrase, key\n decrypt = encrypt phrase, key\n return decrypt\nend", "def caesar_guesser(encrypted_string, alphabet)\r\n\r\nend", "def vigenere_cipher(message, keys)\n alpha = \"abcdefghijklmnopqrstuvwxyz\"\n new_str = \"\"\n if keys.length == 1\n message.each_char do |char|\n alpha_idx = alpha.index(char)\n new_idx = (alpha_idx + keys[0]) % 26\n new_str += alpha[new_idx]\n end\n else\n new_keys = keys\n message.each_char do |char|\n alpha_idx = alpha.index(char)\n new_idx = (alpha_idx + new_keys[0]) % 26\n new_str += alpha[new_idx]\n new_keys.rotate!(1)\n end\n end\n new_str\n \nend", "def encrypt(word)\n\ti = 0\n\twhile i < word.length\n\t\tif word[i] == \"z\"\n\t\t\tword[i] = \"a\"\n\t\telse\n\t\t\tword[i] = word[i].next!\n\t\tend\n\t\t\ti += 1\n\tend\n\tword\n\t#this method works best by not using puts and letting 'word' be returned implicitly or by using p.\nend", "def vigenere_cipher(string, keys)\n alpha = ('a'..'z').to_a\n new_word = \"\"\n\n string.each_char.with_index do |char, idx|\n old_idx = alpha.index(char)\n new_idx = old_idx + keys[idx % keys.length]\n new_char = alpha[new_idx % alpha.length]\n new_word += new_char\n end\n\n new_word\nend", "def encrypt(eword)\n\tstrlen=eword.length\n\tcounter = 0\n\twhile counter < strlen\n\t\tif eword[counter]==\" \"\n\t\telsif eword[counter]==\"z\"\n\t\t \teword[counter]=\"a\"\n\t\telse\n\t\teword[counter]=eword[counter].next\n\tend\n\tcounter+=1\n\tend\n\treturn eword\nend", "def vigenere_cipher(string, key_sequence)\n result = \"\"\n string.each_char.with_index do |c, idx|\n key_idx = idx % key_sequence.length\n key = key_sequence[key_idx]\n result << shift(c, key)\n end\n result\nend", "def vigenere_cipher(str, k)\n alpha = (\"a\"..\"z\").to_a\n\n msg = (0...str.length).map do |i|\n old_pos = alpha.index(str[i])\n new_pos = (old_pos + k[i%k.length]) % alpha.length\n alpha[new_pos]\n end\n\n msg.join()\nend", "def encrypt(encrypt_input)\r\n index_encrypt = 0\r\n encrypt_output = \"\"\r\n\r\n while index_encrypt < encrypt_input.length\r\n if encrypt_input[index_encrypt] == \"z\"\r\n encrypt_output[index_encrypt] = \"a\"\r\n elsif encrypt_input[index_encrypt] == \" \"\r\n encrypt_output[index_encrypt] = \" \"\r\n else\r\n encrypt_output[index_encrypt] = encrypt_input[index_encrypt].next\r\n end\r\n index_encrypt += 1\r\n end \r\n return encrypt_output\r\nend", "def encrypt(content, offset)\n # Decrypting and crypting contains more or less the exact same code.\n # The difference between those two methods is that decrypting by default takes a positive offset\n # as negative in its calculations. That is why we, when calling the decrypting method, turn our offset\n # around. With that being said, we go from + to - or - to + before executing our method call.\n # As our encrypting method is supposed to return the encrypted content uppercase, \n # and decrypt returns the decrypted content lowercase, we call string's member method upcase.\n\n return decrypt(content, offset * -1).upcase\nend", "def encrypt(password)\r\n\tindex = 0\r\n\twhile index < password.length\r\n\t\tif password[index] == \"z\"\r\n\t\t\tpassword[index] = \"a\"\r\n\t\telse\r\n\t\t\tpassword[index] = password[index].next!\r\n\t\tend\r\n\tindex += 1\r\n\tend\r\n#return password\r\nend", "def encrypt(password)\n i = 0\n while i < password.length\n if password[i] == \"z\"\n password[i] = \"a\"\n elsif password[i] == \" \"\n password[i] = \" \"\n else\n password[i] = password[i].next!\n end\n i += 1\n end\n password\nend", "def encrypt (str)\n\tindex = 0\n\twhile index < str.length\n \tp str[index].next\n \tindex += 1\n\tend\nend", "def caesar_guesser(encrypted_string, alphabet)\nend", "def encrypt(string)\n secure_hash(\"#{salt}--#{string}\")\n end", "def encrypt(string, times = 65536)\n # You can change times to how much you like. but pay attention please!\n # Larger numbers will take more time to encrypt.\n # For example, if you use a large number such as 2^32, it'll be about\n # 5 billion times! It will take a very long time (maybe hours and days)\n # and damage your CPU.\n n = 0\n code = string\n while n < times\n code = Digest::SHA2.hexdigest(code)\n # You also can use MD5 or SHA1 algorithms. for more information,\n # check my project https://github.com/prp-e/rsha256 .\n n += 1\n end\n return code\n # Here, you can reverse the coded string, to make it more 'coded', or\n # You can code it in a different algorithm, too.\nend", "def encrypt(str)\n str.tr!('a-z', 'b-za')\nend", "def vigenere_cipher(str, arr)\n alpha = (\"a\"..\"z\").to_a\n new_str = \"\"\n str.each_char.with_index do |char, i|\n pos = alpha.index(char)\n key = arr[i % arr.length]\n new_pos = (pos + key) % alpha.length\n new_str += alpha[new_pos]\n end\n new_str\nend", "def encrypt(str)\n len = str.length\n counter = 0\n message = \"\"\n while counter < len\n if str[counter] == \"z\"\n note = \"a\"\n else\n note = str[counter].next\n end\n message << note\n counter += 1\n end\n p message\nend", "def encrypt(str)\n index = 0\nwhile index < str.length\nprint str[index].next.sub(\"!\", \" \") #Learned that p did not work as well as print. Aslo used sub method to take out the space.\nindex += 1\nend\nend", "def encrypt(password)\n index = 0\n while index < password.length\n if password[index] == \"z\"\n password[index] = password[index].next.chop\n else\n password[index] = password[index].next\n end\n index += 1\n end\n password\nend", "def encrypt (s,n)\n result = nil\n if n <= 0\n result = s\n end\n n.times do\n i = 0\n odds = []\n evens = []\n result ||= s\n result.chars.each do\n odds.push(result[i+1])\n evens.push(result[i])\n i += 2\n end\n result = odds.join + evens.join\n end\n return result\nend", "def folding_cipher(str)\n\nend", "def folding_cipher(str)\nend", "def encrypt(str)\n index = 0\n while index < str.length\n str[index] = if str[index].include? 'z'\n 'a'\n else\n str[index].next\n end\n index += 1\n end\n str\nend", "def vigenereCipher(string, key, alphabet)\n aryStr = string.split(\"\")\n nStr = Array.new\n i = 0\n while i < aryStr.length\n j = 0\n while j < key.length\n nStr << (alphabet[(alphabet.index(aryStr[i]) + key[j])])\n j += 1\n i += 1\n end\n end\n return nStr.join('')\nend", "def encrypt(str)\r\n\tn=0\r\n\tuntil n == str.length\r\n\t\tif str[n] == \" \" \r\n\t\t\tstr[n] = \" \" \r\n\t\telsif str[n] == \"z\"\r\n\t\t\tstr[n] = \"a\"\r\n\t\telse\r\n\t\t\tstr[n] = str[n].next\r\n\t\tend\t\r\n\tn+=1\r\n\tend\r\np str\r\nend", "def decrypt; end", "def encrypt(code)\r\n #declare empty string to add to\r\n encrypted_code=\"\"\r\n i = 0\r\n #loop the letters\r\n while i < code.length\r\n #z is an edge case make a special conditon for that\r\n if code[i] == \"z\"\r\n encrypted_code = encrypted_code + \"a\"\r\n \r\n # all the letters change to subsequent letters and add to encrypted code\r\n else\r\n encrypted_code = encrypted_code + code[i].next\r\n \r\n end\r\n i+=1\r\n end\r\n \r\n return encrypted_code\r\nend", "def vigenere_cipher(message, keys)\n alphabet = (\"a\"..\"z\").to_a\n new_msg = \"\"\n\n message.each_char.with_index do |char|\n old_pos = alphabet.index(char)\n new_pos = old_pos + keys[idx % keys.length]\n new_msg += alphabet[new_pos % alphabet.length]\n end\n\n new_msg\nend", "def folding_cipher(string)\n\nend", "def encrypt(str)\n\ti = 0\n\twhile i < str.length\n\t\tif str[i] == \"z\"\n\t\t\tstr[i] = \"a\"\n\t\telse\n\t\t\tstr[i] = str[i].next!\n\t\tend\n\t\ti += 1\n\tend\n\treturn str\nend", "def vigenere_cipher(message, keys)\n alphabet = \"abcdefghijklmnopqrstuvwxyz\"\n vigenere = \"\"\n\n message.each_char.with_index do |char, i|\n index = alphabet.index(char)\n key = keys[i % keys.length].to_i\n new_char = alphabet[(index + key) % 26] \n vigenere += new_char\n end\n\n vigenere\nend", "def vigenere_cipher(message, keys)\n key_idx = 0\n new_message = \"\"\n message.each_char do |char|\n new_message += cipher(char, keys[key_idx])\n key_idx = (key_idx + 1) % keys.length\n end\n\n new_message\nend", "def encrypt(input)\n abc = \"abcdefghijklmnopqrstuvwxyz\"\n # 3. iterate through the string\n\tx = 0\n\twhile x < input.length\n whereabc = abc.index(input[x])\n # 4. change each character to the next character in the alphabet.\n \tif whereabc == 25\n \t\twhereabc = -1\n \tend #if\n\t\tinput[x] = abc[whereabc + 1]\n\t\tx += 1\n\tend #while\n input\nend", "def encrypt(string)\r\n\r\n\t\tlength = string.length - 1 \r\n\r\n\t\tuntil length == -1\r\n\t\t\tif \r\n\t\t\t\tstring[length] == \"z\"\r\n\t\t\tthen\r\n\t\t\t\tstring[length] = \"a\"\r\n\t\t\telse\r\n\t\t\t\tstring[length] = string[length].next\r\n\t\t\tend\r\n\t\t\tlength = length -1\t\r\n\t\tend\r\n\t\tstring\r\nend", "def vigenere_cipher(message, keys)\n alpha = (\"a\"..\"z\").to_a\n count = 0\n message.each_char.with_index do |char, idx|\n pos = alpha.index(char)\n #rather than count we can do key alpha[(pos + key[idx % key.length] )% 26]\n message[idx] = alpha[(pos + keys[count]) % alpha.length]\n count += 1\n count = 0 if count == keys.length\n end\n message\nend", "def encrypt(string_to_encrypt) # Create a function accepting string variable as parameter\n\tcontrol = 0\t# Set control variable to 0 \n\twhile control < string_to_encrypt.length # check if the control variable is less than length of the passed string. If yes run the code in the while loop\n\t\tif string_to_encrypt[control] == \"z\" # Because .next that doesn't work well with beginning and ending letters of alphabet check if the current letter is \"z\" and if so change it to \"a\" manually\n\t\t\tstring_to_encrypt[control] = \"a\"\n\t\telsif string_to_encrypt[control] == \" \" # If the character is a space, we want to keep it as a space\n\t\t\tstring_to_encrypt[control] = \" \"\n\t\telse\n\t\t\tstring_to_encrypt[control] = string_to_encrypt[control].next # Retrieve letter from the string that is indexed by control variable, apply .next method to it and reasign to the same place in the string\n\t\tend\n\t\tcontrol = control + 1 # Upate control variable to move to the next letter\n\tend\n\treturn_string = string_to_encrypt\n\treturn return_string\nend", "def encrypt(string)\nindex = 0\n while index < string.length\n if string[index] == \"z\"\n \t\tstring[index] = \"a\"\n \telse\n string[index] = string[index].next!\n end\n index += 1\n end\np string \nend", "def encrypt(password)\n\n\tindex = 0\n\n\twhile index < password.length\n\t\tif password[index] == \"z\"\n\t\t\tpassword[index] = \"a\"\n\t\telse\n\t\t\tpassword[index] = password[index].next\n\t\tend\n\n\t\tindex += 1\n\tend\n\treturn password \nend", "def encrypt(str)\n\tcount = 0\n\talphabet = \"abcdefghijklmnopqrstuvwxyz\"\n\tif str[count] == alphabet[0]\n\t\tuntil count == str.length\n\t\tstr[count] = str[count].next\n\t\tcount +=1\n\t\tend\n\t\t\n\tputs str\n\telsif str[count] == alphabet[25]\n\t\tstr[count] = alphabet[0]\n\t\tcount+=1\n\t\tuntil count == str.length\n\t\tstr[count] = str[count].next\n\t\tcount+=1\n\t\tend\n\t\t\n\telse\n\t until count == str.length\n\t\tstr[count] = str[count].next\n\t\tcount +=1\n\t\tend\n\t\t\n\t\t\n str\n\n\tend\n\t\t\nend", "def encrypt(string)\n Digest::SHA1.hexdigest(string)\n end", "def encrypt(string)\n Digest::SHA1.hexdigest(string)\n end", "def encrypt(input)\n\tpasswordlength = input.length\n\tfor i in 0...passwordlength\n\t if input[i] == 'z'\n\t input[i] = 'a'\n\t else\n\t\tinput[i] = input[i].next\n\t\tend\n\tend\n\treturn input\nend", "def encrypt(string)\ncounter = 0 \n while counter < string.length \n string_enc = string[counter].next\n \tif string_enc == \"aa\" \n \t\tstring_enc = \"a\"\n \tend\n print string_enc\n counter += 1 \n end \nend", "def encrypt(string, password = DEFAULT_ENCRYPT_PASS)\n return '' if string == ''\n hex_encode(aes256_encrypt(string, Digest::SHA256.hexdigest(password)))\nend", "def encrypt_letters(letters)\n encrypted_letters = rotated_letters.ord\n end" ]
[ "0.7934466", "0.7506167", "0.74988496", "0.74558085", "0.73458767", "0.7317432", "0.73171896", "0.7242086", "0.72366744", "0.721721", "0.72169286", "0.7203565", "0.7125579", "0.7070596", "0.7029967", "0.70246613", "0.7009031", "0.7000419", "0.69559276", "0.6952344", "0.694667", "0.6933675", "0.6929519", "0.6926693", "0.69263536", "0.6914257", "0.69033587", "0.68976665", "0.6887666", "0.68829143", "0.6867196", "0.6860365", "0.6843264", "0.68431216", "0.6838361", "0.6833859", "0.6818123", "0.6815661", "0.68105423", "0.6807864", "0.68024164", "0.6801542", "0.67826825", "0.677816", "0.6776679", "0.6775704", "0.6771536", "0.67713284", "0.67667747", "0.6765662", "0.676322", "0.6757915", "0.6750329", "0.6744679", "0.67412", "0.6737597", "0.67242527", "0.671888", "0.67156893", "0.67065376", "0.6705212", "0.6701298", "0.66798055", "0.6674823", "0.6670161", "0.6668389", "0.66591567", "0.66579795", "0.6651841", "0.6639813", "0.6636026", "0.6629449", "0.6629346", "0.66277057", "0.6622136", "0.6617884", "0.6617861", "0.66155905", "0.6610082", "0.66057926", "0.66038454", "0.6603492", "0.65966934", "0.6593384", "0.65898585", "0.658493", "0.65843475", "0.6578371", "0.6574263", "0.65706766", "0.65701437", "0.6565881", "0.656359", "0.656046", "0.655773", "0.65548664", "0.65548664", "0.6551368", "0.65499055", "0.6548265", "0.65445244" ]
0.0
-1
Specifies if self can be watched.
def is_watchable? true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def watching?\n @watcher && @watcher.alive? ? true : false\n end", "def watch?\n false\n end", "def can_watch?(song)\n song.open? ||\n song.closed? && authenticated? ||\n authenticated? && @current_user.played?(song)\n end", "def poll_writable?\n true\n end", "def can_control?\n player_iface['CanControl']\n end", "def poll_writable?\n false\n end", "def can_accept?\n !self.new_record? && self.active? && !!self.kase && self.kase.active?\n end", "def can_change_tom?\n self.active? or self.provisional?\n end", "def allowed?\n true\n end", "def can_write?\n can?('w')\n end", "def allowed?\n true\n end", "def allowed?\n true\n end", "def allowed?\n allowed\n end", "def restrictible?\n config.restrictable.equal?(true)\n end", "def writable?\n (options.events & Poller::ZMQ::POLLOUT).positive?\n end", "def listen?\n\t\t!Rails.env.development? and do_listen && can_listen?\n\tend", "def allowed?\n stream.config.allowed?(validate_to || stream.domain, stream.user.jid)\n end", "def publishable?\n self.status == STATUS_PENDING\n end", "def allowed?; true end", "def allowable\n return @allowable if @allowable\n\n @allowable = parent_allowables\n end", "def can_watch_episode?( episode, t = Time.now.utc )\n\t\tepisode.available?( t )\n\tend", "def writable?\n (getsockopt(::XS::EVENTS) & ::XS::POLLOUT) == ::XS::POLLOUT\n end", "def enabled?; end", "def enabled?; end", "def viewable?\n !!status[:viewable]\n end", "def allow_member?\n true\n end", "def watching?; @@watching == $$; end", "def can_publish?\n\t\ttrue\n\tend", "def listen?\n @paused == false && @stopping == false\n end", "def can_be_blacklisted?\n !self.blacklisted?\n end", "def listen?\n @paused == false\n end", "def keep_watching?\n true\n end", "def can_start?\n true\n end", "def can_share=(value)\n @can_share = value\n end", "def writeable?\n true\n end", "def watches?(task_list)\n watched_task_lists.include?(task_list)\n end", "def allowed?\n raise NotImplementedError, 'please implement #allowed? '\\\n \"for #{self.class.name} which should decide if the action is allowed, \"\\\n 'based on the given attributes'\n end", "def writable?() end", "def writeable?\n status_flag?(:kSecWritePermStatus)\n end", "def can_write=(value)\n set_privileges('d', value) unless value\n set_privileges('w', value)\n end", "def is_permission_controlled=(value)\n @is_permission_controlled = value\n end", "def can_open?\n\t\treturn true\n\tend", "def writeable?\n !readonly?\n end", "def controlable?\n respond_to?(:call)\n end", "def publishable?\n false\n end", "def watching=(name)\n gateway_check\n update_status(@status, name, nil, nil, nil, 3)\n end", "def smart?; self.permission_level = 2; end", "def settable?()\n @definition.writeable?\n end", "def can_read=(value)\n if value\n set_privileges('r', value)\n else\n self.privileges = nil\n end\n end", "def IsSubscribed=(arg0)", "def IsSubscribed=(arg0)", "def playable?\n false\n end", "def can_modify_subject_status?\n has_role?(:public_health) || has_role?(:public_health_enroller)\n end", "def manage?\n super || (@user && @user.is_curator?)\n end", "def writable?\n dev = self.device\n return false if dev.nil?\n return dev.writable?\n end", "def playable?\n video_source\n end", "def working?\n raise NotImplementedError.new(\"working() must be implemented by subclasses of AbstractChangeset.\")\n end", "def list_owner_cannot_watch\n if self.list.user == self.user\n errors.add(:base, \"List owner cannot add it to watchlist\")\n end\n end", "def everyone_can_contribute?\n return false if private?\n self.who_can_upload == WHO_EVERYONE\n end", "def allow_notification?\n true\n end", "def can_edit=(value)\n @can_edit = value\n end", "def poll_readable?\n false\n end", "def volunteering_allowed?\n # As of today, cannot volunteer if project is in 'parking lot'\n if self.event.nil? then\n return false\n else\n return self.event.volunteering_enabled?\n end\n end", "def can?(ability, new_subject = :_self)\n return allowed?(ability) if new_subject == :_self\n\n policy_for(new_subject).allowed?(ability)\n end", "def permitted_for_research_object?(item = self)\n if item.is_downloadable?\n item.can_download?(nil)\n else\n item.can_view?(nil)\n end\n end", "def allowed?(*_)\n true\n end", "def writable?\n !(@settings[:user].nil?)\n end", "def can_set?(user, event)\n return false unless @events.key? event\n user.power_in(@room) >= @events[event]\n end", "def writable?\n self['WritableVolume']\n end", "def allowed?() raise NotImplementedError end", "def do_i_watch?(title)\n return false unless @logged_in\n page_info_contains_key(title, 'watched', 'watched')\n end", "def watched_file?(filename)\n false\n end", "def can?\n current_user\n end", "def updatable\n can_update?\n end", "def allows_response?(responder=nil)\n self.active? && self.open?\n end", "def collins_check_can_be_altered?\n collins_osc_state['current_state'] == \"can_be_altered\"\n end", "def writable?\n (events & ZMQ::POLLOUT) == ZMQ::POLLOUT\n end", "def access_locked?\n\n super && date_restricted?\n\n end", "def listening?\n true\n end", "def new_player_allowed?; false end", "def enabled!\n self\n end", "def set_yet?\n !!@resource_lock.synchronize { defined? @resource }\n end", "def viable?\n\t\t\t\t\t\t@ready && @stream&.connected?\n\t\t\t\t\tend", "def poll_readable?\n true\n end", "def is_usable=(value)\n @is_usable = value\n end", "def can?()\n d = server[:deployer]\n \n if d.has_key?(:from) and d.has_key?(:to)\n return true\n else\n return false\n end\n end", "def can_read?\n can?('r')\n end", "def inherit_restricted_status\n self.restricted = parent.restricted?\n end", "def enable_listener?\n true\n end", "def is_removable=(value)\n @is_removable = value\n end", "def set_up_readers can_walk\n\t\t@walk = can_walk\n\tend", "def is_permission_controlled\n return @is_permission_controlled\n end", "def shared_access_allowed\n @settings.get_value(\"Shared Access\") == \"true\"\n end", "def watch()\n merge(watch: 'true')\n end", "def watch()\n merge(watch: 'true')\n end", "def can_change_read_property?(doc = nil)\r\n self.can_edit_document?(doc)\r\n end", "def can_be_replied_to?\n !locked?\n end", "def allowed?(key)\n @status[key] == :allowed\n end", "def filterable?; @filterable; end", "def watching?(hash)\n if hash[:post]\n hash[:post].watches.where(watcher: self).exists?\n elsif hash[:tag]\n fail 'Not Implemented.'\n elsif hash[:user]\n fail 'Not Implemented.'\n else\n fail 'No hash argument set.'\n end\n end" ]
[ "0.64068794", "0.63668895", "0.6277696", "0.6012779", "0.599301", "0.5961691", "0.5937113", "0.5933498", "0.5861864", "0.5847888", "0.5809642", "0.5809642", "0.5782405", "0.5770361", "0.57503444", "0.57259876", "0.5719201", "0.5683221", "0.5676588", "0.56623", "0.56614196", "0.5643171", "0.56217", "0.56217", "0.5591829", "0.55749524", "0.5541069", "0.5535796", "0.55303645", "0.5523932", "0.55180174", "0.5507737", "0.5505695", "0.5502026", "0.5496304", "0.5478559", "0.5473689", "0.54731214", "0.5470566", "0.54653054", "0.5454454", "0.54462975", "0.5443295", "0.5434377", "0.54210955", "0.5414198", "0.54141337", "0.5410037", "0.5407407", "0.5406476", "0.5406476", "0.5394248", "0.5391816", "0.5382866", "0.5377746", "0.5371731", "0.536878", "0.5368402", "0.53663605", "0.53599304", "0.53518265", "0.5349871", "0.53412086", "0.53372705", "0.5328577", "0.53226316", "0.5319526", "0.53188276", "0.5314956", "0.53060097", "0.53059065", "0.5302388", "0.52991897", "0.529672", "0.52958953", "0.5295769", "0.5294893", "0.52925086", "0.529015", "0.5286753", "0.5280979", "0.5279046", "0.52714336", "0.5271312", "0.52605253", "0.52572685", "0.52532274", "0.52505374", "0.52480215", "0.5238682", "0.52370435", "0.523486", "0.523438", "0.52340335", "0.52340335", "0.52340263", "0.5232335", "0.52313757", "0.5225816", "0.52237403" ]
0.76025665
0
Devuelve el evento cuyo id fue recibido.
def show event = Event.find params[ :id ] expose event, serializer: EventSerializer end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def id\n self.event['id'].to_i\n end", "def set_servico_evento\n @servico_evento = Servico::Evento.find(params[:id])\n end", "def set_event(id)\n @event = Event.find(id)\n end", "def after_init(id)\n @event_id = id\n end", "def item id\n ljcall :getevents, :selecttype => \"one\",\n :lastsync => \"1970-01-01 00:00:00\",\n :itemid => id\n end", "def set_evento\n @evento = Evento.find(params[:id])\n end", "def set_evento\n @evento = Evento.find(params[:id])\n end", "def set_evento\n @evento = Evento.find(params[:id])\n end", "def set_evento\n @evento = Evento.find(params[:id])\n end", "def leer\n @eventos = params[:id]\n @eventos = Evento.where(id: @eventos)\n end", "def set_event\n @event = Event.where(id: params[:id])\n end", "def id\n raise NoMethodError.new(\"`Lynr::Events::Handler#id` must be defined in subclass\")\n end", "def set_event\n @event = Event.find(id: params[\"id\"])\n end", "def set_event\n id = /^([0-9]*)-/.match(params[:id])[0]\n @event = Event.find(id)\n end", "def set_event\n @event = Event.getDetails(params[:id]).first\n end", "def set_event\n @event = Event.find_by(id: params[:id])\n end", "def set_event\n @event = Spree::Event.find(params[:id])\n end", "def find_event_by_id(id)\n return nil unless id\n event_lookup(\"/#{id}\")\n end", "def set_event\n @event = Event.find(params[:id])\n end", "def set_listen_event\n @listen_event = @recording.listen_events.find(params[:id])\n end", "def find_event_by_id(id)\n return nil unless id && id.strip != ''\n event_lookup(\"/#{id}\")\n end", "def set_event\n @event = current_client.events.find(params[:id])\n end", "def adquirir(id)\n @client.post(Route.new([ROTA_DID_ESTOQUE, id.to_s]))\n end", "def set_event\n @event = ::Event.find(params[:id] || params[:event_id])\n end", "def set_event\n\t @event = Event.find(params[:id])\n\t end", "def set_event\n @event = Event.find_by_id(params[:id])\n end", "def event(id, options = {})\n get \"events/#{id}\", options\n end", "def find_event\n\t @event = Event.get(params[:id]) unless params[:id].nil?\n\tend", "def event(data)\n # Prepare the event object.\n id = @next_event_id\n @next_event_id += 1\n event = data.merge :id => id, :server_ts => Time.now.to_f\n @events << event\n\n # Broadcast the event to users.\n @users.each do |user|\n next unless user.session\n user.session.sync_events\n end\n end", "def set_event\n @event = Event.find(params[:id]) if(Event.find_by_id(params[:id]) != nil)\n end", "def get(id)\n Event.new(self, @connection.request(:show, {:id => id}))\n end", "def receive_id\n id = params[:id] # receive Id from\n @movie = Movie.find(id)\n end", "def set_event\n @event = Event.find(params[:id])\n end", "def set_event\n @event = Event.find(params[:id])\n end", "def set_event\n @event = Event.find(params[:id])\n end", "def get_event(id)\n @event_svc.get(id)\n end", "def set_event\n @event = Event.find(params[:id])\n end", "def set_event\n @event = Event.find(params[:id])\n end", "def set_event\n @event = Event.find(params[:id])\n end", "def set_event\n @event = Event.find(params[:id])\n end", "def set_event\n @event = Event.find(params[:id])\n end", "def set_event\n @event = Event.find(params[:id])\n end", "def set_event\n @event = Event.find(params[:id])\n end", "def set_event\n @event = Event.find(params[:id])\n end", "def set_event\n @event = Event.find(params[:id])\n end", "def set_event\n @event = Event.find(params[:id])\n end", "def set_event\n @event = Event.find(params[:id])\n end", "def set_event\n @event = Event.find(params[:id])\n end", "def set_event\n @event = Event.find(params[:id])\n end", "def set_event\n @event = Event.find(params[:id])\n end", "def set_event\n @event = Event.find(params[:id])\n end", "def set_event\n @event = Event.find(params[:id])\n end", "def set_event\n @event = Event.find(params[:id])\n end", "def set_event\n @event = Event.find(params[:id])\n end", "def set_event\n @event = Event.find(params[:id])\n end", "def set_event\n @event = Event.find(params[:id])\n end", "def set_event\n @event = Event.find(params[:id])\n end", "def set_event\n @event = Event.find(params[:id])\n end", "def set_event\n @event = Event.find(params[:id])\n end", "def set_event\n @event = Event.find(params[:id])\n end", "def set_event\n @event = Event.find(params[:id])\n end", "def set_event\n @event = Event.find(params[:id])\n end", "def set_event\n @event = Event.find(params[:id])\n end", "def set_event\n @event = Event.find(params[:id])\n end", "def set_event\n @event = Event.find(params[:id])\n end", "def set_event\n @event = Event.find(params[:id])\n end", "def set_event\n @event = Event.find(params[:id])\n end", "def set_event\n @event = Event.find(params[:id])\n end", "def set_event\n @event = Event.find(params[:id])\n end", "def set_event\n @event = Event.find(params[:id])\n end", "def set_event\n @event = Event.find(params[:id])\n end", "def set_event\n @event = Event.find(params[:id])\n end", "def set_event\n @event = Event.find(params[:id])\n end", "def set_event\n @event = Event.find(params[:id])\n end", "def set_event\n @event = Event.find(params[:id])\n end", "def set_event\n @event = Event.find(params[:id])\n end", "def set_event\n @event = Event.find(params[:id])\n end", "def set_event\n @event = Event.find(params[:id])\n end", "def set_event\n @event = Event.find(params[:id])\n end", "def set_event\n @event = Event.find(params[:id])\n end", "def set_event\n @event = Event.find(params[:id])\n end", "def set_event\n @event = Event.find(params[:id])\n end", "def set_event\n @event = Event.find(params[:id])\n end", "def set_event\n @event = Event.find(params[:id])\n end", "def set_event\n @event = Event.find(params[:id])\n end", "def set_event\n @event = Event.find(params[:id])\n end", "def set_event\n @event = Event.find(params[:id])\n end", "def set_event\n @event = Event.find(params[:id])\n end", "def set_event\n @event = Event.find(params[:id])\n end", "def set_event\n @event = Event.find(params[:id])\n end", "def set_event\n @event = Event.find(params[:id])\n end", "def set_event\n @event = Event.find(params[:id])\n end", "def set_event\n @event = Event.find(params[:id])\n end", "def set_event\n @event = Event.find(params[:id])\n end", "def set_event\n @event = Event.find(params[:id])\n end", "def set_event\n @event = Event.find(params[:id])\n end", "def set_event\n @event = Event.find(params[:id])\n end", "def set_event\n @event = Event.find(params[:id])\n end", "def set_event\n @event = Event.find(params[:id])\n end", "def set_event\n @event = Event.find(params[:id])\n end", "def set_event\n @event = Event.find(params[:id])\n end" ]
[ "0.6421807", "0.6287632", "0.62391174", "0.6127028", "0.6097526", "0.60773134", "0.60773134", "0.60773134", "0.60773134", "0.6055085", "0.6017853", "0.59592", "0.5864523", "0.5812277", "0.58103204", "0.56893814", "0.5681095", "0.5675228", "0.56630075", "0.56625384", "0.56535184", "0.5641265", "0.56359386", "0.5634791", "0.561744", "0.5608966", "0.5608468", "0.5604639", "0.5604425", "0.5593319", "0.5585894", "0.55858034", "0.55726737", "0.55726737", "0.55726737", "0.555856", "0.5542346", "0.5541731", "0.5541731", "0.5541731", "0.5541731", "0.5541731", "0.5541731", "0.5541731", "0.5541731", "0.5541731", "0.5541731", "0.5541731", "0.5541731", "0.5541731", "0.5541731", "0.5541731", "0.5541731", "0.5541731", "0.5541731", "0.5541731", "0.5541731", "0.5541731", "0.5541731", "0.5541731", "0.5541731", "0.5541731", "0.5541731", "0.5541731", "0.5541731", "0.5541731", "0.5541731", "0.5541731", "0.5541731", "0.5541731", "0.5541731", "0.5541731", "0.5541731", "0.5541731", "0.5541731", "0.5541731", "0.5541731", "0.5541731", "0.5541731", "0.5541731", "0.5541731", "0.5541731", "0.5541731", "0.5541731", "0.5541731", "0.5541731", "0.5541731", "0.5541731", "0.5541731", "0.5541731", "0.5541731", "0.5541731", "0.5541731", "0.5541731", "0.5541731", "0.5541731", "0.5541731", "0.5541731", "0.5541731", "0.5541731", "0.5541731" ]
0.0
-1