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
About scenario execution Because some condition holds...
def because(msg="Unknown cause", &block) raise ArgumentError, "WSpec because/therefore expects a block" unless block __stack.push(msg) yield(browser) __stack.pop end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def condition; end", "def run_cond; end", "def win_condition\nend", "def hit_condition()\n #This is a stub, used for indexing\n end", "def result_of_checking; end", "def cond; end", "def cond; end", "def cond; end", "def check\n \n end", "def check\n \n end", "def conditionally(*) end", "def conditionally(*) end", "def child_condition; end", "def check ; true ; end", "def step_result; end", "def running_test_case; end", "def covered?; end", "def actual_flow_control\n super\n end", "def postConditionalNextOPlanStage\n # find two random agents. They should be allowed to communicate\n # if they are not in the attack node\n agent1 = nil\n agent2 = nil\n @run.society.each_agent { |agent|\n if (agent.node.get_facet(\"attacker\") == nil)\n if (agent1 == nil) \n agent1 = agent\n else\n if (agent1.node != agent.node) \n agent2 = agent\n break\n end\n end\n end\n }\n\n testMessageSuccess(agent1.name, agent2.name, \n 'Stress3a101', \"Send message successfully\")\n end", "def checks; end", "def test_execute_threshold(value = 1)\n if value == @threshold\n then return true\n end\n return false\n end", "def guard; end", "def passed?; end", "def passed?; end", "def passed?; end", "def trigger_condition_met?(_job)\n true\n end", "def success?() end", "def semact?; false; end", "def if_condition; end", "def proceed!; end", "def proceed!; end", "def complex_condition?(condition); end", "def condition(x)\r\n if x\r\n puts \"condition executed\"\r\n end\r\nend", "def run(_value)\n false\n end", "def check_ending(_result)\n end", "def is_decision\n return (@index == 89)\n end", "def condition\n expect :if\n self[1]\n end", "def scope_condition() {} end", "def run_examination\n true\n end", "def performed?; end", "def performed?; end", "def running_test_step; end", "def check_execute\n unless executed?\n execute\n end\n end", "def execute_all &decision\n @result = nil\n @exception = nil\n\n @test_lines.each do |line|\n break if execute_line line, &decision\n end\n unless @exception\n #puts \"=> \" + @result.inspect\n end\n end", "def conditions; end", "def conditions; end", "def truth\n\t\t\t\"You can't handle the truth\" ; true\n\t\tend", "def run_succeeded; end", "def evaluate_next_step_on_change?\n false\n end", "def passes; end", "def passes; end", "def check_starting(_lang_result)\n end", "def test\n\t\t@a+@b > @c && @a+@c > @b && @b+@c > @a\n\tend", "def invisible_testSuccess(c, ci, cv, state)\n @state[COMMITMENT].any? {|terms| terms.size == 4 and terms[0] == c and terms[1] == ci}\nend", "def step_taken\n\t\t@step = !@step\n\tend", "def passed?\n !failed?\n end", "def integrity_check\n start_values = condition.start_values\n generations.each do |g|\n # FIXME -- use the registered fitness function\n if IterativeLearning::FunctionLearning.sum_of_error(g.start_values, start_values) != 0\n return false\n end\n start_values = g.best_task_response\n end\n return true\n end", "def step\n any_independent = false\n net.edges.each do |e|\n a, b = e.source, e.target\n intersect = (@net.adjacent_either(a, b) & @net.verts_on_paths(a, b)).extend(PowerSet)\n \n # Is |Aab ^ Uab| > n? \n if intersect.length <= n\n next\n else\n # Are a and b independent conditioned on any subsets of Aab ^ Uab of cardinality n+1?\n valid_intersects = intersect.power_set.select {|s| s.length == n+1}.reject { |subset| subset.include?(a) || subset.include?(b) }\n if valid_intersects.any? { |subset|\n print \"Testing independence between #{a.name} and #{b.name}, conditioning on #{(subset.any? ? subset.map(&:name).join(', ') : 'nothing') + '...'}\"\n print (coindependent?(p_value, a, b, *subset) ? \"[+]\\n\" : \"[-]\\n\")\n coindependent?(p_value, a, b, *subset)\n }\n @net = remove_edge(net, e)\n net.edges.each do |e|\n puts \"#{e.source.name} => #{e.target.name}\"\n end\n any_independent = true\n end\n end\n end\n @n += 1\n any_independent\n end", "def condition(&block)\n self.processes << Proc.new do |scenario, args|\n res = catch(:rootage_process_failure) do\n get_process_context_class(scenario).new(scenario).instance_exec(*args, &block)\n true\n end\n throw :rootage_item_stop unless res\n end\n end", "def skipped?; end", "def skipped?; end", "def skipped?; end", "def skipped?; end", "def true_activity(args)\n puts \"#{__method__}>> fired\"\n puts \"#{__method__}>> allotted runtime #{TASK_TIMEOUT}\"\n puts \"#{__method__}>> args: #{args.inspect}\"\n true\n end", "def ok_failed(condition)\n if condition\n puts \"OK\"\n else\n puts \"FAILED\"\n end\nend", "def final_decision?\n final_decision\n end", "def skip_condition_met?\n points = encounter_points_needed\n return false if $game_party.encounter_points < points\n condition = troop.skip_condition\n return false unless condition\n params = condition.parameters\n result = false\n case params[0]\n when 0 # Switch\n result = ($game_switches[params[1]] == (params[2] == 0))\n when 1 # Variable\n value1 = $game_variables[params[1]]\n if params[2] == 0\n value2 = params[3]\n else\n value2 = $game_variables[params[3]]\n end\n case params[4]\n when 0 # value1 is equal to value2\n result = (value1 == value2)\n when 1 # value1 is greater than or equal to value2\n result = (value1 >= value2)\n when 2 # value1 is less than or equal to value2\n result = (value1 <= value2)\n when 3 # value1 is greater than value2\n result = (value1 > value2)\n when 4 # value1 is less than value2\n result = (value1 < value2)\n when 5 # value1 is not equal to value2\n result = (value1 != value2)\n end\n #when 2 # Self switch\n #if @event_id > 0\n #key = [$game_map.map_id, @event_id, params[1]]\n #result = ($game_self_switches[key] == (params[2] == 0))\n #end\n when 3 # Timer\n if $game_timer.working?\n if params[2] == 0\n result = ($game_timer.sec >= params[1])\n else\n result = ($game_timer.sec <= params[1])\n end\n end\n when 4 # Actor\n actor = $game_actors[params[1]]\n if actor\n case params[2]\n when 0 # in party\n result = ($game_party.members.include?(actor))\n when 1 # name\n result = (actor.name == params[3])\n when 2 # Class\n result = (actor.class_id == params[3])\n when 3 # Skills\n result = (actor.skill_learn?($data_skills[params[3]]))\n when 4 # Weapons\n result = (actor.weapons.include?($data_weapons[params[3]]))\n when 5 # Armors\n result = (actor.armors.include?($data_armors[params[3]]))\n when 6 # States\n result = (actor.state?(params[3]))\n end\n end\n when 5 # Enemy\n enemy = $game_troop.members[params[1]]\n if enemy\n case params[2]\n when 0 # appear\n result = (enemy.alive?)\n when 1 # state\n result = (enemy.state?(params[3]))\n end\n end\n #when 6 # Character\n #character = get_character(params[1])\n #if character\n #result = (character.direction == params[2])\n #end\n when 7 # Gold\n case params[2]\n when 0 # Greater than or equal to\n result = ($game_party.gold >= params[1])\n when 1 # Less than or equal to\n result = ($game_party.gold <= params[1])\n when 2 # Less than\n result = ($game_party.gold < params[1])\n end\n when 8 # Item\n result = $game_party.has_item?($data_items[params[1]])\n when 9 # Weapon\n result = $game_party.has_item?($data_weapons[params[1]], params[2])\n when 10 # Armor\n result = $game_party.has_item?($data_armors[params[1]], params[2])\n when 11 # Button\n result = Input.press?(params[1])\n when 12 # Script\n result = eval(params[1])\n when 13 # Vehicle\n result = ($game_player.vehicle == $game_map.vehicles[params[1]])\n end\n return result\n end", "def test_that_foreign_robot_needing_repairs_sent_to_station_1\n skip\n # arrange\n # happened in setup\n # act\n actual_value = @robot.needs_repairs && @robot.foreign_model\n # assert\n expected_value = true\n assert_equal(actual_value, expected_value)\n end", "def continue?; end", "def assert cond\n fail! unless cond\n end", "def internship_passed; end", "def has_run?\n @passed != nil\n end", "def ok_failed(condition)\n if (condition)\n puts \"OK\"\n else\n puts \"FAILED\"\n end\nend", "def failed?; failed_to_start? || (@success == false) end", "def test_cases; end", "def passed_test?(event)\n event['event'] == 'test' && event['status'] == 'pass'\n end", "def attack?\n if rand(@danger_level) > 3\n report_action 'attacking!'\n sleep 7\n return true\n else \n report_action 'not attacking....'\n sleep 1\n return false\n end\n end", "def check!\n true\n end", "def scenario_can_send\n while @step\n case @step.first\n when :proc\n @step.last.call\n when :send\n send_data @step.last\n else\n break\n end\n next_step\n end\n\n unless @step\n # EM might stifle this exception and reraise\n msg = \"Scenario completed prematurely\"\n $stderr.puts msg\n fail msg\n end\n\n case @step.first\n when :receive\n # wait to receive\n return\n when :unbind\n # wait for unbind\n return\n when :close\n @ignore_unbind = true\n close_connection_after_writing\n next_step\n end\n end", "def stand\r\n return true\r\n end", "def business_decision_support \n end", "def comp_noncomp_past_step_1?\n !spectator? && status_is_active?(\"base_details\")\n end", "def run\n raise \"Not implemented for this check.\"\n end", "def enter_pending; end", "def processing_instruction?; end", "def processing_instruction?; end", "def succeeded?; state == 'succeeded'; end", "def succeeded?; state == 'succeeded'; end", "def step\n log_iteration_start\n\n\n @current_task = tasks_list.shift\n status.no_tasks! and return unless current_task #empty tasks list\n\n solve_current_task\n\n return unless current_basis_plan # no optimal plan, so we don't change record and continue\n\n if current_target_function <= record # not interested as previsous record is higher\n status.target_less_than_record!\n elsif task.satisfies_integer?(current_basis_plan)\n change_record\n else\n split_current_task\n end\n log_status\n end", "def precondition(_op)\n # gain access to operation instance methods \n op = Operation.find(_op.id)\n \n # get params\n response_request = op.input(\"Response Request Message\").val\n response_regex = op.input(\"Response Regex Format\").val\n response_tag = op.input(\"Response Tag\").val\n response_status_tag = \"Response Block status\"\n response_level = op.input(\"Response Level\").val\n \n case response_level\n when \"Plan\"\n obj = _op.plan\n response_tag += \" [#{_op.id}]\"\n response_status_tag += \" [#{_op.id}]\"\n when \"Operation\"\n obj = _op\n when \"Item\"\n obj = _op.input(\"Sample\").item\n end\n \n # library method from ControlBlock (Could this interface be improved?)\n user_response = get_user_response(op, response_request_message: response_request, response_regex: response_regex)\n \n # if the user hasn't responded yet, fail and keep downstream operations in waiting\n return false if user_response.nil?\n \n # Response recieved!\n \n # associate response to the item being passed through\n obj.associate(response_tag, user_response)\n \n # associate note on operation to indicate that you cant retroactively change response\n op.associate \"Response Block status\", \"Your response was successfully recorded as \\\"#{user_response}\\\"\"\n \n # pass input, allowing downstream operations to begin\n op.pass(\"Sample\", \"Sample\")\n\n # set status to done, so this block will not be evaluated again\n op.status = \"done\"\n op.save\n \n return true\nend", "def test02_FlagEventComment_TC_24319\n\t\tcommentEventPop\n\t\tsleep 4\n\t\tcommentPopSubmit\n\t\tsleep 4\n\t\tcommentFlag\n\t\t\n\t\tbegin \n\t\tassert $comment_flag_success.exists?\n\t\t\trescue => e\n\t\t\tputs \"IPS05T02: FAILED! User unable to flag comment!\"\n\t\t\tputs e\n\t\tend\n\tend", "def executed?\r\n @executed\r\n end", "def skipped; end", "def waiting; end", "def waiting; end", "def test_start_stop\n start_time_for={}\n stop_time=nil\n at=Activity_tracker.new do |id|\n assert((Time.now-start_time_for[id]-at.timeout).to_f.abs<at.tick_time)\n end\n if at.tresholds<3\n puts \"Warning: this test supposed to run successfully\"+\n \"only wich tresholds>3\"\n end\n 4.times do\n start_time_for[1]=Time.now \n at.active 1\n sleep at.timeout.to_f/2\n start_time_for[2]=Time.now \n at.active 2\n sleep at.timeout.to_f/2\n start_time_for[2]=Time.now \n at.active 2\n end\n end", "def test_not_run?(test_case)\n test_case[:exec_status] == 'n'\n end", "def is_offensive?\n self.status == 1\n end", "def pass; end", "def pass; end", "def scenario_check(flag_param, lang_choice)\n if flag_param == 0\n if lang_choice == 1\n puts 'No such scenarios found'\n else\n puts \"Aucun scénario de ce type n'a été trouvé\"\n end\n return 0\n elsif flag_param == 1\n if lang_choice == 1\n puts 'The desired output is saved in output_file.txt'\n else\n puts 'La sortie souhaitée est enregistrée dans output_file.txt'\n end\n return 0\n else\n return -1\n end\n end" ]
[ "0.7026186", "0.6742123", "0.6522219", "0.6463206", "0.6375171", "0.6368828", "0.6368828", "0.6368828", "0.6218896", "0.6218896", "0.6186503", "0.6186503", "0.61676884", "0.60708827", "0.59520215", "0.5943198", "0.59377944", "0.5933726", "0.5931793", "0.59282166", "0.5926182", "0.5904169", "0.5902555", "0.5902555", "0.5902555", "0.5900418", "0.5893912", "0.58926845", "0.5873759", "0.58668315", "0.58668315", "0.5864729", "0.5860642", "0.5854268", "0.5853928", "0.58325076", "0.5830062", "0.5829812", "0.5796118", "0.57890236", "0.57890236", "0.5771066", "0.5755873", "0.57532996", "0.57407", "0.57407", "0.5707553", "0.5689832", "0.56803215", "0.56645435", "0.56645435", "0.56426424", "0.5622612", "0.5584488", "0.5555738", "0.5546626", "0.5541729", "0.55286217", "0.55250096", "0.5522545", "0.5522545", "0.5522545", "0.5522545", "0.55071133", "0.5502318", "0.5497919", "0.5495229", "0.5491529", "0.54894847", "0.5489228", "0.5487889", "0.5481775", "0.5477816", "0.54756474", "0.54677206", "0.546111", "0.54586166", "0.54545957", "0.5452105", "0.54504436", "0.54468256", "0.5443599", "0.5443505", "0.5443442", "0.5443411", "0.5443411", "0.5438871", "0.5438871", "0.54313767", "0.54117966", "0.5409627", "0.54072815", "0.5407042", "0.54060596", "0.54060596", "0.53960615", "0.53959537", "0.53871804", "0.5386354", "0.5386354", "0.53802973" ]
0.0
-1
About reaching pages Asserts that a page can be reached, leading to a Net::HTTPSuccess result
def i_reach(which_page) result = go(which_page) assert Net::HTTPSuccess===result, __last_because + " (cannot actually reach #{which_page}: #{result})" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_page(base, page, severity=:E, expectedStatus=\"200\", log=true)\n path = base + page\n response = getHTTP(path)\n code = response.code || '?'\n if code != expectedStatus\n test(severity, \"Fetched #{path} - HTTP status: #{code} expected: #{expectedStatus}\") unless severity == nil\n return nil\n end\n I \"Fetched #{path} - OK\" if log\n response.body\nend", "def assert_on_page(page)\n raise \"page must begin with '/': #{page}\" unless page[0] == ?\\/\n assert \"http://example.org#{page}\" == last_request.url,\n \"Expected to be on page http://example.org#{page} but was on #{last_request.url}\"\n end", "def ok?\n Net::HTTPSuccess === self || Net::HTTPRedirection === self\n end", "def test_response_code_200\n assert_equal '200', @page.code\n end", "def test_404_page\n get '/launchpads'\n assert last_response.ok?\n assert last_response.body.include?('Endpoint Not Found')\n end", "def redirect?\n\t\t\thttp_response = Net::HTTP.get_response(URI.parse(@page[:url]))\n\t\t\thttp_response == Net::HTTPRedirection\n\t\trescue Net::HTTPBadResponse\n\t\t\t# Dont do anything, as it is supposed to be raised.\n\t\tend", "def page_ok?(config, url)\n uri = URI.parse(url) rescue nil\n (uri.respond_to?(:host) && uri.host =~ config[\"host_re\"] &&\n uri.respond_to?(:path) && uri.path !~ %r{^/b/}).tap do |result|\n if !result\n puts \"Rejecting page #{url} for key #{config[\"key\"]}\"\n end\n end\n end", "def check_response(response)\n case response\n when Net::HTTPSuccess then\n #puts response\n when Net::HTTPRedirection then\n location = response['location']\n warn \"redirected to #{location}\"\n fetch(location, limit - 1)\n else\n puts response.value\n end\nend", "def test_basic_pages\n %w{ free lite hardcore ultimate }.each do |page|\n get page\n assert_response :success\n end\n end", "def i_could_reach(which_page)\n return if which_page.nil? or '#'==which_page \n case which_page\n when Tag\n i_could_reach(which_page[:href])\n when Array\n which_page.each{|link| i_could_reach(link)}\n when String\n result = browser.headers_fetch(which_page)\n assert Net::HTTPSuccess===result, __last_because + \" (could not reach #{which_page}: #{result})\"\n else\n raise ArgumentError, \"Unable to use #{which_page} for i_could_reach\"\n end\n end", "def i_may_not_reach(which_page)\n result = go(which_page)\n assert (Net::HTTPForbidden===result or Net::HTTPBadRequest===result), __last_because + \" (may actually reach #{which_page}: #{result})\"\n end", "def assess\n @error = false\n begin\n response_code = get_http_response_code(@referer)\n rescue\n Flying.an_error_ocurred(true)\n set_error_message(@referer, false, $!)\n return false\n end\n return true if [\"200\", \"302\"].include? response_code\n Flying.an_error_ocurred(true)\n set_error_message(@referer, response_code.to_s)\n false\n end", "def test_homepage\n\t\tget '/'\n\t\tassert last_response.ok?,\n\t\t\t\"Homepage loaded without an error.\"\n\t\tassert last_response.body.include?('Please leave me a message below!'),\n\t\t\t\"Expected text present.\"\n\tend", "def ensure_redirect response, url_matcher\n expect(response.code).to eq('301').or eq('302')\n expect(response.header['location']).to match url_matcher\n # href = document(response.body).css('a').attr('href').value\n # expect(href).to match url_matcher\n response.header['location']\n end", "def visit_all links\n not_found = []\n server_error = []\n\n links.each do |link|\n puts \"visiting link: #{link}\"\n visit link\n\n grab_screen \"visited #{link}\"\n current_url.should == link\n\n if page.has_content?('404')\n not_found << link\n next\n end\n\n server_error << link if page.has_content?('500') || page.has_content?('rror') || page.has_content?('ception')\n end\n\n unless not_found.empty? && server_error.empty?\n fail \"The following links responded with status 404: #{not_found.inspect} and these responded with status 500: #{server_error}\"\n end\nend", "def XXX_deleted_20150502_test_homepage_is_claim_page_for_now\n get '/'\n assert last_response.ok?\n assert_match /claim your prize/, last_response.body\nend", "def test_redirection\n process :redirect_internal\n assert @response.redirect?\n\n process :redirect_external\n assert @response.redirect?\n\n process :nothing\n assert !@response.redirect?\n end", "def assert_redirected_to(url)\n assert_equal(url, responses.first.location)\n end", "def test_index\n get '/'\n assert last_response.ok?\n end", "def check_error_response(last_response)\n refute_match 'Sinatra doesn&rsquo;t know this ditty', last_response.body, \"unmatched url\"\n end", "def test_offers\r\n get :offers, :id => 5072\r\n assert_response 301\r\n assert_redirected_to '/Ear-Force-X2-Wireless-Headphones-for-Xbox-reviews'\r\n end", "def check_url(path, url)\n res = http_client.get(url, follow_redirect: true)\n return if res.status == 200\n raise(nil) unless res.status.to_s.match(/50\\d|403/)\n\n puts \"::warning file=#{path}:: Unexpected response from #{url} (#{res.status})\"\nrescue StandardError => e\n puts \"::warning file=#{path}:: Unable to reach #{url} #{res.respond_to?('status') ? res.status : nil}\"\n puts e.full_message unless e.instance_of?(TypeError)\n 1\nend", "def page_found_with_redirect?\n @page_found_with_redirect\n end", "def assert_first_page\n assert_no_link PREV_LABEL\n end", "def should_open?(url, &block)\n resp = Net::HTTP.get_response(URI(url))\n case resp\n when Net::HTTPRedirection\n location = resp['location']\n puts \"Redirecting #{url} to #{location}\"\n should_open?(location) { |resp1| block.call(resp1) }\n when Net::HTTPSuccess\n block.call(resp)\n when Net::HTTPNotFound\n false\n else\n p url\n p resp.code\n false\n end\nend", "def check_pages\n if pages.length > 0\n return false\n end\n return true\n end", "def assert_redirected_to(page_name)\n assert_match(/#{Goldberg.settings.send(page_name).url}$/,\n response.redirected_to)\n end", "def check_page(page, page_name)\n Thread.new do\n threads = []\n results = []\n self.class.external_link_uri_strings(page).each do |uri_string|\n SEMAPHORE.synchronize { @links << page }\n wait_to_spawn_thread\n threads << Thread.new do\n begin\n uri = URI(uri_string)\n response = self.class.check_uri(uri)\n response.uri_string = uri_string\n SEMAPHORE.synchronize { results << response }\n rescue => error\n SEMAPHORE.synchronize { results <<\n Error.new( :error => error.to_s, :uri_string => uri_string) }\n end\n end\n end\n threads.each {|thread| thread.join }\n report_results(page_name, results)\n end\n end", "def test_redirect_url_match\n process :redirect_external\n assert @response.redirect?\n assert @response.redirect_url_match?(\"rubyonrails\")\n assert @response.redirect_url_match?(/rubyonrails/)\n assert !@response.redirect_url_match?(\"phpoffrails\")\n assert !@response.redirect_url_match?(/perloffrails/)\n end", "def test_that_find_by_url_finds_us_when_nothing_else_matches\n assert_equal @page, @root.find_by_url(\"a/page\")\n end", "def test_root\n\t\tget \"/\"\n\t\tassert_equal 200, last_response.status\n \tassert last_response.ok?\n\tend", "def reachable?\n return true if (page_ref && (page_ref.good? || (page_ref.http_status == 200))) || (gleaning && gleaning.good?)\n return false if (page_ref && @@BadResponseCodes.include?(page_ref.http_status)) &&\n (gleaning && @@BadResponseCodes.include?(gleaning.http_status))\n end", "def test_valley_smoketest\n @driver.get(@base_url)\n verify_home_page()\n verify_services_page()\n verify_about_page()\n verify_contact_page()\n verify_faq_page()\n verify_links_page()\n end", "def page_status\n @status = \"OK\"\n @status = \"ERR\" if self.response_code > 399\n end", "def test_users\n get '/users'\n assert_equal 302, last_response.status\n end", "def check_head(url)\n http_basic_authentication = SS::MessageEncryptor.http_basic_authentication\n\n redirection = 0\n max_redirection = SS.config.cms.check_links[\"max_redirection\"].to_i\n\n if url.match?(/^\\/\\//)\n url = @base_url.sub(/\\/\\/.*$/, url)\n elsif url[0] == \"/\"\n url = File.join(@base_url, url)\n end\n\n begin\n Timeout.timeout(@head_request_timeout) do\n ::URI.open url, proxy: true, redirect: false, http_basic_authentication: http_basic_authentication, progress_proc: ->(size) { raise \"200\" }\n end\n false\n rescue OpenURI::HTTPRedirect => e\n return false if redirection >= max_redirection\n redirection += 1\n url = e.uri\n retry\n rescue Timeout::Error\n return false\n rescue => e\n return e.to_s == \"200\"\n end\n end", "def check_head(url)\n http_basic_authentication = SS::MessageEncryptor.http_basic_authentication\n\n redirection = 0\n max_redirection = SS.config.cms.check_links[\"max_redirection\"].to_i\n\n if url.match?(/^\\/\\//)\n url = @base_url.sub(/\\/\\/.*$/, url)\n elsif url[0] == \"/\"\n url = File.join(@base_url, url)\n end\n\n begin\n Timeout.timeout(@head_request_timeout) do\n ::URI.open url, proxy: true, redirect: false, http_basic_authentication: http_basic_authentication, progress_proc: ->(size) { raise \"200\" }\n end\n false\n rescue OpenURI::HTTPRedirect => e\n return false if redirection >= max_redirection\n redirection += 1\n url = e.uri\n retry\n rescue Timeout::Error\n return false\n rescue => e\n return e.to_s == \"200\"\n end\n end", "def test_redirection_location\n process :redirect_internal\n assert_equal 'http://test.host/nothing', @response.redirect_url\n\n process :redirect_external\n assert_equal 'http://www.rubyonrails.org', @response.redirect_url\n end", "def test_app\n get '/'\n assert last_response.ok?\n assert_equal 200, last_response.status\n end", "def assert_response_success( opts = {} )\n assert_block \"@response is nil\" do\n !@response.nil?\n end\n\n if @response.error?\n puts @response.body\n elsif @response.redirect?\n raise Test::Unit::AssertionFailedError.new( \"Expected success, was redirect to #{@response.redirected_to} with flash #{flash}\" )\n end\n\n assert_response :success\n assert_template opts[:template] if opts[:template]\n end", "def test_guest_access_to_userland_gives_login_screen\n get '/in/index'\n assert last_response.redirect?\n follow_redirect!\n\n assert last_request.url.ends_with?(\"/login\")\n assert last_response.ok?\n assert last_response.body.include?('Login to continue') \n end", "def check_http_status(href)\n url = href.split(\".com/\")\n response = nil\n Net::HTTP.start(url[0].split(\"https://\").last + \".com\", 80) {|http|\n response = http.head(\"/\" + url[1])\n }\n if(response.code != \"200\")\n fail(href + \" returned code: \" + response.code)\n end\nend", "def successful_get_test(url, allow_index=true)\r\n open_session { |session|\r\n get url\r\n # puts @response.body\r\n assert_response :success\r\n meta_opts = { :tag => 'meta', :attributes => { :name => 'robots', :content => 'noindex,nofollow' } }\r\n if allow_index\r\n assert_no_tag meta_opts\r\n else\r\n assert_tag meta_opts\r\n end\r\n yield session if block_given?\r\n }\r\n end", "def get_page\n begin\n puts \"@@@@@@@@@@@@@ Visiting: #{@url} from #{@parent_page.address if @parent_page.present?}\"\n require 'nokogiri'\n require 'open-uri'\n @page = Nokogiri::HTML(open(@url))\n @page_title = (title_container = @page.css('title').first) ? title_container.content : \"Title unknown\"\n @links = @page.css(\"a\")\n\n return true\n rescue => exc\n puts \"==Problem with URL #{@url} == #{ exc.message}\"\n return false\n end\n end", "def reachable?(url)\n page = MetaInspector.new(url)\n\n if page.response.status < 400\n true\n else\n false\n end\n rescue\n false\n end", "def test_if_sdk_page_still_exists?\n uri = URI.parse(SDK_DOWNLOAD_PAGE)\n res = Net::HTTP.get_response(uri)\n assert_equal 200, res.code.to_i\n end", "def test_home_page\n get '/'\n\n assert_equal 200, last_response.status\n assert_equal \"text/html;charset=utf-8\", last_response['Content-Type']\n assert_includes last_response.body, \"Hello World!\"\n end", "def verify_page(context)\n return unless defined?(context.url_match_attribute)\n return if context.url_match_attribute.nil?\n return if context.has_correct_url?\n\n raise Testable::Errors::PageURLFromFactoryNotVerified\n end", "def test_1\n\n res = get \"http://localhost:7777/things\", :no_redirections => true\n assert_equal 303, res.code.to_i\n\n res = get(\"http://localhost:7777/things\", :noredir => true)\n assert_equal 303, res.code.to_i\n\n expect 200, {}, get(\"http://localhost:7777/items\", :noredir => true)\n end", "def test_index\n get :index\n \n assert_redirected_to :action => :unread\n end", "def test_get_invalid_url1\n get '/param0/param1/param2/param3/param4'\n assert_equal 404, last_response.status\n end", "def test_home_page_redirects\n \n post('admin_home', {}, {})\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n \n post('reviewer_home', {}, {})\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n \n post('manager_home', {}, {})\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n \n post('pcb_admin_home', {}, {})\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n \n post('designer_home', {}, {})\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n \n end", "def test_visit_to_nonexisting_url_tc6\r\n\t\t#redirect input\r\n\r\n\t\tinput = StringIO.new(\"<httpRequests>\\n\"\\\r\n\t\t\t+ \"<httpRequest>http://www.nz-honeynet.org/idontexist.html</httpRequest>\\n\"\\\r\n\t\t\t+ \"</httpRequests>\\n\") \r\n\t\t$stdin = input\r\n\t\t\r\n\t\t#redirect output\r\n\t\tactual_http_response = StringIO.new\r\n\t\t$stdout = actual_http_response\r\n\t\t\r\n\t\texpected_http_response = \"<httpResponses>\\n<httpResponse>\\n<uri>http://www.nz-honeynet.org/idontexist.html</uri>\\n\"\\\r\n\t\t\t+ \"<code>404 - Not Found</code>\\n\"\r\n\t\t\r\n\t\twebBrowser = WebBrowser.new(\"visitor/WebBrowserConfigurationUnitTestDontFollow.xml\")\r\n\t\t$stdout = STDOUT\r\n\t\t\r\n\t\tassert(actual_http_response.string.index(expected_http_response),\\\r\n\t\t\t\"http response not as expected\")\r\n\t\r\n\tend", "def test_not_found\n get '/does_not_exist'\n assert_equal 'Try again.', last_response.body\n end", "def page_status url\n url = URI.parse(url)\n http = Net::HTTP.new(url.host, url.port)\n if url.scheme.downcase == \"https\"\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n http.use_ssl = true\n end\n http.start do\n http.request_get(url.path.empty? ? \"/\" : url.path) do |res|\n return {:name => res.class, :code => res.code}\n end\n end\n end", "def i_dont_reach(which_page)\n result = go(which_page)\n assert (Net::HTTPNotFound===result or Net::HTTPForbidden===result), __last_because + \" (can reach #{which_page}: #{result})\"\n end", "def assert_last_page\n assert_no_link NEXT_LABEL\n end", "def test_p1_00010_aboutpage\n @aboutpage.goto_about_page\n \tassert @browser.body.present?\n assert @aboutpage.about_widget.present?\n @abouturl = @browser.url\n @aboutpage.newline\n end", "def is_on_page? page_text, negation = ''\n should_not_have_exception = false\n should_have_exception = false\n begin\n wait_for(timeout: 5) { has_text? page_text }\n # If negation is not nil, we should raise an error if this message was found on the view\n should_not_have_exception = true unless negation == ''\n rescue\n # only raise exception if negation is nil, otherwise this is the expected behaviour\n should_have_exception = true if negation == ''\n end\n raise \"Unexpected Page. The page should not have: '#{page_text}'\" if should_not_have_exception\n raise \"Unexpected Page. Expected was: '#{page_text}'\" if should_have_exception\n end", "def assert_not_last_page\n assert_link NEXT_LABEL\n end", "def test_visit_to_nonexisting_server_tc5\r\n\t\t#redirect input\r\n\t\tinput = StringIO.new(\"<httpRequests>\\n\"\\\r\n\t\t\t+ \"<httpRequest>http://www.isuredontexist3421.com/</httpRequest>\\n\"\\\r\n\t\t\t+ \"<httpRequest>http://www.isuredontexist3421.com/someotherurl.html</httpRequest>\\n\"\\\r\n\t\t\t+ \"</httpRequests>\\n\") \r\n\t\t$stdin = input\r\n\r\n\t\t#redirect output\r\n\t\tactual_http_response = StringIO.new\r\n\t\t$stdout = actual_http_response\r\n\t\t\r\n\t\texpected_http_response1 = \"<code>501 - getaddrinfo\" #original error\r\n\t\texpected_http_response2 = \"<code>501 - host name unknown\" #custom cache error\r\n\t\t\r\n\t\twebBrowser = WebBrowser.new(\"visitor/WebBrowserConfigurationUnitTestDontFollow.xml\")\r\n\t\t$stdout = STDOUT\r\n\t\t\r\n\t\t\r\n\t\terror_response1 = actual_http_response.string.index(expected_http_response1)\r\n\t\terror_response2 = actual_http_response.string.index(expected_http_response2)\r\n\t\t\r\n\t\tassert(error_response1,\"http response1 not as expected.\")\r\n\t\tassert(error_response2,\"http response2 not as expected.\")\r\n\tend", "def verifyStoryAdminLinks()\n\t\n\tputs \"************** START: Verify PRO page Links ****************\"\n\t\n\tputs \"Step 1 : Click on EditPage link on the Story page.\"\n\t$browser.click \"link=Edit\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Tell Your Story\")\n\t\tputs \"Step 1 is Passed. User has reached the EditPage screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 1 is Failed. User had failed to reach EditPage screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 3 : Click on Matching Grants link on the Story page.\"\n\t$browser.click \"link=Matching Grants\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Set Up a Matching Grant\")\n\t\tputs \"Step 3 is Passed. User has reached the Matching Grants screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 3 is Failed. User had failed to reach Matching Grants screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\t\n\tputs \"Step 6 : Click on Donations link on the Story page.\"\n\t$browser.click \"link=Donations\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Donations Listing\")\n\t\tputs \"Step 6 is Passed. User has reached the Donations screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 6 is Failed. User had failed to reach Donations screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"************** END: Verify PRO page Links ****************\"\n\t\nend", "def test_logged_in_user_access_to_userland_approved\n # first log in\n post '/login', { :username => GOOD_USERNAME, :password => GOOD_PASSWORD }\n\n # then specifically request the index page in userland\n get '/in/index'\n assert last_response.ok?\n assert last_response.body.include?('You are logged in as') \n assert last_response.body.include?(GOOD_USERNAME) \n end", "def test_success_scenario\n assert last_response.ok?\n end", "def test_outbound_link\r\n checker=ConsistencyChecker.new(\r\n @linkfinder,\r\n uriFromTest(\"url_retriever/test.htm\")\r\n )\r\n res=newResponse :body=> <<EOF\r\n<html>\r\n<head>\r\n<title>Consistency checker -- foreign domain test</title>\r\n</head>\r\n<body>\r\n<p>This is an example.com domain.</p>\r\n<a href=\"testB.htm\">Test 2</a>\r\n</body>\r\n</html>\r\nEOF\r\n links=checker.check(URI(\"http://www.example.com\"),res)\r\n assert links.empty?\r\n end", "def assert_not_first_page\n assert_link PREV_LABEL\n end", "def verifyNPOAdminLinks(story_name)\n\t\n\tputs \"************** START: Verify ORG page Links ****************\"\n\t\n\tputs \"Click on MY NPO link at the Header.\"\n\tbegin \n\t\tassert $browser.is_element_present(\"link=My nonprofit\")\n\t\t$browser.click \"link=My nonprofit\"\n\t\t$browser.wait_for_page_to_load \n\t\tbegin\n\t\t\tassert $browser.is_text_present(story_name)\n\t\t\tputs \"Step 1 is Passed. User has reached the MY NPO screen successfully.\"\n\t\trescue Test::Unit::AssertionFailedError\n\t\t\tputs \"Step 1 is Failed. User had failed to reach MY NPO screen.\"\n\t\tend\n\trescue\n\t\t$browser.click \"link=My nonprofits\"\n\t\t$browser.wait_for_page_to_load\n\t\tbegin\n\t\t\tassert $browser.is_text_present(\"News Feed\")\n\t\t\tputs \"Step 1 is Passed. User has reached the Account screen successfully.\"\n\t\t\t$browser.click \"link=Harvard College\"\n\t\t\t$browser.wait_for_page_to_load\n\t\trescue Test::Unit::AssertionFailedError\n\t\t\tputs \"Step 1 is Failed. User had failed to reach Account screen.\"\n\t\tend\n\tend \n\tsleep 5\n\tputs \"Step 2 : Click on EditPage link on the Story page.\"\n\t$browser.click \"link=Edit\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Tell Your Story\")\n\t\tputs \"Step 2 is Passed. User has reached the EditPage screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 2 is Failed. User had failed to reach EditPage screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 4 : Click on Matching Grants link on the Story page.\"\n\t$browser.click \"link=Matching Grants\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Matching Grant\")\n\t\tputs \"Step 4 is Passed. User has reached the Matching Grants screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 4 is Failed. User had failed to reach Matching Grants screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 8 : Click on Donations link on the Story page.\"\n\t$browser.click \"link=Donations\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Donations Listing\")\n\t\tputs \"Step 8 is Passed. User has reached the Donations screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 8 is Failed. User had failed to reach Donations screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\t# ------------------------------ Global Admin Links -----------------------------\n\tbegin \n\t\tassert $browser.is_element_present(\"link=Razoo Admins\")\n\t\tputs \"Step 10 : Click on Create Data Sources link on the Story page.\"\n\t\t$browser.click \"link=Data Sources\"\n\t\t$browser.wait_for_page_to_load \n\t\tbegin\n\t\t\tassert $browser.is_text_present(\"Razoo Admin Area\")\n\t\t\tputs \"Step 10 is Passed. User has reached the Data Sources screen successfully.\"\n\t\trescue Test::Unit::AssertionFailedError\n\t\t\tputs \"Step 10 is Failed. User had failed to reach Data Sources screen.\"\n\t\t\t$verification_errors << $!\n\t\tend\n\t\tputs \"Step 11 : Click on Create Audits link on the Story page.\"\n\t\t$browser.click \"link=Audits\"\n\t\t$browser.wait_for_page_to_load \n\t\tbegin\n\t\t\tassert $browser.is_text_present(\"PATRIOT Act\")\n\t\t\tputs \"Step 11 is Passed. User has reached the Audits screen successfully.\"\n\t\trescue Test::Unit::AssertionFailedError\n\t\t\tputs \"Step 11 is Failed. User had failed to reach Audits screen.\"\n\t\t\t$verification_errors << $!\n\t\tend\n\trescue\n\t\tputs \"Step 10 & 11 : I don't have access to view Data Sources and Audit links.\"\n\tend\n\t# ------------------------------ Global Admin Links -----------------------------\n\n\t\n\tputs \"************** END: Verify ORG page Links ****************\"\n\nend", "def test_grader_that_has_active_report_cant_take_on_another_report\n login_as :sean\n post :auto_assign\n assert_redirected_to :controller => :home, :action=>:index\n end", "def verify_page?\n current_url.include?('Google')\n end", "def http200(url)\n begin\n Net::HTTP.get_response(URI.parse(url)).code == '200'\n rescue Exception\n false\n end\n end", "def process_page(t, response, count)\n msg = \"[#{\"%.3d\" % count}/#{\"%.3d\" % datastore['MAX_PAGES']}] #{response.code || \"ERR\"} - #{t[:host]} - #{response.request.url}\"\n case response.code\n when 301,302\n if response.headers and response.headers[\"location\"]\n print_status(msg + \" -> \" + response.headers[\"location\"].to_s)\n else\n print_status(msg)\n end\n when 500...599\n print_good(msg)\n when 401\n print_good(msg)\n print_good((\" \" * 24) + \"WWW-Authenticate: #{response.headers['WWW-Authenticate']}\")\n when 200\n print_status(msg)\n when 404\n print_error(msg)\n else\n print_error(msg)\n end\n\n #\n # Process the web page\n #\n uri = URI(response.request.url)\n info = {\n :web_site => t[:site],\n :path => uri.path,\n :query => uri.query,\n :code => response.code,\n :body => response.body,\n :headers => response.headers\n }\n\n if response.headers['content-type']\n info[:ctype] = response.headers['content-type']\n end\n\n # TODO\n #if !page.cookies.empty?\n # info[:cookie] = page.cookies\n #end\n\n if response.headers['authorization']\n info[:auth] = response.headers['authorization']\n end\n\n if response.headers['location']\n info[:location] = response.headers['location']\n end\n\n if response.headers['last-modified']\n info[:mtime] = response.headers['last-modified']\n end\n\n # Report the web page to the database\n report_web_page(info)\n\n # Only process interesting response codes\n return unless [302, 301, 200, 500, 401, 403, 404].include?(response.code)\n\n # Skip certain types of forms right off the bat\n\n # Apache multiview directories\n return if uri.query =~ /^C=[A-Z];O=/ # Apache\n\n forms = []\n form_template = { :web_site => t[:site] }\n\n if form = form_from_url(t[:site], response.request.url)\n forms << form\n end\n\n doc = Nokogiri::HTML(response.body) if response.body rescue nil\n if doc\n doc.css(\"form\").each do |f|\n target = uri\n\n if f['action'] and not f['action'].strip.empty?\n action = f['action']\n\n # Prepend relative URLs with the current directory\n if action[0,1] != \"/\" and action !~ /\\:\\/\\//\n # Extract the base href first\n base = uri.path.gsub(/(.*\\/)[^\\/]+$/, \"\\\\1\")\n doc.css(\"base\").each do |bref|\n if bref['href']\n base = bref['href']\n end\n end\n action = (base + \"/\").sub(/\\/\\/$/, '/') + action\n end\n\n target = to_absolute(URI(action), uri) rescue next\n\n target = URI(target)\n unless target.host == uri.host\n # Replace 127.0.0.1 and non-qualified hostnames with our response.host\n # ex: http://localhost/url OR http://www01/url\n if (target.host.index(\".\").nil? or target.host == \"127.0.0.1\")\n target.host = uri.host\n else\n next\n end\n end\n end\n\n # skip this form if it matches exclusion criteria\n unless target.to_s =~ get_link_filter # TODO will need to filter more than this\n form = {}.merge!(form_template)\n form[:method] = (f['method'] || 'GET').upcase\n form[:query] = target.query.to_s if form[:method] != \"GET\"\n form[:path] = target.path\n form[:params] = []\n f.css('input', 'textarea').each do |inp|\n form[:params] << [inp['name'].to_s, inp['value'] || inp.content || '', { :type => inp['type'].to_s }]\n end\n\n f.css( 'select' ).each do |s|\n value = nil\n\n # iterate over each option to find the default value (if there is a selected one)\n s.children.each do |opt|\n ov = opt['value'] || opt.content\n value = ov if opt['selected']\n end\n\n # set the first one as the default value if we don't already have one\n value ||= s.children.first['value'] || s.children.first.content rescue ''\n\n form[:params] << [ s['name'].to_s, value.to_s, [ :type => 'select'] ]\n end\n\n forms << form\n end\n end\n end\n\n # Report each of the discovered forms\n forms.each do |form|\n next unless form[:method]\n print_status((\" \" * 24) + \"FORM: #{form[:method]} #{form[:path]}\")\n report_web_form(form)\n end\n end", "def assert_no_records_match\n sleep 2\n expect(@polaris.login_home_page.text).to include(\"No matching records found\")\n end", "def test_index_unauthorized\n get :index\n assert_response :redirect\n assert_redirected_to :action => \"login\"\n assert_equal \"Please log in first\", flash[:notice]\n end", "def skipped_test_raises_error_on_invalid_redirect_location\n assert_raise(ArgumentError) {\n http.get \"/redirect-to?url=foo\"\n }\n end", "def load_page()\n page = @mech.get(PARENT + PAGE)\n\n # Catch exception - 404 => Net::HTTPNotFound\n end", "def has_page?\n if url.nil? or page.nil? or page.document.nil?\n errors.add(:page, \"can not be nil\")\n return false\n end\n true\n end", "def test_index\n assert_response 200\n end", "def check_404\n end", "def working_url?(url, max_redirects=5)\r\n response = nil\r\n seen = Set.new \t\t\t#Ensures no duplicate entries\r\n loop do\r\n url = URI.parse(url)\r\n break if seen.include? url.to_s\t\t\t\t#Break out of the loop is the url argument is found in the set\r\n break if seen.size > max_redirects\t\t\t#Break out of the loop if you're redirected more than 5 times\r\n seen.add(url.to_s)\r\n request = Net::HTTP.new(url.host, url.port)\r\n request.use_ssl = true\r\n response = request.request_head(url.path)\r\n if response.kind_of?(Net::HTTPRedirection) #Detect a HTTP redirect\r\n url = response['location'] \t\t\t #Add the new redirect location to the set if detected\r\n else\r\n break\t\t\t\t\t\t\t\t\t\t#This means there were no redirects\r\n end\r\n end\r\n response.kind_of?(Net::HTTPSuccess) && url.to_s #Return true only if a URL argument was passed to the method and it was reached successfully\r\nend", "def check_adroll_on_other_pages(params, start_page)\n $tracer.trace(\"GameStopAnalyticsFunctions: #{__method__}, Line: #{__LINE__}\")\n $tracer.report(\"Should #{__method__}.\")\n if params[\"login\"] == \"\" and params[\"password\"] == \"\"\n open(\"#{start_page}/Profiles/OrderTrackingLogin.aspx\")\n order_lookup_email.value = \"robertsantos@gamestop.com\"\n order_lookup_confirmation_number.value = \"4131015095782760\"\n order_lookup_button.click\n wait_for_landing_page_load\n validate_cookies_and_tags(params)\n else\n open(\"#{start_page}/Profiles/MyAccount.aspx\")\n wait_for_landing_page_load\n validate_cookies_and_tags(params)\n\n open(\"#{start_page}/Orders/OrderHistory.aspx\")\n wait_for_landing_page_load\n validate_cookies_and_tags(params)\n\n open(\"#{start_page}/ps3\")\n wait_for_landing_page_load\n validate_cookies_and_tags(params)\n\n search_button.click\n wait_for_landing_page_load\n validate_cookies_and_tags(params)\n end\n end", "def test_should_flag_ON_INIT_PAGE_NEXT_when_clicking_next_on_valid_init_page\n post :init, :user=>{:first_name=>field_first_name, :last_name=>field_last_name}, :commit=>:next\n #assert_redirected_to :action=>second_page\n assert assigns['on_init_page_next']\n end", "def test_your_words\n get '/catspajamas'\n assert last_response.ok?\n assert_includes last_response.body, \"cats, pajamas\"\n end", "def assert_forbidden\n get :index\n\n assert_redirected_to login_path\n assert_equal evaluations_path, session[:return_to]\n assert_equal STRINGS[:not_logged_in], flash[:notice]\n assert_nil @controller.current_user\n end", "def test_home\n get '/'\n assert last_response.ok?\n data = JSON.parse(last_response.body)\n assert data.count > 0\n end", "def wait_until_page_loaded(page_name, prev_url)\n time_secs = 0\n while Capybara.current_session.current_url == prev_url\n break if time_secs > PAGE_TIMEOUT_SECS\n sleep 1\n time_secs+=1\n end\n fail \"ERROR: Page #{page_name} failed to load after #{PAGE_TIMEOUT_SECS} secs\" if Capybara.current_session.current_url == prev_url\n end", "def test_bounce_not_logged_in\n get :panel\n assert_redirected_to :controller => \"users\", :action => \"login\"\n end", "def test_cache_link\n get '/' + TEST_PAGE\n assert_redirected_to :link => TEST_PAGE_LINK\n \n follow_redirect!\n assert_no_errors\n assert_page_cached(TEST_PAGE_LINK)\n end", "def test_02dashboard\n expectedUrl=\"https://opensource-demo.orangehrmlive.com/index.php/dashboard\"\n assert_equal(expectedUrl, $objLoginPage.getUrl, \"Incorrect URL\")\n puts \"Dashboard test pass\" \n end", "def success?\n response.is_a?(Net::HTTPSuccess) || response.is_a?(Net::HTTPRedirection)\n end", "def verifyAboutUsLinks()\n\t\n\tputs \"************** START: Verify AboutUs Links ****************\"\n\t\n\tputs \"Step 1 : Click on AboutRazoo Link at the Footer.\"\n\t$browser.click \"link=About Razoo\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Razoo Overview\")\n\t\tputs \"Step 1 is Passed. User has reached the AboutRazoo screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 1 is Failed. User had failed to reach the About Razoo screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 2 : Click on Overview Link in AboutRazoo screen.\"\n\t$browser.click \"link=Overview\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Donate. Fundraise. Connect.\")\n\t\tputs \"Step 2 is Passed. User has reached the Overview screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 2 is Failed. User had failed to reach the Overview screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 3 : Click on CloserLook Link in AboutRazoo screen.\"\n\t$browser.click \"link=A Closer Look\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"A Closer Look\")\n\t\tputs \"Step 3 is Passed. User has reached the CloserLook screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 3 is Failed. User had failed to reach the CloserLook screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 4 : Click on OurTeam Link in AboutRazoo screen.\"\n\t$browser.click \"link=Our Team\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Razoo is a vibrant social enterprise with an accomplished, fun, and diverse team.\")\n\t\tputs \"Step 4 is Passed. User has reached the OurTeam screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 4 is Failed. User had failed to reach the CloserLook screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 5 : Click on Careers Link in AboutRazoo screen.\"\n\t$browser.click \"link=Careers\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Careers at Razoo\")\n\t\tputs \"Step 5 is Passed. User has reached the Careers screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 5 is Failed. User had failed to reach the Careers screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 6 : Click on PressCoverage Link in AboutRazoo screen.\"\n\t$browser.click \"link=Press Coverage\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Razoo often appears in both local and national press in recognition of our innovative website and approach to online giving and fundraising.\")\n\t\tputs \"Step 6 is Passed. User has reached the PressCoverage screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 6 is Failed. User had failed to reach the PressCoverage screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 7 : Click on ContactUs Link in AboutRazoo screen.\"\n\t$browser.click \"link=Contact Us\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Contact Us\")\n\t\tputs \"Step 7 is Passed. User has reached the ContactUs screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 7 is Failed. User had failed to reach the ContactUs screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 8 : Click on AtGlance Link in AboutRazoo screen.\"\n\t$browser.click \"link=At A Glance\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"What We Offer - At A Glance\")\n\t\tputs \"Step 8 is Passed. User has reached the AtGlance screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 8 is Failed. User had failed to reach the AtGlance screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 9 : Click on ForIndividuals Link in AboutRazoo screen.\"\n\t$browser.click \"link=For Individuals\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Razoo For Individuals\")\n\t\tputs \"Step 9 is Passed. User has reached the ForIndividuals screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 9 is Failed. User had failed to reach the ForIndividuals screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 10 : Click on ForNonProfits Link in AboutRazoo screen.\"\n\t$browser.click \"link=For Nonprofits\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Razoo For Nonprofits\")\n\t\tputs \"Step 10 is Passed. User has reached the ForNonProfits screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 10 is Failed. User had failed to reach the ForNonProfits screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 11 : Click on ForFoundations Link in AboutRazoo screen.\"\n\t$browser.click \"link=For Foundations\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Razoo For Foundations\")\n\t\tputs \"Step 11 is Passed. User has reached the ForFoundations screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 11 is Failed. User had failed to reach the ForFoundations screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 12 : Click on ForCorporations Link in AboutRazoo screen.\"\n\t$browser.click \"link=For Corporations\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Razoo For Corporations\")\n\t\tputs \"Step 12 is Passed. User has reached the ForCorporations screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 12 is Failed. User had failed to reach the ForCorporations screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 13 : Click on SuccessStories Link in AboutRazoo screen.\"\n\t$browser.click \"link=Success Stories\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Success Stories\")\n\t\tputs \"Step 13 is Passed. User has reached the SuccessStories screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 13 is Failed. User had failed to reach the SuccessStories screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 14 : Click on BestValue Link in AboutRazoo screen.\"\n\t$browser.click \"link=The Best Value\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"The Best Value\")\n\t\tputs \"Step 14 is Passed. User has reached the BestValue screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 14 is Failed. User had failed to reach the BestValue screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 15 : Click on EFT Link in AboutRazoo screen.\"\n\t$browser.click \"link=EFT\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"EFT Authorization Form for Nonprofits\")\n\t\tputs \"Step 15 is Passed. User has reached the EFT screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 15 is Failed. User had failed to reach the EFT screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 16 : Click on DonateAnywhere Link in AboutRazoo screen.\"\n\t$browser.click \"link=DonateAnywhere Widget\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"The DonateAnywhere Widget\")\n\t\tputs \"Step 16 is Passed. User has reached the DonateAnywhere screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 16 is Failed. User had failed to reach the DonateAnywhere screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 17 : Click on EDP Link in AboutRazoo screen.\"\n\t$browser.click \"link=Enhanced Donation Processing\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Enhanced Donation Processing\")\n\t\tputs \"Step 17 is Passed. User has reached the EDP screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 17 is Failed. User had failed to reach the EDP screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 18 : Click on Tips Link in AboutRazoo screen.\"\n\t$browser.click \"link=Introducing Tips\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"tips\")\n\t\tputs \"Step 18 is Passed. User has reached the Tips screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 18 is Failed. User had failed to reach the Tips screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 19 : Click on Blog Link in AboutRazoo screen.\"\n\t$browser.click \"link=Blog on Razoo Impact\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Razoo Impact\")\n\t\tputs \"Step 19 is Passed. User has reached the Blog screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 19 is Failed. User had failed to reach the Blog screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 20 : Click on HowDonationsWork Link in AboutRazoo screen.\"\n\t$browser.click \"link=How Donations Work\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"How Donations Work\")\n\t\tputs \"Step 20 is Passed. User has reached the HowDonationsWork screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 20 is Failed. User had failed to reach the HowDonationsWork screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 21 : Click on FundraisingIdeas Link in AboutRazoo screen.\"\n\t$browser.click \"link=Fundraising Ideas\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Fundraising Ideas\")\n\t\tputs \"Step 21 is Passed. User has reached the FundraisingIdeas screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 21 is Failed. User had failed to reach the FundraisingIdeas screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 22 : Click on SetUpFR Link in AboutRazoo screen.\"\n\t$browser.click \"link=How to Setup a Fundraiser\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Create a Fundraising Page\")\n\t\tputs \"Step 22 is Passed. User has reached the SetUpFR screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 22 is Failed. User had failed to reach the SetUpFR screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 23 : Click on MakeYourPageGreat Link in AboutRazoo screen.\"\n\t$browser.click \"link=Make Your Page Great\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Make Your Page Great\")\n\t\tputs \"Step 23 is Passed. User has reached the MakeYourPageGreat screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 23 is Failed. User had failed to reach the MakeYourPageGreat screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 24 : Click on SharePromote Link in AboutRazoo screen.\"\n\t$browser.click \"link=Share and Promote Your Page\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Share and Promote your page\")\n\t\tputs \"Step 24 is Passed. User has reached the SharePromote screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 24 is Failed. User had failed to reach the SharePromote screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 25 : Click on Logos Link in AboutRazoo screen.\"\n\t$browser.click \"link=Logos\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"We've collected a few logos for your use.\")\n\t\tputs \"Step 25 is Passed. User has reached the SharePromote screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 25 is Failed. User had failed to reach the SharePromote screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 26 : Click on OurHomepage Link in AboutRazoo screen.\"\n\t$browser.click \"link=Get Featured on Our Homepage\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Getting Featured on Razoo\")\n\t\tputs \"Step 26 is Passed. User has reached the OurHomepage screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 26 is Failed. User had failed to reach the OurHomepage screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 27 : Click on FAQIndividuals Link in AboutRazoo screen.\"\n\t$browser.click \"link=FAQs for Individuals\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"FAQs for Individuals\")\n\t\tputs \"Step 27 is Passed. User has reached the FAQIndividuals screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 27 is Failed. User had failed to reach the FAQIndividuals screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 28 : Click on FAQNonProfits Link in AboutRazoo screen.\"\n\t$browser.click \"link=FAQs for Nonprofits\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"FAQs for Nonprofits\")\n\t\tputs \"Step 28 is Passed. User has reached the FAQNonProfits screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 28 is Failed. User had failed to reach the FAQNonProfits screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 29 : Click on Security Link in AboutRazoo screen.\"\n\t$browser.click \"link=Security\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Security and Privacy\")\n\t\tputs \"Step 29 is Passed. User has reached the Security screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 29 is Failed. User had failed to reach the Security screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 30 : Click on Privacy Link in AboutRazoo screen.\"\n\t$browser.click \"link=Privacy\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"The Razoo.com Privacy Policy\")\n\t\tputs \"Step 30 is Passed. User has reached the Privacy screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 30 is Failed. User had failed to reach the Privacy screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 31 : Click on TOU Link in AboutRazoo screen.\"\n\t$browser.click \"link=Terms of Use\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"The Razoo.com Terms of Use\")\n\t\tputs \"Step 31 is Passed. User has reached the TOU screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 31 is Failed. User had failed to reach the TOU screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"************** END: Verify AboutUs Links ****************\"\n\nend", "def fetch_page\n Varnisher.log.info \"Looking for external resources on #{@url}...\"\n\n begin\n @html = Net::HTTP.get_response(@uri).body\n rescue\n Varnisher.log.info \"Hmm, I couldn't fetch that URL. Sure it's right?\\n\"\n return\n end\n end", "def robots_error(url); end", "def check_connection\n one_wait = 5\n max_wait = 5\n request = Net::HTTP::Get.new('/')\n wait = 0;\n while (wait < max_wait)\n begin\n response = Net::HTTP.start(@url.host, @url.port) {|http|\n http.request(request)\n }\n break if Net::HTTPForbidden === response\n break if Net::HTTPNotFound === response\n break if Net::HTTPSuccess === response\n # When we try to connect to a down server with an Apache proxy, \n # we'll get Net::HTTPBadGateway and get here\n rescue Errno::ECONNREFUSED\n # When we try to connect to a down server without an Apache proxy, \n # such as a dev instance, we'll get here\n end\n sleep one_wait;\n wait += one_wait\n end\n if (wait == max_wait)\n puts(\"-- ERROR: couldn't connect to test host on \" + @url.host.to_s)\n return false\n end\n puts(\"-- SUCCESS: test host is alive !\\n\")\n return true\nend", "def test_page_security\n # A public page\n get '/home'\n assert_response :success\n # An administrator page\n get '/admin'\n assert_redirected_to_login\n\n form_login('admin', 'admin')\n \n get '/admin'\n assert_response :success\n end", "def location_error(page, params)\n loc_count = Location.count\n past_loc_count = Location::Version.count\n desc_count = LocationDescription.count\n past_desc_count = LocationDescription::Version.count\n post_requires_login(page, params)\n assert_response(page.to_s)\n assert_equal(loc_count, Location.count)\n assert_equal(past_loc_count, Location::Version.count)\n assert_equal(desc_count, LocationDescription.count)\n assert_equal(past_desc_count, LocationDescription::Version.count)\n end", "def is_on_page?(page_text, negation = '')\n fail 'Página inesperada. Entre com uma mensagem válida' if\n page_text.to_s == ''\n\n should_not_have_exception = false\n should_have_exception = false\n begin\n wait_for(timeout: 5) { has_text? page_text }\n # If negation is not nil, we should raise an error\n # if this message was found on the view\n should_not_have_exception = true unless negation == ''\n rescue\n # only raise exception if negation is nil,\n # otherwise this is the expected behaviour\n should_have_exception = true if negation == ''\n end\n\n fail \"Página inesperada. A página não contém: '#{page_text}'\" if\n should_not_have_exception\n\n fail \"Página inesperada. Era esperado: '#{page_text}'\" if\n should_have_exception\n\n true\n end", "def open(url)\n super\n assert_page_loaded\n end", "def test_valid_fields\n\t page = pages(:valid_page)\n\t assert page.valid?\n\tend", "def verifyFooterLinks()\n\t\n\tputs \"************** START: Verify Footer Links ****************\"\n\t\n\tputs \"Step 1 : Click on Fundraise Link at the Footer\"\n\t$browser.click \"//div/a/em\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"exact:What if can others are fundraising with me ?\")\n\t\tputs \"Step 1 is Passed. User has reached the Create Fundraising page successfully thro' Footer.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 1 is Failed. User had failed to reach the Create Fundraising page thro' Footer.\"\n\t\t$verification_errors << $!\n\tend\n\n\tputs \"Step 3 : Click on Nonprofits Link at the Footer\"\n\t$browser.click \"//div[2]/div/a/em\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"exact:Why Should I Claim Admin Access?\")\n\t\tputs \"Step 3 is Passed. User has reached the Claim Admin Access page successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 3 is Failed. User had failed to reach the Claim Admin Access page.\"\n\t\t$verification_errors << $!\n\tend\n\tputs \"************** END: Verify Footer Links ****************\"\n\t\nend", "def test_00090_homepage_open_q_conv_link\n @browser.wait_until { @home_page.open_questions_widget.present? }\n @browser.wait_until { @home_page.open_questions_widget.posts.size > 0 }\n\n # verify the title link would redirect to conversation page.\n q_title = @home_page.open_questions_widget.posts[0].title\n @home_page.open_questions_widget.posts[0].click_title_link\n @browser.wait_until { @convdetail_page.conv_detail.present? }\n assert_equal @convdetail_page.conv_title.when_present.text, q_title, \"title doesn't match\"\n\n @home_page.navigate_in\n @browser.wait_until { @home_page.open_questions_widget.posts.size > 0 }\n\n # verify avatar link would redirect to profile page\n @home_page.open_questions_widget.posts[0].click_avatar\n @browser.wait_until { @profile_page.profile_page.present? }\n author_name = @profile_page.profile_page_author_name_betaon.when_present.text\n\n @home_page.navigate_in\n @browser.wait_until { @home_page.open_questions_widget.posts.size > 0 }\n\n # verify author link would redirect to profile page\n @home_page.open_questions_widget.posts[0].click_author_link\n @browser.wait_until { @profile_page.profile_page.present? }\n assert_equal @profile_page.profile_page_author_name_betaon.when_present.text, author_name, \"Author doesn't match\"\n\n @home_page.navigate_in\n @browser.wait_until { @home_page.open_questions_widget.posts.size > 0 }\n\n # verify topic link would redirect to the correct topic page\n post_in_topic = @home_page.open_questions_widget.posts[0].in_topic_link.when_present.text\n\n @home_page.open_questions_widget.posts[0].click_topic_link\n @browser.wait_until { @topicdetail_page.topic_filter.present? }\n assert_equal @topicdetail_page.topic_title.when_present.text, post_in_topic, \"Title doesn't match\"\n end" ]
[ "0.72206855", "0.674044", "0.6577114", "0.6558375", "0.6494465", "0.644917", "0.6429458", "0.6426055", "0.6384194", "0.63343143", "0.6331706", "0.6258108", "0.624846", "0.6190442", "0.61850494", "0.61820865", "0.61788094", "0.6175449", "0.61469823", "0.6137762", "0.61120224", "0.6109465", "0.6107291", "0.60653824", "0.60486645", "0.6035942", "0.6034368", "0.6030909", "0.60299325", "0.60200834", "0.5984943", "0.5978416", "0.59666866", "0.5965888", "0.5958209", "0.5947246", "0.5947246", "0.5942886", "0.5934855", "0.5925102", "0.591398", "0.5913251", "0.59099454", "0.5902326", "0.5895224", "0.58868235", "0.5871745", "0.58702475", "0.5869939", "0.58590925", "0.58560824", "0.585259", "0.5848548", "0.5847264", "0.5843459", "0.58397675", "0.58347476", "0.5812322", "0.5810318", "0.58085936", "0.57835186", "0.57786274", "0.5778312", "0.57780576", "0.5773845", "0.57736695", "0.5760063", "0.57417077", "0.5727225", "0.5718319", "0.5718162", "0.5710592", "0.5707018", "0.57064116", "0.5700809", "0.569068", "0.5685022", "0.567992", "0.5677126", "0.56748134", "0.56747675", "0.5669235", "0.5667717", "0.56631196", "0.56587434", "0.56522524", "0.56429744", "0.5637079", "0.5636786", "0.56306404", "0.56301874", "0.5628919", "0.5613485", "0.5611953", "0.56006926", "0.5599843", "0.55960506", "0.5593714", "0.55919594", "0.5590373" ]
0.69959426
1
Asserts that a page could be reached (requesting headers leads to a Net::HTTPSucess result)
def i_could_reach(which_page) return if which_page.nil? or '#'==which_page case which_page when Tag i_could_reach(which_page[:href]) when Array which_page.each{|link| i_could_reach(link)} when String result = browser.headers_fetch(which_page) assert Net::HTTPSuccess===result, __last_because + " (could not reach #{which_page}: #{result})" else raise ArgumentError, "Unable to use #{which_page} for i_could_reach" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_page(base, page, severity=:E, expectedStatus=\"200\", log=true)\n path = base + page\n response = getHTTP(path)\n code = response.code || '?'\n if code != expectedStatus\n test(severity, \"Fetched #{path} - HTTP status: #{code} expected: #{expectedStatus}\") unless severity == nil\n return nil\n end\n I \"Fetched #{path} - OK\" if log\n response.body\nend", "def check_head(url)\n http_basic_authentication = SS::MessageEncryptor.http_basic_authentication\n\n redirection = 0\n max_redirection = SS.config.cms.check_links[\"max_redirection\"].to_i\n\n if url.match?(/^\\/\\//)\n url = @base_url.sub(/\\/\\/.*$/, url)\n elsif url[0] == \"/\"\n url = File.join(@base_url, url)\n end\n\n begin\n Timeout.timeout(@head_request_timeout) do\n ::URI.open url, proxy: true, redirect: false, http_basic_authentication: http_basic_authentication, progress_proc: ->(size) { raise \"200\" }\n end\n false\n rescue OpenURI::HTTPRedirect => e\n return false if redirection >= max_redirection\n redirection += 1\n url = e.uri\n retry\n rescue Timeout::Error\n return false\n rescue => e\n return e.to_s == \"200\"\n end\n end", "def check_head(url)\n http_basic_authentication = SS::MessageEncryptor.http_basic_authentication\n\n redirection = 0\n max_redirection = SS.config.cms.check_links[\"max_redirection\"].to_i\n\n if url.match?(/^\\/\\//)\n url = @base_url.sub(/\\/\\/.*$/, url)\n elsif url[0] == \"/\"\n url = File.join(@base_url, url)\n end\n\n begin\n Timeout.timeout(@head_request_timeout) do\n ::URI.open url, proxy: true, redirect: false, http_basic_authentication: http_basic_authentication, progress_proc: ->(size) { raise \"200\" }\n end\n false\n rescue OpenURI::HTTPRedirect => e\n return false if redirection >= max_redirection\n redirection += 1\n url = e.uri\n retry\n rescue Timeout::Error\n return false\n rescue => e\n return e.to_s == \"200\"\n end\n end", "def test_if_sdk_page_still_exists?\n uri = URI.parse(SDK_DOWNLOAD_PAGE)\n res = Net::HTTP.get_response(uri)\n assert_equal 200, res.code.to_i\n end", "def check_http_status(href)\n url = href.split(\".com/\")\n response = nil\n Net::HTTP.start(url[0].split(\"https://\").last + \".com\", 80) {|http|\n response = http.head(\"/\" + url[1])\n }\n if(response.code != \"200\")\n fail(href + \" returned code: \" + response.code)\n end\nend", "def check_url(path, url)\n res = http_client.get(url, follow_redirect: true)\n return if res.status == 200\n raise(nil) unless res.status.to_s.match(/50\\d|403/)\n\n puts \"::warning file=#{path}:: Unexpected response from #{url} (#{res.status})\"\nrescue StandardError => e\n puts \"::warning file=#{path}:: Unable to reach #{url} #{res.respond_to?('status') ? res.status : nil}\"\n puts e.full_message unless e.instance_of?(TypeError)\n 1\nend", "def assert_on_page(page)\n raise \"page must begin with '/': #{page}\" unless page[0] == ?\\/\n assert \"http://example.org#{page}\" == last_request.url,\n \"Expected to be on page http://example.org#{page} but was on #{last_request.url}\"\n end", "def ok?\n Net::HTTPSuccess === self || Net::HTTPRedirection === self\n end", "def test_404_page\n get '/launchpads'\n assert last_response.ok?\n assert last_response.body.include?('Endpoint Not Found')\n end", "def check_response(response)\n case response\n when Net::HTTPSuccess then\n #puts response\n when Net::HTTPRedirection then\n location = response['location']\n warn \"redirected to #{location}\"\n fetch(location, limit - 1)\n else\n puts response.value\n end\nend", "def i_reach(which_page)\n result = go(which_page)\n assert Net::HTTPSuccess===result, __last_because + \" (cannot actually reach #{which_page}: #{result})\"\n end", "def test_response_code_200\n assert_equal '200', @page.code\n end", "def ensure_redirect response, url_matcher\n expect(response.code).to eq('301').or eq('302')\n expect(response.header['location']).to match url_matcher\n # href = document(response.body).css('a').attr('href').value\n # expect(href).to match url_matcher\n response.header['location']\n end", "def assert_redirected_to(url)\n assert_equal(url, responses.first.location)\n end", "def assert_http_status(curl, status)\n\n # If the status doesn't match, then raise an exception\n if (curl.response_code != status) then\n raise curl.url + ': Expected response of ' + status.to_s + ' but was ' + curl.response_code.to_s\n end\nend", "def test_status_code_is_present\n res = get_wrapped_response(default_url)\n\n assert_equal 200, res.status_code\n end", "def check_error_response(last_response)\n refute_match 'Sinatra doesn&rsquo;t know this ditty', last_response.body, \"unmatched url\"\n end", "def test_not_found\n get '/does_not_exist'\n assert_equal 'Try again.', last_response.body\n end", "def should_open?(url, &block)\n resp = Net::HTTP.get_response(URI(url))\n case resp\n when Net::HTTPRedirection\n location = resp['location']\n puts \"Redirecting #{url} to #{location}\"\n should_open?(location) { |resp1| block.call(resp1) }\n when Net::HTTPSuccess\n block.call(resp)\n when Net::HTTPNotFound\n false\n else\n p url\n p resp.code\n false\n end\nend", "def page_ok?(config, url)\n uri = URI.parse(url) rescue nil\n (uri.respond_to?(:host) && uri.host =~ config[\"host_re\"] &&\n uri.respond_to?(:path) && uri.path !~ %r{^/b/}).tap do |result|\n if !result\n puts \"Rejecting page #{url} for key #{config[\"key\"]}\"\n end\n end\n end", "def link_is_existent?(url)\n \tbegin\n\t uri = URI.parse(url)\n \t http_conn = Net::HTTP.new(uri.host, uri.port)\n \t resp, data = http_conn.head(\"/\" , nil)\n \t puts \"=== RESPONSE CODE #{resp.code}\"\n \t resp.code != \"404\"\n \trescue URI::InvalidURIError, Errno::ECONNREFUSED, SocketError\n \t\tfalse\n \tend\n end", "def test_visit_to_nonexisting_url_tc6\r\n\t\t#redirect input\r\n\r\n\t\tinput = StringIO.new(\"<httpRequests>\\n\"\\\r\n\t\t\t+ \"<httpRequest>http://www.nz-honeynet.org/idontexist.html</httpRequest>\\n\"\\\r\n\t\t\t+ \"</httpRequests>\\n\") \r\n\t\t$stdin = input\r\n\t\t\r\n\t\t#redirect output\r\n\t\tactual_http_response = StringIO.new\r\n\t\t$stdout = actual_http_response\r\n\t\t\r\n\t\texpected_http_response = \"<httpResponses>\\n<httpResponse>\\n<uri>http://www.nz-honeynet.org/idontexist.html</uri>\\n\"\\\r\n\t\t\t+ \"<code>404 - Not Found</code>\\n\"\r\n\t\t\r\n\t\twebBrowser = WebBrowser.new(\"visitor/WebBrowserConfigurationUnitTestDontFollow.xml\")\r\n\t\t$stdout = STDOUT\r\n\t\t\r\n\t\tassert(actual_http_response.string.index(expected_http_response),\\\r\n\t\t\t\"http response not as expected\")\r\n\t\r\n\tend", "def reachable?(url)\n page = MetaInspector.new(url)\n\n if page.response.status < 400\n true\n else\n false\n end\n rescue\n false\n end", "def http200(url)\n begin\n Net::HTTP.get_response(URI.parse(url)).code == '200'\n rescue Exception\n false\n end\n end", "def test_redirection\n process :redirect_internal\n assert @response.redirect?\n\n process :redirect_external\n assert @response.redirect?\n\n process :nothing\n assert !@response.redirect?\n end", "def redirect?\n\t\t\thttp_response = Net::HTTP.get_response(URI.parse(@page[:url]))\n\t\t\thttp_response == Net::HTTPRedirection\n\t\trescue Net::HTTPBadResponse\n\t\t\t# Dont do anything, as it is supposed to be raised.\n\t\tend", "def test_missing_response_code\n process :response404\n assert @response.missing?\n end", "def check_uri(uri)\n curl = Curl::Easy.new(uri)\n curl.ssl_verify_peer = false\n curl.follow_location = true\n curl.headers['User-Agent'] = 'static-site-generator-comparison-0.1.0.0'\n curl.headers['Accept'] = 'text/html,application/xhtml+xml,application/xml'\n begin\n curl.perform\n rescue Exception => e\n puts \"#{uri}: failed to curl\"\n raise e\n end\n\n unless curl.response_code == 200\n raise \"#{uri}: #{curl.response_code} response\"\n end\nend", "def test_visit_to_nonexisting_server_tc5\r\n\t\t#redirect input\r\n\t\tinput = StringIO.new(\"<httpRequests>\\n\"\\\r\n\t\t\t+ \"<httpRequest>http://www.isuredontexist3421.com/</httpRequest>\\n\"\\\r\n\t\t\t+ \"<httpRequest>http://www.isuredontexist3421.com/someotherurl.html</httpRequest>\\n\"\\\r\n\t\t\t+ \"</httpRequests>\\n\") \r\n\t\t$stdin = input\r\n\r\n\t\t#redirect output\r\n\t\tactual_http_response = StringIO.new\r\n\t\t$stdout = actual_http_response\r\n\t\t\r\n\t\texpected_http_response1 = \"<code>501 - getaddrinfo\" #original error\r\n\t\texpected_http_response2 = \"<code>501 - host name unknown\" #custom cache error\r\n\t\t\r\n\t\twebBrowser = WebBrowser.new(\"visitor/WebBrowserConfigurationUnitTestDontFollow.xml\")\r\n\t\t$stdout = STDOUT\r\n\t\t\r\n\t\t\r\n\t\terror_response1 = actual_http_response.string.index(expected_http_response1)\r\n\t\terror_response2 = actual_http_response.string.index(expected_http_response2)\r\n\t\t\r\n\t\tassert(error_response1,\"http response1 not as expected.\")\r\n\t\tassert(error_response2,\"http response2 not as expected.\")\r\n\tend", "def test_app\n get '/'\n assert last_response.ok?\n assert_equal 200, last_response.status\n end", "def page_status url\n url = URI.parse(url)\n http = Net::HTTP.new(url.host, url.port)\n if url.scheme.downcase == \"https\"\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n http.use_ssl = true\n end\n http.start do\n http.request_get(url.path.empty? ? \"/\" : url.path) do |res|\n return {:name => res.class, :code => res.code}\n end\n end\n end", "def skipped_test_raises_error_on_invalid_redirect_location\n assert_raise(ArgumentError) {\n http.get \"/redirect-to?url=foo\"\n }\n end", "def check_connection\n one_wait = 5\n max_wait = 5\n request = Net::HTTP::Get.new('/')\n wait = 0;\n while (wait < max_wait)\n begin\n response = Net::HTTP.start(@url.host, @url.port) {|http|\n http.request(request)\n }\n break if Net::HTTPForbidden === response\n break if Net::HTTPNotFound === response\n break if Net::HTTPSuccess === response\n # When we try to connect to a down server with an Apache proxy, \n # we'll get Net::HTTPBadGateway and get here\n rescue Errno::ECONNREFUSED\n # When we try to connect to a down server without an Apache proxy, \n # such as a dev instance, we'll get here\n end\n sleep one_wait;\n wait += one_wait\n end\n if (wait == max_wait)\n puts(\"-- ERROR: couldn't connect to test host on \" + @url.host.to_s)\n return false\n end\n puts(\"-- SUCCESS: test host is alive !\\n\")\n return true\nend", "def test_index\n get '/'\n assert last_response.ok?\n end", "def robots_error(url); end", "def assert_headers\n assert_response :success\n assert_equal 'no-cache', @response.headers['Cache-control']\n assert_equal 'no-cache', @response.headers['Pragma']\n assert_equal '-1', @response.headers['Expires']\n end", "def valid_link?(url)\n # GET or HEAD? Head is more friendly to the server, but some pages\n # May behave differently depending on HEAD or GET.\n HTTParty.head(url,\n verify: false, # don't verify ssl certs\n ).code == 200\n end", "def test_home_page\n get '/'\n\n assert_equal 200, last_response.status\n assert_equal \"text/html;charset=utf-8\", last_response['Content-Type']\n assert_includes last_response.body, \"Hello World!\"\n end", "def i_may_not_reach(which_page)\n result = go(which_page)\n assert (Net::HTTPForbidden===result or Net::HTTPBadRequest===result), __last_because + \" (may actually reach #{which_page}: #{result})\"\n end", "def successful_get_test(url, allow_index=true)\r\n open_session { |session|\r\n get url\r\n # puts @response.body\r\n assert_response :success\r\n meta_opts = { :tag => 'meta', :attributes => { :name => 'robots', :content => 'noindex,nofollow' } }\r\n if allow_index\r\n assert_no_tag meta_opts\r\n else\r\n assert_tag meta_opts\r\n end\r\n yield session if block_given?\r\n }\r\n end", "def robots_error!(url); end", "def page_status\n @status = \"OK\"\n @status = \"ERR\" if self.response_code > 399\n end", "def test_get_invalid_url1\n get '/param0/param1/param2/param3/param4'\n assert_equal 404, last_response.status\n end", "def server_ready?\n begin\n url = URI.parse(TEST_URI)\n req = Net::HTTP.new(url.host, url.port)\n res = req.request_head(\"/\")\n res.code == \"200\"\n rescue Errno::ECONNREFUSED\n false\n end\nend", "def test_homepage\n\t\tget '/'\n\t\tassert last_response.ok?,\n\t\t\t\"Homepage loaded without an error.\"\n\t\tassert last_response.body.include?('Please leave me a message below!'),\n\t\t\t\"Expected text present.\"\n\tend", "def url_tester(method,schema,base_domain,page,query,expected_code,timeout,headers,https_verify,logger)\n\n uri = URI.join(\"#{schema}://#{base_domain}\",page)\n http = Net::HTTP.new(uri.host, uri.port)\n if schema == \"https\"\n http.use_ssl = true\n http.verify_mode = https_verify ? OpenSSL::SSL::VERIFY_PEER : OpenSSL::SSL::VERIFY_NONE\n end\n http.open_timeout = timeout\n\n # Catch errors and set http status codes manually\n begin\n request = Net::HTTP::Get.new(uri.request_uri)\n if !headers.empty?\n headers.each { |header|\n header_array = header.split(':', 2)\n logger.debug_message \"header_array: #{header_array}\"\n request.initialize_http_header({header_array[0] => header_array[1]})\n }\n end\n start_time = Time.now\n response = http.request(request)\n end_time = Time.now\n response_time = end_time - start_time\n return uri.to_s, response.code.to_i, response_time \n # Catch time outs and set code to HTTPGatewayTimeOut: 504.\n rescue Net::OpenTimeout\n return uri.to_s, 504\n end\nend", "def assert_redirect(res, location)\n assert_in_array [\"301\", \"302\", \"303\", \"307\"], res.code\n assert_header res, \"Location\", location\n end", "def assert_response_success( opts = {} )\n assert_block \"@response is nil\" do\n !@response.nil?\n end\n\n if @response.error?\n puts @response.body\n elsif @response.redirect?\n raise Test::Unit::AssertionFailedError.new( \"Expected success, was redirect to #{@response.redirected_to} with flash #{flash}\" )\n end\n\n assert_response :success\n assert_template opts[:template] if opts[:template]\n end", "def verify_pcgw_url(pcgw_id)\n url = URI.parse(\"https://pcgamingwiki.com/wiki/#{pcgw_id}\")\n req = Net::HTTP.new(url.host, url.port)\n req.use_ssl = true\n res = req.request_head(url.path)\n if res.code == \"200\"\n return true\n elsif res.code == \"404\"\n return false\n else\n return false\n end\nend", "def test_success_scenario\n assert last_response.ok?\n end", "def XXX_deleted_20150502_test_homepage_is_claim_page_for_now\n get '/'\n assert last_response.ok?\n assert_match /claim your prize/, last_response.body\nend", "def fetch_page\n Varnisher.log.info \"Looking for external resources on #{@url}...\"\n\n begin\n @html = Net::HTTP.get_response(@uri).body\n rescue\n Varnisher.log.info \"Hmm, I couldn't fetch that URL. Sure it's right?\\n\"\n return\n end\n end", "def mock_success\n head :ok\n end", "def assert_first_page\n assert_no_link PREV_LABEL\n end", "def test_redirection_location\n process :redirect_internal\n assert_equal 'http://test.host/nothing', @response.redirect_url\n\n process :redirect_external\n assert_equal 'http://www.rubyonrails.org', @response.redirect_url\n end", "def valid_url?(url)\n begin\n Net::HTTP.get_response(URI(url)).code == \"200\" ? true : false\n rescue SocketError\n false\n end\nend", "def exist?\n res = Net::HTTP.get_response(uri)\n res.class == Net::HTTPOK\nrescue\n false\nend", "def test_users\n get '/users'\n assert_equal 302, last_response.status\n end", "def test_request\n get \"/example/route\"\n assert last_response.ok?\n body = last_response.body\n assert body[\"Hello\"]\n end", "def test_root\n\t\tget \"/\"\n\t\tassert_equal 200, last_response.status\n \tassert last_response.ok?\n\tend", "def assert_redirected_to(url)\n assert [301, 302].include?(@integration_session.status),\n \"Expected status to be 301 or 302, got #{@integration_session.status}\"\n\n assert_url url, @integration_session.headers[\"Location\"]\n end", "def verify\n head :ok\n end", "def assert_response(expected)\n response.code.to_i.should == Rack::Utils.status_code(expected)\nend", "def test_that_find_by_url_finds_us_when_nothing_else_matches\n assert_equal @page, @root.find_by_url(\"a/page\")\n end", "def assess\n @error = false\n begin\n response_code = get_http_response_code(@referer)\n rescue\n Flying.an_error_ocurred(true)\n set_error_message(@referer, false, $!)\n return false\n end\n return true if [\"200\", \"302\"].include? response_code\n Flying.an_error_ocurred(true)\n set_error_message(@referer, response_code.to_s)\n false\n end", "def open(url)\n super\n assert_page_loaded\n end", "def verify_uri_acessibility uri\n res = Net::HTTP.get_response URI(uri)\n res.is_a? Net::HTTPSuccess\nend", "def test_1\n\n res = get \"http://localhost:7777/things\", :no_redirections => true\n assert_equal 303, res.code.to_i\n\n res = get(\"http://localhost:7777/things\", :noredir => true)\n assert_equal 303, res.code.to_i\n\n expect 200, {}, get(\"http://localhost:7777/items\", :noredir => true)\n end", "def visit_all links\n not_found = []\n server_error = []\n\n links.each do |link|\n puts \"visiting link: #{link}\"\n visit link\n\n grab_screen \"visited #{link}\"\n current_url.should == link\n\n if page.has_content?('404')\n not_found << link\n next\n end\n\n server_error << link if page.has_content?('500') || page.has_content?('rror') || page.has_content?('ception')\n end\n\n unless not_found.empty? && server_error.empty?\n fail \"The following links responded with status 404: #{not_found.inspect} and these responded with status 500: #{server_error}\"\n end\nend", "def checkAndOpen(url)\n\tuserAgent = \"Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36\"\n\tbegin\n\t\topenURLpage = open(url, {'User-Agent' => userAgent})\n\trescue OpenURI::HTTPError => ex\n\t\tFile.open(\"log.txt\",\"a\") do |f|\n\t \t\tf.write(Time.new.utc.to_s + \" OpenURI Error: \" + ex.to_s + \"\\n\")\n\t\tend\n\t\tabort\n\tend\n\t# abort if page size is less than 10KB\n\tif (openURLpage.size * 0.001) < 10\n\t\tFile.open(\"log.txt\",\"a\") do |f|\n\t \t\tf.write(Time.new.utc.to_s + \" Page Size Error: Page size is \" + (openURLpage.size * 0.001).to_s + \"KB\\n\")\n\t\tend\n\t\tabort\n\tend\n\treturn Nokogiri::HTML(openURLpage)\nend", "def head(request, response)\n OK\n end", "def url_exists?(github_url)\n url = URI.parse(github_url)\n req = Net::HTTP.new(url.host, url.port)\n req.use_ssl = true\n res = req.request_head(url.path)\n if res.is_a?(Net::HTTPRedirection)\n url_exist?(res['location']) # Go after any redirect and make sure you can access the redirected URL\n else\n res.code[0] != '4' # false if http code starts with 4 - error on your side.\n end\nrescue Errno::ENOENT\n false # false if can't find the server\nend", "def test_get_with_host_header\n uri = default_uri\n uri.host = '127.0.0.1'\n res = nil\n\n in_transaction do\n res = get_response(uri.to_s, 'Host' => 'test.local')\n end\n\n assert_match %r{<head>}i, body(res)\n assert_externals_recorded_for('test.local', 'GET')\n end", "def test_p1_00010_aboutpage\n @aboutpage.goto_about_page\n \tassert @browser.body.present?\n assert @aboutpage.about_widget.present?\n @abouturl = @browser.url\n @aboutpage.newline\n end", "def assert_ok\n assert last_response.ok?,\n \"Expected OK from this responses:\\n#{last_response.inspect}\"\n end", "def assert_no_records_match\n sleep 2\n expect(@polaris.login_home_page.text).to include(\"No matching records found\")\n end", "def url_accessibility(url)\n open(url).status.last == 'OK'\n rescue ::SocketError, Timeout::Error, Errno::ECONNREFUSED, OpenURI::HTTPError\n false\n end", "def assert_redirected_to(url, message=nil)\n assert_response :redirect\n assert_equal url, extract_redirection_url, message\n end", "def test_basic_pages\n %w{ free lite hardcore ultimate }.each do |page|\n get page\n assert_response :success\n end\n end", "def check_page(page, page_name)\n Thread.new do\n threads = []\n results = []\n self.class.external_link_uri_strings(page).each do |uri_string|\n SEMAPHORE.synchronize { @links << page }\n wait_to_spawn_thread\n threads << Thread.new do\n begin\n uri = URI(uri_string)\n response = self.class.check_uri(uri)\n response.uri_string = uri_string\n SEMAPHORE.synchronize { results << response }\n rescue => error\n SEMAPHORE.synchronize { results <<\n Error.new( :error => error.to_s, :uri_string => uri_string) }\n end\n end\n end\n threads.each {|thread| thread.join }\n report_results(page_name, results)\n end\n end", "def wait_until_page_loaded(page_name, prev_url)\n time_secs = 0\n while Capybara.current_session.current_url == prev_url\n break if time_secs > PAGE_TIMEOUT_SECS\n sleep 1\n time_secs+=1\n end\n fail \"ERROR: Page #{page_name} failed to load after #{PAGE_TIMEOUT_SECS} secs\" if Capybara.current_session.current_url == prev_url\n end", "def attempt_connection\n conn = Puppet.runtime[:http]\n\n response = conn.get(test_uri, headers: test_headers, options: options)\n unless response.code.to_i == expected_code\n Puppet.notice \"Unable to connect to the server or wrong HTTP code (expected #{expected_code}) (#{test_uri}): [#{response.code}] #{response.reason}\"\n return false\n end\n return true\n rescue StandardError => e\n Puppet.notice \"Unable to connect to the server (#{test_uri}): #{e.message}\"\n return false\n end", "def test_successful_response_code\n process :nothing\n assert @response.success?\n end", "def test_your_words\n get '/catspajamas'\n assert last_response.ok?\n assert_includes last_response.body, \"cats, pajamas\"\n end", "def on_a_fort\n fort_response = Net::HTTP.get_response(URI('http://files.fort/'))\n fort_response.is_a?(Net::HTTPSuccess)\nrescue\n false\nend", "def test_outbound_link\r\n checker=ConsistencyChecker.new(\r\n @linkfinder,\r\n uriFromTest(\"url_retriever/test.htm\")\r\n )\r\n res=newResponse :body=> <<EOF\r\n<html>\r\n<head>\r\n<title>Consistency checker -- foreign domain test</title>\r\n</head>\r\n<body>\r\n<p>This is an example.com domain.</p>\r\n<a href=\"testB.htm\">Test 2</a>\r\n</body>\r\n</html>\r\nEOF\r\n links=checker.check(URI(\"http://www.example.com\"),res)\r\n assert links.empty?\r\n end", "def http_get_direct(url)\n log(\"http get : #{url}\") if $opt[\"debug\"]\n begin\n html = Net::HTTP.get_response(URI.parse(url)).body\n # XXX must fix the rescue its not working\n rescue => err\n log(\"Error: #{err}\")\n exit 2\n end\n html\nend", "def perform_site_check(thesite)\n url = URI.parse(thesite)\n geteverything = Net::HTTP::Get.new(thesite)\n theresponse = Net::HTTP.start(url.host, url.port) { |http|\n http.request(geteverything)\n }\n\n return theresponse.code\nend", "def assert_not_cached(url)\n assert !page_cache_exists?(url), \"#{url} is cached\"\n end", "def load_page()\n page = @mech.get(PARENT + PAGE)\n\n # Catch exception - 404 => Net::HTTPNotFound\n end", "def test_offers\r\n get :offers, :id => 5072\r\n assert_response 301\r\n assert_redirected_to '/Ear-Force-X2-Wireless-Headphones-for-Xbox-reviews'\r\n end", "def test_head_collection\n request = Http::Request.new('HEAD', '/dir')\n response = self.request(request)\n\n assert_equal(200, response.status)\n end", "def test_redirect_url_match\n process :redirect_external\n assert @response.redirect?\n assert @response.redirect_url_match?(\"rubyonrails\")\n assert @response.redirect_url_match?(/rubyonrails/)\n assert !@response.redirect_url_match?(\"phpoffrails\")\n assert !@response.redirect_url_match?(/perloffrails/)\n end", "def check_package (url)\n Net::HTTP.start('dl.iuscommunity.org') do |http|\n http.open_timeout = 2\n http.read_timeout = 2\n http.head(url).code == '200'\n end\nend", "def attempt_connection\n begin\n response = Net::HTTP.get_response(uri)\n unless response.code == \"200\"\n Puppet.notice \"HTTP request (#{uri}) failed: (#{response.code} #{response.body})\"\n return false\n end\n return true\n rescue Errno::ECONNREFUSED => e\n Puppet.notice \"Unable to establish HTTP connection to '#{uri}'; #{e}\"\n return false\n end\n end", "def check_response!\n body[:stat] == 'ok' || fail(ClientError, \"#{ body.inspect }\")\n end", "def test_index_unauthorized\n get :index\n assert_response :redirect\n assert_redirected_to :action => \"login\"\n assert_equal \"Please log in first\", flash[:notice]\n end", "def assert_redirected_to(page_name)\n assert_match(/#{Goldberg.settings.send(page_name).url}$/,\n response.redirected_to)\n end", "def test_blank\n request = stub(\"request\", :path => \"\")\n assert !PageConstraint.new.matches?(request), \"blank request\"\n end", "def ok?(response)\n case response\n when Net::HTTPSuccess\n true\n else\n false\n end\n end" ]
[ "0.7060058", "0.6837437", "0.6837437", "0.67828757", "0.6603641", "0.6550996", "0.6550749", "0.6484186", "0.64726526", "0.64720774", "0.64279705", "0.6350959", "0.62982", "0.62548584", "0.62311", "0.61963177", "0.618093", "0.61547214", "0.61358213", "0.6118504", "0.6114479", "0.61131036", "0.6084632", "0.6077403", "0.6068322", "0.6066077", "0.60445637", "0.6041481", "0.6038473", "0.60053194", "0.5985704", "0.5982656", "0.59770507", "0.5964877", "0.59310704", "0.5924195", "0.59094834", "0.59092885", "0.5899953", "0.5892956", "0.58874476", "0.58865947", "0.5884215", "0.5869891", "0.586937", "0.5869105", "0.58651537", "0.58618385", "0.5858226", "0.58563954", "0.584169", "0.58295023", "0.58159196", "0.581419", "0.5803781", "0.5790033", "0.5780286", "0.577549", "0.5769879", "0.5763256", "0.5756983", "0.5755389", "0.5753557", "0.57505333", "0.57421803", "0.57414126", "0.5732963", "0.571307", "0.56938916", "0.5691911", "0.5685887", "0.5684846", "0.5673904", "0.5668602", "0.5661429", "0.56450427", "0.56434333", "0.56358266", "0.56326544", "0.5631977", "0.5627107", "0.562234", "0.5620185", "0.5618333", "0.561572", "0.5612183", "0.5611707", "0.56053406", "0.55996597", "0.5598107", "0.5597359", "0.5591418", "0.55910164", "0.55834204", "0.55807316", "0.5563655", "0.55625737", "0.55623424", "0.5561183", "0.5558631" ]
0.60112536
29
Asserts that a page cannot be reached, leading to a Net::HTTPNotFound or a Net::HTTPForbidden (403) result
def i_dont_reach(which_page) result = go(which_page) assert (Net::HTTPNotFound===result or Net::HTTPForbidden===result), __last_because + " (can reach #{which_page}: #{result})" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def i_may_not_reach(which_page)\n result = go(which_page)\n assert (Net::HTTPForbidden===result or Net::HTTPBadRequest===result), __last_because + \" (may actually reach #{which_page}: #{result})\"\n end", "def check_url(path, url)\n res = http_client.get(url, follow_redirect: true)\n return if res.status == 200\n raise(nil) unless res.status.to_s.match(/50\\d|403/)\n\n puts \"::warning file=#{path}:: Unexpected response from #{url} (#{res.status})\"\nrescue StandardError => e\n puts \"::warning file=#{path}:: Unable to reach #{url} #{res.respond_to?('status') ? res.status : nil}\"\n puts e.full_message unless e.instance_of?(TypeError)\n 1\nend", "def skipped_test_raises_error_on_invalid_redirect_location\n assert_raise(ArgumentError) {\n http.get \"/redirect-to?url=foo\"\n }\n end", "def test_get_invalid_url1\n get '/param0/param1/param2/param3/param4'\n assert_equal 404, last_response.status\n end", "def test_not_found\n get '/does_not_exist'\n assert_equal 'Try again.', last_response.body\n end", "def test_404_page\n get '/launchpads'\n assert last_response.ok?\n assert last_response.body.include?('Endpoint Not Found')\n end", "def robots_error(url); end", "def test_visit_to_nonexisting_url_tc6\r\n\t\t#redirect input\r\n\r\n\t\tinput = StringIO.new(\"<httpRequests>\\n\"\\\r\n\t\t\t+ \"<httpRequest>http://www.nz-honeynet.org/idontexist.html</httpRequest>\\n\"\\\r\n\t\t\t+ \"</httpRequests>\\n\") \r\n\t\t$stdin = input\r\n\t\t\r\n\t\t#redirect output\r\n\t\tactual_http_response = StringIO.new\r\n\t\t$stdout = actual_http_response\r\n\t\t\r\n\t\texpected_http_response = \"<httpResponses>\\n<httpResponse>\\n<uri>http://www.nz-honeynet.org/idontexist.html</uri>\\n\"\\\r\n\t\t\t+ \"<code>404 - Not Found</code>\\n\"\r\n\t\t\r\n\t\twebBrowser = WebBrowser.new(\"visitor/WebBrowserConfigurationUnitTestDontFollow.xml\")\r\n\t\t$stdout = STDOUT\r\n\t\t\r\n\t\tassert(actual_http_response.string.index(expected_http_response),\\\r\n\t\t\t\"http response not as expected\")\r\n\t\r\n\tend", "def robots_error!(url); end", "def test_invalid_velocity_destiny_unit\n get '/velocity/meter/1/invalid_destiny'\n assert_equal 403, last_response.status\n end", "def test_visit_to_nonexisting_server_tc5\r\n\t\t#redirect input\r\n\t\tinput = StringIO.new(\"<httpRequests>\\n\"\\\r\n\t\t\t+ \"<httpRequest>http://www.isuredontexist3421.com/</httpRequest>\\n\"\\\r\n\t\t\t+ \"<httpRequest>http://www.isuredontexist3421.com/someotherurl.html</httpRequest>\\n\"\\\r\n\t\t\t+ \"</httpRequests>\\n\") \r\n\t\t$stdin = input\r\n\r\n\t\t#redirect output\r\n\t\tactual_http_response = StringIO.new\r\n\t\t$stdout = actual_http_response\r\n\t\t\r\n\t\texpected_http_response1 = \"<code>501 - getaddrinfo\" #original error\r\n\t\texpected_http_response2 = \"<code>501 - host name unknown\" #custom cache error\r\n\t\t\r\n\t\twebBrowser = WebBrowser.new(\"visitor/WebBrowserConfigurationUnitTestDontFollow.xml\")\r\n\t\t$stdout = STDOUT\r\n\t\t\r\n\t\t\r\n\t\terror_response1 = actual_http_response.string.index(expected_http_response1)\r\n\t\terror_response2 = actual_http_response.string.index(expected_http_response2)\r\n\t\t\r\n\t\tassert(error_response1,\"http response1 not as expected.\")\r\n\t\tassert(error_response2,\"http response2 not as expected.\")\r\n\tend", "def expect_forbidden_status\n is_expected.to respond_with 403\n end", "def access_denied\n request.env[\"HTTP_REFERER\"] = journals_path\n yield\n assert_redirected_to root_path\n assert_equal \"You are not authorized to access this page.\", flash[:alert]\n end", "def test_invalid_velocity_value\n get '/velocity/meter/letter/meter'\n assert_equal 403, last_response.status\n end", "def assert_forbidden\n get :index\n\n assert_redirected_to login_path\n assert_equal evaluations_path, session[:return_to]\n assert_equal STRINGS[:not_logged_in], flash[:notice]\n assert_nil @controller.current_user\n end", "def test_invalid_velocity_origin_unit\n get '/velocity/invalid_origin/1/meter'\n assert_equal 403, last_response.status\n end", "def expect_forbidden(response)\n expect(response).to redirect_to(root_url)\nend", "def check_404\n end", "def test_the_page_rejects_nonexisting_identifier\n skip\n visit 'http://localhost:9393/sources/IDENTIFIER/urls/RELATIVE/PATH'\n refute '/sources/IDENTIFIER/urls/RELATIVE/PATH'\n assert_equal 'error page', current_path\n within('#error') do\n assert page.has_content?('The Identifier you are trying to access Does Not Currently Exist')\n end\n end", "def not_found\n raise ActionController::RoutingError.new('Page Not Found. Please contact the system administrator.')\n end", "def assert_invalid_request(method, url, *args)\n assert_raise(AssertRequest::RequestError) { self.send(method.to_s, url.to_s, *args) }\n end", "def cannot_perform_ability(subject, ability, target)\n head(404) \n end", "def not_found\n res = {\n error: 'ost_page_not_found',\n error_display_text: 'Page not found',\n http_code: GlobalConstant::ErrorCode.not_found\n }\n @response = Result::Base.error(res)\n render_error_response_for(@response)\n end", "def not_found\n res = {\n error: 'ost_page_not_found',\n error_display_text: 'Page not found',\n http_code: GlobalConstant::ErrorCode.not_found\n }\n @response = Result::Base.error(res)\n render_error_response_for(@response)\n end", "def not_found\n res = {\n error: 'ost_page_not_found',\n error_display_text: 'Page not found',\n http_code: GlobalConstant::ErrorCode.not_found\n }\n @response = Result::Base.error(res)\n render_error_response_for(@response)\n end", "def page_not_found(exception)\n log_error(exception, request.fullpath)\n render \"errors/page_not_found\"\n end", "def check_error_response(last_response)\n refute_match 'Sinatra doesn&rsquo;t know this ditty', last_response.body, \"unmatched url\"\n end", "def not_found\n render_error status: :not_found, body: 'page not found'\n end", "def not_allowed! redirect = root_url\n raise Exceptional::Unauthorized.new(\"Sorry, I was could not perform the action you requested!\")\n end", "def bots_not_allowed\n render_403('page') if visitor_is_bot?\n end", "def test_if_sdk_page_still_exists?\n uri = URI.parse(SDK_DOWNLOAD_PAGE)\n res = Net::HTTP.get_response(uri)\n assert_equal 200, res.code.to_i\n end", "def test_index_unauthorized\n get :index\n assert_response :redirect\n assert_redirected_to :action => \"login\"\n assert_equal \"Please log in first\", flash[:notice]\n end", "def check_page(base, page, severity=:E, expectedStatus=\"200\", log=true)\n path = base + page\n response = getHTTP(path)\n code = response.code || '?'\n if code != expectedStatus\n test(severity, \"Fetched #{path} - HTTP status: #{code} expected: #{expectedStatus}\") unless severity == nil\n return nil\n end\n I \"Fetched #{path} - OK\" if log\n response.body\nend", "def request_not_found(response)\n response.code == 404 ||\n response['status'] == 'Bad Request' ||\n response.parsed_response['Results']['state'].size == 0\n end", "def i_reach(which_page)\n result = go(which_page)\n assert Net::HTTPSuccess===result, __last_because + \" (cannot actually reach #{which_page}: #{result})\"\n end", "def invalid_url\n redirect_to \"#{request.protocol}#{request.host_with_port}/404.html\"\n end", "def not_found(x, title:\"Not Found\", message:nil)\n begin\n if message.nil? and @runs[:website] and @runs[:website][:page]\n return @runs[:website][:page][:get].call(x, *(x.args))\n end\n rescue => e\n message = e.to_s\n end\n error(x, status: 404, type: \"request\", title: title, message: message)\n end", "def test_missing_response_code\n process :response404\n assert @response.missing?\n end", "def assert_not_cached(url)\n assert !page_cache_exists?(url), \"#{url} is cached\"\n end", "def access_denied\n head 401\n end", "def assert_http_status(curl, status)\n\n # If the status doesn't match, then raise an exception\n if (curl.response_code != status) then\n raise curl.url + ': Expected response of ' + status.to_s + ' but was ' + curl.response_code.to_s\n end\nend", "def handle_error (url, res)\n puts \"#{url} was not found\" if res.code.to_i == 404\n puts \"#{url} requires authorization\" if res.code.to_i == 401\n puts \"#{url} returns an application error\" if res.code.to_i == 500\nend", "def http_code\n 403\n end", "def assert_unauthorized(mock)\n assert_response :unauthorized\n assert_select 'h1', '401 Unauthorized', response.body\n assert_mock mock\n end", "def error!(url)\n robots_txt_for(url).error!\n end", "def status_not_found\n @status = 404\n @e.error 'The requested page does not exist.', 404\n throw :exit\n end", "def not_found?\n @code == 403 or @code == 404\n end", "def error_403\n end", "def error(url)\n robots_txt_for(url).error\n end", "def test_capybara_can_ensure_something_is_not_found\n on_visiting_browserkoans_test_page do\n assert_equal __(false), page.has_selector?('#not-there')\n assert_nothing_raised do\n expect(page).to_not have_selector(__('#not-there'))\n end\n end\n end", "def link_is_existent?(url)\n \tbegin\n\t uri = URI.parse(url)\n \t http_conn = Net::HTTP.new(uri.host, uri.port)\n \t resp, data = http_conn.head(\"/\" , nil)\n \t puts \"=== RESPONSE CODE #{resp.code}\"\n \t resp.code != \"404\"\n \trescue URI::InvalidURIError, Errno::ECONNREFUSED, SocketError\n \t\tfalse\n \tend\n end", "def test_get_invalid_metric_metric1\n get '/metric1/param1/param2/param3'\n assert_equal 404, last_response.status\n end", "def is404\n (Net::HTTPNotFound === response)\n end", "def assert_protected(msg = \"401 Unauthorized: You are not authorized to view this page.\")\n assert_response 401\n assert_equal msg, @response.body\n end", "def should_block_access\n should_respond_with :missing\n should_render_template \"404\"\n should_not_set_the_flash\n end", "def page_not_found\n render 'shared/http_status', formats: [:html], locals: { code: '404', message: HttpStatusHelper::ERROR_CODE['message']['404'] }, status: 404, layout: false\n end", "def error!(url); end", "def assert_on_page(page)\n raise \"page must begin with '/': #{page}\" unless page[0] == ?\\/\n assert \"http://example.org#{page}\" == last_request.url,\n \"Expected to be on page http://example.org#{page} but was on #{last_request.url}\"\n end", "def not_found\n raise ActionController::RoutingError.new('Permalink Not Found')\n end", "def visit_all links\n not_found = []\n server_error = []\n\n links.each do |link|\n puts \"visiting link: #{link}\"\n visit link\n\n grab_screen \"visited #{link}\"\n current_url.should == link\n\n if page.has_content?('404')\n not_found << link\n next\n end\n\n server_error << link if page.has_content?('500') || page.has_content?('rror') || page.has_content?('ception')\n end\n\n unless not_found.empty? && server_error.empty?\n fail \"The following links responded with status 404: #{not_found.inspect} and these responded with status 500: #{server_error}\"\n end\nend", "def render_missing_page\n render :template => \"error/404\", :status => 404\n end", "def access_denied(body = nil)\n error 403, body\n end", "def error(url); end", "def not_found generator, req, res, message = nil\n message ||= \"The page <kbd>#{ERB::Util.h req.path}</kbd> was not found\"\n res.body = generator.generate_servlet_not_found message\n res.status = 404\n end", "def test_handles_failure_to_create_request_object\n if defined?(ActionDispatch::Request)\n ActionDispatch::Request.stubs(:new).raises('bad news')\n\n assert_raises RuntimeError do\n get '/foo/bar?q=12'\n end\n\n assert_equal('unhandled error', last_error.message)\n assert_equal('/foo/bar', last_error.params[:request_uri])\n end\n end", "def assert_authentication_failed\n assert_response :found\n assert_redirected_to new_user_session_path\n end", "def cannot_access_api?\n !request.env[\"REQUEST_METHOD\"].eql?(\"GET\") &&\n !request.headers['mw-token'].eql?(ENV[\"api_access_token\"])\n end", "def rescue_not_found\n render nothing: true, status: 404\n end", "def invisible_testFailure(cg, cgi, state)\n true\nend", "def unavailable! redirect = root_path\n raise Exceptional::NotAllowed.new(\"Sorry, I was unable to perform the action you requested!\")\n end", "def give404(response, msg)\n\tgive_X(response, 404, \"plain/text\", msg)\n end", "def page404(pathname);end", "def valid_url?(url)\n begin\n Net::HTTP.get_response(URI(url)).code == \"200\" ? true : false\n rescue SocketError\n false\n end\nend", "def rescue_unauthorized\n render nothing: true, status: 403\n end", "def rescue_unauthorized\n render nothing: true, status: 403\n end", "def access_denied\n case content_type\n when :html\n store_location\n redirect url(:login)\n when :xml\n basic_authentication.request\n end\n end", "def test_bad_login\r\n\t\tpost :home, :login => 'login', :email => 'god@example.com', :password => 'worsethanyou'\r\n\t\tassert_response :success\r\n\r\n\t\t# make sure the user_id is nil in the session\r\n\t\tassert_nil(session[:user_id])\r\n\tend", "def test_should_not_create_link_via_API_XML\r\n get \"/logout\"\r\n post \"/links.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 page_not_found\n render_404\n end", "def not_found\n raise ActionController::RoutingError.new 'Not found'\n end", "def not_found\n logger.error \"404 from #{request.referer}\"\n render :template => 'errors/404', :status => 404\n end", "def not_found\n respond_with 404\n end", "def page_ok?(config, url)\n uri = URI.parse(url) rescue nil\n (uri.respond_to?(:host) && uri.host =~ config[\"host_re\"] &&\n uri.respond_to?(:path) && uri.path !~ %r{^/b/}).tap do |result|\n if !result\n puts \"Rejecting page #{url} for key #{config[\"key\"]}\"\n end\n end\n end", "def response_not_found\n render status: 404,\n json: {\n source: {\n pointer: request.original_url\n },\n errors: [ { message: \"Not Found\" } ]\n }\n end", "def test_status_code_is_present\n res = get_wrapped_response(default_url)\n\n assert_equal 200, res.status_code\n end", "def not_found\n status 404\n body \"not found\\n\"\n end", "def not_found\n status 404\n body \"not found\\n\"\n end", "def not_found\n status 404\n body \"not found\\n\"\n end", "def redirect_403\n return hit_error(403) unless current_user\n end", "def not_found\n respond_with 404\n end", "def not_found\n raise ActionController::RoutingError.new('Not Found')\n end", "def not_found\n raise ActionController::RoutingError.new('Not Found')\n end", "def not_found\n raise ActionController::RoutingError.new('Not Found')\n end", "def not_found\n raise ActionController::RoutingError.new('Not Found')\n end", "def not_found\n raise ActionController::RoutingError.new('Not Found')\n end", "def not_found\n raise ActionController::RoutingError.new('Not Found')\n end", "def test_offers_not_found\r\n get :offers, :id => '1722342xxx'\r\n assert_response :missing\r\n end", "def reachable?(url)\n page = MetaInspector.new(url)\n\n if page.response.status < 400\n true\n else\n false\n end\n rescue\n false\n end", "def not_found\n raise ActionController::RoutingError.new 'Not Found'\n end", "def expect_page_to_not_have_content(content)\n\n page.should_not have_content(content)\n\n end" ]
[ "0.7737149", "0.72584164", "0.7084957", "0.707849", "0.69714546", "0.69306064", "0.6772716", "0.672265", "0.67165005", "0.66754", "0.66626287", "0.6621195", "0.6571661", "0.65649056", "0.6533863", "0.65250134", "0.650281", "0.64729524", "0.642314", "0.64007586", "0.6384376", "0.6348691", "0.6313361", "0.6313361", "0.6313361", "0.6313352", "0.6259099", "0.6239064", "0.6233635", "0.6228695", "0.621594", "0.6210862", "0.61947423", "0.61928016", "0.6189858", "0.6169727", "0.616778", "0.61636937", "0.61407435", "0.6138537", "0.6132106", "0.6116236", "0.61069524", "0.61020124", "0.6101656", "0.60816187", "0.6077583", "0.60743386", "0.6064909", "0.6064319", "0.6049806", "0.6046973", "0.60396785", "0.6037217", "0.6033564", "0.60292834", "0.6027672", "0.60230166", "0.6007211", "0.60010046", "0.5989474", "0.5982296", "0.59633654", "0.5960182", "0.59438175", "0.59363496", "0.59195995", "0.59179735", "0.5916048", "0.58898455", "0.58827204", "0.58771497", "0.58716047", "0.5860867", "0.5860867", "0.58568084", "0.58565617", "0.58563626", "0.5850142", "0.5846251", "0.5842872", "0.58412164", "0.5830845", "0.58297026", "0.58247685", "0.5815764", "0.5815764", "0.5815764", "0.58126456", "0.5809517", "0.5805027", "0.5805027", "0.5805027", "0.5805027", "0.5805027", "0.5805027", "0.5804425", "0.58010316", "0.5794667", "0.5792987" ]
0.7498706
1
Asserts that a page may not be reached, leading to a Net::HTTPForbidden (403) result.
def i_may_not_reach(which_page) result = go(which_page) assert (Net::HTTPForbidden===result or Net::HTTPBadRequest===result), __last_because + " (may actually reach #{which_page}: #{result})" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def i_dont_reach(which_page)\n result = go(which_page)\n assert (Net::HTTPNotFound===result or Net::HTTPForbidden===result), __last_because + \" (can reach #{which_page}: #{result})\"\n end", "def bots_not_allowed\n render_403('page') if visitor_is_bot?\n end", "def assert_forbidden\n get :index\n\n assert_redirected_to login_path\n assert_equal evaluations_path, session[:return_to]\n assert_equal STRINGS[:not_logged_in], flash[:notice]\n assert_nil @controller.current_user\n end", "def access_denied\n request.env[\"HTTP_REFERER\"] = journals_path\n yield\n assert_redirected_to root_path\n assert_equal \"You are not authorized to access this page.\", flash[:alert]\n end", "def expect_forbidden_status\n is_expected.to respond_with 403\n end", "def expect_forbidden(response)\n expect(response).to redirect_to(root_url)\nend", "def not_allowed! redirect = root_url\n raise Exceptional::Unauthorized.new(\"Sorry, I was could not perform the action you requested!\")\n end", "def skipped_test_raises_error_on_invalid_redirect_location\n assert_raise(ArgumentError) {\n http.get \"/redirect-to?url=foo\"\n }\n end", "def redirect_403\n return hit_error(403) unless current_user\n end", "def check_url(path, url)\n res = http_client.get(url, follow_redirect: true)\n return if res.status == 200\n raise(nil) unless res.status.to_s.match(/50\\d|403/)\n\n puts \"::warning file=#{path}:: Unexpected response from #{url} (#{res.status})\"\nrescue StandardError => e\n puts \"::warning file=#{path}:: Unable to reach #{url} #{res.respond_to?('status') ? res.status : nil}\"\n puts e.full_message unless e.instance_of?(TypeError)\n 1\nend", "def error_403\n end", "def cannot_access_api?\n !request.env[\"REQUEST_METHOD\"].eql?(\"GET\") &&\n !request.headers['mw-token'].eql?(ENV[\"api_access_token\"])\n end", "def forbidden\n respond_with 403\n end", "def post(request, response)\n raise HTTPStatus::Forbidden\n end", "def post(request, response)\n raise HTTPStatus::Forbidden\n end", "def test_invalid_velocity_destiny_unit\n get '/velocity/meter/1/invalid_destiny'\n assert_equal 403, last_response.status\n end", "def assert_user_cant_access(user, actions, params = {})\r\n assert_user_access_check(false, user, actions, params)\r\n end", "def access_denied\n end", "def access_denied(body = nil)\n error 403, body\n end", "def assert_protected(msg = \"401 Unauthorized: You are not authorized to view this page.\")\n assert_response 401\n assert_equal msg, @response.body\n end", "def rescue_unauthorized\n render nothing: true, status: 403\n end", "def rescue_unauthorized\n render nothing: true, status: 403\n end", "def forbidden\n respond_with 403\n end", "def assert_unauthorized(mock)\n assert_response :unauthorized\n assert_select 'h1', '401 Unauthorized', response.body\n assert_mock mock\n end", "def access_denied\n head 401\n end", "def not_authorized\n flash[:error] = I18n.t :forbidden\n response.headers['Status-Code'] = '403'\n redirect_to root_path\n end", "def forbidden!\n render_api_error!('403 Forbidden', 403)\n end", "def test_index_unauthorized\n get :index\n assert_response :redirect\n assert_redirected_to :action => \"login\"\n assert_equal \"Please log in first\", flash[:notice]\n end", "def unavailable! redirect = root_path\n raise Exceptional::NotAllowed.new(\"Sorry, I was unable to perform the action you requested!\")\n end", "def http_code\n 403\n end", "def no_access\n flash[:message] = \"You do not have access to that page.\"\n redirect '/'\n end", "def test_invalid_velocity_value\n get '/velocity/meter/letter/meter'\n assert_equal 403, last_response.status\n end", "def should_block_access\n should_respond_with :missing\n should_render_template \"404\"\n should_not_set_the_flash\n end", "def forbidden\n head :forbidden\n end", "def access_denied\n\n end", "def robots_error!(url); end", "def not_found\n raise ActionController::RoutingError.new('Page Not Found. Please contact the system administrator.')\n end", "def robots_error(url); end", "def cannot_perform_ability(subject, ability, target)\n head(404) \n end", "def status_forbidden\n @status = 403\n end", "def test_invalid_velocity_origin_unit\n get '/velocity/invalid_origin/1/meter'\n assert_equal 403, last_response.status\n end", "def access_denied\n render status: 401, text: \"nice try\"\n end", "def assert_invalid_request(method, url, *args)\n assert_raise(AssertRequest::RequestError) { self.send(method.to_s, url.to_s, *args) }\n end", "def assert_not_cached(url)\n assert !page_cache_exists?(url), \"#{url} is cached\"\n end", "def render_access_denied_page\n # Render fail page\n @meta = {}\n @meta[:title] = \"Access Denied\"\n @meta[:description] = \"You do not have access to this application\"\n render :template => \"pages/app_access_unauthorized\", :layout => 'application', :status => :forbidden\n end", "def test_auth_except\n make_controller :auth_except\n get :index\n assert_response :success\n get :secret_ferret_brigade\n assert_protected\n end", "def error_403\n error_layout 403, '403 Forbidden', %[\n <p>\n You don't have permission to access\n <code>#{h(request.REQUEST_URI)}</code> on this server.\n </p>\n ]\n end", "def hubssolib_access_denied\n # See hubsso_must_login for the reason behind the following call.\n\n if hubssolib_ensure_https\n hubssolib_set_flash(:alert, 'You do not have permission to carry out that action on this site.')\n redirect_to HUB_PATH_PREFIX + '/'\n end\n\n return false\n end", "def access_denied\n case content_type\n when :html\n store_location\n redirect url(:login)\n when :xml\n basic_authentication.request\n end\n end", "def test_visit_to_nonexisting_url_tc6\r\n\t\t#redirect input\r\n\r\n\t\tinput = StringIO.new(\"<httpRequests>\\n\"\\\r\n\t\t\t+ \"<httpRequest>http://www.nz-honeynet.org/idontexist.html</httpRequest>\\n\"\\\r\n\t\t\t+ \"</httpRequests>\\n\") \r\n\t\t$stdin = input\r\n\t\t\r\n\t\t#redirect output\r\n\t\tactual_http_response = StringIO.new\r\n\t\t$stdout = actual_http_response\r\n\t\t\r\n\t\texpected_http_response = \"<httpResponses>\\n<httpResponse>\\n<uri>http://www.nz-honeynet.org/idontexist.html</uri>\\n\"\\\r\n\t\t\t+ \"<code>404 - Not Found</code>\\n\"\r\n\t\t\r\n\t\twebBrowser = WebBrowser.new(\"visitor/WebBrowserConfigurationUnitTestDontFollow.xml\")\r\n\t\t$stdout = STDOUT\r\n\t\t\r\n\t\tassert(actual_http_response.string.index(expected_http_response),\\\r\n\t\t\t\"http response not as expected\")\r\n\t\r\n\tend", "def test_404_page\n get '/launchpads'\n assert last_response.ok?\n assert last_response.body.include?('Endpoint Not Found')\n end", "def test_not_found\n get '/does_not_exist'\n assert_equal 'Try again.', last_response.body\n end", "def respond_with_forbidden(exception = nil, error_code = \"forbidden\")\n msg = exception ? exception.message : \"Forbidden\"\n render partial: \"api/error\", locals: { message: msg, error_code: error_code }, status: 403\n return false\n end", "def forbidden\n\n render_error( :forbidden )\n\n end", "def check_logged\n if not is_logged\n halt(403, 'You must login first')\n end\nend", "def test_the_page_rejects_nonexisting_identifier\n skip\n visit 'http://localhost:9393/sources/IDENTIFIER/urls/RELATIVE/PATH'\n refute '/sources/IDENTIFIER/urls/RELATIVE/PATH'\n assert_equal 'error page', current_path\n within('#error') do\n assert page.has_content?('The Identifier you are trying to access Does Not Currently Exist')\n end\n end", "def permision_denied_error\n error(403, 'Permision Denied!')\n end", "def forbidden_response(env)\n if head_request?(env)\n [ 403, { \"content-type\" => \"text/plain\", \"content-length\" => \"0\" }, [] ]\n else\n [ 403, { \"content-type\" => \"text/plain\", \"content-length\" => \"9\" }, [ \"Forbidden\" ] ]\n end\n end", "def test_get_invalid_url1\n get '/param0/param1/param2/param3/param4'\n assert_equal 404, last_response.status\n end", "def access_denied\n [ 403, {'Content-Type' => 'text/plain', 'Content-Length' => '14'},\n ['Access denied.'] ]\n end", "def should_deny_access\n should_respond_with :redirect\n should_redirect_to(\"the login page\") { login_url }\n should_set_the_flash_to(/Vous devez d'abord ouvrir une session!/i)\n end", "def restrict_access\n head :unauthorized and return false unless current_user\n end", "def test_visit_to_nonexisting_server_tc5\r\n\t\t#redirect input\r\n\t\tinput = StringIO.new(\"<httpRequests>\\n\"\\\r\n\t\t\t+ \"<httpRequest>http://www.isuredontexist3421.com/</httpRequest>\\n\"\\\r\n\t\t\t+ \"<httpRequest>http://www.isuredontexist3421.com/someotherurl.html</httpRequest>\\n\"\\\r\n\t\t\t+ \"</httpRequests>\\n\") \r\n\t\t$stdin = input\r\n\r\n\t\t#redirect output\r\n\t\tactual_http_response = StringIO.new\r\n\t\t$stdout = actual_http_response\r\n\t\t\r\n\t\texpected_http_response1 = \"<code>501 - getaddrinfo\" #original error\r\n\t\texpected_http_response2 = \"<code>501 - host name unknown\" #custom cache error\r\n\t\t\r\n\t\twebBrowser = WebBrowser.new(\"visitor/WebBrowserConfigurationUnitTestDontFollow.xml\")\r\n\t\t$stdout = STDOUT\r\n\t\t\r\n\t\t\r\n\t\terror_response1 = actual_http_response.string.index(expected_http_response1)\r\n\t\terror_response2 = actual_http_response.string.index(expected_http_response2)\r\n\t\t\r\n\t\tassert(error_response1,\"http response1 not as expected.\")\r\n\t\tassert(error_response2,\"http response2 not as expected.\")\r\n\tend", "def test_no_unauthenticated_access\n # make sure that we can't get to 'home'\n assert_nil @request.session[:user]\n get :home\n assert_redirected_to :action => \"login\"\n assert_match /You need to log in/, flash[:message] \n end", "def forbidden(response)\n Forbidden.new.tap { |exception| exception.response = response }\n end", "def require_authorization( message=\"You are not authorized to access this resource.\" )\n\t\tfinish_with( HTTP::FORBIDDEN, message )\n\tend", "def user_not_authorized(exception)\n wiki_policy = exception.policy.class.to_s.underscore\n\n flash[:alert] = \"You are not authorized to do that!\"\n redirect_to(request.referrer || root_path)\n end", "def test_capybara_can_ensure_something_is_not_found\n on_visiting_browserkoans_test_page do\n assert_equal __(false), page.has_selector?('#not-there')\n assert_nothing_raised do\n expect(page).to_not have_selector(__('#not-there'))\n end\n end\n end", "def authorization_denied\n head :unauthorized\n end", "def expect_page_to_not_have_content(content)\n\n page.should_not have_content(content)\n\n end", "def invisible_testFailure(cg, cgi, state)\n true\nend", "def access_denied\n redirect '/login'\n end", "def page_not_found(exception)\n log_error(exception, request.fullpath)\n render \"errors/page_not_found\"\n end", "def deny_access\n if request.xhr?\n if !flash[:ajax_error].blank?\n render text: flash[:ajax_error] \n else\n render text: \"You do not have sufficient permissions to perform this action.\"\n end\n else\n flash[:error] = \"You do not have sufficient permissions to perform this action.\"\n redirect_to :back\n end\n rescue\n redirect_to root_path\n end", "def test_bad_login\r\n\t\tpost :home, :login => 'login', :email => 'god@example.com', :password => 'worsethanyou'\r\n\t\tassert_response :success\r\n\r\n\t\t# make sure the user_id is nil in the session\r\n\t\tassert_nil(session[:user_id])\r\n\tend", "def skip_page!\n raise(SkipPage)\n end", "def throw_unauthorized_page(exception = nil)\n dispatch_error_email(exception)\n if current_user\n flash[:error] = I18n.t('title.page_not_authorized')\n redirect_to NavigationHistory.new(request, session).back(1)\n else\n flash[:error] = I18n.t('title.page_not_authorized_login')\n NavigationHistory.new(request, session).store(:current, :force)\n redirect_to new_user_session_path\n end\n end", "def status_forbidden\n respond_to do |format|\n format.any { head :forbidden }\n end\n end", "def access_denied\n redirect_to main_app.root_url, alert: \"Not authorized\"\n end", "def access_denied!\n render partial: 'errors/401', status: 401 && return\n end", "def permission_denied\n respond_to do |format|\n format.html { render :template => \"shared/forbidden\", :status => :forbidden }\n format.any { head :forbidden }\n end\n end", "def handle_permission_denied(message = 'Permission denied.')\r\n flash[:notice] = message\r\n @web_analytics.page_stack = ['Admin', 'Permission Denied']\r\n @web_analytics.error_page = true\r\n @left_rail_ad_pixels = -1\r\n\r\n if request.xhr?\r\n render :update do |page|\r\n page.redirect_to url_for(:controller => 'access', :action => 'denied')\r\n end\r\n else\r\n render :template => 'common/permission_denied', :status => 403, :layout => 'application'\r\n end\r\n\r\n false\r\n end", "def no_500_error!\n return true if browser.all(:css, 'head title', :text => 'Internal Server Error').empty?\n sleep 30 if ENV['GIMME_CRAP']\n raise Unexpected500, browser.body\n end", "def check_404\n end", "def access_denied(exception)\n redirect_to request.referer || root_path, :alert => exception.message\n end", "def ignore_request_unless_permitted\n return if permitted?\n flash_notice(:permission_denied.t)\n redirect_to(action: \"index_article\") and return\n end", "def redirect_if_forbidden\n redirect_to :controller => \"static\", :action => \"forbidden\" unless is_allowed?\n end", "def umn_access_denied\n redirect_to(login_and_redirect_url)\n end", "def unauthorized_access\n flash[:notice] = \"Unauthorized access\"\n redirect_to \"/\"\n return false\n end", "def deny!\n body = %(This is an unauthorised request. Your IP address has been logged and will be reported.)\n response_headers = { 'Content-Type' => 'text/plain' }\n response = Rack::Response.new(body, 400, response_headers)\n custom! response.finish\n end", "def access_forbidden\n if !@authenticated.nil?\n send_response_document :forbidden\n else\n flash.keep\n authentication_needed!\n end\n end", "def user_not_authorized\n flash[:alert] = \"Access denied.\"\n redirect_to (request.referrer || root_path)\n end", "def forbidden?\n request_path.index(root_dir) != 0\n end", "def assert_on_page(page)\n raise \"page must begin with '/': #{page}\" unless page[0] == ?\\/\n assert \"http://example.org#{page}\" == last_request.url,\n \"Expected to be on page http://example.org#{page} but was on #{last_request.url}\"\n end", "def authority_forbidden(error)\n Authority.logger.warn(error.message)\n redirect_to request.referrer.presence || root_path, :alert => \"Sorry! You attempted to visit a page you do not have access to. If you believe this message to be unjustified, please contact us at <#{Figaro.env.pprn_support_email}>.\"\n end", "def render_forbidden\n render :file => File.join(Rails.root.to_s, 'public/403.html'), :status => :forbidden, :layout => false\n end", "def params_not_permitted\n logger.warn('exception: params not permitted')\n render plain: \"403 ForbiddEn\", status: 403\n end", "def user_not_authorized\n flash[:danger] = \"Access denied.\"\n redirect_to (request.referrer || root_path)\n end", "def permission_denied\n render :template => \"shared/permission_denied\",\n :status => :forbidden\n end", "def assert_require_public_data(msg = \"Shouldn't be able to use API when the user's data is not public\")\n assert_response :forbidden, msg\n assert_equal @response.headers['Error'], \"You must make your edits public to upload new data\", \"Wrong error message\"\n end" ]
[ "0.77923113", "0.7196156", "0.7086012", "0.7011919", "0.6874228", "0.6870177", "0.6847909", "0.6718713", "0.6517071", "0.6511993", "0.6406746", "0.6373354", "0.63517374", "0.6351584", "0.6351584", "0.6340072", "0.6335313", "0.6332222", "0.63061833", "0.62902474", "0.62892973", "0.62892973", "0.6287239", "0.62844557", "0.6282273", "0.62523305", "0.6242214", "0.6232543", "0.6219675", "0.6199467", "0.6185127", "0.61824346", "0.6181576", "0.6175856", "0.61577654", "0.61566013", "0.6151427", "0.61390007", "0.61260176", "0.6119686", "0.61165017", "0.6083785", "0.60786706", "0.60695744", "0.60669637", "0.606308", "0.60592943", "0.60097206", "0.60034776", "0.59766793", "0.59619284", "0.59602183", "0.5958256", "0.59533316", "0.59370756", "0.5905584", "0.59030885", "0.5894588", "0.588816", "0.58726853", "0.58593845", "0.58514863", "0.585005", "0.5847519", "0.5845013", "0.58380204", "0.58335215", "0.58331233", "0.581969", "0.5811266", "0.58074415", "0.5802843", "0.5801443", "0.58003527", "0.5800237", "0.5796993", "0.5794109", "0.578855", "0.5785946", "0.5780483", "0.577399", "0.5769037", "0.5760331", "0.5758106", "0.5753902", "0.574653", "0.5745114", "0.57441425", "0.5741845", "0.5729625", "0.5724312", "0.5721783", "0.57214946", "0.571591", "0.5700801", "0.5699686", "0.5698609", "0.5698162", "0.5686468", "0.56856626" ]
0.8168092
0
About seeing something on the page Asserts that something can be seen on the current page
def i_see(what) assert i_see?(what), __last_because + " (don't see #{what})" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assertHomepage #Assertions for the corresponding page within the corresponding page object class\n expect(page.title).to include(\"TodoMVC\")\n end", "def test_p1_00010_aboutpage\n @aboutpage.goto_about_page\n \tassert @browser.body.present?\n assert @aboutpage.about_widget.present?\n @abouturl = @browser.url\n @aboutpage.newline\n end", "def expect_game_to_be_over\n expect(page).to have_content(\"Your Results\")\n end", "def test_ID_25843_edit_profile_what_i_love_about_your_town\n login_as_user1\n go_to_edit_profile_page\n verify_little_more_about_my_community\n verify_text_can_be_entered_saved_on_about_my_community\n end", "def test_ID_25843_edit_profile_what_i_love_about_your_town\n login_as_user1\n go_to_edit_profile_page\n verify_little_more_about_my_community\n verify_text_can_be_entered_saved_on_about_my_community\n end", "def check_own_page(u)\n login_as(u, scope: :user)\n check_profile_enabled(u)\n\n # Can access profile page from menu bar\n visit root_path\n assert page.has_link?('Your Profile', href: user_path(u))\n end", "def verify_landing_page\n @higgs.page_title_present?('Puppet Enterprise Installer')\n @higgs.link_present?('email the CEO.')\n @higgs.select_link(\"Let's get started\")\n @higgs.page_title_present?('Puppet Enterprise Installer - Choose your deployment')\n end", "def test_00090_about_page_edit_banner_button_for_admin\n @aboutpage.about_login(\"regular\", \"logged\")\n if !@aboutpage.about_widget.present?\n @aboutpage.goto_about_page\n end\n assert @aboutpage.about_edit.present?\n @aboutpage.newline\n end", "def test_00010_home_page_contents\n check_main_menu\n check_bottom_menu\n check_footnote\n end", "def entry_should_be_visible(entry)\n expect(page).to have_css \"#feed-entries #entry-#{entry.id}\"\n within \"#feed-entries #entry-#{entry.id}\" do\n expect(page).to have_text entry.title\n end\nend", "def test_navigation_logged_in\n authorize @valid_user\n get :index\n assert_tag \"a\", :content => /Logout/,\n :attributes => { :href => \"/user/logout\"}\n assert_no_tag \"a\", :content => /Register/\n assert_no_tag \"a\", :content => /Login/\n end", "def assert_first_page\n assert_no_link PREV_LABEL\n end", "def test_ID_25842_edit_profile_a_little_more_about_me\n login_as_user1\n go_to_edit_profile_page\n verify_little_more_about_me_text_optional\n verify_text_can_be_entered_saved_on_little_more_about_me\n end", "def test_ID_25842_edit_profile_a_little_more_about_me\n login_as_user1\n go_to_edit_profile_page\n verify_little_more_about_me_text_optional\n verify_text_can_be_entered_saved_on_little_more_about_me\n end", "def assert_admin(url, session=self)\n session.visit url\n assert ! session.has_content?('Login'), 'Ended up in a login page.'\n assert session.has_content?('TESTSITE')\n assert session.has_css?('#top')\n assert session.has_css?('aside#nav')\n end", "def should_see(text)\n expect(page).to have_content(text)\n end", "def loggedin_menu_displayed\n assert_tag :tag => \"a\", :attributes => { :href => \"/home/index\"}, :content => \"Home\"\n assert_tag :tag => \"a\", :attributes => { :href => \"/users/sign_out\"}, :content => \"Logout\" \n assert_no_tag :tag => \"a\", :content => \"Login\"\n end", "def test_ID_25835_edit_profile_desc\n login_as_user1\n go_to_edit_profile_page\n verify_elements_left_nav \"test_ID_25835_edit_profile_desc\"\n verify_elements_on_edit_profile \"test_ID_25835_edit_profile_desc\"\n end", "def test_ID_25890_published_posts_02\n login_as_user1\n go_to_edit_profile_page\n $profile_your_posts.click\n sleep 5\n $profile_published.when_present(60).click\n verify_text \"test_ID_25890_published_posts\",\"Your Posts\",\"Drafts\", \"Scheduled\", \"Published\",\"Submitted Drafts \",\"Published\"\n verify_elements_on_published_post \"test_ID_25890_published_posts\"\n end", "def url_contains_post_info\r\n expect(on_page(BloggyBluesShowPost).current_url) == \"localhost:8080/BloggyBlues/bloggyblues/show/\"\r\n end", "def test_00020_profilepage_profile_page\n @profile_page.goto_profile\n @browser.wait_until { @profile_page.profile_activity_item.present? }\n\n assert_all_keys({\n :profile_page => @profile_page.profile_page.present?,\n :profile_username_match => @c.users[user_for_test].name == @profile_page.user_name,\n :work_info => @profile_page.profile_workinfo_line.present?,\n :profile_img => @profile_page.profile_img.present?,\n :profile_edit_button => @profile_page.profile_edit_button.present?,\n :profile_activity_item => @profile_page.profile_activity_item.present?,\n :topnav_home => @profile_page.topnav_home.present?,\n :topnav_topic => @profile_page.topnav_topic.present?,\n :topnav_product => @profile_page.topnav_product.present?,\n :topnav_about => @profile_page.topnav_about.present?,\n :topnav_search => @profile_page.topnav_search.present?,\n :topnav_logo => @profile_page.topnav_logo.present?,\n # :browser_title => (@browser.title == \"#{@c.users[user_for_test].name}'s Profile\"),\n })\n \n #TODO\n @profile_page.profile_avatar_img.when_present.hover\n @profile_page.profile_avatar_camera.when_present\n assert @profile_page.profile_avatar_camera.present?\n # comment below assert since it is invisible when no bio\n # assert @profile_page.profile_bioinfo_line.present? \n end", "def assert_basic_layout\n get topic_path(@topic)\n # Posts index is actually topic show.\n assert_template 'posts/index'\n # Assert there is topic title.\n assert_match CGI.escapeHTML(@topic.title), response.body\n # Assert there is current_page/total_pages indicator.\n current_page = assigns(:posts).current_page\n total_pages = assigns(:posts).total_pages\n assert_match CGI.escapeHTML(\"#{current_page}/#{total_pages}\"), response.body\n # Asset there is link to corresponding category.\n assert_select 'a[href=?]', category_path(@topic.category)\n # Assert there is will_paginate on the page.\n assert_select 'ul.pagination', count: 1\n # Assert there is no flash messages.\n assert_flash_notices\n end", "def test_00090_homepage_open_q_conv_link\n @browser.wait_until { @home_page.open_questions_widget.present? }\n @browser.wait_until { @home_page.open_questions_widget.posts.size > 0 }\n\n # verify the title link would redirect to conversation page.\n q_title = @home_page.open_questions_widget.posts[0].title\n @home_page.open_questions_widget.posts[0].click_title_link\n @browser.wait_until { @convdetail_page.conv_detail.present? }\n assert_equal @convdetail_page.conv_title.when_present.text, q_title, \"title doesn't match\"\n\n @home_page.navigate_in\n @browser.wait_until { @home_page.open_questions_widget.posts.size > 0 }\n\n # verify avatar link would redirect to profile page\n @home_page.open_questions_widget.posts[0].click_avatar\n @browser.wait_until { @profile_page.profile_page.present? }\n author_name = @profile_page.profile_page_author_name_betaon.when_present.text\n\n @home_page.navigate_in\n @browser.wait_until { @home_page.open_questions_widget.posts.size > 0 }\n\n # verify author link would redirect to profile page\n @home_page.open_questions_widget.posts[0].click_author_link\n @browser.wait_until { @profile_page.profile_page.present? }\n assert_equal @profile_page.profile_page_author_name_betaon.when_present.text, author_name, \"Author doesn't match\"\n\n @home_page.navigate_in\n @browser.wait_until { @home_page.open_questions_widget.posts.size > 0 }\n\n # verify topic link would redirect to the correct topic page\n post_in_topic = @home_page.open_questions_widget.posts[0].in_topic_link.when_present.text\n\n @home_page.open_questions_widget.posts[0].click_topic_link\n @browser.wait_until { @topicdetail_page.topic_filter.present? }\n assert_equal @topicdetail_page.topic_title.when_present.text, post_in_topic, \"Title doesn't match\"\n end", "def is_on_page? page_text, negation = ''\n should_not_have_exception = false\n should_have_exception = false\n begin\n wait_for(timeout: 5) { has_text? page_text }\n # If negation is not nil, we should raise an error if this message was found on the view\n should_not_have_exception = true unless negation == ''\n rescue\n # only raise exception if negation is nil, otherwise this is the expected behaviour\n should_have_exception = true if negation == ''\n end\n raise \"Unexpected Page. The page should not have: '#{page_text}'\" if should_not_have_exception\n raise \"Unexpected Page. Expected was: '#{page_text}'\" if should_have_exception\n end", "def tour_should_be_visible(title=nil)\n expect(page).to have_css 'div.hopscotch-bubble'\n if title.present?\n within 'div.hopscotch-bubble .hopscotch-title' do\n expect(page).to have_text title\n end\n end\nend", "def test_pageload\n @driver.navigate.to(@url)\n element = @driver.find_element(:class, \"ss-form-title\")\n assert_equal(element.text,\"Basic Web Forms\") # Check if the page open and the title is \"Basic Web Forms\"\n end", "def test_assertions_after_visit\n visit \"/\"\n assert_contain \"Hello World\"\n end", "def test_00030_homepage_topic_widget\n @browser.wait_until { @home_page.home_featured_topic_row.present? }\n assert @home_page.home_featured_topic.present?\n end", "def test_valid_fields\n\t page = pages(:valid_page)\n\t assert page.valid?\n\tend", "def test_show\n herbarium = nybg\n assert_not(herbarium.curator?(mary))\n login(\"mary\")\n get(:show, params: { id: herbarium.id })\n\n assert_displayed_title(herbarium.format_name)\n assert_select(\n \"a[href^='#{new_herbaria_curator_request_path(id: herbarium)}']\",\n { text: :show_herbarium_curator_request.l },\n \"Fungarium page missing a link to #{:show_herbarium_curator_request.l}\"\n )\n end", "def public_menu_displayed\n assert_tag :tag => \"a\", :attributes => { :href => \"/home/index\"}, :content => \"Home\"\n assert_tag :tag => \"a\", :attributes => { :href => \"/users/sign_in\"}, :content => \"Login\"\n assert_no_tag :tag => \"a\", :content => \"Users\"\n assert_no_tag :tag => \"a\", :content => \"Logout\"\n end", "def visit_questionnaire_submission_page questionnaire\n visit submission_questionnaire_path(questionnaire)\n\n assert page.has_content?(questionnaire.questionnaire_fields.first.title)\n assert page.has_content?(\"Submit questionnaire\")\nend", "def verify_persinfo\n\t\t@browser.url == \"https://www.autogravity.com/credit/application/personal\"\n\t\t@browser.div(:visible_text, /Personal Information$/).present?\n\tend", "def test_ID_25890_published_posts_02\n login $user_1_email, $master_password\n go_to_edit_profile_page\n $profiles_your_posts.click\n $profile_published.when_present().click\n sleep 5\n verify_text \"Your Posts\",\"Drafts\", \"Scheduled\", \"Published\"\n assert $profile_published.exists?\n assert $count_of_published.exists?\n end", "def verifyInformationScreen()\n clickOnMoreTab()\n clickOnInformation()\n verifyMeeting()\n end", "def check_redirect(proj)\n visit opening_path(proj)\n assert_text 'You must be logged in to view job openings.'\n assert page.has_css?('title', text: full_title('User Login'), visible: false)\n assert page.has_css?('h1', text: 'User Login')\n end", "def test_it_works\n visit '/'\n assert page.has_content?('It works')\n end", "def test_00010_topicspage_loads\n @topicspage.goto_topics_page\n \tassert @browser.body.present?\n assert @topicspage.topics_grid_view.present?\n end", "def assert_valid_show_page(model, title: nil)\n ctrlr = controller_name(model)\n title = title ? sanitized_string(title) : property(ctrlr, :show, :title)\n heading = title ? { text: title } : {}\n body_css = property(ctrlr, :show, :body_css)\n assert_selector \"body#{body_css}\"\n assert_selector property(ctrlr, :show, :entry_css)\n assert_selector SHOW_HEADING_SELECTOR, **heading\n assert_title title if title\n end", "def test_ID_25841_edit_profile_i_am_a_optional\n login_as_user1\n go_to_edit_profile_page\n verify_i_am_a_text_optional\n verify_text_can_be_entered_saved_on_i_am_a\n end", "def test_homepage\n\t\tget '/'\n\t\tassert last_response.ok?,\n\t\t\t\"Homepage loaded without an error.\"\n\t\tassert last_response.body.include?('Please leave me a message below!'),\n\t\t\t\"Expected text present.\"\n\tend", "def test_index\n get :index\n \n assert_redirected_to :action => :unread\n end", "def assert_not_first_page\n assert_link PREV_LABEL\n end", "def test_reviewer_home\n\n post('index', {}, {})\n assert_response(:success)\n assert_template('tracker/index')\n \n post('index', {}, lee_hweng_session)\n assert_response(:success)\n assert_template('tracker/reviewer_home')\n\n #follow_redirect\n #assert_no_tag :content => \"POST Placement Review\"\n\n end", "def test_ID_25841_edit_profile_i_am_a_optional\n login_as_user1\n go_to_edit_profile_page\n verify_i_am_a_text_optional\n verify_text_can_be_entered_saved_on_i_am_a_textfield\n end", "def XXX_deleted_20150502_test_homepage_is_claim_page_for_now\n get '/'\n assert last_response.ok?\n assert_match /claim your prize/, last_response.body\nend", "def public_menu_displayed\n assert_tag :tag => \"a\", :attributes => { :href => \"/home/index\"}, :content => \"Home\"\n assert_tag :tag => \"a\", :attributes => { :href => \"/users/sign_up\"}, :content => \"Register\"\n assert_tag :tag => \"a\", :attributes => { :href => \"/users/sign_in\"}, :content => \"Login\"\n assert_no_tag :tag => \"a\", :content => \"Contacts\"\n assert_no_tag :tag => \"a\", :content => \"Companies\"\n assert_no_tag :tag => \"a\", :content => \"Calendar\"\n assert_no_tag :tag => \"a\", :content => \"Admin\"\n assert_no_tag :tag => \"a\", :content => \"Logout\"\n end", "def test_00030_view_upcoming_event\n @admin_events_page.start!(user_for_test)\n check_events\n \t@browser.wait_until{ @admin_events_page.first_event_item.present? }\n \ttitle = @admin_events_page.first_event_title.text\n \t# topics = @admin_events_page.first_event_topics.map{ |x|x.inner_html }\n \t@admin_events_page.event_view.click\n @browser.wait_until{ @admin_events_page.pic_view.present? }\n assert @admin_events_page.content_view.text.include? title\n # topics_view = @admin_events_page.related_topics_view.map{ |x|x.inner_html }\n # assert topics.sort == topics_view.sort\n end", "def test_show\n #login_as(:john)\n #get :show, :id => @first_id\n\n #assert_response :success\n #assert_template 'show'\n\n #assert_not_nil assigns(:taverna_enactor)\n #assert assigns(:taverna_enactor).valid?\n \n assert true\n end", "def test_00171_homepage_featured_review_widget\n @browser.wait_until { @home_page.featured_r_widget.present? }\n @browser.wait_until { @home_page.featured_r_widget.posts.size > 0 }\n\n # verify the title link would redirect to conversation page.\n q_title = @home_page.featured_r_widget.posts[0].title\n @home_page.featured_r_widget.posts[0].click_title_link\n @browser.wait_until { @convdetail_page.conv_detail.present? }\n assert_equal @convdetail_page.conv_title.when_present.text, q_title, \"title doesn't match\"\n\n @home_page.navigate_in\n @browser.wait_until { @home_page.featured_r_widget.posts.size > 0 }\n\n # verify avatar link would redirect to profile page\n @home_page.featured_r_widget.posts[0].click_avatar\n @browser.wait_until { @profile_page.profile_page.present? }\n author_name = @profile_page.profile_page_author_name_betaon.when_present.text\n\n @home_page.navigate_in\n @browser.wait_until { @home_page.featured_r_widget.posts.size > 0 }\n\n # verify author link would redirect to profile page\n @home_page.featured_r_widget.posts[0].click_author_link\n @browser.wait_until { @profile_page.profile_page.present? }\n assert_equal @profile_page.profile_page_author_name_betaon.when_present.text, author_name, \"Author doesn't match\"\n\n @home_page.navigate_in\n @browser.wait_until { @home_page.featured_r_widget.posts.size > 0 }\n\n # verify topic link would redirect to the correct topic page\n post_in_topic = @home_page.featured_r_widget.posts[0].in_topic_link.when_present.text\n\n @home_page.featured_r_widget.posts[0].click_topic_link\n @browser.wait_until { @topicdetail_page.topic_filter.present? }\n assert_equal @topicdetail_page.topic_title.when_present.text, post_in_topic, \"Title doesn't match\"\n end", "def tour_should_not_be_visible\n expect(page).not_to have_css 'div.hopscotch-bubble'\nend", "def test_page_security\n # A public page\n get '/home'\n assert_response :success\n # An administrator page\n get '/admin'\n assert_redirected_to_login\n\n form_login('admin', 'admin')\n \n get '/admin'\n assert_response :success\n end", "def test_home\n @current_test_name = \"Arch - Testing Home Page\"\n each_driver do\n each_view_redirects do\n common_elements?\n end\n end\n end", "def test_00140_homepage_featured_q_widget_conv_links\n @browser.wait_until { @home_page.featured_q_widget.present? }\n @browser.wait_until { @home_page.featured_q_widget.posts.size > 0 }\n\n # verify the title link would redirect to conversation page.\n q_title = @home_page.featured_q_widget.posts[0].title\n @home_page.featured_q_widget.posts[0].click_title_link\n @browser.wait_until { @convdetail_page.conv_detail.present? }\n assert_equal @convdetail_page.conv_title.when_present.text, q_title, \"title doesn't match\"\n\n @home_page.navigate_in\n @browser.wait_until { @home_page.featured_q_widget.posts.size > 0 }\n\n # verify avatar link would redirect to profile page\n @home_page.featured_q_widget.posts[0].click_avatar\n @browser.wait_until { @profile_page.profile_page.present? }\n author_name = @profile_page.profile_page_author_name_betaon.when_present.text\n\n @home_page.navigate_in\n @browser.wait_until { @home_page.featured_q_widget.posts.size > 0 }\n\n # verify author link would redirect to profile page\n @home_page.featured_q_widget.posts[0].click_author_link\n @browser.wait_until { @profile_page.profile_page.present? }\n assert_equal @profile_page.profile_page_author_name_betaon.when_present.text, author_name, \"Author doesn't match\"\n\n @home_page.navigate_in\n @browser.wait_until { @home_page.featured_q_widget.posts.size > 0 }\n\n # verify topic link would redirect to the correct topic page\n post_in_topic = @home_page.featured_q_widget.posts[0].in_topic_link.when_present.text\n\n @home_page.featured_q_widget.posts[0].click_topic_link\n @browser.wait_until { @topicdetail_page.topic_filter.present? }\n assert_equal @topicdetail_page.topic_title.when_present.text, post_in_topic, \"Title doesn't match\"\n end", "def test_p1_00010_profilepage_profile_option\n if !@profilepage.profile_activity.present?\n @profilepage.goto_profile\n end\n if @profilepage.profile_pic_modal.present?\n @profilepage.profile_pic_cancel_button.click\n @browser.wait_until($t) { !@profilepage.profile_pic_modal.present? }\n end\n \t@profilepage.check_profile_in_user_dropdown\n \tassert @profilepage.profile_link.present? \n @profilepage.newline\n end", "def guessing?\n ! page.has_content?(\"Your Results\")\n end", "def thelper_assert_has_form_error\n assert page.has_css?('div#errorExplanation')\n end", "def test_home_bk_app\n @driver.navigate.to(@rootURL)\n verify_visible_image_in_css(:css, '.bkDelivers')\n just_verify {assert @driver.find_element(:css, 'section.bkDelivers h3.title').text.include?'APP'}\n just_verify {assert_not_nil @driver.find_element(:css, 'section.bkDelivers h4.subtitle').text}\n end", "def test_text_is_present\n @selenium.open \"/\"\n assert @selenium.text? \"Advanced Search\"\n end", "def test_links_exist\n login_as_valid_user\n puts \"****\"+session[:login].to_s\n \n assert_tag :tag => \"a\",\n :parent => { :tag => \"li\"},\n :descendant => {\n :child => /Project Management/ }\n logout\nend", "def logged_in?\n page.has_selector? \"a\", text: \"Cerrar sesión\"\nend", "def assert_forbidden\n get :index\n\n assert_redirected_to login_path\n assert_equal evaluations_path, session[:return_to]\n assert_equal STRINGS[:not_logged_in], flash[:notice]\n assert_nil @controller.current_user\n end", "def test_int_page\n open_new_tab(Constants::INT_PAGE)\n sleep 5\n button_click(LOCATOR['RWDS_TAB'])\n switch_frame\n button_click(LOCATOR['ERN_PTS'])\n p text_displayed?(LOCATOR['ACT_NM'], 'Account Creation')\n switch_back\n @driver.close\n end", "def entry_should_be_marked_read(entry)\n expect(page).to have_css \"a[data-entry-id='#{entry.id}'].entry-read\"\nend", "def test_00160_homepage_featured_b_widget\n # # @browser.execute_script(\"window.scrollBy(0,8000)\")\n # @browser.wait_until { @home_page.home_featured_blog.present? }\n # assert @home_page.home_featured_blog.present?\n # assert @home_page.home_featured_b_desc.present?\n @browser.wait_until { @home_page.featured_b_widget.present? }\n @browser.wait_until { @home_page.featured_b_widget.posts.size > 0 }\n\n # verify the title link would redirect to conversation page.\n q_title = @home_page.featured_b_widget.posts[0].title\n @home_page.featured_b_widget.posts[0].click_title_link\n @browser.wait_until { @convdetail_page.conv_detail.present? }\n assert_equal @convdetail_page.conv_title.when_present.text, q_title, \"title doesn't match\"\n\n @home_page.navigate_in\n @browser.wait_until { @home_page.featured_b_widget.posts.size > 0 }\n\n # verify avatar link would redirect to profile page\n @home_page.featured_b_widget.posts[0].click_avatar\n @browser.wait_until { @profile_page.profile_page.present? }\n author_name = @profile_page.profile_page_author_name_betaon.when_present.text\n\n @home_page.navigate_in\n @browser.wait_until { @home_page.featured_b_widget.posts.size > 0 }\n\n # verify author link would redirect to profile page\n @home_page.featured_b_widget.posts[0].click_author_link\n @browser.wait_until { @profile_page.profile_page.present? }\n assert_equal @profile_page.profile_page_author_name_betaon.when_present.text, author_name, \"Author doesn't match\"\n\n @home_page.navigate_in\n @browser.wait_until { @home_page.featured_b_widget.posts.size > 0 }\n\n # verify topic link would redirect to the correct topic page\n post_in_topic = @home_page.featured_b_widget.posts[0].in_topic_link.when_present.text\n\n @home_page.featured_b_widget.posts[0].click_topic_link\n @browser.wait_until { @topicdetail_page.topic_filter.present? }\n assert_equal @topicdetail_page.topic_title.when_present.text, post_in_topic, \"Title doesn't match\"\n end", "def admin_should_be_logged_in\n page.should have_content('Log Out')\n end", "def test_01login\n $objBasePage.setup()\n $objLoginPage.getUrl()\n actualTitle=$objLoginPage.getTitle()\n expectedTitle=\"OrangeHRM\"\n assert_equal(expectedTitle,actualTitle, \"Title of page doesn't match\")\n puts \"Login test pass\"\n end", "def test_00130_profilepage_check_activity_feed_link\n @profile_page.goto_profile\n @browser.wait_until { @profile_page.profile_activity_item.present? }\n\n @browser.wait_until { @profile_page.question_list_in_activity_pane.activity_list.size > 0 }\n activity_card = @profile_page.question_list_in_activity_pane.activity_list[0]\n conv = activity_card.conv_title\n activity_card.click_conv_link\n\n @browser.wait_until { @convdetail_page.convdetail.present? }\n assert @convdetail_page.convdetail.text.include? conv\n end", "def test_05_1_show_me_how_TC_24406\n\t\t\n\t\tprofileLogin\n\t\t$browser.goto($patch_note)\n\t\t$help_post_note.when_present.click\n\t\tsleep 4 \n\t\t$browser.window(:title, /Post a Note/).use do\n\t\t\n\t\tbegin\n\t\tassert $browser.text.include?(\"Post a Note\")\n\t\trescue => e\n\t\t\tputs e\n\t\tputs \"J1_T5.1: FAILED! User unable to navigate to zendesk.\"\n\t\tend\n\t\tend\n\tend", "def entry_should_not_be_visible(entry)\n expect(page).to have_no_css \"#feed-entries #entry-#{entry.id}\"\nend", "def should_see_dashboard\n expect(page).to have_selector(\"#dashboard\")\n end", "def then_i_can_see_a_header_section\n expect(page).to have_content(I18n.t(\"coronavirus.pages.show.header_section.title\"))\n end", "def check_another_user(url, session:)\n session.visit(url)\n marys_draft = NameDescription.last\n assert(session.has_link?(href: name_description_path(marys_draft.id)))\n session.first(:link, href: name_description_path(marys_draft.id)).click\n assert_flash_error(session: session)\n end", "def verify_home_page\n home_header_tag = \"Welcome to Valley Wine Works\"\n\n @driver.find_element(:id, \"home_lodi_wine_business_solutions\").click\n assert_equal home_header_tag, @driver.find_element(:css, \"#main > h1\").text\n puts \"INFO: Home text = #{@driver.find_element(:css, \"#main > h1\").text}\"\n puts \"PASS: home page was loaded successfully\"\n end", "def test_00120_profilepage_check_new_activity_feed\n @topicdetail_page = @topiclist_page.go_to_topic(\"A Watir Topic\")\n title = \"Test q created by Watir - #{get_timestamp}\"\n @topicdetail_page.create_conversation(type: :question,\n title: title,\n details: [{type: :text, content: \"Watir test description\"}])\n\n @profile_page.goto_profile\n @browser.wait_until { !@profile_page.question_list_in_activity_pane.activity_at_title(title).nil? }\n activity_card = @profile_page.question_list_in_activity_pane.activity_at_title(title)\n activity_card.click_conv_link\n @browser.wait_until { @convdetail_page.convdetail.present? }\n assert @convdetail_page.root_post_title.text =~ /#{title}/ \n end", "def check_element_presence(access_type, access_name, test_case)\n expect(is_element_displayed(access_type, access_name)).to be test_case\nend", "def entry_should_be_open(entry)\n expect(page).to have_css \"div#entry-#{entry.id} div#entry-#{entry.id}-summary.entry_open\"\nend", "def test_should_flag_ON_INIT_PAGE_NEXT_when_clicking_next_on_valid_init_page\n post :init, :user=>{:first_name=>field_first_name, :last_name=>field_last_name}, :commit=>:next\n #assert_redirected_to :action=>second_page\n assert assigns['on_init_page_next']\n end", "def verifyStoryAdminLinks()\n\t\n\tputs \"************** START: Verify PRO page Links ****************\"\n\t\n\tputs \"Step 1 : Click on EditPage link on the Story page.\"\n\t$browser.click \"link=Edit\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Tell Your Story\")\n\t\tputs \"Step 1 is Passed. User has reached the EditPage screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 1 is Failed. User had failed to reach EditPage screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 3 : Click on Matching Grants link on the Story page.\"\n\t$browser.click \"link=Matching Grants\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Set Up a Matching Grant\")\n\t\tputs \"Step 3 is Passed. User has reached the Matching Grants screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 3 is Failed. User had failed to reach Matching Grants screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\t\n\tputs \"Step 6 : Click on Donations link on the Story page.\"\n\t$browser.click \"link=Donations\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Donations Listing\")\n\t\tputs \"Step 6 is Passed. User has reached the Donations screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 6 is Failed. User had failed to reach Donations screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"************** END: Verify PRO page Links ****************\"\n\t\nend", "def check_if_back_button_is_displayed\n\n page.should have_button(BACK_BUTTON)\n sleep(THREAD_SLEEP_1)\n\n end", "def check_list_title_should_be_displayed(title)\n expect(page).to have_selector 'h1', text: title\n end", "def test_capybara_can_find_element\n on_visiting_browserkoans_test_page do\n assert_equal __(true), page.has_selector?('#mypara')\n assert_nothing_raised do\n expect(page).to have_selector(__('#mypara'))\n end\n end\n end", "def check_another_student(url, session:)\n session.visit(url)\n marys_draft = NameDescription.last\n session.first(:link, href: name_description_path(marys_draft.id)).click\n assert(\n session.has_no_link?(href: edit_name_description_path(marys_draft.id))\n )\n session.assert_no_selector(\n class: \"destroy_name_description_link_#{marys_draft.id}\"\n )\n end", "def test03_EventLanding_Headers #to be deprecated once page objects is complete\n\t\tlogin $user_1_email, $master_password\n\t\tsleep 3\n\t\t$home_see_all_events.click\n\t\tsleep 4\n\t\t\n\t\tassert $events_all_events_header.exists?\n\t\t\n\t\t$events_family.click\n\t\tsleep 1\n\t\tassert $events_family_header.exists?\n\t\t\n\t\t$events_free.click\n\t\tsleep 1\n\t\tassert $events_free_header.exists?\n\t\t\n\t\t$events_this_weekend.click\n\t\tsleep 1\n\t\tassert $events_this_weekend_header.exists?\n\tend", "def on_page?\n raise NotImplementedError, \"implement me, e.g. using #has_title?\"\n end", "def verifyAttendeesDisplayed()\n attendees= attendeesDisplayed()\n assert_equal attendees, true, \"In people screen attendees should be shown\"\n end", "def test_has_content\n assert(!@contentless_post.has_content?)\n end", "def test_003\n open_pu_management_page\n assert is_element_present(xpath[\"pu_management\"][\"search_box\"])\n assert is_element_present(xpath[\"pu_management\"][\"pu_table\"])\n logout\n end", "def assert_on_page(page)\n raise \"page must begin with '/': #{page}\" unless page[0] == ?\\/\n assert \"http://example.org#{page}\" == last_request.url,\n \"Expected to be on page http://example.org#{page} but was on #{last_request.url}\"\n end", "def test_login_controls\n get :login_controls\n assert_response :success\n assert_nil session[:user]\n end", "def assert_valid_action_page(model, action, **opt)\n prop = property(model, action)&.slice(:title, :heading)\n opt.reverse_merge!(prop) if prop.present?\n assert_valid_page(**opt)\n end", "def assert_no_records_match\n sleep 2\n expect(@polaris.login_home_page.text).to include(\"No matching records found\")\n end", "def check_if_joined_button_is_visible\n\n page.should have_selector(JOINED_BUTTON_FANZONE_VIEW)\n\n end", "def test_public_page_titles\n @selenium.open \"/\"\n assert_equal \"Google\", @selenium.title\n end", "def member_can_view_profile_form\n visit profile_path\n expect(page).to have_content(\"My Profile\")\n end", "def member_can_view_profile_form\n visit profile_path\n expect(page).to have_content(\"My Profile\")\n end", "def test_should_show_list_root_if_invalid\n login_as :admin\n\n # Invalid name.\n get :list, :id => \"INVALID\"\n assert_response :success\n assert_template 'list'\n assert_equal assigns(:title), \"Manage Tags\"\n assert_not_nil assigns(:tags)\n assert_select \"div#flash\"\n end", "def assert_consult_read_only_message\n expect(@polaris.login_home_page.text).to include(\"This approved form is in read-only mode\")\n end", "def test_capybara_can_ensure_something_is_not_found\n on_visiting_browserkoans_test_page do\n assert_equal __(false), page.has_selector?('#not-there')\n assert_nothing_raised do\n expect(page).to_not have_selector(__('#not-there'))\n end\n end\n end", "def show_read\n find('#show-read').click\n\n # Ensure entries have finished loading\n expect(page).to have_no_css 'div#loading'\nend", "def entry_should_be_marked_unread(entry)\n expect(page).to have_css \"a[data-entry-id='#{entry.id}'].entry-unread\"\nend" ]
[ "0.70692956", "0.70179796", "0.68485636", "0.67491496", "0.67491496", "0.67294014", "0.6668216", "0.6662455", "0.66601545", "0.66525555", "0.66165525", "0.6615059", "0.6590222", "0.6590222", "0.65801567", "0.6571386", "0.65680563", "0.65601003", "0.6541923", "0.6514346", "0.6499739", "0.64972645", "0.6497244", "0.6497241", "0.64819694", "0.6478856", "0.6446598", "0.6436522", "0.6435166", "0.64335805", "0.6429721", "0.64273417", "0.64177406", "0.6414846", "0.63829875", "0.637856", "0.6373755", "0.63737", "0.6361527", "0.63333595", "0.6326485", "0.63207114", "0.6320328", "0.6318487", "0.6315867", "0.6309747", "0.63084024", "0.62910795", "0.628518", "0.6279893", "0.6274281", "0.6271194", "0.6261881", "0.62610257", "0.6254411", "0.6241539", "0.6239593", "0.62320673", "0.6207731", "0.6207653", "0.62000483", "0.61989164", "0.6194732", "0.6193876", "0.6173727", "0.6162805", "0.61602145", "0.61568356", "0.6150821", "0.61457723", "0.6145728", "0.61428744", "0.6140789", "0.6138771", "0.61378926", "0.613284", "0.61269104", "0.6126232", "0.6115285", "0.6106959", "0.61005896", "0.6089939", "0.60822225", "0.6078805", "0.60772735", "0.6063019", "0.6054264", "0.60501075", "0.60472596", "0.6044891", "0.6044597", "0.6040987", "0.6036423", "0.60360205", "0.60306585", "0.60306585", "0.6028876", "0.60283744", "0.6026831", "0.60246485", "0.60169655" ]
0.0
-1
Asserts that something is not present on the current page
def i_dont_see(what) assert !i_see?(what), __last_because + " (actually see #{what})" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_capybara_can_ensure_something_is_not_found\n on_visiting_browserkoans_test_page do\n assert_equal __(false), page.has_selector?('#not-there')\n assert_nothing_raised do\n expect(page).to_not have_selector(__('#not-there'))\n end\n end\n end", "def expect_page_to_not_have_content(content)\n\n page.should_not have_content(content)\n\n end", "def assert_not_first_page\n assert_link PREV_LABEL\n end", "def entry_should_not_be_visible(entry)\n expect(page).to have_no_css \"#feed-entries #entry-#{entry.id}\"\nend", "def test_the_page_rejects_nonexisting_identifier\n skip\n visit 'http://localhost:9393/sources/IDENTIFIER/urls/RELATIVE/PATH'\n refute '/sources/IDENTIFIER/urls/RELATIVE/PATH'\n assert_equal 'error page', current_path\n within('#error') do\n assert page.has_content?('The Identifier you are trying to access Does Not Currently Exist')\n end\n end", "def should_not_exist\n $tracer.trace(format_method(__method__))\n @name_link.should_not_exist && @remove_button.should_not_exist\n end", "def should_not_exist\n $tracer.trace(format_method(__method__))\n @name_links.should_not_exist && @remove_buttons.should_not_exist\n end", "def tour_should_not_be_visible\n expect(page).not_to have_css 'div.hopscotch-bubble'\nend", "def assert_not_last_page\n assert_link NEXT_LABEL\n end", "def sign_up_button_should_not_be_visible\n\n page.should_not have_text(SIGN_UP_BUTTON_TEXT)\n\n end", "def assert_no_records_match\n sleep 2\n expect(@polaris.login_home_page.text).to include(\"No matching records found\")\n end", "def apartment_order_form_not_present?\n within(\".main\") do\n expect(page).not_to have_content(I18n.t('retail_order.staff_order_type'))\n expect(page).not_to have_content(I18n.t('retail_order.personal_order'))\n expect(page).not_to have_content(I18n.t('retail_order.apartment_order'))\n expect(page).not_to have_content(I18n.t('retail_order.customer_id'))\n expect(page).not_to have_content(I18n.t('retail_order.trade_discount'))\n expect(page).not_to have_content(I18n.t('retail_order.shipping_method'))\n expect(page).not_to have_content(I18n.t('retail_order.carry_out'))\n expect(page).not_to have_content(I18n.t('retail_order.messenger_service'))\n expect(page).not_to have_content(I18n.t('retail_order.pack_out'))\n expect(page).not_to have_content(I18n.t('retail_order.internal_comments'))\n expect(page).not_to have_content('apartment_customer@elanstudio.com')\n expect(page).not_to have_content('internal comments for a customer ordering from the apartment')\n end\nend", "def assert_not_cached(url)\n assert !page_cache_exists?(url), \"#{url} is cached\"\n end", "def assert_first_page\n assert_no_link PREV_LABEL\n end", "def login_button_should_not_be_visible\n\n page.should_not have_text(LOGIN_BUTTON_TEXT)\n\n end", "def assert_element_not_present(locator)\n wait_for(:message => \"Expected element '#{locator}' not to be present, but it was\") do\n !selenium.is_element_present(locator)\n end\n end", "def admin_should_not_be_logged_in\n page.should_not have_content('Log Out')\n end", "def back_button_should_not_be_displayed\n\n page.should_not have_button(BACK_BUTTON)\n sleep(THREAD_SLEEP_1)\n\n end", "def assert_forbidden\n get :index\n\n assert_redirected_to login_path\n assert_equal evaluations_path, session[:return_to]\n assert_equal STRINGS[:not_logged_in], flash[:notice]\n assert_nil @controller.current_user\n end", "def your_league_pop_up_should_not_be_displayed\n\n page.should_not have_content(read_file_content(YOUR_LEAGUES))\n sleep(THREAD_SLEEP_1)\n\n end", "def assert_no_missing_translations(msg = \"\")\n assert_select \"span[class=translation_missing]\", false, \"Missing translation #{msg}\"\n end", "def user_should_not_be_logged_in\n expect(page).to have_no_css 'div.navbar div.navbar-inner ul li a#sign_out', visible: false\nend", "def is_on_page? page_text, negation = ''\n should_not_have_exception = false\n should_have_exception = false\n begin\n wait_for(timeout: 5) { has_text? page_text }\n # If negation is not nil, we should raise an error if this message was found on the view\n should_not_have_exception = true unless negation == ''\n rescue\n # only raise exception if negation is nil, otherwise this is the expected behaviour\n should_have_exception = true if negation == ''\n end\n raise \"Unexpected Page. The page should not have: '#{page_text}'\" if should_not_have_exception\n raise \"Unexpected Page. Expected was: '#{page_text}'\" if should_have_exception\n end", "def tolerate_not_found\n begin\n yield\n rescue Capybara::ElementNotFound\n nil\n end\n end", "def assert_no_xpath(html, *args, &block)\n matcher = have_xpath(*args, &block)\n assert !matcher.matches?(send(__response_accessor).body), matcher.negative_failure_message\n end", "def assert_does_not_contain(*args)\n matcher = contain(*args)\n assert !matcher.matches?(send(__response_accessor).body), matcher.negative_failure_message\n end", "def entry_should_not_be_highlighted(entry)\n entry_should_be_visible entry\n within \"#feed-entries #entry-#{entry.id}\" do\n expect(page).not_to have_css 'a.open-entry-link.highlighted-entry'\n expect(page).not_to have_css 'i.fa-caret-right.current-entry', visible: true\n end\nend", "def test_no_login\r\n\t\tget :home\r\n\t\tassert_response :success\r\n\r\n\t\t# make sure the user_id is nil in the session\r\n\t\tassert_nil(session[:user_id])\r\n\tend", "def assert_no_app_error\n assert_nil flash[:error]\n end", "def i_may_not_reach(which_page)\n result = go(which_page)\n assert (Net::HTTPForbidden===result or Net::HTTPBadRequest===result), __last_because + \" (may actually reach #{which_page}: #{result})\"\n end", "def assert_last_page\n assert_no_link NEXT_LABEL\n end", "def assert_no_tag(*opts)\n clean_backtrace do\n opts = opts.size > 1 ? opts.last.merge({ :tag => opts.first.to_s }) : opts.first\n tag = find_tag(opts)\n assert !tag, \"expected no tag, but found tag matching #{opts.inspect} in:\\n#{@session.response.body.inspect}\"\n end\n end", "def class_css_element_is_not_displayed(selector)\n\n page.should_not have_selector(selector)\n\n end", "def thelper_assert_has_form_error\n assert page.has_css?('div#errorExplanation')\n end", "def join_public_league_pop_up_should_not_be_displayed\n\n page.should_not have_content(read_file_content(JOIN_A_PUBLIC_LEAGUE_PATH))\n sleep(THREAD_SLEEP_1)\n\n end", "def access_denied\n request.env[\"HTTP_REFERER\"] = journals_path\n yield\n assert_redirected_to root_path\n assert_equal \"You are not authorized to access this page.\", flash[:alert]\n end", "def non_existing_cart\n\t\t# A user goes to the orders page\n\t\tget \"/orders/243233\"\n\n\t\t# He is re directed to store index with a error message at the top of the page\n\t\tassert_redirected_to store_url\n\t\tassert_equal 'Invalid order', flash[:notice]\n\n\t\t# An email is sent to the Administrator telling the error had occured.\n\t\tmail = ActionMailer::Base.deliveries.last\n\t\tassert_equal [\"marcotello@grupovidanta.com\"], mail.to\n\t\tassert_equal 'Depot Application <depot@example.com>', mail[:from].value\n\t\tassert_equal 'Pragmatic Store Error Raised', mail.subject\n\n\tend", "def test_cannot_see_donee_wish_if_is_not_donee\n nonshared_wish=create_nonshared_wish\n \n get :show, {user_id: @current_user.id, id: nonshared_wish.id}\n\n assert_response :not_found\n end", "def create_your_own_league_pop_up_should_not_be_displayed\n\n page.should_not have_content(read_file_content(CREATE_YOUR_OWN_LEAGUE_PATH))\n sleep(THREAD_SLEEP_1)\n\n end", "def join_private_league_pop_up_should_not_be_displayed\n\n page.should_not have_content(read_file_content(JOIN_A_PRIVATE_LEAGUE_PATH))\n sleep(THREAD_SLEEP_1)\n\n end", "def non_existing_cart\n\t\t# A user goes to the orders page\n\t\tget \"/carts/243233\"\n\n\t\t# He is re directed to store index with a error message at the top of the page\n\t\tassert_redirected_to store_url\n\t\tassert_equal 'Invalid cart', flash[:notice]\n\n\t\t# An email is sent to the Administrator telling the error had occured.\n\t\tmail = ActionMailer::Base.deliveries.last\n\t\tassert_equal [\"marcotello@grupovidanta.com\"], mail.to\n\t\tassert_equal 'Depot Application <depot@example.com>', mail[:from].value\n\t\tassert_equal 'Pragmatic Store Error Raised', mail.subject\n\n\tend", "def assert_element_does_not_contain(locator, text, options={})\n element(locator).assert_does_not_contain(text, options)\n end", "def assert_have_no_selector(expected)\n hs = HaveSelector.new(expected)\n assert !hs.matches?(response_body), hs.negative_failure_message\n end", "def test_not_found\n get '/does_not_exist'\n assert_equal 'Try again.', last_response.body\n end", "def assert_dashboard_widget_hidden\n expect(page).to_not have_selector('.confirm-account')\n\n # Empty Dashboard Cell\n expect(page).to have_selector('p', text: t('dashboard.empty.display.empty_message'))\n end", "def assert_no_cookie(name)\n assert !cookies[name.to_s]\n end", "def assert_not(assertion, fail_desc = nil)\n assert(!assertion, fail_desc) do\n \"Failed assert_not: assertion was \"\\\n \"`#{Assert::U.show(assertion, __assert_config__)}`.\"\n end\n end", "def i_dont_reach(which_page)\n result = go(which_page)\n assert (Net::HTTPNotFound===result or Net::HTTPForbidden===result), __last_because + \" (can reach #{which_page}: #{result})\"\n end", "def assertNotEqualTest expected, value\n assertNotEqual expected, value\n end", "def test_that_find_by_url_finds_us_when_nothing_else_matches\n assert_equal @page, @root.find_by_url(\"a/page\")\n end", "def assert_no_test_warnings\n refute has_test_warnings?(@review)\n end", "def assert_not_checked(locator)\n assert_element_present locator\n wait_for(:message => \"Expected '#{locator}' not to be checked\") do\n !selenium.is_checked(locator)\n end\n end", "def assert_text_not_present(pattern, message = \"Expected '#{pattern}' to be absent, but it was present\", options = {})\n wait_for({:message => message}.merge(options)) do\n !selenium.is_text_present(pattern)\n end\n end", "def refute(value)\n assert !value\n end", "def make_your_predictions_pop_up_should_not_be_displayed\n\n page.should_not have_content(read_file_content(MAKE_YOUR_PREDICTIONS_PATH))\n sleep(THREAD_SLEEP_1)\n\n end", "def start_link_should_not_be_highlighted\n within '#sidebar' do\n expect(page).not_to have_css 'a#start-page.highlighted-link'\n end\nend", "def assert_no_session\n assert_nil @cookies[\"camping_sid\"], \n \"A session cookie was sent although this should not happen\"\n end", "def test_unexistent_non_member_registering\n\t\tregistering_non_member = Enrollment.new(:participantID => \"abc12345\", :courseID => \"yoga0123\")\n\t\tassert Course.find_by(courseID: registering_non_member.courseID), \"Course is not in Courses database\"\n\t\tassert !Participant.find_by(participantID: registering_non_member.participantID), \"non existent non member was found in Participant database\"\n\tend", "def test_index_unauthorized\n get :index\n assert_response :redirect\n assert_redirected_to :action => \"login\"\n assert_equal \"Please log in first\", flash[:notice]\n end", "def has_no_field_value?(locator, text)\n if find_field(locator).value != text\n true\n else\n raise Capybara::ExpectationNotMet, \"expected to not find field #{locator} with a value of #{text}.\"\n end\n end", "def test_blank\n request = stub(\"request\", :path => \"\")\n assert !PageConstraint.new.matches?(request), \"blank request\"\n end", "def assert_have_no_selector(expected)\n hs = HaveSelector.new(expected)\n assert !hs.matches?(response), hs.negative_failure_message\n end", "def element_should_not_be_visible(loc)\n raise(Exception::ElementVisibilityError, \"The element described by #{parse_location(loc)} is visible erroneously.\") if\n @browser.element(parse_location(loc)).visible?\n end", "def test_no_unauthenticated_access\n # make sure that we can't get to 'home'\n assert_nil @request.session[:user]\n get :home\n assert_redirected_to :action => \"login\"\n assert_match /You need to log in/, flash[:message] \n end", "def assert_does_not_contain(collection, x) # :nodoc:\n !assert_contains(collection, x)\n end", "def assert_not_in_body(*strings)\n strings.each do |string|\n assert last_response.body.index(string).nil?,\n \"Did not expect '#{string}' to be in last_response.body\"\n end\n end", "def assertNilTest value\n assertNil value\n end", "def test_404_page\n get '/launchpads'\n assert last_response.ok?\n assert last_response.body.include?('Endpoint Not Found')\n end", "def feed_link_should_not_be_highlighted(feed)\n within '#sidebar #folders-list' do\n expect(page).not_to have_css \"a[data-feed-id='#{feed.id}'].highlighted-link\"\n end\nend", "def test_bounce_not_logged_in\n get :panel\n assert_redirected_to :controller => \"users\", :action => \"login\"\n end", "def assert_dom_not_equal(expected, actual, message = nil, strict: false, html_version: nil)\n expected_dom, actual_dom = fragment(expected, html_version: html_version), fragment(actual, html_version: html_version)\n message ||= \"Expected: #{expected}\\nActual: #{actual}\"\n assert_not compare_doms(expected_dom, actual_dom, strict), message\n end", "def assert_no_vote_links_for(topic)\n get topic_path(topic)\n assert_select 'a[href=?]',\n topic_votes_path(resource_id: topic.id, value: 1), count: 1\n assert_select 'a[href=?]',\n topic_votes_path(resource_id: topic.id, value: -1), count: 1\n end", "def assert_dom_not_equal(expected, actual, message=\"\")\n clean_backtrace do\n expected_dom = HTML::Document.new(expected).root\n actual_dom = HTML::Document.new(actual).root\n full_message = build_message(message, \"<?> expected to be != to\\n<?>.\", expected_dom.to_s, actual_dom.to_s)\n assert_block(full_message) { expected_dom != actual_dom }\n end\n end", "def test_nonexistence\n record_not_found = false\n begin\n not_there = User.find(999999999)\n rescue ActiveRecord::RecordNotFound\n record_not_found = true\n end\n assert record_not_found\n end", "def test_004\n open_pu_management_page\n assert is_element_present(xpath[\"pu_management\"][\"pu_table\"])\n logout\nend", "def should_hide_alert(alert_id)\n expect(page).to have_no_css \"div##{alert_id}\", visible: true\nend", "def test_should_show_list_root_if_invalid\n login_as :admin\n\n # Invalid name.\n get :list, :id => \"INVALID\"\n assert_response :success\n assert_template 'list'\n assert_equal assigns(:title), \"Manage Tags\"\n assert_not_nil assigns(:tags)\n assert_select \"div#flash\"\n end", "def test_login_no_data\n get 'index'\n assert assigns['question']\n assert_response :success\n assert flash['answer']\n end", "def test_bad_login\r\n\t\tpost :home, :login => 'login', :email => 'god@example.com', :password => 'worsethanyou'\r\n\t\tassert_response :success\r\n\r\n\t\t# make sure the user_id is nil in the session\r\n\t\tassert_nil(session[:user_id])\r\n\tend", "def raise_no_element_error\n raise Selenium::WebDriver::Error::NoSuchElementError, 'An element could not be located on the page using the given search parameters.'\n end", "def test_inactive_product_no_reviews\r\n get :show, :id => '2006-Ford-Mustang-reviews'\r\n assert_response :missing\r\n end", "def something_is_missing_error(expected)\n \"#{expected.name || 'top level'} Node/Object/Element is missing\"\n end", "def not_see(*args)\n Kameleon::DSL::Verify::Absence.new(*args).tap do |absence|\n absence.conditions.each do |condition|\n if condition.block\n instance_eval(condition.block)\n else\n page.should send(condition.method, *condition.params)\n end\n end\n end\n end", "def test_003\n open_pu_management_page\n assert is_element_present(xpath[\"pu_management\"][\"search_box\"])\n assert is_element_present(xpath[\"pu_management\"][\"pu_table\"])\n logout\n end", "def deny(assertion)\n assert !assertion\n end", "def expect_fields_to_be_blank\n expect(page).to have_field(\"Email\", with: \"\", type: \"email\")\n expect(find_field(\"Password\", type: \"password\").value).to be_nil\n expect(find_field(\"Password confirmation\", type: \"password\").value).to be_nil\n end", "def test_show_nonexistent_post\n assert_raise(ActiveRecord::RecordNotFound) {\n get :show,\n :id => 99\n }\n end", "def test_unexistent_course_registering_non_member\n\t\tregistering_non_member = Enrollment.new(:participantID => participants(:non_member_one).participantID, :courseID => \"nap101\")\n\t\tassert Participant.find_by(participantID: registering_non_member.participantID), \"Non Member was not found in Participant database\"\n \t\tassert !Course.find_by(courseID: registering_non_member.courseID), \"Non existent Course is in Courses database\"\n\tend", "def assert_no_data_at data, path, msg=nil\n msg ||= \"Data found at #{path.inspect} for #{data.inspect}\"\n found = false\n\n Path.find path, data do |d,k,p|\n found = true\n break\n end\n\n assert !found, msg\n end", "def assert_unauthorized(mock)\n assert_response :unauthorized\n assert_select 'h1', '401 Unauthorized', response.body\n assert_mock mock\n end", "def assert_false(exp, msg=nil)\n FalseAssay.assert!(exp, :message=>msg, :backtrace=>caller)\n end", "def assertHomepage #Assertions for the corresponding page within the corresponding page object class\n expect(page.title).to include(\"TodoMVC\")\n end", "def assert_not_true(exp, msg=nil)\n TrueFailure.refute(exp, :message=>msg, :backtrace=>caller)\n end", "def test_when_time_entries_have_no_issue_associated\n assert_equal false , @project.has_time_entries_with_no_issue\n end", "def assert_element_does_not_contain_text(locator, text, message=nil, timeout=default_wait_for_time)\n wait_for({:message => message, :timeout => timeout}) {element_does_not_contain_text(locator, text)}\n end", "def expect_page_to_not_have_content_with_uniquenumber(content)\n\n page.should_not have_content(content + read_file.to_s)\n\n end", "def test_visit_to_nonexisting_url_tc6\r\n\t\t#redirect input\r\n\r\n\t\tinput = StringIO.new(\"<httpRequests>\\n\"\\\r\n\t\t\t+ \"<httpRequest>http://www.nz-honeynet.org/idontexist.html</httpRequest>\\n\"\\\r\n\t\t\t+ \"</httpRequests>\\n\") \r\n\t\t$stdin = input\r\n\t\t\r\n\t\t#redirect output\r\n\t\tactual_http_response = StringIO.new\r\n\t\t$stdout = actual_http_response\r\n\t\t\r\n\t\texpected_http_response = \"<httpResponses>\\n<httpResponse>\\n<uri>http://www.nz-honeynet.org/idontexist.html</uri>\\n\"\\\r\n\t\t\t+ \"<code>404 - Not Found</code>\\n\"\r\n\t\t\r\n\t\twebBrowser = WebBrowser.new(\"visitor/WebBrowserConfigurationUnitTestDontFollow.xml\")\r\n\t\t$stdout = STDOUT\r\n\t\t\r\n\t\tassert(actual_http_response.string.index(expected_http_response),\\\r\n\t\t\t\"http response not as expected\")\r\n\t\r\n\tend", "def assert_no_errors_in_response\n assert_equal [nil, nil], response.data.values_at(\"error_type\", \"message\")\n end", "def assert_not_found(clazz, id)\n message = \"#{clazz} with ID #{id} is still here!\"\n assert_raise ActiveRecord::RecordNotFound, message do\n clazz.find(id)\n end\n end", "def assert_no_error_occurred\n @status.must_equal 0\n end" ]
[ "0.7536978", "0.7220779", "0.7149996", "0.7097892", "0.6965843", "0.6961422", "0.68913674", "0.6890181", "0.6872802", "0.6813863", "0.6764166", "0.6719421", "0.66887593", "0.66631734", "0.6614167", "0.65759957", "0.6571946", "0.6553961", "0.6543067", "0.6528654", "0.6490951", "0.64498323", "0.6443825", "0.64143443", "0.6413446", "0.6410509", "0.64074713", "0.6348254", "0.63104594", "0.6288931", "0.6279831", "0.6259957", "0.6238899", "0.6238461", "0.6221604", "0.61797893", "0.61774224", "0.61590517", "0.6140003", "0.61186737", "0.6112731", "0.61004853", "0.6085218", "0.6065705", "0.6045869", "0.60457337", "0.6038751", "0.60301924", "0.6028867", "0.6026236", "0.601703", "0.6015983", "0.6014289", "0.600964", "0.6009381", "0.5980886", "0.5976089", "0.59727246", "0.59676737", "0.59648377", "0.5961941", "0.59538746", "0.5948083", "0.59451514", "0.59374493", "0.59235966", "0.5922964", "0.591713", "0.59103507", "0.590587", "0.59031785", "0.5888777", "0.5860308", "0.58563435", "0.5854846", "0.5848846", "0.5844913", "0.58442944", "0.582791", "0.58223176", "0.58215684", "0.58116263", "0.58089334", "0.5791727", "0.57895386", "0.5774013", "0.5771982", "0.5771642", "0.5768157", "0.5767314", "0.5756744", "0.5755909", "0.5748578", "0.5746555", "0.5742031", "0.57406074", "0.5733104", "0.5733008", "0.57313055", "0.5728547" ]
0.5843209
78
Asserts that I see a particular tag (see HTMLAnalysis.tag)
def i_see_tag(name, opts = nil) assert has_tag?(name, opts), __last_because + " (don't see tag <#{name} #{opts.inspect})" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_has_tag\n ogg = dummy()\n\n assert ogg.has_tag?(\"GENRE\")\n assert !ogg.has_tag?(\"UNKNOWN\")\n end", "def test_navbar\n get 'index'\n tag={:tag=>'li'}\n assert_tag :ancestor=>tag,\n :tag => 'a', :content=>'Feed'\n \n assert_tag :ancestor=>tag,\n :tag => 'form', :attributes=>{:action=>/google/}\n end", "def see_tag(text); end", "def assert_tag(tag, string)\n complete_tag = \"<#{tag}>\"\n partial_tag = \"<#{tag}(\"\n (string.include? complete_tag) || (string.include? partial_tag)\n end", "def assert_xml_tag(xml, conditions)\n doc = HTML::Document.new(xml)\n assert doc.find(conditions), \n \"expected tag, but no tag found matching #{conditions.inspect} in:\\n#{xml.inspect}\"\nend", "def test_tags\n get :date, { :year => 2006, :month => 3, :day => 10, :id => 1 }, { :user => true }\n assert_response :success\n \n assert_select \"h4.tags\", { :count => 1 }, \"Could not find tags section\" do\n post = Post.find(1)\n post.tags.each do |tag|\n assert_select %Q|a[href=\"#{tag_page_url(:tag => tag.name)}\"]|, {:count => 1}, \"Tag: #{tag.name} should appear once\"\n end \n end\n \n assert_tag_cloud\n \n end", "def assert_tag(file, key, value)\n info = Aur::FileInfo.new(file)\n assert_equal(value.to_s, info.our_tags[key].to_s)\nend", "def test_tag_no_attributes_3\n expected_tag = \"<td>game won</td>\"\n\n tag = \"td\"\n content = \"game won\"\n actual_tag = @page_generator.generate_simple_tag tag, content\n\n assert_equal expected_tag, actual_tag\n end", "def assert_meta(tag, text)\n tag = find(:xpath, \"//head/meta[@name='#{tag.to_s}']\")\n assert_equal text, tag.native.attribute(\"content\")\n end", "def test_tag_no_attributes_1\n expected_tag = \"<h1>Hello World!</h1>\"\n\n tag = \"h1\"\n content = \"Hello World!\"\n actual_tag = @page_generator.generate_simple_tag tag, content\n\n assert_equal expected_tag, actual_tag\n end", "def test_no_tag_then_tag_set\n @tag.on_root('t002.txt', nil)\n @tag.after_root('t002.txt', nil)\n\n @tag.on_root('t002.txt', nil)\n @tag.run('CAR')\n @tag.after_root('t002.txt', nil)\n assert_nil @tag.tag_page_db['t002_, __no_tag_']\n assert_equal '1', @tag.tag_page_db['t002_, _CAR']\n end", "def assert_no_tag(*opts)\n clean_backtrace do\n opts = opts.size > 1 ? opts.last.merge({ :tag => opts.first.to_s }) : opts.first\n tag = find_tag(opts)\n assert !tag, \"expected no tag, but found tag matching #{opts.inspect} in:\\n#{@session.response.body.inspect}\"\n end\n end", "def test_tag_no_attributes_2\n expected_tag = \"<th>W/L</th>\"\n\n tag = \"th\"\n content = \"W/L\"\n actual_tag = @page_generator.generate_simple_tag tag, content\n\n assert_equal expected_tag, actual_tag\n end", "def test_tag(tag, required, tfa_state, website, only_true = false)\n if website[tag].nil? && website['tfa'] == tfa_state && required\n error(\"#{website['name']}: The required YAML tag \\'#{tag}\\' tag is \"\\\n 'not present.')\n end\n return if website[tag].nil?\n if website['tfa'] != tfa_state\n error(\"#{website['name']}: The YAML tag \\'#{tag}\\' should NOT be \"\\\n \"present when TFA is #{website['tfa'] ? 'enabled' : 'disabled'}.\")\n end\n return unless only_true && website[tag] != true\n error(\"#{website['name']}: The YAML tag \\'#{tag}\\' should either have\"\\\n \" a value set to \\'Yes\\' or not be used at all. (Current value:\"\\\n \" \\'#{website[tag]}\\')\")\nend", "def has_tag?(name); end", "def test_add_tag\n @post = GopDataTrustAdapter::Api.add_tag(\n \"Foobar\",\n :year => 2005,\n :name => \"Something\",\n :desc => \"A desc of something.\"\n )\n assert_query_hash_value_is_present \"PersonKey\", \"Foobar\"\n assert_query_hash_value_is_present \"ElementYear\", \"2005\"\n assert_query_hash_value_is_present \"ElementName\", \"Something\"\n assert_query_hash_value_is_present \"ElementDescription\", \"A desc of something.\"\n end", "def tag(tag); end", "def tag(tag); end", "def test_tag_is_present\n actor = Actor.new(\n :name => 'No Tag',\n :tag => ''\n )\n assert !actor.valid?\n end", "def loggedin_menu_displayed\n assert_tag :tag => \"a\", :attributes => { :href => \"/home/index\"}, :content => \"Home\"\n assert_tag :tag => \"a\", :attributes => { :href => \"/users/sign_out\"}, :content => \"Logout\" \n assert_no_tag :tag => \"a\", :content => \"Login\"\n end", "def test_search\n get :search,\n :query => 'furrowend'\n assert_response :success\n #TODO: Figure out why this doesn't work\n #assert_tag :tag => 'Location'\n end", "def test_links_exist\n login_as_valid_user\n puts \"****\"+session[:login].to_s\n \n assert_tag :tag => \"a\",\n :parent => { :tag => \"li\"},\n :descendant => {\n :child => /Project Management/ }\n logout\nend", "def test_tag_2_attributes_1\n expected_tag = \"<a href=\\\"https:\\\\\\\\www.google.com\\\" target=\\\"_blank\\\">Google</a>\"\n\n tag = \"a\"\n content = \"Google\"\n atrribute1 = \"href=\\\"https:\\\\\\\\www.google.com\\\"\"\n attribute2 = \"target=\\\"_blank\\\"\"\n actual_tag = @page_generator.generate_simple_tag tag, content, atrribute1, attribute2\n\n assert_equal expected_tag, actual_tag\n end", "def test_tag_pass\n assert_equal mail_to(\"bob@here.com\"), \"<a href='mailto:bob@here.com'>bob@here.com</a>\"\n end", "def test_show_by_tags_invalid_subtag\n a_tag = tags(:weapons)\n get :show_by_tags, :tags => [a_tag.name, \"invalid\"]\n assert_response :missing\n end", "def test_tags(website)\n tfa = website['tfa']\n # rubocop:disable DoubleNegation\n if !!tfa != tfa\n error(\"#{website['name']}: The YAML tag \\'{tfa}\\' should be either \"\\\n \"\\'Yes\\' or \\'No\\'. (#{tfa})\")\n end\n # rubocop:endable DoubleNegation\n\n # Test tags that are obligatory\n @obligatory_tags.each do |t|\n next unless website[t].nil?\n error(\"#{website['name']}: The required YAML tag \\'#{t}\\' tag is not\"\\\n ' present.')\n end\n\n # Test tags associated with TFA 'YES'\n @tfa_yes_tags.each { |tfa_form| test_tag(tfa_form, false, true, website) }\n\n # Test TFA form tags'\n @tfa_forms.each { |tfa_form| test_tag(tfa_form, false, true, website, true) }\n\n # Test tags associated with TFA 'NO'\n @tfa_no_tags.each { |tfa_form| test_tag(tfa_form, false, false, website) }\nend", "def test_show_by_tags_with_tag\n a_tag = tags(:weapons)\n get :show_by_tags, :tags => [a_tag.name]\n assert_response :success\n assert_equal \"Store #{assigns(:viewing_tags).collect { |t| ' > ' + t.name}}\", assigns(:title)\n assert assigns(:products)\n assert_template 'index'\n end", "def test_tag_1_attributes_1\n expected_tag = \"<h1 style=\\\"background-color:DodgerBlue;\\\">Hello World</h1>\"\n\n tag = \"h1\"\n content = \"Hello World\"\n atrribute1 = \"style=\\\"background-color:DodgerBlue;\\\"\"\n actual_tag = @page_generator.generate_simple_tag tag, content, atrribute1\n\n assert_equal expected_tag, actual_tag\n end", "def test_no_tag\n @tag.on_root('t002.txt', nil)\n @tag.after_root('t002.txt', nil)\n assert_equal '1', @tag.tag_page_db['t002_, __no_tag_']\n end", "def specifies?(tag)\n include?(tag)\n end", "def test_index\n get :index\n assert_response :success\n ## должен прийти флеш\n assert_tag :tag=>'object'\n end", "def snippet_tagged\n tags = {\"testing\" => true, \"yayness\" => false,\n \"both\" => false, \"bothtrue\" => true, \"define\" => true}\n\n tags.each do |tag, retval|\n assert_file(\"/tmp/tagged#{tag}#{retval.to_s}\")\n end\n end", "def check_html_element(name, doc)\r\n elements = doc.css(name)\r\n process_tag(name, elements, \"text\")\r\n end", "def raise_tag(text); end", "def assert_tag_not_in(*opts)\n target = opts.shift\n tag_opts = find_tag_opts(opts)\n assert find_tag_in(target, tag_opts).nil?, \n \"#{tag_opts.inspect} was found in \\n#{target.inspect}\"\n end", "def test_news\n get 'index'\n assert_tag :tag=>'div', :attributes=>{:class=>'newsitem'}\n assert_tag :tag=>'div', :attributes=>{:id=>'newsbar'}\n end", "def test_register \n tag = Liquid::Template.tags['t']\n assert_not_nil tag\n assert_equal 'Jekyll::ThumbnailifyTag', tag.to_s\n end", "def test_tagged_request_for_no_tags\n login_as(:quentin)\n post :tagged, {:tags=>nil}\n assert_response :success\n assert_nil assigns(:tag)\n assert_equal [], assigns(:selected_tags)\n assert_equal Hash[], assigns(:remove_tag_links)\n assert_equal Hash['Good'=>'Good', 'Bad'=>'Bad', 'Ugly'=>'Ugly', 'Question'=>'Question', 'Crazy sugar'=>'Crazy sugar', 'Pretty'=>'Pretty'], assigns(:add_tag_links)\n assert_equal 4, assigns(:samples).size\n end", "def test_cases_by_tag_name; end", "def check_tag(tag, required, tfa_state, website, only_true = false)\n if website[tag].nil?\n if website['tfa'] == tfa_state && required\n error(\"#{website['name']}: The required YAML tag \\'#{tag}\\' tag is not present.\")\n end\n else\n if website['tfa'] != tfa_state\n state = website['tfa'] ? \"enabled\" : \"disabled\"\n error(\"#{website['name']}: The YAML tag \\'#{tag}\\' should NOT be present when TFA is #{state}.\")\n end\n if only_true && website[tag] != true\n error(\"#{website['name']}: The YAML tag \\'#{tag}\\' should either have a value set to \\'Yes\\' or not be used at all. (Current value: \\'#{website[tag]}\\')\")\n end\n end\n end", "def test_tag_1_attributes_2\n expected_tag = \"<p style=\\\"background-color:Tomato;\\\">Lorem ipsum...</p>\"\n\n tag = \"p\"\n content = \"Lorem ipsum...\"\n atrribute1 = \"style=\\\"background-color:Tomato;\\\"\"\n actual_tag = @page_generator.generate_simple_tag tag, content, atrribute1\n\n assert_equal expected_tag, actual_tag\n end", "def test_tags\n ogg = dummy()\n\n expected_tags = %w{GENRE UNICODETAG}.to_set\n assert_equal expected_tags, ogg.tags.to_set\n end", "def test_show_by_tags_invalid\n get :show_by_tags, :tags => [\"invalid\"]\n assert_response :missing\n end", "def tag_with tag_or_id, uid=nil\n assert_tagging tag_or_id, (uid || @tagging_user_id)\n end", "def test_navigation_logged_in\n authorize @valid_user\n get :index\n assert_tag \"a\", :content => /Logout/,\n :attributes => { :href => \"/user/logout\"}\n assert_no_tag \"a\", :content => /Register/\n assert_no_tag \"a\", :content => /Login/\n end", "def has_tag(tag)\n @tags.include?(\"@#{tag}\")\n end", "def tag; end", "def tag; end", "def test_get_tag\n ogg = dummy()\n\n assert_equal %w{Acoustic Rock}.to_set, ogg['GENRE']\n assert_equal Set[\"öäüoΣø\"], ogg['UNICODETAG']\n\n assert_empty ogg['UNKNOWN']\n assert ogg['UNKNOWN'].frozen?\n end", "def test_empty_tag\n\n pdef = Ruote.define do\n noop :tag => ''\n end\n\n wfid = @dashboard.launch(pdef)\n r = @dashboard.wait_for(wfid)\n\n assert_equal 'terminated', r['action']\n end", "def has_tag?(t)\n tags.include?(t)\n end", "def valid_tag(tag)\n parser = REXML::Parsers::UltraLightParser.new( tag)\n parser.parse[0]\n end", "def example_tag(text); end", "def has_tag?(tag)\n tags.include?(tag.to_s)\n end", "def tag(tag)\n @tagname = tag\n end", "def is_valid_element?(element)\n VALID_TAGS.include?(element.get_tag_name)\n end", "def dump_tag(tag)\n puts \"#{tag.class} -- comp: #{tag.playlist_compatability} \"\\\n \"version:#{tag.version} -- valid?#{tag.valid?} :: #{tag}\"\n end", "def test_remove_tag\n\n resultCreated = Tag.newTag(\"Payroll\", 1);\n\n assert_equal true, resultCreated\n\n results = Tag.getByBookmarkId(1);\n\n result = results[0]\n\n resultRemoved = Tag.removeTag(1, result.tagId)\n\n assert_equal true, resultRemoved\n\n end", "def new_tag(tag)\n puts cyan(\"Found new tag: #{tag}\")\n end", "def tag(name); end", "def tt?(tag)\n tag.bit == @tt_bit\n end", "def entry_should_be_marked_read(entry)\n expect(page).to have_css \"a[data-entry-id='#{entry.id}'].entry-read\"\nend", "def test_show_by_tags_with_subtag\n a_tag = tags(:weapons)\n a_subtag = tags(:mass_destruction)\n get :show_by_tags, :tags => [a_tag.name, a_subtag.name]\n assert_response :success\n assert_equal \"Store #{assigns(:viewing_tags).collect { |t| ' > ' + t.name}}\", assigns(:title)\n assert assigns(:products)\n assert_template 'index'\n end", "def tt? tag\n tag.bit == @tt_bit\n end", "def check_meta_element(name, doc)\r\n elements = doc.css(\"meta[@name='#{name}']\") \r\n process_tag(name, elements, [\"[]\", \"content\"])\r\n end", "def tagged?; end", "def tagged?(tag)\n @tags.include?(tag)\n end", "def has_essence?(essence_tag) has_tag(:essence, essence_tag) end", "def tag\n end", "def tag\n end", "def print_tag_message(tag)\n print_time_stamp\n puts 'Current tag is set to '.colorize(:blue) + '#' + tag\n end", "def has_tag?(tag)\n self.tags.include?(tag)\n end", "def public_menu_displayed\n assert_tag :tag => \"a\", :attributes => { :href => \"/home/index\"}, :content => \"Home\"\n assert_tag :tag => \"a\", :attributes => { :href => \"/users/sign_in\"}, :content => \"Login\"\n assert_no_tag :tag => \"a\", :content => \"Users\"\n assert_no_tag :tag => \"a\", :content => \"Logout\"\n end", "def tagged?(tag)\n !! self.tag(tag)\n end", "def assert_title(title)\n assert_seen title, :within => \"head title\"\n end", "def tag(new_tag); end", "def open_tag?(tag)\n !close_tag?(tag)\n end", "def clickable?(tag)\n clickable.include? tag.to_sym\n end", "def clickable?(tag)\n clickable.include? tag.to_sym\n end", "def hastag?(tag)\n @tags[tag] ? true : false\n end", "def test_img_attrs\n PictureTag.stubs(:html_attributes).returns('img' => 'class=\"img\"')\n\n correct = <<~HEREDOC\n <img class=\"img\" src=\"good_url\" srcset=\"ss\">\n HEREDOC\n\n assert_equal correct, @tested.to_s\n end", "def test_should_not_create_invalid_tag\n login_as :admin\n\n parent_tags_count = Tag.find_ordered_parents.length\n \n # Call the list action.\n get :list\n assert_response :success\n assert_template 'list'\n\n # Initially we should have all parent tags visible.\n assert_select \"ul#tag_list\" do\n assert_select \"li\", :count => parent_tags_count\n end\n\n # Variation fields should be aded using ajax calls.\n xhr(:post, :create, :tag => { :name => \"Weapons\" })\n\n # The answer will be a javascript popup, we dont have a way to test that.\n\n # Test if it is NOT in the database.\n assert_equal Tag.find_ordered_parents.length, parent_tags_count\n end", "def test_get_hits_for_tag\n hits = CachedResource.get_hits_for_tag(\"good\", @paul)\n assert_equal 1, hits.length\n assert_equal \"http://resource/3/both\", hits[0]['uri']\n hits = CachedResource.get_hits_for_tag(\"bad\", nil)\n assert_equal 0, hits.length\n hits = CachedResource.get_hits_for_tag(\"bad\", @paul)\n assert_equal 0, hits.length\n hits = CachedResource.get_hits_for_tag(\"daves_tag\", @paul)\n assert_equal 0, hits.length\n hits = CachedResource.get_hits_for_tag(\"daves_tag\", @dave)\n assert_equal 1, hits.length\n assert_equal \"http://resource/2/dave\", hits[0]['uri']\n hits = CachedResource.get_hits_for_tag(\"good\", nil)\n end", "def has_tag\n return @has_tag unless @has_tag.nil?\n get_tag_information\n @has_tag\n end", "def check_tags(tags)\n if tags['Purpose'] == 'Continuous Integration' && tags['Environment'] == 'QA'\n return 'yes'\n else\n return 'no'\n end\nend", "def tag(string); end", "def el_request(tag, *_)\n log \"Unmatched .el found:\" + stack_trace.first\n end", "def require_tag(obj, tag_name, params={})\n params[:message] ||= \"Tag named '#{tag_name}' must be present but is not.\"\n\n return unless obj\n\n tag = Tag.find_by_name(tag_name)\n tag_present = obj.sobject.tags.include?(tag)\n tag_present = tag.children.any? { |child_tag| obj.sobject.tags.include?(child_tag) } unless tag_present\n\n rule_errors << params[:message] unless tag_present\n end", "def test_container_logs_metadata_from_tag\n verify_container_logs(method(:container_log_entry),\n CONTAINER_FROM_TAG_PARAMS)\n end", "def test_tag_assignment\n assert_equal 2, @twitter_reporter.reports.create(:body => 'my #machine is #good').tags.size\n # assert_equal 7, @twitter_reporter.reports.create(:body => 'many #challenges here, #bad').score\n goodreport = @twitter_reporter.reports.create(:body => 'no problems #good overall, #wait12')\n goodreport.reload\n assert_equal 2, goodreport.tags.size\n epreport = @twitter_reporter.reports.create(:body => 'being #challenges here #EPOH l:cincinnati oh')\n epreport.reload\n assert_equal 2, epreport.tags.size\n # FIXM - figure out how to get EPXX back into the tag_list, all we have is the pattern here\n #assert epreport.tag_list.split(Tag::TAG_SEPARATOR).include?('EPOH'), \"has tag_list: #{epreport.tag_list}\"\n end", "def have_tag(tag, attributes = {})\n selector = tag.to_s\n text = attributes.delete(:text)\n\n attributes.each do |k, v|\n selector << \"[#{k}='#{v}']\"\n end\n\n args = [selector]\n args << {:text => text} if text\n \n have_css *args\n end", "def test_sample2\n\n # Search Accessibility Area\n target = '//android.widget.TextView[@content-desc=\"Accessibility\"]'\n element = @action.driver.find_element(xpath: target)\n assert_equal(\n 'App',\n element.text\n )\n\n rescue StandardError => e\n @action.error_handling(scenario_name: method_name, error_obj: e)\n end", "def tag_is_directive?(tag_name); end", "def allowed_child?(tag); end", "def tag(selector)\n\t\te = element(selector)\n\t\te && e.inner_html\n\tend", "def has_tag(tag_name)\n tag = USER_TAGS[tag_name: tag_name]\n return tag != nil\n end", "def public_menu_displayed\n assert_tag :tag => \"a\", :attributes => { :href => \"/home/index\"}, :content => \"Home\"\n assert_tag :tag => \"a\", :attributes => { :href => \"/users/sign_up\"}, :content => \"Register\"\n assert_tag :tag => \"a\", :attributes => { :href => \"/users/sign_in\"}, :content => \"Login\"\n assert_no_tag :tag => \"a\", :content => \"Contacts\"\n assert_no_tag :tag => \"a\", :content => \"Companies\"\n assert_no_tag :tag => \"a\", :content => \"Calendar\"\n assert_no_tag :tag => \"a\", :content => \"Admin\"\n assert_no_tag :tag => \"a\", :content => \"Logout\"\n end", "def tag?(t)\n return false if t.nil?\n if t =~ /^[a-zA-Z][\\w\\_\\-]+[a-zA-Z]$/\n return true\n end\n false\n end", "def tag\n try_opt(:tag)\n end", "def assert_seen(text, opts={})\n if opts[:within]\n within(opts[:within]) do\n puts \"text: #{text}\"\n puts \"opts: #{opts.inspect}\"\n assert has_content?(text)\n end\n else\n assert has_content?(text)\n end\n end" ]
[ "0.67250544", "0.6717588", "0.67012674", "0.66086125", "0.66059035", "0.65624624", "0.64394224", "0.6423503", "0.63943315", "0.63641894", "0.6362613", "0.6299818", "0.6298143", "0.62975556", "0.6252634", "0.60787", "0.6077071", "0.6077071", "0.60445255", "0.60224754", "0.6017349", "0.5944972", "0.58844256", "0.58803433", "0.58802325", "0.58787894", "0.5865786", "0.5858512", "0.58524907", "0.583907", "0.5795065", "0.57770586", "0.5757291", "0.5736278", "0.5735993", "0.5735306", "0.57347804", "0.5697752", "0.5690261", "0.5685255", "0.5676837", "0.5667463", "0.56587404", "0.5642244", "0.56341684", "0.5630143", "0.56215596", "0.56215596", "0.5605092", "0.55663925", "0.5560992", "0.5558765", "0.5552818", "0.5517277", "0.5516016", "0.55128366", "0.5508344", "0.55074096", "0.5503847", "0.5494631", "0.5487417", "0.54858124", "0.54753095", "0.54563725", "0.5446056", "0.5440504", "0.5401679", "0.5400634", "0.53916353", "0.53916353", "0.5385432", "0.5375969", "0.53740394", "0.5363451", "0.5361117", "0.5345849", "0.534543", "0.53448576", "0.53448576", "0.53445196", "0.534007", "0.5338409", "0.53255486", "0.5323918", "0.5321454", "0.5309892", "0.53059983", "0.5299635", "0.5298972", "0.5286302", "0.5284871", "0.5266969", "0.52665675", "0.5259191", "0.524832", "0.52411455", "0.5238571", "0.52357906", "0.5210921", "0.5205817" ]
0.5893549
22
Asserts that I see a particular link (see HTMLAnalysis.link)
def i_see_link(opts = nil) assert has_link?(opts), __last_because + " (dont see link <a #{opts.inspect})" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assert_link_is_visible(text, is_target_link=nil, link=nil)\n if !is_target_link.nil?\n find_link(text, visible: true)[:target].should == \"_blank\"\n elsif !link.nil?\n expect(page).to have_link(text, visible: true, href: Helpers::ContentHelper.str_to_regexp(link), minimum: 1)\n else\n expect(page).to have_link(text, visible: true, minimum: 1)\n end\n end", "def test_outbound_link\r\n checker=ConsistencyChecker.new(\r\n @linkfinder,\r\n uriFromTest(\"url_retriever/test.htm\")\r\n )\r\n res=newResponse :body=> <<EOF\r\n<html>\r\n<head>\r\n<title>Consistency checker -- foreign domain test</title>\r\n</head>\r\n<body>\r\n<p>This is an example.com domain.</p>\r\n<a href=\"testB.htm\">Test 2</a>\r\n</body>\r\n</html>\r\nEOF\r\n links=checker.check(URI(\"http://www.example.com\"),res)\r\n assert links.empty?\r\n end", "def assert_link(rel, href, response = last_response)\n link_header = LinkHeader.parse(response.headers[\"Link\"])\n link = link_header.find_link([\"rel\", rel])\n assert link, \"No link with rel '#{rel}' found\"\n assert_equal href, link.href\n\n # Also check in _response_info\n parsed_response = JSON.parse(response.body)\n links = parsed_response.fetch(\"_response_info\", {})[\"links\"] || []\n found_link = links.find { |link| link[\"rel\"] == rel }\n assert found_link, \"No link with rel '#{rel}' found in _response_info\"\n assert_equal href, found_link[\"href\"]\n end", "def test_get_position_links_02\n a = Scraper.new\n link = a.get_position_links\n link.each do |a|\n assert_match /https:\\/\\/www.jobsatosu.com.*/, a ,\"The link must be a link to jobsatosu.com\"\n end\n\n end", "def click(link); end", "def test_text_with_incomplete_link\n assert_equal %q{sth sth sth <a href='http://duzadupa'>http://duzadupa</a> sth sth},\n replace_links_with_html('sth sth sth http://duzadupa sth sth')\n end", "def test_add_link\n num_links0 = count_links\n test_link = 'http://news.ycombinator.com/'\n @ds.add_or_get_link(test_link)\n assert_equal(num_links0 + 1, count_links)\n assert_equal(1, count_links(test_link))\n assert_equal('Hacker News', get_link_title(test_link))\n delete_link(test_link)\n end", "def test_add_pvt_link\n num_links0 = count_links\n test_link = 'http://www.avilayparekh.com/'\n @ds.add_or_get_link(test_link)\n assert_equal(num_links0 + 1, count_links)\n assert_equal(1, count_links(test_link))\n assert_empty(get_link_title(test_link))\n delete_link(test_link)\n end", "def test_click_base\n page = @mech.get(\"http://google.com/tc_base_link.html\")\n page = page.links.first.click\n assert @mech.visited?(\"http://localhost/index.html\")\n end", "def test_cache_link\n get '/' + TEST_PAGE\n assert_redirected_to :link => TEST_PAGE_LINK\n \n follow_redirect!\n assert_no_errors\n assert_page_cached(TEST_PAGE_LINK)\n end", "def link\n throw 'STUB'\n end", "def visit_link?(link)\n @link_rules.accept?(link)\n end", "def test_link\n authenticated_client.link test_link_full_name\nend", "def test_uri_weird\n doc = Nokogiri::HTML::Document.new\n\n node = Nokogiri::XML::Node.new('foo', doc)\n node['href'] = 'http://foo.bar/ baz'\n\n link = Mechanize::Page::Link.new(node, nil, nil)\n\n assert_equal 'http://foo.bar/%20baz', link.uri.to_s\n end", "def test_links_with_bold\n page = @mech.get(\"http://localhost/tc_links.html\")\n link = page.links_with(:text => /Bold Dude/)\n assert_equal(1, link.length)\n assert_equal('Bold Dude', link.first.text)\n assert_equal [], link.first.rel\n assert !link.first.rel?('me')\n assert !link.first.rel?('nofollow')\n\n link = page.links_with(:text => 'Aaron James Patterson')\n assert_equal(1, link.length)\n assert_equal('Aaron James Patterson', link.first.text)\n assert_equal ['me'], link.first.rel\n assert link.first.rel?('me')\n assert !link.first.rel?('nofollow')\n\n link = page.links_with(:text => 'Aaron Patterson')\n assert_equal(1, link.length)\n assert_equal('Aaron Patterson', link.first.text)\n assert_equal ['me', 'nofollow'], link.first.rel\n assert link.first.rel?('me')\n assert link.first.rel?('nofollow')\n\n link = page.links_with(:text => 'Ruby Rocks!')\n assert_equal(1, link.length)\n assert_equal('Ruby Rocks!', link.first.text)\n end", "def assert_links_visibility(should_be_visible, skip_links: [])\n links = %w[previous_step help_sign_up save_and_exit] - skip_links\n\n links.each do |link_name|\n action = should_be_visible ? :to : :not_to\n expect(rendered).send(action, have_selector('a', text: l10n(link_name)))\n end\n end", "def assert_first_page\n assert_no_link PREV_LABEL\n end", "def test_should_not_create_link_via_API_XML\r\n get \"/logout\"\r\n post \"/links.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 verify_linkurl(linkurl)\n url = Loofah.scrub_fragment(linkurl, :prune).to_s\n url if valid_url?(url)\n end", "def test_get_link\n num_links0 = count_links\n @ds.add_or_get_link('http://www.ml-class.com/') \n assert_equal(num_links0, count_links)\n end", "def clicks_get_link(link_text)\n link = find_link(link_text)\n link.click(:get)\n end", "def test_visit_dont_follow_link_tc29\r\n\t\t#redirect input\r\n\t\tinput = StringIO.new(\"<httpRequests>\\n\"\\\r\n\t\t\t+ \"<httpRequest>http://www.nz-honeynet.org/webBrowserUnitTestAbsoluteLink.html</httpRequest>\\n\"\\\r\n\t\t\t+ \"</httpRequests>\\n\") #page contains link, but we configure webbrowser to ignore links\r\n\t\t$stdin = input\r\n\t\r\n\t\t\r\n\t\t#redirect output\r\n\t\tactual_http_response = StringIO.new\r\n\t\t$stdout = actual_http_response\r\n\t\texpected_http_response = \"<httpResponses>\\n<httpResponse>\\n<uri>http://www.nz-honeynet.org/webBrowser\"\\\r\n\t\t\t+\"UnitTestAbsoluteLink.html</uri>\\n<code>200 - OK</code>\\n<header\"\\\r\n\t\t\t+\"s><header name=\\\"date\\\">removed</header>\\n<header name=\\\"content-type\\\">text/html\"\\\r\n\t\t\t+ \"</header>\\n<header name=\\\"server\\\">Apache</header>\\n<header name=\\\"transfer-encoding\\\">\"\\\r\n\t\t\t+\"chunked</header>\\n</headers>\\n<bod\"\\\r\n\t\t\t+\"y>Jmx0O2h0bWwmZ3Q7DQombHQ7aGVhZCZndDsNCiZsdDt0aXRsZSZndDtV\"\\\r\n\t\t\t+\"bnRp\\ndGxlZCBEb2N1bWVudCZsdDsvdGl0bGUmZ3Q7DQombHQ7bWV0YSBodHRwLWVx\\ndWl2PSZxdW90\"\\\r\n\t\t\t+\"O0NvbnRlbnQtVHlwZSZxdW90OyBjb250ZW50PSZxdW90O3Rl\\neHQvaHRtbDsgY2hhcnNldD1pc28tOD\"\\\r\n\t\t\t+\"g1OS0xJnF1b3Q7Jmd0Ow0KJmx0Oy9o\\nZWFkJmd0Ow0KDQombHQ7Ym9keSZndDsNClRoaXMgaXMgYSB0\"\\\r\n\t\t\t+\"ZXN0IHBhZ2Ug\\nZm9yIHRoZSB3ZWIgYnJvd3NlciB1bml0IHRlc3Qgd2l0aCBhIGFic29sdXRl\\nIGxp\"\\\r\n\t\t\t+\"bmsgdG8gJmx0O2EgaHJlZj0mcXVvdDtodHRwOi8vd3d3Lm56LWhvbmV5\\nbmV0Lm9yZy93ZWJCcm93c2\"\\\r\n\t\t\t+\"VyVW5pdFRlc3QuaHRtbCZxdW90OyZndDthbm90\\naGVyIHBhZ2UuICZsdDsvYSZndDsNCiZsdDsvYm9k\"\\\r\n\t\t\t+\"eSZndDsNCiZsdDsvaHRt\\nbCZndDsNCg==\\n</body>\\n</httpResponse>\\n</httpResponses>\\n\"\r\n\t\t\r\n\t\twebBrowser = WebBrowser.new(\"visitor/WebBrowserConfigurationUnitTestDontFollow.xml\")\r\n\t\t$stdout = STDOUT\r\n\t\r\n\t\t#1 response although it included link, because we configured webbrowser not to follow link\r\n\t\tdate_str = Regexp.escape(\"<header name=\\\"date\\\">.*?<\\/header>\")\r\n\t\tactual_http_response_without_date = actual_http_response.string.to_s.sub(/<header name=\\\"date\\\">.*?<\\/header>/,\"<header name=\\\"date\\\">removed</header>\")\r\n\t\tassert_equal(expected_http_response,actual_http_response_without_date,\"http response not as expected.\")\r\n\tend", "def has_links?(links)\r\n\t\texpected_links_raw = links.rows\r\n\t\texpected_links_raw.each do |link_text|\r\n\t\t\t@browser.link(:text => link_text[0]).exists?.should == true\r\n\t\tend\r\n\tend", "def refute_link(rel, response = last_response)\n link_header = LinkHeader.parse(response.headers[\"Link\"])\n link = link_header.find_link([\"rel\", rel])\n refute link, \"Unexpected link with rel '#{rel} found\"\n\n # Also check in _response_info\n parsed_response = JSON.parse(response.body)\n links = parsed_response.fetch(\"_response_info\", {})[\"links\"] || []\n found_link = links.find { |link| link[\"rel\"] == rel }\n refute found_link, \"Unexpected link with rel '#{rel} in _response_info\"\n end", "def link\n query_root_node(\"link/text()\")\n end", "def link\n node.at(\"link\").text\n end", "def test_it_finds_link_to_texts_as_an_exception_to_the_rule\n assert_equal find_text('= link_to \"This should be found\", \"/\"'), [\"This should be found\", \"/\"]\n assert_equal find_type('= link_to \"This should be found\", \"/\"'), :script_array\n end", "def verify_linkurl(linkurl)\n url = Loofah.scrub_fragment(linkurl, :prune).to_s\n url if valid_url?(url)\n end", "def test_links_exist\n login_as_valid_user\n puts \"****\"+session[:login].to_s\n \n assert_tag :tag => \"a\",\n :parent => { :tag => \"li\"},\n :descendant => {\n :child => /Project Management/ }\n logout\nend", "def link(link_text)\n element(damballa(link_text+\"_link\")) { |b| b.link(:text=>link_text) }\n action(damballa(link_text)) { |b| b.link(:text=>link_text).click }\n end", "def clicks_get_link(link_text)\n clicks_link_with_method(link_text, :get)\n end", "def link() url; end", "def link() url; end", "def clicks_link(link_text)\n link = links.detect { |el| el.innerHTML =~ /#{link_text}/i }\n return flunk(\"No link with text #{link_text.inspect} was found\") if link.nil?\n \n onclick = link.attributes[\"onclick\"]\n href = link.attributes[\"href\"]\n \n http_method = http_method_from_js(onclick)\n authenticity_token = authenticity_token_value(onclick)\n \n request_page(http_method, href, authenticity_token.blank? ? {} : {\"authenticity_token\" => authenticity_token})\n end", "def valid_link?(url)\n # GET or HEAD? Head is more friendly to the server, but some pages\n # May behave differently depending on HEAD or GET.\n HTTParty.head(url,\n verify: false, # don't verify ssl certs\n ).code == 200\n end", "def click_selenium_test1\n @session.click_link(@link_text)\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 check_only_links\n end", "def link(link, title, content)\n if no_links\n content\n else\n # \"<a href=\\\"#{DashboardRouter.normalize(link)}\\\" target=\\\"_top\\\">#{content}</a>\"\n \"<a href=\\\"#{link}\\\">#{content}</a>\"\n end\n end", "def test_p1_00010_aboutpage\n @aboutpage.goto_about_page\n \tassert @browser.body.present?\n assert @aboutpage.about_widget.present?\n @abouturl = @browser.url\n @aboutpage.newline\n end", "def test_00130_profilepage_check_activity_feed_link\n @profile_page.goto_profile\n @browser.wait_until { @profile_page.profile_activity_item.present? }\n\n @browser.wait_until { @profile_page.question_list_in_activity_pane.activity_list.size > 0 }\n activity_card = @profile_page.question_list_in_activity_pane.activity_list[0]\n conv = activity_card.conv_title\n activity_card.click_conv_link\n\n @browser.wait_until { @convdetail_page.convdetail.present? }\n assert @convdetail_page.convdetail.text.include? conv\n end", "def verifyStoryAdminLinks()\n\t\n\tputs \"************** START: Verify PRO page Links ****************\"\n\t\n\tputs \"Step 1 : Click on EditPage link on the Story page.\"\n\t$browser.click \"link=Edit\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Tell Your Story\")\n\t\tputs \"Step 1 is Passed. User has reached the EditPage screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 1 is Failed. User had failed to reach EditPage screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 3 : Click on Matching Grants link on the Story page.\"\n\t$browser.click \"link=Matching Grants\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Set Up a Matching Grant\")\n\t\tputs \"Step 3 is Passed. User has reached the Matching Grants screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 3 is Failed. User had failed to reach Matching Grants screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\t\n\tputs \"Step 6 : Click on Donations link on the Story page.\"\n\t$browser.click \"link=Donations\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Donations Listing\")\n\t\tputs \"Step 6 is Passed. User has reached the Donations screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 6 is Failed. User had failed to reach Donations screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"************** END: Verify PRO page Links ****************\"\n\t\nend", "def valid_link(link)\n\t\t!link.nil? and !link.empty?\n\tend", "def test_links\n schema = Heroics::Schema.new(SAMPLE_SCHEMA)\n assert_equal(\n ['list', 'info', 'identify_resource', 'create', 'submit', 'update', 'delete'],\n schema.resource('resource').links.map { |link| link.name })\n end", "def assert_not_first_page\n assert_link PREV_LABEL\n end", "def isitLink?(message)\n uri = URI.parse(message)\n %w( http https ).include?(uri.scheme)\n rescue URI::BadURIError\n false\n rescue URI::InvalidURIError\n false\n end", "def assert_on_page(page)\n raise \"page must begin with '/': #{page}\" unless page[0] == ?\\/\n assert \"http://example.org#{page}\" == last_request.url,\n \"Expected to be on page http://example.org#{page} but was on #{last_request.url}\"\n end", "def visit_url?(link)\n @url_rules.accept?(link)\n end", "def test_should_create_link_via_API_XML\r\n get \"/logout\"\r\n post \"/links.xml\", :api_key=>'testapikey',\r\n :link => {:user_id => 1,\r\n :title => 'API Link 1',\r\n :url => 'http://www.api.com'}\r\n assert_response :created\r\n end", "def click_visible_link(locator)\n wait_randomly\n click_link(locator.to_s, match: :first, visible: true)\nrescue StandardError\n raise_with_new_message 'Unable to click on link'\nend", "def test_url_generation\n page = new_page()\n assert_equal page.url, '/test'\n end", "def test_anastatica\n assert_kind_of(Anastatica, @card.anastatica)\n assert_equal(@card.anastatica.uri, @page.uri)\n end", "def should_have_correct_static_pages_links\n visit root_path\n\tclick_link \"About\"\n\tpage.should have_selector 'title', text: 'About'\n\tclick_link \"Home\"\n\tclick_link \"Sign up now!\"\n\tpage.should have_selector 'title', text: 'Sign up'\n\tclick_link \"pbook\"\n\tpage.should have_selector 'title', text: 'PammBook'\nend", "def ensure_http_link\t\t\n\t\tself.link = \"http://\" + self.link if !self.link.nil? and !self.link.start_with?(\"http://\")\n\tend", "def assert_valid_url(string)\n assert string.to_s.match(/https?:\\/\\/[\\S]+/)\nend", "def href!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 41 )\n\n type = HREF\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 371:7: 'href'\n match( \"href\" )\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__, 41 )\n\n end", "def test_navigation_logged_in\n authorize @valid_user\n get :index\n assert_tag \"a\", :content => /Logout/,\n :attributes => { :href => \"/user/logout\"}\n assert_no_tag \"a\", :content => /Register/\n assert_no_tag \"a\", :content => /Login/\n end", "def check_if_link_is_valid\n uri = URI.parse(self.url.split(\" \")[0])\n self.url = uri\n if !%w( http https ).include?(uri.scheme)\n self.url = nil\n end\n end", "def issue_from_link(link)\n uri = URI.parse(link)\n http = Net::HTTP.new(uri.host)\n response = http.get(uri.path)\n if response.code == '200'\n return response.body.dup\n else\n return nil\n end\n end", "def test_02dashboard\n expectedUrl=\"https://opensource-demo.orangehrmlive.com/index.php/dashboard\"\n assert_equal(expectedUrl, $objLoginPage.getUrl, \"Incorrect URL\")\n puts \"Dashboard test pass\" \n end", "def test_link_tab(link, expected_title = nil, expected_url = nil)\n wait = Selenium::WebDriver::Wait.new(timeout: 3)\n \n #Open link\n js_scroll_up(link)\n link.click\n $test_driver.switch_to.window( $test_driver.window_handles.last )\n #Test it for URL or title\n begin\n if expected_title == nil\n wait.until { $test_driver.current_url.downcase.include? expected_url.downcase }\n elsif expected_url == nil\n wait.until { $test_driver.title.include? expected_title }\n else\n fail(\"Did not specify expected title or expected url\")\n end\n #Print detalied error message\n rescue Selenium::WebDriver::Error::TimeOutError\n if expected_title == nil\n fail(\"Expected URL did not include \" + expected_url + \", was instead: \" + $test_driver.current_url)\n elsif expected_url == nil\n fail(\"Expected title did not include \" + expected_title + \", was instead: \" + $test_driver.title)\n end\n end\n\n #Close tab that was opened\n if ENV['BROWSER_TYPE'] == 'IE'\n $test_driver.execute_script(\"window.open('', '_self', ''); window.close();\")\n else\n $test_driver.execute_script(\"window.close();\")\n end\n $test_driver.switch_to.window( $test_driver.window_handles.first )\nend", "def assert_absence_of_non_kamishibai_links(options = {})\n ignores = options[:except] || []\n ignores += accepted_non_kamishibai_links\n\n css_select(\"a\").each do |anchor|\n href = anchor.attributes[\"href\"]\n next if ignores.detect{|regexp| href =~ regexp}\n method = anchor.attributes[\"method\"] || anchor.attributes[\"data-method\"]\n next if !method.blank? && method.upcase != \"GET\"\n if @request.user_agent != user_agent_strings_for(:galapagos)\n if href !~ /^http/ && href !~ /^#/\n assert false, \"Non-kamishibai local link for #{href} in #{@templates.keys}\"\n end\n else\n if href =~ /^#!_/\n assert false, \"Kamishibai local link advertantly for #{href} in #{@templates.keys}\"\n end\n end\n end\n end", "def verifyAboutUsLinks()\n\t\n\tputs \"************** START: Verify AboutUs Links ****************\"\n\t\n\tputs \"Step 1 : Click on AboutRazoo Link at the Footer.\"\n\t$browser.click \"link=About Razoo\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Razoo Overview\")\n\t\tputs \"Step 1 is Passed. User has reached the AboutRazoo screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 1 is Failed. User had failed to reach the About Razoo screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 2 : Click on Overview Link in AboutRazoo screen.\"\n\t$browser.click \"link=Overview\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Donate. Fundraise. Connect.\")\n\t\tputs \"Step 2 is Passed. User has reached the Overview screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 2 is Failed. User had failed to reach the Overview screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 3 : Click on CloserLook Link in AboutRazoo screen.\"\n\t$browser.click \"link=A Closer Look\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"A Closer Look\")\n\t\tputs \"Step 3 is Passed. User has reached the CloserLook screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 3 is Failed. User had failed to reach the CloserLook screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 4 : Click on OurTeam Link in AboutRazoo screen.\"\n\t$browser.click \"link=Our Team\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Razoo is a vibrant social enterprise with an accomplished, fun, and diverse team.\")\n\t\tputs \"Step 4 is Passed. User has reached the OurTeam screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 4 is Failed. User had failed to reach the CloserLook screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 5 : Click on Careers Link in AboutRazoo screen.\"\n\t$browser.click \"link=Careers\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Careers at Razoo\")\n\t\tputs \"Step 5 is Passed. User has reached the Careers screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 5 is Failed. User had failed to reach the Careers screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 6 : Click on PressCoverage Link in AboutRazoo screen.\"\n\t$browser.click \"link=Press Coverage\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Razoo often appears in both local and national press in recognition of our innovative website and approach to online giving and fundraising.\")\n\t\tputs \"Step 6 is Passed. User has reached the PressCoverage screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 6 is Failed. User had failed to reach the PressCoverage screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 7 : Click on ContactUs Link in AboutRazoo screen.\"\n\t$browser.click \"link=Contact Us\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Contact Us\")\n\t\tputs \"Step 7 is Passed. User has reached the ContactUs screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 7 is Failed. User had failed to reach the ContactUs screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 8 : Click on AtGlance Link in AboutRazoo screen.\"\n\t$browser.click \"link=At A Glance\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"What We Offer - At A Glance\")\n\t\tputs \"Step 8 is Passed. User has reached the AtGlance screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 8 is Failed. User had failed to reach the AtGlance screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 9 : Click on ForIndividuals Link in AboutRazoo screen.\"\n\t$browser.click \"link=For Individuals\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Razoo For Individuals\")\n\t\tputs \"Step 9 is Passed. User has reached the ForIndividuals screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 9 is Failed. User had failed to reach the ForIndividuals screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 10 : Click on ForNonProfits Link in AboutRazoo screen.\"\n\t$browser.click \"link=For Nonprofits\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Razoo For Nonprofits\")\n\t\tputs \"Step 10 is Passed. User has reached the ForNonProfits screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 10 is Failed. User had failed to reach the ForNonProfits screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 11 : Click on ForFoundations Link in AboutRazoo screen.\"\n\t$browser.click \"link=For Foundations\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Razoo For Foundations\")\n\t\tputs \"Step 11 is Passed. User has reached the ForFoundations screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 11 is Failed. User had failed to reach the ForFoundations screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 12 : Click on ForCorporations Link in AboutRazoo screen.\"\n\t$browser.click \"link=For Corporations\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Razoo For Corporations\")\n\t\tputs \"Step 12 is Passed. User has reached the ForCorporations screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 12 is Failed. User had failed to reach the ForCorporations screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 13 : Click on SuccessStories Link in AboutRazoo screen.\"\n\t$browser.click \"link=Success Stories\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Success Stories\")\n\t\tputs \"Step 13 is Passed. User has reached the SuccessStories screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 13 is Failed. User had failed to reach the SuccessStories screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 14 : Click on BestValue Link in AboutRazoo screen.\"\n\t$browser.click \"link=The Best Value\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"The Best Value\")\n\t\tputs \"Step 14 is Passed. User has reached the BestValue screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 14 is Failed. User had failed to reach the BestValue screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 15 : Click on EFT Link in AboutRazoo screen.\"\n\t$browser.click \"link=EFT\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"EFT Authorization Form for Nonprofits\")\n\t\tputs \"Step 15 is Passed. User has reached the EFT screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 15 is Failed. User had failed to reach the EFT screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 16 : Click on DonateAnywhere Link in AboutRazoo screen.\"\n\t$browser.click \"link=DonateAnywhere Widget\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"The DonateAnywhere Widget\")\n\t\tputs \"Step 16 is Passed. User has reached the DonateAnywhere screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 16 is Failed. User had failed to reach the DonateAnywhere screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 17 : Click on EDP Link in AboutRazoo screen.\"\n\t$browser.click \"link=Enhanced Donation Processing\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Enhanced Donation Processing\")\n\t\tputs \"Step 17 is Passed. User has reached the EDP screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 17 is Failed. User had failed to reach the EDP screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 18 : Click on Tips Link in AboutRazoo screen.\"\n\t$browser.click \"link=Introducing Tips\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"tips\")\n\t\tputs \"Step 18 is Passed. User has reached the Tips screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 18 is Failed. User had failed to reach the Tips screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 19 : Click on Blog Link in AboutRazoo screen.\"\n\t$browser.click \"link=Blog on Razoo Impact\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Razoo Impact\")\n\t\tputs \"Step 19 is Passed. User has reached the Blog screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 19 is Failed. User had failed to reach the Blog screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 20 : Click on HowDonationsWork Link in AboutRazoo screen.\"\n\t$browser.click \"link=How Donations Work\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"How Donations Work\")\n\t\tputs \"Step 20 is Passed. User has reached the HowDonationsWork screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 20 is Failed. User had failed to reach the HowDonationsWork screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 21 : Click on FundraisingIdeas Link in AboutRazoo screen.\"\n\t$browser.click \"link=Fundraising Ideas\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Fundraising Ideas\")\n\t\tputs \"Step 21 is Passed. User has reached the FundraisingIdeas screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 21 is Failed. User had failed to reach the FundraisingIdeas screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 22 : Click on SetUpFR Link in AboutRazoo screen.\"\n\t$browser.click \"link=How to Setup a Fundraiser\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Create a Fundraising Page\")\n\t\tputs \"Step 22 is Passed. User has reached the SetUpFR screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 22 is Failed. User had failed to reach the SetUpFR screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 23 : Click on MakeYourPageGreat Link in AboutRazoo screen.\"\n\t$browser.click \"link=Make Your Page Great\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Make Your Page Great\")\n\t\tputs \"Step 23 is Passed. User has reached the MakeYourPageGreat screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 23 is Failed. User had failed to reach the MakeYourPageGreat screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 24 : Click on SharePromote Link in AboutRazoo screen.\"\n\t$browser.click \"link=Share and Promote Your Page\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Share and Promote your page\")\n\t\tputs \"Step 24 is Passed. User has reached the SharePromote screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 24 is Failed. User had failed to reach the SharePromote screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 25 : Click on Logos Link in AboutRazoo screen.\"\n\t$browser.click \"link=Logos\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"We've collected a few logos for your use.\")\n\t\tputs \"Step 25 is Passed. User has reached the SharePromote screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 25 is Failed. User had failed to reach the SharePromote screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 26 : Click on OurHomepage Link in AboutRazoo screen.\"\n\t$browser.click \"link=Get Featured on Our Homepage\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Getting Featured on Razoo\")\n\t\tputs \"Step 26 is Passed. User has reached the OurHomepage screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 26 is Failed. User had failed to reach the OurHomepage screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 27 : Click on FAQIndividuals Link in AboutRazoo screen.\"\n\t$browser.click \"link=FAQs for Individuals\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"FAQs for Individuals\")\n\t\tputs \"Step 27 is Passed. User has reached the FAQIndividuals screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 27 is Failed. User had failed to reach the FAQIndividuals screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 28 : Click on FAQNonProfits Link in AboutRazoo screen.\"\n\t$browser.click \"link=FAQs for Nonprofits\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"FAQs for Nonprofits\")\n\t\tputs \"Step 28 is Passed. User has reached the FAQNonProfits screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 28 is Failed. User had failed to reach the FAQNonProfits screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 29 : Click on Security Link in AboutRazoo screen.\"\n\t$browser.click \"link=Security\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Security and Privacy\")\n\t\tputs \"Step 29 is Passed. User has reached the Security screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 29 is Failed. User had failed to reach the Security screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 30 : Click on Privacy Link in AboutRazoo screen.\"\n\t$browser.click \"link=Privacy\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"The Razoo.com Privacy Policy\")\n\t\tputs \"Step 30 is Passed. User has reached the Privacy screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 30 is Failed. User had failed to reach the Privacy screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 31 : Click on TOU Link in AboutRazoo screen.\"\n\t$browser.click \"link=Terms of Use\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"The Razoo.com Terms of Use\")\n\t\tputs \"Step 31 is Passed. User has reached the TOU screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 31 is Failed. User had failed to reach the TOU screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"************** END: Verify AboutUs Links ****************\"\n\nend", "def test_get_position_links\n a = Scraper.new\n link = a.get_position_links\n assert_equal(30,link.length, \"Expected number of link in a single page: \")\n end", "def show\n if @link\n @link.clicked!(:referrer => request.referrer)\n redirect_to @link.url\n else\n render text: \"No such link.\", status: 404\n end\n end", "def link\n @headers[:link]\n end", "def link\n @link\n end", "def test_get_headline_link_from_user\n # Initialize mechanize\n \tmechanize = Mechanize.new\n page = mechanize.get(\"https://news.osu.edu/sports/\")\n # Go through each of the headings and put the link and heading into their respective arrays\n headlines = page.search('.pp_bigheadlines_heading').map {|element| Headline.new(element.text.strip, element.children[1].attributes['href'].to_s.delete_prefix('//news.osu.edu/'))}\n # Get the page with the headline the user wanted\n puts \"please input the number 1 for testing \\n\"\n actual_url = get_headline_link_from_user(headlines)\n expected_url = \"https://news.osu.edu/2021-ohio-state-big-ten-football-schedule-revision-announced/\" \n assert_equal expected_url, actual_url\n end", "def should_have_correct_static_pages_links\n\tvisit root_path\n\tclick_link \"About\"\n\tpage.should have_selector 'title', text: full_title('About Us')\n\tclick_link \"Help\"\n\tpage.should have_selector 'title', text: full_title('Help')\n\tclick_link \"Contact\"\n\tpage.should have_selector 'title', text: full_title('Contact')\n\tclick_link \"Home\"\n\tclick_link \"Sign up now!\"\n\tpage.should have_selector 'title', text: full_title('Sign up')\n\tclick_link \"social app\"\n\tpage.should have_selector 'title', text: 'Social App'\nend", "def link(_content, _url)\n raise NotImplementedError\n end", "def navigate_to(link)\n\t $driver.get link\nend", "def verifyStoryAdminLinks()\n\t\n\tputs \"************** START: Verify PRO page Links ****************\"\n\t\n\tputs \"Step 1 : Click on EditPage link on the Story page.\"\n\t$browser.click \"link=Edit Page\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"The Basics\")\n\t\tputs \"Step 1 is Passed. User has reached the EditPage screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 1 is Failed. User had failed to reach EditPage screen.\"\n\t\t$verification_errors << $!\n\tend\n\n\tputs \"Step 2 : Click on Thumbnail link on the Story page.\"\n\t$browser.click \"link=Thumbnail\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Current Thumbnail\")\n\t\tputs \"Step 2 is Passed. User has reached the Thumbnail screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 2 is Failed. User had failed to reach Thumbnail screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 3 : Click on Matching Grants link on the Story page.\"\n\t$browser.click \"link=Matching Grants\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Grantor\")\n\t\tputs \"Step 3 is Passed. User has reached the Matching Grants screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 3 is Failed. User had failed to reach Matching Grants screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 4 : Click on Promote link on the Story page.\"\n\t$browser.click \"link=Promote\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Or get a donation button to put on your website\")\n\t\tputs \"Step 4 is Passed. User has reached the Promote screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 4 is Failed. User had failed to reach Promote screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 5 : Click on DonateAnywhere link on the Story page.\"\n\t$browser.click \"link=DonateAnywhere\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"DonateAnywhere\")\n\t\tputs \"Step 5 is Passed. User has reached the DonateAnywhere screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 5 is Failed. User had failed to reach DonateAnywhere screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 6 : Click on Donations link on the Story page.\"\n\t$browser.click \"link=Donations\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Donations Listing\")\n\t\tputs \"Step 6 is Passed. User has reached the Donations screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 6 is Failed. User had failed to reach Donations screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"************** END: Verify PRO page Links ****************\"\n\t\nend", "def verifyStoryAdminLinks()\n\t\n\tputs \"************** START: Verify PRO page Links ****************\"\n\t\n\tputs \"Step 1 : Click on EditPage link on the Story page.\"\n\t$browser.click \"link=Edit Page\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"The Basics\")\n\t\tputs \"Step 1 is Passed. User has reached the EditPage screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 1 is Failed. User had failed to reach EditPage screen.\"\n\t\t$verification_errors << $!\n\tend\n\n\tputs \"Step 2 : Click on Thumbnail link on the Story page.\"\n\t$browser.click \"link=Thumbnail\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Current Thumbnail\")\n\t\tputs \"Step 2 is Passed. User has reached the Thumbnail screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 2 is Failed. User had failed to reach Thumbnail screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 3 : Click on Matching Grants link on the Story page.\"\n\t$browser.click \"link=Matching Grants\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Grantor\")\n\t\tputs \"Step 3 is Passed. User has reached the Matching Grants screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 3 is Failed. User had failed to reach Matching Grants screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 4 : Click on Promote link on the Story page.\"\n\t$browser.click \"link=Promote\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Or get a donation button to put on your website\")\n\t\tputs \"Step 4 is Passed. User has reached the Promote screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 4 is Failed. User had failed to reach Promote screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 5 : Click on DonateAnywhere link on the Story page.\"\n\t$browser.click \"link=DonateAnywhere\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"DonateAnywhere\")\n\t\tputs \"Step 5 is Passed. User has reached the DonateAnywhere screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 5 is Failed. User had failed to reach DonateAnywhere screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 6 : Click on Donations link on the Story page.\"\n\t$browser.click \"link=Donations\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Donations Listing\")\n\t\tputs \"Step 6 is Passed. User has reached the Donations screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 6 is Failed. User had failed to reach Donations screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"************** END: Verify PRO page Links ****************\"\n\t\nend", "def test_NeedHelpLink\n\n loginpage = Hudl_Login_Page.new @@driver\n\n loginpage.ClickNeedHelp()\n\n end", "def assert_last_page\n assert_no_link NEXT_LABEL\n end", "def select_link (linktext)\n\t\t@link = @browser.link :text => linktext\n\t\t@link.click\n\tend", "def url?(link)\n true if link =~ /\\Ahttps?:\\/\\//\nend", "def test_sentence_with_link_sent_to_links\n input = \"I like <em>dinosaurs and tigers</em> on [home page](http://www.espn.com).\"\n expected = \"I like <em>dinosaurs and tigers</em> on <a href='http://www.espn.com'>home page</a>.\"\n output = Em.new(input)\n assert_equal expected, output.send_to_links\n end", "def link?\n !link.nil? && !link.empty?\n end", "def link?\n !link.nil? && !link.empty?\n end", "def assert_not_last_page\n assert_link NEXT_LABEL\n end", "def link(link, title, content)\n \"#{content} (#{link})\"\n end", "def assert_valid_links(links)\n assert_kind_of 'options[:links]', links, Array\n\n if links.empty?\n raise ArgumentError, '+options[:links]+ should not be empty'\n end\n\n links.each do |link|\n case link\n when Symbol, String\n unless @relationships.key?(link.to_sym)\n raise ArgumentError, \"+options[:links]+ entry #{link.inspect} does not map to a relationship in #{model}\"\n end\n\n when Associations::Relationship\n # TODO: figure out how to validate links from other models\n #unless @relationships.value?(link)\n # raise ArgumentError, \"+options[:links]+ entry #{link.name.inspect} does not map to a relationship in #{model}\"\n #end\n\n else\n raise ArgumentError, \"+options[:links]+ entry #{link.inspect} of an unsupported object #{link.class}\"\n end\n end\n end", "def set_test_link\n @test_link = TestLink.find(params[:id])\n end", "def parse_link; end", "def visit_link?(link, from_page = nil)\n !@pages.has_page?(link) &&\n !skip_link?(link) &&\n !skip_query_string?(link) &&\n allowed(link) &&\n !too_deep?(from_page)\n end", "def visit_link?(link, from_page = nil)\n !@pages.has_page?(link) &&\n !skip_link?(link) &&\n !skip_query_string?(link) &&\n allowed(link) &&\n !too_deep?(from_page)\n end", "def follow(link_text)\n Praline::browser.find_element(:link, link_text).click\n end", "def link \n puts \"It's Dangerous To Go Alone! Take This.\"\nend", "def link_click(ele)\n ref=$array[\"#{ele}\"]\n path=ele.split(\"_\").last\n $log.info \"verifying the #{ele} present or not \"\n if $browser.link(:\"#{path}\", \"#{ref}\").exists?\n $log.info \"#{ele} is prsented on the webpage\"\n $browser.link(:\"#{path}\", \"#{ref}\").click\n $log.info \"clicked the #{ele} link\"\n\n elsif $browser.span(:\"#{path}\", \"#{ref}\").exists?\n $log.info \"{ele} is presented on the webpage\"\n $browser..span(:\"#{path}\", \"#{ref}\").click\n $log.info \"clicked the #{ele}\"\n else\n $log.info \"failed to find the #{ele} link\"\n raise(\"failed to find the #{ele} link\") \n end\n \n \nend", "def should_see_facebook_login_button\n expect(page).to have_link(\"fb_login_btn\")\n end", "def test_03_storyadmin_clickall_links()\n\t\t\n\t\tputs \"---------------------- START OF SCENARIO 02 ----------------------\"\n\t\tlogin(\"orgadmin@aol.com\", \"123456\")\n\t\tverifyHeaderLinks()\n\t\tverifyFooterLinks()\n\t\tverifyMyAccountLinks()\n\t\tverifyNPOAdminLinks(\"Minnesota Community Foundation\")\n\t\t#~ searchProject(\"RazooTrunkFirefoxPRO20 of Minnesota Community Foundation\")\n\t\t#~ verifyStoryAdminLinks()\n\t\tlogout()\n\t\tputs \"---------------------- END OF SCENARIO 02 --------------------------\"\n\tend", "def check_exist_link_tp\n check('link source/target tp ref check') do |messages|\n all_links do |link, _nw|\n src_refs = link.source.refs\n dst_refs = link.destination.refs\n check_tp_ref(messages, 'source', src_refs, link)\n check_tp_ref(messages, 'destination', dst_refs, link)\n end\n end\n end", "def link!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 25 )\n\n type = LINK\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 159:8: 'link'\n match( \"link\" )\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__, 25 )\n\n end", "def verifyNPOAdminLinks(story_name)\n\t\n\tputs \"************** START: Verify ORG page Links ****************\"\n\t\n\tputs \"Step 1 : Click on MY NPO link at the Header.\"\n\t$browser.click \"link=My NPO\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(story_name)\n\t\tputs \"Step 1 is Passed. User has reached the MY NPO screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 1 is Failed. User had failed to reach MY NPO screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 2 : Click on EditPage link on the Story page.\"\n\t$browser.click \"link=Edit Page\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"The Basics\")\n\t\tputs \"Step 2 is Passed. User has reached the EditPage screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 2 is Failed. User had failed to reach EditPage screen.\"\n\t\t$verification_errors << $!\n\tend\n\n\tputs \"Step 3 : Click on Thumbnail link on the Story page.\"\n\t$browser.click \"link=Thumbnail\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Current Thumbnail\")\n\t\tputs \"Step 3 is Passed. User has reached the Thumbnail screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 3 is Failed. User had failed to reach Thumbnail screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 4 : Click on Matching Grants link on the Story page.\"\n\t$browser.click \"link=Matching Grants\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Grantor\")\n\t\tputs \"Step 4 is Passed. User has reached the Matching Grants screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 4 is Failed. User had failed to reach Matching Grants screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 5 : Click on NPO Details link on the Story page.\"\n\t$browser.click \"link=NPO Details\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Charity Logo:\")\n\t\tputs \"Step 5 is Passed. User has reached the NPO Details screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 5 is Failed. User had failed to reach NPO Details screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 6 : Click on Promote link on the Story page.\"\n\t$browser.click \"link=Promote\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Or get a donation button to put on your website\")\n\t\tputs \"Step 6 is Passed. User has reached the Promote screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 6 is Failed. User had failed to reach Promote screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 7 : Click on DonateAnywhere link on the Story page.\"\n\t$browser.click \"link=DonateAnywhere\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"DonateAnywhere\")\n\t\tputs \"Step 7 is Passed. User has reached the DonateAnywhere screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 7 is Failed. User had failed to reach DonateAnywhere screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 8 : Click on Donations link on the Story page.\"\n\t$browser.click \"link=Donations\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Donations Listing\")\n\t\tputs \"Step 8 is Passed. User has reached the Donations screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 8 is Failed. User had failed to reach Donations screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 9 : Click on Donations link on the Story page.\"\n\t$browser.click \"link=Disbursements\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Disbursements\")\n\t\tputs \"Step 9 is Passed. User has reached the Disbursements screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 9 is Failed. User had failed to reach Disbursements screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\t# ------------------------------ Global Admin Links -----------------------------\n\tbegin \n\t\tassert $browser.is_element_present(\"link=Data Sources\")\n\t\tputs \"Step 10 : Click on Create Data Sources link on the Story page.\"\n\t\t$browser.click \"link=Data Sources\"\n\t\t$browser.wait_for_page_to_load \n\t\tbegin\n\t\t\tassert $browser.is_text_present(\"Razoo Admin Area\")\n\t\t\tputs \"Step 10 is Passed. User has reached the Data Sources screen successfully.\"\n\t\trescue Test::Unit::AssertionFailedError\n\t\t\tputs \"Step 10 is Failed. User had failed to reach Data Sources screen.\"\n\t\t\t$verification_errors << $!\n\t\tend\n\t\tputs \"Step 11 : Click on Create Audits link on the Story page.\"\n\t\t$browser.click \"link=Audits\"\n\t\t$browser.wait_for_page_to_load \n\t\tbegin\n\t\t\tassert $browser.is_text_present(\"PATRIOT Act\")\n\t\t\tputs \"Step 11 is Passed. User has reached the Audits screen successfully.\"\n\t\trescue Test::Unit::AssertionFailedError\n\t\t\tputs \"Step 11 is Failed. User had failed to reach Audits screen.\"\n\t\t\t$verification_errors << $!\n\t\tend\n\trescue\n\t\tputs \"Step 10 & 11 : I don't have access to view Data Sources and Audit links.\"\n\tend\n\t# ------------------------------ Global Admin Links -----------------------------\n\t\n\tputs \"Step 12 : Click on Create Project link on the Story page.\"\n\t$browser.click \"link=Create Project\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"The Basics\")\n\t\tputs \"Step 12 is Passed. User has reached the Create Project screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 12 is Failed. User had failed to reach Create Project screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"************** END: Verify ORG page Links ****************\"\n\nend", "def verifyNPOAdminLinks(story_name)\n\t\n\tputs \"************** START: Verify ORG page Links ****************\"\n\t\n\tputs \"Step 1 : Click on MY NPO link at the Header.\"\n\t$browser.click \"link=My NPO\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(story_name)\n\t\tputs \"Step 1 is Passed. User has reached the MY NPO screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 1 is Failed. User had failed to reach MY NPO screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 2 : Click on EditPage link on the Story page.\"\n\t$browser.click \"link=Edit Page\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"The Basics\")\n\t\tputs \"Step 2 is Passed. User has reached the EditPage screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 2 is Failed. User had failed to reach EditPage screen.\"\n\t\t$verification_errors << $!\n\tend\n\n\tputs \"Step 3 : Click on Thumbnail link on the Story page.\"\n\t$browser.click \"link=Thumbnail\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Current Thumbnail\")\n\t\tputs \"Step 3 is Passed. User has reached the Thumbnail screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 3 is Failed. User had failed to reach Thumbnail screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 4 : Click on Matching Grants link on the Story page.\"\n\t$browser.click \"link=Matching Grants\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Grantor\")\n\t\tputs \"Step 4 is Passed. User has reached the Matching Grants screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 4 is Failed. User had failed to reach Matching Grants screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 5 : Click on NPO Details link on the Story page.\"\n\t$browser.click \"link=NPO Details\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Charity Logo:\")\n\t\tputs \"Step 5 is Passed. User has reached the NPO Details screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 5 is Failed. User had failed to reach NPO Details screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 6 : Click on Promote link on the Story page.\"\n\t$browser.click \"link=Promote\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Or get a donation button to put on your website\")\n\t\tputs \"Step 6 is Passed. User has reached the Promote screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 6 is Failed. User had failed to reach Promote screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 7 : Click on DonateAnywhere link on the Story page.\"\n\t$browser.click \"link=DonateAnywhere\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"DonateAnywhere\")\n\t\tputs \"Step 7 is Passed. User has reached the DonateAnywhere screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 7 is Failed. User had failed to reach DonateAnywhere screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 8 : Click on Donations link on the Story page.\"\n\t$browser.click \"link=Donations\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Donations Listing\")\n\t\tputs \"Step 8 is Passed. User has reached the Donations screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 8 is Failed. User had failed to reach Donations screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 9 : Click on Disbursements link on the Story page.\"\n\t$browser.click \"link=Disbursements\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Disbursements\")\n\t\tputs \"Step 9 is Passed. User has reached the Disbursements screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 9 is Failed. User had failed to reach Disbursements screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\t# ------------------------------ Global Admin Links -----------------------------\n\tbegin \n\t\tassert $browser.is_element_present(\"link=Data Sources\")\n\t\tputs \"Step 10 : Click on Create Data Sources link on the Story page.\"\n\t\t$browser.click \"link=Data Sources\"\n\t\t$browser.wait_for_page_to_load \n\t\tbegin\n\t\t\tassert $browser.is_text_present(\"Razoo Admin Area\")\n\t\t\tputs \"Step 10 is Passed. User has reached the Data Sources screen successfully.\"\n\t\trescue Test::Unit::AssertionFailedError\n\t\t\tputs \"Step 10 is Failed. User had failed to reach Data Sources screen.\"\n\t\t\t$verification_errors << $!\n\t\tend\n\t\tputs \"Step 11 : Click on Create Audits link on the Story page.\"\n\t\t$browser.click \"link=Audits\"\n\t\t$browser.wait_for_page_to_load \n\t\tbegin\n\t\t\tassert $browser.is_text_present(\"PATRIOT Act\")\n\t\t\tputs \"Step 11 is Passed. User has reached the Audits screen successfully.\"\n\t\trescue Test::Unit::AssertionFailedError\n\t\t\tputs \"Step 11 is Failed. User had failed to reach Audits screen.\"\n\t\t\t$verification_errors << $!\n\t\tend\n\trescue\n\t\tputs \"Step 10 & 11 : I don't have access to view Data Sources and Audit links.\"\n\tend\n\t# ------------------------------ Global Admin Links -----------------------------\n\t\n\tputs \"Step 12 : Click on Create Project link on the Story page.\"\n\t$browser.click \"link=Create Project\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"The Basics\")\n\t\tputs \"Step 12 is Passed. User has reached the Create Project screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 12 is Failed. User had failed to reach Create Project screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"************** END: Verify ORG page Links ****************\"\n\nend", "def link(link, title, content)\n\t \"<u><link href='#{link}'>#{content}</link></u>\"\n\t end", "def link\n object[\"link\"]\n end", "def link(url, title) # :nodoc:\n warn \"link called from #{self.inspect}\"\n \"[#{title}](#{url})\"\n end", "def verifyNPOAdminLinks(story_name)\n\t\n\tputs \"************** START: Verify ORG page Links ****************\"\n\t\n\tputs \"Click on MY NPO link at the Header.\"\n\tbegin \n\t\tassert $browser.is_element_present(\"link=My nonprofit\")\n\t\t$browser.click \"link=My nonprofit\"\n\t\t$browser.wait_for_page_to_load \n\t\tbegin\n\t\t\tassert $browser.is_text_present(story_name)\n\t\t\tputs \"Step 1 is Passed. User has reached the MY NPO screen successfully.\"\n\t\trescue Test::Unit::AssertionFailedError\n\t\t\tputs \"Step 1 is Failed. User had failed to reach MY NPO screen.\"\n\t\tend\n\trescue\n\t\t$browser.click \"link=My nonprofits\"\n\t\t$browser.wait_for_page_to_load\n\t\tbegin\n\t\t\tassert $browser.is_text_present(\"News Feed\")\n\t\t\tputs \"Step 1 is Passed. User has reached the Account screen successfully.\"\n\t\t\t$browser.click \"link=Harvard College\"\n\t\t\t$browser.wait_for_page_to_load\n\t\trescue Test::Unit::AssertionFailedError\n\t\t\tputs \"Step 1 is Failed. User had failed to reach Account screen.\"\n\t\tend\n\tend \n\tsleep 5\n\tputs \"Step 2 : Click on EditPage link on the Story page.\"\n\t$browser.click \"link=Edit\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Tell Your Story\")\n\t\tputs \"Step 2 is Passed. User has reached the EditPage screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 2 is Failed. User had failed to reach EditPage screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 4 : Click on Matching Grants link on the Story page.\"\n\t$browser.click \"link=Matching Grants\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Matching Grant\")\n\t\tputs \"Step 4 is Passed. User has reached the Matching Grants screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 4 is Failed. User had failed to reach Matching Grants screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 8 : Click on Donations link on the Story page.\"\n\t$browser.click \"link=Donations\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Donations Listing\")\n\t\tputs \"Step 8 is Passed. User has reached the Donations screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 8 is Failed. User had failed to reach Donations screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\t# ------------------------------ Global Admin Links -----------------------------\n\tbegin \n\t\tassert $browser.is_element_present(\"link=Razoo Admins\")\n\t\tputs \"Step 10 : Click on Create Data Sources link on the Story page.\"\n\t\t$browser.click \"link=Data Sources\"\n\t\t$browser.wait_for_page_to_load \n\t\tbegin\n\t\t\tassert $browser.is_text_present(\"Razoo Admin Area\")\n\t\t\tputs \"Step 10 is Passed. User has reached the Data Sources screen successfully.\"\n\t\trescue Test::Unit::AssertionFailedError\n\t\t\tputs \"Step 10 is Failed. User had failed to reach Data Sources screen.\"\n\t\t\t$verification_errors << $!\n\t\tend\n\t\tputs \"Step 11 : Click on Create Audits link on the Story page.\"\n\t\t$browser.click \"link=Audits\"\n\t\t$browser.wait_for_page_to_load \n\t\tbegin\n\t\t\tassert $browser.is_text_present(\"PATRIOT Act\")\n\t\t\tputs \"Step 11 is Passed. User has reached the Audits screen successfully.\"\n\t\trescue Test::Unit::AssertionFailedError\n\t\t\tputs \"Step 11 is Failed. User had failed to reach Audits screen.\"\n\t\t\t$verification_errors << $!\n\t\tend\n\trescue\n\t\tputs \"Step 10 & 11 : I don't have access to view Data Sources and Audit links.\"\n\tend\n\t# ------------------------------ Global Admin Links -----------------------------\n\n\t\n\tputs \"************** END: Verify ORG page Links ****************\"\n\nend" ]
[ "0.72316915", "0.7087352", "0.7048184", "0.6803872", "0.67697275", "0.6733283", "0.663515", "0.65928894", "0.65332997", "0.6459212", "0.64545757", "0.64526594", "0.6428117", "0.6423113", "0.6341839", "0.6329584", "0.6320291", "0.63007975", "0.62639904", "0.6233173", "0.6230213", "0.62183636", "0.6207315", "0.62039685", "0.62034535", "0.6179166", "0.61552066", "0.6155188", "0.6149556", "0.61355025", "0.61172855", "0.6109004", "0.6109004", "0.6093522", "0.60923326", "0.6089699", "0.6087478", "0.6087313", "0.6084728", "0.60839844", "0.6066903", "0.60668504", "0.6055423", "0.60549164", "0.6046185", "0.6045269", "0.60451263", "0.60109174", "0.6009412", "0.6008165", "0.6007863", "0.598796", "0.5984856", "0.5980699", "0.5937757", "0.59347665", "0.5928573", "0.59268665", "0.5919432", "0.5917414", "0.5914239", "0.5907998", "0.59039146", "0.5891462", "0.5887025", "0.5883077", "0.5873389", "0.5862853", "0.58549947", "0.58462954", "0.5835711", "0.5821855", "0.5821855", "0.5804437", "0.5800523", "0.5797796", "0.5788059", "0.5777416", "0.5777002", "0.5777002", "0.57751495", "0.57748175", "0.5774793", "0.576241", "0.5761113", "0.5747428", "0.5747428", "0.57399297", "0.5737967", "0.5735202", "0.5723278", "0.5721193", "0.5720886", "0.57059175", "0.5701794", "0.5701794", "0.5696321", "0.56898624", "0.5680734", "0.5674139" ]
0.6579738
8
About linkbased navigation Following a link
def i_follow(link) link = case link when String link when Tag link[:href] when ::Waw::ActionController::Action link.href else raise ArgumentError, "Unable to apply i_follow to #{link.inspect}" end i_reach(link) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_page; link 'next' end", "def click_through_link\n\t\treturn '/items/' + self.items.first.slug if !self.items.first.blank?\n\t\treturn '/blog/' + self.blogs.first.slug if !self.blogs.first.blank?\n\t\treturn \"#\"\n\tend", "def links; end", "def links; end", "def click(link); end", "def show\n if @link\n @link.clicked!(:referrer => request.referrer)\n redirect_to @link.url\n else\n render text: \"No such link.\", status: 404\n end\n end", "def link_self; end", "def nav_link(link_text, link_path)\n class_name = current_page?(link_path) ? 'current' : ''\n\n # Playlists and Tags routes should also trigger highlighting of the Watch Ignite Videos menu item\n current_uri = request.env['PATH_INFO']\n if ['/tags','/playlists'].include? current_uri and link_path == '/videos'\n class_name = 'current'\n end\n\n content_tag(:li, :class => class_name) do\n link_to link_text, link_path\n end\n end", "def nav_link(text, link, options = {})\n #controller, action=\"index\", show_link=true , css_class='')\n options.reverse_merge! :li_class => '', :show_link => true, :a_class => ''\n if current_page?(link)\n if options[:show_link]\n \"<li class=\\\"current #{options[:li_class]}\\\">#{link_to text, link, :class => options[:a_class]}</li>\"\n else\n \"<li class=\\\"current #{options[:li_class]}\\\">#{text}</li>\"\n end\n else\n \"<li class=\\\"#{options[:li_class]}\\\">#{link_to text, link, :class => options[:a_class]}</li>\"\n end\n end", "def follow(link_text)\n Praline::browser.find_element(:link, link_text).click\n end", "def nav_link(linkname1, logged_in_path, linkname2, nonlogged_path)\n if logged_in?\n\tlink_to linkname1, logged_in_path\n\telse\n\tlink_to linkname2, nonlogged_path\n\tend\nend", "def nav_link(text, link)\n recognized = Rails.application.routes.recognize_path(link)\n if recognized[:controller] == params[:controller] && recognized[:action] == params[:action]\n content_tag(:li, :class => \"active\") { link_to( text, link ) }\n else\n content_tag(:li) { link_to( text, link ) }\n end\n end", "def my_links\n end", "def follow\n\n end", "def links_to_follow(page)\n @page = page # need below, sorry\n links = @focus_crawl_block ? instance_eval(@focus_crawl_block).call(page) : page.links\n links.select { |link| visit_link?(link, page) }.map { |link| link.dup }\n end", "def links_to_follow(page)\n @page = page # need below, sorry\n links = @focus_crawl_block ? instance_eval(@focus_crawl_block).call(page) : page.links\n links.select { |link| visit_link?(link, page) }.map { |link| link.dup }\n end", "def open_link(head)\n if head == \"Search\"\n show_search\n elsif @sections.has_key? head\n open_section(head)\n elsif @methods.has_key? head\n open_methods(head)\n elsif @mindex.has_key? head\n head, sub = @mindex[head]\n open_methods(head, nil, sub)\n elsif head =~ /^http:\\/\\//\n debug head\n visit head\n end\n end", "def links_to_follow(page)\n links = @focus_crawl_block ? @focus_crawl_block.call(page) : page.links\n links.select { |link| visit_link?(link, page) }\n end", "def navigation\n [IndexHtmlUnit.new.link] + ModelHtmlUnitCollection.links_by_make(make)\n end", "def nav_link_to(link_text, link)\n if current_page?(link)\n link_to link_text, link, class: \"active\"\n else\n link_to link_text, link\n end\n end", "def nav_link(text,controller,action=\"index\")\n link_to_unless_current text,:id=>nil,:controller=>controller,:action=>action\n end", "def follow_links(p)\n\t\tif p.links\n\t\t\tp.links.each do |l|\n\t\t\t\tnext if @visited_pages.include? l\n\t\t\t\t\n\t\t\t\tlp = Wikipedia.find(l)\n\t\t\t\tif lp.is_a? Array\n\t\t\t\t\tlp.each do |lp_i|\n\t\t\t\t\t\tlogger.debug \"following to: #{lp_i.title}\"\n\t\t\t\t\t\tif is_artist_page? lp_i\n\t\t\t\t\t\t\tp = lp_i\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\telsif not is_artist_page? p\n\t\t\t\t\tif is_artist_page? lp\n\t\t\t\t\t\tp = lp\n\t\t\t\t\t\tbreak\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tp\n\tend", "def follow_button\n view_renderer.follow_tag_link(@target)\n end", "def link_to_identifier; end", "def link_to_identifier; end", "def navigate_to(link)\n\t $driver.get link\nend", "def link_through\n @link.increment_uses!\n redirect_to(@link.url)\n end", "def linkToPageIDFrom(toPageID, fromPageID)\n puts \"Link #{toPageID} to #{fromPageID}\"\n link = $links[toPageID]\n if link == nil\n\tputs \"Bad link for #{toPageID}\"\n end\n if toPageID == fromPageID\n return link\n elsif fromPageID == \"toc\"\n link = \"pages/\" + link\n elsif toPageID == \"toc\" and fromPageID\n link = \"../\" + link\n end\n return link\nend", "def go_to_where_you_belong\n \n end", "def link() url; end", "def link() url; end", "def nav_link(text,controller,action=\"index\")\n\t\t\tlink_to_unless_current text,:controller=>controller,:action=>action\n\t\tend", "def navigation\n [IndexHtmlUnit.new.link, MakeHtmlUnitCollection.link_by_make(make)]\n end", "def next_page\n @page.link_with(:text => /Next/)\n end", "def link_to_nav(name, url)\n path = request.path\n current = false\n\n # path - url\n # docs/index.html - /docs/index.html\n # docs/index.html - /docs\n # docs/quickstart/dashboard - /docs\n\n # Strip leading / from the url\n testUrl = url[1..-1]\n\n\n if testUrl == path\n # Exact match\n current = true\n elsif path.start_with? testUrl\n # starts with match\n current = true\n end\n\n if current\n link_to name, url, :class => \"active\"\n else\n link_to name, url\n end\n end", "def link_to_page(page)\n link_to(page.name, page.navigation_path)\n end", "def main_nav_link_helper(role,link_id,link_text,link_title,link_details)\n if has_role?(role)\n (\"<li id='#{link_id}'#{\" class='active'\" if main_nav_guess_current == link_id}>\" +\n link_to(link_text, link_details, :title => link_title) +\n \"</li>\").html_safe\n else\n \"\"\n end\n end", "def navigation_link_to(txt, url)\n\t\tpage_index = request[\"path\"].gsub(\"index.html\",\"\")\n\t\t\n\t\tif url == \"/#{page_index}\"\n\t\t\treturn link_to(txt, url, :class => \"active\")\n\t\tend\n\t\tlink_to(txt,url)\n\tend", "def follow_redirection(&block); end", "def navigation_link(nav,text=nil)\n text ||= nav\n \"<li id=\\\"#{nav.split(\"/\").last.downcase}_tab\\\">#{link_to(text, :controller => \"/#{nav.downcase}\")}</li>\"\n end", "def nav_link(*args)\n class_names = \"button\"\n class_names = \"#{class_names} #{args[2][:class]}\" if args.length >= 3\n content_tag(:li, active_link_to(args[0] , args[1] , :title => args[0]), :class => class_names)\n end", "def link_to_follow\n return if !current_user || current_user == user\n if current_user.following?(user)\n url = user_following_path(user, current_user)\n link_to('Unfollow', url, :method => :delete, :class => 'unfollow')\n else\n link_to('Follow', following_path, :method => :create, :class => 'follow')\n end\n end", "def next_and_previous_links(work, chapter)\n if logged_in? && current_user.is_author_of?(work)\n number_of_chapters = work.chapters.in_order.size \n chapter_position = work.chapters.in_order.index(chapter)\n else\n number_of_chapters = work.chapters.posted.in_order.size \n chapter_position = work.chapters.posted.in_order.index(chapter)\n end\n links = []\n \n links << link_to_chapter(\"First Chapter\", work, 0)\n links << (chapter_position == 0 ? \n \"Previous Chapter\" : \n link_to_chapter(\"Previous Chapter\", work, chapter_position-1))\n links << (chapter_position == (number_of_chapters - 1) ? \n \"Next Chapter\" : \n link_to_chapter(\"Next Chapter\", work, chapter_position+1))\n links << link_to_chapter(\"Last Chapter\", work, number_of_chapters-1)\n end", "def nav_link(link_text, link_path)\n recognized = Rails.application.routes.recognize_path(link_path)\n class_name = recognized[:controller] == params[:controller] ? 'active' : ''\n content_tag(:li, class: class_name) do\n link_to link_text, link_path\n end\n end", "def link\n @link\n end", "def links_to_follow(page)\n links = @focus_crawl_block ? @focus_crawl_block.call(page) : page.links\n links.select { |link| visit_link?(link, page) }.map { |link| link.dup }\n end", "def links_to_follow(page)\n links = @focus_crawl_block ? @focus_crawl_block.call(page) : page.links\n links.select { |link| visit_link?(link, page) }.map { |link| link.dup }\n end", "def nav_link(text, action=\"index\", controller)\n\t\treturn link_to_unless_current text, :id => nil, :controller => controller, :action => action\n\tend", "def link_4menu(item) #:nodoc:\n html = ''\n link = item.link\n link = \"/#{@site.route_name}/#{item.page_id}\" #if link.blank?\n# \n html << @parent.link_to(item.picture, link) unless item.picture.blank?\n html << if !item.caption.blank?\n # TODO Translation\n @parent.link_to(item.caption, link)\n end\nend", "def nav_link_to(text, path)\n\t\t\tlink_to_unless_current text, path do\n\t\t\t\tlink_to text, '#', :class => 'current'\n\t\t\tend\n\t\tend", "def nav_link(link_text, link_path)\n class_name = current_page?(link_path) ? 'active' : ''\n\n content_tag(:li, :class => class_name) do\n link_to link_text, link_path\n end\n end", "def clicked\n router.navigated\n end", "def navigation_link_to(name, options = {}, html_options = {})\n if current_page?(options)\n content_tag(\"span\", name)\n else\n link_to name, options, html_options\n end\n end", "def link *a; app.link *a end", "def nav(name=\"\", path=root_path, active='')\n active_class = active == controller.controller_name ? 'activelink' : ''\n markaby do #=> Markaby template.\n li :class => active_class do\n link_to(name, path)\n end\n end\n end", "def navigate_to_link(link_name)\n find_link(link_name).click\n end", "def navigation_list_link_to(name, options = {}, html_options = {})\n content_tag(\"li\", navigation_link_to(name, options, html_options))\n end", "def navlistbar_hubs_link\n $tracer.trace(__method__)\n return GINavbarHubsListLinks.new(li.className(\"magazine\").div.className(\"subnav\").a, __method__)\n end", "def nav_link(text, path)\n if current_page? path\n content_tag :li, class: 'active' do\n\n # <span class=\"sr-only\">(current)</span> required for Screen Readers\n link_to path do\n concat text\n concat content_tag :span, '(current)', class: 'sr-only'\n end\n end\n else\n content_tag :li do\n link_to text, path\n end\n end\n end", "def href; end", "def link_to(name, url, options = {}); end", "def link_to_landing_page \n \"/about/#{url_uuid}\"\n end", "def navigation (sec)\n chap = sec.chapter\n cfname = name2fn chap.name\n res=\"\"\n next_ref=proc{|n| \"<a href =\\\"#{name2fn n.name}\\\">Next</a>\"}\n prev_ref=proc{|n| \"<a href =\\\"#{name2fn n.name}\\\">Previous</a> \"}\n if sec.secnum == 0\n res<< prev_ref[$chapters[chap.number-1]]unless chap.number==1\n res<< \"<a href = \\\"index.htm\\\">Up</a> \"\n res<< next_ref[$chapters[chap.number+1]]if $chapters[chap.number+1]\n else\n res<< prev_ref[chap.sections[sec.secnum-1]]unless sec.secnum == 1\n res<< \"<a href = \\\"#{cfname}\\\">Up</a> \"\n res<< \"<a href = \\\"index.htm\\\">Top</a> \"\n res<< next_ref[chap.sections[sec.secnum+1]]if chap.sections[sec.secnum+1]\n end\n res<< \"<BR><a href = \\\"theindex.htm\\\">Index</a>\\n\"\n res\nend", "def navigationUrl\n @url\n end", "def navigation_helper(label, link_path, link_opts={})\n li_opts = {}\n li_opts = request.path.eql?(link_path) ? { class: \"selected\" } : {}\n content_tag(:li, link_to(label, link_path, link_opts), li_opts)\n end", "def tasknav_link(text, action) \n link_to text, :id => nil, :controller => \"task\", :action => action \n end", "def nav_link(text, route)\n content_tag(:li, class: current_page?(route) ? \"active\" : \"\") do\n link_to text, route\n end\n end", "def parse_link; end", "def nav_link(text, controller, action=\"index\", id=nil)\n link_to_unless_current text, :id => nil, :controller => controller, :action => action, :id => id\n end", "def link!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 25 )\n\n type = LINK\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 159:8: 'link'\n match( \"link\" )\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__, 25 )\n\n end", "def navigate_to(url)\n self.visit url\n end", "def linked\n request('linked')\n end", "def get_my_link()\n strip = self;\n return \"#{strip.id}\";\n# return \"comic/#{strip.id}\"; # this utilizes our route magic \n # to forward us to home/index/:id \n end", "def next_follow\n end", "def follow_redirect?; end", "def nav_link(text, controller, action=\"index\")\n content_tag(:div, \"#{img} #{link}\", :id => \"nav_row\") do\n image_tag(\"red_arrow.jpg\") + link_to_unless_current(text, :id => nil, :action => action, :controller => controller)\n end\n end", "def draw_link(href, label, current_path = \"\")\n active = active_path?(href, current_path)\n\n l = \"<li\"\n l += active ? ' class=\"active\">' : \">\"\n l += %Q(<a href=\"#{href}\">#{label})\n l += active ? ' <span class=\"sr-only\">(current)</span>' : \"\"\n l += \"</a></li>\"\n end", "def follow_get_redirection(&block); end", "def main_menu_link; MAIN_MENU_LINK; end", "def links_feed\n end", "def nav_link(link_text, icon_text, link_path)\n\t\tclass_name = current_page?(link_path) ? 'current' : ''\n\n\t\tcontent_tag(:li, :class => class_name) do\n\t\t\tlink_to \"#{icon(icon_text)} <span>#{link_text}</span>\".html_safe, link_path\n\t\tend\n\tend", "def posts_nav_link( sep = '', prelabel = '', nxtlabel = '' )\n args = { sep: sep, prelabel: prelabel, nxtlabel: nxtlabel } # TODO array_filter\n get_posts_nav_link( args )\n end", "def nav_link(text, options)\n link_to_unless_current text, options\n end", "def direct_link\n link = params[:link];\n if ( link.blank? )\n add_error(\"EMPTY DIRECT LINK\");\n redirect_to :controller=>\"general\";\n return;\n end\n begin\n as = ApplicationState.unmarshal(link.strip);\n logger.info \"******* as=#{as.to_hash().to_s}\"\n logger.info \"******* as=#{as.redirect_to_hash().to_s}\"\n # TODO see that as.user equals the current user, and hadle in-equality.\n redirect_to :controller=>\"mt_company\", :action=>\"mt_req_show\", :id=>\"330\" #as.redirect_to_hash();\n return;\n rescue Exception => e\n add_error( e.message );\n add_error( \"<pre>#{params[:link]}</pre>\")\n add_error(\"BAD DIRECT LINK\");\n redirect_to :controller=>\"general\";\n end\n end", "def nav_link(text, *paths)\n attrs = paths.any? { |p| current_page?(p) } ? { :class => \"active\" } : {}\n content_tag(:li, attrs) { link_to text, paths.first }\n end", "def visited_page(url); end", "def visited_page(url); end", "def nav_link(text, path, link_args={})\n if path.kind_of? Array\n current = path.any? do |p|\n current_page?(p)\n end\n path = path[0]\n else\n current = current_page?(path)\n end\n\n link_args[:class] = \"#{current ? 'active' : ''} nav-link #{link_args[:class] || ''}\"\n\n content_tag(:li, link_to(text, path, link_args), class: \"nav-item\")\n end", "def neat_pages_navigation(options={})\n NeatPages::Helpers::Navigation.new(pagination, request).generate\n end", "def item title, link\n unless current_page? link\n content_tag :li, link_to(title, link)\n else\n content_tag(:li, :class => :active){\n content_tag :strong, title\n }\n end\n end", "def site_page_navigation_item(text, path, link_html_opts={}, li_html_opts={})\n li_class = current_page?(path) ? \"active\" : \"\"\n content_tag :li, li_html_opts.merge(:class=>li_class) do\n link_to text.html_safe, path, link_html_opts\n end\n end", "def create_links\n end", "def create_links\n end", "def layouts_show_links(*args)\n render \"layouts/show/links\", obj: args.shift, sender: args.shift, args: args \n end", "def menu_link_to(text, url, options={}, current=nil)\n content_tag :li, link_to(text, url, options), :class => (current.nil? ? part_of_current_url?(url) : current) ? 'current' : nil\n end", "def next_and_previous_links_listitems(work, chapter)\n links = next_and_previous_links(work, chapter)\n links.collect {|link| \"<li>\" + link + \"</li>\\n\"}\n end", "def link\n '-'\n end", "def link\n node.at(\"link\").text\n end", "def go\r\n\t\t@link = Link.find_by_in_url(params[:in_url])\r\n\t\tunless @link\r\n\t\t\tflash[:errors] = [\"Non existing short url!\"]\r\n\r\n\t\t\t@link = Link.new({in_url: params[:in_url]})\r\n\t\t\t@links = Link.all\r\n\r\n\t\t\trender :root\r\n\t\telse\r\n\t\t\tredirect_to @link.out_url, status: @link.http_status\r\n\t\tend\r\n\tend", "def follow_redirect=(follow); end" ]
[ "0.6808108", "0.67411846", "0.66839784", "0.66839784", "0.66414374", "0.6522173", "0.64972407", "0.64508826", "0.64416075", "0.6394263", "0.6378187", "0.63633364", "0.62921023", "0.62797123", "0.6242351", "0.6242351", "0.62389725", "0.62112355", "0.6185782", "0.6185486", "0.61800396", "0.6174247", "0.61730313", "0.6172504", "0.6172504", "0.6163242", "0.6144561", "0.6142598", "0.61303586", "0.61224204", "0.61224204", "0.6115507", "0.611241", "0.61079955", "0.61065984", "0.61001086", "0.60758364", "0.60717183", "0.6042619", "0.60255873", "0.5984615", "0.5983641", "0.5982847", "0.5960151", "0.5959008", "0.59588027", "0.59588027", "0.59426045", "0.59419346", "0.59234655", "0.59180254", "0.5909219", "0.5907613", "0.59059834", "0.59027886", "0.5890583", "0.58784753", "0.5876289", "0.5870696", "0.5870248", "0.5867231", "0.5863197", "0.5861404", "0.58496404", "0.5841774", "0.58382094", "0.58285135", "0.5818852", "0.58119994", "0.58111644", "0.5802684", "0.5794964", "0.579493", "0.57896703", "0.5785713", "0.57853866", "0.57752603", "0.5773302", "0.57557696", "0.5754057", "0.57533836", "0.57512957", "0.57435757", "0.57292414", "0.57269406", "0.5726481", "0.5726481", "0.57253945", "0.5722017", "0.5721272", "0.57102954", "0.57086194", "0.57086194", "0.57071227", "0.5703096", "0.5694245", "0.5687977", "0.5685992", "0.5684366", "0.56817955" ]
0.61314225
28
About forms and action Submits some form with optional arguments
def i_submit(form, args = {}) assert_not_nil form, __last_because + "(form has not been found)" raise ArgumentError, "i_submit requires a Tag instance, #{form.inspect} received" unless Tag===form i_invoke(form[:action], args) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def submit; end", "def submit\n end", "def fb_request_form_submit(options={})\n\t\t\t tag(\"fb:request-form-submit\",stringify_vals(options))\n\t\t\tend", "def submit(form, button = T.unsafe(nil), headers = T.unsafe(nil)); end", "def submit_form\n @page = @form.submit\n end", "def submit!\n\tend", "def submit_form\n click_button 'submit'\n end", "def form_submit(form, opts = {})\n opts[:class] ||= \"btn btn-primary\"\n opts[:value] ||= submit_default_value(form)\n content_tag(:div, :class => \"form-actions\") do\n form.submit(opts)\n end\n end", "def submit_without_clicking_button\n path = self.action.blank? ? self.uri : self.action # If no action attribute on form, it submits to the same URI where the form was displayed\n params = {}\n fields.each {|field| params[field.name] = field.value unless field.value.nil? || field.value == [] || params[field.name] } # don't submit the nils, empty arrays, and fields already named\n \n # Convert arrays and hashes in param keys, since test processing doesn't do this automatically\n params = ActionController::UrlEncodedPairParser.new(params).result\n @testcase.make_request(request_method, path, params, self.uri, @xhr)\n end", "def form; end", "def click_submit\n end", "def submit(form, button = nil, headers = {})\n form.add_button_to_query(button) if button\n\n case form.method.upcase\n when 'POST'\n post_form(form.action, form, headers)\n when 'GET'\n get(form.action.gsub(/\\?[^\\?]*$/, ''),\n form.build_query,\n form.page,\n headers)\n else\n raise ArgumentError, \"unsupported method: #{form.method.upcase}\"\n end\n end", "def onSubmit(request, response, form, errors) \r\n return form\r\n end", "def onSubmit(request, response, form, errors) \r\n return form\r\n end", "def onSubmit(request, response, form, errors) \r\n return form\r\n end", "def onSubmit(request, response, form, errors) \r\n return form\r\n end", "def submits; end", "def onSubmit(request, response, form, errors)\r\n return form\r\n end", "def onSubmit(request, response, form, errors)\r\n return form\r\n end", "def form_submit\r\n form.submit\r\n @form = nil\r\nend", "def onSubmit(request, response, form, errors)\r\n\treturn form\r\n end", "def fill_form_and_submit(agent, creds, url, category, tech, data)\n case category\n when 'extensions'\n puts \"uploading #{category.chop}: #{data[category.chop].to_s}\" unless $quiet\n cat_page = get_page(agent, creds, url + CONFIG, {display: category, tech_hardware: 'custom_custom'})\n frm = cat_page.form('frm_extensions')\n when 'trunks'\n puts \"uploading #{category.chop}: #{data['trunk_name'].to_s}\" unless $quiet\n cat_page = get_page(agent, creds, url + CONFIG, {display: category, tech: tech.upcase})\n frm = cat_page.form('trunkEdit')\n end\n abort 'error: form not found' unless frm\n\n if $debug\n frm.fields.each { |field| puts \"send_sever_request: #{field.name}: #{field.value}\" }\n frm.checkboxes.each { |chkbx| puts \"send_sever_request: #{chkbx.name}: #{chkbx.value}\" }\n frm.radiobuttons.each { |rdb| puts \"send_sever_request: #{rdb.name}: #{rdb.value}\" if rdb.checked }\n end\n # Fill in the form, and submit it!\n data.each { |key, val| frm[key] = val }\n frm.submit\nend", "def submit(opts={})\n msg = \"Submit button not found in form\"\n selector = 'input[type=\"submit\"], input[type=\"image\"], button[type=\"submit\"]'\n if @submit_value\n msg << \" with a value of '#{@submit_value}'\"\n selector.gsub!(/\\]/, \"][value=#{@submit_value}]\")\n end\n raise MissingSubmitError, msg unless tag.select(selector).any?\n fields_hash.update(opts)\n submit_without_clicking_button\n end", "def submit_form(form)\n @agent.submit(form)\n end", "def submit(args = {})\n watercourse.set(args[:watercourse]) if args.key?(:watercourse)\n stop_day.set(args[:stop_day]) if args.key?(:stop_day)\n stop_month.set(args[:stop_month]) if args.key?(:stop_month)\n stop_year.set(args[:stop_year]) if args.key?(:stop_year)\n apply_day.set(args[:apply_day]) if args.key?(:apply_day)\n apply_month.set(args[:apply_month]) if args.key?(:apply_month)\n apply_year.set(args[:apply_year]) if args.key?(:apply_year)\n gauging_station.set(args[:gauging_station]) if args.key?(:gauging_station)\n hof_threshold.set(args[:hof_threshold]) if args.key?(:hof_threshold)\n contact_name.set(args[:contact_name]) if args.key?(:contact_name)\n contact_details.set(args[:contact_details]) if args.key?(:contact_details)\n sender_name.set(args[:sender_name]) if args.key?(:sender_name)\n sender_role.set(args[:sender_role]) if args.key?(:sender_role)\n sender_address.set(args[:sender_address]) if args.key?(:sender_address)\n submit_button.click\n end", "def onSubmit(request, response, form, errors) \n return form\n end", "def form\n end", "def emit_form(formdata: {})\n if formdata[JIRA] || formdata[CONFLUENCE]\n title = 'Update your JIRA and Confluence IDs (previously submitted)'\n submit_title = 'Update Your ID Mapping'\n else\n title = 'Enter your JIRA and Confluence IDs'\n submit_title = 'Submit Your ID Mapping'\n end\n _whimsy_panel(title, style: 'panel-success') do\n _form.form_horizontal method: 'post' do\n _div.form_group do\n _label.control_label.col_sm_3 'Do you have an Apache JIRA ID?', for: JIRAHAS\n _div.col_sm_9 do\n _select.form_control name: JIRAHAS, id: JIRAHAS, required: true do\n _option value: ''\n _option \"Yes - I have one JIRA ID\", value: 'y', selected: \"#{formdata[JIRAHAS] == 'y' ? 'selected': ''}\"\n _option \"No - I do not have a JIRA ID\", value: 'n', selected: \"#{formdata[JIRAHAS] == 'n' ? 'selected': ''}\"\n _option \"I use multiple JIRA IDs\", value: 'm', selected: \"#{formdata[JIRAHAS] == 'm' ? 'selected': ''}\"\n end\n end\n end\n emit_input(label: 'Enter your Apache JIRA ID (if you have one)', name: JIRA, required: false,\n value: \"#{formdata[JIRA]}\", \n helptext: \"The JIRA ID used on issues.apache.org (usually same as committer ID)\")\n emit_input(label: 'List any other JIRA IDs you personally use, one per line', name: JIRAOTHER, required: false,\n value: \"#{formdata[JIRAOTHER]}\",\n rows: 3, helptext: \"Remember: these should only be personal IDs you use, not project ones.\")\n \n _div.form_group do\n _label.control_label.col_sm_3 'Do you have an Apache Confluence ID?', for: CONFLUENCEHAS\n _div.col_sm_9 do\n _select.form_control name: CONFLUENCEHAS, id: CONFLUENCEHAS, required: true do\n _option value: ''\n _option \"Yes - I have one Confluence ID\", value: 'y', selected: \"#{formdata[CONFLUENCEHAS] == 'y' ? 'selected': ''}\"\n _option \"No - I do not have a Confluence ID\", value: 'n', selected: \"#{formdata[CONFLUENCEHAS] == 'n' ? 'selected': ''}\"\n _option \"I use multiple Confluence IDs\", value: 'm', selected: \"#{formdata[CONFLUENCEHAS] == 'm' ? 'selected': ''}\"\n end\n end\n end\n emit_input(label: 'Enter your Apache Confluence ID (if you have one)', name: CONFLUENCE, required: false,\n value: \"#{formdata[CONFLUENCE]}\", \n helptext: \"The Confluence ID used on cwiki.apache.org (usually same as committer ID)\")\n emit_input(label: 'List any other Confluence IDs you personally use, one per line', name: CONFLUENCEOTHER, required: false,\n value: \"#{formdata[CONFLUENCEOTHER]}\",\n rows: 3, helptext: \"Remember: these should only be personal IDs you use, not project ones.\")\n \n emit_input(label: 'Your Apache Committer ID', name: COMMITTERID, readonly: true,\n value: formdata[COMMITTERID], icon: 'glyphicon-user', iconlabel: 'Committer ID')\n _div.col_sm_offset_3.col_sm_9 do\n _input.btn.btn_default type: 'submit', value: submit_title\n end\n end\n end\nend", "def submit(contents, attrs = {})\n current_form_context.submit(contents, attrs)\n end", "def test_submit_on_form\n page = @agent.get(\"http://localhost/form_multival.html\")\n form = page.form_with(:name => 'post_form')\n\n assert_not_nil(form)\n assert_equal(2, form.fields_with(:name => 'first').length)\n\n form.fields_with(:name => 'first')[0].value = 'Aaron'\n form.fields_with(:name => 'first')[1].value = 'Patterson'\n\n page = form.submit\n\n assert_not_nil(page)\n\n assert_equal(2, page.links.length)\n assert_not_nil(page.link_with(:text => 'first:Aaron'))\n assert_not_nil(page.link_with(:text => 'first:Patterson'))\n end", "def submit(value = nil, name = nil)\n attributes = if (not value) or value.kind_of?(String)\n { \"TYPE\" => \"submit\", \"VALUE\" => value, \"NAME\" => name }\n else\n value[\"TYPE\"] = \"submit\"\n value\n end\n input(attributes)\n end", "def ogone_form options={}, html={}\n ogone_form_tag(html) do\n output = ogone_fields(options)\n output << \"\\t<input type='submit' value='ga verder naar ogones' id='submit2' name='submit2'>\\n\"\n end\n end", "def submitIncidentForm(page, startYear, endYear)\n form = page.form_with(:action => \"search.php\");\n form['start_year'] = startYear;\n form['end_year'] = endYear;\n page = page.form_with(:action => \"search.php\").click_button();\nend", "def input_submit(value = nil, args = {})\n args = args.merge(:type => :submit)\n args[:value] = value unless value.nil?\n\n @g.p do\n @g.input(args)\n end\n end", "def submit(value = \"Submit\", options = {})\n @template.submit_tag(value, options)\n end", "def forms; end", "def submit(form_selector='form', submit_matcher='submit', input_values_hash={})\n forms = (self.html/form_selector)\n\n if forms.length != 1\n raise \"Problem with parsing form page -- expected only 1 form tag on `#{self.url}` matching selector `#{form_selector}`, but selected `#{forms.length}` fom tags\\n#{forms.inspect}\"\n end\n\n form_values = Hpricotscape::Form.parse(forms[0])\n full_action_url = if form_values[:action].starts_with?('/')\n \"#{self.url.split('://').first}://#{self.url.split('://').last.split('/').first}#{form_values[:action]}\"\n elsif form_values[:action].index('://').nil?\n \"#{self.url.rpartition('/').first}/#{form_values[:action]}\"\n else\n form_values[:action]\n end\n\n # Allow user to use strings or symbols for input values, and merge them into the form\n form_values[:inputs].keys.each do |k|\n form_values[:inputs][k.to_s] = input_values_hash[k.to_s] if input_values_hash.has_key?(k.to_s)\n form_values[:inputs][k.to_s] = input_values_hash[k.to_sym] if input_values_hash.has_key?(k.to_sym)\n end\n\n submit_key = form_values[:submits].keys.select { |k| k.downcase.index(submit_matcher) }.first\n form_post_body = form_values[:inputs].merge(submit_key => form_values[:submits][submit_key])\n\n _load(full_action_url, form_values[:method], form_post_body)\n end", "def bp_submit(*args, &block)\n if block_given?\n \"No admite &block\"\n else\n label = args.first\n options = args.second || {}\n #options_hash = options # Para que reciba cualquier atributo (sin filtrar)\n options_hash = {}\n\n options_hash[:class] = options[:class].blank? ? \"btn\" : bp_class(\"btn #{options[:class]}\")\n\n if !options[:id].blank?\n options_hash[:id] = options[:id]\n end\n\n if options[:input_id].blank?\n input_id = options_hash[:id].blank? ? \"\" : \"input_#{options_hash[:id]}\"\n else\n input_id = options[:input_id]\n end\n\n input_hash = {}\n input_hash[:id] = input_id\n\n content_tag :div, options_hash do\n submit_tag label, input_hash\n end\n end\n end", "def submit(button = T.unsafe(nil), headers = T.unsafe(nil)); end", "def link_to_submit text, args\n link_to_function text, \"$(this).closest('form').submit()\", args\n end", "def submit\r\n assert_exists\r\n submit_form \r\n @o.wait\r\n end", "def submit\n frm.button(:value=>\"Submit\").click\n @@file_number=0\n if frm.div(:class=>\"portletBody\").h3.text=~/Submission Confirmation/\n SubmissionConfirmation.new(@browser)\n elsif frm.button(:value=>\"Back to list\").exist?\n SubmissionConfirmation.new(@browser)\n else\n AssessmentsList.new(@browser)\n end\n end", "def submit\n frm.button(:value=>\"Submit\").click\n @@file_number=0\n if frm.div(:class=>\"portletBody\").h3.text=~/Submission Confirmation/\n SubmissionConfirmation.new(@browser)\n elsif frm.button(:value=>\"Back to list\").exist?\n SubmissionConfirmation.new(@browser)\n else\n AssessmentsList.new(@browser)\n end\n end", "def submit(value = \"Submit\", options = {})\n @template.submit_tag(value, options)\n end", "def apphelp_submit( form, action_or_string, indent = nil )\n return apphelp_complex_button(\n form,\n action_or_string,\n {\n :indent => indent,\n :button_image => 'accept'\n }\n )\n end", "def submit(button_name=nil, opts={})\n # 1. Loop through the non hidden fields and if they're active and displayed enter the value\n fill_in_field_data\n\n # 2. Submit Form\n submit_button = select_submit_button(button_name, opts)\n\n wait_for_submit(submit_button)\n submit_button.node.click\n\n # 3. Wait for Page page\n wait_for_page(driver, metz)\n\n # 4. Return new Page\n Metallize::Page.new(driver, metz)\n\n end", "def submit(value = nil, options = {})\n value = (@object.new_record?? \"Create\" : \"Update\") if value.nil?\n build_shell(value, options, 'submit_button') { super }\n end", "def submit\n click_button 'SEND'\n self\n end", "def fb_request_form_submit\n tag \"fb:request-form-submit\"\n end", "def submit\n frm.button(:value=>\"Submit\").click\n SubmissionConfirmation.new(@browser)\n end", "def submit\n frm.button(:value=>\"Submit\").click\n SubmissionConfirmation.new(@browser)\n end", "def form(*args, &blk)\n _singleton_form_context.form(*args, &blk)\n end", "def submit locator\r\n command 'submit', locator\r\n end", "def submit locator\r\n command 'submit', locator\r\n end", "def submit\n self.oaw_follow(params[:follow])\n self.oaw_unfollow(params[:unfollow])\n end", "def submit(form_name)\n Praline::browser.find_element(:name, form_name).submit\n end", "def standard_submit name=nil, object=nil\n name = post_type unless name\n object = @post unless object\n submit_tag(\"Save #{name}\") + (object.new_record? ? \"\" : (\" or \" + link_to(\"Delete\", { :action => 'show' }, :method => :delete, :confirm => \"Are you sure?\", :class => \"delete\")))\n end", "def create_submit_button(args)\n\n\t\tform = args[\"form\"]\n\t\tdestination = args[\"destination\"]\n\t\ttext = args[\"text\"] || \"Submit\"\n\n\t\tform_ids = @@current_forms[form]\n\t\tsubmit_script = \"\"\n\t\tif form_ids\n\t\t\tsubmit_script = \"<script>function submit_form_#{form}() {var form_args = \"\n\t\t\tform_args = []\n\t\t\t@@current_forms[form].each do |id|\n\t\t\t\tform_args << \"'#{id}=' + encodeURIComponent(document.getElementById('#{id}').value)\"\n\t\t\tend\n\t\t\t@@current_forms.delete(form)\n\t\t\tsubmit_script += \"#{form_args.join(\" + '&' + \")};\"\n\t\t\tsubmit_script += \"location.href = '#{destination}?' + form_args;}</script>\"\n\t\tend\n\t\treturn \"#{submit_script}<button onclick='submit_form_#{form}();'>#{text}</button>\"\n\tend", "def submit_button(form, args = {})\n classes = \"btn btn-primary #{args.delete(:class)}\".strip!\n label = args.delete(:label)\n form.submit(label, args.merge!(class: classes))\n end", "def xf_submit (label = \"Submit\", target_options = {}, id = \"submit\", attrs = {})\n attrs = attrs.symbolize_keys()\n attrs[:submission] = id\n labelAttrs = attrs.delete(:labelAttrs)\n label = label(label, labelAttrs)\n method = attrs.delete(:method)\n model = model(attrs[:model])\n model.submission = submission(method, url_for(target_options), {:id => id})\n typeWithAttrs(\"submit\", label, attrs)\n end", "def new_job \n form{|f| f.action == 'job'}\nend", "def post(data = \"\")\n submit :Post, data\n end", "def link_to_submit(*args, &block)\n\t\tlink_to_function (block_given? ? capture(&block) : args[0]), \"$(this).closest('form').submit()\", args.extract_options!\n\tend", "def api_form_actions(object_name, options = {})\n \" <li><div class=\\\"form_actions\\\">\\n \" +\n submit_button(object_name, options[:submit_text]) + \"\\n \" + cancel_link +\n \"\\n </div></li>\"\n end", "def link_to_formsubmit(name, id, html_options = {}) \n \tlink_to_function(name, \"if(document.forms['#{id}'].onsubmit()) { document.forms['#{id}'].submit(); }\", html_options)\n end", "def on_submit\n controller.send(@form_name+'_submit', @model) unless controller.nil?\n clear\n end", "def link_to_submit(*args, &block)\n link_to_function (block_given? ? capture(&block) : args[0]), \"$(this).closest('form').submit()\", args.extract_options!\n end", "def form_from_options(opts)\n\t\tform_html = ''\n\t\topts.select {|e| e.has_key?(:method) && e[:method].match(/POST|PUT/)}.each do |opt|\n\t\t\tform_html += %Q{<h3>#{opt[:description]}</h3>}\n\t\t\tform_html += %Q{<form method=\"POST\" action=\"#{opt[:href]}\">\\n}\n\t\t\tif opt[:method] != \"POST\"\n\t\t\t\tform_html += %Q{<input type=\"hidden\" name=\"_method\" value=\"#{opt[:method]}\">}\n\t\t\tend\n\n\t\t\tif opt.has_key?(:parameters)\n\t\t\t\topt[:parameters].each do |k, v|\n\t\t\t\t\tform_html += %Q{#{v[:description]} <input type=\"text\" name=\"#{k}\"><br>\\n}\n\t\t\t\tend\n\t\t\tend\n\t\t\tform_html += '<input type=\"submit\" value=\"Do\"></form><br>'\n\t\tend\n\t\treturn form_html\n\tend", "def submit(value = nil, options = {})\n options[:class] ||= 'btn btn-primary'\n\n super value, options\n end", "def ajax_form_submit(opts = {})\n form_id = opts[:form_id] || id\n \"javascript:$('form##{form_id}').submit()\"\n end", "def form_submit_button(text=\"Continue\".t, *args)\n fat_turquoise_button_link_to(text, \"#{member_path([@tier, @topic, Kase], :new)}\")\n end", "def submit_form_with_rest(form_element: nil, action: nil, params: nil, expected_redirect: nil)\n if form_element.nil? && ( action.nil? && params.nil?)\n raise \"Must pass in either a form element to submit or an action url with a parameters hash\"\n end\n\n if form_element\n params = form_element.all(:css, \"input\").inject({}){|result, input| result[input[\"name\"]] = input.value ; result }\n action = form_element[\"action\"]\n end\n\n rest_request(:post, action, payload: params, format: :html, retry_login: true, expected_redirect: expected_redirect)\n end", "def submit(label, options = nil)\n str = ''\n \n label = options.delete(:value) unless label \n \n str << '<input type=\"submit\"'\n str << %[ value=\"#{label}\"] if label\n\n unless options.empty?\n opts = options.collect { |k, v| %[#{k}=\"#{v}\"] }.join(' ')\n str << %[ #{opts} ]\n end\n \n str << ' />'\n\n return str\n end", "def submit_spam(args)\n call_akismet('submit-spam', args)\n end", "def submit_mode\n enable_input_box\n hc_modal_button.title = \"Submit\"\n hc_modal_button.on_action = lambda do |sender|\n @pomodori_controller.create(:text => hc_pomodoro_input_box.to_s)\n @modal_button_controller.on_click_submit(sender)\n end\n end", "def submit_for_grading\n frm.button(:value=>\"Submit for Grading\").click\n SubmissionSummary.new(@browser)\n end", "def submit_for_grading\n frm.button(:value=>\"Submit for Grading\").click\n ConfirmSubmission.new(@browser)\n end", "def form_for(model, action, fields = [])\n if model.nil?\n raise ArgumentError.new(\"needs a model\")\n elsif action.nil?\n raise ArgumentError.new(\"needs an action\")\n end\n\n f = ''\n\n if model\n f << errors_on(model) \n end\n\n f << \"<form action=\\\"#{action}\\\" method=\\\"post\\\" class=\\\"edit-form\\\">\"\n\n fields.each do |field|\n case field\n when Array\n f << form_p(field[0], ({:model => model}.merge!(field[1] || {})))\n else\n f << form_p(field, :model => model)\n end\n end\n\n f << form_submit(\"Submit #{model.class.to_s.demodulize.titleize}\")\n end", "def submit(value = nil, options = {})\n div_form_group do\n div_col_md_9 do\n options[:class] = 'btn btn-success'\n # Disable button when the form is submitted\n data_options = options[:data] || {}\n options[:data] = data_options.merge(disable_with: 'Please wait..')\n orig_submit(value, options)\n end\n end\n end", "def restful_submit_tag(value, action, url, method, options = {})\n hidden_field_tag(\"__map[#{action}][url]\", url) <<\n hidden_field_tag(\"__map[#{action}][method]\", method.upcase) <<\n submit_tag(value, {:name => \"__rewrite[#{action}]\"}.reverse_merge!(options))\n end", "def form(http_method, action = nil)\n unless action\n action = http_method\n http_method = :get\n end\n @form_attrs = {method: http_method, action: action}\n @form_attrs\n end", "def post(action, **args); end", "def set_form(easy)\n end", "def submit_or_cancel(form, name='Cancel')\n form.submit + ' or ' + link_to(name, 'javascript:history.go(-1);', :class => 'cancel')\n end", "def submit_spam(options = {})\n call_akismet('submit-spam', options)\n end", "def action args = {}\n\t\tend", "def submit_or_cancel(form, name='Cancel')\n form.submit + \" or \" +\n link_to(name, root_path, :class => \"for_black_font_link\")\n #link_to(name, 'javascript:history.go(-1);', :class => 'cancel')\n end", "def emailform\n end", "def emailform\n end", "def form(*args, &block)\n options = args.extract_options!.to_options!\n\n model = args.first\n\n if model.respond_to?(:persisted)\n model = args.first\n\n options[:html] = (options[:html] || {}).merge!(form_attrs!(options))\n\n if options[:url].blank?\n options[:url] = url_for(:action => (model.persisted? ? :update : :create))\n end\n\n if model.respond_to?(:form_builder)\n options[:builder] = model.form_builder\n end\n\n form_for(model, options, &block)\n else\n if args.empty?\n action = options.delete(:action) || request.fullpath\n args.unshift(action)\n end\n\n options.merge!(form_attrs(options))\n\n args.push(options)\n\n form_tag(*args, &block)\n end\n end", "def action_form\n verify_ajax_request\n require_parameters :id, :issue\n\n @issue_result = Api.issues.find(params[:issue])\n @issue = @issue_result.first\n\n bad_request('Unknown issue') unless @issue\n\n action_type = params[:id]\n render :partial => \"issue/#{action_type}_form\"\n end", "def submit_default_value(form)\n key = form.object ? (form.object.persisted? ? :update : :create) : :submit\n defaults = []\n defaults << \"%s.%s\" % [controller_name.singularize, key]\n defaults << \"metadata_ingest_form.%s\" % key\n defaults << key\n defaults << \"Submit\"\n\n return I18n.t(defaults.shift, scope: [:helpers, :submit], default: defaults)\n end", "def html_form(url_or_path, *args)\n options = args.last.is_a?(Hash) ? args.pop.dup : {}\n # noinspection RubyMismatchedArgumentType\n separator = options.delete(:separator) || \"\\n\"\n content = args.flatten\n content += Array.wrap(yield) if block_given?\n content = content.compact_blank\n form_tag(url_or_path, options) do\n safe_join(content, separator)\n end\n end", "def submit\n respond_to do |format|\n if @order.submit\n session[:order_id] = nil\n format.html { redirect_to orders_path, notice: 'Замовлення відправлено.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def click_submit_button\n\t\tsubmit_button.click\n\tend", "def test_post_multival\n page = @agent.get(\"http://localhost/form_multival.html\")\n form = page.form_with(:name => 'post_form')\n\n assert_not_nil(form)\n assert_equal(2, form.fields_with(:name => 'first').length)\n\n form.fields_with(:name => 'first')[0].value = 'Aaron'\n form.fields_with(:name => 'first')[1].value = 'Patterson'\n\n page = @agent.submit(form)\n\n assert_not_nil(page)\n\n assert_equal(2, page.links.length)\n assert_not_nil(page.link_with(:text => 'first:Aaron'))\n assert_not_nil(page.link_with(:text => 'first:Patterson'))\n end", "def form_tag(url_for_options = T.unsafe(nil), options = T.unsafe(nil), &block); end", "def scaffold_form(url, options={})\n meth = options.delete(:method) || :post\n \"<form action='#{url}' method='#{meth}' #{options[:attributes]}>#{scaffold_token_tag if meth.to_s == 'post'}\"\n end", "def external_form_post_js( label = \"Submit\", action = '', params = {} )\n return \"<input type='button' value='#{label}' onClick='externalFormPost(\" + action.to_json + \",\" + params.to_json + \")'/>\"\n end", "def in_submit attrs = nil\n attrs ||= Hash.new\n a_droite = attrs.delete(:right)\n au_centre = attrs.delete(:center)\n f = \"\".in_input(attrs.merge(:value => self, :type => 'submit'))\n # Valeur retournée\n case true\n when a_droite then f.in_div(class: 'right')\n when au_centre then f.in_div(class: 'center')\n else f\n end\n end" ]
[ "0.69529366", "0.68987024", "0.682489", "0.6816341", "0.67750204", "0.67656577", "0.67510206", "0.6746226", "0.67338943", "0.66551137", "0.66525877", "0.661776", "0.6581385", "0.6581385", "0.6581385", "0.6581385", "0.65773493", "0.6560446", "0.6560446", "0.6549808", "0.6538663", "0.6528177", "0.65155876", "0.65113354", "0.64946663", "0.6481168", "0.64528346", "0.64297205", "0.63726336", "0.6344701", "0.63415873", "0.63358504", "0.6323445", "0.6318031", "0.63128096", "0.6257635", "0.6241996", "0.62131304", "0.6212146", "0.62111294", "0.6201702", "0.6191542", "0.6191542", "0.6185659", "0.6175976", "0.6173923", "0.617107", "0.614532", "0.61443496", "0.6122867", "0.6122867", "0.6095697", "0.6073921", "0.6073921", "0.60499173", "0.60284686", "0.6024837", "0.6016764", "0.60166085", "0.600637", "0.5983989", "0.5983704", "0.5957662", "0.59390116", "0.59325796", "0.59198314", "0.59136975", "0.5904113", "0.5890195", "0.58876103", "0.5883192", "0.58808774", "0.58786047", "0.5866491", "0.5860931", "0.5860619", "0.58483976", "0.58478254", "0.5837867", "0.5829435", "0.58205175", "0.58074987", "0.578971", "0.5781224", "0.5780017", "0.5740237", "0.5728789", "0.57265407", "0.57265407", "0.5711612", "0.5711091", "0.5706492", "0.5698553", "0.5698174", "0.5695612", "0.5689193", "0.56886667", "0.568722", "0.568161", "0.56761324" ]
0.64751977
26
Directly invoke an action or service server side, bypassing form lookup and so on.
def i_invoke(action, args = {}) result = case action when String browser.invoke_service(action, args) when ::Waw::ActionController::Action browser.invoke_action(action, args) else raise ArgumentError, "Unable to apply i_invoke on #{action.inspect}, unable to catch the associated action" end assert Net::HTTPSuccess===result, __last_because + " (invoking #{action.inspect} led to: #{result})" result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def invoke_action(name)\n check_authenticity_token unless req.request_method == 'GET'\n self.send(name)\n self.render(name.to_s) unless already_built_response?\n end", "def invoke_direct(method_name, *args)\r\n prepare_request('api', 'api', method_name, *args)\r\n @controller.process(@request, @response)\r\n decode_rpc_response\r\n end", "def invoke_action(name)\n end", "def invoke_action(name)\n end", "def invoke_action(name)\n end", "def invoke_action(name)\n check_authenticity_token if self.class.protect_from_forgery? && !get_request?\n\n send( name )\n render( name ) unless already_built_response?\n end", "def _call_action(action)\n send(action)\n end", "def process_action(method_name, *args); end", "def invoke_action(name)\n # debugger\n self.send(name)\n render(name.to_s) unless already_built_response?\n end", "def invoke_action(command, args, allow_private = false)\n session = request ? request.session || {} : {}\n if self.has_action? command, allow_private\n self.send :\"action_#{command}\", session, args\n else\n nil\n end # if-else\n end", "def invoke_action(name)\n if req.request_method != \"GET\" && @@protect_from_forgery\n self.check_authenticity_token\n end\n self.send(name)\n end", "def invoke_action(name)\n send(name)\n render(name) unless already_built_response?\n end", "def process_action(...)\n send_action(...)\n end", "def invoke_action(name)\n self.send(name)\n render(name.to_s) unless already_built_response?\n end", "def invoke_action(name)\n self.send(name)\n render(name) unless already_built_response?\n end", "def invoke_action(name)\n self.send(name)\n render(name) unless already_built_response?\n end", "def invoke_action(name)\n send(name)\n render(name) unless already_built_response?\n end", "def invoke_action(name)\n self.send(name)\n render unless self.already_built_response?\n\n end", "def call_action(handler, params, query_params)\n controller_name, action_name = handler.split('#')\n controller_class = lookup_controller(controller_name)\n controller = controller_class.new(self, params, query_params)\n controller.execute_action(action_name)\n end", "def send_action action_name, service_name\n self.class.actions[action_name][service_name].run(self)\n end", "def invoke_action(name)\n if protect_from_forgery? && req.request_method != \"GET\"\n check_authenticity_token\n else\n form_authenticity_token\n end\n\n send(name)\n render(name) unless already_built_response?\n\n end", "def invoke\n execute_only(:invoke)\n end", "def invoke_action(action, args = {})\n raise ArgumentError, \"Browser.invoke_action expects an ActionController::Action as first parameter\"\\\n unless ::Waw::ActionController::Action===action\n location, response = fetch(relative_uri(action.uri), :post, args)\n apply_action_routing(action, JSON.parse(response.body))\n self.response\n end", "def invoke_method\n unless check_preconditions\n return send_response(status: :precondition_failed)\n end\n\n method = request.request_method.downcase\n status, body = make_request method\n\n send_response status: status, body: body\n end", "def invoke_action(path)\n controller(path).send(action_name)\n end", "def invoke_layered(service_name, method_name, *args)\r\n prepare_request('api', service_name, method_name, *args)\r\n @controller.process(@request, @response)\r\n decode_rpc_response\r\n end", "def execute(*args)\n\n # Verify if the controller answers to the @action_name value\n raise WebFlowError, \"The action step #{@action_name} is not defined in your controller.\" unless args[0].respond_to? lookup_method_to_call(@action_name)\n \n # The controller defines a method with the same name as @action_name.\n # Kewl! A 'someone else problem' !!!\n args[0].send( lookup_method_to_call( @action_name ) )\n \n end", "def invoke_action(name)\n self.send(name)\n #Rails Magic: Default calls render on appropriate method even if the programmer doesn't :\n render(name) unless already_rendered?\n end", "def invoke *args, &proc\n\n if args.size == 0\n error 500, '`%s` expects an action(or an app and action) to be provided' % __method__\n end\n\n app = ::AppetiteUtils.is_app?(args.first) ? args.shift : self.class\n\n if args.size == 0\n error 500, 'Beside app, `%s` expects an action to be provided' % __method__\n end\n\n action = args.shift.to_sym\n route = app[action] || error(404, '%s app does not respond to %s action' % [app, action])\n rest_map = app.url_map[route]\n env.update 'SCRIPT_NAME' => route\n\n if args.size > 0\n path, params = '/', {}\n args.each { |a| a.is_a?(Hash) ? params.update(a) : path << a.to_s << '/' }\n env.update 'PATH_INFO' => path\n params.size > 0 &&\n env.update('QUERY_STRING' => build_nested_query(params))\n end\n app.new(nil, rest_map).call env, &proc\n end", "def invoke_delegated(service_name, method_name, *args)\r\n prepare_request(service_name.to_s, service_name, method_name, *args)\r\n @controller.process(@request, @response)\r\n decode_rpc_response\r\n end", "def invoke_service(service, args = {})\n raise ArgumentError, \"Browser.invoke_service expects a String as first parameter\"\\\n unless String===service\n location, response = fetch(relative_uri(service), :post, args)\n self.response\n end", "def invoke_action(name)\n if request.request_method != 'GET' && !csrf_safe?\n render_content('Invalid authenticity token.', 'text/text')\n return\n end\n self.send(name)\n unless already_rendered?\n render(name)\n end\n end", "def invoke\n begin \n # RequestStore.available_services[@amfbody.service_class_name] ||=\n @service = @amfbody.service_class_name.constantize.new #handle on service\n rescue Exception => e\n puts e.message\n puts e.backtrace\n raise RUBYAMFException.new(RUBYAMFException.UNDEFINED_OBJECT_REFERENCE_ERROR, \"There was an error loading the service class #{@amfbody.service_class_name}\")\n end\n \n #call one or the other method depending in the ruby version we are using\n if RUBY_VERSION > RUBY_19\n caller = \"to_sym\"\n else\n caller = \"to_s\"\n end \n\n if @service.private_methods.include?(@amfbody.service_method_name.send(caller))\n raise RUBYAMFException.new(RUBYAMFException.METHOD_ACCESS_ERROR, \"The method {#{@amfbody.service_method_name}} in class {#{@amfbody.service_class_file_path}} is declared as private, it must be defined as public to access it.\")\n elsif !@service.public_methods.include?(@amfbody.service_method_name.send(caller))\n raise RUBYAMFException.new(RUBYAMFException.METHOD_UNDEFINED_METHOD_ERROR, \"The method {#{@amfbody.service_method_name}} in class {#{@amfbody.service_class_file_path}} is not declared.\")\n end\n \n #clone the request and response and alter it for the target controller/method\n req = RequestStore.rails_request.clone\n res = RequestStore.rails_response.clone\n \n #change the request controller/action targets and tell the service to process. THIS IS THE VOODOO. SWEET!\n controller = @amfbody.service_class_name.gsub(\"Controller\",\"\").underscore\n action = @amfbody.service_method_name\n req.parameters['controller'] = req.request_parameters['controller'] = req.path_parameters['controller'] = controller\n req.parameters['action'] = req.request_parameters['action'] = req.path_parameters['action'] = action\n req.env['PATH_INFO'] = req.env['REQUEST_PATH'] = req.env['REQUEST_URI'] = \"#{controller}/#{action}\"\n req.env['HTTP_ACCEPT'] = 'application/x-amf,' + req.env['HTTP_ACCEPT'].to_s\n \n #set conditional helper\n @service.is_amf = true\n @service.is_rubyamf = true\n \n #process the request\n rubyamf_params = @service.rubyamf_params = {}\n if @amfbody.value && !@amfbody.value.empty?\n @amfbody.value.each_with_index do |item,i|\n rubyamf_params[i] = item\n end\n end\n \n # put them by default into the parameter hash if they opt for it\n rubyamf_params.each{|k,v| req.parameters[k] = v} if ParameterMappings.always_add_to_params \n \n begin\n #One last update of the parameters hash, this will map custom mappings to the hash, and will override any conflicting from above\n ParameterMappings.update_request_parameters(@amfbody.service_class_name, @amfbody.service_method_name, req.parameters, rubyamf_params, @amfbody.value)\n rescue Exception => e\n raise RUBYAMFException.new(RUBYAMFException.PARAMETER_MAPPING_ERROR, \"There was an error with your parameter mappings: {#{e.message}}\")\n end\n\n #fosrias\n #@service.process(req, res)\n\n # call the controller action differently depending on Rails version\n if Rails::VERSION::MAJOR < 3\n @service.process(req, res)\n else\n @service.request = req\n @service.response = res\n @service.process(action.to_sym)\n end\n #fosrias\n \n #unset conditional helper\n @service.is_amf = false\n @service.is_rubyamf = false\n @service.rubyamf_params = rubyamf_params # add the rubyamf_args into the controller to be accessed\n \n result = RequestStore.render_amf_results\n \n #handle FaultObjects\n if result.class.to_s == 'FaultObject' #catch returned FaultObjects - use this check so we don't have to include the fault object module\n e = RUBYAMFException.new(result['code'], result['message'])\n e.payload = result['payload']\n raise e\n end\n \n #amf3\n @amfbody.results = result\n if @amfbody.special_handling == 'RemotingMessage'\n @wrapper = generate_acknowledge_object(@amfbody.get_meta('messageId'), @amfbody.get_meta('clientId'))\n @wrapper[\"body\"] = result\n @amfbody.results = @wrapper\n end\n @amfbody.success! #set the success response uri flag (/onResult)\n end", "def invoke_action(name)\n send(name)\n unless @already_built_response\n render (name)\n end\n end", "def send_action(*_arg0); end", "def server_invoke(service, args, decode_method = nil)\n location, response = fetch(relative_uri(service), :post, args)\n response\n end", "def remote_call_for_action_on_entity(action, entity, options = {})\n action or fail \"helper 'remote_call_for_action' lacks of input params.\"\n entity or return # do nothing\n action = action.to_s\n controller = options[:controller] || entity.controller_name\n options.merge!(:url => \"\\/#{controller}\\/#{action}\\/#{entity.to_param}\")\n remote_function_with_params(options) \n end", "def method_missing(method, *args, &block)\n if actions(current_api).include? method\n self.class.send(:define_method, method) do |params|\n perform_soap_call(method, params) || perform_rest_call(params)\n end\n send method, *args, &block\n else\n super\n end\n end", "def perform!(resource_name, action, options = {})\n ClientOperations::Perform.new(resource_name, action, session, options).perform!\n end", "def invoke\n\t\tbegin\n\t @service = Object.const_get(@amfbody.service_name).new #handle on service\n\t RequestStore.available_services[@amfbody.service_name] = @service\n\t\trescue LoadError => e\n\t\t\traise RUBYAMFException.new(RUBYAMFException.LOAD_CLASS_FILE, \"The file #{@amfbody.class_file_uri}#{@amfbody.class_file} was not loaded. Check to make sure it exists in: #{RequestStore.service_path}\")\n\t\trescue Exception => e\n\t\t raise RUBYAMFException.new(RUBYAMFException.LOAD_CLASS_FILE, \"There was an error loading file #{@amfbody.class_file_uri}#{@amfbody.class_file}.\")\n\t\tend\n\t\t\n\t\tif @service.private_methods.include?(@amfbody.service_method_name)\n\t\t\traise RUBYAMFException.new(RUBYAMFException.METHOD_ACCESS_ERROR, \"The method {#{@amfbody.service_method_name}} in class {#{@amfbody.class_file_uri}#{@amfbody.class_file}} is declared as private, it must be defined as public to access it.\")\n\t\telsif !@service.public_methods.include?(@amfbody.service_method_name)\n\t\t\traise RUBYAMFException.new(RUBYAMFException.METHOD_UNDEFINED_METHOD_ERROR, \"The method {#{@amfbody.service_method_name}} in class {#{@amfbody.class_file_uri}#{@amfbody.class_file}} is not declared.\")\n\t\tend\n\t\t\t\t\n\t\t#clone the request and response and alter it for the target controller/method\n\t\treq = RequestStore.rails_request.clone\n\t\tres = RequestStore.rails_response.clone\n\t\t\n\t\t#change the request controller/action targets and tell the service to process. THIS IS THE VOODOO. SWEET!\n\t ct = @amfbody.target_uri.clone.split('Controller')[0].downcase\n\t sm = @amfbody.service_method_name\n\t\treq.parameters['controller'] = ct\n\t\treq.parameters['action'] = sm\n\t\treq.request_parameters['controller'] = ct\n\t\treq.request_parameters['action'] = sm\n\t\treq.request_parameters['amf'] = 'hello world'\n\t\treq.path_parameters['controller'] = ct\n\t\treq.path_parameters['action'] = ct\n\t\treq.env['PATH_INFO'] = \"#{ct}/#{sm}\"\n\t\treq.env['REQUEST_PATH'] = \"#{ct}/#{sm}\"\n\t\treq.env['REQUEST_URI'] = \"#{ct}/#{sm}\"\n\t\treq.env['HTTP_ACCEPT'] = 'application/x-amf,' + req.env['HTTP_ACCEPT'].to_s\n\t\t\n\t\t#set conditional helper\n\t\t@service.is_amf = true\n\t\t@service.is_rubyamf = true\n \n #process the request\n\t\tif @amfbody.value.empty? || @amfbody.value.nil?\n\t\t @service.process(req,res)\n\t\telse\n\t\t @amfbody.value.each_with_index do |item,i|\t\t \n\t\t req.parameters[i] = item\n\t\t if item.class.superclass.to_s == 'ActiveRecord::Base'\n\t\t req.parameters[i] = item.original_vo_from_deserialization.to_hash\n if i < 1 #Only the first parameter will be \n req.parameters.merge!(item.original_vo_from_deserialization.to_hash) #merge in properties into the params hash\n #have to specifically check for id here, as it doesn't show up in any object members.\n if item.original_vo_from_deserialization.id != nil\n #This will override the above params[:id] attempt, because it's the original deserialized values.\n req.parameters[:id] = item.original_vo_from_deserialization.id\n end\n end\n\t req.parameters[item.class.to_s.downcase.to_sym] = item.original_vo_from_deserialization.to_hash\n\t \n\t\t elsif !item._explicitType.nil?\n\t\t t = item._explicitType\n\t\t if t.include?('.')\n\t\t t = t.split('.').last.downcase.to_s\n\t\t end\n \t\t req.parameters[t.to_sym] = item.to_hash\n \t\t if i < 1\n \t\t if item.class.to_s == 'Object' || item.class.to_s == 'OpenStruct'\n \t\t if item.id != nil && item.id.to_s != 'NaN' && item.id != 0\n \t\t req.parameters[:id] = item.id\n \t\t end\n \t\t end\n \t\t req.parameters.merge!(item.to_hash)\n \t\t end\n \t\t \n \t\t elsif item.class.to_s == 'OpenStruct' || item.class.to_s == \"Object\"\n\t\t if i < 1\n \t\t if item.id != nil && item.id.to_s != 'NaN' && item.id != 0\n \t\t req.parameters[:id] = item.id\n \t\t end\n \t\t req.parameters.merge!(item.to_hash)\n \t\t end \t\t \n\t\t end\n end\n\t @service.process(req,res)\n end\n \n #unset conditional helper\n @service.is_amf = false\n\t\t@service.is_rubyamf = false\n \n\t\t#handle FaultObjects\n\t\tif @service.amf_content.class.to_s == 'FaultObject' #catch returned FaultObjects\n raise RUBYAMFException.new(@service.amf_content.code, @service.amf_content.message)\n\t\tend\n\t\t\n\t\t#amf3\n\t\t@amfbody.results = @service.amf_content\n if @amfbody.special_handling == 'RemotingMessage'\n @wrapper = generate_acknowledge_object(@amfbody.get_meta('messageId'), @amfbody.get_meta('clientId'))\n @wrapper.body = @service.amf_content\n @amfbody.results = @wrapper\n\t\tend\n\t @amfbody.success! #set the success response uri flag (/onResult)\n\tend", "def process\n send_request @action\n end", "def perform_action(*args)\n end", "def action _obj, _args\n \"_obj action _args;\" \n end", "def invoke_action(name)\n # used for self-reflection in views\n @action = name\n\n send(name)\n end", "def invoke_action(opt = {})\n raise(\"Method not implemented for this class: #{@klass}\")\n end", "def execute_soap_request(action, args, extra_namespaces)\n original_action_name =\n get_service_registry.get_method_signature(action)[:original_name]\n original_action_name = action if original_action_name.nil?\n response = @client.request(original_action_name) do |soap|\n set_headers(soap, args, extra_namespaces)\n end\n return response\n end", "def service(req, res)\n method_name = \"do_\" + req.request_method.gsub(/-/, \"_\")\n if respond_to?(method_name)\n __send__(method_name, req, res)\n else\n raise HTTPStatus::MethodNotAllowed,\n \"unsupported method `#{req.request_method}'.\"\n end\n end", "def invoke!\n _log { \"@facade=@#{@facade.object_id}\" }\n @result = @facade._active_target.__send__(@selector, *@arguments)\n @block.call(@result) if @block\n rescue Exception => exc\n @thread.raise(@exception = exc)\n end", "def perform(request, options); end", "def _perform(args); end", "def serve request, response, client, vhost\n @action.call(request, response, client, vhost) unless @action.nil?\n end", "def call_action action=nil\n action ||= @action\n invoke{ dispatch action }\n invoke{ handle_status(@response.status) }\n content_type self.class.content_type unless @response[CNT_TYPE]\n @response.finish\n end", "def post(action, **args); end", "def _handle_action_missing(*args); end", "def process_action(method_name)\n send(method_name)\n end", "def receive_action(action)\n self.define_singleton_method(:perform_action, &action)\n end", "def call\n access = RIGHTS[method] # Checking access permissions for perform corresponding ACTION\n raise NoAccessError.new(access) unless @permissions[access] # Raising Custom error if no access granted\n\n send(@method) # Calling method from @method\n end", "def call\n access = RIGHTS[method] # Checking access permissions for perform corresponding ACTION\n raise NoAccessError.new(access) unless @permissions[access] # Raising Custom error if no access granted\n\n send(@method) # Calling method from @method\n end", "def execute_action(action_name, args, &block)\n validator = ParametersValidator.new(get_service_registry())\n args = validator.validate_args(action_name, args)\n response = execute_soap_request(\n action_name.to_sym, args, validator.extra_namespaces)\n log_headers(response.http.headers)\n handle_errors(response)\n return extract_result(response, action_name, &block)\n end", "def call(request); end", "def exec_action_object(action)\n\t\t\taction.execute\n\t\tend", "def run(req, res)\n controller = controller_class.new(req, res, route_params(req))\n controller.invoke_action(action_name)\n end", "def process_action(*_arg0); end", "def process_action(*_arg0); end", "def process_action(*_arg0); end", "def invoke_method(request, response, _send_response = true)\n method = request.method\n\n return nil unless emit(\"beforeMethod:#{method}\", [request, response])\n return nil unless emit('beforeMethod', [request, response])\n\n if Server.expose_version\n response.update_header('X-Sabre-Version', Version::VERSION)\n end\n\n @transaction_type = method.downcase\n\n unless check_preconditions(request, response)\n @sapi.send_response(response)\n return nil\n end\n\n if emit(\"method:#{method}\", [request, response])\n if emit('method', [request, response])\n ex_message = \"There was no plugin in the system that was willing to handle this #{method} method.\"\n if method == \"GET\"\n ex_message += \" Enable the Browser plugin to get a better result here.\"\n end\n\n # Unsupported method\n fail Exception::NotImplemented, ex_message\n end\n end\n\n fail Exception, 'No subsystem set a valid HTTP status code. Something must have interrupted the request without providing further detail.' unless response.status\n\n return nil unless emit(\"afterMethod:#{method}\", [request, response])\n return nil unless emit('afterMethod', [request, response])\n\n # No need for checking, send_response just returns an array\n response = sapi.send_response(response)\n end", "def perform(request, response); end", "def _dispatch(action)\n _run_filters(:before, action)\n response = send(action)\n _run_filters(:after, action)\n response\n end", "def run(*args)\n @action.call(args)\n end", "def run(*args)\n @action.call(args)\n end", "def process(action, *args); end", "def method_missing(api_method, *args) # :nodoc:\n @client.wsdl.soap_actions.include?(api_method.to_sym) ? call(api_method, *args) : super\n end", "def op_invoke(method = nil)\n op_send(method, false)\n end", "def request(method, *args)\n public_send(method, *args)\n end", "def execute(&block)\n\t\t\t\t@controller.refined_http_methods\n\t\t\t\t\t.each do |action, (http_method, action_path)|\n\t\t\t\t\t\tsend(http_method, action_path, action)\n\t\t\t\t\tend\n\t\t\t\tinstance_exec(&block) if block\n\t\t\t\tdefaults\n\t\t\tend", "def call(controller, action)\n lambda {\n controller = Object.const_get(controller)\n action ||= Configuration::Base.app.default_action\n\n instance = controller.new\n request.controller = instance\n request.action = action\n\n instance.send(action)\n }\n end", "def method_missing method, *opt\n method.to_s =~ /^do_[A-Z]+$/ ? process_request(*opt) : super\n end", "def invokeAction(action, args, &b)\n\t\t\tarty = method(action).arity\n\t\t\tif args.length == arty or arty == -1\n\t\t\t\t__send__(action, *args, &b)\n\t\t\tend\n\t\tend", "def call_action(action, structure)\n if action.present? and structure.present?\n self.send(action, structure)\n else\n nil\n end\n end", "def do_service_action(action)\n validate :service, String\n\n service = request[:service]\n\n begin\n Log.instance.debug(\"Doing #{action} for service #{service}\")\n\n svc = get_puppet(service)\n\n unless action == \"status\"\n svc.send action\n sleep 0.5\n end\n\n reply[\"status\"] = svc.status.to_s\n rescue Exception => e\n reply.fail \"#{e}\"\n end\n end", "def perform_action(data); end", "def do_service_action(action)\n validate :service, String\n\n service = request[:service]\n\n begin\n Log.instance.debug(\"Doing #{action} for service #{service}\")\n\n svc = get_puppet(service)\n\n unless action == \"status\"\n svc.send action\n sleep 0.5\n end\n\n reply[\"status\"] = svc.status.to_s\n rescue Exception => e\n reply.fail \"#{e}\"\n end\n end", "def dispatch(soap_action)\n response = @request.soap @soap\n Response.new response\n end", "def do_action(server, action)\n puts \"Checking action #{action} on server #{server.name}.\"\n if server.state == \"ACTIVE\"\n puts \"Doing action #{action} on server #{server.name}.\"\n server.send(action)\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 invoke\n _fromUTF8(tk_send_without_enc('invoke'))\n end", "def service_request(service); end", "def call(*args)\n @ctx.instance_exec(args, &action)\n end", "def invoke\n resp = nil\n ms = Benchmark.realtime do\n resp = @http.post @url, @req.to_s\n end\n @logger.info 'SmartView request %s completed in %.1fs' % [@req.method, ms]\n doc = Hpricot::XML(resp.body.content)\n if !doc.at(\"//res_#{@req.method}\")\n @logger.error \"Error invoking SmartView method #{@req.method}\"\n @logger.debug \"Request was:\\n#{@req}\"\n @logger.debug \"Response was:\\n#{resp.body.content}\"\n if ex = doc.at('//exception')\n ex = SmartViewException.new(ex)\n @logger.error \"An exception occurred in #{@req.method}\"\n @logger.error ex\n raise ex\n else\n @logger.error \"Unexpected response from SmartView provider:\\n#{doc.to_plain_text}\"\n raise RuntimeError, \"Unexpected response from SmartView provider: #{doc.to_plain_text}\"\n end\n end\n doc\n end", "def perform_action action_name, *args\n raise \"No such action #{action_name} defined for current page\" if !@current_page[:page_data].user_data['actions'].has_key?(action_name)\n # override locator from config file if needed\n if args[0].is_a?(Hash) and args[0].has_key?('locator')\n locator = args[0]['locator']\n else\n locator = @current_page[:page_data].user_data['actions'][action_name]['locator']\n end\n # search the entire dom or just under the current element\n if args[0].is_a?(Hash) and args[0].has_key?('root_search')\n dom = args[0]['root_search'].eql?(true) ? @driver : @element\n else\n dom = @driver\n end\n # perform the search\n @element = dom.find_element(locator)\n # json contains only a predefined set of instructions\n if action_name.include?('click')\n @element.click\n elsif action_name.include?('type')\n @element.send_keys args[0]\n elsif action_name.include?('submit')\n @element.submit\n elsif action_name.include?('inspect')\n @element\n else\n raise \"Don't know how to perform this action\"\n end\n # wait for a specific element or page to be present after the action\n wait_and_update @current_page[:page_data].user_data['actions'][action_name]['wait']\n end", "def invoking\n end", "def action\n driver.action\n end", "def method_for_action(action_name); end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def perform(action)\n @action_name = action\n begin\n self.send(@action_name)\n rescue\n Skates.logger.error {\n \"#{$!}:\\n#{$!.backtrace.join(\"\\n\")}\"\n }\n end\n self.render\n end", "def cartridge_do_action\n Log.instance.info(\"cartridge_do_action call / action: #{request.action}, agent=#{request.agent}, data=#{request.data.pretty_inspect}\")\n Log.instance.info(\"cartridge_do_action validation = #{request[:cartridge]} #{request[:action]} #{request[:args]}\")\n validate :cartridge, /\\A[a-zA-Z0-9\\.\\-\\/]+\\z/\n validate :cartridge, :shellsafe\n validate :action, /\\A(app-create|app-destroy|env-var-add|env-var-remove|broker-auth-key-add|broker-auth-key-remove|authorized-ssh-key-add|authorized-ssh-key-remove|ssl-cert-add|ssl-cert-remove|configure|deconfigure|update-namespace|tidy|deploy-httpd-proxy|remove-httpd-proxy|restart-httpd-proxy|move|pre-move|post-move|info|post-install|post-remove|pre-install|reload|restart|start|status|stop|force-stop|add-alias|remove-alias|threaddump|cartridge-list|expose-port|system-messages|connector-execute|get-quota|set-quota)\\Z/\n validate :action, :shellsafe\n cartridge = request[:cartridge]\n action = request[:action]\n args = request[:args]\n pid, stdin, stdout, stderr = nil, nil, nil, nil\n rc = nil\n output = \"\"\n if cartridge == 'openshift-origin-node'\n cmd = \"oo-#{action}\"\n if action == 'connector-execute'\n pid, stdin, stdout, stderr = oo_connector_execute(cmd, args)\n exitcode, output = complete_process_gracefully(pid, stdin, stdout)\n else\n exitcode, output = handle_oo_cmd(action, args)\n end\n else\n validate :args, /\\A[\\w\\+\\/= \\{\\}\\\"@\\-\\.:;\\'\\\\\\n~,]+\\z/\n validate :args, :shellsafe\n exitcode, output = handle_cartridge_action(cartridge, action, args)\n end\n reply[:exitcode] = exitcode\n reply[:output] = output\n if exitcode == 0\n Log.instance.info(\"cartridge_do_action (#{exitcode})\\n------\\n#{cleanpwd(output)}\\n------)\")\n else\n Log.instance.info(\"cartridge_do_action failed (#{exitcode})\\n------\\n#{cleanpwd(output)}\\n------)\")\n reply.fail! \"cartridge_do_action failed #{exitcode}. Output #{output}\"\n end\n end" ]
[ "0.6927848", "0.6789505", "0.65752107", "0.65752107", "0.6574149", "0.6508829", "0.6466567", "0.64300656", "0.64256185", "0.6394846", "0.63693225", "0.63602453", "0.6345985", "0.63020897", "0.6289195", "0.6289195", "0.62844884", "0.62803626", "0.62679785", "0.62516385", "0.6209606", "0.61912775", "0.6149207", "0.61360884", "0.6129513", "0.6127011", "0.6104588", "0.6076545", "0.60485023", "0.59954715", "0.5988216", "0.5987358", "0.59858286", "0.5983059", "0.5979465", "0.5960876", "0.5944881", "0.5935854", "0.5918963", "0.58855355", "0.58492684", "0.5847681", "0.583816", "0.583383", "0.58225495", "0.5794266", "0.57761014", "0.5768222", "0.5766212", "0.5750283", "0.5749224", "0.5742052", "0.57213056", "0.57195616", "0.5715431", "0.5676318", "0.5673825", "0.5673825", "0.56549346", "0.56535816", "0.5648819", "0.56303674", "0.5628933", "0.5628933", "0.5628933", "0.5619351", "0.56146705", "0.5600092", "0.5591734", "0.5591734", "0.55884016", "0.5587031", "0.55859864", "0.5573863", "0.5570204", "0.5566073", "0.55598634", "0.55596346", "0.5554231", "0.5553851", "0.55446863", "0.5540871", "0.5540221", "0.5539098", "0.55289567", "0.5525594", "0.55227035", "0.552191", "0.5516574", "0.5515625", "0.5515558", "0.55074227", "0.5506136", "0.550495", "0.550495", "0.550495", "0.550495", "0.550495", "0.5501906", "0.5488293" ]
0.646318
7
GET /classifieds/1 GET /classifieds/1.json
def show @classified = Classified.find(params[:id]) @message = @classified.messages.build # In this case ..its same as Message.new ....because while building an empty message , since this message is not nested in some routes like users/12/messages ....so when u do form_for @message ....it doesnt matter much...the only advantage of building through association a new record (not creating mind u ...building) is that when u do form_for @message ...it auto.. gets the route path of the message respond_to do |format| format.html # show.html.erb format.json { render json: @classified } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @classifieds = Classified.all\n end", "def new\n @classified = Classified.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @classified }\n end\n end", "def create\n @classified = Classified.new(classified_params)\n respond_to do |format|\n if @classified.save\n format.html { redirect_to @classified, notice: 'Classified was successfully created.' }\n format.json { render :show, status: :created, location: @classified }\n else\n format.html { render :new }\n format.json { render json: @classified.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @classified = Classified.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @classified }\n end\n end", "def set_classified\n @classified = Classified.find(params[:id])\n end", "def set_classified\n @classified = Classified.find(params[:id])\n end", "def create\n #@classified = Classified.new(classified_params)\n @classified = current_user.classifieds.new(classified_params)\n\n respond_to do |format|\n if @classified.save\n format.html { redirect_to @classified, notice: 'Classified was successfully created.' }\n format.json { render :show, status: :created, location: @classified }\n else\n format.html { render :new }\n format.json { render json: @classified.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @classifiers = Classifier.all\n end", "def index\n @category_classifieds = CategoryClassified.all\n end", "def show\n @class_taken = ClassTaken.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @class_taken }\n end\n end", "def show\n @citizenship_class = @grantee.citizenship_classes.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @citizenship_class }\n end\n end", "def index\n @citizenship_classes = @grantee.citizenship_classes.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @citizenship_classes }\n end\n end", "def classifications(classification)\n params = {\n classification: classification\n }.compact\n\n _get(\"/account/classifications\", params) { |json| json }\n end", "def show\n @recommendation = Recommendation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recommendation }\n end\n end", "def with_photo\n @classifieds = Classified.with_photos\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @classifieds }\n end\n end", "def show\n @classification = Classification.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @classification }\n end\n end", "def update\n @classified = @user.classifieds.find(params[:id])\n\n respond_to do |format|\n if @classified.update_attributes(params[:classified])\n format.html { redirect_to @classified, notice: 'Classified was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @classified.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @classified = @user.classifieds.find(params[:id])\n @classified.destroy\n\n respond_to do |format|\n format.html { redirect_to classifieds_url }\n format.json { head :no_content }\n end\n end", "def new\n @classified = Classified.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @classified }\n end\n end", "def show\n @iclass = Iclass.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @iclass }\n end\n end", "def index\n @clasifications = Clasification.all\n end", "def show\n @class = Classe.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @class }\n end\n end", "def index\n @glasses = Glass.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @glasses }\n end\n end", "def index\n @project_classifications = ProjectClassification.all\n end", "def show\n @judgement = Judgement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @judgement }\n end\n end", "def show\n @judgement = Judgement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @judgement }\n end\n end", "def update\n respond_to do |format|\n if @classified.update(classified_params)\n format.html { redirect_to @classified, notice: 'Classified was successfully updated.' }\n format.json { render :show, status: :ok, location: @classified }\n else\n format.html { render :edit }\n format.json { render json: @classified.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @classified.update(classified_params)\n format.html { redirect_to @classified, notice: 'Classified was successfully updated.' }\n format.json { render :show, status: :ok, location: @classified }\n else\n format.html { render :edit }\n format.json { render json: @classified.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @item_classifications = ItemClassification.all\n end", "def show\n @clasificacion_pegi = ClasificacionPegi.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clasificacion_pegi }\n end\n end", "def index\n @reviews = reviewable.reviews\n\n respond_to do |format|\n format.html\n format.json { render json: @reviews }\n end\n end", "def index\n @disciplines = Discipline.all\n\n render json: @disciplines\n end", "def create\n Rails.logger.debug \"[ClassificationsController.create] params.class: #{params.class}, params: #{params}\"\n @classifaction = Classification.new transaction_data: params\n @classifaction.classifiers << StatusCodeClassifier.classify( @classifaction.transaction_data )\n @classifaction.classify\n\n if @classifaction.save\n render json: @classifaction.as_jsonapi, status: :created\n else\n render json: { error: 'oops' }, status: 500\n end\n end", "def show\n @proficiency = Proficiency.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @proficiency }\n end\n end", "def show\n render status: 200, json: Training.find(params[:id])\n end", "def index\n @classifieds = Classified.paginate :page => params[:page], :order => 'list_date DESC'\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @classifieds }\n end\n end", "def create\n @classifier = Classifier.new(classifier_params)\n\n respond_to do |format|\n if @classifier.save\n format.html { redirect_to @classifier, notice: 'Classifier was successfully created.' }\n format.json { render :show, status: :created, location: @classifier }\n else\n format.html { render :new }\n format.json { render json: @classifier.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @risk_classification = RiskClassification.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @risk_classification }\n end\n end", "def index\n @classified_people = ClassifiedPerson.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @classified_people }\n end\n end", "def show\n kid = Kid.find(params[:id])\n classroom = kid.classroom\n respond_to do |format|\n format.html { render action: 'show' }\n format.json do\n # Return kid as json object\n result = kid.to_json(include: :classroom)\n render json: result\n end\n end\nend", "def index\n reviews = Review.all\n render json: reviews\n end", "def index\n reviews = Review.all\n render json: reviews\n end", "def index\n @classrooms = Classroom.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @classrooms }\n end\n end", "def new\n @class_taken = ClassTaken.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @class_taken }\n end\n end", "def show\n @accuracy = Accuracy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @accuracy }\n end\n end", "def show\n @critical_factor = CriticalFactor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @critical_factor }\n end\n end", "def show\n @evaluable_competency = EvaluableCompetency.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @evaluable_competency }\n end\n end", "def show\n @test_class = TestClass.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test_class }\n end\n end", "def show\n @classication = Classication.find(params[:id])\n @movies = @classication.movies\n\n respond_to do |format|\n format.html\n format.json {render :json => @classication}\n end\n end", "def welcome\n @reviews = Review.all\n render json: @reviews\n end", "def show\n @classroom = classroom.find(params[:id])\n\n render json: @classroom\n end", "def classification\n classifications = @data[\"spData\"][\"classifications\"]\n if classifications.empty?\n raise Holdings::Error, NO_CLASSIFICATIONS_ERROR\n end\n Classification.new(classifications.first)\n end", "def show\n @responsibility = Responsibility.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @responsibility }\n end\n end", "def create\n @category_classified = CategoryClassified.new(category_classified_params)\n\n respond_to do |format|\n if @category_classified.save\n format.html { redirect_to @category_classified, notice: 'Category classified was successfully created.' }\n format.json { render :show, status: :created, location: @category_classified }\n else\n format.html { render :new }\n format.json { render json: @category_classified.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @classified_person = ClassifiedPerson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @classified_person }\n end\n end", "def class_json\n clazz = @offering.clazz\n section = clazz.section && clazz.section.length > 0 ? clazz.section : nil\n section = section ? \" (#{section})\" : \"\"\n {\n name: clazz.name + section,\n students: @students\n .sort_by { |s| \"#{s.last_name} #{s.first_name}\".downcase }\n .map { |s| student_json(s) }\n }\n end", "def show\n @criterion = Criterion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @criterion }\n end\n end", "def show\n @frequent_set = FrequentSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @frequent_set }\n end\n end", "def show\n @rating_alt = Rating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rating_alt }\n end\n end", "def show\n @precinct = Precinct.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @precinct }\n end\n end", "def show\n @collection = Collection.find(params[:id])\n @sketches = @collection.sketches.includes(:topic).includes(:artist).order('topics.name, artists.name')\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @collection }\n end\n end", "def show\n if signed_in? && applied_class?\n @user_ids = ClclassesUser.where(:clclass_id=>params[:id])\n @users = Array.new\n @user_ids.each do |u|\n @users.push(User.find(u.user_id))\n end\n @lectures = Lecture.all :joins=>:clclass\n render 'clclass'\n return\n end\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clclass }\n end\n end", "def show\n @fiction = Fiction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fiction }\n end\n end", "def index\n @collection = current_user.collections.find(params[:collection_id]) \n @recommenders = @collection.recommenders.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @recommenders }\n end\n end", "def index\n @reviews = Review.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reviews }\n end\n end", "def index\n @reviews = Review.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reviews }\n end\n end", "def show\n @inference_clarification_weight = InferenceClarificationWeight.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inference_clarification_weight }\n end\n end", "def show\n render json: Festival.build_for(params[:id]).to_json\n end", "def show\n @classified = Classified.find_by_permalink(params[:id])\n\n if @classified.nil?\n render :file => \"#{RAILS_ROOT}/public/404.html\", :status => 404\n return\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @classified }\n end\n end", "def show\n @interview = Interview.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @interview }\n end\n end", "def index\n @discipleship_classes = DiscipleshipClass.all\n end", "def show\n @clinicalsection = Clinicalsection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clinicalsection }\n end\n end", "def show\n @discipline_class_exam_type = DisciplineClassExamType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @discipline_class_exam_type }\n end\n end", "def set_category_classified\n @category_classified = CategoryClassified.find(params[:id])\n end", "def no_photo\n @classifieds = Classified.no_photos\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @classifieds }\n end\n end", "def show\n @discipline = Discipline.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @discipline }\n end\n end", "def index\n @investigationclassifications = Investigationclassification.all\n end", "def show\n render json: @review\n end", "def show\n render json: @review\n end", "def show\n render json: @review\n end", "def index\n @clclasses = Clclass.paginate(page: params[:page], :per_page => 10)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clclasses }\n end\n end", "def show\n @cluster = Cluster.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cluster }\n end\n end", "def show\n @contestant = Contestant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contestant }\n end\n end", "def show\n @classe = Classe.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @classe }\n end\n end", "def show\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rating }\n end\n end", "def show\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rating }\n end\n end", "def show\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rating }\n end\n end", "def index\n @confidence_ratings = ConfidenceRating.all\n end", "def show\n\t\t@recommendation = Recommendation.find(params[:id])\n\t\t#sleep 1\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render json: @recommendation }\n\t\tend\n\tend", "def index\n @critical_factors = CriticalFactor.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @critical_factors }\n end\n end", "def destroy\n @classified.destroy\n respond_to do |format|\n format.html { redirect_to classifieds_url, notice: 'Classified was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @classified.destroy\n respond_to do |format|\n format.html { redirect_to classifieds_url, notice: 'Classified was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def index\n render_json content: Review.all\n end", "def show\n render json: @laboratory\n end", "def show\n @review = Review.find(params[:id])\n render json: @review\n end", "def index\n @interviews = Interview.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @interviews }\n end\n end", "def index\n # @prenotations = Prenotation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @prenotations }\n end\n end", "def show\n @classified_person_category = ClassifiedPersonCategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @classified_person_category }\n end\n end", "def show\n @training = trainings.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @training }\n end\n end", "def show\n @critical_success_factor = CriticalSuccessFactor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @critical_success_factor }\n end\n end", "def show\n @myclass = Myclass.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @myclass }\n end\n end" ]
[ "0.7305298", "0.6786777", "0.6599307", "0.64442146", "0.6397545", "0.6397545", "0.62669694", "0.61965847", "0.6155539", "0.6142037", "0.6072862", "0.60491306", "0.6011878", "0.59770024", "0.5957758", "0.588961", "0.5861056", "0.5833146", "0.5773363", "0.57686156", "0.57515895", "0.57509536", "0.57482815", "0.568769", "0.5670776", "0.5670776", "0.5660003", "0.5660003", "0.5651726", "0.5633692", "0.55997366", "0.5596972", "0.55745983", "0.5571656", "0.5567874", "0.55671287", "0.55588067", "0.5554741", "0.554541", "0.5534498", "0.5528226", "0.5528226", "0.55116725", "0.55079323", "0.5507464", "0.5500754", "0.5498675", "0.5491716", "0.5489925", "0.5485726", "0.5478516", "0.5474555", "0.54665345", "0.54626364", "0.5460026", "0.5458162", "0.5450918", "0.54494506", "0.54468584", "0.5443494", "0.54426986", "0.54374963", "0.54283184", "0.5425202", "0.5413711", "0.5413711", "0.54099965", "0.5407387", "0.540628", "0.54050815", "0.54047364", "0.5402171", "0.54001087", "0.539991", "0.539945", "0.5398036", "0.5394133", "0.53924763", "0.53924763", "0.53924763", "0.53897405", "0.53883296", "0.5384708", "0.53813344", "0.5380659", "0.5380659", "0.5380659", "0.5379848", "0.5379201", "0.5375905", "0.53698677", "0.53698677", "0.5367533", "0.5367351", "0.53653497", "0.53644073", "0.53606975", "0.5360579", "0.5360046", "0.53594506", "0.5355954" ]
0.0
-1
GET /classifieds/new GET /classifieds/new.json
def new @classified = Classified.new respond_to do |format| format.html # new.html.erb format.json { render json: @classified } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @classified = Classified.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @classified }\n end\n end", "def create\n @classified = Classified.new(classified_params)\n respond_to do |format|\n if @classified.save\n format.html { redirect_to @classified, notice: 'Classified was successfully created.' }\n format.json { render :show, status: :created, location: @classified }\n else\n format.html { render :new }\n format.json { render json: @classified.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @class_taken = ClassTaken.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @class_taken }\n end\n end", "def create\n #@classified = Classified.new(classified_params)\n @classified = current_user.classifieds.new(classified_params)\n\n respond_to do |format|\n if @classified.save\n format.html { redirect_to @classified, notice: 'Classified was successfully created.' }\n format.json { render :show, status: :created, location: @classified }\n else\n format.html { render :new }\n format.json { render json: @classified.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @risk_classification = RiskClassification.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @risk_classification }\n end\n end", "def new\n @classtable = Classtable.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @classtable }\n end\n end", "def new\n @citizenship_class = @grantee.citizenship_classes.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @citizenship_class }\n end\n end", "def new\n @new_review = NewReview.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_review }\n end\n end", "def new\n @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 @class = Classe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @class }\n end\n end", "def create\n @classifier = Classifier.new(classifier_params)\n\n respond_to do |format|\n if @classifier.save\n format.html { redirect_to @classifier, notice: 'Classifier was successfully created.' }\n format.json { render :show, status: :created, location: @classifier }\n else\n format.html { render :new }\n format.json { render json: @classifier.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n Rails.logger.debug \"[ClassificationsController.create] params.class: #{params.class}, params: #{params}\"\n @classifaction = Classification.new transaction_data: params\n @classifaction.classifiers << StatusCodeClassifier.classify( @classifaction.transaction_data )\n @classifaction.classify\n\n if @classifaction.save\n render json: @classifaction.as_jsonapi, status: :created\n else\n render json: { error: 'oops' }, status: 500\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @interest }\n end\n end", "def new\n @iclass = Iclass.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @iclass }\n end\n end", "def new\n @interested = Interested.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @interested }\n end\n end", "def new\n @certification = Certification.find params[:certification_id]\n @class_request = ClassRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @class_request }\n end\n end", "def new\n @major = Major.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @major }\n end\n end", "def create\n @category_classified = CategoryClassified.new(category_classified_params)\n\n respond_to do |format|\n if @category_classified.save\n format.html { redirect_to @category_classified, notice: 'Category classified was successfully created.' }\n format.json { render :show, status: :created, location: @category_classified }\n else\n format.html { render :new }\n format.json { render json: @category_classified.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @entity = @klass.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entity }\n end\n end", "def new\n @gpath = Gpath.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gpath }\n end\n end", "def new\n @clazz = Clazz.new\n respond_to do |format|\n format.html # new.html.erb\n #format.json { render json: @clazz }\n format.js\n end\n end", "def new\n @classified_person = ClassifiedPerson.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @classified_person }\n end\n end", "def new\n @prob = Prob.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @prob }\n end\n end", "def new\n @assigned = Assigned.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @assigned }\n end\n end", "def new\n @gist = Gist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gist }\n end\n end", "def new\n @clasificacion_pegi = ClasificacionPegi.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @clasificacion_pegi }\n end\n end", "def new\n @test_class = TestClass.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @test_class }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @certification }\n end\n end", "def new\n @class_mstr = ClassMstr.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @class_mstr }\n end\n end", "def new\n @cluster = Cluster.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cluster }\n end\n end", "def new\n @nlp = Nlp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @nlp }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tips_trick }\n end\n end", "def new\n @classe = Classe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @classe }\n end\n end", "def new\n @fiction = Fiction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fiction }\n end\n end", "def new\n @collection = Collection.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @collection }\n end\n end", "def new\n @classified_person_category = ClassifiedPersonCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @classified_person_category }\n end\n end", "def new\n @preceed = Preceed.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @preceed }\n end\n end", "def new\n @predict = Predict.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @predict }\n end\n end", "def new\n @classroom = classroom.new\n\n render json: @classroom\n end", "def new\n @constitution = Constitution.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @constitution }\n end\n end", "def new\n @gnode = Gnode.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gnode }\n end\n end", "def new\n @collection = Collection.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @collection }\n end\n end", "def new\n @classwork = Classwork.new\n \n drop_breadcrumb('新增')\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @classwork }\n end\n end", "def new\n @interest = Interest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @interest }\n end\n end", "def new\n @feature = Feature.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @feature }\n end\n end", "def new\n @feature = Feature.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @feature }\n end\n end", "def new\n @rating_alt = Rating.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rating_alt }\n end\n end", "def new\n @rating = Rating.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rating }\n end\n end", "def new\n @rating = Rating.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rating }\n end\n end", "def new\n @rating = Rating.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rating }\n end\n end", "def new\n @new_status = NewStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_status }\n end\n end", "def new\n @critical_factor = CriticalFactor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @critical_factor }\n end\n end", "def new\n @interest = Interest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @interest }\n end\n end", "def new\n @patch = Patch.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @patch }\n end\n end", "def create\n @new_ = New.new(new__params)\n\n respond_to do |format|\n if @new_.save\n format.html { redirect_to @new_, notice: \"New was successfully created.\" }\n format.json { render :show, status: :created, location: @new_ }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @new_.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @classification = Classification.new(classification_params)\n\n respond_to do |format|\n if @classification.save\n format.html { redirect_to @classification, notice: t('controller.successfully_created', model: t('activerecord.models.classification')) }\n format.json { render json: @classification, status: :created, location: @classification }\n else\n @classification_types = ClassificationType.all\n format.html { render action: \"new\" }\n format.json { render json: @classification.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @star_fact = Star::Fact.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @star_fact }\n end\n end", "def new\n @clclass = Clclass.new\n @courses = Course.all\n @teachers = Teacher.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @clclass }\n end\n end", "def new\n @proposal = Proposal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @proposal }\n end\n end", "def new\n @proposal = Proposal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @proposal }\n end\n end", "def new\n @proposal = Proposal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @proposal }\n end\n end", "def new\n @create_classified_ad = CreateClassifiedAd.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @create_classified_ad }\n end\n end", "def new\n @label = Label.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @label }\n end\n end", "def new\n @interesting = Interesting.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @interesting }\n end\n end", "def new\n @interest = Interest.new\n\n respond_to do |format|\n format.json { render json: @interest }\n end\n end", "def new\n @frequent_set = FrequentSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @frequent_set }\n end\n end", "def new\n @crowd = Crowd.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @crowd }\n end\n end", "def new\n @interview = Interview.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @interview }\n end\n end", "def new\n @obj = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @obj }\n end\n end", "def new\n @participation = Participation.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @participation }\n end\n end", "def new\n @finding_category = FindingCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @finding_category }\n end\n end", "def new\n @county = County.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @county }\n end\n end", "def new\n @person_interest = PersonInterest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @person_interest }\n end\n end", "def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @node }\n end\n end", "def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @node }\n end\n end", "def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @node }\n end\n end", "def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @node }\n end\n end", "def new\n @gig_request = GigRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gig_request }\n end\n end", "def new\n @factoid = Factoid.new\n @tags = []\n Tag.all.each do |t|\n @tags.append(t.name)\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @factoid }\n end\n end", "def new\n @tip = Tip.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tip }\n end\n end", "def new\n @new_policy = NewPolicy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_policy }\n end\n end", "def new\n @edited << 'new'\n @expanded << 'new'\n\n respond_to do |format|\n format.html { render template: 'shared/new' }\n format.js { render 'feature' }\n format.json { render json: @feature }\n end\n end", "def new\n @prefer = Prefer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @prefer }\n end\n end", "def new\n @family = Family.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @family }\n end\n end", "def new\n @classroom = Classroom.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @classroom }\n end\n end", "def new\n @cat = Cat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cat }\n end\n end", "def new\n @cat = Cat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cat }\n end\n end", "def new\n @undergraduate_major = UndergraduateMajor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @undergraduate_major }\n end\n end", "def new\n @training = Training.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @training }\n end\n end", "def new\n @discipline = Discipline.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @discipline }\n end\n end", "def new\n @inference_clarification_weight = InferenceClarificationWeight.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inference_clarification_weight }\n end\n end", "def new\n @collection = Collection.new\n respond_to do |format|\n format.html { create }\n format.json { render :json => @collection }\n end\n end", "def new\n \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @topic }\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 @criterion = Criterion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @criterion }\n end\n end", "def new\n @threshold = Threshold.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @threshold }\n end\n end", "def new\n @fact = fact_type.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fact }\n end\n end", "def set_new_\n @new_ = New.find(params[:id])\n end", "def new\n @green = Green.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @green }\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" ]
[ "0.7290924", "0.7123625", "0.69955546", "0.679667", "0.675727", "0.6642035", "0.66077185", "0.6570642", "0.6570221", "0.6568146", "0.6467695", "0.64505446", "0.6449248", "0.6428555", "0.64233875", "0.63973665", "0.6378445", "0.63398683", "0.6321351", "0.6318048", "0.63082737", "0.6305561", "0.62858284", "0.62769926", "0.62713814", "0.62571204", "0.6251986", "0.62397444", "0.6239165", "0.6233358", "0.62193614", "0.62162775", "0.62075144", "0.6204666", "0.62022924", "0.6193593", "0.61794376", "0.61748606", "0.61739886", "0.6173308", "0.61702603", "0.61589885", "0.6153926", "0.61492896", "0.6143861", "0.6143861", "0.6137045", "0.61283195", "0.61283195", "0.61283195", "0.61270785", "0.611469", "0.6112563", "0.61072636", "0.61061966", "0.61052907", "0.6103311", "0.610182", "0.6100166", "0.6100166", "0.6100166", "0.608717", "0.6085744", "0.60850316", "0.6079474", "0.60724705", "0.607171", "0.60700727", "0.606939", "0.6068914", "0.6067951", "0.6061929", "0.60608375", "0.60603607", "0.60603607", "0.60603607", "0.60603607", "0.60602754", "0.60590273", "0.6056845", "0.6054052", "0.60524046", "0.60512286", "0.60510683", "0.60505927", "0.60473055", "0.60473055", "0.60457385", "0.6043315", "0.6041576", "0.6039105", "0.6036232", "0.6036077", "0.6031123", "0.602983", "0.60286295", "0.60284364", "0.6027215", "0.6025903", "0.6025356" ]
0.8099734
0
POST /classifieds POST /classifieds.json
def create if signed_in? @classified = current_user.classifieds.build(params[:classified]) else if user_present?(params[:email]) # checks whether user is already present ...and if present assigns it to @user redirect_to signin_path, notice: 'This account is already in use.Please sign in to use it' return else create_impulse_signup params[:email] end @classified = @user.classifieds.build(params[:classified]) end respond_to do |format| if @classified.save if signed_in? format.html { redirect_to @classified, notice: 'Classified was successfully created.' } else format.html { redirect_to @classified, notice: 'Classified was successfully created..Please confirm your email account by clicking on the link we sent you' } end format.json { render json: @classified, status: :created, location: @classified } else format.html { render action: 'new' } format.json { render json: @classified.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @classified = Classified.new(classified_params)\n respond_to do |format|\n if @classified.save\n format.html { redirect_to @classified, notice: 'Classified was successfully created.' }\n format.json { render :show, status: :created, location: @classified }\n else\n format.html { render :new }\n format.json { render json: @classified.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #@classified = Classified.new(classified_params)\n @classified = current_user.classifieds.new(classified_params)\n\n respond_to do |format|\n if @classified.save\n format.html { redirect_to @classified, notice: 'Classified was successfully created.' }\n format.json { render :show, status: :created, location: @classified }\n else\n format.html { render :new }\n format.json { render json: @classified.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n Rails.logger.debug \"[ClassificationsController.create] params.class: #{params.class}, params: #{params}\"\n @classifaction = Classification.new transaction_data: params\n @classifaction.classifiers << StatusCodeClassifier.classify( @classifaction.transaction_data )\n @classifaction.classify\n\n if @classifaction.save\n render json: @classifaction.as_jsonapi, status: :created\n else\n render json: { error: 'oops' }, status: 500\n end\n end", "def create\n @classifier = Classifier.new(classifier_params)\n\n respond_to do |format|\n if @classifier.save\n format.html { redirect_to @classifier, notice: 'Classifier was successfully created.' }\n format.json { render :show, status: :created, location: @classifier }\n else\n format.html { render :new }\n format.json { render json: @classifier.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category_classified = CategoryClassified.new(category_classified_params)\n\n respond_to do |format|\n if @category_classified.save\n format.html { redirect_to @category_classified, notice: 'Category classified was successfully created.' }\n format.json { render :show, status: :created, location: @category_classified }\n else\n format.html { render :new }\n format.json { render json: @category_classified.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @classified = Classified.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @classified }\n end\n end", "def set_classified\n @classified = Classified.find(params[:id])\n end", "def set_classified\n @classified = Classified.find(params[:id])\n end", "def classified_params\n params.require(:classified).permit(\n :id,\n :title,\n :document_type,\n :document_number,\n :seller_name,\n :email,\n :landline,\n :cell_phone,\n :description,\n :price,\n :user_id,\n :bonded,\n :classified_conditional\n )\n end", "def index\n @classifieds = Classified.all\n end", "def create\n @clasification = Clasification.new(clasification_params)\n\n respond_to do |format|\n if @clasification.save\n format.html { redirect_to @clasification, notice: \"Clasification was successfully created.\" }\n format.json { render :show, status: :created, location: @clasification }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @clasification.errors, status: :unprocessable_entity }\n end\n end\n end", "def classified_params\n params.require(:classified).permit(:title, :description, :price, :location,:category_id,{images: []}, :images_cache)\n end", "def create\n @classification = Classification.new(classification_params)\n\n respond_to do |format|\n if @classification.save\n format.html { redirect_to @classification, notice: t('controller.successfully_created', model: t('activerecord.models.classification')) }\n format.json { render json: @classification, status: :created, location: @classification }\n else\n @classification_types = ClassificationType.all\n format.html { render action: \"new\" }\n format.json { render json: @classification.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @classified.update(classified_params)\n format.html { redirect_to @classified, notice: 'Classified was successfully updated.' }\n format.json { render :show, status: :ok, location: @classified }\n else\n format.html { render :edit }\n format.json { render json: @classified.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @classified.update(classified_params)\n format.html { redirect_to @classified, notice: 'Classified was successfully updated.' }\n format.json { render :show, status: :ok, location: @classified }\n else\n format.html { render :edit }\n format.json { render json: @classified.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @classified = @user.classifieds.find(params[:id])\n\n respond_to do |format|\n if @classified.update_attributes(params[:classified])\n format.html { redirect_to @classified, notice: 'Classified was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @classified.errors, status: :unprocessable_entity }\n end\n end\n end", "def category_classified_params\n params.require(:category_classified).permit(:user_id, :title)\n end", "def create\n @project_classification = ProjectClassification.new(project_classification_params)\n\n respond_to do |format|\n if @project_classification.save\n format.html { redirect_to project_classifications_path, notice: 'Project classification was successfully created.' }\n format.json { render :show, status: :created, location: @project_classification }\n else\n format.html { render :new }\n format.json { render json: @project_classification.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @risk_classification = RiskClassification.new(params[:risk_classification])\n\n respond_to do |format|\n if @risk_classification.save\n format.html { redirect_to @risk_classification, notice: 'Risk classification was successfully created.' }\n format.json { render json: @risk_classification, status: :created, location: @risk_classification }\n else\n format.html { render action: \"new\" }\n format.json { render json: @risk_classification.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item_classification = ItemClassification.new(item_classification_params)\n\n respond_to do |format|\n if @item_classification.save\n format.html { redirect_to @item_classification, notice: 'Classificação criada com sucesso.' }\n format.json { render :show, status: :created, location: @item_classification }\n else\n format.html { render :new }\n format.json { render json: @item_classification.errors, status: :unprocessable_entity }\n end\n end\n end", "def recipe_classify_params\n params.require(:recipe_classify).permit(:name, :recipe_classify_id)\n end", "def create\n @product_classify = ProductClassify.new(product_classify_params)\n\n respond_to do |format|\n if @product_classify.save\n format.html { redirect_to :product_classifies, notice: '产品分类添加成功。' }\n format.json { render :show, status: :created, location: @product_classify }\n else\n format.html { render :new }\n format.json { render json: @product_classify.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @classs = Classs.new(classs_params)\n\n respond_to do |format|\n if @classs.save\n format.html { redirect_to @classs, notice: 'Classs was successfully created.' }\n format.json { render :show, status: :created, location: @classs }\n else\n format.html { render :new }\n format.json { render json: @classs.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @classication = Classication.new(classication_params)\n\n respond_to do |format|\n if @classication.save\n format.html { redirect_to @classication, notice: 'Classication was successfully created.' }\n format.json { render :show, status: :created, location: @classication }\n else\n format.html { render :new }\n format.json { render json: @classication.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n s_id = Allotment.where(user_id: current_user.id).pluck(:school_id).first\n standard_id = Standard.where(name: params[:class_mapping][:standard]).pluck(:id).first\n section_id = Section.where(name: params[:class_mapping][:section]).pluck(:id).first\n @classes = ClassMapping.new({:section_id => section_id, :standard_id => standard_id, :school_id => s_id})\n @saved_class = { id:@classes.id, standard: params[:class_mapping][:standard], section: params[:class_mapping][:section], school: s_id}\n if @classes.save\n render :json => @saved_class\n end\n end", "def destroy\n @classified = @user.classifieds.find(params[:id])\n @classified.destroy\n\n respond_to do |format|\n format.html { redirect_to classifieds_url }\n format.json { head :no_content }\n end\n end", "def classifier_params\n params.require(:classifier).permit(:x1, :x2, :x3, :x4, :x5, :x6)\n end", "def classification(query, set=nil)\n is_valid_with_error(__method__, [:ipv4, :domain], query)\n if domain?(query)\n query = normalize_domain(query)\n end\n if set.nil?\n get('actions/classification', {'query' => query})\n else\n is_valid_with_error(__method__.to_s, [:classification], set)\n post('actions/classification', { 'query' => query, 'classification' => set })\n end\n end", "def create\n @citizenship_class = @grantee.citizenship_classes.new(params[:citizenship_class])\n\n respond_to do |format|\n if @citizenship_class.save\n format.html { redirect_to [@grantee, @citizenship_class], notice: 'Citizenship class was successfully created.' }\n format.json { render json: @citizenship_class, status: :created, location: @citizenship_class }\n else\n format.html { render action: \"new\" }\n format.json { render json: @citizenship_class.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @classified = Classified.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @classified }\n end\n end", "def create\n @confidence_rating = ConfidenceRating.new(confidence_rating_params)\n\n respond_to do |format|\n if @confidence_rating.save\n format.html { redirect_to @confidence_rating, notice: 'Confidence rating was successfully created.' }\n format.json { render :show, status: :created, location: @confidence_rating }\n else\n format.html { render :new }\n format.json { render json: @confidence_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @recommendation = Recommendation.new(recommendation_params)\n @submission = Submission.find_by_user_id(current_user.id)\n @recommendation.submission_id = @submission.id\n\n respond_to do |format|\n if @recommendation.save\n RecommendationRequestMailer.recommendation_request(@recommendation).deliver\n format.html { redirect_to dashboard_home_path, notice: 'Recommendation was successfully created.' }\n format.json { render :show, status: :created, location: @recommendation }\n else\n format.html { render :new }\n format.json { render json: @recommendation.errors, status: :unprocessable_entity }\n end\n end\n end", "def clasification_params\n params.require(:clasification).permit(:clasification)\n end", "def create\n @classified_person = ClassifiedPerson.new(params[:classified_person])\n\n respond_to do |format|\n if @classified_person.save\n flash[:notice] = 'ClassifiedPerson was successfully created.'\n format.html { redirect_to(@classified_person) }\n format.xml { render :xml => @classified_person, :status => :created, :location => @classified_person }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @classified_person.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @class_taken = ClassTaken.new(params[:class_taken])\n\n respond_to do |format|\n if @class_taken.save\n format.html { redirect_to @class_taken, notice: 'Class taken was successfully created.' }\n format.json { render json: @class_taken, status: :created, location: @class_taken }\n else\n format.html { render action: \"new\" }\n format.json { render json: @class_taken.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @taxon_name_classification = TaxonNameClassification.new(taxon_name_classification_params)\n\n respond_to do |format|\n if @taxon_name_classification.save\n format.html { redirect_to @taxon_name_classification.taxon_name.metamorphosize, notice: 'Taxon name classification was successfully created.' }\n format.json { render json: @taxon_name_classification, status: :created, location: @taxon_name_classification.metamorphosize }\n else\n format.html { redirect_to :back, notice: 'Taxon name classification was NOT successfully created.' }\n format.json { render json: @taxon_name_classification.errors, status: :unprocessable_entity }\n end\n end\n end", "def save\n ::Classifier.dataset.delete\n\n @classifiers.each do |section, reference_values|\n ::Classifier.create(\n section: section.to_s,\n reference_values: JSON.generate(reference_values)\n )\n end\n end", "def classs_params\n params.require(:classs).permit(:name, :major_id)\n end", "def classification_params\n params.require(:classification).permit(:company_id, :text, :category)\n end", "def create\n @discipleship_class = DiscipleshipClass.new(discipleship_class_params)\n\n respond_to do |format|\n if @discipleship_class.save\n format.html { redirect_to @discipleship_class, notice: 'Discipleship class was successfully created.' }\n format.json { render :show, status: :created, location: @discipleship_class }\n else\n format.html { render :new }\n format.json { render json: @discipleship_class.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @classified.destroy\n respond_to do |format|\n format.html { redirect_to classifieds_url, notice: 'Classified was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @classified.destroy\n respond_to do |format|\n format.html { redirect_to classifieds_url, notice: 'Classified was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def create\n @business_classification = BusinessClassification.new(business_classification_params)\n\n respond_to do |format|\n if @business_classification.save\n format.html { redirect_to @business_classification, notice: 'Business classification was successfully created.' }\n format.json { render :show, status: :created, location: @business_classification }\n else\n format.html { render :new }\n format.json { render json: @business_classification.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_category_classified\n @category_classified = CategoryClassified.find(params[:id])\n end", "def classifications(classification)\n params = {\n classification: classification\n }.compact\n\n _get(\"/account/classifications\", params) { |json| json }\n end", "def classify\n pos_probs = cond_probs(:pos)\n neg_probs = cond_probs(:neg)\n\n # Label the reviews in each polarity folder\n pos_labels = @features[:pos].map { |f| label(f, pos_probs, neg_probs) }\n neg_labels = @features[:neg].map { |f| label(f, pos_probs, neg_probs) }\n\n { pos_labels: pos_labels, neg_labels: neg_labels }\n end", "def create\n @food_class = FoodClass.new(food_class_params)\n\n respond_to do |format|\n if @food_class.save\n format.html { redirect_to @food_class, notice: 'Food class was successfully created.' }\n format.json { render :show, status: :created, location: @food_class }\n else\n format.html { render :new }\n format.json { render json: @food_class.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @classification_code = ClassificationCode.new(classification_code_params)\n\n respond_to do |format|\n if @classification_code.save\n format.html { redirect_to @classification_code, notice: 'Classification code was successfully created.' }\n format.json { render action: 'show', status: :created, location: @classification_code }\n else\n format.html { render action: 'new' }\n format.json { render json: @classification_code.errors, status: :unprocessable_entity }\n end\n end\n end", "def addClassifications(filename)\n\t# open the file with classifications\n\tclassificationTypes = File.open(Rails.root.join(\"db\", \"seed_data\", filename))\n\t# Each line of the file contains a classification description. Iterate through the file and create a classification for each line.\n\tclassificationTypes.each do |curClassificationType|\n\t\tClassification.find_or_create_by({ :classification_description => curClassificationType.strip })\n\tend\nend", "def create\n final_set = []\n params['doctors_review'].permit!\n doctors_id = params['doctors_review']['doctors_id']\n specialties_id = DoctorsSpecialty.where(doctors_id: doctors_id).first\n .specialties_id\n specialty = Specialty.find(specialties_id)\n unless specialties_id.nil?\n params['doctors_review']['specialties_id'] = specialties_id\n end\n @doctors_reviews = DoctorsReview.new(params['doctors_review'])\n if @doctors_reviews.save\n rating = params['doctors_review']['rating']\n unless rating.nil?\n all_reviews = DoctorsReview.where(specialties_id: specialties_id)\n .where('rating >= ?', rating).order('rating')\n all_reviews&.each do |review|\n doctor = Doctor.find(review['doctors_id'])\n recommendations = { specialty: specialty.name,\n doctor: doctor.name,\n rating: review.rating,\n comments: review.comments\n }\n final_set << recommendations\n end\n end\n final_set\n else\n @doctors_reviews.errors.full_messages\n end\n end", "def classication_params\n params.require(:classication).permit(:number, :category)\n end", "def create\n @investigationclassification = Investigationclassification.new(investigationclassification_params)\n\n respond_to do |format|\n if @investigationclassification.save\n format.html { redirect_to @investigationclassification.investigation, notice: 'Investigationclassification was successfully created.' }\n format.json { render :show, status: :created, location: @investigationclassification }\n else\n format.html { render :new }\n format.json { render json: @investigationclassification.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @mscore_classification = MscoreClassification.new(mscore_classification_params)\n\n if @mscore_classification.save\n flash[:success] = 'Mscore classification was successfully created.'\n redirect_to :back\n else\n flash[:danger] = 'Mscore classification was not created.'\n redirect_to :back\n end\n end", "def create\n @iclass = Iclass.new(params[:iclass])\n\n respond_to do |format|\n if @iclass.save\n format.html { redirect_to @iclass, :notice => 'Iclass was successfully created.' }\n format.json { render :json => @iclass, :status => :created, :location => @iclass }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @iclass.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n @category_classifieds = CategoryClassified.all\n end", "def classify(text)\n choose classifications(text)\n end", "def create\n @class = Classe.new(params[:class])\n\n respond_to do |format|\n if @class.save\n format.html { redirect_to @class, notice: 'Classe was successfully created.' }\n format.json { render json: @class, status: :created, location: @class }\n else\n format.html { render action: \"new\" }\n format.json { render json: @class.errors, status: :unprocessable_entity }\n end\n end\n end", "def product_classify_params\n params.require(:product_classify).permit(:name, :intro)\n end", "def create\n @clazz = current_user.clazzs.build(params[:clazz])\n\n respond_to do |format|\n if @clazz.save\n @clazz_amt = current_user.clazzs.size - 1\n format.html { redirect_to(@clazz, :notice => 'class created.') } \n format.js\n else\n @clazz_amt = \"error\"\n format.html { render :action => \"new\" } \n #format.json { render json: @clazz.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end", "def create\n @registration_klass = @school.registration_klasses.build(registration_klass_params)\n\n respond_to do |format|\n if @registration_klass.save\n format.html { redirect_to [@school, @registration_klass], notice: 'Class was successfully created.' }\n format.json { render :show, status: :created, location: @registration_klass }\n format.js { }\n else\n format.html { render :new }\n format.json { render json: @registration_klass.errors, status: :unprocessable_entity }\n format.js { render layout: false, content_type: 'text/javascript' }\n end\n end\n end", "def mscore_classification_params\n params.require(:mscore_classification).permit(:name)\n end", "def create\n @biocuration_classification = BiocurationClassification.new(biocuration_classification_params)\n\n respond_to do |format|\n if @biocuration_classification.save\n format.html { redirect_to :back, notice: 'Biocuration classification was successfully created.' }\n format.json { render json: @biocuration_classification, status: :created, location: @biocuration_classification }\n else\n format.html { redirect_to :back, notice: 'Biocuration classification was NOT successfully created.' }\n format.json { render json: @biocuration_classification.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @recommendation = Recommendation.new(recommendation_params)\n respond_to do |format|\n if @recommendation.save\n format.html { redirect_to @recommendation, notice: \"Recommendation was successfully created.\" }\n format.json { render :show, status: :created, location: @recommendation }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @recommendation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @classifier.update(classifier_params)\n format.html { redirect_to @classifier, notice: 'Classifier was successfully updated.' }\n format.json { render :show, status: :ok, location: @classifier }\n else\n format.html { render :edit }\n format.json { render json: @classifier.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @occupationclassification = Occupationclassification.new(params[:occupationclassification])\n\n respond_to do |format|\n if @occupationclassification.save\n flash[:success] = \"Occupation classification was successfully created.\"\n format.html { redirect_to @occupationclassification }\n format.xml { render :xml => @occupationclassification, :status => :created, :location => @occupationclassification }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @occupationclassification.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @classpersonscore = Classpersonscore.new(classpersonscore_params)\n\n respond_to do |format|\n if @classpersonscore.save\n format.html { redirect_to @classpersonscore, notice: 'Classpersonscore was successfully created.' }\n format.json { render :show, status: :created, location: @classpersonscore }\n else\n format.html { render :new }\n format.json { render json: @classpersonscore.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_rest_api(endpoint, data, http)\n rest_api_endpoint = \"/classifier-api/v1/#{endpoint}\"\n\n # Create an HTTP POST request against the specified REST API endpoint\n request = Net::HTTP::Post.new(rest_api_endpoint)\n # Set the Content-Type and data of the HTTP POST request\n request.content_type = \"application/json\"\n request.body = data\n # Submit the request\n response = http.request(request)\n # Return the response bosy (JSON containing the result of the POST operation)\n response.body\nend", "def create\n @recommendation = Recommendation.new\n\n respond_to do |format|\n if @recommendation.save\n format.html { redirect_to @recommendation, notice: 'Recommendation was successfully created.' }\n format.json { render action: 'show', status: :created, location: @recommendation }\n else\n format.html { render action: 'new' }\n format.json { render json: @recommendation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @create_classified_ad = CreateClassifiedAd.new(params[:create_classified_ad])\n @create_classified_ad.user_id = current_user.id\n respond_to do |format|\n if @create_classified_ad.save\n format.html { redirect_to @create_classified_ad, notice: 'Create classified ad was successfully created.' }\n format.json { render json: @create_classified_ad, status: :created, location: @create_classified_ad }\n else\n format.html { render action: \"new\" }\n format.json { render json: @create_classified_ad.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n reviews = []\n params[:scores].keys.each{ |name|\n score = params[:scores][name]\n peer_review = PeerReview.new(name:name, score:score, miniproject_id:params[:project][:id])\n peer_review.save\n reviews << peer_review\n }\n\n render json: reviews\n\n end", "def create\n @test_class = TestClass.new(params[:test_class])\n\n respond_to do |format|\n if @test_class.save\n format.html { redirect_to @test_class, notice: 'Test class was successfully created.' }\n format.json { render json: @test_class, status: :created, location: @test_class }\n else\n format.html { render action: \"new\" }\n format.json { render json: @test_class.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category_classified.update(category_classified_params)\n format.html { redirect_to @category_classified, notice: 'Category classified was successfully updated.' }\n format.json { render :show, status: :ok, location: @category_classified }\n else\n format.html { render :edit }\n format.json { render json: @category_classified.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @class_taken = ClassTaken.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @class_taken }\n end\n end", "def with_photo\n @classifieds = Classified.with_photos\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @classifieds }\n end\n end", "def create\n p = prediction_params\n\n p[:tags] = [p[:tags]]\n puts \"BLAH\"\n puts p\n @prediction = current_user.predictions.create(p)\n respond_to do |format|\n if @prediction.save\n format.html { redirect_to action: 'index' }\n format.json { render action: 'show', status: :created, location: @prediction }\n else\n format.html { render action: 'new' }\n format.json { render json: @prediction.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @seniority = Seniority.new(seniority_params)\n\n respond_to do |format|\n if @seniority.save\n format.html { redirect_to @seniority, notice: \"Seniority was successfully created.\" }\n format.json { render :show, status: :created, location: @seniority }\n else\n format.html { render :new }\n format.json { render json: @seniority.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @inchef_recommendation = InchefRecommendation.new(inchef_recommendation_params)\n\n respond_to do |format|\n if @inchef_recommendation.save\n format.html { redirect_to @inchef_recommendation, notice: 'Inchef recommendation was successfully created.' }\n format.json { render :show, status: :created, location: @inchef_recommendation }\n else\n format.html { render :new }\n format.json { render json: @inchef_recommendation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @classified = Classified.find(params[:id])\n\n respond_to do |format|\n if @classified.update_attributes(params[:classified])\n flash[:notice] = 'Cyberstock was successfully updated.'\n format.html { redirect_to(cyberstock_admin_classifieds_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @classified.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n @classifiers = Classifier.all\n end", "def create\n @contestant = Contestant.new(contestant_params)\n\n \n if @contestant.save\n render json: @contestant\n else\n render json: @contestant.errors\n end\n \n end", "def create\n authorize Judge\n @judge = Judge.new(permitted_attributes(Judge))\n\n respond_to do |format|\n if @judge.save\n format.html { redirect_to @judge, notice: I18n.t('controllers.created', model: Judge.model_name.human) }\n format.json { render :show, status: :created, location: @judge }\n else\n format.html { render :new }\n format.json { render json: @judge.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @criterion = Criterion.new(params[:criterion])\n\n if @criterion.save\n render json: @criterion, status: :created, location: @criterion\n else\n render json: @criterion.errors, status: :unprocessable_entity\n end\n end", "def create\n @classname = Classname.new(classname_params)\n\n respond_to do |format|\n if @classname.save\n format.html { redirect_to @classname, notice: 'Classname was successfully created.' }\n format.json { render :show, status: :created, location: @classname }\n else\n format.html { render :new }\n format.json { render json: @classname.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @data_class = DataClass.new(data_class_params)\n\n respond_to do |format|\n if @data_class.save\n format.html { redirect_to @data_class, notice: 'Data class was successfully created.' }\n format.json { render :show, status: :created, location: @data_class }\n else\n format.html { render :new }\n format.json { render json: @data_class.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n course = Course.includes(:professors).new(course_params)\n course.professor_ids=(params[:professors])\n\n if course.save\n render json: course.to_json(include: :professors)\n else\n render :json => { :errors => course.errors }, :status => 422\n end\n end", "def create\n @catched = Catched.new(catched_params)\n @catched.user_id = current_user.id\n\n respond_to do |format|\n if @catched.save\n format.html { redirect_to @catched, notice: 'Catched was successfully created.' }\n format.json { render :show, status: :created, location: @catched }\n else\n format.html { render :new }\n format.json { render json: @catched.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @clasificacion_pegi = ClasificacionPegi.new(params[:clasificacion_pegi])\n\n respond_to do |format|\n if @clasificacion_pegi.save\n format.html { redirect_to @clasificacion_pegi, notice: 'Clasificacion pegi was successfully created.' }\n format.json { render json: @clasificacion_pegi, status: :created, location: @clasificacion_pegi }\n else\n format.html { render action: \"new\" }\n format.json { render json: @clasificacion_pegi.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @class_detail = ClassDetail.new(class_detail_params)\n\n respond_to do |format|\n if @class_detail.save\n format.html { redirect_to class_details_path, notice: 'Class detail was successfully created.' }\n format.json { render :show, status: :created, location: @class_detail }\n else\n format.html { render :new }\n format.json { render json: @class_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n params[:predictions].each do |prediction|\n @prediction = current_user.predictions.new(prediction)\n if @prediction.valid?\n @prediction.save\n end\n end\n redirect_to root_path\n end", "def classify(text)\n rating = @classifiers[@mailbox].rate text\n rating > @threshold\n end", "def create\n @classwork = Classwork.new(classwork_params)\n\n respond_to do |format|\n if @classwork.save\n format.html { redirect_to @classwork, notice: 'Classwork was successfully created.' }\n format.json { render action: 'show', status: :created, location: @classwork }\n else\n format.html { render action: 'new' }\n format.json { render json: @classwork.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @classified = Classified.find(params[:id])\n @classified.destroy\n\n respond_to do |format|\n format.html { redirect_to(classifieds_url) }\n format.xml { head :ok }\n end\n end", "def create\n professor = Professor.new(professor_params)\n \n if professor.save\n render json: professor.to_json(include: :courses)\n else\n render :json => { :errors => professor.errors }, :status => 422\n end\n end", "def create\n @clclass = Clclass.new(params[:clclass])\n\n respond_to do |format|\n if @clclass.save\n format.html { redirect_to @clclass, notice: 'Clclass was successfully created.' }\n format.json { render json: @clclass, status: :created, location: @clclass }\n else\n format.html { render action: \"new\" }\n format.json { render json: @clclass.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @classification_fund = ClassificationFund.new(classification_fund_params)\n\n respond_to do |format|\n if @classification_fund.save\n format.html { redirect_to @classification_fund, notice: 'Classification fund was successfully created.' }\n format.json { render :show, status: :created, location: @classification_fund }\n else\n format.html { render :new }\n format.json { render json: @classification_fund.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @prediction = Prediction.new(prediction_params)\n\n respond_to do |format|\n if @prediction.save\n format.html { redirect_to @prediction, notice: 'Prediction was successfully created.' }\n format.json { render :show, status: :created, location: @prediction }\n else\n format.html { render :new }\n format.json { render json: @prediction.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @featuring = Featuring.new(featuring_params)\n\n respond_to do |format|\n if @featuring.save\n format.html { redirect_to @featuring, notice: 'Featuring was successfully created.' }\n format.json { render :show, status: :created, location: @featuring }\n else\n format.html { render :new }\n format.json { render json: @featuring.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @classment = Classment.new(classment_params)\n\n respond_to do |format|\n if @classment.save\n format.html { redirect_to @classment, notice: 'Classment was successfully created.' }\n format.json { render :show, status: :created, location: @classment }\n else\n format.html { render :new }\n format.json { render json: @classment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n respond_to do |format|\n if @certification.save\n format.html { redirect_to Certification, :notice => 'Certification was successfully created.' }\n format.json { render :json => @certification, :status => :created, :location => @certification }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @certification.errors, :status => :unprocessable_entity }\n end\n end\n end", "def classification_code_params\n params.require(:classification_code).permit(:name, :selection_criterium_ids => [])\n end" ]
[ "0.7535576", "0.7053226", "0.6705475", "0.656762", "0.65147984", "0.6427479", "0.62266773", "0.62266773", "0.61918867", "0.60876113", "0.59600914", "0.5907236", "0.5885389", "0.5870816", "0.5870816", "0.58438134", "0.57648623", "0.56751895", "0.56650513", "0.5615167", "0.55998033", "0.55823064", "0.5568752", "0.55586207", "0.5556162", "0.54801863", "0.54649967", "0.5457147", "0.5436504", "0.5434551", "0.54023767", "0.5383064", "0.53656673", "0.536501", "0.5354936", "0.53532594", "0.53467655", "0.53380567", "0.5306069", "0.52980673", "0.5280547", "0.5280547", "0.52778107", "0.5257967", "0.52071756", "0.5206133", "0.5189941", "0.5186271", "0.51851565", "0.51840866", "0.5167813", "0.51660573", "0.515603", "0.51560104", "0.5155414", "0.51536417", "0.51453644", "0.51453394", "0.5142992", "0.5139389", "0.5136442", "0.5136042", "0.5128805", "0.5126227", "0.51194423", "0.5105841", "0.51045984", "0.51017725", "0.5097662", "0.5094522", "0.50942796", "0.5084563", "0.50753164", "0.5062991", "0.50545657", "0.5051222", "0.50494015", "0.504448", "0.50406116", "0.5039826", "0.5035246", "0.503139", "0.50207955", "0.50144434", "0.5006934", "0.49888223", "0.49821296", "0.4980411", "0.49772143", "0.49770832", "0.49749514", "0.49744877", "0.49665418", "0.49628437", "0.49575385", "0.4950475", "0.49491236", "0.49488926", "0.4942773", "0.4923053" ]
0.6072999
10
PUT /classifieds/1 PUT /classifieds/1.json
def update @classified = @user.classifieds.find(params[:id]) respond_to do |format| if @classified.update_attributes(params[:classified]) format.html { redirect_to @classified, notice: 'Classified was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @classified.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @classified.update(classified_params)\n format.html { redirect_to @classified, notice: 'Classified was successfully updated.' }\n format.json { render :show, status: :ok, location: @classified }\n else\n format.html { render :edit }\n format.json { render json: @classified.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @classified.update(classified_params)\n format.html { redirect_to @classified, notice: 'Classified was successfully updated.' }\n format.json { render :show, status: :ok, location: @classified }\n else\n format.html { render :edit }\n format.json { render json: @classified.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_classified\n @classified = Classified.find(params[:id])\n end", "def set_classified\n @classified = Classified.find(params[:id])\n end", "def update\n @classified = Classified.find(params[:id])\n\n respond_to do |format|\n if @classified.update_attributes(params[:classified])\n flash[:notice] = 'Cyberstock was successfully updated.'\n format.html { redirect_to(cyberstock_admin_classifieds_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @classified.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @classifier.update(classifier_params)\n format.html { redirect_to @classifier, notice: 'Classifier was successfully updated.' }\n format.json { render :show, status: :ok, location: @classifier }\n else\n format.html { render :edit }\n format.json { render json: @classifier.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @classified = Classified.new(classified_params)\n respond_to do |format|\n if @classified.save\n format.html { redirect_to @classified, notice: 'Classified was successfully created.' }\n format.json { render :show, status: :created, location: @classified }\n else\n format.html { render :new }\n format.json { render json: @classified.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category_classified.update(category_classified_params)\n format.html { redirect_to @category_classified, notice: 'Category classified was successfully updated.' }\n format.json { render :show, status: :ok, location: @category_classified }\n else\n format.html { render :edit }\n format.json { render json: @category_classified.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @clasification.update(clasification_params)\n format.html { redirect_to @clasification, notice: \"Clasification was successfully updated.\" }\n format.json { render :show, status: :ok, location: @clasification }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @clasification.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #@classified = Classified.new(classified_params)\n @classified = current_user.classifieds.new(classified_params)\n\n respond_to do |format|\n if @classified.save\n format.html { redirect_to @classified, notice: 'Classified was successfully created.' }\n format.json { render :show, status: :created, location: @classified }\n else\n format.html { render :new }\n format.json { render json: @classified.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @classification.update(classification_params)\n format.html { redirect_to @classification, notice: t('controller.successfully_updated', model: t('activerecord.models.classification')) }\n format.json { head :no_content }\n else\n @classification_types = ClassificationType.all\n format.html { render action: \"edit\" }\n format.json { render json: @classification.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @classs.update(classs_params)\n format.html { redirect_to @classs, notice: 'Classs was successfully updated.' }\n format.json { render :show, status: :ok, location: @classs }\n else\n format.html { render :edit }\n format.json { render json: @classs.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @risk_classification = RiskClassification.find(params[:id])\n\n respond_to do |format|\n if @risk_classification.update_attributes(params[:risk_classification])\n format.html { redirect_to @risk_classification, notice: 'Risk classification was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @risk_classification.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @classified_person = ClassifiedPerson.find(params[:id])\n\n respond_to do |format|\n if @classified_person.update_attributes(params[:classified_person])\n flash[:notice] = 'ClassifiedPerson was successfully updated.'\n format.html { redirect_to(@classified_person) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @classified_person.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @taxon_name_classification.update(taxon_name_classification_params)\n format.html { redirect_to :back, notice: 'Taxon name classification was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { redirect_to :back, notice: 'Taxon name classification was NOT successfully updated.' }\n format.json { render json: @taxon_name_classification.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @classroom = classroom.find(params[:id])\n\n if @classroom.update_attributes(params[:classroom])\n head :no_content\n else\n render json: @classroom.errors, status: :unprocessable_entity\n end\n end", "def put!\n request! :put\n end", "def update\n respond_to do |format|\n if @item_classification.update(item_classification_params)\n format.html { redirect_to @item_classification, notice: 'Classificação atualizada com sucesso.' }\n format.json { render :show, status: :ok, location: @item_classification }\n else\n format.html { render :edit }\n format.json { render json: @item_classification.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @classication.update(classication_params)\n format.html { redirect_to @classication, notice: 'Classication was successfully updated.' }\n format.json { render :show, status: :ok, location: @classication }\n else\n format.html { render :edit }\n format.json { render json: @classication.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @class_taken = ClassTaken.find(params[:id])\n\n respond_to do |format|\n if @class_taken.update_attributes(params[:class_taken])\n format.html { redirect_to @class_taken, notice: 'Class taken was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @class_taken.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @project_classification.update(project_classification_params)\n format.html { redirect_to project_classifications_path, notice: 'Project classification was successfully updated.' }\n format.json { render :show, status: :ok, location: @project_classification }\n else\n format.html { render :edit }\n format.json { render json: @project_classification.errors, status: :unprocessable_entity }\n end\n end\n end", "def update options={}\n client.put(\"/#{id}\", options)\n end", "def update\n respond_to do |format|\n if @klass.update(klass_params)\n format.html { redirect_to @klass, notice: 'Class was successfully updated.' }\n format.json { render :show, status: :ok, location: @klass }\n else\n format.html { render :edit }\n format.json { render json: @klass.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @classified = @user.classifieds.find(params[:id])\n @classified.destroy\n\n respond_to do |format|\n format.html { redirect_to classifieds_url }\n format.json { head :no_content }\n end\n end", "def update\n @iclass = Iclass.find(params[:id])\n\n respond_to do |format|\n if @iclass.update_attributes(params[:iclass])\n format.html { redirect_to @iclass, :notice => 'Iclass was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @iclass.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @citizenship_class = @grantee.citizenship_classes.find(params[:id])\n\n respond_to do |format|\n if @citizenship_class.update_attributes(params[:citizenship_class])\n format.html { redirect_to [@grantee, @citizenship_class], notice: 'Citizenship class was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @citizenship_class.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n Rails.logger.debug \"[ClassificationsController.create] params.class: #{params.class}, params: #{params}\"\n @classifaction = Classification.new transaction_data: params\n @classifaction.classifiers << StatusCodeClassifier.classify( @classifaction.transaction_data )\n @classifaction.classify\n\n if @classifaction.save\n render json: @classifaction.as_jsonapi, status: :created\n else\n render json: { error: 'oops' }, status: 500\n end\n end", "def update\n @classtable = Classtable.find(params[:id])\n\n respond_to do |format|\n if @classtable.update_attributes(params[:classtable])\n format.html { redirect_to @classtable, notice: 'Classtable was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @classtable.errors, status: :unprocessable_entity }\n end\n end\n end", "def put(*args)\n request :put, *args\n end", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def update\n respond_to do |format|\n if @product_classify.update(product_classify_params)\n format.html { redirect_to :product_classifies, notice: '产品分类修改成功。' }\n format.json { render :show, status: :ok, location: @product_classify }\n else\n format.html { render :edit }\n format.json { render json: @product_classify.errors, status: :unprocessable_entity }\n end\n end\n end", "def put payload, path = \"\"\n make_request(path, \"put\", payload)\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 @occupationclassification = Occupationclassification.find(params[:id])\n\n respond_to do |format|\n if @occupationclassification.update_attributes(params[:occupationclassification])\n flash[:success] = \"Occupation classification was successfully updated.\"\n format.html { redirect_to @occupationclassification }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @occupationclassification.errors, :status => :unprocessable_entity }\n end\n end\n end", "def perform_put_with_object_from_collection(path, options, klass, collection_name)\n perform_request_with_object_from_collection(:put, path, options, klass, collection_name)\n end", "def update\n @clazz = Clazz.find(params[:id])\n\n respond_to do |format|\n if @clazz.update_attributes(params[:clazz])\n format.html { redirect_to @clazz, notice: 'Clazz was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @clazz.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @class = Classe.find(params[:id])\n\n respond_to do |format|\n if @class.update_attributes(params[:class])\n format.html { redirect_to @class, notice: 'Classe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @class.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @recommendation = Recommendation.find(params[:id])\n @users=User.all\n @products=Product.all\n @occasions=Occasion.all\n respond_to do |format|\n if @recommendation.update_attributes(params[:recommendation])\n format.html { redirect_to occasion_path(@recommendation.occasion_id) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recommendation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @trainclass.update(trainclass_params)\n format.html { redirect_to @trainclass, notice: 'Trainclass was successfully updated.' }\n format.json { render :show, status: :ok, location: @trainclass }\n else\n format.html { render :edit }\n format.json { render json: @trainclass.errors, status: :unprocessable_entity }\n end\n end\n end", "def classified_params\n params.require(:classified).permit(\n :id,\n :title,\n :document_type,\n :document_number,\n :seller_name,\n :email,\n :landline,\n :cell_phone,\n :description,\n :price,\n :user_id,\n :bonded,\n :classified_conditional\n )\n end", "def update\n @test_class = TestClass.find(params[:id])\n\n respond_to do |format|\n if @test_class.update_attributes(params[:test_class])\n format.html { redirect_to @test_class, notice: 'Test class was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @test_class.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @review = Review.find(params[:id])\n @review.update(review_params)\n render json: @review\n end", "def set_category_classified\n @category_classified = CategoryClassified.find(params[:id])\n end", "def put(path, data = {})\n request 'PUT', path, body: data.to_json\n end", "def update\n respond_to do |format|\n if @food_class.update(food_class_params)\n format.html { redirect_to @food_class, notice: 'Food class was successfully updated.' }\n format.json { render :show, status: :ok, location: @food_class }\n else\n format.html { render :edit }\n format.json { render json: @food_class.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @classname.update(classname_params)\n format.html { redirect_to @classname, notice: 'Classname was successfully updated.' }\n format.json { render :show, status: :ok, location: @classname }\n else\n format.html { render :edit }\n format.json { render json: @classname.errors, status: :unprocessable_entity }\n end\n end\n end", "def classs_params\n params.require(:classs).permit(:name, :major_id)\n end", "def update\n @classification = Classification.find(params[:id])\n @items = Item.select_list\n @subjects = Subject.concept_list\n @genres = Subject.genre_list\n respond_to do |format|\n if @classification.update_attributes(params[:classification])\n format.html { redirect_to(admin_classification_path(@classification), :notice => 'Classification was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @classification.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @class_detail.update(class_detail_params)\n format.html { redirect_to @class_detail, notice: 'Class detail was successfully updated.' }\n format.json { render :show, status: :ok, location: @class_detail }\n else\n format.html { render :edit }\n format.json { render json: @class_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @classified = Classified.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @classified }\n end\n end", "def update\n respond_to do |format|\n if @discipleship_class.update(discipleship_class_params)\n format.html { redirect_to @discipleship_class, notice: 'Discipleship class was successfully updated.' }\n format.json { render :show, status: :ok, location: @discipleship_class }\n else\n format.html { render :edit }\n format.json { render json: @discipleship_class.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @clclass = Clclass.find(params[:id])\n\n respond_to do |format|\n if @clclass.update_attributes(params[:clclass])\n format.html { redirect_to @clclass, notice: 'Clclass was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @clclass.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @classification_code.update(classification_code_params)\n format.html { redirect_to @classification_code, notice: 'Classification code was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @classification_code.errors, status: :unprocessable_entity }\n end\n end\n end", "def perform_put_with_objects(path, options, klass)\n perform_request_with_objects(:put, path, options, klass)\n end", "def put(id, json)\n with_endpoint do |endpoint|\n url = [endpoint, @resource_name, id].compact.join('/')\n url += \"/\" \n return HTTParty.put(url, :body => json, :timeout => 4, :headers => { 'Content-Type' => 'application/json' })\n end\n end", "def update\n @interest = Interest.find(params[:id])\n \n respond_to do |format|\n if @interest.update_attributes(params[:interest])\n format.json { head :ok }\n else\n format.json { render :json => @interest.errors,\n :status => :unprocessable_entity }\n end\n end\n end", "def update\n @create_classified_ad = CreateClassifiedAd.find(params[:id])\n\n respond_to do |format|\n if @create_classified_ad.update_attributes(params[:create_classified_ad])\n format.html { redirect_to @create_classified_ad, notice: 'Create classified ad was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @create_classified_ad.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @business_classification.update(business_classification_params)\n format.html { redirect_to @business_classification, notice: 'Business classification was successfully updated.' }\n format.json { render :show, status: :ok, location: @business_classification }\n else\n format.html { render :edit }\n format.json { render json: @business_classification.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @confidence_rating.update(confidence_rating_params)\n format.html { redirect_to @confidence_rating, notice: 'Confidence rating was successfully updated.' }\n format.json { render :show, status: :ok, location: @confidence_rating }\n else\n format.html { render :edit }\n format.json { render json: @confidence_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def recipe_classify_params\n params.require(:recipe_classify).permit(:name, :recipe_classify_id)\n end", "def index\n @classifieds = Classified.all\n end", "def update\n respond_to do |format|\n if @biocuration_classification.update(biocuration_classification_params)\n format.html { redirect_to :back, notice: 'Biocuration classification was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { redirect_to :back, notice: 'Biocuration classification was NOT successfully updated.' }\n format.json { render json: @biocuration_classification.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @instruction_factory = InstructionFactory.find(params[:id]) \n @instruction_factory.classname = params[:instruction_factory][:classname]\n @instruction_factory.name = params[:instruction_factory][:name]\n respond_to do |format|\n \n if @instruction_factory.save\n format.html { redirect_to @instruction_factory, notice: 'instruction_factory was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @instruction_factory.errors, status: :unprocessable_entity }\n end\n end\n end", "def put(*args)\n request(:put, *args)\n end", "def update\n @klass = Klass.find(params[:id])\n\n respond_to do |format|\n if @klass.update_attributes(params[:klass])\n flash[:notice] = 'Klass was successfully updated.'\n format.html { redirect_to(@klass) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @klass.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @investigationclassification.update(investigationclassification_params)\n format.html { redirect_to @investigationclassification.investigation, notice: 'Investigationclassification was successfully updated.' }\n format.json { render :show, status: :ok, location: @investigationclassification }\n else\n format.html { render :edit }\n format.json { render json: @investigationclassification.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @recommendation = Recommendation.find(params[:id])\n\n respond_to do |format|\n if @recommendation.update_attributes(params[:recommendation])\n format.html { redirect_to @recommendation, notice: 'Recommendation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recommendation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @incomeclassification = Incomeclassification.find(params[:id])\n\n respond_to do |format|\n if @incomeclassification.update_attributes(params[:incomeclassification])\n flash[:success] = \"Income classification was successfully updated.\"\n format.html { redirect_to @incomeclassification }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @incomeclassification.errors, :status => :unprocessable_entity }\n end\n end\n end", "def perform_put_with_object(path, options, klass)\n perform_request_with_object(:put, path, options, klass)\n end", "def http_put(path, data, content_type = 'application/json')\n http_methods(path, :put, data, content_type)\n end", "def update\n\n if @mscore_classification.update(mscore_classification_params)\n flash[:success] = 'Mscore classification was successfully updated.'\n redirect_to :back\n\n else\n flash[:danger] = 'Mscore classification was not updated.'\n redirect_to :back\n end\n\n end", "def update\n respond_to do |format|\n if @classwork.update(classwork_params)\n format.html { redirect_to @classwork, notice: 'Classwork was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @classwork.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @gg_classlist.update(gg_classlist_params)\n format.html { redirect_to @gg_classlist, notice: 'Gg classlist was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @gg_classlist.errors, status: :unprocessable_entity }\n end\n end\n end", "def classified_params\n params.require(:classified).permit(:title, :description, :price, :location,:category_id,{images: []}, :images_cache)\n end", "def update\n add_breadcrumb \"Classes\", classes_url\n add_breadcrumb \"Edit\"\n respond_to do |format|\n if @class.update(class_params)\n format.html { redirect_to classes_url, notice: 'Class was successfully updated.' }\n format.json { render :show, status: :ok, location: @class }\n else\n format.html { render :edit }\n flash[:alert] = @class.errors.full_messages.to_sentence\n format.json { render json: @class.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def update\n put :update\n end", "def update\n respond_to do |format|\n if @education_class.update(education_class_params)\n format.html { redirect_to @education_class, notice: 'Education class was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @education_class.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_classication\n @classication = Classication.find(params[:id])\n end", "def update\n respond_to do |format|\n if @featuring.update(featuring_params)\n format.html { redirect_to @featuring, notice: 'Featuring was successfully updated.' }\n format.json { render :show, status: :ok, location: @featuring }\n else\n format.html { render :edit }\n format.json { render json: @featuring.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 respond_to do |format|\n if @request_class_lab.update(request_class_lab_params)\n format.html { redirect_to @request_class_lab }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @request_class_lab.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @student_class.update(student_class_params)\n format.html { redirect_to @student_class, notice: \"Student class was successfully updated.\" }\n format.json { render :show, status: :ok, location: @student_class }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @student_class.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @classified_person_category = ClassifiedPersonCategory.find(params[:id])\n\n respond_to do |format|\n if @classified_person_category.update_attributes(params[:classified_person_category])\n flash[:notice] = 'ClassifiedPersonCategory was successfully updated.'\n format.html { redirect_to(@classified_person_category) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @classified_person_category.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put(path, params = {})\n request(:put, path, params)\n end", "def put(path, params = {})\n request(:put, path, params)\n end", "def put(path, params = {})\n request(:put, path, params)\n end", "def update\n respond_to do |format|\n if @classpersonscore.update(classpersonscore_params)\n format.html { redirect_to @classpersonscore, notice: 'Classpersonscore was successfully updated.' }\n format.json { render :show, status: :ok, location: @classpersonscore }\n else\n format.html { render :edit }\n format.json { render json: @classpersonscore.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\nlogger.debug \"update discipline: \"+@discipline.inspect\n discipline_params.each_pair do |property,value|\n @discipline.send(property+'=',value)if @discipline.respond_to?(property+'=')\n end\n @discipline.updater_id = current_user\n if @discipline.save\n set_discipline\n #respond_with @discipline\n render json: @discipline, status: :ok\n else\n ##render json: @discipline.errors, status: :unprocessable_entity\n respond_with @discipline.errors, status: :unprocessable_entity\n end\n end", "def put(klass, data, opts = {})\n opts = job_options(klass, data, opts)\n @client.call('put', worker_name, @name,\n (opts[:jid] || Qless.generate_jid),\n klass.is_a?(String) ? klass : klass.name,\n JSON.generate(data),\n opts.fetch(:delay, 0),\n 'priority', opts.fetch(:priority, 0),\n 'tags', JSON.generate(opts.fetch(:tags, [])),\n 'retries', opts.fetch(:retries, 5),\n 'depends', JSON.generate(opts.fetch(:depends, []))\n )\n end", "def put(path, params = {})\n request(:put, path, params)\n end", "def put(path, params = {})\n request(:put, path, params)\n end", "def update\n json_update(category,category_params, Category)\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 @s_class.update(s_class_params)\n format.html { redirect_to @s_class, notice: 'S class was successfully updated.' }\n format.json { render :show, status: :ok, location: @s_class }\n else\n format.html { render :edit }\n format.json { render json: @s_class.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @recommendation.update(recommendation_params)\n format.html { redirect_to @recommendation, notice: \"Recommendation was successfully updated.\" }\n format.json { render :show, status: :ok, location: @recommendation }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @recommendation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @myclass = Myclass.find(params[:id])\n\n respond_to do |format|\n if @myclass.update_attributes(params[:myclass])\n format.html { redirect_to @myclass, notice: 'Myclass was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @myclass.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @class_test.update(class_test_params)\n format.html { redirect_to @class_test, notice: 'Class test was successfully updated.' }\n format.json { render :show, status: :ok, location: @class_test }\n else\n format.html { render :edit }\n format.json { render json: @class_test.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @female_shot_put.update(female_shot_put_params)\n format.html { redirect_to @female_shot_put, notice: 'Female shot put was successfully updated.' }\n format.json { render :show, status: :ok, location: @female_shot_put }\n else\n format.html { render :edit }\n format.json { render json: @female_shot_put.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_recipe_classify\n @recipe_classify = RecipeClassify.find(params[:id])\n end" ]
[ "0.6790866", "0.6790866", "0.6443071", "0.6443071", "0.6332666", "0.60775906", "0.6046845", "0.5942756", "0.5915898", "0.58568054", "0.58161974", "0.57492745", "0.57295406", "0.5697634", "0.56951195", "0.5639165", "0.5630543", "0.56200415", "0.56196827", "0.55982274", "0.5589343", "0.5558245", "0.555612", "0.5555804", "0.55454785", "0.55322963", "0.55255103", "0.5514639", "0.55073893", "0.55028164", "0.5488876", "0.5487661", "0.54836786", "0.5466467", "0.5464143", "0.545841", "0.54487777", "0.5439288", "0.54392374", "0.543188", "0.5431367", "0.5411244", "0.5409968", "0.5404859", "0.5398554", "0.5397264", "0.5392713", "0.53853476", "0.5384124", "0.5377045", "0.53718936", "0.5369633", "0.53553903", "0.5332532", "0.53299654", "0.5328782", "0.53279805", "0.5314828", "0.53077096", "0.5307275", "0.53017", "0.529946", "0.52992445", "0.5298399", "0.52975166", "0.52936906", "0.52866614", "0.52811193", "0.527293", "0.52714103", "0.5263424", "0.5260029", "0.5258664", "0.52564955", "0.52502126", "0.5248137", "0.52419794", "0.52394414", "0.52279323", "0.52267855", "0.5226529", "0.52215534", "0.5218228", "0.5208396", "0.52080756", "0.52080756", "0.52080756", "0.5206902", "0.520532", "0.5200752", "0.51992506", "0.51992506", "0.5197913", "0.519327", "0.5192031", "0.51897717", "0.5187746", "0.518548", "0.51854306", "0.51846266" ]
0.7026347
0
DELETE /classifieds/1 DELETE /classifieds/1.json
def destroy @classified = @user.classifieds.find(params[:id]) @classified.destroy respond_to do |format| format.html { redirect_to classifieds_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @classified.destroy\n respond_to do |format|\n format.html { redirect_to classifieds_url, notice: 'Classified was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @classified.destroy\n respond_to do |format|\n format.html { redirect_to classifieds_url, notice: 'Classified was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @classified = Classified.find(params[:id])\n @classified.destroy\n\n respond_to do |format|\n format.html { redirect_to(classifieds_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @classified = Classified.find(params[:id])\n @classified.destroy\n\n respond_to do |format|\n format.html { redirect_to(cyberstock_admin_classifieds_path) }\n format.xml { head :ok }\n end\n end", "def destroy\n @classification = Classification.find(params[:id])\n @classification.destroy\n\n respond_to do |format|\n format.html { redirect_to classifications_url, notice: t('controller.successfully_deleted', model: t('activerecord.models.classification')) }\n format.json { head :no_content }\n end\n end", "def destroy\n @classifier.destroy\n respond_to do |format|\n format.html { redirect_to classifiers_url, notice: 'Classifier was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @risk_classification = RiskClassification.find(params[:id])\n @risk_classification.destroy\n\n respond_to do |format|\n format.html { redirect_to risk_classifications_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item_classification.destroy\n respond_to do |format|\n format.html { redirect_to item_classifications_url, notice: 'Classificação destruída com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @nudge.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @clasification.destroy\n respond_to do |format|\n format.html { redirect_to clasifications_url, notice: \"Clasification was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @classtable = Classtable.find(params[:id])\n @classtable.destroy\n\n respond_to do |format|\n format.html { redirect_to classtables_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @discipleship_class.destroy\n respond_to do |format|\n format.html { redirect_to discipleship_classes_url, notice: 'Discipleship class was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_class = TestClass.find(params[:id])\n @test_class.destroy\n\n respond_to do |format|\n format.html { redirect_to test_classes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @klass.destroy\n respond_to do |format|\n format.html { redirect_to klasses_url, notice: 'Class was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @clclass = Clclass.find(params[:id])\n @clclass.destroy\n\n respond_to do |format|\n format.html { redirect_to clclasses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @class_taken = ClassTaken.find(params[:id])\n @class_taken.destroy\n\n respond_to do |format|\n format.html { redirect_to class_takens_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @classs.destroy\n respond_to do |format|\n format.html { redirect_to classses_url, notice: 'Classs was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @category_classified.destroy\n respond_to do |format|\n format.html { redirect_to category_classifieds_url, notice: 'Category classified was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @class = Classe.find(params[:id])\n @class.destroy\n\n respond_to do |format|\n format.html { redirect_to classes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @education_class.destroy\n respond_to do |format|\n format.html { redirect_to education_classes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @myclass = Myclass.find(params[:id])\n @myclass.destroy\n\n respond_to do |format|\n format.html { redirect_to myclasses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @investigationclassification.destroy\n respond_to do |format|\n format.html { redirect_to investigationclassifications_url, notice: 'Investigationclassification was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @certified.destroy\n respond_to do |format|\n format.html { redirect_to certifieds_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @classication.destroy\n respond_to do |format|\n format.html { redirect_to classications_url, notice: 'Classication was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @food_class.destroy\n respond_to do |format|\n format.html { redirect_to food_classes_url, notice: 'Food class was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @gpath = Gpath.find(params[:id])\n @gpath.destroy\n\n respond_to do |format|\n format.html { redirect_to gpaths_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @klass.destroy\n respond_to do |format|\n format.html { redirect_to management_klasses_url, notice: 'Class was successfully removed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @klass = Klass.find(params[:id])\n @klass.destroy\n\n respond_to do |format|\n format.html { redirect_to(klasses_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @crowd = Crowd.find(params[:id])\n @crowd.destroy\n\n respond_to do |format|\n format.html { redirect_to crowds_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @request_class_lab.destroy\n respond_to do |format|\n format.html { redirect_to request_class_labs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @citizenship_class = @grantee.citizenship_classes.find(params[:id])\n @citizenship_class.destroy\n\n respond_to do |format|\n format.html { redirect_to grantee_path(@grantee) }\n format.json { head :no_content }\n end\n end", "def destroy\n @class_student.destroy\n respond_to do |format|\n format.html { redirect_to class_students_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sob_class.destroy\n respond_to do |format|\n format.html { redirect_to sob_classes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @taxon_determination.destroy\n respond_to do |format|\n format.html { redirect_to taxon_determinations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @occupationclassification = Occupationclassification.find(params[:id])\n @occupationclassification.destroy\n\n respond_to do |format|\n format.html { redirect_to occupationclassifications_url }\n format.xml { head :ok }\n end\n end", "def destroy\n @dish_mixture.destroy\n respond_to do |format|\n format.html { redirect_to dish_mixtures_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @confidence_rating.destroy\n respond_to do |format|\n format.html { redirect_to confidence_ratings_url, notice: 'Confidence rating was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @forest = Forest.find(params[:id])\n @forest.destroy\n\n respond_to do |format|\n format.html { redirect_to forests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @taxon_name_classification.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Taxon name classification was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @classe = Classe.find(params[:id])\n @classe.destroy\n\n respond_to do |format|\n format.html { redirect_to classi_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @rating.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @ruby.destroy\n respond_to do |format|\n format.html { redirect_to rubies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @competency.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @iclass = Iclass.find(params[:id])\n @iclass.destroy\n\n respond_to do |format|\n format.html { redirect_to iclasses_url }\n format.json { head :ok }\n end\n end", "def destroy\n @investigated.destroy\n respond_to do |format| \n format.json { head :no_content }\n end\n end", "def delete\n request(:delete)\n end", "def destroy\n @incomeclassification = Incomeclassification.find(params[:id])\n @incomeclassification.destroy\n\n respond_to do |format|\n format.html { redirect_to incomeclassifications_url }\n format.xml { head :ok }\n end\n end", "def destroy\n @classified_person = ClassifiedPerson.find(params[:id])\n @classified_person.destroy\n\n respond_to do |format|\n format.html { redirect_to(classified_people_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @six.destroy\n respond_to do |format|\n format.html { redirect_to sixes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @accuracy = Accuracy.find(params[:id])\n @accuracy.destroy\n\n respond_to do |format|\n format.html { redirect_to accuracies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @business_classification.destroy\n respond_to do |format|\n format.html { redirect_to business_classifications_url, notice: 'Business classification was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @project_classification.destroy\n respond_to do |format|\n format.html { redirect_to project_classifications_url, notice: 'Project classification was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @forest.destroy\n respond_to do |format|\n format.html { redirect_to forests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @data_class.destroy\n respond_to do |format|\n format.html { redirect_to data_classes_url, notice: 'Data class was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @climb_class.destroy\n respond_to do |format|\n format.html { redirect_to climb_classes_url, notice: 'Climb class was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @districtclass = Districtclass.find(params[:id])\n @districtclass.destroy\n\n respond_to do |format|\n format.html { redirect_to districtclasses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @trainclass.destroy\n respond_to do |format|\n format.html { redirect_to trainclasses_url, notice: 'Trainclass was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @crew_class.destroy\n respond_to do |format|\n format.html { redirect_to crew_classes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @featuring.destroy\n respond_to do |format|\n format.html { redirect_to featuring_index_url, notice: 'Featuring was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @class_detail.destroy\n respond_to do |format|\n format.html { redirect_to class_details_url, notice: 'Class detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @massive_load = MassiveLoad.find(params[:id])\n @massive_load.destroy\n\n respond_to do |format|\n format.html { redirect_to massive_loads_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @green = Green.find(params[:id])\n @green.destroy\n\n respond_to do |format|\n format.html { redirect_to scaffold_greens_url }\n format.json { head :ok }\n end\n end", "def destroy\n @classwork.destroy\n respond_to do |format|\n format.html { redirect_to classworks_url }\n format.json { head :no_content }\n end\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def destroy\n @review.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @clazz = Clazz.find(params[:id])\n @clazz.destroy\n\n respond_to do |format|\n format.html { redirect_to clazzs_url }\n #format.json { head :no_content }\n format.js { render :nothing => true }\n end\n end", "def destroy\n @occupant = Occupant.find(params[:id])\n @occupant.destroy\n\n respond_to do |format|\n format.html { redirect_to occupants_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @inclass.destroy\n respond_to do |format|\n format.html { redirect_to inclasses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @class_test.destroy\n respond_to do |format|\n format.html { redirect_to class_tests_url, notice: 'Class test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Post.delete(params[\"id\"])\n end", "def destroy\n @graduating_class.destroy\n respond_to do |format|\n format.html { redirect_to graduating_classes_url, notice: 'Graduating class was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @kickoff = Kickoff.find(params[:id])\n @kickoff.destroy\n\n respond_to do |format|\n format.html { redirect_to kickoffs_url }\n format.json { head :no_content }\n end\n end", "def delete\n \n end", "def destroy\n @contestant = Contestant.find(params[:id])\n @contestant.destroy\n\n respond_to do |format|\n format.html { redirect_to contestants_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @male_shot_put_head.destroy\n respond_to do |format|\n format.html { redirect_to male_shot_put_heads_url, notice: 'Male shot put head was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @prediction.destroy\n respond_to do |format|\n format.html { redirect_to predictions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @apex_class.destroy\n respond_to do |format|\n format.html { redirect_to apex_classes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @firstclass.destroy\n respond_to do |format|\n format.html { redirect_to firstclasses_url, notice: 'Firstclass was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def destroy\n @gig_request = GigRequest.find(params[:id])\n @gig_request.destroy\n\n respond_to do |format|\n format.html { redirect_to gig_requests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @classification_fund.destroy\n respond_to do |format|\n format.html { redirect_to classification_funds_url, notice: 'Classification fund was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @prediction = Prediction.find(params[:id])\n @prediction.destroy\n\n respond_to do |format|\n format.html { redirect_to predictions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @recommendation = Recommendation.find(params[:id])\n @recommendation.destroy\n\n respond_to do |format|\n format.html { redirect_to recommendations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @recommendation = Recommendation.find(params[:id])\n @recommendation.destroy\n\n respond_to do |format|\n format.html { redirect_to recommendations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @seatclass.destroy\n respond_to do |format|\n format.html { redirect_to seatclasses_url, notice: 'Seatclass was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @recommendation.destroy\n respond_to do |format|\n format.html { redirect_to recommendations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @gg_classlist.destroy\n respond_to do |format|\n format.html { redirect_to gg_classlists_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @detail_class.destroy\n respond_to do |format|\n format.html { redirect_to detail_classes_url, notice: 'Detail class was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @student_class.destroy\n respond_to do |format|\n format.html { redirect_to student_classes_url, notice: \"Student class was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @predict = Predict.find(params[:id])\n @predict.destroy\n\n respond_to do |format|\n format.html { redirect_to predicts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @classification_code.destroy\n respond_to do |format|\n format.html { redirect_to classification_codes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @biocuration_classification.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Biocuration classification was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @classpersonscore.destroy\n respond_to do |format|\n format.html { redirect_to classpersonscores_url, notice: 'Classpersonscore was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @dnd_class.destroy\n respond_to do |format|\n format.html { redirect_to dnd_classes_url, notice: 'Dnd class was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @proficiency = Proficiency.find(params[:id])\n @proficiency.destroy\n\n respond_to do |format|\n format.html { redirect_to proficiencies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @class_seat.destroy\n respond_to do |format|\n format.html { redirect_to class_seats_url, notice: 'Class seat was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @food.destroy\n @food.image.destroy\n @j = Joint.where(food_id: @food.id)\n if @j == true\n @j.destroy_all\n end\n respond_to do |format|\n format.html { redirect_to foods_url, notice: 'Food was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(url)\n @deleted = true\nend", "def delete!\n request! :delete\n end" ]
[ "0.735492", "0.735492", "0.73449916", "0.7194511", "0.70238125", "0.6886442", "0.68384784", "0.67592686", "0.67164856", "0.66575056", "0.66549844", "0.66458607", "0.6619374", "0.66177684", "0.6577693", "0.6549269", "0.6535986", "0.65257215", "0.65209186", "0.6513518", "0.65129316", "0.65044004", "0.6475338", "0.6469808", "0.64676607", "0.6466686", "0.64465916", "0.64447445", "0.64359516", "0.6433199", "0.64250934", "0.642451", "0.64198804", "0.6419584", "0.64194894", "0.64125025", "0.6406047", "0.6405747", "0.6404073", "0.64037263", "0.6402326", "0.6399532", "0.63993746", "0.6396643", "0.63940704", "0.6385646", "0.6384249", "0.6381991", "0.6379483", "0.63792074", "0.6377251", "0.63764477", "0.63733125", "0.6372633", "0.63678944", "0.6367512", "0.6366932", "0.6365876", "0.6359154", "0.6358491", "0.6358138", "0.63579184", "0.6355155", "0.6348668", "0.6340177", "0.6335134", "0.6334447", "0.63329303", "0.63320166", "0.63317156", "0.6330592", "0.63274676", "0.63249713", "0.63242644", "0.6320462", "0.63196874", "0.6318783", "0.6305321", "0.6304994", "0.63044375", "0.6301918", "0.63017976", "0.62941605", "0.6294077", "0.62939644", "0.6286054", "0.62793547", "0.62788403", "0.627871", "0.62782264", "0.627015", "0.62666523", "0.62645733", "0.6263778", "0.6262444", "0.62516516", "0.6250797", "0.6249797", "0.6248911", "0.6246872" ]
0.7414375
0
The rule used to determine if a model has a problem
def rule(model) return false unless model.is_a?(CukeModeler::Scenario) || model.is_a?(CukeModeler::Outline) model_steps = model.steps || [] return false unless model_steps.last when_keywords.include?(model_steps.last.keyword) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rule(model)\n return false unless model.is_a?(CukeModeler::Scenario) || model.is_a?(CukeModeler::Outline)\n\n @linted_step_count = model.steps.nil? ? 0 : model.steps.count\n @linted_step_threshold = @step_threshold || 10\n\n @linted_step_count > @linted_step_threshold\n end", "def rule(model)\n return false unless model.is_a?(CukeModeler::Step)\n\n @linted_step_length = model.text.nil? ? 0 : model.text.length\n\n @linted_step_length > step_length_threshold\n end", "def measure\n return :skip if !@rule.enabled? || !@rule.validatable?\n @rule.valid?\n end", "def rule(model)\n return false unless model.is_a?(CukeModeler::Scenario) || model.is_a?(CukeModeler::Outline)\n\n @linted_test_name_length = model.name.nil? ? 0 : model.name.length\n\n @linted_test_name_length > test_name_length_threshold\n end", "def rule?\n kind == :rule\n end", "def rule(model)\n return false unless model.is_a?(CukeModeler::Scenario) || model.is_a?(CukeModeler::Outline)\n\n model_steps = model.steps || []\n verification_step_found = false\n\n model_steps.each do |step|\n if verification_step_found\n return true if given_keywords.include?(step.keyword)\n else\n verification_step_found = then_keywords.include?(step.keyword)\n end\n end\n\n false\n end", "def problem?\n analysis.any? { |c| !c.ok? }\n end", "def required?\n @rule == :required\n end", "def rule; end", "def rule; end", "def rule; end", "def base_rule_error?\n !errors.filter(:base?).empty?\n end", "def rule(model)\n return false unless relevant_model?(model)\n\n @linted_model_class = model.class\n\n relevant_tags = if @tag_inheritance\n model.all_tags\n else\n model.tags || []\n end\n tag_names = relevant_tags.map(&:name)\n\n @duplicate_tag = tag_names.find { |tag| tag_names.count(tag) > 1 }\n\n !@duplicate_tag.nil?\n end", "def allquantors_inside?(problem)\n problem.constraints.each do |constraint|\n return true if constraint.expression.is_a? Yarpler::Models::Forall\n end\n false\n end", "def check\n if unique_has_one_association?\n check_unique_has_one\n else\n check_remaining\n end\n end", "def rule(model)\n return false unless model.is_a?(CukeModeler::Scenario) || model.is_a?(CukeModeler::Outline)\n\n model_steps = model.steps || []\n background_steps = model.parent_model.has_background? ? model.parent_model.background.steps || [] : []\n all_steps = model_steps + background_steps\n all_steps.none? { |step| when_keywords.include?(step.keyword) }\n end", "def rules; end", "def rules; end", "def rules; end", "def rules; end", "def rules; end", "def rules; end", "def rules; end", "def can_see_problem\n\t\tcurr_problem = current_problem\n\t\tif curr_problem.checked || current_user.id==curr_problem.creator.id ||current_user.admin? || current_user.moderator?\t\n\t\t\tunless current_user.relation_of(curr_problem).present? || current_user.id==curr_problem.creator.id || curr_problem.solutions.count==0 ||current_user.admin? || current_user.moderator?\t\t\t\t\n\t\t\t\tflash[:danger] = \"You are not allowed to see this problem\"\n\t\t\t\tredirect_to root_path\n\t\t\tend\n\t\telse\n\t\t\tflash[:danger] = \"This problem is not checked!!! You cannoot see it!!!!\"\n\t\t\tredirect_to root_path\n\t\tend\n\tend", "def validate\n\t\t\t# time always exists\n\t\t\tsyms = { 't' => Parameter.new('t', 0) }\n\t\t\tidents = []\n\t\t\t@species.each {|k, v| syms[k] = v}\n\t\t\t@parameters.each do |k, v| \n\t\t\t\traise \"Parameter and species share id: #{k}\" if syms[k]\n\t\t\t\tsyms[k] = v\n\t\t\tend\n\t\t\tsyms.each do |k, v|\n\t\t\t\traise \"Symbol #{v.to_s} mapped to wrong id: #{k}\" if v.name != k\n\t\t\tend\n\n\t\t\trule_output_names = {}\n\n\t\t\t@rules.each do |rule|\n\t\t\t\tif rule_output_names.key? (rule.output.name)\n\t\t\t\t\traise \"Two rules for one output (#{rule.output.name})\"\n\t\t\t\tend\n\t\t\t\trule_output_names[rule.output.name] = 1\n\n\t\t\t\tif !syms.key?(rule.output.name)\n\t\t\t\t\traise \"rule #{rule.to_s} has undefined output: #{rule.output.name}\"\n\t\t\t\tend\n\n\t\t\t\tif syms[rule.output.name] != rule.output\n\t\t\t\t\traise \"Inconsistent model: rule #{rule.to_s} does not output to the correct variable #{syms[rule.output.name]}\"\n\t\t\t\tend\n\n\t\t\t\trule.equation.all_idents.each do |id|\n\t\t\t\t\tidents = idents | [id]\n\t\t\t\t\tif !syms.key?(id)\n\t\t\t\t\t\traise \"rule #{rule.to_s} has undefined input: #{id}\"\n\t\t\t\t\t# else\n\t\t\t\t\t# \tputs \"#{id} used in #{rule.to_s}\\n\"\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tunused = idents.reject { |e| syms.key?(e) }\n\t\t\tunused = unused | (syms.keys.reject { |e| idents.index(e) })\n\t\t\t# dawn dusk and force are in every model (at least after sassy opens it)\n\t\t\tunused = unused.reject { |e| e == 't' || e == 'dawn' || e == 'dusk' || e == 'force' \\\n\t\t\t\t|| rule_output_names.key?(e) || @species.key?(e) }\n\t\t\tif unused.length > 0\n\t\t\t\tputs \"[W] Model has unused symbols: #{unused}\\n\"\n\t\t\tend\n\t\t\tself\n\t\tend", "def confusion?\r\n exist? && restriction >= 1 && restriction <= 3\r\n end", "def check_model?\n !check_model.nil?\n end", "def rule_error?(key)\n !schema_error?(key) && error?(key)\n end", "def test_invalid_with_empty_rule_name_or_state_or_logic\n owner = people(:valid_person)\n rule = Rule.new(:person_id => owner.id)\n assert !rule.valid?\n # The rule_name field should have validation errors\n assert rule.errors[:rule_name].any?\n # The state field should have validation errors\n assert rule.errors[:state].any?\n # The logic field should have validation errors\n assert rule.errors[:logic].any?\n end", "def parameter_rule?; end", "def validation\n :wf_point?\n end", "def metricModel? \n model = Sketchup.active_model\n\n # Get the length Units of the active model from the unitsOptions\n # 0=inches,1=feet,2=mm,3=cm,4=m\n unit = model.options[\"UnitsOptions\"][\"LengthUnit\"]\n return !(unit==0 || unit==1)\nend", "def rule(model)\n return false unless model.is_a?(CukeModeler::Feature)\n\n tags = model.tags\n\n model.each_descendant do |descendant_model|\n tags.concat(descendant_model.tags) if descendant_model.respond_to?(:tags)\n end\n\n tags = tags.collect(&:name).uniq\n\n @linted_tag_threshold = @tag_threshold || 10\n @linted_tag_count = tags.count\n\n @linted_tag_count > @linted_tag_threshold\n end", "def rule\n super\n end", "def rule\n super\n end", "def valid_rule?(rule)\n RULES.key?(rule.to_sym)\n end", "def solver\n if checkrule(0)\n puts \"Success!!!\"\n else\n puts \"No solution found\"\n end\n end", "def coming_under?(model)\n @determine.nil? or !!@determine.call(model)\n end", "def optional?\n @rule == :optional\n end", "def has_required?; end", "def perform_validation?\n self.skip_validation == true ? false : true\n end", "def has_rule?(name)\n rules.key?(name.to_sym)\n end", "def has_rule?(name)\n rules.key?(name.to_sym)\n end", "def doGreedy? forceValidation\r\n\t\tif ! @trainTestStruct.equalTestSetAndResults?\r\n\t\t\tif ! forceValidation\r\n\t\t\t\treturn false\r\n\t\t\telse\r\n\t\t\t\tdoValidation \r\n\t\t\tend\r\n\t\tend\r\n\t\ttrue\r\n\tend", "def elide? # :nodoc:\n rule.elide?\n end", "def my_request(request)\n if self.problems.where({ id: request.problem_id }).any?\n true\n else\n false\n end\n end", "def interested?(model)\n !model.nil?\nend", "def has_problem?(options = {})\n options = options.reverse_merge(:include_owner => true)\n\n problem = self.class.problem_court_status.include?(court_status)\n\n if options[:include_owner]\n problem || owner.try(has_problem?)\n else\n problem\n end\n end", "def rule\n rules[0]\n end", "def rule\n rules[0]\n end", "def rule\n rules[0]\n end", "def rule\n rules[0]\n end", "def rule\n rules[0]\n end", "def rules\n self.class.rules\n end", "def test_invalid_logic\n owner = people(:valid_person)\n rule = Rule.new(:person_id=>owner.id,\n :rule_name=>\"test\",\n :state=>\"active\",\n :logic=>\"aaaaaand\")\n assert !rule.valid?\n # The logic field should have validation errors\n assert rule.errors[:logic].any?\n end", "def integrity_check\n start_values = condition.start_values\n generations.each do |g|\n # FIXME -- use the registered fitness function\n if IterativeLearning::FunctionLearning.sum_of_error(g.start_values, start_values) != 0\n return false\n end\n start_values = g.best_task_response\n end\n return true\n end", "def is_design_problem?\n return self.type == \"DesignProblem\"\n end", "def feasible?(x)\n feas = true\n @constraints.each do |c|\n feas = false if is_violated?(c,x)\n end\n #puts inspect_constraints(x) if @options[:debug] > 4\n info(inspect_constraints(x), 4, __method__, __LINE__)\n return feas\n end", "def suitable_for_any?\n \treturn self.disciplines.count > 0\n end", "def good?\n @summary[:total_score] <= Constants::THRESHOLDS[\"Project\"]\n end", "def solved?\n self.fittest.fitness >= 1.0\n end", "def check_rule(rule)\n\n\t if rule.include? 'twitter_lang'\n\t\t rule = handle_lang_operators rule\n\t end\n\n\t if rule.include? 'has:lang'\n\t\t rule = handle_has_lang rule\n\t end\n\n\t if rule.include? '_contains:'\n\t\t rule = handle_contains_operators rule\n\t end\n\n\n\t if rule.include? 'country_code:'\n\t\t rule = handle_country_code_operators rule\n\t end\n\n\t rule\n\n end", "def repeated?\n @rule == :repeated\n end", "def returns_one?\n rule != :each\n end", "def validate_model\n raise CarValidationErrors.new(\"Invalid Model\") unless MAKES[make].include?(model)\n end", "def fullfills?(models, args = nil)\n if models.kind_of?(Roby::Task)\n args ||= models.meaningful_arguments\n models = models.model\n end\n if !model.fullfills?(models)\n return false\n end\n\n if args\n args.each do |key, name|\n if self.arguments[key] != name\n return false\n end\n end\n end\n\n\t true\n\tend", "def can_be_rejected?\n self.applied?\n end", "def extra_validations\n success\n end", "def rule_by_id; end", "def has_any_model_relationship?\n !model_relationship.eql?(NONE)\n end", "def test_necessary_existence_of_communication_subject\n test_necessary_existence_of_model_field(\"cannot be empty\", @communication, :communication_subject)\n end", "def failing_rules\n @failing_rules ||= rules.dup.failing\n end", "def check\n \n end", "def check\n \n end", "def valid?\n score.eql?(@issue.labels.sort.find { |l| grid.any? { |g| l.eql? g } })\n end", "def required?\n\t\t@required\n\tend", "def cop_rule?; end", "def validate\n needs :project unless skip_project_check?\n end", "def solved?\n unknown_count == 0\n end", "def matched_item_and_model\n return unless equipment_item\n return unless equipment_model\n return unless equipment_item.equipment_model != equipment_model\n errors.add(:base, equipment_item.name + ' must be of type '\\\n + equipment_model.name + \".\\n\")\n end", "def validate!\n true\n end", "def rules_by_name; end", "def rule\n @rule ||= resolve!\n end", "def rule\n @rule ||= resolve!\n end", "def validation_rules\n []\n end", "def specific?\n @requirement.specific?\n end", "def specific?\n @requirement.specific?\n end", "def valid?\n validate\n @model.errors.on(:preferences).blank?\n end", "def metric?\n unit and self.class.rules[unit][:metric] || false\n end", "def solvable?\n\t\tsteps > 0\n\tend", "def supports_check_constraints?\n false\n end", "def required?\n @required\n end", "def allotment_is_not_100\n if not allot_for_item.blank? and not allot_for_const.blank? and not allot_for_research.blank?\n errors.add(:base, I18n.t('activerecord.errors.models.houdd_user.attributes.allotment_is_not_100')) if (allot_for_item + allot_for_const + allot_for_research) != 100\n end\n end", "def fullfills?(models, args = nil)\n if models.kind_of?(Roby::Task)\n args ||= models.meaningful_arguments\n models = models.model\n end\n unless model.fullfills?(models)\n return false\n end\n\n args&.each do |key, name|\n if self.arguments[key] != name\n return false\n end\n end\n\n true\n end", "def valid?\r\n (forcing && item) || subject.usable?(item)\r\n end", "def required?\n @required\n end", "def limit_modeling?\n !self[:modeling].nil? && self[:modeling] == false\n end", "def validate\n show\n return\n\n # Check the variables:\n steps = []\n variables = all_variable.sort_by{|var| var.ordinal}\n variables.each_with_index do |variable, i|\n raise \"Variable #{i} should have ordinal #{variable.ordinal}\" unless variable.ordinal == i\n raise \"Variable #{i} has missing object_type\" unless variable.object_type\n variable.all_play do |play|\n raise \"Variable for #{object_type.name} includes role played by #{play.object_type.name}\" unless play.object_type == object_type\n end\n steps += variable.all_step\n end\n steps.uniq!\n\n # Check the steps:\n steps.each do |step|\n raise \"Step has missing fact type\" unless step.fact_type\n raise \"Step has missing input node\" unless step.input_play\n raise \"Step has missing output node\" unless step.output_play\n if (role = input_play).role.fact_type != fact_type or\n (role = output_play).role.fact_type != fact_type\n raise \"Step has role #{role.describe} which doesn't belong to the fact type '#{fact_type.default_reading}' it traverses\"\n end\n end\n\n # REVISIT: Do a connectivity check\n end", "def solvable?\n steps > 0\n end", "def validate!\n # pass\n end" ]
[ "0.66836125", "0.66733706", "0.6342038", "0.6323115", "0.6299487", "0.6210634", "0.6119436", "0.6092455", "0.6087931", "0.6087931", "0.6087931", "0.60011846", "0.59728104", "0.5846034", "0.58372587", "0.5814538", "0.5768985", "0.5768985", "0.5768985", "0.5768985", "0.5768985", "0.5768985", "0.5768985", "0.57613707", "0.5756055", "0.5730057", "0.5636486", "0.5631699", "0.5618754", "0.55911076", "0.5587456", "0.55826724", "0.5572803", "0.5568805", "0.5568805", "0.55608654", "0.5557926", "0.5555733", "0.5518724", "0.5518411", "0.55018955", "0.55008453", "0.55008453", "0.54823995", "0.547936", "0.54716504", "0.5463576", "0.54504293", "0.54471874", "0.54471874", "0.54471874", "0.54471874", "0.54471874", "0.54366225", "0.54354787", "0.5431808", "0.5424694", "0.5411682", "0.5401424", "0.5393585", "0.53830016", "0.5382854", "0.5376997", "0.53757775", "0.53673154", "0.53559524", "0.5344787", "0.5343169", "0.53431636", "0.53270894", "0.5319063", "0.5315132", "0.5312621", "0.5312621", "0.53107595", "0.53095174", "0.5306508", "0.52993125", "0.52977926", "0.52889913", "0.528682", "0.5279471", "0.5275965", "0.5275965", "0.5275851", "0.52691793", "0.52691793", "0.5258379", "0.5257986", "0.5253215", "0.524924", "0.5247992", "0.5245857", "0.52398306", "0.5235538", "0.5232692", "0.5231464", "0.52255803", "0.5221226", "0.52212" ]
0.5973222
12
The message used to describe the problem that has been found
def message "Test has 'When' as the final step." end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def error_msg\n name\n end", "def message\n msg = \"Format error found in %s tuple: %s\" % [@identifier, @invalid_data.inspect]\n return msg\n end", "def message\n message = \"Some of the request parameters are invalid:\" \n @messages.each { |param, identifiers| message << \"\\n * #{param}: #{identifiers.join(', ')}\" }\n message\n end", "def error_message\n error.message\n end", "def message\n message_hash || 'The item could not be found'.freeze\n end", "def error_message\n if nagios_mode?\n puts \"CRIT: #{invalid_metadata_files.size} metadata files and #{invalid_packages.size} packages with invalid checksums\"\n else\n invalid_metadata_files.each do |metadata|\n msg metadata.explain_error\n end\n invalid_packages.each do |pkg|\n msg pkg.explain_error\n end\n end\n end", "def failure_message\n @message\n end", "def error_message; end", "def message\n @error['message']\n end", "def error_message(e)\n fail e\n end", "def error_message\n \"JPT - #{setting_name} received an invalid argument: #{source}\"\n end", "def error_message\n @response.reason_phrase\n end", "def describe_error\n message = \"\"\n if self.account_number == nil\n message = message + I18n.t(:wrong_or_missing_account_number, :scope => [:model, :index]) + \" \"\n end\n if self.account_bank_number == nil\n message = message + I18n.t(:wrong_or_missing_account_bank_number, :scope => [:model, :index]) + \" \"\n end\n if self.student.uic == nil\n message = message + I18n.t(:missing_uic, :scope => [:model, :index]) + \" \"\n end\n if self.sident == -666\n message = message + I18n.t(:missing_sident_666, :scope => [:model, :index]) + \" \"\n end\n if self.sident == nil\n message = message + I18n.t(:missing_sident, :scope => [:model, :index]) + \" \"\n end\n return message\n\n end", "def translated_message\n lookups = []\n lookups << :\"activemodel.errors.template.message\"\n lookups << :\"activerecord.errors.template.message\"\n lookups << :\"case_form.errors.template.message\"\n lookups << \"There were problems with the following fields:\"\n I18n.t(lookups.shift, :default => lookups)\n end", "def message\n \"Telphin returned an error #{@error_code}: '#{@error_msg}'\"\n end", "def errmsg(message)\n error.print(\"*** #{message}\\n\")\n end", "def message\n errors.join(\"\\n\")\n end", "def error_message(ex) #:nodoc:\n msg = \"error: #{ex.message}\"\n case ex\n when UnknownCommand\n msg += \". Use '#{program_name} help' for a list of commands\"\n when UnknownCommandArgument\n msg += \". Use '#{program_name} help #{ex.command.name}' for a list of command options\"\n when UnknownGlobalArgument\n msg += \". Use '#{program_name} help' for a list of global options\"\n end\n msg\n end", "def message\n \"#{reason}: #{args.join(' ')}#{additional[@arg0] if additional}\"\n end", "def error_message\n return @error_message\n end", "def message\n \"#{super}:\\n#{errors_message}\"\n end", "def message\n configuration.default_message || @exception.message\n end", "def failure_message\n +\"expected to find #{description}\" << count_message\n end", "def error_message\n if error == 'on_reserve'\n 'another user has already reserved this item'\n elsif error == 'too_many'\n \"you cannot renew a loan more than 10 times\"\n elsif code == 'PatronNotFound'\n 'problem with user id - please contact an administrator for assistance'\n end\n end", "def failure_message\n actual = prettify_args(@actual)\n\n if @description\n \"'#{actual}' should #{@description}\"\n else\n \"'#{actual}' should satisfy the requirements\"\n end\n end", "def errmsg(message)\n print(\"*** #{message}\\n\")\n end", "def errmsg(message); end", "def get_message(key)\n msg = error_messages[key]\n return msg.nil? ? 'An unspecified error occurred.' : msg\n end", "def message\n format(ERRORS.fetch(type), **params)\n end", "def message\n format(ERRORS.fetch(type), **params)\n end", "def message\n @errormsg\n end", "def error_message\n err = details[\"err\"] || details[\"errmsg\"] || details[\"$err\"]\n if code = details[\"code\"]\n \"failed with error #{code}: #{err.inspect}\\n\\n\" <<\n \"See #{ERROR_REFERENCE}\\nfor details about this error.\"\n elsif code = details[\"assertionCode\"]\n assertion = details[\"assertion\"]\n \"failed with error #{code}: #{assertion.inspect}\\n\\n\" <<\n \"See #{ERROR_REFERENCE}\\nfor details about this error.\"\n else\n \"failed with error #{err.inspect}\"\n end\n end", "def message\n @props.fetch(:message, \"must be valid\")\n end", "def error_description\n end", "def gotcha_error\n t(:gotcha_validation_failed, :default => 'Failed to validate the Gotcha.') if @_gotcha_validated === false\n end", "def cause_message\n root_cause.best_message\n end", "def error_message\n self[:error_message]\n end", "def not_valid_message; nil; end", "def not_valid_message; nil; end", "def failure_message\n \"validation failed with #{@errors.inspect}, expected no validation errors\"\n end", "def failure_message; end", "def failure_message; end", "def failure_message; end", "def failure_message; end", "def failure_message; end", "def failure_message; end", "def failure_message; end", "def message\n @cause.nil? ? super : \"#{super} (cause: #{@cause.message})\"\n end", "def error_string\n # This method should be overridden\n end", "def message\n message = 'VKontakte returned an errors:'\n\n @errors.each_with_index do |error, index|\n message << \"\\n #{index+1}) Code #{error[:error_code]}: '#{error[:error_msg]}'\"\n message << \"\\n after calling method '#{error[:method]}'.\"\n end\n\n message\n end", "def failed_text\n 'Failed: %d' % failed\n end", "def title\n t = []\n t << (@exception.message.length > 120 ? @exception.message[0..120] + \"...\" : @exception.message)\n t.join(' ')\n end", "def message_for_display\n issue_url = nil\n if issue_key\n issue_url = Settings.rcm_jira_issue_url % issue_key\n end\n\n [error_cause, issue_url].reject(&:blank?).join(\"\\n\")\n end", "def error_message( msg, details='' )\n\t\t\t$stderr.puts colorize( 'bold', 'white', 'on_red' ) { msg } + details\n\t\tend", "def custom_error_message\n message = component.dig('errors', schema_key, 'any')\n\n message % error_message_hash if message.present?\n end", "def errmsg e\n m, c, b = e.message, e.class, (e.backtrace||[])\n \"#{ m } (#{ c })\\n#{ b }\"\n end", "def failed_message\n Online::OPERATION_FAILED_ADVICES[@data['error_code'].to_i || \"Errore sconosciuto (#{error_code})\"]\n end", "def error_message\n @data[\"message\"]\n end", "def message\n \"Test has too many steps. #{@linted_step_count} steps found (max #{@linted_step_threshold}).\"\n end", "def error_message\n if @errors\n @errors.map { |(k,v)|\n \"#{k} #{v.join(',')}\"\n }.join(\"; \")\n end\n end", "def error(msg)\n puts red(bold(\"[!] #{msg}\"))\n end", "def get_general_error_message\n find('#form-message-general').text\n end", "def failure_message\n @failures.map(&:failure_message).join(\" and \")\n end", "def verification_failed_message\n return \"Verification Failed\"\n end", "def miss_reason; end", "def message\n \"Step is too long. #{@linted_step_length} characters found (max #{step_length_threshold})\"\n end", "def inspect; message; end", "def failure_message\n \"expected #{@target.name} to provide #{@expected}, but it doesn't\"\n end", "def error_message(obj, name = \"\")\n if name.present? && obj.get_operation_result.code.zero?\n \"Could not find user '#{name}'\"\n else\n \"#{obj.get_operation_result.message} (code #{obj.get_operation_result.code})\"\n end\n end", "def error_message( msg, details='' )\n\t\t$stderr.puts colorize( 'bold', 'white', 'on_red' ) { msg } + ' ' + details\n\tend", "def error_message\n raise \"calculator is empty\"\n end", "def failure_message\n if found.nil?\n found_count = 'none'\n found_string = nil\n else\n materialized_found = found.to_a\n found_count = \"#{materialized_found.length}:\"\n found_string = materialized_found.map {|job| strategy.pretty_print_job(job) }.join(\"\\n\")\n end\n [\n \"expected #{expected_count || 'any number of'} jobs matching #{expected.to_s},\",\n \"found #{found_count}\",\n found_string,\n ].compact.join(' ')\n end", "def failure_message\n actual = prettify_args(@actual)\n matcher = prettify_matcher(@metadata[:name])\n\n if @metadata[:args].count > 0\n args = prettify_args(*@metadata[:args])\n\n \"'#{actual}' should #{matcher} '#{args}'\"\n else\n \"'#{actual}' should #{matcher}\"\n end\n end", "def message\n \"Scenario name is too long. #{@linted_test_name_length} characters found (max #{test_name_length_threshold})\"\n end", "def error\n params[\"ErrDesc\"]\n end", "def default_message\n \"Invalid Derelict instance\"\n end", "def obvious_error(message, e)\n \"#{stars}\\n#{message}\\n#{stars}\\n#{e.message}#{stars}\"\n end", "def message\n @options[:message] || \"failed validation\"\n end", "def message\n debug_info = [\n @instance.mapping.database_model,\n @instance.mapping.salesforce_model,\n @instance.id,\n ]\n\n \"[#{debug_info.join('|')}] #{base_exception.message}\"\n end", "def error_msg\n return nil if result\n\n bad_emails = email_addresses.reject { |email| regex.match(email) }\n\n \"#{bad_emails.count == 1 ? 'Email does' : 'Emails do'} not meet criteria: #{bad_emails.join(', ')}\"\n end", "def error_msg\n IBM_DB.getErrormsg(@conn, IBM_DB::DB_CONN)\n end", "def error_message\n # :nocov:\n options.fetch(:messages, :valid)\n # :nocov:\n end", "def error_messages; end", "def unexpected_error(format)\n msg = \"Hi #{@user.first_name},\"\n msg << \"\\n\\n\"\n msg << 'Something weird and unexpected happened when you tried posting to MindHub via an '\n msg << \"email. The site is automatically sending this email out to let you know, and it's \"\n msg << 'CCing the site Admins so they can look into what happened. In the meantime, '\n msg << \"take a look at the #{faq_link_for(format)} and make sure you follow the rules \"\n msg << 'for posting via email.'\n msg << \"\\n\\n\"\n msg << \"We're sorry this happened and if this is our fault, will try to fix this ASAP! \"\n msg << \"Here's what you tried posting:\"\n msg << \"\\n\"\n\n msg\n end", "def error_msg\n ERROR_MSG[upcase_class_sym]\n end", "def failure_message\n @message += \"Expected: #{@expected}\\n\\n\"\n @message += \"Actual: #{@actual}\\n\\n\"\n @message += \"Differences\\n\\n\"\n\n add_diff_to_message(@actual, @expected)\n\n @message\n end", "def error_message(message)\n Format(:red, bold_message(message))\n end", "def get_error_message(str)\n tmp=str.scan(/^ERROR MESSAGE --8<------\\n(.*?)ERROR MESSAGE ------>8--$/m)\n return \"Error message not available\" if !tmp[0]\n tmp[0][0].strip\n end", "def message\n MESSAGE\n end", "def message\n MESSAGE\n end", "def message\n MESSAGE\n end", "def message\n MESSAGE\n end", "def failure_message_for_should\n message = \"expected #{@collection_key} to match the user's mental model, but:\\n\"\n unless expected_items_found?\n message += \"expected to be present: #{pp_array(expected_items)}\\n\"\n message += \"the missing elements were: #{pp_array(expected_items_that_were_not_found)}\\n\"\n end\n if unexpected_items_found?\n message += \"expected to not be present: #{pp_array(unexpected_items)}\\n\"\n message += \"the unexpected extra elements: #{pp_array(unexpected_items_that_were_found)}\\n\"\n end\n message\n end", "def standard_error\n \"Oops! Either that search expired, or you're trying to go somewhere you don't belong. Either way, try a new search to find your dream getaway.\"\n end", "def subject\n 'Report a problem'.freeze\n end", "def message # :nodoc:\n @properties['errorMessage'].dup\n end", "def failure_message\n parts = []\n parts << %(\n Hi. Your friendly Curry bot here. Just letting you know that there are\n commit authors in this Pull Request who appear to not have signed a Chef\n CLA.\n ).squish\n\n unknown_commit_authors_with_email_count = @pull_request.unknown_commit_authors.with_known_email.count\n\n if unknown_commit_authors_with_email_count > 0\n parts << %{\n There are #{unknown_commit_authors_with_email_count} commit author(s)\n whose commits are authored by a non GitHub-verified email address in\n this Pull Request. Chef will have to verify by hand that they have\n signed a Chef CLA.\n }.squish\n end\n\n unknown_commit_authors_with_login = @pull_request.unknown_commit_authors.with_known_login\n\n if unknown_commit_authors_with_login.count > 0\n parts << 'The following GitHub users do not appear to have signed a CLA:'\n\n list = unknown_commit_authors_with_login.map do |commit_author|\n \"* @#{commit_author.login}\"\n end.join(\"\\n\")\n\n parts << list\n end\n\n parts << [\n '[Please sign the CLA here.]',\n \"(#{ENV['CURRY_CLA_LOCATION']})\"\n ].join\n\n parts.join(\"\\n\\n\")\n end", "def error_reason\n @request['error']['reason']\n end", "def item_message\n \"#{model_name.capitalize} with id #{id} not found\".freeze\n end", "def foorth_message\r\n \"#{self.foorth_code} #{self.message}\"\r\n end", "def message_for(key,options={})\n handwritten_message || I18n.translate(key, {:scope => 'activerecord.errors.messages'}.merge(options))\n end" ]
[ "0.72686905", "0.7262926", "0.7171339", "0.71390676", "0.71348447", "0.7084101", "0.70767105", "0.707142", "0.7028446", "0.7025792", "0.7013351", "0.7012839", "0.6992545", "0.69484556", "0.69111955", "0.6865585", "0.68640834", "0.6856111", "0.685106", "0.68445855", "0.68225855", "0.6803905", "0.6786324", "0.67721325", "0.6757044", "0.67391723", "0.6738493", "0.67179954", "0.6689762", "0.6689762", "0.6681991", "0.6672877", "0.6659973", "0.66473955", "0.6636033", "0.662633", "0.662122", "0.6604291", "0.6604291", "0.6596652", "0.6593221", "0.6593221", "0.6593221", "0.6593221", "0.6593221", "0.6593221", "0.6593221", "0.65873706", "0.65744156", "0.65563786", "0.6553025", "0.6543332", "0.65412825", "0.6537953", "0.65154594", "0.6513375", "0.6509167", "0.65034866", "0.64806324", "0.64488375", "0.6447262", "0.6445518", "0.64453757", "0.6445021", "0.6440821", "0.64391756", "0.6436376", "0.64325494", "0.64260644", "0.6423827", "0.6421567", "0.6414015", "0.6400566", "0.6397838", "0.6395591", "0.6391891", "0.63838106", "0.6383526", "0.63830584", "0.6382372", "0.63786244", "0.63771445", "0.6373754", "0.63673186", "0.63600945", "0.63583523", "0.63521206", "0.6350962", "0.63471425", "0.63471425", "0.63471425", "0.63471425", "0.6343124", "0.6331352", "0.63284606", "0.6320774", "0.63111097", "0.6300189", "0.62639916", "0.62580055", "0.62467116" ]
0.0
-1
NOTE: (cmhobbs) all_groups and unique_groups are used because the UserGroup object was repurposed and now requires UserGroups for a given User to be unique. This needs rearch. FIXME (cmhobbs) wrap all_groups and unique_groups in tests.
def all_groups groups + [organization] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_groups\n return @user_groups if @user_groups\n\n @user_groups = default_user_groups\n @user_groups |= current_user.groups if current_user and current_user.respond_to? :groups\n @user_groups |= ['registered'] if !current_user.new_record? && current_user.is_osu\n @user_groups\n end", "def user_groups\n return @user_groups if @user_groups\n\n @user_groups = default_user_groups\n # TODO: necessary to include #hyrax_group_names?\n @user_groups |= current_user.hyrax_group_names if current_user.respond_to? :hyrax_group_names\n @user_groups |= ['registered'] if !current_user.new_record? && current_user.roles.count.positive?\n # OVERRIDE: add the names of all user's roles to the array of user_groups\n @user_groups |= all_user_and_group_roles\n\n @user_groups\n end", "def user_groups\n return @user_groups if @user_groups\n @user_groups = default_user_groups\n @user_groups += RoleMapper.roles(@user)\n @user_groups\n end", "def related_groups_users\n [].tap do |related_users|\n all_groups.each do |group|\n related_users << group.all_users.reject { |group_user| group_user == self }\n end\n end.flatten.uniq\n end", "def get_all_groups\n grps = self.get_groups_recursively\n grps << self.home_group\n logged_in_group = Group.new(:name => \"logged in user\")\n logged_in_group.id = 0\n grps << logged_in_group\n anonymous_group = Group.new(:name => \"anonymous user\")\n anonymous_group.id = -1\n grps << anonymous_group\n return grps.compact.uniq\n end", "def groups\n Group.groups(user_name)\n end", "def users_and_groups=(value)\n @users_and_groups = value\n end", "def user_groups_assignable_for_user(usr)\n return [] if usr.nil?\n ug_table = Lockdown.user_groups_hbtm_reference.to_s\n if administrator?(usr)\n Lockdown.user_group_class.find_by_sql <<-SQL\n select #{ug_table}.* from #{ug_table} order by #{ug_table}.name\n SQL\n else\n usr_table = Lockdown.users_hbtm_reference.to_s\n if usr_table < ug_table\n join_table = \"#{usr_table}_#{ug_table}\"\n else\n join_table = \"#{ug_table}_#{usr_table}\"\n end\n Lockdown.user_group_class.find_by_sql <<-SQL\n select #{ug_table}.* from #{ug_table}, #{join_table}\n where #{ug_table}.id = #{join_table}.#{Lockdown.user_group_id_reference}\n and #{join_table}.#{Lockdown.user_id_reference} = #{usr.id}\t \n order by #{ug_table}.name\n SQL\n end\n end", "def user_groups(deprecated_user=nil, deprecated_session=nil)\n ActiveSupport::Deprecation.warn(\"No need to pass user or session to user_groups, use the instance_variables\", caller()) if deprecated_user || deprecated_session\n\n return @user_groups if @user_groups\n \n @user_groups = default_user_groups\n @user_groups |= current_user.groups if current_user and current_user.respond_to? :groups\n @user_groups |= ['registered'] unless current_user.new_record?\n @user_groups\n end", "def user_groups_assignable_for_user(usr)\n return [] if usr.nil?\n \n if administrator?(usr)\n UserGroup.find_by_sql <<-SQL\n select user_groups.* from user_groups order by user_groups.name\n SQL\n else\n UserGroup.find_by_sql <<-SQL\n select user_groups.* from user_groups, user_groups_users\n where user_groups.id = user_groups_users.user_group_id\n and user_groups_users.user_id = #{usr.id}\t \n order by user_groups.name\n SQL\n end\n end", "def clear_user_group_cache\n if groupable.is_a?(UserGroup)\n Rails.cache.delete \"UserGroup:is_in_group_#{groupable_id}_#{user_id}\"\n Rails.cache.delete \"UserGroup:is_admin_#{groupable_id}_#{user_id}\"\n end\n end", "def manage_groups\n @other_user = @login_user\n @groups = @login_user.groups\n end", "def get_user_groups\n user_groups.keys\n end", "def group_users\n DiscussionGroupUser.where(\"discussion_group_id=? AND is_member=?\", self.id, true)\n end", "def test_group\n \n user = @user_1\n group = 'customer-test'\n \n assert (not @crowd.group_member? user.name, group), \"#{user.name} is already a member of group #{group}\"\n\n @crowd.add_user_to_group user.name, group \n assert (@crowd.group_member? user.name, group) \n\n groups = @crowd.find_group_memberships user.name\n assert (groups.length > 0)\n assert (groups.include? group)\n\n @crowd.remove_user_from_group user.name, group \n assert (not @crowd.group_member? user.name, group)\n\n groups_after_remove = @crowd.find_group_memberships user.name\n\n # ensure the user in one less group \n assert_equal groups.length - 1, groups_after_remove.length\n \n end", "def groups\n @groups ||= {}\n end", "def groups\r\n @groups ||= fetch_groups\r\n end", "def safe_for_group(users, group)\n group_users = group.users\n selected_users = []\n\n if users\n # Have any users been checked?\n users.keys.each do |id|\n user = User.find_by_id(id)\n selected_users << user if group_users.include?(user)\n end\n else\n # Otherwise just use the whole group\n selected_users = group_users - [current_user]\n end\n\n selected_users\n end", "def groups\n @groups ||= Groups.call(self)\n end", "def nonmembered_groups(user)\n (LogicalAuthz::group_model.all - user.groups).map { |g| [ g.name, g.id ] }\n end", "def groups\n original_groups | mapped_groups | mapped_ldap_groups\n end", "def groups\n UserGroups.new(:id => id).get.items\n end", "def available_groups\n @available_groups ||= begin\n current_user.groups\n .sort_by { |g| g.description.downcase }\n .map { |g| { id: g.id, description: g.description, user_permissions: g.user_permissions(current_user.login) } }\n # :nocov:\n rescue StandardError\n []\n end\n # :nocov:\n end", "def all_users\n self.users +\n User.where(institution: self.institution).\n select{ |u| u.belongs_to_user_group?(self) }\n end", "def initialize(user, group)\n if user.admin_in_group?(group) \n can [:read, :update], Group, :id => group.id\n can :invite_to, Group, :id => group.id\n can :accept_member, GameUserGroup, :group_id => group.id\n can :create_collection, Group, :id => group.id\n can :join, Group do |group|\n user.game_user_groups.where(:group_id => group.id).nil?\n end\n elsif user.owner_in_group?(group)\n can :manage, Group\n can :invite_to, Group, :id => group.id\n can :accept_member, GameUserGroup, :group_id => group.id\n can :create_collection, Group, :id => group.id\n can :join, Group do |group|\n user.game_user_groups.where(:group_id => group.id).nil?\n end\n else\n can :read, Group do |group|\n gug_state = user.game_user_groups.where(:group_id => group.id).first.state\n if gug_state == 'accepted'\n true\n else\n false\n end\n end\n \n can :join, Group do |group|\n user.game_user_groups.where(:group_id => group.id).nil?\n end\n end\n end", "def group_users(table)\n @group_users ||= {}\n @group_users[table] ||= User.where(id: group_user_ids(table)).to_a\n end", "def group(user_id, group_id)\n is_initialized_and_enabled do\n group = Itly::Group.new(\n\n )\n validate_schema(group)\n @adapters.each { |adapter| adapter.group(user_id, group_id, group.properties) }\n end\n end", "def replace_old_with_new_in_groups\n old_user.groups.each do |group|\n # Add new user to group if needed\n if !group.member?(new_user) && !group.banned?(new_user)\n group.redis.multi do\n group.member_ids << new_user.id\n new_user.group_ids << group.id\n new_user.group_join_times[group.id] = Time.current.to_i\n end\n\n # Make new user an admin if needed\n group.admin_ids << new_user.id if group.admin?(old_user)\n end\n\n # Remove old user from group and admin if needed\n group.redis.multi do\n group.admin_ids.delete(old_user.id)\n group.member_ids.delete(old_user.id)\n old_user.group_ids.delete(group.id)\n end\n\n # Publish group once after all changes\n faye_publisher.publish_to_group(group, PublishGroupSerializer.new(group).as_json)\n\n group_data = GroupSerializer.new(group).as_json\n faye_publisher.publish_group_to_user(new_user, group_data)\n faye_publisher.publish_group_to_user(old_user, group_data)\n end\n end", "def groups\n # self[:memberof].map { |dn| Group.select_dn(dn) }\n self[:memberof].map { |dn| self.class.group_klass.select_dn(dn) }\n end", "def ldap_groups\n User.walk_ldap_groups(User.ldap_member_of(user_key), []).sort\n end", "def users_and_groups\n return @users_and_groups\n end", "def set_groups(user, grouplist)\n\t\t\tend", "def safe_select_groups\n return unless user_signed_in?\n @groups = current_user.groups\n end", "def add_user_to_group(user, group)\n\t\t\tend", "def user_groups_operation(user, groups, operation)\n params = {\n :first => user['first'],\n :last => user['last'],\n :username => user['username'],\n :uid => user['uid']\n }\n \n groups.each do |group|\n params[:groupname] = group\n group_op = JSON.parse(\n @config[:templates][:group].result(binding),\n :symbolize_names => true\n )\n \n group_op[:ops].each do |op|\n op[0] = operation\n op[1] = op[1].to_sym\n end\n \n ret = modify({:name => \"localuser\", :ip => \"127.0.0.1\"}, group_op[:dn], group_op[:ops])\n end\n end", "def groups\n return @groups if @groups\n return [] if uid.nil?\n\n codes = [\"student\"]\n res = Group.where(code: codes)\n # add eduPersonAffiliation (e.g. student, faculty, staff) to groups that the user is a member of\n @groups = res + affiliations.map{ |code| Group.new(:code=>code) }\n end", "def current_user_group_ids\n @current_user_group_ids ||= Manage::Group.group_ids_for current_user\n end", "def group_ids\n @group_ids ||= current_user.group_ids\n end", "def groups\n @@groups = Group.groups if @@groups.nil? or @@groups.empty?\n @@groups\n end", "def hydra_default_permissions(deprecated_user=nil, deprecated_session=nil)\n ActiveSupport::Deprecation.warn(\"No need to pass user or session to hydra_default_permissions, use the instance_variables\", caller()) if deprecated_user || deprecated_session\n logger.debug(\"Usergroups are \" + user_groups.inspect)\n self.ability_logic.each do |method|\n send(method)\n end\n end", "def update_groups\n unless group_ids.nil?\n self.groups_members.each do |m|\n m.destroy unless group_ids.include?(m.group_id.to_s)\n group_ids.delete(m.group_id.to_s)\n end\n group_ids.each do |g|\n self.groups_members.create(:group_id => g) unless g.blank?\n end\n reload\n self.group_ids = nil\n end\n end", "def groups\n @groups = init_groups\n end", "def load_possible_groups\n if can? :manage, :all\n @possible_groups = Group.order(:name)\n else\n @possible_groups = @current_user.admin_groups\n end\n @groups_with_product_group_portfolios = Group.where(\"groups.id IN (?)\", @possible_groups.pluck(:id) ).includes(:product_group_portfolios => :product).where(:product_group_portfolios => {:portfolio_id => @portfolio.id}).order(\"groups.name\", \"products.name\").uniq\n end", "def get_changeable_groups\n response = get_current_user_meta('changeablegroups')\n return false unless response\n\n changeablegroups = response['query']['userinfo']['changeablegroups']\n {\n :add => changeablegroups['add'],\n :remove => changeablegroups['remove'],\n :addself => changeablegroups['add-self'],\n :removeself => changeablegroups['add-self']\n }\n end", "def group\n strong_memoize(:group) do\n if params[:group_id].present? && valid_request?\n the_group = Group.find_by(id: params[:group_id])\n can?(current_user, :read_group, the_group) ? the_group : nil\n end\n end\n end", "def associate_in_groups(user, org, groups)\n associate_user_with_org(org.name, user)\n groups.each do |group|\n add_user_to_group(org.name, user, group)\n end\n end", "def manage_group\n if new_resource.append\n members_to_be_added = [ ]\n if new_resource.excluded_members && !new_resource.excluded_members.empty?\n # First find out if any member needs to be removed\n members_to_be_removed = [ ]\n new_resource.excluded_members.each do |member|\n members_to_be_removed << member if current_resource.members.include?(member)\n end\n\n unless members_to_be_removed.empty?\n # We are using a magic trick to remove the groups.\n reset_group_membership\n\n # Capture the members we need to add in\n # members_to_be_added to be added later on.\n current_resource.members.each do |member|\n members_to_be_added << member unless members_to_be_removed.include?(member)\n end\n end\n end\n\n if new_resource.members && !new_resource.members.empty?\n new_resource.members.each do |member|\n members_to_be_added << member unless current_resource.members.include?(member)\n end\n end\n\n logger.debug(\"#{new_resource} not changing group members, the group has no members to add\") if members_to_be_added.empty?\n\n add_group_members(members_to_be_added)\n else\n # We are resetting the members of a group so use the same trick\n reset_group_membership\n logger.debug(\"#{new_resource} setting group members to: none\") if new_resource.members.empty?\n add_group_members(new_resource.members)\n end\n end", "def owned_groups\n @owned_groups = Group.where(\"owner_id = ?\", current_user)\n end", "def user_groups(user)\n record = find_user(user)\n return [] if record&.size != 1\n\n dn = record.first.dn\n groups_from(dn, \"uniqueMember\") | groups_from(dn, \"member\")\n rescue ::Net::LDAP::Error => e\n Rails.logger.tagged(:ldap) { Rails.logger.warn \"Connection error: #{e.message}\" }\n []\n end", "def collect_groups\n @groups.inject(name => self) do |acc, g|\n acc.merge(g.collect_groups)\n end\n end", "def add_user_to_group(default_group)\n if default_group.present?\n default_group.split(',').each do |group_name|\n if group = Group.named(group_name).first\n group.users << @user\n elsif logger\n logger.warn \"MailHandler: could not add user to [#{group_name}], group not found\"\n end\n end\n end\n end", "def owned_groups\n codes = Hydra::LDAP.groups_owned_by_user(uid)\n #puts \"codes: #{codes}\"\n Group.find_all_by_code(codes)\n end", "def update_groups(desc, type, groups)\n for id, val in groups\n if group = UserGroup.safe_find(id)\n update_group(desc, type, group, (val == '1'))\n else\n flash_error(:runtime_description_user_not_found.t(:name => id))\n end\n end\n end", "def groups\n find_groups if @groups.nil?\n @groups\n end", "def remove_user_from_group(user, group)\n\t\t\tend", "def create\n @group = Group.new(params[:group])\n\n #here we add the current user to the membership collection of the group\n @membership = @group.memberships.build(params[:membership])\n @membership.group = @group\n @membership.user = current_user\n @membership.initiator = false\n @membership.membership_status_id = 2\n \n #and here we set the current_user as the owner of the group\n @group_permission = @group.group_permissions.build(params[:group_permission])\n @group_permission.membership = @membership\n @group_permission.group_role = GroupRole.find_by_name('Owner')\n \n @group.metro_area = MetroArea.find(params[:metro_area_id])\n @group.state = (@group.metro_area && @group.metro_area.state) ? @group.metro_area.state : nil\n @group.country = @group.metro_area.country if (@group.metro_area && @group.metro_area.country)\n\n \n #current_user.track_activity(:created_a_group)\n \n# unless @user.is_in_group?(@group)\n# @user.memberships << @group\n# end\n\n respond_to do |format|\n if @group.save\n flash[:notice] = 'Group was successfully created.'\n format.html { redirect_to(@group) }\n format.xml { render :xml => @group, :status => :created, :location => @group }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n \n end", "def new\n @user_group = UserGroup.new\n @permissions = {}\n @group_permissions = Permission.get_group_permissions\n @group_permissions.each do |g|\n @permissions[g.group_permission_name] = Permission.get_permission_in_group_permission(g.group_permission_name)\n end\n end", "def get_groups()\n return self.groups\n end", "def visible_groups\n @visible_groups ||= begin\n filter_visible_groups_for_user(self.current_groups)\n end\n end", "def find_groups\n @groups ||= Group.find(:all)\n end", "def get_all_groups\n grps = []\n grps += self.groups\n grps.each { |g| grps += g.get_all_groups }\n return grps.compact.uniq\n end", "def new\n @user = User.new\n @user_groups = UserGroup.get_all_user_groups_in_org(params[:organization_id])\n end", "def new\n @user = User.new\n @user_groups = UserGroup.get_all_user_groups_in_org(params[:organization_id])\n end", "def new\n @user = User.new\n @user_groups = UserGroup.get_all_user_groups_in_org(params[:organization_id])\n end", "def has_groups(options={})\n return if has_groups?\n \n class_eval {\n include GroupedModel::GroupedInstanceMethods\n\n def self.has_groups?\n true\n end\n \n def self.visible\n ungrouped\n end\n }\n \n has_many :permissions, :as => :permitted\n accepts_nested_attributes_for :permissions\n has_many :groups, :through => :permissions\n Group.define_retrieval_methods(self.to_s)\n\n named_scope :visible_to, lambda { |reader| \n conditions = \"pp.group_id IS NULL\"\n if reader && reader.is_grouped?\n ids = reader.group_ids\n conditions = [\"#{conditions} OR pp.group_id IS NULL OR pp.group_id IN(#{ids.map{\"?\"}.join(',')})\", *ids]\n end\n {\n :joins => \"LEFT OUTER JOIN permissions as pp on pp.permitted_id = #{self.table_name}.id AND pp.permitted_type = '#{self.to_s}'\",\n :group => column_names.map { |n| self.table_name + '.' + n }.join(','),\n :conditions => conditions,\n :readonly => false\n } \n }\n\n named_scope :ungrouped, lambda {\n {\n :select => \"#{self.table_name}.*, count(pp.id) as group_count\",\n :joins => \"LEFT OUTER JOIN permissions as pp on pp.permitted_id = #{self.table_name}.id AND pp.permitted_type = '#{self.to_s}'\", \n :having => \"group_count = 0\",\n :group => column_names.map { |n| self.table_name + '.' + n }.join(','), # postgres requires that we group by all selected (but not aggregated) columns\n :readonly => false\n }\n } do\n def count\n length\n end\n end\n\n named_scope :grouped, lambda {\n {\n :select => \"#{self.table_name}.*, count(pp.id) as group_count\",\n :joins => \"LEFT OUTER JOIN permissions as pp on pp.permitted_id = #{self.table_name}.id AND pp.permitted_type = '#{self.to_s}'\", \n :having => \"group_count > 0\",\n :group => column_names.map { |n| self.table_name + '.' + n }.join(','),\n :readonly => false\n }\n } do\n def count\n length\n end\n end\n \n named_scope :belonging_to, lambda { |group|\n {\n :joins => \"INNER JOIN permissions as pp on pp.permitted_id = #{self.table_name}.id AND pp.permitted_type = '#{self.to_s}'\", \n :group => column_names.map { |n| self.table_name + '.' + n }.join(','),\n :conditions => [\"pp.group_id = ?\", group.id],\n :readonly => false\n }\n }\n \n named_scope :find_these, lambda { |ids|\n ids = ['NULL'] unless ids && ids.any?\n { :conditions => [\"#{self.table_name}.id IN (#{ids.map{\"?\"}.join(',')})\", *ids] }\n }\n \n end", "def users\n users = []\n members.each do |member|\n if member.is_a? User\n users << member\n elsif member.is_a? UserGroup\n users + member.users\n else\n raise UserGroupException, \"While retrieving users from a user group (#{self}), found a member that was not a User or UserGroup record!\"\n end\n end\n users.uniq(&:id)\n end", "def recursive_members()\n return @users if @users.present?\n\n # False is the users, true groups\n grouped = member(true).group_by{|g| LdapGroup.dn_is_group? g}\n @users = grouped[false] || []\n groups = grouped[true] || []\n\n cached_groups = {}\n\n groups.each do |g_dn|\n key = dn.rdns.first.values.first\n\n group = cached_groups[key] || LdapGroup.find(g_dn)\n cached_groups[key] = group\n\n group_users = group.member.group_by{ |g| LdapGroup.dn_is_group? g }[false]\n @users.push(*group_users)\n end\n @users\n end", "def create\n group_ids = params[\"user_groups\"]\n org_id = params[:organization_id]\n @user = User.new(params[:user])\n @user.user_group_ids = group_ids\n @user.organization_id = org_id\n\n if @user.save\n redirect_to organization_users_path(org_id)\n else\n flash[:error] = t('users.new.exist')\n @user_groups = UserGroup.all\n render :new\n end\n end", "def create\n group_ids = params[\"user_groups\"]\n org_id = params[:organization_id]\n @user = User.new(params[:user])\n @user.user_group_ids = group_ids\n @user.organization_id = org_id\n\n if @user.save\n redirect_to organization_users_path(org_id)\n else\n flash[:error] = t('users.new.exist')\n @user_groups = UserGroup.all\n render :new\n end\n end", "def can_be_created_by?(user)\n \n not (user.usergroups & usergroups).empty?\n\n end", "def index\n @member_groups = @user.groups_where_member\n @admin_groups = @user.groups_where_admin\n end", "def save_group(user)\n ActiveRecord::Base.transaction do\n save\n @user_group = UserGroup.new\n @user_group.user_id = user.id\n @user_group.group_id = id\n @user_group.save\n @member = GroupMember.new\n @member.e_mail = user.email\n @member.group_id = id\n @member.save\n end\n end", "def get_grouphistory(users)\n known_group_sids = {\n 'S-1-5-113' => 'Local Account',\n 'S-1-5-114' => 'Local Administrator',\n 'S-1-1-0' => 'Everyone',\n 'S-1-5-32-545' => 'Builtin Group',\n 'S-1-5-32-544' => 'Builtin Administrator',\n 'S-1-5-4' => 'Interactive Logon',\n 'S-1-2-0' => 'Local Logon',\n 'S-1-2-1' => 'Console Logon',\n 'S-1-5-11' => 'Authenticated User',\n 'S-1-5-15' => 'This Organization',\n 'S-1-5-13' => 'Terminal Service Logon',\n 'S-1-5-6' => 'Service Logon',\n 'S-1-5-2' => 'Network Logon',\n 'S-1-18-5' => 'Multi Factor Authentication',\n 'S-1-5-32-578' => 'Hyper-V Admins',\n 'S-1-5-9' => 'Domain Controller',\n 'S-1-5-14' => 'Remote Interactive Logon',\n 'S-1-5-17' => 'IUSR',\n 'S-1-5-18' => 'Local System',\n 'S-1-5-19' => 'Local Service',\n 'S-1-5-20' => 'Network Service',\n 'S-1-5-32-546' => 'BuiltIn Guests',\n 'S-1-5-32-547' => 'BuiltIn PowerUser',\n 'S-1-5-32-548' => 'Account Operators',\n 'S-1-5-32-549' => 'Server Operators',\n 'S-1-5-32-550' => 'Printer Operators',\n 'S-1-5-32-551' => 'Backup Operators',\n 'S-1-5-32-555' => 'Remote Desktop',\n 'S-1-16-12288' => 'High Integrity Level',\n 'S-1-18-1' => 'Asserted Identiry',\n 'S-1-5-64-10' => 'NTLM Authentication',\n 'S-1-16-8192' => 'Medium Integrity'\n }\n\n dom_known_rids = {\n '498' => 'Domain Controllers',\n '500' => 'Machine Administrator',\n '501' => 'Machine Guest',\n '502' => 'KRBGT',\n '512' => 'Domain Admins',\n '513' => 'Domain Users',\n '514' => 'Domain Guests',\n '515' => 'Domain Computer',\n '516' => 'Domain Controller',\n '517' => 'Cert Publisher',\n '518' => 'Schema Administrator',\n '519' => 'Enterprise Administrators',\n '520' => 'GPO Creator/Owner',\n '521' => 'RODC',\n '522' => 'Clonable Controllers',\n '525' => 'Protected Users',\n '526' => 'Key Admins',\n '527' => 'Enterprise Key Admins',\n '553' => 'RAS Server',\n '571' => 'RODC Password Replicator',\n '572' => 'Denied RODC Password Replicator'\n\n }\n reg_key = 'HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Group Policy'\n group_history = []\n users.each do |u|\n results_table = Rex::Text::Table.new(\n 'Header' => 'Groups',\n 'Indent' => 1,\n 'SortIndex' => 0,\n 'Columns' => ['Name', 'SID']\n )\n print_status(\"Group Membership for #{u[:account]}\")\n groupmembership_key = \"#{reg_key}\\\\#{u[:sid]}\\\\GroupMembership\"\n key_vals = registry_enumvals(groupmembership_key)\n key_vals.each do |g|\n if g =~/Group\\d+/\n group_sid = registry_getvaldata(groupmembership_key, g)\n if group_sid =~ /^S-\\d-\\d+-(\\d+-){3,14}\\d+$/\n rid = (group_sid.split(\"-\"))[-1]\n if dom_known_rids.key?(rid)\n results_table << [dom_known_rids[\"#{rid}\"], group_sid]\n else\n results_table << [dom_known_rids[\"#{rid}\"], group_sid]\n end\n else\n if known_group_sids.key?(group_sid)\n results_table << [known_group_sids[\"#{group_sid}\"], group_sid]\n else\n results_table << [known_group_sids[\"#{group_sid}\"], group_sid]\n end\n end\n end\n end\n results_table.to_s.each_line do |l|\n if l =~ /admin|operator|owner/i\n print_line(\"%red#{l.chomp}%clr\")\n elsif l =~ /term|network|service/i\n print_line(\"%yel#{l.chomp}%clr\")\n else\n print_line(l.chomp)\n end\n end\n print_line\n report_note(\n :host => session.session_host,\n :type => 'host.info.user_groups',\n :data => {\n :user => u[:account],\n :data => results_table.to_csv} ,\n :update => :unique_data)\n end\n end", "def creator_in_group?\n return unless errors.blank?\n if !group.users.include?(user)\n errors.add(:user, user.username + \" isn't in the group\")\n end\n end", "def private_groups\n Group.find_private self.id\n end", "def possible_uni_modules_for_new_group(calling_user = current_user)\r\n if (calling_user.department_admin?)\r\n calling_user.department.uni_modules\r\n else\r\n UniModule.all\r\n end\r\n end", "def groups\n Vedeu::Groups.registered\n end", "def save\n \n transaction do |transaction|\n check_usergroups! if self.usergroups and (not self.usergroups.empty?)\n super\n update_aspects\n transaction.commit\n end\n\n end", "def user_group(name, *permissions)\n return if permissions.empty?\n name = name.to_s\n ug = Lockdown::Configuration.find_or_create_user_group(name)\n\n permissions.each do |name|\n if (perm = Lockdown::Configuration.permission(name))\n ug.permissions << perm unless ug.permissions.include?(perm)\n end\n end\n\n Lockdown::Configuration.maybe_add_user_group(ug)\n end", "def groups\n\t\t\t@groups.clone\n\t\tend", "def user_group(user)\n Etc.getpwnam(user).gid\n rescue ArgumentError\n Chef::Log.warn(\n \"ssh_authorize_key: User #{user} not found at compile time, perhaps \"\\\n \"you should specify a default group. I will use #{user} for now.\"\n )\n user\n end", "def groups_where_member\n self.groups-self.groups_where_admin_and_wrapper\n end", "def groups\n unless @groups\n @groups = convert_to_objects(cn_groups)\n end\n @groups\n end", "def remove_member(RegisteredUser r)\n r.destroy\n unless members.include? (r)\n return false\n else\n members.delete(r)\n return true\n end\n\n # POST /groups\n # POST /groups.json\n def create\n @group = Group.new(group_params)\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render action: 'show', status: :created, location: @group }\n else\n format.html { render action: 'new' }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end\n\n # PATCH/PUT /groups/1\n # PATCH/PUT /groups/1.json\n def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end\n\n # DELETE /groups/1\n # DELETE /groups/1.json\n def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end\n\n # This is a function that allows a group member to create a status in a group\n # Returns nothing\n # Time complexity: O(1)\n # Author: Mohamed Bahgat Elrakaiby\n def create_status(Status status)\n Status.create(group_id: @group_id, status: status)\n end\n\n # This is a function that views members of the group\n # Returns nothing\n # Time Complexity: O(n).\n # Author: Mohamed Bahgat Elrakaiby\n def view_members()\n a = []\n GroupMember.all.each {|r|\n if r.group_id == @group.id\n a.push(r.username)\n end\n }\n puts a\n end\n\n private\n # Use callbacks to share common setup or constraints between actions.\n def set_group\n @group = Group.find(params[:id])\n end\n\n # Never trust parameters from the scary internet, only allow the white list through.\n def group_params\n params[:group]\n end\n\n # End of autogenerated methods\n \n # start of my methods\n # This is a function that adds a member to the group by his name.\n # Time complexity: O(1).\n # Authors: Mohammed T. Nabih.\n def add_member_name(name)\n\n end\n\n # This is a function that adds a member to the group by his email.\n # Doesn't return anything.\n # Time complexity: O(n).\n # Authors: Mohammed T. Nabih.\n def add_member_email(email)\n\n end\n\n # This is a function that adds a member to the group by his phone number.\n # Doesn't return anything.\n # Time complexity: O(n).\n # Authors: Mohammed T. Nabih.\n def add_member_phone(phone)\n\n end\n\n # This is a function that allows members in the group to accept the join requests from other users.\n # Doesn't return anything.\n # Time complexity: O(1).\n # Authors: Mohammed T. Nabih.\n def accept_invitation\n \n end\n \n # This is a function that allows the user to send request to a group.\n # Doesn't return anything.\n # Time complexity: O(1).\n #Authors: Mohammed T. Nabih.\n def join_request\n \n end\n\n # Use callbacks to share common setup or constraints between actions.\n def set_group\n @group = Group.find(params[:id])\n end\n\n # Never trust parameters from the scary internet, only allow the white list through.\n def group_params\n params[:group]\n end\n \nend", "def set_my_groups(moduleName)\r\n @user = Authentify::User.find(session[:user_id])\r\n up = session[:user_privilege]\r\n groups = up.find_user_module_groups(moduleName)\r\n session[:mygroups] = groups\r\n return groups\r\n end", "def groups\r\n save_default_group(params)\r\n delete_group(params)\r\n end", "def test_create_and_mange_user_groups\n # set group name\n group_name = \"test-group-#{@random_test_seed}\"\n puts 'creating group...'\n group = @fire_cloud_client.create_user_group(group_name)\n assert group.present?, 'Did not create user group'\n\n puts 'adding user to group...'\n user_role = FireCloudClient::USER_GROUP_ROLES.sample\n user_added = @fire_cloud_client.add_user_to_group(group_name, user_role, @test_email)\n assert user_added, 'Did not add user to group'\n\n puts 'getting user groups...'\n groups = @fire_cloud_client.get_user_groups\n assert groups.any?, 'Did not find any user groups'\n\n puts 'getting user group...'\n group = @fire_cloud_client.get_user_group(group_name)\n assert group.present?, \"Did not retrieve user group: #{group_name}\"\n email_key = user_role == 'admin' ? 'adminsEmails' : 'membersEmails'\n assert group[email_key].include?(@test_email), \"Test group did not have #{@test_email} as member of #{email_key}: #{group[email_key]}\"\n\n puts 'delete user from group...'\n delete_user = @fire_cloud_client.delete_user_from_group(group_name, user_role, @test_email)\n assert delete_user, 'Did not delete user from group'\n\n puts 'confirming user delete...'\n updated_group = @fire_cloud_client.get_user_group(group_name)\n assert !updated_group[email_key].include?(@test_email), \"Test group did still has #{@test_email} as member of #{email_key}: #{updated_group[email_key]}\"\n\n puts 'deleting user group...'\n delete_group = @fire_cloud_client.delete_user_group(group_name)\n assert delete_group, 'Did not delete user group'\n\n puts 'confirming user group delete...'\n updated_groups = @fire_cloud_client.get_user_groups\n group_names = updated_groups.map {|g| g['groupName']}\n assert !group_names.include?(group_name), \"Test group '#{group_name}' was not deleted: #{group_names.join(', ')}\"\n end", "def add_x_users(num, *args)\n\n puts \"Adding #{num} users, params=#{args.inspect}\"\n\n org = Org.find(:first)\n\n name = \"Test User\"\n login_name = \"testuser\"\n password = \"password\"\n phone = \"+123456789\"\n validated = true\n group_name = nil\n\n if args.length==1\n params = args[0]\n name = params[:name] if params[:name]\n login_name = params[:username] if params[:username]\n password = params[:password] if params[:password]\n phone = params[:phone] if params[:phone]\n validated = params[:validated] if params[:validated]\n group_name = params[:group]\n end\n\n if group_name and Group.find_by_name(:first,group_name)\n raise \"The group #{group_name} already exists!\"\n end\n \n # find the first unique test user name\n next_avail_user_num = 0\n found = true\n while found do\n next_avail_user_num = next_avail_user_num + 1\n found = User.find_by_login_name(login_name+next_avail_user_num.to_s) != nil \n print \".\"\n end\n\n puts \"found next #{login_name} #{next_avail_user_num}\"\n\n users = []\n num.times do |i|\n u = User.new\n u.org = org\n u.name = name + (next_avail_user_num+i).to_s\n u.login_name = login_name + (next_avail_user_num+i).to_s\n u.password = password\n u.phone = phone\n u.save!\n u.force_sms_validation!(validated)\n users << u\n puts \"Added user #{u.inspect}\"\n end\n\n if group_name\n # now create the group_name from this\n group = Group.new\n group.org = org\n group.name = group_name\n group.save!\n puts \"Added group #{group.inspect}\"\n users.each do |u|\n u.groups << group\n end\n puts \"Added all users to groups\"\n end\n\n users\nend", "def load_users\n @users_not_in_group = User.active.not_in_group(@project_group).limit(100)\n end", "def index_global\n authorize UserGroup\n @user_groups = UserGroup.where(institution: nil).order(:name)\n end", "def belongs_to_group\n if current_sys_user # session has been started \n if current_sys_user.hr_employee_id #only check groups for employee users, not inspectors\n # checks if employee user belongs to any group\n if !SysUserXGroup.find_by(sys_user_id: (SysUser.find_by(username: current_sys_user.username)))\n sign_out current_sys_user\n flash[:alert] = 'Usuário não pertence a nenhum grupo' \n redirect_to :action => 'new', :controller => 'devise/sessions' # Redirect to sign in page\n end\n end\n end\n end", "def test_userlist(groups)\n\t\tUser.joins(:groups).includes(:groups).merge(groups).explain #map {|user| user.name}.to_s.html_safe\n\t\t# User.joins(:groups).merge(groups).map {|user| \"<tr><td>#{user.name}</td><td>#{user.groups.map {|group| group.name}.to_s.html_safe}</td></tr>\"}.uniq.join.html_safe\n\tend", "def set_user_group\n @user_group = UserGroup.find(params[:id])\n end", "def group_owner\n User.find_by(id: self.user_id)\n end", "def groups\n @groups ||= questions.map{|question|question.meta_attribute_entity_group}.uniq\n end", "def create\n\t\t@group = current_user.groups.create(group_params)\n\t\tif params[:users].present?\n\t\t\tparams[:users].each do |user_id|\n\t\t\t\t@group.user_groups.create(user_id: user_id)\n\t\t\tend\n\t\tend\n\t\tredirect_to :groups, notice: 'Group created successfully'\n\tend", "def get_groups\n\t\tgroup0 = course_groups.find_all_by_group(0).collect(&:user_id)\n\t\tgroup1 = course_groups.find_all_by_group(1).collect(&:user_id)\n\t\t[group0,group1]\n\tend", "def set_user_group\n @user_group = UserGroup.find(params[:id])\n end", "def set_user_group\n @user_group = UserGroup.find(params[:id])\n end", "def permissions_for_user_group(ug)\n sym = Lockdown.get_symbol(ug)\n perm_array = [] \n\n if has_user_group?(sym)\n permissions = user_groups[sym] || []\n else\n if ug.respond_to?(:permissions)\n permissions = ug.permissions\n else\n raise GroupUndefinedError, \"#{ug} not found in init.rb and does not respond to #permissions\"\n end\n end\n\n\n permissions.each do |perm|\n perm_sym = Lockdown.get_symbol(perm)\n\n unless permission_exists?(perm_sym)\n msg = \"Permission associated to User Group is invalid: #{perm}\"\n raise SecurityError, msg\n end\n\n perm_array << perm_sym\n end\n\n perm_array \n end" ]
[ "0.7268439", "0.7154243", "0.7076522", "0.66934717", "0.66569066", "0.66560596", "0.65319574", "0.6493767", "0.64746463", "0.6398485", "0.63856745", "0.6358953", "0.63484156", "0.62237376", "0.62062955", "0.61791676", "0.6172178", "0.6156638", "0.6155247", "0.61112285", "0.6100835", "0.60820186", "0.6074004", "0.6066405", "0.6027329", "0.6022593", "0.60132915", "0.5990949", "0.5983317", "0.5965904", "0.59567994", "0.5951369", "0.594464", "0.5937394", "0.59238833", "0.5919987", "0.5909837", "0.58798635", "0.58497405", "0.5838425", "0.5834596", "0.5833122", "0.58219945", "0.58109605", "0.58062994", "0.5771379", "0.5770116", "0.5764223", "0.57631755", "0.5730136", "0.5714969", "0.571429", "0.5711589", "0.5709873", "0.5709358", "0.5701843", "0.5701652", "0.5701113", "0.5697989", "0.5691976", "0.56874555", "0.5683587", "0.5683587", "0.5683587", "0.5678229", "0.5673273", "0.5657066", "0.56347007", "0.56347007", "0.5628178", "0.5611556", "0.56081426", "0.56014174", "0.56000644", "0.55956566", "0.55915076", "0.557682", "0.5563263", "0.5557447", "0.55567425", "0.5542467", "0.5538789", "0.552799", "0.5523543", "0.5522987", "0.5520699", "0.5516872", "0.5516248", "0.55125195", "0.550271", "0.55004466", "0.54978865", "0.54925525", "0.5490059", "0.5489708", "0.54891914", "0.5482246", "0.5481925", "0.5481925", "0.54796696" ]
0.5829316
42
FIXME: (cmhobbs) this is pretty heavy handed. User shouldn't know this much about related objects. Public: Aggregate all users in associated groups Examples User.first.related_groups_users => [ , ] Returns an Array representing the related User objects.
def related_groups_users [].tap do |related_users| all_groups.each do |group| related_users << group.all_users.reject { |group_user| group_user == self } end end.flatten.uniq end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def users\n users = []\n members.each do |member|\n if member.is_a? User\n users << member\n elsif member.is_a? UserGroup\n users + member.users\n else\n raise UserGroupException, \"While retrieving users from a user group (#{self}), found a member that was not a User or UserGroup record!\"\n end\n end\n users.uniq(&:id)\n end", "def get_users(user_group_id=nil) \n # {{{\n users = Array.new\n if is_atomic? then return nil end\n if user_group_id.nil? then \n user_group_id = attr['user_group_id'] \n end\n \n own_users = User_Group_Hierarchy.select { |e| \n e.where(\n (e['user_group_id__parent'] == user_group_id)\n )\n e.order_by('user_group_name', :asc)\n }.each { |ugh|\n user = User_Group.select { |ug|\n ug.where(ug['user_group_id'] == ugh.attr['user_group_id__child'])\n ug.order_by('user_group_name', :asc)\n }.first\n if user.is_atomic? then users.push(user) \n else\n users += get_users(ugh.attr['user_group_id__child'])\n end\n }\n \n return users\n \n end", "def all_users\n self.users +\n User.where(institution: self.institution).\n select{ |u| u.belongs_to_user_group?(self) }\n end", "def all_users\r\n result = []\r\n\r\n self.descendants_and_self.each do |role|\r\n if role == self\r\n result << role.users \r\n else\r\n result << role.all_users\r\n end\r\n end\r\n self.all_groups.each { |group| result << group.all_users }\r\n result.flatten!\r\n result.uniq!\r\n return result\r\n end", "def user_groups\n return @user_groups if @user_groups\n @user_groups = default_user_groups\n @user_groups += RoleMapper.roles(@user)\n @user_groups\n end", "def associated_users(permission: nil)\n owner = self.user\n shares = permission.present? ? self.study_shares.where(permission: permission) : self.study_shares\n share_users = shares.map { |share| User.find_by(email: /#{share.email}/i) }.compact\n [owner] + share_users\n end", "def targeted_users\r\n if groups.any?\r\n target = []\r\n groups.each do |group|\r\n target << group.active_members\r\n end\r\n\r\n target.flatten!\r\n target_ids = target.map{|u| u.id}\r\n\r\n target = User.where(id: target_ids)\r\n else\r\n target = enterprise.users.active\r\n end\r\n\r\n target = target.for_segments(segments) unless segments.empty?\r\n\r\n target.uniq{|u| u.id}\r\n end", "def find_user_groups\r\n user_group = Group.where(\"id IN (SELECT gu.group_id FROM groups_users gu WHERE gu.user_id = ?)\", User.current.id).all\r\n group_names = []\r\n user_group.each do |group|\r\n group_names << group.lastname\r\n end\r\n return group_names\r\n end", "def users\n users_array = []\n if serialization_options[:include_users] == true\n # NOTE: object here refers to the ActiveRecord model object. self refers to the serializer object itself.\n object.users.each do |user|\n # NOTE: You can pass serialization_options to serializable_hash.\n users_array << UserSerializer.new(user, {}).serializable_hash({})\n end\n end\n return users_array\n end", "def memberships_users\n group_ids_select = memberships.select(:user_id).where(user_type: 'Group')\n\n User.where('id IN (:user_ids) OR id IN (:group_owner_ids)',\n user_ids: memberships.select(:user_id).where(user_type: 'User'),\n group_owner_ids: Group.where(id: group_ids_select).select(:owner_id))\n end", "def users\n Ecore::User.where(\"group_ids LIKE '%#{id}%'\").all\n end", "def member_users(recursive = false)\n @member_users = User.find(:all, distinguishedname: @entry[:member]).delete_if(&:nil?)\n if recursive\n member_groups.each do |group|\n @member_users.concat(group.member_users(true))\n end\n end\n @member_users\n end", "def users\n Section.find_roles.pluck(:name).inject(Array.new) do |result, role|\n result += User.with_role(role, self)\n end.uniq\n end", "def user_groups\n return @user_groups if @user_groups\n\n @user_groups = default_user_groups\n # TODO: necessary to include #hyrax_group_names?\n @user_groups |= current_user.hyrax_group_names if current_user.respond_to? :hyrax_group_names\n @user_groups |= ['registered'] if !current_user.new_record? && current_user.roles.count.positive?\n # OVERRIDE: add the names of all user's roles to the array of user_groups\n @user_groups |= all_user_and_group_roles\n\n @user_groups\n end", "def group_users\n DiscussionGroupUser.where(\"discussion_group_id=? AND is_member=?\", self.id, true)\n end", "def all_users()\n User.all\n end", "def show_Users\n theUsers = User.select{ |user| user.group_id == self.id}\n theUsers\n end", "def user_groups(user)\n record = find_user(user)\n return [] if record&.size != 1\n\n dn = record.first.dn\n groups_from(dn, \"uniqueMember\") | groups_from(dn, \"member\")\n rescue ::Net::LDAP::Error => e\n Rails.logger.tagged(:ldap) { Rails.logger.warn \"Connection error: #{e.message}\" }\n []\n end", "def getUsersForGroup(group_id)\n self.class.get(\"users/user/_search?q=group_id:#{group_id}\")\n end", "def get_relevant_users(include_evaluator = false, include_evaluated = false)\n relevant_users = self.get_team_members\n if not self.adviser_id.blank?\n relevant_users.append(self.adviser.user)\n end\n if not self.mentor_id.blank?\n relevant_users.append(self.mentor.user)\n end\n if include_evaluator\n relevant_users.concat(self.get_evaluator_teams_members)\n end\n if include_evaluated\n relevant_users.concat(self.get_evaluated_teams_members)\n end\n return relevant_users\n end", "def recursive_members()\n return @users if @users.present?\n\n # False is the users, true groups\n grouped = member(true).group_by{|g| LdapGroup.dn_is_group? g}\n @users = grouped[false] || []\n groups = grouped[true] || []\n\n cached_groups = {}\n\n groups.each do |g_dn|\n key = dn.rdns.first.values.first\n\n group = cached_groups[key] || LdapGroup.find(g_dn)\n cached_groups[key] = group\n\n group_users = group.member.group_by{ |g| LdapGroup.dn_is_group? g }[false]\n @users.push(*group_users)\n end\n @users\n end", "def users\n res = []\n url = data['links']['roleUsers']\n tmp = GoodData.get url\n tmp['associatedUsers']['users'].each do |user_url|\n user = GoodData.get user_url\n res << GoodData::Profile.new(user)\n end\n res\n end", "def user_groups_assignable_for_user(usr)\n return [] if usr.nil?\n \n if administrator?(usr)\n UserGroup.find_by_sql <<-SQL\n select user_groups.* from user_groups order by user_groups.name\n SQL\n else\n UserGroup.find_by_sql <<-SQL\n select user_groups.* from user_groups, user_groups_users\n where user_groups.id = user_groups_users.user_group_id\n and user_groups_users.user_id = #{usr.id}\t \n order by user_groups.name\n SQL\n end\n end", "def users\n Webmail::User.in(group_ids: id)\n end", "def users_and_groups\n return @users_and_groups\n end", "def users\n User.in(id: user_promotions.pluck(:user_id))\n end", "def my_managers\n my_groups = group_users.pluck(:group_id)\n CourseUser.joins(group_users: :group).merge(Course::GroupUser.manager).\n where(Course::Group.arel_table[:id].in(my_groups)).distinct\n end", "def group_users(table)\n @group_users ||= {}\n @group_users[table] ||= User.where(id: group_user_ids(table)).to_a\n end", "def owned_groups\n @owned_groups = Group.where(\"owner_id = ?\", current_user)\n end", "def aggregated_associations\n @aggregated_associations ||= []\n end", "def user_groups_assignable_for_user(usr)\n return [] if usr.nil?\n ug_table = Lockdown.user_groups_hbtm_reference.to_s\n if administrator?(usr)\n Lockdown.user_group_class.find_by_sql <<-SQL\n select #{ug_table}.* from #{ug_table} order by #{ug_table}.name\n SQL\n else\n usr_table = Lockdown.users_hbtm_reference.to_s\n if usr_table < ug_table\n join_table = \"#{usr_table}_#{ug_table}\"\n else\n join_table = \"#{ug_table}_#{usr_table}\"\n end\n Lockdown.user_group_class.find_by_sql <<-SQL\n select #{ug_table}.* from #{ug_table}, #{join_table}\n where #{ug_table}.id = #{join_table}.#{Lockdown.user_group_id_reference}\n and #{join_table}.#{Lockdown.user_id_reference} = #{usr.id}\t \n order by #{ug_table}.name\n SQL\n end\n end", "def users\n GroupMembers.new(:id => id).get.items\n end", "def users\n company_ids = [self.id]\n company_ids += advisor_company_ids if advised?\n\n user_ids = UserAffiliation.where(:company_id.in => company_ids).with_access.only(:user_id).map(&:user_id)\n User.where(:id.in => user_ids).order_by(created_at: :asc)\n end", "def user_groups\n return @user_groups if @user_groups\n\n @user_groups = default_user_groups\n @user_groups |= current_user.groups if current_user and current_user.respond_to? :groups\n @user_groups |= ['registered'] if !current_user.new_record? && current_user.is_osu\n @user_groups\n end", "def my_students\n CourseUser.joins(group_users: :group).merge(Course::GroupUser.normal).\n where(Course::Group.arel_table[:id].in(group_users.manager.pluck(:group_id))).distinct\n end", "def fellow_group_member_ids\n user_ids = GroupUser\n .where(group_id: group_ids + owned_group_ids)\n .uniq\n .pluck(:user_id)\n\n # don't include self\n user_ids.delete(id)\n\n user_ids\n end", "def users\n return @canonical_user_pool if @canonical_user_pool\n Egi::Fedcloud::Vmhound::Log.debug \"[#{self.class}] Retrieving all users\"\n check_retval @user_pool.info!\n\n @canonical_user_pool = []\n @user_pool.each { |user| @canonical_user_pool << canonical_user(user) }\n @canonical_user_pool\n end", "def my_users\n self.users + [self.user]\n end", "def get_related_users(query='', results=10, start=0)\r\n get_related('Users',query, results, start)\r\n end", "def users\n Ecore::User.find(@user_id, :group_ids.like(\"%#{@id}%\")).receive(:all)\n end", "def users\n users = []\n if current_user.lead?\n users = object.users.select { |u| u.id != current_user.id }\n users = users.unshift(current_user)\n elsif current_user.dev?\n vms_v = object.vms.select { |vm| vm.is_jenkins }\n users = vms_v.flat_map(&:user).uniq.select { |u| u.id != current_user.id }\n users = users.unshift(current_user)\n else\n users <<= current_user\n end\n users.map { |u| u.id }\n end", "def groups\n Group.groups(user_name)\n end", "def get_all\n @user_repository.get_all_users\n end", "def related_objects\n related_objects = Array.new\n\n\t\tself.meta_data_group_assignments.uniq.each do |assignment|\n\t\t\tobject_type = assignment.meta_data_group_assignable_type\n\t\t\tobject_id = assignment.meta_data_group_assignable_id\n\n\t\t\trelated_object = eval(object_type+'.find('+object_id.to_s+')')\n\t\t\trelated_objects.push(related_object)\n\t\tend\n\n\t\tputs related_objects.inspect\n\n return related_objects\n end", "def accounts_from_current_user\n\t\taccounts = []\n\t\tcurrent_user.RelatedAccounts.each do |relatedaccount|\n\t\t\tAccount.find_all_by_Canal__c(relatedaccount.canal_id).each do |account|\n\t\t\t\taccounts << account\n\t\t\tend\n\t\tend\n\n\t\treturn accounts\n\tend", "def users\n user_arr = []\n accounts.each do |s|\n user_arr << User.find(s.user.id)\n end\n user_arr\n end", "def get_user_groups\n user_groups.keys\n end", "def groups\n groups = []\n relations = self.group_relations\n relations.each do |r|\n groups.push r.group\n end\n groups\n end", "def users\n if @group\n @users ||= @group.users.tracking_enabled.with_waypoints.order(:name)\n else\n @users ||= User.tracking_enabled.with_waypoints.order(:name)\n end\n end", "def involved_people\n # [self.user, self.answerers, self.commenters].flatten.uniq\n [self.user].flatten.uniq\n end", "def users\n user_arr = []\n subscriptions.each do |s|\n user_arr << User.find(s.user.id)\n end\n user_arr\n end", "def users\n users = Backlogjp.base._command \"getUsers\", self.id\n users.map {|hash| User.new(hash)}\n end", "def list_users\n group_id_param = params[:group_id]\n\n if group_id_param.nil? || group_id_param.blank?\n render json: { error: 'group_id not specified.' }, status: :bad_request\n return\n end\n\n group = CanvasSpaces.GroupCategory.groups.find_by_id(group_id_param)\n if group.nil?\n render json: { error: 'No such group found.' }, status: :bad_request\n else\n if @current_user.account.site_admin? || group.leader_id == @current_user.id\n render json: { size: group.users.count, users: group.users.map { |user| user.as_json(only: [:id, :name], include_root: false) } }, status: :ok\n else\n # doesn't have access to the group\n render json: { error: \"Can't list users. Not owner.\" }, status: :forbidden\n end\n end\n end", "def groups\n UserGroups.new(:id => id).get.items\n end", "def test_userlist(groups)\n\t\tUser.joins(:groups).includes(:groups).merge(groups).explain #map {|user| user.name}.to_s.html_safe\n\t\t# User.joins(:groups).merge(groups).map {|user| \"<tr><td>#{user.name}</td><td>#{user.groups.map {|group| group.name}.to_s.html_safe}</td></tr>\"}.uniq.join.html_safe\n\tend", "def category_users\n images.collect{|e| e.user}\n end", "def ldap_groups\n User.walk_ldap_groups(User.ldap_member_of(user_key), []).sort\n end", "def get_friends_list\n friends = self.friendships\n friends = friends.map do |friendship|\n User.find(friendship.friend_id)\n end\n end", "def involved_people\n involved_people_ids.collect{|user_id| User.find(user_id)}\n end", "def user_associations(users)\n x = []\n users.each do |u|\n puts \" collecting #{u.login}'s records\"\n\n ## PSEUDS will dump the actual user record and the user's preferences\n ## so they don't need to be dumped here.\n PSEUDS << u.pseuds\n\n # the roles are all dumped separately, so just dump the association here\n x << u.roles_users\n\n x << u.profile unless MULTI # profile's may have sensitive information that isn't visible\n\n TAGS << u.fandoms if u.tag_wrangler\n\n x << u.skins\n\n u.readings.find_in_batches(:batch_size => NTH) do |readings|\n x << readings.last\n WORKS << readings.last.work if MULTI\n end\n\n u.inbox_comments.find_in_batches(:batch_size => NTH) do |batch|\n inbox_comment = batch.last\n x << inbox_comment\n x << inbox_comment.feedback_comment\n commentable = inbox_comment.feedback_comment.ultimate_parent\n if MULTI\n if commentable.is_a?(Work)\n WORKS << commentable\n elsif commentable.is_a?(Tag)\n TAGS << commentable\n else\n x << commentable\n end\n end\n PSEUDS << inbox_comment.feedback_comment.pseud\n commentable = inbox_comment.feedback_comment.ultimate_parent\n WORKS << commentable if (MULTI && commentable.is_a?(Work))\n end\n\n # most of the associations are actually through the pseuds\n u.pseuds.each do |p|\n p.comments.find_in_batches(:batch_size => NTH) do |comments|\n comment = comments.last\n x << comment\n if MULTI\n commentable = comment.ultimate_parent\n if commentable.is_a?(Work)\n WORKS << commentable\n elsif commentable.is_a?(Tag)\n TAGS << commentable\n elsif commentable\n x << commentable\n end\n end\n end\n p.bookmarks.each do |bookmark|\n if !bookmark.private? || !MULTI\n x << bookmark\n x << bookmark.taggings\n TAGS << bookmark.tags\n if MULTI\n bookmarkable = bookmark.bookmarkable\n if bookmarkable.is_a?(Work)\n WORKS << bookmarkable\n elsif bookmarkable.is_a?(Series)\n x << bookmarkable\n bookmarkable.works.each {|w| WORKS << w}\n elsif bookmarkable.is_a?(ExternalWork)\n x << bookmarkable\n x << bookmarkable.taggings\n TAGS << bookmarkable.tags\n end\n end\n end\n end\n x << p.creatorships\n p.creatorships.map(&:creation).each do |item|\n if item.is_a?(Work)\n if item.posted? || !MULTI\n WORKS << item\n x << item.related_works\n item.related_works.each do |parent|\n if parent.is_a? Work\n WORKS << parent\n else\n x << parent\n end\n end\n x << item.parent_work_relationships\n item.children.each {|w| WORKS << w}\n end\n elsif item.is_a?(Chapter)\n # chapters get pulled in from works\n elsif item.is_a?(Series)\n x << item\n end\n end\n x << p.collections\n p.collections.each do |c|\n x << c.collection_profile\n x << c.collection_preference\n x << c.collection_participants\n PSEUDS << c.collection_participants.map(&:pseud)\n end\n end\n end\n x.flatten.compact.uniq\nend", "def projects_users\n all_users_ids = projects.map { |project| project.user_ids }\n all_users_ids.flatten!\n all_users_ids.uniq!\n User.all(conditions: {:_id.in => all_users_ids})\n end", "def projects_users\n all_users_ids = projects.map { |project| project.user_ids }\n all_users_ids.flatten!\n all_users_ids.uniq!\n User.all(conditions: {:_id.in => all_users_ids})\n end", "def users\n records do |instance|\n instance['users'] = user.where('organization_id': instance['_id'])\n end\n end", "def all_users\n result = []\n api.search(accounts_dn, ::LDAP::LDAP_SCOPE_SUBTREE, accounts_filter) do |user|\n result << user.to_hash\n end\n result\n end", "def users\n\t\tusers = []\n\t\trooms.each do |room|\n\t\t\troom.users.each do |user|\n\t\t\t\tusers << user\n\t\t\tend\n\t\tend\n\t\tusers\n\tend", "def groups\n return @groups if @groups\n return [] if uid.nil?\n\n codes = [\"student\"]\n res = Group.where(code: codes)\n # add eduPersonAffiliation (e.g. student, faculty, staff) to groups that the user is a member of\n @groups = res + affiliations.map{ |code| Group.new(:code=>code) }\n end", "def users\n category_users.uniq\n end", "def get_all_users\n @users = []\n User.all.each do |user|\n @users << user.to_hash\n end\n end", "def get_all_users\n @users = []\n results = User.all\n results.each do |user|\n @users << user.to_hash\n end\n end", "def get_target_users\n\n users = []\n\n self.get_orders.each do |user_hash|\n\n user_ids = user_hash.keys\n\n users = users + user_ids unless user_ids.nil?\n end\n\n users.compact!\n\n return users\n end", "def get_users(options = {})\n options[:include] = [:roles, :groups, :center]\n options[:page] ||= 1\n options[:per_page] ||= 20\n users = if self.has_access?(:user_show_all) # gets all users which are not login-users\n User.users.with_roles(Role.get_ids(Access.roles(:all_real_users))).paginate(options).uniq\n elsif self.has_access?(:user_show_admins)\n User.users.with_roles(Role.get_ids(Access.roles(:user_show_admins))).paginate(options)\n elsif self.has_access?(:user_show)\n User.users.in_center(self.center).paginate(options)\n else\n WillPaginate::Collection.new(options[:page], options[:per_page])\n end\n return users\n end", "def get_users(options = {})\n options[:include] = [:roles, :groups, :center]\n options[:page] ||= 1\n options[:per_page] ||= 20\n users = if self.has_access?(:user_show_all) # gets all users which are not login-users\n User.users.with_roles(Role.get_ids(Access.roles(:all_real_users))).paginate(options).uniq\n elsif self.has_access?(:user_show_admins)\n User.users.with_roles(Role.get_ids(Access.roles(:user_show_admins))).paginate(options)\n elsif self.has_access?(:user_show)\n User.users.in_center(self.center).paginate(options)\n else\n WillPaginate::Collection.new(options[:page], options[:per_page])\n end\n return users\n end", "def liked_users \n users = object.liked_users.collect do |liked_user|\n # user = User.find_by(id: liked_user.liked_user_id)\n # user.attributes.except!(\"created_at\", :updated_at, :email)\n user = User.select(:id, :name, :gender, :age, :bio).find_by(id: liked_user.liked_user_id)\n end\n end", "def get_all_users\n @users = []\n\n User.all.each do|user|\n @users << user.to_hash\n end\n end", "def all_friends\n return self.users\n end", "def admins\n group_users(admins_join_table)\n end", "def all_users\n\t\tshared_users.map(&:id).join(\", \")\n\tend", "def household_users\n User.where(id: household_user_ids)\n end", "def all_active_directory_users\n filter = Net::LDAP::Filter.construct(\n '(&(objectCategory=organizationalPerson)(givenName=*)(sn=*)(objectClass=User)(!(userAccountControl:1.2.840.113556.1.4.803:=2)))')\n entries = OP_CONN.search(filter: filter)\n users = []\n entries.each do |entry|\n user = User.new(convert_user_attributes(entry))\n user.status = :enabled if (!user.disabled? && user.is_app_user?)\n users << user\n end\n users\n rescue Net::LDAP::LdapError => e\n return []\n end", "def get_all_groups\n grps = []\n grps += self.groups\n grps.each { |g| grps += g.get_all_groups }\n return grps.compact.uniq\n end", "def index\n @groups_user = GroupsUser.find(params[:id])\n @groups_users = GroupsUser.all\n end", "def get_users\n users = call(CMD_GET_USERS)[:users]\n users.map {|account| User.new(account) }\n end", "def find_all_gym_users\n self.gym_user_instances.map{|user| user.name } \n end", "def users\n raise \"No users are defined\" unless user_role.users.count.positive?\n user_role.users\n end", "def owned_groups\n codes = Hydra::LDAP.groups_owned_by_user(uid)\n #puts \"codes: #{codes}\"\n Group.find_all_by_code(codes)\n end", "def users\n set_attributes_for(User)\n User.find(:all)\n end", "def returning_users\n []\n end", "def users\n # TODO use SQL\n results = self.approvers + self.observers + [self.requester]\n results.compact\n end", "def friendable_users\n User.all.where.not('id IN (?)', [id] + friends.ids +\n friend_requests_sent.pending.pluck(:receiver_id) + friend_requests_received.pending.pluck(:sender_id))\n end", "def all_users\n query = users.to_sql + \"\\nUNION\\n\" + User.where(id: super_admin_id).to_sql\n User.find_by_sql(query)\n end", "def investors\n relationships = self.investment_relationships\n users = []\n\n relationships.each do |relationship|\n users << relationship.investor_user\n end\n return users\n end", "def index\n @groups = Group.all.includes(:user)\n end", "def get_all_groups\n grps = self.get_groups_recursively\n grps << self.home_group\n logged_in_group = Group.new(:name => \"logged in user\")\n logged_in_group.id = 0\n grps << logged_in_group\n anonymous_group = Group.new(:name => \"anonymous user\")\n anonymous_group.id = -1\n grps << anonymous_group\n return grps.compact.uniq\n end", "def users\n users = Set.new\n\n @channels.each do |channel|\n users.merge(channel.users)\n end\n\n users\n end", "def get_user_groups(user)\n ldap_user = get_user(user)\n group_filter = Net::LDAP::Filter.eq(\n \"member\", \"cn=#{ldap_user[:first]} #{ldap_user[:last]},#{@config[:userdn]}\"\n )\n \n res = search(@config[:groupdn], group_filter)\n \n if (res[:message] != \"Success\")\n # tbd handle error\n return nil\n end\n \n if (res[:values] == [])\n return nil\n end\n \n groups = []\n \n res[:values].each do |group|\n groups << group.cn.first\n end\n \n return groups\n end", "def users\n object.users.uniq.each do |user|\n UserSerializer.new(user)\n end\n end", "def students_from_group(group_id)\n course.course_users.joins(:group_users).where('course_group_users.group_id = ?', group_id).\n merge(Course::GroupUser.normal)\n end", "def users\n self.user_cards.map do |card|\n card.user\n end\n end", "def get_users_from_select(select)\n select = select.reject { |id| id.blank? }\n unless select.blank?\n group_ids = select.select {|group_id| group_id.start_with?(\"g\")}\n users = User.find(select - group_ids)\n group_users = group_ids.map {|group_id| group_id.sub! \"g\",\"\"}\n .map {|group_id| Group.find(group_id).users}\n .flatten\n group_users.concat(users).uniq\n end\n end", "def users\n subject.respond_to?(:users) ? subject.users : [subject]\n end" ]
[ "0.6788714", "0.66747075", "0.64734405", "0.63823956", "0.60214233", "0.5985585", "0.5972596", "0.59077686", "0.58903253", "0.5865416", "0.5822525", "0.57893354", "0.5760975", "0.5745023", "0.5733774", "0.57257736", "0.57074296", "0.5695067", "0.56680304", "0.5631721", "0.5631607", "0.5594348", "0.5588938", "0.55888826", "0.5565189", "0.5557994", "0.55237025", "0.5502845", "0.54936326", "0.5484826", "0.547948", "0.5479283", "0.54720056", "0.5465841", "0.5456764", "0.5456475", "0.5445348", "0.5443616", "0.5414996", "0.5407836", "0.5404899", "0.53595245", "0.5358375", "0.53467417", "0.5327124", "0.5324785", "0.5321349", "0.5309849", "0.5293192", "0.528824", "0.528497", "0.52816725", "0.52635026", "0.5263191", "0.5257892", "0.52335393", "0.52297497", "0.52248436", "0.5221283", "0.5211885", "0.5205006", "0.5205006", "0.52033496", "0.51809096", "0.51586777", "0.5157107", "0.51569927", "0.5155641", "0.5153755", "0.5141199", "0.5137028", "0.5136652", "0.5134506", "0.512944", "0.512191", "0.51191044", "0.5118722", "0.51155406", "0.5111452", "0.51052827", "0.510386", "0.50892824", "0.508654", "0.5076061", "0.5074308", "0.50601137", "0.5041245", "0.5032933", "0.5030272", "0.5015008", "0.5002298", "0.5001852", "0.49985597", "0.49952272", "0.49859002", "0.49858648", "0.4984863", "0.49821323", "0.4980684", "0.49705258" ]
0.78119546
0
NOTE: (cmhobbs+tyrendenison) verify usage of this set of methods
def non_profit_admin? managed_organization.try(:type) == 'NonProfit' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def probers; end", "def schubert; end", "def implementation; end", "def implementation; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def jack_handey; end", "def mitch_hedberg; end", "def weber; end", "def berlioz; end", "def celebration; end", "def operations; end", "def operations; end", "def methods; end", "def methods; end", "def methods; end", "def methods; end", "def internal; end", "def formation; end", "def suivre; end", "def anchored; end", "def methods() end", "def custom; end", "def custom; end", "def who_we_are\r\n end", "def bellini; end", "def silly_adjective; end", "def terpene; end", "def king_richard_iii; end", "def villian; end", "def bizet; end", "def in_law; end", "def feruchemist; end", "def bs; end", "def scientist; end", "def herald; end", "def strain; end", "def processor; end", "def strategy; end", "def intensifier; end", "def schumann; end", "def blg; end", "def malts; end", "def romeo_and_juliet; end", "def dh; end", "def gounod; end", "def stderrs; end", "def ibu; end", "def trd; end", "def hiss; end", "def ca; 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 zuruecksetzen()\n end", "def verdi; end", "def invention; end", "def overrides; end", "def operation; end", "def ignores; end", "def isolated; end", "def isolated; end", "def manufacture; end", "def how_it_works\r\n end", "def buzzword; end", "def buzzword; end", "def private_method\n end", "def specialty; end", "def guct\n end", "def missing; end", "def electromechanical; end", "def extra; end", "def offences_by; end", "def refutal()\n end", "def respond(); end", "def spec; end", "def spec; end", "def r; end", "def r; end", "def mascot; end", "def code_of_conduct; end", "def celebrity; end", "def celebrity; end", "def upc_e; end", "def kids_musical; end", "def getc() end", "def getc() end", "def getc() end", "def mech; end" ]
[ "0.7557106", "0.7089973", "0.6906544", "0.6891817", "0.6891817", "0.6877616", "0.6877616", "0.6877616", "0.6877616", "0.6834909", "0.6621984", "0.6570836", "0.6562285", "0.6541487", "0.6535754", "0.6535754", "0.65221846", "0.65221846", "0.65221846", "0.65221846", "0.6507424", "0.6506507", "0.6502099", "0.64909905", "0.64908993", "0.6432385", "0.6432385", "0.6423916", "0.63995206", "0.63746405", "0.63601416", "0.63508445", "0.6264684", "0.6252477", "0.6248085", "0.622928", "0.6206075", "0.61957437", "0.61816376", "0.6164764", "0.6141663", "0.61309", "0.61303633", "0.6125832", "0.6115621", "0.6114676", "0.61093086", "0.6107074", "0.6101661", "0.60958034", "0.6092237", "0.608929", "0.60850537", "0.6078655", "0.60746086", "0.60746086", "0.60746086", "0.60746086", "0.60746086", "0.60746086", "0.60746086", "0.60746086", "0.60746086", "0.60746086", "0.60746086", "0.60746086", "0.60500133", "0.60342103", "0.6029993", "0.60298455", "0.6029071", "0.6027849", "0.60149044", "0.60149044", "0.6012368", "0.60081327", "0.6005512", "0.6005512", "0.5970261", "0.5951531", "0.59443796", "0.59384555", "0.59375864", "0.5933173", "0.59314525", "0.5930808", "0.5927256", "0.59269375", "0.59269375", "0.59181327", "0.59181327", "0.59151727", "0.59148824", "0.5901052", "0.5901052", "0.59007293", "0.59003705", "0.5900006", "0.5900006", "0.5900006", "0.5893475" ]
0.0
-1
NOTE: (cmhobbs) we don't check to see if a BadgeType is awardable. this may prove troublesome in the future. FIXME (cmhobbs) we're passing badge_type_id around quite a bit... this may require a separate class at some point.
def award_badge(badge_type_id) if badges.where(badge_type_id: badge_type_id).exists? false else badge = badges.create(badge_type_id: badge_type_id, year: Time.now.year) Notifier.delay.new_badge_email(self, badge) # NOTE: (cmhobbs) spam all the users! \o/ # BadgeWorker.perform_async(badge.id) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def award_badge(participant_id, badge_name)\n badge_id = Badge.get_id_from_name(badge_name: badge_name)\n AwardedBadge.where(participant_id: participant_id, badge_id: badge_id, approval_status: 0).first_or_create\n end", "def has_badge?(badge)\n case badge\n when Badge\n badges.find_by_id(badge.id)\n when Fixnum\n badges.find_by_id(badge)\n when String\n badges.find_by_name(badge)\n end\n end", "def award!(badge, award_date = nil)\n if !badge.awarded_to?(self) or badge.allow_duplicates\n\n if badge.expire_in_days != 0\n base_date = award_date.present? ? award_date : DateTime.now\n abs_expiry = base_date.advance(:days => badge.expire_in_days)\n else\n abs_expiry = nil\n end\n\n self.awards.create(:badge_id => badge.id, :award_date => award_date, :expiry => abs_expiry )\n end\n end", "def update\n raise 'Unimplemented award type update!'\n end", "def set_award_type(name, expires_in, quality)\n case name\n when 'Blue First'\n BlueFirst.new(name, expires_in, quality)\n when 'Blue Distinction Plus'\n BlueDistinctionPlus.new(name, expires_in, quality)\n when 'Blue Compare'\n BlueCompare.new(name, expires_in, quality)\n when 'Blue Star'\n BlueStar.new(name, expires_in, quality)\n else\n StandardAward.new(name, expires_in, quality)\n end\n end", "def for_badge(badge); end", "def badges_count_for_type(badge_type)\n\t self.badges.where(:badge_type => badge_type).count\n end", "def award!(badge, award_date = nil)\n return unless !badge.awarded_to?(self) || badge.allow_duplicates\n\n if badge.expire_in_days != 0\n base_date = award_date.present? ? award_date : DateTime.now\n abs_expiry = base_date.advance(days: badge.expire_in_days)\n else\n abs_expiry = nil\n end\n\n awards.create(badge_id: badge.id, award_date: award_date, expiry: abs_expiry)\n end", "def badge\n if badge_id\n Merit::Badge.find(badge_id)\n else\n Merit::Badge.find_by_name_and_level(badge_name, level)\n end\n end", "def award_badges!(new_badges)\n return true if new_badges.empty?\n if !new_badges.first.is_a?(Badge)\n new_badges = Badge.find(:all, :conditions => [\"ref IN (?)\", new_badges])\n end\n self.badges += (new_badges - self.badges)\n end", "def perform(badge_event, global_id)\n object = GlobalID::Locator.locate(global_id)\n user = object.user\n badges = QA::BadgeManager.badges_for(badge_event.to_sym)\n logger.info \"Checking badge #{badge_event} for user ##{user.id}\"\n\n # Iterate through the badges for the event and check if they should be\n # awarded\n update_badge_count = false\n badges.each do |badge|\n # skip if criteria not satisfied\n next unless badge.new.check(object)\n # skip if already awarded\n if badge.unique?\n next if user.badges.where(name: badge.name).exists?\n else\n next if user.badges.where(name: badge.name, subject: object).exists?\n end\n\n logger.info \"Awarding badge #{badge.name} to user ##{user.id}\"\n update_badge_count = true\n user.badges.create(\n subject: object,\n name: badge.name\n )\n end\n Jobs::UpdateUserBadgeCount.perform_async(user.id) if update_badge_count\n end", "def has_badge?\n !!self.badge\n end", "def badge\n if @badge.nil?\n badges = Badge.by_name(badge_name)\n badges = badges.by_level(level) unless level.nil?\n @badge = badges.first\n end\n @badge\n end", "def donator?\n @badges.key? 'bits'\n end", "def awarded?\n return false if declined?\n case offering.award_basis\n when \"review\" then awarded_by_review_committee?\n when \"interview\" then awarded_by_interview_committee?\n when \"final\" then awarded_by_final_committee?\n else awarded_by_review_committee?\n end\n end", "def apply_badges\n if rule_applies?\n grant_badge if new_or_multiple?\n else\n remove_badge if @rule.temporary\n end\n end", "def validate_badge(data, badge)\n if data[\"client_id\"] == badge.client_id && data[\"badge_id\"] == badge.id && data[\"name\"] == badge.name &&\n data[\"description\"] == badge.description && data[\"image\"] == badge.badge_image.image.url(:thumb) &&\n data[\"feats\"].length == badge.feats.length\n if data[\"feats\"].length == 0\n return true\n end\n if data[\"feats\"].length > 0 && validate_feat(data[\"feats\"][0] == badge.feats[0])\n return true\n end\n end\n return false\n end", "def founder?\n @badges.key? 'founder'\n end", "def show\n authorize @badge\n @staff = User.where(role: 'staff', school: current_user.school)\n @awarded_badge = AwardedBadge.where(user: current_user, badge: @badge).first\n end", "def prime?\n @badges.key? 'premium'\n end", "def grant_or_delete_badge(action)\n unless (sash = sash_to_badge(action))\n Rails.logger.warn \"[merit] no sash found on Rule#grant_or_delete_badge\"\n return\n end\n\n if applies? action.target_object(model_name)\n if badge.grant_to(sash)\n action.log!(\"badge_granted:#{badge.name}\")\n end\n elsif temporary?\n if badge.delete_from(sash)\n action.log!(\"badge_removed:#{badge.name}\")\n end\n end\n end", "def mod?\n @badges.key? 'moderator'\n end", "def badge; end", "def award; end", "def crear_achievement badge, id_app\n description = badge[\"description\"].encode(\"UTF-8\")\n \n body = {\n name:badge[\"name\"],\n imageUrl:badge[\"imageUrl\"],\n unique: true,\n criteriaUrl: badge[\"criteriaUrl\"],\n earnerDescription: description,\n consumerDescription: description ,\n criteria: badge[\"criteria\"],\n type: 'Badge'\n }\n status 201\n \n response = signed_post_request @@API_ROOT+\"/issuers/#{id_app}/badges\", body\n\n end", "def badges\n Merit::Badge.find { |b| b.custom_fields[:skill_level] == self.name_key.to_sym }\n end", "def find_object(id:)\n super(id: ::Types::GlobalIDType[::Awardable].coerce_isolated_input(id))\n end", "def set_badge\n @badge = Badge.friendly.find(params[:id])\n authorize @badge\n end", "def sub_gift_leader?\n @badges.key? 'sub-gift-leader'\n end", "def badge_status(user)\n if user.badges.select {|b| b.is_a?(self)}.empty?\n 0\n else\n current = user.badges.select {|b| b.is_a?(self)}\n current.map {|b| b.level }.max\n end\n end", "def blue_first(award)\n award.expires_in -= 1\n if award.expires_in >= 0\n award.quality += 1\n elsif award.expires_in < 0\n award.quality += 2\n end\nend", "def priority_badge_class(type)\n case type\n when \"high\" then \"badge badge-danger\"\n when \"medium\" then \"badge badge-primary\"\n when \"low\" then \"badge badge-success\"\n end\n end", "def add_badge!( badge, update_badge = true )\n unless @badges.include?( badge )\n @badges << badge\n badge.add_user!( self, false) if update_badge\n end\n return @badges\n end", "def convert_badge_name_to_badge\n return if self.badge.kind_of?(Badge) || self.badge_name.blank?\n\n self.badge = BadgeFinder.find(self.authoritative_company, self.badge_name)\n end", "def fetch_badge_from_params\n badge = nil\n\n params.permit(:badge_name)\n if params[:badge_name].nil?\n params.require(:badge_id)\n badge = Badge.find_by(id: params[:badge_id], enabled: true)\n else\n badge = Badge.find_by(name: params[:badge_name], enabled: true)\n end\n raise Discourse::NotFound if badge.blank?\n\n badge\n end", "def badges\n end", "def badge_percentage(user, badge) \n case badge \n when \"ownership\"\n score = user.ownership.score \n when \"persistence\"\n score = user.persistence.score \n when \"communication\"\n score = user.communication.score \n when \"gratitude\"\n score = user.gratitude.score \n else\n #Failsafe\n end\n level = user.badge_ding_threshold(badge)\n value = score.to_f / level.to_f\n percentage = value * 100\n return percentage.to_i\n end", "def badges(league_id, player_id)\n # get players\n players = player_ids league_id\n badges = Hash.new { |h, k| h[k] = [] }\n all_games = game_ids(league_id)\n\n # tournament hack\n # badges[399] << badge('🏆', 'New Bags Champs') #adam\n # badges[453] << badge('🏆', 'Jan 18th Champs') #james\n # badges[397] << badge('🥈', 'New Bags 2nd Place') #greg\n # badges[319] << badge('🥈', 'Jan 18th - 2nd Place') #mike\n # badges[449] << badge('🥉', 'New Bags 3rd Place') #kirk\n # badges[21] << badge('🥉', 'Jan 18th - 3rd Place') #randall\n\n # plays a lot\n # players.each do |p|\n # badges[p] << badge('⚽', 'Determined') if games_this_week(p, league_id) > 50\n # end\n\n # fire badge\n # best daily change\n best_change = players.group_by { |p| daily_elo_change(p, league_id) }.max\n best_change.last.each { |b| badges[b] << badge('🔥', 'On Fire') } if !best_change.nil? && best_change.first >= 10\n\n # poop badge\n # worst daily change\n worst_change = players.group_by { |p| daily_elo_change(p, league_id) }.min\n worst_change.last.each { |b| badges[b] << badge('💩', 'Rough Day') } if !worst_change.nil? && worst_change.first <= -10\n\n # baby badge\n # 10-15 games played\n babies = players.select do |p|\n games_with_player(p, league_id, 20).length.between?(10, 15)\n end\n babies.each { |b| badges[b] << badge('👶🏼', 'Newly Ranked') } unless all_games.length < 100 || babies.nil?\n\n # monkey badge\n # won last game but elo went down\n # flexing badge\n # won last game and gained 10+ elo\n players.select do |p|\n games = games_with_player(p, league_id, 1)\n next if games.empty?\n last_game = api_game(games.first, league_id)\n winner = last_game[:teams][0][:players].any? { |a| a[:playerID] == p }\n badges[p] << badge('🙈', 'Monkey\\'d') if last_game[:teams][0][:delta] < 0 && winner\n badges[p] << badge('🍌', 'Graceful Loss') if last_game[:teams][0][:delta] < 0 && !winner\n badges[p] << badge('💪🏼', 'Hefty Win') if last_game[:teams][0][:delta] >= 10 && winner\n badges[p] << badge('🤕', 'Hospital Bound') if last_game[:teams][0][:delta] >= 10 && !winner\n end\n\n # toilet badge\n # last skunk (lost w/ 0 points)\n toilet_game = all_games.find do |g|\n (api_game(g, league_id)[:teams][1][:score]).zero?\n end\n toilets = api_game(toilet_game, league_id)[:teams][1][:players] if toilet_game\n toilets.each { |b| badges[b[:playerID]] << badge('🚽', 'Get Rekt') } unless toilets.nil?\n\n # win streak badges\n # 5 and 10 current win streak\n win_streaks = {}\n players.each do |p|\n games = games_with_player(p, league_id, 20)\n last_wins = games.take_while do |g|\n game = api_game(g, league_id)\n game[:teams][0][:players].any? { |a| a[:playerID] == p }\n end\n win_streaks[p] = last_wins.length\n end\n\n win_streaks.each do |p, s|\n badges[p] << badge(\"#{s}⃣\", \"#{s}-Win Streak\") if s.between?(3, 9)\n badges[p] << badge('💰', \"#{s}-Win Streak\") if s.between?(10, 19)\n badges[p] << badge('👑', '20+ Win Streak') if s >= 20\n end\n\n # zzz badge\n # hasn't played a game in 2 weeks\n if league_id == 1\n sleepers = players.select do |p|\n player_snoozin(p, league_id)\n end\n sleepers.each { |b| badges[b] << badge('💤', 'Snoozin\\'') }\n end\n\n # nemesis and ally badges\n if player_id > 0\n nemeses = []\n allies = []\n you = api_player(player_id, true, league_id)\n players.each do |p|\n this_player = api_player(p, false, league_id)\n nemeses << p if this_player[:displayName] == you[:nemesis]\n allies << p if this_player[:displayName] == you[:ally]\n end\n nemeses.each { |b| badges[b] << badge('😈', 'Your Nemesis') }\n allies.each { |b| badges[b] << badge('😇', 'Your Ally') }\n end\n\n # build hash\n badges.collect do |k, v|\n {\n playerID: k,\n badges: v\n }\n end\nend", "def verify_weekend_warrior(badge_user,expected_earned_date,expected_total_warrior_badges,reason)\n warrior = badge_user.badges.reload.detect{|b|b.badge_key==Badge::WeekendWarrior && b.earned_date == expected_earned_date} \n if warrior\n if badge_user.badges.select{|b|b.badge_key==Badge::WeekendWarrior}.size == expected_total_warrior_badges\n # bacon pancaaaaaaaaakes\n return true\n else\n puts \"boo! weekend warrior badge doesn't work! (#{reason}) badges below\"\n puts y(badge_user.badges)\n return false\n end\n else\n puts \"boo! weekend warrior badge doesn't work! (#{reason}, badge not earned for #{expected_earned_date}). badges below\"\n puts y(badge_user.badges)\n return false\n end\nend", "def pbTypeImmunityByAbility(type,attacker,opponent)\n return false if attacker.index==opponent.index\n return false if attacker.hasMoldBreaker\n if opponent.hasWorkingAbility(:SAPSIPPER) && isConst?(type,PBTypes,:GRASS)\n PBDebug.log(\"[Ability triggered] #{opponent.pbThis}'s Sap Sipper (made #{@name} ineffective)\")\n if opponent.pbCanIncreaseStatStage?(PBStats::ATTACK,opponent)\n opponent.pbIncreaseStatWithCause(PBStats::ATTACK,1,opponent,PBAbilities.getName(opponent.ability))\n else\n @battle.pbDisplay(_INTL(\"{1}'s {2} made {3} ineffective!\",\n opponent.pbThis,PBAbilities.getName(opponent.ability),self.name))\n end\n return true\n end\n if (opponent.hasWorkingAbility(:STORMDRAIN) && isConst?(type,PBTypes,:WATER)) ||\n (opponent.hasWorkingAbility(:LIGHTNINGROD) && isConst?(type,PBTypes,:ELECTRIC))\n PBDebug.log(\"[Ability triggered] #{opponent.pbThis}'s #{PBAbilities.getName(opponent.ability)} (made #{@name} ineffective)\")\n if opponent.pbCanIncreaseStatStage?(PBStats::SPATK,opponent)\n opponent.pbIncreaseStatWithCause(PBStats::SPATK,1,opponent,PBAbilities.getName(opponent.ability))\n else\n @battle.pbDisplay(_INTL(\"{1}'s {2} made {3} ineffective!\",\n opponent.pbThis,PBAbilities.getName(opponent.ability),self.name))\n end\n return true\n end\n if opponent.hasWorkingAbility(:MOTORDRIVE) && isConst?(type,PBTypes,:ELECTRIC)\n PBDebug.log(\"[Ability triggered] #{opponent.pbThis}'s Motor Drive (made #{@name} ineffective)\")\n if opponent.pbCanIncreaseStatStage?(PBStats::SPEED,opponent)\n opponent.pbIncreaseStatWithCause(PBStats::SPEED,1,opponent,PBAbilities.getName(opponent.ability))\n else\n @battle.pbDisplay(_INTL(\"{1}'s {2} made {3} ineffective!\",\n opponent.pbThis,PBAbilities.getName(opponent.ability),self.name))\n end\n return true\n end\n if (opponent.hasWorkingAbility(:DRYSKIN) && isConst?(type,PBTypes,:WATER)) ||\n (opponent.hasWorkingAbility(:VOLTABSORB) && isConst?(type,PBTypes,:ELECTRIC)) ||\n (opponent.hasWorkingAbility(:WATERABSORB) && isConst?(type,PBTypes,:WATER))\n PBDebug.log(\"[Ability triggered] #{opponent.pbThis}'s #{PBAbilities.getName(opponent.ability)} (made #{@name} ineffective)\")\n healed=false\n if opponent.effects[PBEffects::HealBlock]==0\n if opponent.pbRecoverHP((opponent.totalhp/4).floor,true)>0\n @battle.pbDisplay(_INTL(\"{1}'s {2} restored its HP!\",\n opponent.pbThis,PBAbilities.getName(opponent.ability)))\n end\n end\n if !healed\n @battle.pbDisplay(_INTL(\"{1}'s {2} made {3} useless!\",\n opponent.pbThis,PBAbilities.getName(opponent.ability),@name))\n end\n return true\n end\n if opponent.hasWorkingAbility(:FLASHFIRE) && isConst?(type,PBTypes,:FIRE)\n PBDebug.log(\"[Ability triggered] #{opponent.pbThis}'s Flash Fire (made #{@name} ineffective)\")\n if !opponent.effects[PBEffects::FlashFire]\n opponent.effects[PBEffects::FlashFire]=true\n @battle.pbDisplay(_INTL(\"{1}'s {2} raised its Fire power!\",\n opponent.pbThis,PBAbilities.getName(opponent.ability)))\n else\n @battle.pbDisplay(_INTL(\"{1}'s {2} made {3} ineffective!\",\n opponent.pbThis,PBAbilities.getName(opponent.ability),self.name))\n end\n return true\n end\n if opponent.hasWorkingAbility(:TELEPATHY) && pbIsDamaging? &&\n !opponent.pbIsOpposing?(attacker.index)\n PBDebug.log(\"[Ability triggered] #{opponent.pbThis}'s Telepathy (made #{@name} ineffective)\")\n @battle.pbDisplay(_INTL(\"{1} avoids attacks by its ally Jermon!\",opponent.pbThis))\n return true\n end\n if opponent.hasWorkingAbility(:BULLETPROOF) && isBombMove?\n PBDebug.log(\"[Ability triggered] #{opponent.pbThis}'s Bulletproof (made #{@name} ineffective)\")\n @battle.pbDisplay(_INTL(\"{1}'s {2} made {3} ineffective!\",\n opponent.pbThis,PBAbilities.getName(opponent.ability),self.name))\n return true\n end\n return false\n end", "def has_new_badges?\n if scheduled_achievements.where(due: Time.at(0)..Time.now).exists?\n scheduled_achievements.where(due: Time.at(0)..Time.now)\n .each(&:apply)\n end\n\n achievements.any? { |ach| ach.new_badges? }\n end", "def set_AwardType(value)\n set_input(\"AwardType\", value)\n end", "def remove_awarding!(awardable, awarding)\n current_award = awarding.award\n awardable = awarding.awardable\n awardable_id = awarding.awardable_id\n awardable_type = awarding.awardable_type\n awarding.delete\n return unless current_award.respond_to? :ancestors\n return if current_award.ancestors.empty?\n return unless meets_requirements? Grant.new(awardable, current_award)\n # The awardable did not meet the requirements for this award.\n # Thus this award and all ancestors of this award are voided.\n # We're going to delete all the awardings for these awards.\n # remove awardings where award in current_award.ancestors and is awardable\n Awarding.delete_all(\n 'awardable_type' => awardable_type,\n 'awardable_id' => awardable_id,\n 'award_id' => current_award.ancestors)\n end", "def allows_reward?\n self.class.allows_reward?\n end", "def will_bounce?; bounce_type end", "def add_badge(badge_id)\n badges = JSON.parse(self.badges)\n badges[\"#{badge_id}\"][\"earned\"] = true\n badges[\"#{badge_id}\"][\"earn_date\"] = Date.current\n self.update(badges: badges.to_json)\n end", "def find_bonus_rate(beneficiary_type = :receiver)\n BonusReward.action_bonus_rate(self.source.class, beneficiary_type, self.action, self.tier)\n end", "def update\n @badge = Badge.find_by_key(params['id'])\n @badge.approved_at = Time.now unless session[:admin]\n respond_to do |format|\n if @badge.update_attributes(params[:badge])\n format.html { redirect_to @badge, :notice => 'Badge was successfully updated.' }\n else\n format.html { render :action => \"edit\" }\n end\n end\n end", "def advanced_charge_type\n charge_type == INSURANCE || charge_type == GARAGE_INSURANCE\n end", "def sash_to_badge(action)\n target = case to\n when :action_user\n User.find_by_id(action.user_id) # _by_id doens't raise ActiveRecord::RecordNotFound\n when :itself\n action.target_object(model_name)\n else\n begin\n action.target_object(model_name).send(to)\n rescue NoMethodError\n Rails.logger.warn \"[merit] #{action.target_model.singularize}.find(#{action.target_id}) not found, no badges giving today\"\n return\n end\n end\n if target\n target.create_sash_if_none\n target.sash\n end\n end", "def badge\n positive? ? \"+\" : \"-\"\n end", "def nature(level)\n data = @data['families'].find { |type| type['name'] == 'Nature' }\n badge = data['earnedAchievements'].find { |le| le['familyOrder'] == (level - 1) }\n HQTrivia::Badge.new(badge)\n end", "def awarded_with?(value)\n case value\n when Award\n return awards.any? do |item|\n item == value\n end\n when Array, Set\n return value.any? do |item|\n awarded_with? item\n end\n else\n award_str = value.to_s\n return awards.any? do |item|\n item.name == award_str\n end\n end\n end", "def business(level = 3)\n data = @data['families'].find { |type| type['name'] == 'Business' }\n badge = data['earnedAchievements'].find { |le| le['familyOrder'] == (level - 1) }\n HQTrivia::Badge.new(badge)\n end", "def badges(options={})\n self.class.parse_badges(request(singular(user_id) + \"/badges\", options))\n end", "def bonus?\n kind == 'bonus'\n end", "def user_badges user_id=\"self\"\n response = get(\"/users/#{user_id}/badges\")[\"response\"]\n if response[\"sets\"] and response[\"sets\"][\"groups\"]\n response[\"sets\"][\"groups\"].map!{|group| Foursquared::Response::BadgeGroup.new(self, group)}\n end\n\n if response[\"badges\"]\n response[\"badges\"].each_key do |badge_id|\n response[\"badges\"][badge_id] = badge(badge_id)\n end\n end\n response\n end", "def award\n\tend", "def is_allow?\n type == :A\n end", "def optimal_responders_for_type(type)\n available_capacities = type.able_to_respond_capacities # keys are id's, values are capacities\n capacity_needed = @emergency.type_severity(type)\n\n capacity_state = CapacityState.new(available_capacities, capacity_needed)\n return capacity_state.responder_ids if capacity_state.more_needed_than_available?\n\n optimal_responders_for_state(capacity_state)\n end", "def set_admin_badge\n @badge = Badge.find(params[:id])\n end", "def reputation_threshold_action\n :offer_reward\n end", "def set_badge\n @badge = Badge.find(params[:id])\n end", "def type_fairy?\n return type?(GameData::Types::FAIRY)\n end", "def update_quality(awards)\n awards.each do |award|\n # update blue star plans\n if award.name == 'Blue Star' && award.quality > 0\n award.quality -= 2\n end\n\n # awards passed: 'normal item', 'Blue Distinction Plus', 'Blue Star'\n if award.name != 'Blue First' && award.name != 'Blue Compare' \n if award.quality > 0\n if award.name != 'Blue Distinction Plus' && award.name != 'Blue Star'\n # awards pass 'normal item'\n award.quality -= 1\n end\n end\n else\n # adds quality to 'Blue first' + 'blue compare' that are less then 50\n if award.quality < 50 \n award.quality += 1\n # adds to blue compare\n if award.name == 'Blue Compare'\n if award.expires_in < 11\n if award.quality < 50\n award.quality += 1\n end\n end\n if award.expires_in < 6\n if award.quality < 50\n award.quality += 1\n end\n end\n end\n end\n end\n # after huge if else, all awards.qualities are updates + or - 1\n \n # decrease expiration day by one \n if award.name != 'Blue Distinction Plus'\n award.expires_in -= 1\n end\n \n # this is where you do the logic for degrading based on expired days for normal items and blue star\n if award.expires_in < 0\n if award.name != 'Blue First'\n if award.name != 'Blue Compare'\n if award.quality > 0\n if award.name != 'Blue Distinction Plus' \n # decrease normal items and blue star\n award.quality -= 1\n if award.name == 'Blue Star'\n # blue star degrade twice as much \n award.quality -= 1\n end\n end\n end\n else\n # after expiration quality zero'd for blue compare\n award.quality = 0\n end\n else\n # adds to blue first that are expired\n if award.quality < 50\n award.quality += 1\n end\n end\n end\n end\nend", "def check_object_type(record, attribute, value)\n return unless value && value['objectType']\n unless value && value['objectType'] && (value['objectType'] == 'Agent' || value['objectType'] == 'Group')\n record.errors[attribute] << (options[:message] || \"invalid agent object type\")\n end\n end", "def total_available_amount(bonus_type:)\n if bonus_type.eql?('betting')\n withdrawable_amount + betting_bonus\n elsif bonus_type.eql?('casino')\n withdrawable_amount + casino_bonus\n else\n available_amount\n end\n end", "def can_issue?(user, type = self.type.to_sym)\n Punishment.can_issue?(user, type)\n end", "def set_badge\n @badge = Badge.find(params[:id])\n end", "def set_badge\n @badge = Badge.find(params[:id])\n end", "def set_badge\n @badge = Badge.find(params[:id])\n end", "def earned(badge_id)\n badges = JSON.parse(self.badges)\n badges[\"#{badge_id}\"][\"earned\"]\n end", "def parse_badges(result)\n parse_type(result, \"badge\")\n end", "def owner_only_offers_reward?\n self.rewards_count == 1 && self.rewards.visible[0].sender == self.person\n end", "def backfill_awarded_badges(user)\n MeritRebuilder.new.rebuild_merit_for(user)\n end", "def check_for_breach\n return nil if pledges.empty? || breached?\n\n funding_goal_breached = funded? && (total_pledged - pledges.last.amount) < funding_goal\n half_funding_goal_breached = funded?(0.50) && (total_pledged - pledges.last.amount) < (funding_goal / 2)\n\n # return if there is nothing to do\n return nil unless funding_goal_breached || half_funding_goal_breached\n\n # it was breached!\n if funding_goal_breached\n update_attributes breached: true, breached_at: DateTime.now\n\n # email the fundraiser creator\n person.send_email :notify_creator_of_fundraiser_breached, fundraiser: self\n\n # email all of the backers\n backers.map { |b| b.send_email :notify_backers_of_fundraiser_breached, fundraiser: self }\n\n # send survey emails to backers that selected a reward which requires more info\n rewards.find_each do |reward|\n reward.pledges.joins(:reward).each(&:send_survey_email) if reward.fulfillment_details?\n end\n\n # last but not least... pay the creator!\n payout!\n end\n\n # half way there, and it wasn't just breached\n if half_funding_goal_breached && !funding_goal_breached\n # email the fundraiser creator\n person.send_email :notify_creator_of_fundraiser_half_completion, fundraiser: self\n\n # email all of the backers\n backers.map { |b| b.send_email :notify_backers_of_fundraiser_half_completion, fundraiser: self }\n end\n end", "def badges\n achievements.reduce({}) do |badges, achievement|\n badges.merge(achievement.name => achievement.badges)\n end\n end", "def set_badge\n @badge = Badge.find(params[:id])\n end", "def update\n respond_to do |format|\n if @badge.update(badge_params)\n format.html { redirect_to([:admin, @badge], notice: 'Badge was successfully updated.') }\n format.xml { head :ok }\n website.add_log(user: current_user, action: \"Updated badge: #{@badge.name}\")\n else\n format.html { render action: \"edit\" }\n format.xml { render xml: @badge.errors, status: :unprocessable_entity }\n end\n end\n end", "def manually_awarded?\n actable_type.nil? && actable.nil?\n end", "def find_badgedefs_to_test(user_id, course_id)\n user_badges = Badge.where(user_id: user_id)\n awarded_bd_ids = user_badges.map { |b| b.badge_def_id }\n\n all_course_badgedefs = BadgeDef.where(course_id: course_id, active: true)\n all_bd_ids = all_course_badgedefs.map { |bd| bd.id }\n unawarded_bd_ids = all_bd_ids - awarded_bd_ids\n\n BadgeDef.find(unawarded_bd_ids)\n end", "def update\n respond_to do |format|\n if @badge.update(badge_params)\n format.html { redirect_to @badge, notice: 'Badge was successfully updated.' }\n format.json { render :show, status: :ok, location: @badge }\n else\n format.html { render :edit }\n format.json { render json: @badge.errors, status: :unprocessable_entity }\n end\n end\n end", "def status_badge(article)\n case\n # ======\n #\n # Unpublished\n #\n when article.published_at.nil? && article.embargoed_until.nil?\n \"<span class='badge'>#{status_text(article)}</span>\".html_safe\n\n # ======\n #\n # Published\n #\n when article.published_at.present?\n \"<span class='badge status-active'>#{status_text(article)}</span>\".html_safe\n\n # ======\n #\n # Embargoed\n #\n when article.embargoed_until.present?\n \"<span class='badge status-pending'>#{status_text(article, extended: true)}</span>\".html_safe\n #\n end\n end", "def geography(level)\n data = @data['families'].find { |type| type['name'] == 'Geography' }\n badge = data['earnedAchievements'].find { |le| le['familyOrder'] == (level - 1) }\n HQTrivia::Badge.new(badge)\n end", "def capturable?\n [ :base, :harbour, :airfield ].include?( @type ) and\n @faction != @game.my_faction\n end", "def is_pledge_payment?\n payable_type == 'UserGroup' && goal == 'pledge'\n end", "def index\n @awarded_badges = policy_scope(AwardedBadge).pluck(:badge_id)\n\n @badge_requests = policy_scope(BadgeRequest).where(student: current_user).pluck(:badge_id, :status)\n\n @badges = policy_scope(Badge).left_outer_joins(:badge_requests)\n .where('badge_requests.student_id is null', current_user.id)\n .where.not(id: @awarded_badges)\n end", "def badge_level_up\n\t\tbadge_level_up_aux(\"Birdman\",\"bird\",\"following\",\"follower\") #devo passare il parametro follower poichè non si chiama \"user\" come negli altri casi di badges\n\tend", "def badge_params\n params[:user].permit(:name, :badge, :admin_id)\n end", "def getBadgeClass(result, guess)\n point = getPoints(result, guess)\n if point == 3\n \"badge-success\"\n elsif point == 1\n \"badge-primary\"\n else\n \"badge-default\"\n end\n end", "def blue_magic_learn_by_allies?(user)\n if user.actor?\n return Bubs::BlueMagic::LEARN_BY_ALLIES\n else\n return true\n end\n end", "def badge_image\n badge_type.image_url + year.to_s + \".png\"\n end", "def award?\n # another list comprehension with closures\n grades.all? { |grade| grade == 6 }\n end", "def badges\n get(\"user/#{user_id}/badges.json\")\n end", "def authorize_achievement!\n authorize!(:award, @achievement) if achievement_params.include?(:course_user_ids)\n end", "def bonus_grade?\n return false if grade_entry_item.nil?\n grade_entry_item.bonus?\n end", "def unanimously_accepted?\n if issue\n if issue.fiat?\n issue.bounties.pluck(:person_id).uniq.count == bounty_claim_responses.where(value: true).count\n elsif issue.crypto?\n issue.crypto_bounties.pluck(:owner_id).uniq.reject(&:nil?).count == bounty_claim_responses.where(value: true).count\n end\n elsif pact\n pact.bounties.pluck(:person_id).uniq.count == bounty_claim_responses.where(value: true).count\n end\n end", "def hit\n self.damage = damage + 1\n check_boat\n end", "def badge_level(name)\n these_badges = self.badges.find_all { |b| b.name == name }\n if these_badges.any?\n these_badges.sort_by { |b| b.level }.last.level\n else\n 0\n end\n end", "def badge_level_up\n\t return if recipe.ratings.where(user_id: user.id).first.score == 0 \n\t\tbadge_level_up_aux(\"Critic\",\"critic\",\"ratings\")\n\tend" ]
[ "0.6292739", "0.61310035", "0.6009031", "0.5941763", "0.5928707", "0.59059054", "0.583447", "0.5803822", "0.5802567", "0.5726422", "0.5684858", "0.5675342", "0.5619803", "0.5567785", "0.55570734", "0.5527625", "0.5522571", "0.5483815", "0.5443195", "0.5434529", "0.54320854", "0.5409408", "0.53786814", "0.535505", "0.5352301", "0.5349757", "0.5335671", "0.5324935", "0.53068465", "0.5301496", "0.5204905", "0.51923525", "0.5191977", "0.51821184", "0.51717025", "0.5145999", "0.51447517", "0.5131084", "0.5125336", "0.5122792", "0.50992143", "0.5087485", "0.50745255", "0.5065305", "0.50605214", "0.50575787", "0.5042413", "0.50372684", "0.50334823", "0.5029643", "0.5028973", "0.50259775", "0.5017474", "0.5015665", "0.50126725", "0.5003781", "0.50027066", "0.50014", "0.50000733", "0.4996095", "0.4982061", "0.49793866", "0.4970005", "0.49505973", "0.49218208", "0.49179658", "0.49124867", "0.4905645", "0.48892903", "0.48892903", "0.48892903", "0.48797867", "0.4877861", "0.48760253", "0.4867625", "0.48662776", "0.48635402", "0.48583403", "0.4853982", "0.4847217", "0.48445207", "0.4844441", "0.4830745", "0.4829046", "0.48285383", "0.48263064", "0.481394", "0.4812769", "0.48078677", "0.4802316", "0.479506", "0.4792934", "0.47876424", "0.4785321", "0.4783613", "0.47813883", "0.4778457", "0.47738764", "0.47577685", "0.47557276" ]
0.70889163
0
Parse out the main components of the BLAST output file in preparation for result display
def hits_prev # see PsiBlastJob for comment end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse\n # TODO: Try to convert lsynth parts, maybe flag parts that are troublesome for manual editing,\n # look up to see if I've stored a conversion from ldraw ID to Bricklink ID,\n # convert Ldraw color IDs to BL color IDs, etc.\n parts = {}\n temp_parts = []\n\n @lines.each_with_index do |line, i|\n # This will stop getting parts for the base model once a submodel is reached\n break if line.match(/0 FILE/) && i > 15\n\n @submodels << line.match(/\\w+\\.ldr/).to_s.downcase if line.match(/^1/) && line.match(/\\.ldr$/)\n @lsynthed_parts << line.gsub('0 SYNTH BEGIN', '').split if line =~ /^0 SYNTH BEGIN/\n next unless line.match(/^1/) && line.match(/.dat$/)\n\n part = line.match(/\\w+\\.dat/).to_s.gsub!('.dat', '')\n next if lsynth_part?(part)\n\n color = line.match(/^1\\s\\d+/).to_s.gsub!('1 ', '')\n bl_part = get_bl_part_number(part)\n temp_parts << [bl_part, color, part]\n end\n\n # Now go through all submodels to determine the parts belonging to the submodels\n temp_parts = handle_submodels(temp_parts)\n\n # Not yet functional\n # handle_lsynthed_parts(temp_parts)\n\n temp_parts.each do |info|\n if parts.key?(\"#{info[0]}_#{info[1]}\")\n parts[\"#{info[0]}_#{info[1]}\"]['quantity'] += 1\n else\n parts[\"#{info[0]}_#{info[1]}\"] = {}\n parts[\"#{info[0]}_#{info[1]}\"]['quantity'] = 1\n parts[\"#{info[0]}_#{info[1]}\"]['ldraw_part_num'] = info[2]\n end\n end\n\n parts\n end", "def parse_input(input_file); end", "def parse_input(input_file); end", "def process_output\n\tcounter = 1\n\t\t@parsed[\"businesses\"].each do |x|\n\t\t\tputs \"#{counter} Name: \" + x[\"name\"] + \" Rating:\" + x[\"rating\"].to_s\n\t\t\tcounter +=1 \n\t\tend\n\tend", "def parse\n wo_lines = IO.readlines( @file_dir )\n @current_group = get_group( \"default\" )\n @current_material_name = \"default\"\n puts(\"+Loading .obj file:\\n \\\"#{@file_dir.sub(ROOT, '')}\\\"\") if @verbose\n # parse file context\n wo_lines.each do |line|\n tokens = line.split\n # make sense of the object tokens\n string = line.sub(\"\\r\", \"\")\n process_line(tokens[0], tokens[1..tokens.length-1], string.sub(\"\\n\", \"\"))\n end\n @object_name = @file_dir.split('/').last\n @object_name.sub!(\".obj\", '')\n # verbose status updates\n puts(\"+Object name is \\\"#{@object_name}\\\" with (#{@objects.size}) Internal Objects.\") if @verbose\n if get_group(\"default\").faces.empty?\n @groups.delete(\"default\")\n end\n @current_group = nil\n @current_material_name = nil\n end", "def parse_output(_report, _result, _targets); end", "def parse_dotfile\n # the chunk is everything inside '{}'\n raw_chunk = @raw_dotfile.split(\"{\")[1].split(\"}\")[0].strip\n # pull out the header\n raw_header = raw_chunk.match(/([\\w\\s*=\".,\\s\\[\\]_\\\\]+;)*/m)[0]\n # find body by chopping header off chunk\n raw_body = raw_chunk.sub(raw_header, \"\")\n # split the body on '>];', which delimits the tables section\n raw_connections = raw_body.split(\">];\")[-1].strip\n # split out the tables section from the body\n raw_tables = raw_body.split(\">];\")[0 .. -2].join(\">];\").strip + \" \\n>];\"\n\n # assemble the output hash\n @graph_type = @raw_dotfile.match(/\\A\\s*((?:di)?graph)/)[1]\n @title = @raw_dotfile.match(/\\A\\s*(?:di)?graph\\s*(\\w+)/)[1]\n @header = parse_header(raw_header, \";\")\n @nodes = parse_nodes(raw_tables)\n @connections = parse_connections(raw_connections)\n end", "def parse(output)\n lines = output.strip.split(\"\\n\").drop(1)\n lines.map do |line|\n JobInfo.new(*(line.split(\"|\", 6)))\n end\n end", "def perform\n params_dump\n\n ### KEEPING FORMER ROUNDS\n #@commands << \"cp #{@outfile} #{@outfile}.former\" \n # Export variable needed for HHSuite\n #@commands << \"export HHLIB=#{HHLIB} \"\n #@commands << \"export PATH=$PATH:#{HHSUITE}\" \n \n # cmd for blast run\n @commands << \"source #{SETENV}\" \n @commands << \"echo 'Starting BLAST search' &> #{job.statuslog_path}\"\n @commands << \"#{CSBLAST}/bin/csblast -i #{@infile} -j #{@rounds} -h #{@e_thresh} -D #{CSBLAST}/data/K4000.crf #{@alignment} --blast-path #{BLAST}/bin -e #{@expect} -F #{@filter} -G #{@gapopen} -E #{@gapext} -v #{@descriptions} -b #{@alignments} -T T -o #{@outfile} -d \\\"#{@db_path}\\\" -I T -a 1 #{@other_advanced} >>#{job.statuslog_path}\"\n \n @commands << \"echo 'Finished BLAST search' >> #{job.statuslog_path}\"\n # run perl script to fix blast errors. TODO: Find out what script does \n @commands << \"echo 'Fixing BLAST errors' >> #{job.statuslog_path}\" \n @commands << \"#{UTILS}/fix_blast_errors.pl -i #{@outfile} &>#{@basename}.log_fix_errors\"\n # run perl script to visualize blast results. TODO: Find out what script does\n @commands << \"echo 'Visualizing BLAST Output' >> #{job.statuslog_path}\" \n @commands << \"#{UTILS}/blastviz.pl #{@outfile} #{job.jobid} #{job.job_dir} #{job.url_for_job_dir_abs} &> #{@basename}.blastvizlog\";\n # run perl script to process blast history. TODO: Find out what script does\n @commands << \"echo 'Generating Blast Histograms... ' >> #{job.statuslog_path}\"\n @commands << \"#{UTILS}/blasthisto.pl #{@outfile} #{job.jobid} #{job.job_dir} &> #{@basename}.blasthistolog\";\n \n # run perl script to create alignment\n @commands << \"echo 'Processing Alignments... ' >> #{job.statuslog_path}\"\n @commands << \"#{UTILS}/alignhits_html.pl #{@outfile} #{@basename}.align -fas -no_link -e #{@expect}\"\n # run perl script to reformat alignment TODO: Find out what script does\n @commands << \"reformat.pl fas fas #{@basename}.align #{@basename}.ralign -M first -r\"\n # TODO: Find out what script does\n @commands << \"if [ -s #{@basename}.ralign ]; then hhfilter -i #{@basename}.ralign -o #{@basename}.ralign -diff 50; fi\"\n # TODO: Find out what script does\n @commands << \"#{RUBY_UTILS}/parse_csiblast.rb -i #{@basename}.csblast -o #{@basename}.csblast\"\n # Generate Jalview Output from alignment data\n @commands << \"echo 'Creating Jalview Input... ' >> #{job.statuslog_path}\"\n @commands << \"#{RUBY_UTILS}/parse_jalview.rb -i #{@basename}.ralign -o #{@basename}.j.align\" \n # TODO: Find out what script does\n @commands << \"reformat.pl fas fas #{@basename}.j.align #{@basename}.j.align -r\"\n\n\n @commands << \"source #{UNSETENV}\" \n\n logger.debug \"Commands:\\n\"+@commands.join(\"\\n\")\n # Submit generated cmd list to queue\n queue.submit(@commands)\n\n end", "def parse\n self.data = BdlFile.strip_comments self.data\n save!\n tokenize\n Instruction.create_references!\n end", "def parsed; end", "def parsed; end", "def parse_input (input_file)\nend", "def output(base_dir)\n # check $map_bset_types\n fail \"set $map_bset_types in ./railroadmap/abstraction.rb file\" if $map_bset_types.nil?\n\n # main model\n b_file = base_dir + '/railroadmap.mch'\n open(b_file, \"w\") do |f|\n f.write \"/* Generated by railroadmap */\\n\"\n f.write \"MACHINE railroadmap\\n\"\n f.write \"SETS\\n\"\n f.write \" USER={user1, user2, anonymous};\\n\"\n f.write \" EMAIL={email1, email2};\\n\"\n f.write \" PASSWORD={password1, password2};\\n\"\n f.write \" FLAG={on, off};\\n\"\n f.write \" TEXT={text1, text2};\\n\"\n f.write \" TOKEN={good, bad};\\n\"\n f.write \" STATE={\\n\"\n\n $abst_states.each do |n, s|\n sid = escape(s.id)\n f.write \" #{sid},\\n\"\n end\n\n f.write \" root_start, root_end\\n\"\n f.write \" };\\n\"\n f.write \" MESSAGE={ok, login_failed, error1, error2}\\n\"\n f.write \" \\n\"\n f.write \" \\n\"\n f.write \"CONSTANTS\\n\"\n f.write \" APPLICATION_USER\\n\"\n f.write \" \\n\"\n f.write \" \\n\"\n f.write \"PROPERTIES\\n\"\n f.write \" APPLICATION_USER <: USER & APPLICATION_USER /= {}\\n\"\n f.write \" \\n\"\n f.write \" \\n\"\n f.write \"VARIABLES\\n\"\n f.write \" user, state, message, signed_in, post_error, save, update, csrf_token\\n\"\n f.write \" \\n\"\n f.write \" \\n\"\n f.write \"INVARIANT\\n\"\n f.write \" user:USER &\\n\"\n f.write \" state:STATE &\\n\"\n f.write \" message:MESSAGE &\\n\"\n f.write \" signed_in:BOOL &\\n\"\n f.write \" post_error:BOOL &\\n\"\n f.write \" save:BOOL &\\n\"\n f.write \" update:BOOL &\\n\"\n f.write \" csrf_token:TOKEN\\n\"\n f.write \" \\n\"\n f.write \" \\n\"\n # TODO: set by init table?\n f.write \"INITIALISATION\\n\"\n f.write \" user,state,message,signed_in,post_error,save,update,csrf_token \"\n f.write \":= anonymous, C_welcome_index, ok, FALSE, FALSE, FALSE, FALSE, good\\n\"\n f.write \" \\n\"\n f.write \" \\n\"\n\n # OPERATIONS\n f.write \"OPERATIONS\\n\"\n opcnt = 0\n\n $abst_transitions.each do |n, t|\n if t.invalid == false\n # OPERATION ID\n opid = 't' + opcnt.to_s + '_' + t.type\n # TODO: POST(submit) has more args\n pre1 = ''\n if t.type == 'submit' && t.variables.size > 0\n arg = ''\n t.variables.each do |v|\n arg << v + ', '\n # TODO: check $map_bset_types\n v2 = $map_bset_types[v]\n v2 = 'ruby(' + v + ')' if v2.nil?\n pre1 << v + ':' + v2 + ' & '\n end\n arg << 'u, dst' # TODO\n else\n arg = 'u, dst' # default args\n end\n\n # TODO: check inconsistent transition. (= BUG)\n if $abst_states[t.src_id].nil?\n # error \"#{t.src_id} -> #{t.dst_id}, src is missing, skip or abort\"\n elsif $abst_states[t.dst_id].nil?\n # error \"#{t.src_id} -> #{t.dst_id}, dst is missing, skip or abort\"\n else\n # OK\n src_id = escape(t.src_id)\n dst_id = escape(t.dst_id)\n\n # Pre condition\n pre = rg2bp(t.block.abst_condition_success)\n\n # Action\n action = ra2ba($abstmap_action[t.block.id])\n f.write \"\\n\"\n f.write \" #{opid}(#{arg})=\\n\"\n f.write \" PRE\\n\"\n f.write \" #{pre1}u:APPLICATION_USER & dst:STATE &\\n\"\n\n # before filter authenticated => signed_in = TRUE\n dst = $abst_states[t.dst_id]\n f.write \" signed_in = TRUE &\\n\" if dst.is_authenticated\n f.write \" #{pre} &\\n\" if pre != ''\n f.write \" dst = #{dst_id} &\\n\"\n f.write \" state = #{src_id}\\n\"\n f.write \" THEN\\n\"\n f.write \" #{action} ||\\n\" if action != ''\n f.write \" state:=#{dst_id}\\n\"\n f.write \" END;\\n\"\n end\n # count all trans\n opcnt = opcnt + 1\n end # if\n end # DO\n f.write \" Dummy(u)=\\n\"\n f.write \" PRE\\n\"\n f.write \" u: APPLICATION_USER & state = root_start\\n\"\n f.write \" THEN\\n\"\n f.write \" state := root_end\\n\"\n f.write \" END\\n\"\n f.write \"END\\n\"\n end # do f\n # LTL\n end", "def parse\n \n # TODO: Because the Gemfile parser will look at any file without a suffix\n # it is important to make sure that the filename is actually Gemfile\n \n gemfile = File.basename(@file)\n \n log.info \"Gemfile - Bundler: #{gemfile}\"\n \n # Use Bundler's DSL evaluator to generate the domain objects\n bundle = Bundler::Dsl.new\n bundle.instance_eval(@source, @file, 1)\n \n # Bundler::Dsl does grant access to the instance variables so we will \n # add attribute readers to allow us to read the following attributes.\n\n class << bundle\n attr_reader :rubygems_source, :sources, :dependencies, :groups, :platforms\n end\n \n end", "def process_gbff(blast_result_hash,gbff_db,flanking_res,fna_hash)\n gbff_file = File.new(gbff_db,'r')\n while(line = gbff_file.gets)\n position = line.split()\n if(position[0] == \"LOCUS\")\n endo_proteins = process_organism_gbff(gbff_file,blast_result_hash,flanking_res,fna_hash)\n output_endo_proteins(endo_proteins,flanking_res)\n end\n end\nend", "def parse\n info \"---- Digest DB and store data in mRNA Hash (NoCache)\"\n @count_ids = Counter.new # Count ids\n @count_seqnames = Counter.new # Count seqnames\n @componentlist = SeekRecList.new(@iter.fh,@options[:parser]) # Store containers, like genes, contigs\n @orflist = SeekLinkedRecs.new # Store linked gene records\n @mrnalist = SeekLinkedRecs.new # Store linked mRNA records\n @cdslist = SeekLinkedRecs.new\n @exonlist = SeekLinkedRecs.new\n @sequencelist = {}\n @unrecognized_features = {}\n @iter.each_rec do |fpos, line|\n rec = case @options[:parser]\n when :bioruby\n Bio::GFF::GFF3::BioRubyFileRecord.new(fpos, line)\n when :line\n Bio::GFF::GFF3::FastParserFileRecord.new(fpos, line)\n else\n raise 'Unknown parser'\n end\n store_record(rec)\n end\n @iter.each_sequence do | id, bioseq |\n @sequencelist[id] = bioseq.to_s\n end\n validate_mrnas \n validate_cdss\n show_unrecognized_features\n @genelist = @count_ids.keys \n read_fasta\n end", "def parse\n @meta = parse_meta\n @comments = parse_comments\n @sensors = parse_sensors\n @workout = parse_workout\n @intervals = parse_intervals\n @interval_samples = parse_interval_samples\n end", "def parse; end", "def parse; end", "def parse; end", "def parse\n parse_file\n self\n end", "def parse \n info \"---- Digest DB and store data in mRNA Hash\"\n @count_ids = Counter.new # Count ids\n @count_seqnames = Counter.new # Count seqnames\n @componentlist = {} # Store containers, like genes, contigs\n @orflist = LinkedRecs.new\n @mrnalist = LinkedRecs.new # Store linked mRNA records\n @cdslist = LinkedRecs.new\n @exonlist = LinkedRecs.new\n @sequencelist = {}\n @unrecognized_features = {}\n @gff.records.each do | rec |\n store_record(rec)\n end\n @gff.sequences.each do | bioseq |\n id = bioseq.entry_id\n @sequencelist[id] = bioseq.to_s # in Bio::Sequence with contained Bio::FastaFormat\n end\n validate_mrnas\n validate_cdss \n show_unrecognized_features \n @genelist = @count_ids.keys \n log_sys_info(\"After reading GFF\")\n read_fasta\n log_sys_info(\"After reading FASTA\")\n end", "def processa_bc\n # puts(format(\"%<n>4i ATTESTATIONS INSERIDAS #{BD}.eth2at\", n: apibc.novtx.empty? ? 0 : dml(eth2at_ins)))\n # puts(format(\"%<n>4i PROPOSALS INSERIDAS #{BD}.eth2pr\", n: apibc.novkx.empty? ? 0 : dml(eth2pr_ins)))\n puts(format(\"%<n>4i BALANCES\\tETH2\\t\\tINSERIDOS eth2bh\", n: apibc.nov.empty? ? 0 : dml(eth2bh_ins)))\n end", "def parse\n @file_data.each {|line|\n h = {}\n data_elements = line.split('|').collect(&:strip)\n #LastName | FirstName | MiddleInitial | Gender | FavoriteColor | DateOfBirth\n @data_collection << {:last_name => data_elements[0], :first_name => data_elements[1], :middle_initial => data_elements[2], :gender => (data_elements[3] == 'M') ? 'Male' : 'Female', :favorite_color => data_elements[4], :dob => data_elements[5].gsub('-', '/'), :dob_year => data_elements[5][-4,4]}\n }\n end", "def process\n out = ''\n @filtered.each do |line|\n p = Parser.new(line)\n out += p.process\n end\n out\n end", "def parse\n input_data.each do |filename, data|\n rowdata_template = OpenStruct.new\n @preprocess_block.call(filename, rowdata_template) if @preprocess_block\n\n arrived_at_table_data = false\n\n data.split(\"\\r\\n\").each do |line|\n next if line.strip.empty? # Skip blank and whitespace lines\n\n if !arrived_at_table_data\n next if line =~ /\\ACreated by SunData/ # Skip created by line\n if date_match = line.match(/\\A(\\d\\d\\d\\d-\\d\\d-\\d\\d)\\t\\tLocal time is (GMT.\\d+ Hrs)/)\n rowdata_template.date = date_match[1]\n rowdata_template.timezone = date_match[2]\n end\n\n if sunscan_match = line.match(/\\ASunScan probe (v.*)/)\n rowdata_template.sunscan_version = sunscan_match[1]\n end\n\n if matches = line.scan(/\\s*([^\\t:]+)\\s*:\\s*([^\\t:]+)/)\n matches.flatten.map(&:strip).each_slice(2) do |key, value|\n next if value.nil? || value.empty?\n rowdata_template[key.downcase.gsub(\" \", \"_\")] = value\n end\n end\n\n # Once we hit the table hearder we can start processing tabular data.\n # The header is two lines long because of the formatting.\n next if line =~ /\\ATime\\tPlot\\t/\n arrived_at_table_data = true and next if line =~ /\\s+mitted\\s+ent/\n\n\n else\n rowdata = rowdata_template.dup\n table_line = line.split(\"\\t\")\n rowdata.time = table_line[0]\n rowdata.plot = table_line[1]\n rowdata.sample = table_line[2]\n rowdata.transmitted = table_line[3]\n rowdata.spread = table_line[4]\n rowdata.incident = table_line[5]\n rowdata.beam = table_line[6]\n rowdata.zenith_angle = table_line[7]\n rowdata.lai = table_line[8]\n rowdata.notes = table_line[9]\n # Only record output data once the full line data has been captured.\n output_data << rowdata\n end\n end\n end\n end", "def parse_file()\n\n if !self.has?()\n return\n end\n\n @logs = {}\n @configs = {}\n current_index = 0\n current_config = {}\n parsing_config = false\n config_script = \"\"\n\n ::IO.foreach(self.path()) do |line|\n line.strip!\n if line.match(/\\}/)\n parsing_config = false\n @configs[current_index] = current_config\n current_config = {}\n current_index += 1\n config_script = \"\"\n\n else\n\n if parsing_config\n config = line.split(/\\s+/, 2)\n config.reject!(&:empty?) # Oh Ruby, why do you have 10 ways to do everything?\n #config[0].strip!\n\n if config[0] == \"postrotate\"\n config_script = config[0]\n current_config[config[0]] = []\n\n else\n\n if config_script != \"\"\n if config[0] == \"endscript\"\n current_config[config_script] << config[0]\n #current_config[config[0]] = \"\"\n config_script = \"\"\n\n else\n #line.strip!\n current_config[config_script] << line\n\n end\n\n else\n val = true\n if config.length == 2\n val = config[1]\n end\n current_config[config[0]] = val\n\n end\n end\n\n else\n logs = line.split(/\\s+/)\n logs.reject! { |c| c.empty? || c == \"{\" } # remove blank entries\n logs.each do |log|\n log.strip!\n @logs[log] = current_index\n end\n\n if line.match(/\\{/)\n parsing_config = true\n end\n\n end\n\n end\n\n\n end # foreach\n\n end", "def parse_all\n while parse_one_entry; end\n end", "def proccess\n # data = get_data\n separate_bets\n end", "def parse_file(filename); end", "def parse\n @parts = []\n\n sect = text.split(/^\\-\\-\\-/)\n\n if sect.size == 1\n @header = {}\n @parts << Part.new(sect[0]) #, *[@stencil, @default].compact.flatten)\n else\n sect.shift if sect.first.strip.empty?\n\n head = sect.shift\n head = YAML::load(head)\n parse_header(head)\n\n sect.each do |body|\n index = body.index(\"\\n\")\n formats = body[0...index].strip\n formats = formats.split(/\\s+/) if String===formats\n #formats = @default if formats.empty?\n #formats.unshift(@stencil) if @stencil\n text = body[index+1..-1]\n @parts << Part.new(text, *formats)\n end\n end\n end", "def before_results(controller_params)\n @num_seqs = 0\n\n resfile = File.join(job_dir, jobid+\".aln\")\n raise(\"ERROR with resultfile!\") if !File.readable?(resfile) || !File.exists?(resfile) || File.zero?(resfile)\n res = IO.readlines(resfile).map {|line| line.chomp}\n\n # get the header\n @header = res.shift\n\n #get the alignment blocks\n @aln_blocks = []\n block = []\n num = 0\n res.each do |line|\n if (line =~ /^\\s*$/)\n if (!block.empty?)\n @aln_blocks.push(block)\n block = []\n if (@num_seqs == 0) then @num_seqs = num end\n num = 0\n end\n next\n end\n\n if (line !~ /^\\s+/) then num += 1 end\n block.push(line)\n end\n\n if (!block.empty?)\n @aln_blocks.push(block)\n end\n end", "def parse_input(params)\n puts \"============ Job will execute with following order =================\"\n puts Parser.sort_jobs!(Parser.parse_params(params))\n puts \"============ ************************************* =================\"\n Parser.sort_jobs!(Parser.parse_params(params))\n end", "def display ( )\n puts 'Parser states: ' + @states.size.to_s\n\n @states.each do |st|\n\tputs\n\tputs '*' * 80\n\tputs 'state: ' + st.statename\n\tputs 'branches: '\n\tst.branches.each do |br|\n\t puts ' ' + @states[br].statename\n\tend\n end\n end", "def parseFile(player, fName)\n typetoi = { \"DAT\" => 0, \"MOV\" => 1, \"ADD\" => 2, \"SUB\" => 3, \"JMP\" => 4, \"JMZ\" => 5, \"DJZ\" => 6, \"CMP\" => 7}\n modetoi = { \"\\#\" => 0, \"\\$\" => 1, \"\\@\" => 2}\n bufCore = [] # Holds the compiled programs for each player\n f = File.open(fName, \"r\") # Open fName for reading\n puts \"Parsing file: \" + fName\n f.each_line do |line| \n puts line\n line.slice!(/;.*/) # Delete comments\n line1 = line.upcase\n typeIndex = /[A-Z][A-Z][A-Z]/ =~ line1 # Get Type\n if typeIndex != nil # Type exists\n type = $~[0]\n puts \" Type: \" + type\n line1 = $~.post_match # Trim out the type\n numIndex = /[\\-|\\+|\\d]\\d*/ =~ line1 # Get First Field\n \n if numIndex == nil\n puts \"Error, no Fields\"\n else\n fieldA = $~[0].to_i\n end #numIndex...\n \n line1 = $~.pre_match # Before the first field\n line2 = $~.post_match # After the first field\n \n modeIndex = /[\\#\\$\\@]/ =~ line1 # Get Mode for first field\n \n if modeIndex == nil\n modeA = \"$\"\n else\n modeA = $~[0]\n end # if modeIndex\n puts \" ModeA: \" + modeA # Print the assembled instruction\n puts \" FieldA: #{fieldA}\"\n\n numIndex = /[\\-|\\+|\\d]\\d*/ =~ line2 # Get Second Field\n \n if numIndex == nil\n fieldB = fieldA # Copy first field & mode if no second\n modeB = modeA\n else\n fieldB = $~[0].to_i\n\n line1 = $~.pre_match # Before the second field\n\n modeIndex = /[\\#\\$\\@]/ =~ line1 # Get Mode for second field\n if modeIndex == nil\n modeB = \"$\"\n else\n modeB = $~[0]\n end\n end # if numIndex...\n \n puts \" ModeB: \" + modeB\n puts \" FieldB: #{fieldB}\"\n puts \" Opcode: #{typetoi[type]}, #{modetoi[modeA]}, #{fieldA}, #{modetoi[modeB]}, #{fieldB}\"\n bufCore << [typetoi[type], modetoi[modeA], fieldA, modetoi[modeB], fieldB, player]\n end #if typeIndex...\n # Instruction Regexp: /[A-Za-z]+|[#$@]|[[-|+]\\d+]/ \n # Comment Regexp: /;.*/ \n end #each_line\n f.close\n puts \"Core Dump, player[#{player}]:\" # Write out the compiled program\n bufCore.each do |element| \n puts \" #{element[0]}, #{element[1]}, #{element[2]}, #{element[3]}, #{element[4]}\"\n end #bufCore.each\n puts\n bufCore\n end", "def buildInfoTable(out, hmm, dir)\n pepAnn = Hash.new\n pepTax = Hash.new\n pepHmm = Hash.new\n pepHmmAnn = Hash.new\n STDERR.printf(\"Processing %s...\\n\", dir)\n STDERR.printf(\"\\tLoading HMM Data...\\n\")\n `grep #{dir} #{hmm}`.each {|line|\n hmmId, id, sample, ann = line.chomp.split(\"\\t\")\n pepHmm[id] = hmmId.gsub(\",\",\"\")\n pepHmmAnn[id] = ann.gsub(\",\",\"\")\n }\n mainPep = dir + \"/\" + dir + \".pep\"\n if !File.file?(mainPep)\n STDERR.printf(\"Error: no %s\\n\", mainPep)\n exit(1)\n end\n STDERR.printf(\"\\tLoading main peptide file...\\n\")\n `grep \">\" #{mainPep}`.each {|line|\n id = line.chomp.tr(\">\",\"\").split(\" \").first\n pepAnn[id] = \"\"\n pepTax[id] = \"NO_TREE\"\n }\n annPep = dir + \"/\" + \"ann.pep\"\n if !File.file?(annPep)\n STDERR.printf(\"Error: no %s\\n\", annPep)\n exit(1)\n end\n STDERR.printf(\"\\tLoading annotated peptide file...\\n\")\n `grep \">\" #{annPep}`.each {|line|\n id, ann = line.chomp.tr(\">\",\"\").split(\" \", 2)\n pepAnn[id] = ann.gsub(\",\",\"\") if (!ann.nil?)\n pepTax[id] = \"\"\n }\n STDERR.printf(\"\\tLoading taxonomy...\\n\")\n ranks = [\"kingdom\",\"phylum\",\"class\",\"order\",\"family\",\"genus\",\"species\"]\n ranks.each {|level|\n Dir.glob(dir + \"/*\" + level + \".html\").each {|html|\n tax = nil\n if (html =~/is_unresolved/)\n tax = \"Mixed\"\n elsif (html =~/(Contained_within[_]*|Outgroup_of[_]*)(.*)_#{level}/)\n tax = $2.gsub(\",\",\"\")\n else\n STDERR.printf(\"Error: %s cannot be parsed at %s\\n\", html, level)\n exit(1)\n end\n File.new(html).each {|line|\n if (line =~/\\\"blast\\/(.*).blastp/)\n id = $1\n pepTax[id] += tax + \"; \" if (!pepTax[id].include?(\"Mixed\"))\n end\n }\n }\n }\n sample = $1 if (dir =~/(GS[^-]*)/)\n sample.gsub!(/IOLG|IOSM|IOVIR/,\"\")\n size = $1 if (dir =~/-([1-9|-]*(kb|KB))/)\n sample = $1 if sample == \"GS\" && (dir =~/(GS-[0-9]*)/)\n STDERR.printf(\"\\tWriting data...\\n\")\n pepAnn.keys.sort.each {|key|\n out.printf(\"%s,%s,%s,%s,%s,%s,%s,%s\\n\",key, sample, size, \n pepAnn[key], pepTax[key], pepHmm[key], pepHmmAnn[key], dir) \n }\nend", "def file_stats\n\t\ttest_parser = PbfParser.new(file)\n\t\tunless test_parser.nodes.empty?\n\t\t\t@n_count+= test_parser.nodes.size\n\t\tend\n\t\tunless test_parser.ways.empty?\n\t\t\t@w_count+= test_parser.ways.size\n\t\tend\n\t\tunless test_parser.relations.empty?\n\t\t\t@r_count+= test_parser.relations.size\n\t\tend\n\t\twhile test_parser.next\n\t\t\tunless test_parser.nodes.empty?\n\t\t\t\t@n_count+= test_parser.nodes.size\n\t\t\tend\n\t\t\tunless test_parser.ways.empty?\n\t\t\t\t@w_count+= test_parser.ways.size\n\t\t\tend\n\t\t\tunless test_parser.relations.empty?\n\t\t\t\t@r_count+= test_parser.relations.size\n\t\t\tend\n\t\tend\n\t\tputs \"=============================================================\"\n\t\tputs \"Nodes: #{n_count}, Ways: #{w_count}, Relations: #{r_count}\\n\"\n\t\tputs \"=============================================================\\n\"\n\tend", "def print_segments\n\t\t# METHOD: after all of the HL7 content has been parsed, print the contents of each segment in a more easily readible format\n\t\t# output for 1 segment looks like:\n\t\t\t\t\t#~ :: Segment: PID\n\t\t\t\t\t#~ PID-0: Segment => PID\n\t\t\t\t\t#~ PID-1: Set ID - PID => 1\n\t\t\t\t\t#~ PID-2: Patient ID => \n\t\t\t\t\t#~ PID-3: Patient Identifier List => [[\"P00057804\", \"\", \"\", \"\", \"PN\"], [\"4009887514\", \"\", \"\", \"AUSHIC\", \"MC\"], [\"SMIAL001\", \"\", \"\", \"\", \"PI\"]]\n\t\t\t\t\t#~ PID-4: Alternate Patient ID - PID => \n\t\t\t\t\t#~ PID-5: Patient Name => [\"SMITH\", \"Alan\", \"Ross\", \"\", \"Mr\"]\n\t\t\t\t\t#~ PID-6: Mother’s Maiden Name => \n\t\t\t\t\t#~ PID-7: Date/Time of Birth => 19770621\n\t\t\t\t\t#~ PID-8: Sex => M\n\t\t\t\t\t#~ PID-9: Patient Alias => \n\t\t\t\t\t#~ PID-10: Race => \n\t\t\t\t\t#~ PID-11: Patient Address => [\"818 Beach Road\", \"\", \"BEECHMERE\", \"\", \"4510\", \"AU\", \"H\"]\n\n\t\t\t# iterate over each segment\n\t\t\t@parsed_content.each do |segment|\n\t\t\t\tseg = segment[0]\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t # eg => \"PID\"\n\t\t\t\t\n\t\t\t\t#get yaml file details\n\t\t\t\tyamlfile = \"hl7specification/#{seg}\"\t\t\t\t\t# for each segment, find the appropriate yaml file (ie one for each segment)\n\t\t\t\tspecs = YAML.load_file(yamlfile)\t\t\t\t\t\t\t# load the yaml file\n\t\t\t\t\n\t\t\t puts \":: #{specs[\"Header\"][\"name\"]} (#{seg})\"\t\t\t# print the text eg \":: Message Header Segment (MSH)\"\n\t\t\t \n\t\t\t # then iterate over each field in the particular segment\n\t\t\t\tsegment.each_with_index do |field, index|\t\t\t\t\t# then for each field...\n\t\t\t\t\tif index > 0 then\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# only if the index is 1 or more (ie the first value is not useful here)\n\t\t\t\t\t\tfld = \"#{seg}-#{index}\"\t\t\t\t\t\t\t\t\t # get the field id => \"PID-5\"\n\t\t\t\t\t\tprint \" #{fld}: \"\t\t\t\t\t\t \t\t\t\t\t\t# on each line print the particular field being queried eg \"PID-5: \"\n\t\t\t\t\t\tfldname = specs[fld][\"name\"]\t\t\t\t\t\t\t\t\t# get the name of the field from the yaml file\n\t\t\t\t\t\tprint \"#{fldname} => \"\t\t\t\t\t\t\t\t\t\t\t\t# print the field name after the field eg \"PID-5: Patient Name\"\n\t\t\t\t\t\tif field.class == String then\t\t\t\t\t\t\t\t\t# if the field class is a string...\n\t\t\t\t\t\t\tputs field\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# then just print (ie add) the value of the string eg \"PID-7: Date/Time of Birth => 19770621\"\n\t\t\t\t\t\telsif field.class == Array then\t\t\t\t\t\t\t\t# otherwise if the field is an array, ie there is lower level structure...\n\t\t\t\t\t\t\tputs field.inspect\t\t\t\t\t\t\t\t\t\t\t\t\t# then print the structure eg \"PID-5 Patient Name => [\"SMITH\", \"Alan\", \"Ross\", \"\", \"Mr\"]\"\n\t\t\t\t\t\tend # << end if field...\n\t\t\t\t\tend # << end if index > 0 \n\t\t\t\tend\t # << end segment.each_with_index\n\t\t\t\tputs\t\n\t\t end\t # << end @parsed_content.each\n\t \n\t end", "def parse\n end", "def parse!\n return if @parsed\n \n # the parents\n log_data = `git log -1 #{node}^ 2> /dev/null`\n \n # DETERMINING PARENTS\n dad = log_data[/^commit (.+)$/, 1]\n dad = dad ? dad[0..6] : nil\n mom = nil\n \n if log_data =~ /^Merge: (.+)\\.\\.\\. (.+)\\.\\.\\.$/ # Merge: 1c002dd... 35cfb2b...\n dad = $1 # just have them both use the short name, nbd\n mom = $2\n end\n \n @parents = [dad, mom].compact.map {|r| Changeset.new repo, r }\n \n # the actual changeset\n log_data = `git log -1 #{node} 2> /dev/null`\n \n # DETERMINING DATE\n @date = Time.parse log_data[/^Date:\\s+(.+)$/, 1]\n \n # DETERMINING USER\n @user = log_data[/^Author:\\s+(.+)$/, 1]\n \n # DETERMINING DESCRIPTION\n @description = log_data.split(\"\\n\")[4..-1].map {|l| l.strip }.join \"\\n\"\n \n # ALTERED FILES\n @altered_files = `git log -1 #{node} --pretty=oneline --name-only 2> /dev/null`.split(\"\\n\")[1..-1]\n \n # ALL FILES\n # @all_files is also sorted. Hooray!\n @all_files = `git ls-tree -r #{node}`.split(\"\\n\").map do |line|\n # 100644 blob cdbeb2a42b714a4db49293c87fec4e180d07d44f .autotest\n line[/^\\d+ \\w+ \\w+\\s+(.+)$/, 1]\n end\n \n @parsed = true\n end", "def run\n options_parse\n \n # output files (or set outfile to $stdout if no output file specified)\n outfile = $stdout\n unless @options[:out].nil?\n outfile = File.open(@options[:out], \"w+\")\n end\n \n outfile.write \"Id,Story,Labels,Iteration,Iteration Start,Iteration End,Story Type,Estimate,\"\n outfile.write \"Current State,Created at,Accepted at,Deadline,Requested By,Owned By,\"\n outfile.puts \"Description,URL,Note\"\n id = 1\n \n # parse the input file and produce \n ScarabParser.parse(@options[:in]).each do |key, attributes|\n # provide estimates for the statuses that require them\n new_status = STATUS_MAP[attributes[\"Status\"]]\n estimate = case\n when [ 'finished', 'accepted', 'started' ].include?(new_status) then\n case (attributes[\"Estimated effort\"] || 1).to_i\n when 0 then 0\n when 1 then 1\n when 2..6 then 2\n when 7..12 then 3\n when 13..24 then 5\n else 8\n end\n else ''\n end\n \n # build the CSV row for the new input file\n outfile.write(id) # Id\n outfile.write(\",\\\"#{attributes[\"Summary\"]}\\\"\") # Story\n outfile.write(\",\") # Labels\n outfile.write(\",\") # Iteration\n outfile.write(\",\") # Iteration Start\n outfile.write(\",\") # Iteration End\n outfile.write(\",#{@options[:story_type]}\") # Story Type\n outfile.write(\",#{estimate}\") # Estimate\n outfile.write(\",#{new_status}\") # Current State\n outfile.write(\",\") # Created at\n outfile.write(\",\") # Accepted at\n outfile.write(\",\") # Deadline\n outfile.write(\",\") # Requested By\n outfile.write(\",\") # Owned By\n outfile.write(\",\\\"#{attributes[\"Description\"]}\\\"\") # Description\n outfile.write(\",\") # URL\n outfile.write(\",\") # Note\n outfile.write(\"\\n\")\n \n # increment ID for the next pass\n id += 1\n end\n \n # close output file (if one was opened)\n unless @options[:out].nil?\n outfile.close\n end\n end", "def parser; end", "def parser; end", "def parser; end", "def parser; end", "def _parse_\n\t\t\tout = []\n\t\t\tstr = ''\n\t\t\tfresh = true\n\t\t\twhile @scanner.rest? do\n\t\t\t\t# last ||= 0\n\t\t\t\t# out.last.tap do |o|\n\t\t\t\t# \tif o.is_a?(Hash)\n\t\t\t\t# \t\tputs \"[#{@scanner.pos}] Parser has a Dictionary (#{o.class.name}) with data:\"\n\t\t\t\t# \t\to.each do |k, v|\n\t\t\t\t# \t\t\tputs \" #{k}: is #{v.class.name} with data: #{v.to_s[0..4]}#{\"...\" if v.to_s.length > 5}\"\n\t\t\t\t# \t\tend\n\t\t\t\t# \telse\n\t\t\t\t# \t\tputs \"[#{@scanner.pos}] Parser has #{o.class.name} with data: #{o.to_s[0..4]}#{\"...\" if o.to_s.length > 5}\"\n\t\t\t\t# \tend\n\t\t\t\t# \tputs \"next is #{@scanner.peek 8}\"\n\t\t\t\t# end unless (last == out.count) || (-1 == (last = out.count))\n\t\t\t\tcase\n\t\t\t\t##########################################\n\t\t\t\t## parse an Array\n\t\t\t\t##########################################\n\t\t\t\twhen @scanner.scan(/\\[/)\n\t\t\t\t\tout << _parse_\n\t\t\t\t##########################################\n\t\t\t\t## parse a Dictionary\n\t\t\t\t##########################################\n\t\t\t\twhen @scanner.scan(/<</)\n\t\t\t\t\tdata = _parse_\n\t\t\t\t\tobj = {}\n\t\t\t\t\tobj[data.shift] = data.shift while data[0]\n\t\t\t\t\tout << obj\n\t\t\t\t##########################################\n\t\t\t\t## return content of array or dictionary\n\t\t\t\t##########################################\n\t\t\t\twhen @scanner.scan(/\\]/), @scanner.scan(/>>/)\n\t\t\t\t\treturn out\n\t\t\t\t##########################################\n\t\t\t\t## parse a Stream\n\t\t\t\t##########################################\n\t\t\t\twhen @scanner.scan(/stream[\\r\\n]/)\n\t\t\t\t\t@scanner.pos += 1 if @scanner.peek(1) == \"\\n\".freeze && @scanner.matched[-1] != \"\\n\".freeze\n\t\t\t\t\t# the following was dicarded because some PDF files didn't have an EOL marker as required\n\t\t\t\t\t# str = @scanner.scan_until(/(\\r\\n|\\r|\\n)endstream/)\n\t\t\t\t\t# instead, a non-strict RegExp is used:\n\t\t\t\t\tstr = @scanner.scan_until(/endstream/)\n\t\t\t\t\t# raise error if the stream doesn't end.\n\t\t\t\t\traise \"Parsing Error: PDF file error - a stream object wasn't properly colsed using 'endstream'!\" unless str\n\t\t\t\t\t# need to remove end of stream\n\t\t\t\t\tif out.last.is_a? Hash\n\t\t\t\t\t\t# out.last[:raw_stream_content] = str[0...-10] #cuts only one EON char (\\n or \\r)\n\t\t\t\t\t\tout.last[:raw_stream_content] = unify_string str.sub(/(\\r\\n|\\n|\\r)?endstream\\z/, \"\").force_encoding(Encoding::ASCII_8BIT)\n\t\t\t\t\telse\n\t\t\t\t\t\twarn \"Stream not attached to dictionary!\"\n\t\t\t\t\t\tout << str.sub(/(\\r\\n|\\n|\\r)?endstream\\z/, \"\").force_encoding(Encoding::ASCII_8BIT)\n\t\t\t\t\tend\n\t\t\t\t##########################################\n\t\t\t\t## parse an Object after finished\n\t\t\t\t##########################################\n\t\t\t\twhen str = @scanner.scan(/endobj/)\n\t\t\t\t\t#what to do when this is an object?\n\t\t\t\t\tif out.last.is_a? Hash\n\t\t\t\t\t\tout << out.pop.merge({indirect_generation_number: out.pop, indirect_reference_id: out.pop})\n\t\t\t\t\telse\n\t\t\t\t\t\tout << {indirect_without_dictionary: out.pop, indirect_generation_number: out.pop, indirect_reference_id: out.pop}\n\t\t\t\t\tend\n\t\t\t\t\tfresh = true\n\t\t\t\t\t# puts \"!!!!!!!!! Error with :indirect_reference_id\\n\\nObject #{out.last} :indirect_reference_id = #{out.last[:indirect_reference_id]}\" unless out.last[:indirect_reference_id].is_a?(Fixnum)\n\t\t\t\t##########################################\n\t\t\t\t## parse a Hex String\n\t\t\t\t##########################################\n\t\t\t\twhen str = @scanner.scan(/<[0-9a-fA-F]+>/)\n\t\t\t\t\t# warn \"Found a hex string\"\n\t\t\t\t\tout << unify_string([str[1..-2]].pack('H*').force_encoding(Encoding::ASCII_8BIT))\n\t\t\t\t##########################################\n\t\t\t\t## parse a Literal String\n\t\t\t\t##########################################\n\t\t\t\twhen @scanner.scan(/\\(/)\n\t\t\t\t\t# warn \"Found a literal string\"\n\t\t\t\t\tstr = ''.force_encoding(Encoding::ASCII_8BIT)\n\t\t\t\t\tcount = 1\n\t\t\t\t\twhile count > 0 && @scanner.rest? do\n\t\t\t\t\t\tscn = @scanner.scan_until(/[\\(\\)]/)\n\t\t\t\t\t\tunless scn\n\t\t\t\t\t\t\twarn \"Unknown error parsing string at #{@scanner.pos} for string: #{str}!\"\n\t\t\t\t\t\t\tcount = 0 # error\n\t\t\t\t\t\t\tnext\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\tstr += scn.to_s\n\t\t\t\t\t\tseperator_count = 0\n\t\t\t\t\t\tseperator_count += 1 while str[-2-seperator_count] == \"\\\\\"\n\n\t\t\t\t\t\tcase str[-1]\n\t\t\t\t\t\twhen '('\n\t\t\t\t\t\t\t## The following solution might fail when (string ends with this sign: \\\\)\n\t\t\t\t\t\t\tcount += 1 unless seperator_count.odd?\n\t\t\t\t\t\twhen ')'\n\t\t\t\t\t\t\tcount -= 1 unless seperator_count.odd?\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\twarn \"Unknown error parsing string at #{@scanner.pos} for string: #{str}!\"\n\t\t\t\t\t\t\tcount = 0 # error\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\t# The PDF formatted string is: str[0..-2]\n\t\t\t\t\t# now starting to convert to regular string\n\t\t\t\t\tstr_bytes = str.force_encoding(Encoding::ASCII_8BIT)[0..-2].bytes.to_a\n\t\t\t\t\tstr = []\n\t\t\t\t\tuntil str_bytes.empty?\n\t\t\t\t\t\tcase str_bytes[0]\n\t\t\t\t\t\twhen 13 # eol - \\r\n\t\t\t\t\t\t\t# An end-of-line marker appearing within a literal string without a preceding REVERSE SOLIDUS\n\t\t\t\t\t\t\t# shall be treated as a byte value of (0Ah),\n\t\t\t\t\t\t\t# irrespective of whether the end-of-line marker was a CARRIAGE RETURN (0Dh), a LINE FEED (0Ah), or both.\n\t\t\t\t\t\t\tstr_bytes.shift\n\t\t\t\t\t\t\tstr_bytes.shift if str_bytes[0] == 10\n\t\t\t\t\t\t\tstr << 10\n\t\t\t\t\t\twhen 10 # eol - \\n\n\t\t\t\t\t\t\t# An end-of-line marker appearing within a literal string without a preceding REVERSE SOLIDUS\n\t\t\t\t\t\t\t# shall be treated as a byte value of (0Ah),\n\t\t\t\t\t\t\t# irrespective of whether the end-of-line marker was a CARRIAGE RETURN (0Dh), a LINE FEED (0Ah), or both.\n\t\t\t\t\t\t\tstr_bytes.shift\n\t\t\t\t\t\t\tstr_bytes.shift if str_bytes[0] == 13\n\t\t\t\t\t\t\tstr << 10\n\t\t\t\t\t\twhen 92 # \"\\\\\".ord == 92\n\t\t\t\t\t\t\tstr_bytes.shift\n\t\t\t\t\t\t\trep = str_bytes.shift\n\t\t\t\t\t\t\tcase rep\n\t\t\t\t\t\t\twhen 110 #n\n\t\t\t\t\t\t\t\tstr << 10 #new line\n\t\t\t\t\t\t\twhen 114 #r\n\t\t\t\t\t\t\t\tstr << 13 # CR\n\t\t\t\t\t\t\twhen 116 #t\n\t\t\t\t\t\t\t\tstr << 9 #tab\n\t\t\t\t\t\t\twhen 98 #b\n\t\t\t\t\t\t\t\tstr << 8\n\t\t\t\t\t\t\twhen 102 #f\n\t\t\t\t\t\t\t\tstr << 255\n\t\t\t\t\t\t\twhen 48..57 #octal notation for byte?\n\t\t\t\t\t\t\t\trep = rep.chr\n\t\t\t\t\t\t\t\trep += str_bytes.shift.chr if str_bytes[0].between?(48,57)\n\t\t\t\t\t\t\t\trep += str_bytes.shift.chr if str_bytes[0].between?(48,57) && ((rep + str_bytes[0].chr).to_i <= 255)\n\t\t\t\t\t\t\t\tstr << rep.to_i\n\t\t\t\t\t\t\twhen 10 # new line, ignore\n\t\t\t\t\t\t\t\tstr_bytes.shift if str_bytes[0] == 13\n\t\t\t\t\t\t\t\ttrue\n\t\t\t\t\t\t\twhen 13 # new line (or double notation for new line), ignore\n\t\t\t\t\t\t\t\tstr_bytes.shift if str_bytes[0] == 10\n\t\t\t\t\t\t\t\ttrue\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tstr << rep\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tstr << str_bytes.shift\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\tout << unify_string(str.pack('C*').force_encoding(Encoding::ASCII_8BIT))\n\t\t\t\t##########################################\n\t\t\t\t## Parse a comment\n\t\t\t\t##########################################\n\t\t\t\twhen str = @scanner.scan(/\\%/)\n\t\t\t\t\t#is a comment, skip until new line\n\t\t\t\t\tloop do\n\t\t\t\t\t\t# break unless @scanner.scan(/[^\\d\\r\\n]+/)\n\t\t\t\t\t\tbreak if @scanner.scan(/[^\\d]+[\\r\\n]+/) || @scanner.check(/([\\d]+[\\s]+[\\d]+[\\s]+obj[\\n\\r\\s]+\\<\\<)|([\\n\\r]+)/) || @scanner.eos?\n\t\t\t\t\t\t@scanner.pos += 1\n\t\t\t\t\tend\n\t\t\t\t\t# puts \"AFTER COMMENT: #{@scanner.peek 8}\"\n\t\t\t\t##########################################\n\t\t\t\t## Parse a Name\n\t\t\t\t##########################################\n\t\t\t\t# old, probably working version: when str = @scanner.scan(/\\/[\\#\\w\\d\\.\\+\\-\\\\\\?\\,]+/)\n\t\t\t\t# I don't know how to write the /[\\x21-\\x7e___subtract_certain_hex_values_here____]+/\n\t\t\t\t# all allowed regular caracters between ! and ~ : /[\\x21-\\x24\\x26\\x27\\x2a-\\x2e\\x30-\\x3b\\x3d\\x3f-\\x5a\\x5c\\x5e-\\x7a\\x7c\\x7e]+\n\t\t\t\t# all characters that aren't white space or special: /[^\\x00\\x09\\x0a\\x0c\\x0d\\x20\\x28\\x29\\x3c\\x3e\\x5b\\x5d\\x7b\\x7d\\x2f\\x25]+\n\t\t\twhen str = @scanner.scan(/\\/[^\\x00\\x09\\x0a\\x0c\\x0d\\x20\\x28\\x29\\x3c\\x3e\\x5b\\x5d\\x7b\\x7d\\x2f\\x25]+/)\n\t\t\t\t\tout << ( str[1..-1].gsub(/\\#[0-9a-fA-F]{2}/) {|a| a[1..2].hex.chr } ).to_sym\n\t\t\t\t##########################################\n\t\t\t\t## Parse a Number\n\t\t\t\t##########################################\n\t\t\t\twhen str = @scanner.scan(/[\\+\\-\\.\\d]+/)\n\t\t\t\t\tstr.match(/\\./) ? (out << str.to_f) : (out << str.to_i)\n\t\t\t\t##########################################\n\t\t\t\t## Parse an Object Reference\n\t\t\t\t##########################################\n\t\t\t\twhen @scanner.scan(/R/)\n\t\t\t\t\tout << { is_reference_only: true, indirect_generation_number: out.pop, indirect_reference_id: out.pop}\n\t\t\t\t\t@references << out.last\n\t\t\t\t##########################################\n\t\t\t\t## Parse Bool - true and after false\n\t\t\t\t##########################################\n\t\t\t\twhen @scanner.scan(/true/)\n\t\t\t\t\tout << true\n\t\t\t\twhen @scanner.scan(/false/)\n\t\t\t\t\tout << false\n\t\t\t\t##########################################\n\t\t\t\t## Parse NULL - null\n\t\t\t\t##########################################\n\t\t\t\twhen @scanner.scan(/null/)\n\t\t\t\t\tout << nil\n\t\t\t\t##########################################\n\t\t\t\t## XREF - check for encryption... anything else?\n\t\t\t\t##########################################\n\t\t\t\twhen @scanner.scan(/xref/)\n\t\t\t\t\t##########\n\t\t\t\t\t## get root object to check for encryption\n\t\t\t\t\t@scanner.scan_until(/(trailer)|(\\%EOF)/)\n\t\t\t\t\tfresh = true\n\t\t\t\t\tif @scanner.matched[-1] == 'r'\n\t\t\t\t\t\tif @scanner.skip_until(/<</)\n\t\t\t\t\t\t\tdata = _parse_\n\t\t\t\t\t\t\t@root_object ||= {}\n\t\t\t\t\t\t\t@root_object[data.shift] = data.shift while data[0]\t\t\t\t\t\t\n\t\t\t\t\t\tend\n\t\t\t\t\t\t##########\n\t\t\t\t\t\t## skip untill end of segment, maked by %%EOF\n\t\t\t\t\t\t@scanner.skip_until(/\\%\\%EOF/)\n\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\twhen @scanner.scan(/[\\s]+/)\n\t\t\t\t\t# Generally, do nothing\n\t\t\t\t\tnil\n\t\t\t\twhen @scanner.scan(/obj[\\s]*/)\n\t\t\t\t\t# Fix wkhtmltopdf PDF authoring issue - missing 'endobj' keywords\n\t\t\t\t\tunless fresh || (out[-4].nil? || out[-4].is_a?(Hash))\n\t\t\t\t\t\tkeep = []\n\t\t\t\t\t\tkeep << out.pop # .tap {|i| puts \"#{i} is an ID\"} \n\t\t\t\t\t\tkeep << out.pop # .tap {|i| puts \"#{i} is a REF\"} \n\n\t\t\t\t\t\tif out.last.is_a? Hash\n\t\t\t\t\t\t\tout << out.pop.merge({indirect_generation_number: out.pop, indirect_reference_id: out.pop})\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tout << {indirect_without_dictionary: out.pop, indirect_generation_number: out.pop, indirect_reference_id: out.pop}\n\t\t\t\t\t\tend\n\t\t\t\t\t\twarn \"'endobj' keyword was missing for Object ID: #{out.last[:indirect_reference_id]}, trying to auto-fix issue, but might fail.\"\n\n\t\t\t\t\t\tout << keep.pop\n\t\t\t\t\t\tout << keep.pop\n\t\t\t\t\tend\n\t\t\t\t\tfresh = false\n\t\t\t\telse\n\t\t\t\t\t# always advance \n\t\t\t\t\t# warn \"Advnacing for unknown reason... #{@scanner.peek(4)}\" unless @scanner.peek(1) =~ /[\\s\\n]/\n\t\t\t\t\twarn \"Warning: parser advnacing for unknown reason. Potential data-loss.\"\n\t\t\t\t\t@scanner.pos = @scanner.pos + 1\n\t\t\t\tend\n\t\t\tend\n\t\t\tout\n\t\tend", "def before_results(controller_params)\n @num_seqs = 0\n @header = []\n @aln_blocks = []\n \n resfile = File.join(job_dir, jobid+\".results\")\n raise(\"ERROR with resultfile!\") if !File.readable?(resfile) || !File.exists?(resfile) || File.zero?(resfile)\n res = IO.readlines(resfile).map {|line| line.chomp}\n \n seq = \"\"\n res.each do |line|\n if (line =~ /^>/)\n if (!seq.empty?) then @aln_blocks.push(seq) end\n @header.push(line)\n @num_seqs += 1\n seq = \"\"\n else\n seq += line + \"\\n\"\n end\n end\n if (!seq.empty?) then @aln_blocks.push(seq) end\n end", "def parse_bam_to_intermediate_files(out_prefix)\n script=File.join(File.dirname(__FILE__),\"bam_to_insert_size_bed.awk\")\n cmd = @conf.cluster_cmd_prefix(free:1, max:12, sync:true, name:\"bed_prep_#{File.basename(@bam.path)}\") +\n %W(/bin/bash -o pipefail -o errexit -c)\n filt = \"samtools view #{@bam.path} | awk -f #{script} -vbase=#{out_prefix} -vendness=\"\n if @bam.paired?\n filt += \"pe\"\n else\n filt += \"se -vsize=#{@bam.fragment_size}\"\n end\n cmd << \"\\\"#{filt}\\\"\"\n puts cmd.join(\" \") if @conf.verbose\n unless system(*cmd)\n @errors << \"Failure prepping bedfiles for #{@bam} #{$?.exitstatus}\"\n return false\n end\n if @bam.paired?\n IO.foreach(out_prefix+FRAGMENT_SIZE_SUFFIX) do |line|\n @bam.fragment_size = line.chomp.to_i\n break\n end\n end\n IO.foreach(out_prefix+\"_num_alignments.txt\") do |line|\n @bam.num_alignments = line.chomp.to_i\n break\n end\n return true\n end", "def parse_file\n line_count = 0\n @text.each_line do |line|\n if line == nil || line == '' || line.size == 0 || line[0] == '#' || line[0] == \"\\n\"\n next\n end\n elements = line.split(' ')\n if elements.size > 2\n puts 'Waring : '.red + 'in file \"' + @file_name.yellow + '\" ignoring line ' + line_count.to_s.yellow + ' ( it has more than one space and is not a comment )'\n else\n if elements.size == 1\n @ret << Manga_data.new(nil, nil, nil, elements[0], nil)\n else\n @ret << Manga_data.new(nil, elements[0], elements[1], nil, nil)\n end\n end\n line_count += 1\n end\n end", "def parse\n\n puts \"==> invoked: #parse\"\n\n {\n # raw_feed: @feed_hash,\n information: @information,\n amenities: @amenities,\n floorplan: @floorplan,\n file: @file,\n }\n end", "def ExtractInfoFromFileContents file_contents\ndata = file_contents.split('|')\n# Remove the first line\n# Remove the project_name from data\n# Remove the line below project_name\ndata = data.drop(3)\n\n# Now, everything is in 3-tuple <key, value, \"\\n\">\ndata.shift\nproject_name = data.first\nproject_name = project_name.gsub(/\\s+/, \"\")\ndata = data.drop(3)\n\nrepo_url = data.first\nrepo_url = repo_url.gsub(/\\s+/, \"\")\ndata = data.drop(3)\n\nhead_sha = data.first\nhead_sha = head_sha.gsub(/\\s+/, \"\")\ndata = data.drop(3)\n\nnum_commits = data.first\nnum_commits = num_commits.gsub(/\\s+/, \"\")\ndata = data.drop(3)\n\nnum_merges = data.first\nnum_merges = num_merges.gsub(/\\s+/, \"\")\ndata = data.drop(3)\n\nreverts_msg = data.first\nreverts_msg = reverts_msg.gsub(/\\s+/, \"\")\ndata = data.drop(3)\n\nreverts_complete = data.first\nreverts_complete = reverts_complete.gsub(/\\s+/, \"\")\ndata = data.drop(3)\n\nreverts_partial = data.first\nreverts_partial = reverts_partial.gsub(/\\s+/, \"\")\ndata = data.drop(3)\n\ncps_complete = data.first\ncps_complete = cps_complete.gsub(/\\s+/, \"\")\ndata = data.drop(3)\n\ncps_partial = data.first\ncps_partial = cps_partial.gsub(/\\s+/, \"\")\ndata = data.drop(2)\n\nproject_name_repo_url_head_sha_combined = project_name + \"\\n\" + repo_url + \"\\n\" + head_sha\nreturn [project_name_repo_url_head_sha_combined, num_commits, num_merges, reverts_msg, reverts_complete, reverts_partial, cps_complete, cps_partial]\n\nend", "def parse\n\t\t\tif ARGV.empty?\n\t\t\t\tprint_targets \"SYNTAX: tbm <targets>\\n\\nWhere <targets> is a comma-separated list of:\"\n\t\t\telsif ARGV == ['--version']\n\t\t\t\tputs \"Tunnel Boring Machine v#{VERSION}\"\n\t\t\telse\n\t\t\t\tparse_targets( ARGV )\n\t\t\tend\n\t\tend", "def load_inp(filename,runner = nil)\n BTAP::runner_register(\"Info\", \"loading file:\" + filename, runner)\n #Open the file.\n #puts filename\n iter = 0\n\n\n File.exist?(filename)\n f = File.open(filename, \"r\")\n\n\n\n\n #Read the file into an array, line by line.\n lines = f.readlines\n #Set up the temp string.\n command_string =\"\"\n #iterate through the file.\n parents = Array.new()\n children = Array.new()\n lines.each do|line|\n iter = iter.next\n #line.forced_encoding(\"US-ASCII\")\n #Ignore comments (To do!...strip from file as well as in-line comments.\n if (!line.match(/\\$.*/) )\n\n if (myarray = line.match(/(.*?)\\.\\./) )\n #Add the last part of the command to the newline...may be blank.\"\n command_string = command_string + myarray[1]\n #Determine correct command class to create, then populates it.\"\n command = DOECommandFactory.command_factory(command_string, self)\n #Push the command into the command array.\"\n @commands.push(command)\n command_string = \"\"\n else\n myarray = line.match(/(.*)/)\n command_string = command_string + myarray[1]\n end\n end\n end\n \n organize_data()\n BTAP::runner_register(\"Info\",\"INP model contains:\", runner)\n #report number of things read in. \n [\"SPACE\",\"ZONE\",\"EXTERIOR-WALL\",\"ROOF\",\"INTERIOR-WALL\",\"UNDERGROUND-WALL\",\"WINDOW\",\"DOOR\",\"MATERIAL\",\"CONSTRUCTION\"].each do |item|\n items = self.find_all_commands(item)\n message = \"\\t#{item} = #{items.size}\"\n BTAP::runner_register(\"Info\",message, runner)\n end\n BTAP::runner_register(\"Info\", \"\\tFinished Loading File:\" + filename,runner)\n end", "def inspect_jobs(index = nil)\n return empty_msg if empty?\n desc = []\n puts \"\\n\"\n @jobs.each_with_index do |j, i|\n unless index.nil?\n next unless i == index\n end\n desc << '| Job: ' + \" #{i + 1} \".rjust(8) + '|' + 'Pattern/AIV:'.rjust(18) + \" #{j.pattern.basename}\".ljust(125) + '|'\n desc << '| |' + 'Compiler ID:'.rjust(18) + \" #{j.id} \".ljust(125) + '|'\n desc << '| |' + 'AVC Files:'.rjust(18) + \" #{j.count} \".ljust(125) + '|'\n desc << '| |' + 'Output Directory:'.rjust(18) + \" #{j.output_directory} \".ljust(125) + '|'\n desc << '| |' + '.avc directory:'.rjust(18) + \" #{j.avc_dir} \".ljust(125) + '|'\n desc << '| |' + '.binl directory:'.rjust(18) + \" #{j.binl_dir} \".ljust(125) + '|'\n desc << '| |' + 'LSF:'.rjust(18) + \" #{j.location == :lsf ? true : false} \".ljust(125) + '|'\n desc << '| |' + 'Delete log files:'.rjust(18) + \" #{j.clean} \".ljust(125) + '|'\n desc << '| |' + 'Verbose:'.rjust(18) + \" #{j.verbose} \".ljust(125) + '|'\n if j.aiv2b_opts && j.aiv2b_opts.is_a?(String)\n aiv2b_opts = j.aiv2b_opts.gsub('AI_V2B_OPTIONS ', '')\n else\n aiv2b_opts = render_aiv2b_options_line.gsub('AI_V2B_OPTIONS', '')\n end\n desc << '| |' + 'AI_V2B Options:'.rjust(18) + \" #{aiv2b_opts} \".ljust(125) + '|'\n desc << '-' * desc.first.size\n end\n puts desc.flatten.join(\"\\n\")\n end", "def process_str_file(file_array)\n column_headings = []\n file_array.each do |f|\n\n #File.open(params[:inputfile],\"r\") do |file|\n # while (f = file.gets)\n next if f =~ /^#/ # ignore lines that start with a hash - comments\n f.strip! # remove any whitespace, linefeeds, etc.\n\n # if this line has the column headings, extract and do the next line\n if f =~ /^Order/\n column_headings = f.split(/\\t/)\n next\n end\n\n # Split the biomart dump file on tabs\n the_data = f.split(/\\t/)\n\n case the_data[2]\n when 'TRAIT'\n load_hjj_trait_data(column_headings,the_data)\n when 'SNP'\n load_hjj_snp_data(column_headings,the_data)\n when 'STR'\n load_hjj_str_data(column_headings,the_data)\n end\n\n #end # end of while loop\n end # of File.open\n \n end", "def parse()\n #This is a stub, used for indexing\n end", "def basic_output()\n temp_string = String.new()\n\n if (@utype != \"\")\n temp_string = temp_string + \"#{@utype} = \"\n end\n temp_string = temp_string + @commandName\n temp_string = temp_string + \"\\n\"\n @keywordPairs.each {|array| temp_string = temp_string + \"\\t#{array[0]} = #{array[1]}\\n\" }\n temp_string = temp_string + \"..\\n\"\n\n temp_string = temp_string + \"$Parents\\n\"\n @parents.each do |array|\n temp_string = temp_string + \"$\\t#{array.utype} = #{array.commandName}\\n\"\n end\n temp_string = temp_string + \"..\\n\"\n\n temp_string = temp_string + \"$Children\\n\"\n @children.each {|array| temp_string = temp_string + \"$\\t#{array.utype} = #{array.commandName}\\n\" }\n temp_string = temp_string + \"..\\n\"\n\n end", "def parse_output_data(filepath)\n # NOPE!\nend", "def run\n $schema.each do |k, v|\n case k\n when 'queryType'\n $query= v['name'] if v\n when 'mutationType'\n $mutation= v['name'] if v\n when 'subscriptionType'\n $subscription= v['name'] if v\n when 'directives'\n parse_directives v\n when 'types'\n parse_types_1 v\n else\n STDERR.puts \"Unrecognized schema element '#{k}'. This probably means that the parser file '#{$0}' needs to be updated to support it.\"\n exit 1\n end\n end\n\n # Now we are certain that $query/$mutation/$subscription are filled in.\n # They contain the names of types that serve as entry points into the respective parts of schema.\n if !$query; $log.fatal \"Did not find name of query entry in JSON schema; exiting.\"; exit 1 end\n if !$mutation; $log.fatal \"Did not find name of mutation entry in JSON schema; exiting.\"; exit 1 end\n if $subscription\n $log.error \"Found a 'subscription' entry point. Previously this wasn't present, so an update to '#{$0}' is needed to support it. For implementation, see existing implementations for queries and mutations; exiting.\"\n exit 1\n end\n\n # Let's now parse all types. This is the pass 2 of type parsing.\n parse_types_2 $schema['types']\n\n # And now we can output all files to disk.\n output_files()\n\n #pp $catalog\n puts \"Done. Methods: #{$catalog[:total]}.\"\n\n exit 0\nend", "def parse(input)\n\t input.each('*') do |block|\n\t\tblock.strip!\n\t\tnext if !block || block.empty?\n\t\traise ParseError, \"Found blocks after M02 '#{block}'\" if self.eof\n\t\tcase block\n\t\t when /^%AM/ # Special handling for aperture macros\n\t\t\tparse_parameter((block + input.gets('%')).gsub(/[\\n%]/,''))\n\t\t when /^%[A-Z]{2}/\n\t\t\t(block + input.gets('%')).gsub(/[\\n%]/,'').gsub(/\\* /,'').lines('*') {|b| parse_parameter(b)}\n\t\t when /^D(\\d{2,3})/\n\t\t\tcurrent_layer.parse_dcode(block)\n\t\t when /^M0(0|1|2)/\n\t\t\tmcode = $1\n\t\t\traise ParseError, \"Invalid M code: #{m}\" unless mcode\n\t\t\t@eof = true if mcode.to_i == 2\n\t\t when /^G54D(\\d{2,3})/\t# Deprecated G54 function code\n\t\t\tcurrent_layer.parse_gcode(54, nil, nil, nil, nil, $1)\n\t\t when /^G70/\n\t\t\tset_inches\n\t\t when /^G71/\n\t\t\tset_millimeters\n\t\t when /^(G(\\d{2}))?(X([\\d\\+-]+))?(Y([\\d\\+-]+))?(I([\\d\\+-]+))?(J([\\d\\+-]+))?(D0(1|2|3))?/\n\t\t\tgcode, dcode = $2, $12\n\t\t\tx, y, i, j = [$4, $6, $8, $10].map {|a| parse_coordinate(a) }\n\t\t\tcurrent_layer.parse_gcode(gcode, x, y, i, j, dcode)\n\t\t else\n\t\t\traise ParseError,\"Unrecognized block: \\\"#{block}\\\"\"\n\t\tend\n\t end\n\n\t # FIXME apply any @rotation\n\n\t @layers = @layer_parsers.select {|parser| !parser.empty? }.map do |parser|\n\t\tlayer = Gerber::Layer.new\n\t\tlayer.polarity = parser.polarity if parser.polarity\n\t\tlayer.name = parser.name\n\t\traise StandardError unless parser.geometry\n\n\t\tparser.geometry.each_with_index do |geometry, aperture_number|\n\t\t next unless geometry\n\t\t aperture = self.apertures[aperture_number]\n\t\t raise ParseError, \"Undefined aperture number #{aperture_number}\" unless aperture\n\t\t layer.apertures[aperture] = geometry\n\t\tend\n\n\t\tlayer\n\t end\n\n\t gerber = Gerber.new\n\t gerber.apertures.replace @apertures\n\t gerber.aperture_macros.replace @aperture_macros\n\t gerber.coordinate_format = self.integer_places, self.decimal_places\n\t gerber.name = @image_name\n\t gerber.layers.replace @layers\n\t gerber.zero_omission = self.zero_omission\n\n\t if @units == 'inch'\n\t\tgerber.set_inch\n\t else\n\t\tgerber.set_millimeter\n\t end\n\n\t gerber\n\tend", "def gather_target_sites(all_blast_results,gbff_dir,seq_dir,flanking_res)\n #step1 process blast_results into a hash function which includes the seq_id and an array of blast_items\n #blast_result_hash = blast_results_to_hash(all_blast_results)\n #step2 gather endo from gbff file\n process_all_db(all_blast_results,gbff_dir,seq_dir,flanking_res)\nend", "def postprocess( scaleData )\n\n stream_out( \"\\n Loading XML elements from #{$gWorkingModelFile} ...\")\n\n # Load all XML elements from HOT2000 file (post-run results now available)\n h2kPostElements = get_elements_from_filename( $gWorkingModelFile )\n\n if ( $gCustomCostAdjustment )\n $gRegionalCostAdj = $gCostAdjustmentFactor\n else\n $gRegionalCostAdj = $RegionalCostFactors[$Locale]\n end\n\n # PVSise Depreciated. To be removed in later versions.\n # $PVsize = $gChoices[\"Opt-StandoffPV\"] # Input examples: \"SizedPV\", \"SizedPV|3kW\", or \"NoPV\"\n $PVInt = $gChoices[\"Opt-H2K-PV\"] # Input examples: \"MonoSi-50m2\", \"NA\"\n if ( $PVInt != \"NA\" )\n $PVIntModel = true\n if ( $PVsize != \"NoPV\" ) # Internal PV model supercedes external!\n $PVsize = \"NoPV\"\n end\n end\n\n # Set flags for reading from Browse.rpt file\n bReadOldERSValue = false\n bUseNextPVLine = false\n bUseNextACLine = false\n bReadAirConditioningLoad = true # Always get Air Conditioning Load (not available in XML)\n\n #Open diagnostics file and possibly read in interesting info !?!\n $lineNo = 0\n if ( $gReadROutStrTxt )\n #begin\n stream_out(\"\\nParsing diagnostics from #{$OutputFolder}\\\\Routstr.txt ...\")\n fRoutStr = File.new(\"#{$OutputFolder}\\\\Routstr.txt\", \"r\")\n\n $SOCparse = false\n $SHTiniparse = false\n $FFBCparse = false\n $EFBCparse = false\n $HPparse = false\n $bHeatingDone = false\n $EBakparse = false\n $GOPparse = false\n # Zero arrays\n 32.times do |n|\n\n $binDatHrs[n+1]=0\n $binDatTmp[n+1]=0\n $binDatTsfB[n+1]=0\n $binDatHLR[n+1]=0\n $binDatT2cap[n+1]=0\n #$binDatT1cap[n+1]=0\n $binDatT2PLR[n+1]=0\n $binDatT1PLR[n+1]=0\n\n end\n\n\n\n while !fRoutStr.eof? do\n\n $lineNo = $lineNo + 1\n\n $lineIn = fRoutStr.readline\n $lineIn.strip!\n\n if ( $lineIn =~ /^\\s*$/ || $bHeatingDone ) then\n next # Skip empty line.\n end\n\n\n #Report binned data in general or SOC modes.\n # (This still calls for a more robust approach that can set the evaluation\n # type from the choice file or cmd line.)\n if ($lineIn =~ /Starting Run: House with standard operating conditions/ ||\n $lineIn =~ /Starting Run: House\\s*$/ )\n debug_out(\"ROUTSTR ? SOC open #{$lineNo} | #{$lineIn} \\n\")\n $SOCparse = true\n elsif ($lineIn =~ /Starting Run: / && $SOCparse)\n debug_out(\"ROUTSTR ? SOC close #{$lineNo} | #{$lineIn} \\n\")\n $SOCparse = false\n end\n\n if ( ! $SOCparse ) then\n next # Skip if we're not within standard OCs.\n end\n\n # Test if cooling sectins have been reached.\n if ( $lineIn =~ /Cooling calculations ../ )\n debug_out(\"ROUTSTR ? COOLING SECTION : #{$lineIn} \\n\")\n $bHeatingDone = true\n next\n end\n\n\n\n # Set flags for sections in the file\n if ($lineIn =~ /SpaceHTini/ )\n debug_out(\"ROUTSTR ? SpaceHTini open #{$lineNo} | #{$lineIn} \\n\")\n $SHTiniparse = true\n elsif ($lineIn =~ /Space00/ && $SHTiniparse )\n debug_out(\"ROUTSTR ? SpaceHTini close #{$lineNo} | #{$lineIn} \\n\")\n $SHTiniparse = false\n end\n\n if ($lineIn =~ /FossilFurnaceBC/ )\n debug_out(\"ROUTSTR ? FossilFurnaceBC open #{$lineNo} | #{$lineIn} \\n\")\n $FFBCparse = true\n elsif ($FFBCparse &&\n ( $lineIn =~ /HPBPLocated/ || $lineIn =~ /ElectricFurnaceBC/ || $lineIn =~ /oSpaceHT/ ) )\n debug_out(\"ROUTSTR ? FossilFurnaceBC close #{$lineNo} | #{$lineIn} \\n\")\n $FFBCparse = false\n end\n\n\n if ($lineIn =~ /GOPBackup: Gas\\/Oil\\/Propane backup../ )\n debug_out(\"ROUTSTR ? Gas/Oil/Propoane backup open #{$lineNo} | #{$lineIn} \\n\")\n $GOPparse = true\n elsif ( $GOPparse &&\n ( $lineIn =~ /HPBPLocated/ || $lineIn =~ /ElectricFurnaceBC/ || $lineIn =~ /oSpaceHT/ ) )\n debug_out(\"ROUTSTR ? Gas/Oil/Propoane backup close #{$lineNo} | #{$lineIn} \\n\")\n $GOPparse = false\n end\n\n\n if ($lineIn =~ /ElectricFurnaceBC/ )\n debug_out(\"ROUTSTR ? ElectricFurnaceBC open #{$lineNo} | #{$lineIn} \\n\")\n $EFBCparse = true\n elsif ($EFBCparse &&\n ( $lineIn =~ /HPBPLocated/ || $lineIn =~ /oSpaceHT/ ) )\n debug_out(\"ROUTSTR ? ElectricFurnaceBC close #{$lineNo} | #{$lineIn} \\n\")\n $EFBCparse = false\n end\n\n if ($lineIn =~ /ElectricBackup: ELECTRIC BACK-UP/ )\n debug_out(\"ROUTSTR ? ElectricBack open #{$lineNo} | #{$lineIn} \\n\")\n $EBakparse = true\n elsif ( $EBakparse &&\n ( $lineIn =~ /ElectricFurnaceBC: ELECTRIC HEAT BELOW CUT-OFF../ ) )\n debug_out(\"ROUTSTR ? ElectricBack close #{$lineNo} | #{$lineIn} \\n\")\n $EBakparse = false\n end\n\n\n if ($lineIn =~ /AboveHPBP @160/ )\n debug_out(\"ROUTSTR ? HP open #{$lineNo} | #{$lineIn} \\n\")\n $HPparse = true\n elsif ( $HPparse &&\n ( $lineIn =~ /FALLS THU OPS/ || $lineIn =~ /Exit AboveHPBP @ 180/ || $lineIn =~/HPBPLocated 180 T/) )\n debug_out(\"ROUTSTR ? HP close #{$lineNo} | #{$lineIn} \\n\")\n $HPparse = false\n end\n\n\n # ==== Parse Data =====\n\n # Read fan power\n if ($lineIn =~ /QFFAN/ )\n debug_out(\"ROUTSTR ? QFFAN : #{$lineNo} | #{$lineIn} \\n\")\n valuesArr = $lineIn.split()\n $FurnFanPower = valuesArr[3]\n $HPFanPower = valuesArr[4]\n debug_out(\"ROUTSTR ? #{$lineNo} | QFFAN = #{$FurnFanPower} , QHPFAN = #{$HPFanPower} \\n \")\n end\n\n # Read T1 capacity\n if ($lineIn =~ /oSpaceHT FURNPW/ )\n valuesArr = $lineIn.split()\n debug_out(\"ROUTSTR ? oCpaceHTFURN : #{$lineIn} \\n\")\n $T1Capacity = valuesArr[2]\n end\n\n # Get SH bin definitions\n if ($SHTiniparse)\n debug_out(\"ROUTSTR ? SHITI : #{$lineIn} \\n\")\n # Headerline - ignore\n if ($lineIn =~ /Bin BinHours TbinC HLcvs HLAir TsfB CShtr HLR0 HLR1 HLR2/ )\n\n else\n valuesArr = $lineIn.split()\n binNo = valuesArr[0].to_i\n $binDatHrs[binNo] = valuesArr[1].to_f\n $binDatTmp[binNo] = valuesArr[2].to_f\n $binDatTsfB[binNo] = valuesArr[5].to_f\n end\n\n end\n\n\n\n\n\n # Get furnace performace data\n if ( $FFBCparse )\n debug_out(\"ROUTSTR ? FossilFurnace : #{$lineIn} \\n\")\n if ($lineIn =~ /FossilFurnaceBC:/ || $lineIn !~ /^\\s*[0-9]/)\n # Header - ignore\n else\n\n debug_out(\">>>FOSIL Furnace Parsing #{$lineIn} \\n\")\n valuesArr = $lineIn.split()\n binNo = valuesArr[0].to_i\n $binDatHLR[binNo] = valuesArr[3].to_f\n $binDatT1PLR[binNo] = valuesArr[6].to_f\n\n\n end\n end\n\n # Get Heat pump w/ electric back-up data\n if ( $EBakparse )\n debug_out(\"ROUTSTR ? E-Backup: #{$lineIn} \\n\")\n if ($lineIn =~ /ElectricFurnaceBC:/ || $lineIn !~ /^\\s*[0-9]/)\n # Header - ignore\n else\n\n valuesArr = $lineIn.split()\n binNo = valuesArr[0].to_i\n $binDatHLR[binNo] = valuesArr[1].to_f\n $binDatT2cap[binNo] = valuesArr[3].to_f\n $binDatT2PLR[binNo] = 1.0\n $binDatT1PLR[binNo] = valuesArr[5].to_f\n\n\n end\n end\n\n\n #Get heat pump w/gas back up data.\n if ( $GOPparse )\n\n if ( $lineIn !~ /^@290/ )\n # Header - ignore\n else\n debug_out(\"ROUTSTR ? GOP parse: #{$lineIn} \\n\")\n valuesArr = $lineIn.split()\n binNo = valuesArr[1].to_i\n $binDatHLR[binNo] = valuesArr[2].to_f\n $binDatT2cap[binNo] = valuesArr[3].to_f\n $binDatT2PLR[binNo] = 1.0\n $binDatT1PLR[binNo] = valuesArr[6].to_f\n\n\n end\n\n\n\n end\n\n\n\n # Get Electric furnace data\n if ( $EFBCparse )\n debug_out(\"ROUTSTR ? Electric Furnace : #{$lineIn} \\n\")\n if ($lineIn =~ /ElectricFurnaceBC:/ || $lineIn !~ /^\\s*[0-9]/)\n # Header - ignore\n else\n\n valuesArr = $lineIn.split()\n binNo = valuesArr[0].to_i\n $binDatHLR[binNo] = valuesArr[1].to_f\n $binDatT1PLR[binNo] = valuesArr[3].to_f\n\n\n end\n end\n\n\n # Get heat pump data\n if ( $HPparse )\n debug_out(\"ROUTSTR ? Heat pump : #{$lineIn} \\n\")\n if ($lineIn =~ /AboveHPBP/ || $lineIn !~ /^\\s*[0-9]/ )\n # Header - ignore\n else\n valuesArr = $lineIn.split()\n binNo = valuesArr[0].to_i\n $binDatHLR[binNo] = valuesArr[2].to_f\n $binDatT2cap[binNo] = valuesArr[4].to_f\n $binDatT2PLR[binNo] = valuesArr[5].to_f\n\n\n end\n end\n\n end # end of while loop\n\n\n stream_out(\"done.\\n\")\n fRoutStr.close()\n #rescue\n # fatalerror(\"Could not read ROutStr.txt\\n\")\n\n #end\n end #of reading ROUTSTR file\n\n\n\n\n\n debug_out(\" bin data: #{'%4s' \"bin\"} #{'%12s' % \"$binDatHrs\"} #{'%12s' % \"$binDatTmp\"} #{'%12s' % \"$binDatTsfB\"} #{'%12s' % \"$binDatHLR\"} #{'%12s' % \"$binDatT1PLR\"} #{'%12s' % \"$binDatT2PLR\"} #{'%12s' % \"$binDatT2cap\"}\\n\" )\n 32.times do |n|\n\n bin = n + 1\n debug_out(\" bin data: #{'%4s' % bin} #{'%12s' % $binDatHrs[bin]} #{'%12s' % $binDatTmp[bin]} #{'%12s' % $binDatTsfB[bin]} #{'%12s' % $binDatHLR[bin]} #{'%12s' % $binDatT1PLR[bin]} #{'%12s' % $binDatT2PLR[bin]} #{'%12s' % $binDatT2cap[bin]}\\n\" )\n\n end\n\n\n\n\n\n\n\n\n\n\n # Determine if need to read old ERS number based on existence of file Set_EGH.h2k in H2K folder\n if File.exist?(\"#{$run_path}\\\\Set_EGH.h2k\") then\n bReadOldERSValue = true\n end\n\n\n # Read from Browse.rpt ASCII file *if* data not available in XML (.h2k file)!\n if bReadOldERSValue || bReadAirConditioningLoad || $PVIntModel\n begin\n fBrowseRpt = File.new(\"#{$OutputFolder}\\\\Browse.Rpt\", \"r\")\n while !fBrowseRpt.eof? do\n lineIn = fBrowseRpt.readline # Sequentially read file lines\n lineIn.strip! # Remove leading and trailing whitespace\n if ( lineIn !~ /^\\s*$/ ) # Not an empty line!\n if ( bReadOldERSValue && lineIn =~ /^Energuide Rating \\(not rounded\\) =/ )\n lineIn.sub!(/Energuide Rating \\(not rounded\\) =/, '')\n lineIn.strip!\n $gERSNum = lineIn.to_f # Use * scaleData?\n bReadOldERSValue = false\n break if !$PVIntModel # Stop parsing Browse.rpt when ERS number found!\n elsif ( ( $PVIntModel && lineIn =~ /PHOTOVOLTAIC SYSTEM MONTHLY PERFORMANCE/ ) || ( $PVIntModel && bUseNextPVLine ) )\n bUseNextPVLine = true\n if ( lineIn =~ /^Annual/ )\n valuesArr = lineIn.split() # Uses spaces by default to split-up line\n $annPVPowerFromBrowseRpt = valuesArr[4].to_f * 12.0 / 1000.0 # kW (approx PV power)\n break # PV power near bottom and last value to read!\n end\n elsif ( (bReadAirConditioningLoad && lineIn =~ /AIR CONDITIONING SYSTEM PERFORMANCE/) || bUseNextACLine)\n bUseNextACLine = true\n if ( lineIn =~ /^Ann/ ) # Look for the annual results\n valuesArr = lineIn.split() # Uses spaces by default to split-up line\n $annACSensibleLoadFromBrowseRpt = valuesArr[1].to_f #Annual AirConditioning Sensible Load (MJ)\n $annACLatentLoadFromBrowseRpt = valuesArr[2].to_f #Annual AirConditioning Latent Load (MJ)\n $AvgACCOP = valuesArr[8].to_f #Average COP of AirConditioning\n $TotalAirConditioningLoad = ($annACSensibleLoadFromBrowseRpt + $annACLatentLoadFromBrowseRpt) / 1000.0 # Divided by 1000 to convert unit to GJ\n bUseNextACLine = false\n break if !$PVIntModel # Stop parsing Browse.rpt if noting else required!\n end\n end\n end\n end\n fBrowseRpt.close()\n rescue\n fatalerror(\"Could not read Browse.Rpt.\\n\")\n end\n end\n\n # ===================== Get house information from the XML file\n if ($FlagHouseInfo)\n getHouseInfo(h2kPostElements)\n end\n\n # ===================== Get envelope characteristics from the XML file\n getEnvelopeSpecs(h2kPostElements)\n\n # ==================== Get electricity rate structure for external PV model use\n if ($PVsize !~ /NoPV/ )\n locationText = \"HouseFile/FuelCosts/Electricity/Fuel/Minimum\"\n $gElecRate[\"ElecMthMinCharge$\"] = h2kPostElements[locationText].attributes[\"charge\"].to_f\n locationText = \"HouseFile/FuelCosts/Electricity/Fuel/RateBlocks/Block1\"\n $gElecRate[\"ElecBlck1Units\"] = h2kPostElements[locationText].attributes[\"units\"].to_f\n $gElecRate[\"ElecBlck1CostPerUnit\"] = h2kPostElements[locationText].attributes[\"costPerUnit\"].to_f\n if ( h2kPostElements[locationText].attributes[\"units\"] != \"99999\" )\n locationText = \"HouseFile/FuelCosts/Electricity/Fuel/RateBlocks/Block2\"\n $gElecRate[\"ElecBlck2Units\"] = h2kPostElements[locationText].attributes[\"units\"].to_f\n $gElecRate[\"ElecBlck2CostPerUnit\"] = h2kPostElements[locationText].attributes[\"costPerUnit\"].to_f\n if ( h2kPostElements[locationText].attributes[\"units\"] != \"99999\" )\n locationText = \"HouseFile/FuelCosts/Electricity/Fuel/RateBlocks/Block3\"\n $gElecRate[\"ElecBlck3Units\"] = h2kPostElements[locationText].attributes[\"units\"].to_f\n $gElecRate[\"ElecBlck3CostPerUnit\"] = h2kPostElements[locationText].attributes[\"costPerUnit\"].to_f\n if ( h2kPostElements[locationText].attributes[\"units\"] != \"99999\" )\n locationText = \"HouseFile/FuelCosts/Electricity/Fuel/RateBlocks/Block4\"\n $gElecRate[\"ElecBlck4Units\"] = h2kPostElements[locationText].attributes[\"units\"].to_f\n $gElecRate[\"ElecBlck4CostPerUnit\"] = h2kPostElements[locationText].attributes[\"costPerUnit\"].to_f\n end\n end\n end\n end\n\n # Get house heated floor area\n $FloorArea = getHeatedFloorArea( h2kPostElements )\n $HouseVolume= h2kPostElements[\"HouseFile/House/NaturalAirInfiltration/Specifications/House\"].attributes[\"volume\"].to_f\n # ==================== Get results for all h2k calcs from XML file (except above case)\n\n parseDebug = true\n $HCRequestedfound = false\n $HCGeneralFound = false\n $HCSOCFound = false\n\n # Make sure that the code we want is available\n h2kPostElements[\"HouseFile/AllResults\"].elements.each do |element|\n\n houseCode = element.attributes[\"houseCode\"]\n\n # 05-Feb-2018 JTB: Note that in Non-Program (ERS) mode there is no \"houseCode\" attribute in the single element results set!\n # When in Program mode there are multiple element results sets (7). The first set has no houseCode attribute, the next six (6)\n # do have a value for the houseCode attribute. The last set has the houseCode attribute of \"UserHouse\", which almost exactly\n # matches the first results set (General mode results).\n if (houseCode == nil && element.attributes[\"sha256\"] != nil)\n houseCode = \"General\"\n end\n\n if (houseCode == \"#{$outputHCode}\" )\n $HCRequestedfoundfound = true\n end\n\n if ( houseCode == \"SOC\" )\n $HCSOCFound = true\n end\n\n if ( houseCode == \"General\" )\n $HCGeneralFound = true\n end\n\n end\n\n if ( ! $HCRequestedfound && $outputHCode != \"General\" )\n $ThisMsg = \"HOT2000 didn't generate \\\"#{$outputHCode}\\\" result set. \"\n\n if ( $HCSOCFound )\n $outputHCode = \"SOC\"\n elsif ( $HCGeneralFound )\n $outputHCode = \"General\"\n end\n\n $ThisMsg +=\" Reporting result set \\\"#{$outputHCode}\\\" result instead. \\n\"\n warn_out($ThisMsg)\n end\n\n h2kPostElements[\"HouseFile/AllResults\"].elements.each do |element|\n\n houseCode = element.attributes[\"houseCode\"]\n\n if (houseCode == nil && element.attributes[\"sha256\"] != nil)\n houseCode = \"General\"\n end\n\n # JTB 31-Jan-2018: Limiting results parsing to 1 set specified by user in choice file and saved in $outputHCode\n if (houseCode =~ /#{$outputHCode}/)\n\n stream_out( \"\\n Parsing results from set: #{$outputHCode} ...\")\n\n # Energy Consumption (Annual GJ)\n $gResults[houseCode][\"avgEnergyTotalGJ\"] = element.elements[\".//Annual/Consumption\"].attributes[\"total\"].to_f * scaleData\n $gResults[houseCode][\"avgEnergyHeatingGJ\"] = element.elements[\".//Annual/Consumption/SpaceHeating\"].attributes[\"total\"].to_f * scaleData\n $gResults[houseCode][\"avgGrossHeatLossGJ\"] = element.elements[\".//Annual/HeatLoss\"].attributes[\"total\"].to_f * scaleData\n $gResults[houseCode][\"avgEnergyCoolingGJ\"] = element.elements[\".//Annual/Consumption/Electrical\"].attributes[\"airConditioning\"].to_f * scaleData\n $gResults[houseCode][\"avgEnergyVentilationGJ\"] = element.elements[\".//Annual/Consumption/Electrical\"].attributes[\"ventilation\"].to_f * scaleData\n $gResults[houseCode][\"avgEnergyEquipmentGJ\"] = element.elements[\".//Annual/Consumption/Electrical\"].attributes[\"baseload\"].to_f * scaleData\n $gResults[houseCode][\"avgEnergyWaterHeatingGJ\"] = element.elements[\".//Annual/Consumption/HotWater\"].attributes[\"total\"].to_f * scaleData\n\n if $ExtraOutput1 then\n # Total Heat Loss of all zones by component (GJ)\n $gResults[houseCode][\"EnvHLTotalGJ\"] = element.elements[\".//Annual/HeatLoss\"].attributes[\"total\"].to_f * scaleData\n $gResults[houseCode][\"EnvHLCeilingGJ\"] = element.elements[\".//Annual/HeatLoss\"].attributes[\"ceiling\"].to_f * scaleData\n $gResults[houseCode][\"EnvHLMainWallsGJ\"] = element.elements[\".//Annual/HeatLoss\"].attributes[\"mainWalls\"].to_f * scaleData\n $gResults[houseCode][\"EnvHLWindowsGJ\"] = element.elements[\".//Annual/HeatLoss\"].attributes[\"windows\"].to_f * scaleData\n $gResults[houseCode][\"EnvHLDoorsGJ\"] = element.elements[\".//Annual/HeatLoss\"].attributes[\"doors\"].to_f * scaleData\n $gResults[houseCode][\"EnvHLExpFloorsGJ\"] = element.elements[\".//Annual/HeatLoss\"].attributes[\"exposedFloors\"].to_f * scaleData\n $gResults[houseCode][\"EnvHLCrawlspaceGJ\"] = element.elements[\".//Annual/HeatLoss\"].attributes[\"crawlspace\"].to_f * scaleData\n $gResults[houseCode][\"EnvHLSlabGJ\"] = element.elements[\".//Annual/HeatLoss\"].attributes[\"slab\"].to_f * scaleData\n $gResults[houseCode][\"EnvHLBasementBGWallGJ\"] = element.elements[\".//Annual/HeatLoss\"].attributes[\"basementBelowGradeWall\"].to_f * scaleData\n $gResults[houseCode][\"EnvHLBasementAGWallGJ\"] = element.elements[\".//Annual/HeatLoss\"].attributes[\"basementAboveGradeWall\"].to_f * scaleData\n $gResults[houseCode][\"EnvHLBasementFlrHdrsGJ\"] = element.elements[\".//Annual/HeatLoss\"].attributes[\"basementFloorHeaders\"].to_f * scaleData\n $gResults[houseCode][\"EnvHLPonyWallGJ\"] = element.elements[\".//Annual/HeatLoss\"].attributes[\"ponyWall\"].to_f * scaleData\n $gResults[houseCode][\"EnvHLFlrsAbvBasementGJ\"] = element.elements[\".//Annual/HeatLoss\"].attributes[\"floorsAboveBasement\"].to_f * scaleData\n $gResults[houseCode][\"EnvHLAirLkVentGJ\"] = element.elements[\".//Annual/HeatLoss\"].attributes[\"airLeakageAndNaturalVentilation\"].to_f * scaleData\n\n # Annual DHW heating load [GJ] -- heating load (or demand) on DHW system (before efficiency applied)\n $gResults[houseCode][\"AnnHotWaterLoadGJ\"] = element.elements[\".//Annual/HotWaterDemand\"].attributes[\"base\"].to_f * scaleData\n end\n\n # Design loads, other data\n $gResults[houseCode][\"avgOthPeakHeatingLoadW\"] = element.elements[\".//Other\"].attributes[\"designHeatLossRate\"].to_f * scaleData\n $gResults[houseCode][\"avgOthPeakCoolingLoadW\"] = element.elements[\".//Other\"].attributes[\"designCoolLossRate\"].to_f * scaleData\n\n $gResults[houseCode][\"avgOthSeasonalHeatEff\"] = element.elements[\".//Other\"].attributes[\"seasonalHeatEfficiency\"].to_f * scaleData\n $gResults[houseCode][\"avgVntAirChangeRateNatural\"] = element.elements[\".//Annual/AirChangeRate\"].attributes[\"natural\"].to_f * scaleData\n $gResults[houseCode][\"avgVntAirChangeRateTotal\"] = element.elements[\".//Annual/AirChangeRate\"].attributes[\"total\"].to_f * scaleData\n $gResults[houseCode][\"avgSolarGainsUtilized\"] = element.elements[\".//Annual/UtilizedSolarGains\"].attributes[\"value\"].to_f * scaleData\n $gResults[houseCode][\"avgVntMinAirChangeRate\"] = element.elements[\".//Other/Ventilation\"].attributes[\"minimumAirChangeRate\"].to_f * scaleData\n\n $gResults[houseCode][\"avgFuelCostsElec$\"] = element.elements[\".//Annual/ActualFuelCosts\"].attributes[\"electrical\"].to_f * scaleData\n $gResults[houseCode][\"avgFuelCostsNatGas$\"] = element.elements[\".//Annual/ActualFuelCosts\"].attributes[\"naturalGas\"].to_f * scaleData\n $gResults[houseCode][\"avgFuelCostsOil$\"] = element.elements[\".//Annual/ActualFuelCosts\"].attributes[\"oil\"].to_f * scaleData\n $gResults[houseCode][\"avgFuelCostsPropane$\"] = element.elements[\".//Annual/ActualFuelCosts\"].attributes[\"propane\"].to_f * scaleData\n $gResults[houseCode][\"avgFuelCostsWood$\"] = element.elements[\".//Annual/ActualFuelCosts\"].attributes[\"wood\"].to_f * scaleData\n\n if $ExtraOutput1 then\n # Annual SpaceHeating and HotWater energy by fuel type [GJ]\n $gResults[houseCode][\"AnnSpcHeatElecGJ\"] = element.elements[\".//Annual/Consumption/Electrical\"].attributes[\"spaceHeating\"].to_f * scaleData\n $gResults[houseCode][\"AnnSpcHeatGasGJ\"] = element.elements[\".//Annual/Consumption/NaturalGas\"].attributes[\"spaceHeating\"].to_f * scaleData\n $gResults[houseCode][\"AnnSpcHeatOilGJ\"] = element.elements[\".//Annual/Consumption/Oil\"].attributes[\"spaceHeating\"].to_f * scaleData\n $gResults[houseCode][\"AnnSpcHeatPropGJ\"] = element.elements[\".//Annual/Consumption/Propane\"].attributes[\"spaceHeating\"].to_f * scaleData\n $gResults[houseCode][\"AnnSpcHeatWoodGJ\"] = element.elements[\".//Annual/Consumption/Wood\"].attributes[\"spaceHeating\"].to_f * scaleData\n $gResults[houseCode][\"AnnHotWaterElecGJ\"] = element.elements[\".//Annual/Consumption/Electrical/HotWater\"].attributes[\"dhw\"].to_f * scaleData\n $gResults[houseCode][\"AnnHotWaterGasGJ\"] = element.elements[\".//Annual/Consumption/NaturalGas\"].attributes[\"hotWater\"].to_f * scaleData\n $gResults[houseCode][\"AnnHotWaterOilGJ\"] = element.elements[\".//Annual/Consumption/Oil\"].attributes[\"hotWater\"].to_f * scaleData\n $gResults[houseCode][\"AnnHotWaterPropGJ\"] = element.elements[\".//Annual/Consumption/Propane\"].attributes[\"hotWater\"].to_f * scaleData\n $gResults[houseCode][\"AnnHotWaterWoodGJ\"] = element.elements[\".//Annual/Consumption/Wood\"].attributes[\"hotWater\"].to_f * scaleData\n end\n\n $gResults[houseCode][\"avgFueluseElecGJ\"] = element.elements[\".//Annual/Consumption/Electrical\"].attributes[\"total\"].to_f * scaleData\n\n # Bug in v11.3b90: The annual electrical energy total is 0 even though its components are not. Workaround below.\n # 07-APR-2018 JTB: This should only be checked when there is NO internal PV model in use!\n if !$PVIntModel && $gResults[houseCode][\"avgFueluseElecGJ\"] == 0 then\n $gResults[houseCode][\"avgFueluseElecGJ\"] = element.elements[\".//Annual/Consumption/Electrical\"].attributes[\"baseload\"].to_f * scaleData +\n element.elements[\".//Annual/Consumption/Electrical\"].attributes[\"airConditioning\"].to_f * scaleData +\n element.elements[\".//Annual/Consumption/Electrical\"].attributes[\"appliance\"].to_f * scaleData +\n element.elements[\".//Annual/Consumption/Electrical\"].attributes[\"lighting\"].to_f * scaleData +\n element.elements[\".//Annual/Consumption/Electrical\"].attributes[\"heatPump\"].to_f * scaleData +\n element.elements[\".//Annual/Consumption/Electrical\"].attributes[\"spaceHeating\"].to_f * scaleData +\n element.elements[\".//Annual/Consumption/Electrical\"].attributes[\"spaceCooling\"].to_f * scaleData +\n element.elements[\".//Annual/Consumption/Electrical\"].attributes[\"ventilation\"].to_f * scaleData +\n element.elements[\".//Annual/Consumption/Electrical/HotWater\"].attributes[\"dhw\"].to_f * scaleData\n end\n $gResults[houseCode][\"avgFueluseNatGasGJ\"] = element.elements[\".//Annual/Consumption/NaturalGas\"].attributes[\"total\"].to_f * scaleData\n $gResults[houseCode][\"avgFueluseOilGJ\"] = element.elements[\".//Annual/Consumption/Oil\"].attributes[\"total\"].to_f * scaleData\n $gResults[houseCode][\"avgFuelusePropaneGJ\"] = element.elements[\".//Annual/Consumption/Propane\"].attributes[\"total\"].to_f * scaleData\n $gResults[houseCode][\"avgFueluseWoodGJ\"] = element.elements[\".//Annual/Consumption/Wood\"].attributes[\"total\"].to_f * scaleData\n\n $gResults[houseCode][\"avgFueluseEleckWh\"] = $gResults[houseCode][\"avgFueluseElecGJ\"] * 277.77777778\n $gResults[houseCode][\"avgFueluseNatGasM3\"] = $gResults[houseCode][\"avgFueluseNatGasGJ\"] * 26.853\n $gResults[houseCode][\"avgFueluseOilL\"] = $gResults[houseCode][\"avgFueluseOilGJ\"] * 25.9576\n $gResults[houseCode][\"avgFuelusePropaneL\"] = $gResults[houseCode][\"avgFuelusePropaneGJ\"] / 25.23 * 1000\n $gResults[houseCode][\"avgFueluseWoodcord\"] = $gResults[houseCode][\"avgFueluseWoodGJ\"] / 18.30 # estimated GJ/cord for wood/pellet burning from YHC Fuel Cost Comparison.xls\n\n $gResults[houseCode][\"avgFuelCostsTotal$\"] = $gResults[houseCode][\"avgFuelCostsElec$\"] +\n $gResults[houseCode][\"avgFuelCostsNatGas$\"] +\n $gResults[houseCode][\"avgFuelCostsOil$\"] +\n $gResults[houseCode][\"avgFuelCostsPropane$\"] +\n $gResults[houseCode][\"avgFuelCostsWood$\"]\n\n # JTB 10-Nov-2016: Changed variable name from avgEnergyTotalGJ to \"..Gross..\" and uncommented\n # the reading of avgEnergyTotalGJ above. This value does NOT include utilized PV energy and\n # avgEnergyTotalGJ does when there is an internal H2K PV model.\n $gResults[houseCode][\"avgEnergyGrossGJ\"] = $gResults[houseCode]['avgEnergyHeatingGJ'].to_f +\n $gResults[houseCode]['avgEnergyWaterHeatingGJ'].to_f +\n $gResults[houseCode]['avgEnergyVentilationGJ'].to_f +\n $gResults[houseCode]['avgEnergyCoolingGJ'].to_f +\n $gResults[houseCode]['avgEnergyEquipmentGJ'].to_f\n\n\n\n monthArr = [ \"january\", \"february\", \"march\", \"april\", \"may\", \"june\", \"july\", \"august\", \"september\", \"october\", \"november\", \"december\" ]\n # Picking up AUX energy requirement from each result set.\n\n $gAuxEnergyHeatingGJ = 0\n $MonthlyAuxHeatingMJ = 0\n monthArr.each do |mth|\n $gAuxEnergyHeatingGJ += element.elements[\".//Monthly/UtilizedAuxiliaryHeatRequired\"].attributes[mth].to_f / 1000\n end\n\n # ASF 03-Oct-2016 - picking up PV generation from each individual result set.\n if ( $PVIntModel )\n pvAvailable = 0\n pvUtilized = 0\n #monthArr = [ \"january\", \"february\", \"march\", \"april\", \"may\", \"june\", \"july\", \"august\", \"september\", \"october\", \"november\", \"december\" ]\n monthArr.each do |mth|\n # ASF: 03-Oct-2016: Note inner caps on PhotoVoltaic likely an error (and inconsistent with convention used\n # elsewhere in the h2k file. Watch out for future .h2k file format changes here!)\n # ASF: 05-Oct-2016: I suspect this loop is really expensive.\n pvAvailable += h2kPostElements[\".//Monthly/Load/PhotoVoltaicAvailable\"].attributes[mth].to_f # GJ\n pvUtilized += h2kPostElements[\".//Monthly/Load/PhotoVoltaicUtilized\"].attributes[mth].to_f # GJ\n end\n # 10-Nov-2016 JTB: Use annual PV values only! HOT2000 redistributes the monthly excesses, if available!\n $gResults[houseCode][\"avgEnergyPVAvailableGJ\"] = pvAvailable # GJ\n $gResults[houseCode][\"avgEnergyPVUtilizedGJ\"] = pvUtilized # GJ\n $gResults[houseCode][\"avgElecPVGenkWh\"] = $gResults[houseCode][\"avgEnergyPVAvailableGJ\"] * 277.777778 # kWh\n $gResults[houseCode][\"avgElecPVUsedkWh\"] = $gResults[houseCode][\"avgEnergyPVUtilizedGJ\"] * 277.777778 # kWh\n\n # ***** Calculation of NET PV Revenue using HOT2000 model *****\n # 10-Nov-2016 JTB: Assumes that all annual PV energy available is used to reduce house electricity\n # to zero first, the balance is sold to utility at the rate PVTarrifDollarsPerkWh,\n # which is specified in the options file (defaulted at top if not in Options file!).\n netAnnualPV = $gResults[houseCode][\"avgElecPVGenkWh\"] - $gResults[houseCode][\"avgElecPVUsedkWh\"]\n if ( netAnnualPV > 0 )\n $gResults[houseCode][\"avgPVRevenue\"] = netAnnualPV * $PVTarrifDollarsPerkWh\n else\n $gResults[houseCode][\"avgPVRevenue\"] = 0\n end\n else\n # Calculate and reset these values below if external PV model used\n $gResults[houseCode][\"avgEnergyPVAvailableGJ\"] = 0.0\n $gResults[houseCode][\"avgEnergyPVUtilizedGJ\"] = 0.0\n $gResults[houseCode][\"avgElecPVGenkWh\"] = 0.0\n $gResults[houseCode][\"avgElecPVUsedkWh\"] = 0.0\n $gResults[houseCode][\"avgPVRevenue\"] = 0.0\n end\n\n # This is used for debugging only.\n diff = ( $gResults[houseCode][\"avgFueluseElecGJ\"].to_f +\n $gResults[houseCode][\"avgFueluseNatGasGJ\"].to_f -\n $gResults[houseCode][\"avgEnergyPVUtilizedGJ\"]) - $gResults[houseCode][\"avgEnergyTotalGJ\"].to_f\n $gResults[houseCode][\"zH2K-debug-Energy\"] = diff.to_f * scaleData\n\n break # break out of the element loop to avoid further processing\n\n end\n\n end # h2kPostElements |element| loop (and scope of local variable houseCode!)\n\n if ( $gDebug )\n $gResults.each do |houseCode, data|\n debug_out (\">Results for \" << houseCode.to_s)\n data.each do | var, value |\n debug_out (\" - \" << var.to_s << \" : \" << value.to_s )\n end\n end\n end\n\n $gAvgCost_Pellet = 0 # H2K doesn't identify pellets in output (only inputs)!\n\n # Total of all fuels in GJ\n $gAvgEnergy_Total = $gResults[$outputHCode][\"avgFueluseElecGJ\"] + $gResults[$outputHCode][\"avgFueluseNatGasGJ\"] +\n $gResults[$outputHCode][\"avgFueluseOilGJ\"] + $gResults[$outputHCode][\"avgFuelusePropaneGJ\"] +\n $gResults[$outputHCode][\"avgFueluseWoodGJ\"]\n\n # JTB 12-Nov-2016 : Updated and still valid. Sets cost of PV based on model type\n # and estimates PV kW size.\n # PV Data cost...\n $PVArrayCost = 0.0\n $PVArraySized = 0.0\n # Stand-off PV code depriciated. Need to figure out how to get PV size from H2k results.\n $PVsize = \"NoPV\"\n $PVcapacity = $PVsize\n $PVcapacity.gsub(/[a-zA-Z:\\s'\\|]/, '')\n if ( !$PVIntModel && ( $PVcapacity == \"\" || $PVcapacity == \"NoPV\" ) )\n $PVcapacity = 0.0\n end\n if ( $PVIntModel )\n if ( $PVInt != \"NA\" )\n # JTB 03-Nov-2016: The Cost field for Opt-H2K-PV is total cost NOT unit cost!!\n $PVUnitCost = $gOptions[\"Opt-H2K-PV\"][\"options\"][ $gChoices[\"Opt-H2K-PV\"] ][\"cost\"].to_f\n $PVUnitOutput = 0.0 # GJ/kW not used or estimated for internal H2K PV model\n else\n # No PV option specified in choice file (PV internal model part of base file)\n $PVUnitCost = 0.0\n $PVUnitOutput = 0.0\n end\n elsif ( $PVsize != \"NoPV\" )\n\n # Depreciated - to be removed.\n #$PVUnitCost = $gOptions[\"Opt-StandoffPV\"][\"options\"][\"SizedPV\"][\"cost\"].to_f\n #$PVUnitOutput = $gOptions[\"Opt-StandoffPV\"][\"options\"][\"SizedPV\"][\"ext-result\"][\"production-elec-perKW\"].to_f # GJ/kW\n end\n\n if ( $PVsize =~ /NoPV/ )\n # NoPV\n $gPVProduction = 0.0\n $PVArrayCost = 0.0\n elsif ( $PVsize =~ /SizedPV/ )\n # Size PV according to user specification, to max, or to size required to reach Net-Zero.\n # User-specified PV size (format is 'SizedPV|XkW', PV will be sized to X kW'.\n if ( $gExtraDataSpecd[\"Opt-StandoffPV\"] =~ /kW/ )\n $PVArraySized = $gExtraDataSpecd[\"Opt-StandoffPV\"].to_f # ignores \"kW\" in string\n $PVArrayCost = $PVUnitCost * $PVArraySized\n $gPVProduction = -1.0 * $PVUnitOutput * $PVArraySized\n $PVsize = \"spec'd SizedPV | #{$PVArraySized} kW\"\n else\n # USER Hasn't specified PV size, Size PV to attempt to get to net-zero.\n # First, get the home's total energy requirement.\n $prePVEnergy = $gAvgEnergy_Total\n if ( $prePVEnergy > 0 )\n # This should always be the case!\n $PVArraySized = $prePVEnergy / $PVUnitOutput # KW Capacity\n $PVmultiplier = 1.0\n if ( $PVArraySized > 14.0 )\n $PVmultiplier = 2.0\n end\n $PVArrayCost = $PVArraySized * $PVUnitCost * $PVmultiplier\n $PVsize = \" scaled: \" + \"#{$PVArraySized.round(1)} kW\"\n $gPVProduction = -1.0 * $PVUnitOutput * $PVArraySized\n else\n # House is already energy positive, no PV needed. Shouldn't happen!\n $PVsize = \"0.0 kW\"\n $PVArrayCost = 0.0\n end\n # Debug: How big is the sized array?\n debug_out (\"\\n PV array is #{$PVsize} ...\\n\")\n end\n end\n\n # Depreciated. To be deleted.\n #$gChoices[\"Opt-StandoffPV\"] = $PVsize\n #$gOptions[\"Opt-StandoffPV\"][\"options\"][$PVsize][\"cost\"] = $PVArrayCost\n\n\n # PV energy from HOT2000 model run (GJ) or estimate from option file PV data\n if ( $PVIntModel )\n $PVcapacity = $annPVPowerFromBrowseRpt # kW\n $PVsize = \" H2K: \" + \"#{$PVcapacity.round(1)} kW\"\n $gEnergyPV = $gResults[$outputHCode][\"avgEnergyPVUtilizedGJ\"]\n\n debug_out (\"\\n PV array is #{$PVsize} ...\\n\")\n elsif ( $PVsize !~ /NoPV/ )\n # PV energy comes from an estimate using Opt-StandoffPV specification. Uses options file\n # number for GJ/kW PV energy production for location and roof pitch.\n $PVcapacity = $PVArraySized # kW\n $gEnergyPV = $gPVProduction * -1.0 # GJ\n\n # Set values for external PV model (initialized to zero above)...\n $gResults[$outputHCode][\"avgEnergyPVAvailableGJ\"] = $gEnergyPV\n if ( $gResults[$outputHCode][\"avgFueluseElecGJ\"] > $gEnergyPV )\n # Decrease house electricity use by PV energy productions\n $gResults[$outputHCode][\"avgEnergyPVUtilizedGJ\"] = $gEnergyPV\n $gResults[$outputHCode][\"avgFueluseElecGJ\"] -= $gEnergyPV\n $gResults[$outputHCode][\"avgFueluseEleckWh\"] = $gResults[$outputHCode][\"avgFueluseElecGJ\"] * 277.77777778\n # Calculate new electricity cost and also update total fuel costs!\n calcElectCost( \"annual\" )\n else\n # PV production at least enough to cover house electrical needs!\n $gResults[$outputHCode][\"avgEnergyPVUtilizedGJ\"] = $gResults[$outputHCode][\"avgFueluseElecGJ\"]\n $gResults[$outputHCode][\"avgFueluseElecGJ\"] = 0.0\n $gResults[$outputHCode][\"avgFueluseEleckWh\"] = 0.0\n # New electricity cost is just the monthly minimum (also update total fuel cost)!\n calcElectCost( \"annualMin\" )\n end\n $gResults[$outputHCode][\"avgElecPVGenkWh\"] = $gResults[$outputHCode][\"avgEnergyPVAvailableGJ\"] * 277.777778 # kWh\n $gResults[$outputHCode][\"avgElecPVUsedkWh\"] = $gResults[$outputHCode][\"avgEnergyPVUtilizedGJ\"] * 277.777778 # kWh\n\n netAnnualPV = $gResults[$outputHCode][\"avgElecPVGenkWh\"] - $gResults[$outputHCode][\"avgElecPVUsedkWh\"]\n if ( netAnnualPV > 0 )\n $gResults[$outputHCode][\"avgPVRevenue\"] = netAnnualPV * $PVTarrifDollarsPerkWh\n else\n $gResults[$outputHCode][\"avgPVRevenue\"] = 0\n end\n end\n\n stream_out( \" done \\n\")\n\n stream_out \"\\n----------------------- SIMULATION RESULTS ---------------------------------\\n\"\n\n stream_out \"\\n Peak Heating Load (W): #{$gResults[$outputHCode]['avgOthPeakHeatingLoadW'].round(1)} \\n\"\n stream_out \" Peak Cooling Load (W): #{$gResults[$outputHCode]['avgOthPeakCoolingLoadW'].round(1)} \\n\"\n\n stream_out(\"\\n Energy Consumption: \\n\\n\")\n stream_out ( \" #{$gResults[$outputHCode]['avgEnergyHeatingGJ'].round(1)} ( Space Heating, GJ ) \\n\")\n stream_out ( \" #{$gResults[$outputHCode]['avgEnergyWaterHeatingGJ'].round(1)} ( Hot Water, GJ ) \\n\")\n stream_out ( \" #{$gResults[$outputHCode]['avgEnergyVentilationGJ'].round(1)} ( Ventilator Electrical, GJ ) \\n\")\n stream_out ( \" #{$gResults[$outputHCode]['avgEnergyCoolingGJ'].round(1)} ( Space Cooling, GJ ) \\n\")\n stream_out ( \" #{$gResults[$outputHCode]['avgEnergyEquipmentGJ'].round(1)} ( Appliances + Lights + Plugs + outdoor, GJ ) \\n\")\n stream_out ( \" --------------------------------------------------------\\n\")\n stream_out ( \" #{$gResults[$outputHCode]['avgEnergyGrossGJ'].round(1)} ( H2K Gross energy use GJ ) \\n\")\n\n if ( parseDebug )\n $check = $gResults[$outputHCode]['avgEnergyHeatingGJ'].to_f +\n $gResults[$outputHCode]['avgEnergyWaterHeatingGJ'].to_f +\n $gResults[$outputHCode]['avgEnergyVentilationGJ'].to_f +\n $gResults[$outputHCode]['avgEnergyCoolingGJ'].to_f +\n $gResults[$outputHCode]['avgEnergyEquipmentGJ'].to_f\n stream_out (\" ( Check1: should = #{$check.round(1)}, \")\n stream_out (\"Check2: avgEnergyTotalGJ = #{$gResults[$outputHCode]['avgEnergyTotalGJ'].round(1)} ) \\n \")\n end\n\n if $ExtraOutput1 then\n stream_out(\"\\n Components of envelope heat loss: \\n\\n\")\n stream_out ( \" #{$gResults[$outputHCode]['EnvHLCeilingGJ'].round(1)} ( Envelope Ceiling Heat Loss (all zones), GJ ) \\n\")\n stream_out ( \" #{$gResults[$outputHCode]['EnvHLMainWallsGJ'].round(1)} ( Envelope Main Wall Heat Loss (all zones), GJ ) \\n\")\n stream_out ( \" #{$gResults[$outputHCode]['EnvHLWindowsGJ'].round(1)} ( Envelope Window Heat Loss (all zones), GJ ) \\n\")\n stream_out ( \" #{$gResults[$outputHCode]['EnvHLDoorsGJ'].round(1)} ( Envelope Door Heat Loss (all zones), GJ ) \\n\")\n stream_out ( \" #{$gResults[$outputHCode]['EnvHLExpFloorsGJ'].round(1)} ( Envelope Exp Floor Heat Loss (all zones), GJ ) \\n\")\n stream_out ( \" #{$gResults[$outputHCode]['EnvHLCrawlspaceGJ'].round(1)} ( Envelope Crawlspace Loss (all zones), GJ ) \\n\")\n stream_out ( \" #{$gResults[$outputHCode]['EnvHLSlabGJ'].round(1)} ( Envelope Slab Heat Loss (all zones), GJ ) \\n\")\n stream_out ( \" #{$gResults[$outputHCode]['EnvHLBasementBGWallGJ'].round(1)} ( Envelope BG Basement Heat Loss (all zones), GJ ) \\n\")\n stream_out ( \" #{$gResults[$outputHCode]['EnvHLBasementAGWallGJ'].round(1)} ( Envelope AG Basement Heat Loss (all zones), GJ ) \\n\")\n stream_out ( \" #{$gResults[$outputHCode]['EnvHLBasementFlrHdrsGJ'].round(1)} ( Envelope Basement Floor Hdr Heat Loss (all zones), GJ ) \\n\")\n stream_out ( \" #{$gResults[$outputHCode]['EnvHLPonyWallGJ'].round(1)} ( Envelope Pony Wall Heat Loss (all zones), GJ ) \\n\")\n stream_out ( \" #{$gResults[$outputHCode]['EnvHLFlrsAbvBasementGJ'].round(1)} ( Envelope Floors Above Basement Heat Loss (all zones), GJ ) \\n\")\n stream_out ( \" #{$gResults[$outputHCode]['EnvHLAirLkVentGJ'].round(1)} ( Envelope Air Leakage & Ventilation Heat Loss (all zones), GJ ) \\n\")\n stream_out ( \" --------------------------------------------------------\\n\")\n stream_out ( \" #{$gResults[$outputHCode]['EnvHLTotalGJ'].round(1)} ( Envelope Total Heat Loss (as reported in file), GJ ) \\n\")\n\n if ( parseDebug )\n $check = $gResults[$outputHCode]['EnvHLCeilingGJ'].to_f +\n $gResults[$outputHCode]['EnvHLMainWallsGJ'].to_f +\n $gResults[$outputHCode]['EnvHLWindowsGJ'].to_f +\n $gResults[$outputHCode]['EnvHLDoorsGJ'].to_f +\n $gResults[$outputHCode]['EnvHLExpFloorsGJ'].to_f +\n $gResults[$outputHCode]['EnvHLCrawlspaceGJ'].to_f +\n $gResults[$outputHCode]['EnvHLSlabGJ'].to_f +\n $gResults[$outputHCode]['EnvHLBasementBGWallGJ'].to_f +\n $gResults[$outputHCode]['EnvHLBasementAGWallGJ'].to_f +\n $gResults[$outputHCode]['EnvHLBasementFlrHdrsGJ'].to_f +\n $gResults[$outputHCode]['EnvHLPonyWallGJ'].to_f +\n $gResults[$outputHCode]['EnvHLAirLkVentGJ'].to_f\n stream_out (\" ( Note: sum above without basement floor above HL = #{$check.round(1)} )\")\n end\n\n stream_out ( \"\\n\\n #{$gResults[$outputHCode][\"AnnHotWaterLoadGJ\"].round(1)} ( Annual DHW heating load, GJ ) \\n\")\n end\n\n stream_out(\"\\n\\n Energy Cost (not including credit for PV, direction #{$gRotationAngle} ): \\n\\n\")\n stream_out(\" + \\$ #{$gResults[$outputHCode]['avgFuelCostsElec$'].round(2)} (Electricity)\\n\")\n stream_out(\" + \\$ #{$gResults[$outputHCode]['avgFuelCostsNatGas$'].round(2)} (Natural Gas)\\n\")\n stream_out(\" + \\$ #{$gResults[$outputHCode]['avgFuelCostsOil$'].round(2)} (Oil)\\n\")\n stream_out(\" + \\$ #{$gResults[$outputHCode]['avgFuelCostsPropane$'].round(2)} (Propane)\\n\")\n stream_out(\" + \\$ #{$gResults[$outputHCode]['avgFuelCostsWood$'].round(2)} (Wood) \\n\")\n# stream_out(\" + \\$ #{$gResults[$outputHCode][''].round(2)} #{$gAvgCost_Pellet.round(2)} (Pellet)\\n\")\n stream_out ( \" --------------------------------------------------------\\n\")\n stream_out ( \" \\$ #{$gResults[$outputHCode]['avgFuelCostsTotal$'].round(2)} (All utilities).\\n\")\n stream_out ( \"\\n\")\n\n netAnnualPV = $gResults[$outputHCode]['avgElecPVGenkWh'] - $gResults[$outputHCode]['avgElecPVUsedkWh']\n\n stream_out ( \" - \\$ #{$gResults[$outputHCode]['avgPVRevenue'].round(2)} (**Net PV revenue for #{$PVcapacity.round(0)} kW unit: #{netAnnualPV.round(0)} kWh at \\$ #{$PVTarrifDollarsPerkWh} / kWh)\\n\")\n stream_out ( \" --------------------------------------------------------\\n\")\n\n netUtilityCost = $gResults[$outputHCode]['avgFuelCostsTotal$'] - $gResults[$outputHCode]['avgPVRevenue']\n\n stream_out ( \" \\$ #{netUtilityCost.round(2)} (Net utility costs).\\n\")\n stream_out ( \"\\n\")\n\n if $ExtraOutput1 then\n stream_out(\"\\n Space Heating Energy Use by Fuel (GJ): \\n\\n\")\n stream_out(\" - #{$gResults[$outputHCode][\"AnnSpcHeatElecGJ\"].round(1)} (Space Heating Electricity, GJ)\\n\")\n stream_out(\" - #{$gResults[$outputHCode][\"AnnSpcHeatGasGJ\"].round(1)} (Space Heating Natural Gas, GJ)\\n\")\n stream_out(\" - #{$gResults[$outputHCode][\"AnnSpcHeatOilGJ\"].round(1)} (Space Heating Oil, GJ)\\n\")\n stream_out(\" - #{$gResults[$outputHCode][\"AnnSpcHeatPropGJ\"].round(1)} (Space Heating Propane, GJ)\\n\")\n stream_out(\" - #{$gResults[$outputHCode][\"AnnSpcHeatWoodGJ\"].round(1)} (Space Heating Wood, GJ)\\n\")\n stream_out(\" - #{$gResults[$outputHCode][\"AnnHotWaterElecGJ\"].round(1)} (Hot Water Heating Electricity, GJ)\\n\")\n stream_out(\" - #{$gResults[$outputHCode][\"AnnHotWaterGasGJ\"].round(1)} (Hot Water Heating Natural Gas, GJ)\\n\")\n stream_out(\" - #{$gResults[$outputHCode][\"AnnHotWaterOilGJ\"].round(1)} (Hot Water Heating Oil, GJ)\\n\")\n stream_out(\" - #{$gResults[$outputHCode][\"AnnHotWaterPropGJ\"].round(1)} (Hot Water Heating Propane, GJ)\\n\")\n stream_out(\" - #{$gResults[$outputHCode][\"AnnHotWaterWoodGJ\"].round(1)} (Hot Water Heating Wood, GJ)\\n\")\n end\n\n stream_out(\"\\n\\n Total Energy Use by Fuel (in fuel units, not including credit for PV, direction #{$gRotationAngle} ): \\n\\n\")\n stream_out(\" - #{$gResults[$outputHCode]['avgFueluseEleckWh'].round(0)} (Total Electricity, kWh)\\n\")\n stream_out(\" - #{$gResults[$outputHCode]['avgFueluseNatGasM3'].round(0)} (Total Natural Gas, m3)\\n\")\n stream_out(\" - #{$gResults[$outputHCode]['avgFueluseOilL'].round(0)} (Total Oil, l)\\n\")\n stream_out(\" - #{$gResults[$outputHCode]['avgFuelusePropaneL'].round(0)} (Total Propane, l)\\n\")\n\n # ASF 03-Oct-2016:\n # Wood/Pellets\n stream_out(\" - #{$gResults[$outputHCode]['avgFueluseWoodcord'].round(0)} (Total Wood, cord)\\n\")\n # stream_out(\" - #{$gAvgPelletCons_t.round(1)} (Pellet, tonnes)\\n\")\n # stream_out (\"> SCALE #{scaleData} \\n\");\n # Estimate total cost of upgrades\n $gTotalCost = 0\n\n if ( $Locale == \"NA\" )\n thisLocale = \"Basehouse location\"\n else\n thisLocale = $Locale\n end\n stream_out (\"\\n\\n Estimated costs in #{thisLocale} (x #{$gRegionalCostAdj} Ottawa costs) : \\n\\n\")\n\n $gChoices.sort.to_h\n for attribute in $gChoices.keys()\n\n debug_out \"Costing for #{attribute}: \"\n\n choice = $gChoices[attribute]\n cost = $gOptions[attribute][\"options\"][choice][\"cost\"].to_f\n $gTotalCost += cost\n stream_out( \" + #{cost.round()} ( #{attribute} : #{choice} ) \\n\")\n end\n stream_out ( \" - #{($gIncBaseCosts * $gRegionalCostAdj).round} (Base costs for windows) \\n\")\n stream_out ( \" --------------------------------------------------------\\n\")\n stream_out ( \" = #{($gTotalCost-$gIncBaseCosts * $gRegionalCostAdj).round} ( Total incremental cost ) \\n\\n\")\n $gRegionalCostAdj != 0 ? val = $gTotalCost / $gRegionalCostAdj : val = 0\n stream_out ( \" ( Unadjusted upgrade costs: \\$ #{val} )\\n\\n\")\n\n if ( $gERSNum > 0 )\n $tmpval = $gERSNum.round(1)\n stream_out(\" ERS value: #{$tmpval}\\n\")\n end\n\nend", "def parse\n lines = @text.split(\"\\n\")\n head = lines.shift\n head = head.gsub(/[[:punct:]]/, '')\n #head = head.gsub(/[[:space:]]|\\t/, '')\n head_match = Tables::Header_regex.match(head.strip)\n if head_match then\n @die = head_match[2].to_i\n @header = head_match[3].strip\n end\n lines.each { |l|\n l = l.gsub(/[[:punct:]]/, '')\n ti = Tables::Line_regex.match(l.strip)\n if ti then\n @outcomes << TableItem.new(ti.to_s)\n end\n }\n end", "def parse_file\n parsed_result_blocks = get_record_blocks\n\n gff_array = []\n if !parsed_result_blocks.empty?\n parsed_result_blocks.each do |b|\n gff_array << line_to_gff(b)\n end\n end\n return gff_array\n end", "def parse(file)\n doc = Nokogiri::XML( File.open( file ) )\n @type = doc.xpath(\"/probe/header/@type\").to_s\n @vendor = doc.xpath(\"/probe/header/@vendor\").to_s\n @services = \"<TODO>\"\n @indexes = \"<TODO>\"\n end", "def test_parse_job_full\n\t\tinfile=\"./testdata/job_parser.in.full\"\n\t\tresult=@parser.parse(infile)[:jobs]\n\t\t# jobは2個定義されている。\n assert_equal(3, result.size)\n\n\t\tjob=result.shift\n assert_equal('cpu1', job.wkstation)\n assert_equal('gl1', job.name)\n assert_equal('\"/usr/acct/scripts/gl1\"', job.scriptname)\n assert_equal('\"C:\\Hidemaru.exe %1\"', job.docommand)\n assert_equal('acct', job.streamlogon)\n assert_equal('\"general ledger job1\"', job.description)\n assert_equal(true, job.interactive)\n assert_equal('\"(RC=3) OR ((RC>=5) AND (RC<10))\"', job.rccondsucc)\n assert_equal('stop', job.recovery)\n\t\tassert_equal('SomeHost',job.recovery_job_wkstation)\n\t\tassert_equal('SomeJob1',job.recovery_job_name)\n\t\tassert_equal('\"! abended.\"',job.abendprompt)\n\n\t\tjob=result.shift\n assert_equal('cpu2', job.wkstation)\n assert_equal('gl2', job.name)\n assert_equal('\"/usr/acct/scripts/gl2\"', job.scriptname)\n assert_equal('\"C:\\Hidemaru.exe %2\"', job.docommand)\n assert_equal('acct', job.streamlogon)\n assert_equal('\"general ledger job2\"', job.description)\n assert_equal(true, job.interactive)\n assert_equal('\"(RC=3) OR ((RC>=5) AND (RC<10))\"', job.rccondsucc)\n assert_equal('continue', job.recovery)\n\t\tassert_equal('SomeHost',job.recovery_job_wkstation)\n\t\tassert_equal('SomeJob1',job.recovery_job_name)\n\t\tassert_equal('\": abended.\"',job.abendprompt)\n\n\t\tjob=result.shift\n assert_equal('cpu3', job.wkstation)\n assert_equal('gl3', job.name)\n assert_equal('\"/usr/acct/scripts/gl3\"', job.scriptname)\n assert_equal('\"C:\\Hidemaru.exe %3\"', job.docommand)\n assert_equal('acct', job.streamlogon)\n assert_equal('\"general ledger job3\"', job.description)\n assert_equal(true, job.interactive)\n assert_equal('\"(RC=3) OR ((RC>=5) AND (RC<10))\"', job.rccondsucc)\n assert_equal('rerun', job.recovery)\n\t\tassert_equal('SomeHost',job.recovery_job_wkstation)\n\t\tassert_equal('SomeJob1',job.recovery_job_name)\n\t\tassert_equal('\"abended.\"',job.abendprompt)\n\tend", "def parse_grimm(grimm_output)\n @grimm_output = grimm_output\n @parsed = {:rearrangements => []}\n parts = grimm_output.split('======================================================================')\n parts.first.split(/\\n/).each do |line|\n k, v = line.split(/:/, 2).map(&:strip)\n v.sub!(/\\s+\\(\\w+\\)$/, '') if k == \"Number of Chromosomes\"\n @parsed[k.downcase.gsub(' ', '_').to_sym] = v.match(/\\A[+-]?\\d+\\Z/) ? v.to_i : v\n end\n parts[2].split(/\\n/).each do |line|\n # Parse lines of the form:\n # Step 1: Chrom. 1, gene 587 [587] through chrom. 1, gene 591 [591]: Reversal\n next unless line =~ /^Step (\\d)+:/\n next if $1.to_i == 0\n m = line.match(/Chrom. (\\d+), gene (-?\\d+) \\[(-?\\d+)\\] through chrom. (\\d+), gene (-?\\d+) \\[(-?\\d+)\\]:([\\w ]+)/)\n @parsed[:rearrangements] << m.to_a.slice(1..-2).map(&:to_i).concat([m[-1].strip])\n end\n end", "def parseDemuxBustardSummary(demuxBustardSummaryXML)\n laneNumber = @fcBarcode.slice(/-\\d/)\n laneNumber.gsub!(/^-/, \"\")\n\n xmlDoc = Hpricot::XML(open(demuxBustardSummaryXML))\n\n (xmlDoc/:'ExpandedLaneSummary Read').each do |read|\n readNumber = (read/'readNumber').inner_html\n\n if readNumber.to_s.eql?(@readType.to_s)\n\n (read/'Lane').each do |lane|\n laneNum = (lane/'laneNumber').inner_html\n \n if laneNum.to_s.eql?(laneNumber.to_s)\n\n tmp = (lane/'phasingApplied').inner_html\n !isEmptyOrNull(tmp) ? @phasing = tmp : @phasing = 0\n tmp = (lane/'prephasingApplied').inner_html\n !isEmptyOrNull(tmp) ? @prePhasing = tmp : @prePhasing = 0\n end\n end\n end\n end\n\n (xmlDoc/:'LaneResultsSummary Read').each do |read|\n readNumber = (read/'readNumber').inner_html\n\n if readNumber.to_s.eql?(@readType.to_s)\n\n (read/'Lane').each do |lane|\n laneNum = (lane/'laneNumber').inner_html\n\n if laneNum.to_s.eql?(laneNumber.to_s)\n\n tmp = (lane/'oneSig/mean').inner_html\n !isEmptyOrNull(tmp) ? @firstCycleInt = tmp : @firstCycleInt = 0 \n tmp = (lane/'signal20AsPctOf1/mean').inner_html\n !isEmptyOrNull(tmp) ? @percentIntAfter20 = tmp : @percentIntAfter20 = 0\n end\n end\n end\n end\n end", "def parse\n logger.debug \"Reading stoage file from: #{self.file.path}\"\n if self.status != 'finished'\n last_parsed_line = self.last_parsed_line\n # make_options\n begin\n # Match the proper parser and build options\n case self.file_type\n when \"1\"\n @parser = Wms::Input::Filetype1\n else\n raise \"Undefined storage type #{file_type}\"\n end\n # when \"wifilocation\"\n # @parser = Wms::Input::AndroidWifiLocation\n # when \"sensor\"\n # @parser = Wms::Input::AndroidSensor\n # when \"audio\"\n # raise \"Not Supported yet storage type #{file_type}\"\n # else\n # raise \"Undefined storage type #{file_type}\"\n # end\n\n @processor = @parser.new\n options = make_options\n @processor.register(options=options)\n\n @processor.run do |data|\n begin\n create_event data\n \n rescue Exception => e\n logger.error \"ERROR #{self.class.name}: #{e} for #{data}\"\n end\n last_parsed_line += 1\n end\n\n \n self.last_parsed_line = last_parsed_line\n self.status = \"finished\"\n self.save\n \n rescue Exception => e\n logger.error \"ERROR: [#{e}]\"\n self.last_parsed_line = last_parsed_line\n self.status = \"error\"\n self.save\n end # end begin\n \n end #end if self.status != 'finished'\n\n\n \n \n end", "def process\n @log.info \"processing label mapping to #{@outfile}\" if @log\n time = File.mtime(@file)\n begin \n RDF::Writer.open(@outfile) do |writer|\n \t\n \trecord = RDF::URI.new(\"http://bio2rdf.org/sider\")\n \n File.open(@file,\"r\").each do |line|\n row = line.strip.chomp.split(\"\\t\") rescue next\n label = @sider[\"label_\"+Digest::MD5.hexdigest(row[-1])] \n \n writer << [label,DC.identifier,row[-1],record]\n writer << [label,RDF.type,@sider_vocabulary['Drug_Information_Label'],record]\n \n case row[1]\n when \"\"\n drug = @pubchem[row[3].to_i.abs.to_s]\n writer << [label,RDFS.comment,\"Label mapping for: #{CGI.escape(row[0])}\",record]\n writer << [label,@sider_vocabulary['involves_drug'],drug,record]\n writer << [drug,RDF.type,@sider_vocabulary['Drug'],record]\n writer << [drug,DC.identifier,\"cid:\"+row[3].to_i.abs.to_s,record]\n writer << [drug,RDFS.label,CGI.escape(row[0]),record]\n when \"combination\"\n writer << [label,RDFS.label,\"Label mapping for combination: #{row[0]}\",record]\n writer << [label,@sider_vocabulary['marker'],row[1],record]\n #writer << [label,RDF.type,@sider_vocabulary['Combination'],record]\n row[0].split(\";\").each {|drug| writer << [label,@sider_vocabulary['drug'],drug,record]}\n when \"not found\"\n # not implemented\n when \"mapping conflict\"\n # not implemented\n when \"template\"\n # not implemented\n end\n end\n end\n rescue ArgumentError => e\n @log.error e.backtrace.join(\"\\n\")\n end\n end", "def main(args)\n expectedArgs = 1\n helpMessage = \"Usage\\nlef_layer_blockage_count.rb input_lef [layer_name]\\n\"\n helpMessage << \"Default [layer_name] is VI1\\n\" \n if (args.size<expectedArgs)\n puts helpMessage\n abort\n end\n\n layer_name = \"VI1\"\n lef_file = args.shift\n if args.length>0\n layer_name = args.shift\n end\n\n\n # Header\n puts \"cell_name,#{layer_name}_blockage_count\"\n # Open a file and parse some stuff\n infile = File.open(lef_file,\"r\")\n lines = infile.readlines\n infile.close\n cntr=0\n layer_count=0\n in_obs = false\n in_obs_layer = false\n cell_layer_count = Hash.new()\n while cntr<(lines.length-1)\n line=lines[cntr]\n # Get cell name\n if line=~/^\\s*MACRO\\s+(\\w+)\\s*$/\n cell = $1\n layer_count=0\n # Look for obstruction\n elsif line=~/^\\s*OBS\\s*$/\n in_obs = true\n # Look for layers and get a count\n elsif in_obs && line=~/^\\s*LAYER\\s+#{layer_name}\\s*;/\n in_obs_layer = true\n #keep processinga all the layers and look for the end of the layers\n while in_obs_layer\n cntr+=1\n line=lines[cntr]\n if (line=~/^\\s*LAYER\\s+/) \n in_obs_layer = false\n elsif (line=~/^\\s*END\\s*$/)\n in_obs = false\n in_obs_layer = false\n else\n layer_count+=1\n end\n end\n cell_layer_count[cell]=layer_count\n puts \"#{cell},#{layer_count}\"\n # Look for end of obs\n elsif in_obs && (line=~/^\\s*END\\s*$/)\n in_obs = false\n end\n cntr+=1\n end\nend", "def gen_fragment(input_file)\n in_header = in_apibody = in_desc = in_example = in_code = nil\n header = apibody = desc = example = last_line = \"\"\n blanks = 0\n sep_line = \"<!-- break -->\\n\"\n stop_line = \"<!-- stop -->\\n\"\n \n lines = IO.readlines(input_file)\n \n use_separator = lines.include? sep_line\n \n lines.each do |line|\n line = line.rstrip + \"\\n\"\n # Skip multiple runs of blank lines\n if line == \"\\n\" and last_line == line\n next\n else\n last_line = line\n end\n \n # detect YAML header\n if line == \"---\\n\"\n in_header = (in_header == nil ? true : false)\n next\n end\n \n # collect YAML header\n if in_header\n header += line\n next\n end\n \n # collect API body\n in_apibody = true if line == \"{% apibody %}\\n\" and in_apibody == nil\n apibody += line if in_apibody\n in_apibody = false if line == \"{% endapibody %}\\n\"\n \n # collect description\n if line == \"# Description #\\n\"\n in_desc = true\n next\n end\n if in_desc\n if line.start_with? \"<img\"\n blanks -= 1\n next\n end\n if use_separator\n if line == sep_line\n in_desc = false\n else\n desc += line\n end\n next\n end\n blanks += 1 if line == \"\\n\"\n if blanks > 1\n in_desc = false\n else\n desc += line\n end\n end\n\n # collect first example\n if line.start_with? \"__Example:\" and in_example == nil\n in_example = true\n example += line\n next\n end\n if in_example\n if line.start_with? \"__Example:\" or line == stop_line\n in_example = false\n else\n example += line\n end\n end\n end\n example.strip!\n apibody.strip!\n desc.strip!\n header = YAML.load(header)\n permalink = header['permalink'].split(\"/\")[-1] + \"/\"\n \n <<-EOS\n## [#{header['command']}](#{permalink}) ##\n\n#{apibody}\n\n#{desc}\n\n#{example}\n\n[Read more about this command &rarr;](#{permalink})\n\nEOS\nend", "def run_blast_with_splitting evalue, threads, bin1, bin2\n # puts \"running blast by splitting input into #{threads} pieces\"\n if !File.exist?(@output1)\n blasts=[]\n files = split_input(@query, threads)\n threads = [threads, files.length].min\n files.threach(threads) do |thread|\n cmd1 = \"#{bin1} -query #{thread} -db #{@working_dir}/#{@target_name} \"\n cmd1 << \" -out #{thread}.blast -evalue #{evalue} \"\n cmd1 << \" -outfmt \\\"6 std qlen slen\\\" \"\n if bin1=~/blastn/\n cmd1 << \" -dust no \"\n elsif bin1=~/blastx/ or bin1=~/blastp/ or bin1=~/tblastn/\n cmd1 << \" -seg no \"\n end\n cmd1 << \" -soft_masking false \"\n cmd1 << \" -max_target_seqs 50 \"\n cmd1 << \" -num_threads 1\"\n if !File.exists?(\"#{thread}.blast\")\n blast1 = Cmd.new(cmd1)\n blast1.run\n if !blast1.status.success?\n raise RuntimeError.new(\"BLAST Error:\\n#{blast1.stderr}\")\n end\n end\n blasts << \"#{thread}.blast\"\n end\n cat_cmd = \"cat \"\n cat_cmd << blasts.join(\" \")\n cat_cmd << \" > #{@output1}\"\n catting = Cmd.new(cat_cmd)\n catting.run\n if !catting.status.success?\n raise RuntimeError.new(\"Problem catting files:\\n#{catting.stderr}\")\n end\n files.each do |file|\n File.delete(file) if File.exist?(file)\n end\n blasts.each do |b|\n File.delete(b) # delete intermediate blast output files\n end\n end\n\n if !File.exist?(@output2)\n blasts=[]\n files = split_input(@target, threads)\n threads = [threads, files.length].min\n files.threach(threads) do |thread|\n cmd2 = \"#{bin2} -query #{thread} -db #{@working_dir}/#{@query_name} \"\n cmd2 << \" -out #{thread}.blast -evalue #{evalue} \"\n cmd2 << \" -outfmt \\\"6 std qlen slen\\\" \"\n cmd2 << \" -max_target_seqs 50 \"\n cmd2 << \" -num_threads 1\"\n if !File.exists?(\"#{thread}.blast\")\n blast2 = Cmd.new(cmd2)\n blast2.run\n if !blast2.status.success?\n raise RuntimeError.new(\"BLAST Error:\\n#{blast2.stderr}\")\n end\n end\n blasts << \"#{thread}.blast\"\n end\n cat_cmd = \"cat \"\n cat_cmd << blasts.join(\" \")\n cat_cmd << \" > #{@output2}\"\n catting = Cmd.new(cat_cmd)\n catting.run\n if !catting.status.success?\n raise RuntimeError.new(\"Problem catting files:\\n#{catting.stderr}\")\n end\n files.each do |file|\n File.delete(file) if File.exist?(file)\n end\n blasts.each do |b|\n File.delete(b) # delete intermediate blast output files\n end\n end\n\n end", "def read_end_data\n _app, data = File.read(file).split(/^__END__$/, 2)\n data || ''\n end", "def parse\n read_header\n parse_text_segment\n parse_data_segment\n @data = nil\n end", "def find_blat_out_candidate_reads\n\t\tputs \"step 4 find blat out candidate reads\"\n\t\tblat_out_candidate_reads(\n\t\t\tfiles.keys.sort.collect{|k| \"chopped_#{k}lane.psl \" },\n\t\t\tfiles.keys.sort.collect{|k| \"#{k}lane.fa \" },\n\t\t\tfiles.keys.sort.collect{|k| \"04_blat_out_candidate_#{k}lane.fa\" })\n\n#\t\tcommand = \"blatoutcandidate.rb \"\n#\t\t#\tfiles is a hash and the keys are not guaranteed to be sorted\n#\t\t#\tsort alphabetically and left is first, right is last (conveniently)\n#\t\tfiles.keys.sort.each{|k| command << \"chopped_#{k}lane.psl \" } #\tNON-HUMAN matches\n#\t\tfiles.keys.sort.each{|k| command << \"#{k}lane.fa \" } #\traw reads input\n#\t\tcommand.execute\n##\n##\tblatoutcandidate.pl ALWAYS creates ... blat_out_candidate_#{k}lane.fa\n##\tI REALLY don't like that. So much inconsistancy. Will overwrite existing.\n##\n##\tTODO wrote my own version of blatoutcandidate so could change this\n##\n#\t\tfiles.each_pair { |k,v| \n#\t\t\t#\t\n#\t\t\t#\traw reads with names in the psl files.\n#\t\t\t#\t\n#\t\t\t\"blat_out_candidate_#{k}lane.fa\".file_check(die_on_failed_file_check)\n#\t\t\tFileUtils.mv( \"blat_out_candidate_#{k}lane.fa\",\n#\t\t\t\t\"04_blat_out_candidate_#{k}lane.fa\" )\t#\tNON-HUMAN matches \n#\t\t}\n\tend", "def _parse\n unless errored?\n @players = @league.parser.new(\n @pre_processor.output_file,\n @league.feed_config\n ).start\n\n _output_parse_success('parsing')\n end\n rescue Exception => e\n _output_exception(e, 'parsing')\n end", "def parse_row row=nil\n @row = row if row\n @row<<\"\\n\" #;p \"row:#{@row}\"\n p \"_____> #{@row}\" if @dbg[:parse] && @plt == 99 && @rmk == 99\n\n parse_spc\n \n @ln_end = \"\" #imediate ends tag\n @row.gsub!(/\\\\\\\\/,'\u001e') #esc char \\\\\n @row.gsub!('\\}','\u001c') #esc char \\}\n @row.gsub!('\\;','\u001d') #esc char \\;\n while (parse_all) do; end \n @row.gsub!('\u001e','\\\\')\n @row.gsub!('\u001c','}')\n @row.gsub!('\u001d',';')\n if @ln_end!=\"\"\n @row.gsub!(/([\\n\\t ]*$)/,'')\n @row << \"#{@ln_end.strip}\\n\"\n end\n if @row.strip!=\"\" # responsible for generating good output\n p \"#####> #{@row}\" if @dbg[:parse] \n @doc_out << (@row.rstrip + \"\\n\") \n #@doc_out << @row.rstrip # not working for \n #@doc_out << \"\\n\" # shortcut if elsif else \n end\n @row\n end\n\n #parse one w2tags, result will be name of the target file created\n def parse_file(src,init_start=true,chk_date=false)\n tgt,@ext = [src[/(.+\\.)w2(\\w+)$/,1]<<$2,$2]\n \n return nil if !File.exist?(src) #p \"src: #{src} not found...\"\n if chk_date && File.exist?(tgt)\n return nil if File.mtime(src) <= File.mtime(tgt)\n end\n \n puts \"\\nParsing W2Tags File:#{src}\" \n parsing(src,tgt,init_start)\n tgt\n end\n \n #parse multiple w2tags files, result will be array of target file created\n def parse_files(srcs,init_start=true)\n srcs.collect do |src|\n src.gsub!(/\\n/,'')\n parse_file(src,init_start)\n end.compact\n end\n \n def end_tags(arr)\n @tg_end = @tg_end + arr\n end\n \n #call from proc hot before it render hots line\n #see in source code \"w2tags.rb::read_filehot\"\n #default behaviour for tag_nex will not execute\n #since @mem_hot will assigned w/o nil\n #assigned nil using \"%!\" in w2tags \n def chg_mem_hot(nxt)\n @mem_hot = nxt \n @mem_tag[\"^\"] = nxt if nxt\n end\n \n #pop up end tags from the stack \n #result will be string contains end tags from stack \n #who's space inside each end tags > current space\n def multi_end(ttls)\n rpls = ''\n ttl = @tg_end.size-1\n ttl = ttls-1 if ttls\n ttl.downto(0) do |i|\n sz = @tg_end[i][/^ +/].to_s.size\n if ttls || @spc.size <= sz\n send = @tg_end.pop.to_s\n if send.strip[0,5]==\"!run!\"\n scrpt = send.gsub(\"\\n\",\"\\n#{@spc}\").split(\"\\n\")\n @doc_src = scrpt[1,99]+@doc_src\n else\n spc = send[/(^[ \\t]*)/,1].to_s\n rpls << send.gsub(/\\n/,\"\\n#{spc}\") + \"\\n\" \n end\n end\n end\n p \"End..: #{rpls.strip}\" if @dbg[:parse] && rpls!= ''\n rpls\n end\n \n private \n\n # try to shift empty line create document and add current \n # row to source. but it means re parsing current row.\n def swap_last_empt_src_with_end_tg(end_tg)\n while @doc_out[-1] && @doc_out[-1].strip == ''\n @doc_out.pop\n end\n @doc_out<< \"\\n\" if @doc_out[-1] && @doc_out[-1][-1,1] != \"\\n\" # responsible for generating good output\n end_tg.shift if end_tg[0].strip==''\n @doc_src = end_tg + @doc_src #; p @doc_src; p @doc_out\n #p \"Swp..: #{@doc_src[-1]}\" if @dbg[:parse] \n end\n \n #merging file hot based on the target extension, and target \n #extension it self based on source extension, example: \n #suppose you have source of w2tags 'index.html.w2erb' \n #it just like autoloading:\n # !hot!erb\n #it will search HOT files in current folder, if it not found \n #it will search in gem/hot and merging the HOT\n def merge_tags(ext) \n hot1 = \"#{@src_path}/#{ext}.#{@hot}\"\n hot2 = \"#{W2Tags::Dir}/../hot/#{ext}.#{@hot}\"\n filehot = hot1 if File.exist?(hot1)\n filehot = hot2 if File.exist?(hot2)\n if filehot\n puts '=>'+File.expand_path(filehot) if !@silent\n @tg_hot.merge!(W2Tags.read_filehot(filehot)) \n end\n @tg_hot\n end\n \n #define variable ( &var! or @var! )tobe use by parser in hot for \n #the next line parsing, example on w2tags: \n # &myvar=hello\\n\n # ^{.myclass &myvar!}\n #\n #it will translate on the fly to:\n # ^{.myclass hello}\n #\n #for @var! is uniq value split by \";\", example on w2tags:\n # @myvar=hello;world\\n\n # @myvar=world;tags\\n\n # ^{.myclass @myvar!}\n #\n #it will translate on the fly to:\n # ^{.myclass hello;world;tags}\n def parse_set_var\n if @row.gsub!( /^[ \\t]*(&[\\w]+)=([^\\n]+)([\\n])/,'')\n @mem_var[$1+\"!\"] = $2.strip\n elsif @row.gsub!(/^[ \\t]*(@[\\w]+)=([^\\n]+)([\\n])/,'')\n k,v = [$1+\"!\",$2.strip] #;p v\n #v << ';'+@mem_var[k].to_s if v[0,1]!=';' && @mem_var[k]\n v = (@mem_var[k].to_s + ';' + v) if v[0,1]!=';' && @mem_var[k]\n @mem_var[k] = v.split(';').uniq.select{|x|x!=''}.join(';')\n p \"uniqV> #{v}\" if @dbg[:parse] #&& @plt == 99 && @rmk == 99\n end\n end\n \n #when parsing and found tag\n # !hot!filehot1;filehotN\n #it will search HOT files in current folder, if it not found it will search\n #in gem/hot and merging the HOT, this command can have multiple\n #file HOT separate with \";\"\n def merge_hot\n if(/!hot! *([\\w;.\\/]+)([\\n])/ =~ @row;@rgx = $~)\n hots= @rgx[1].split(';').collect {|x|x+'.'+@hot}\n rpl = ['']\n hots.each do |hot|\n fls = File.exist?(hot) ? hot :\n File.exist?(@src_path+'/'+hot) ? @src_path+'/'+hot :\n File.exist?(W2Tags::Dir+'/../hot/'+hot) ? W2Tags::Dir+'/../hot/'+hot : ''\n if fls==''\n rpl << \"<!--\"+hot+\", Not Found-->\\n\"\n else\n puts '=>'+File.expand_path(fls) if !@silent\n @tg_hot.merge!(W2Tags.read_filehot(fls))\n end \n end\n @row.gsub!(@rgx.to_s,rpl.join)\n end\n end\n \n #when parsing and found tag \n # !inc!fileinc\n #it will include / replace current row from file include, and after \n #parser will try to get current row after merging to be evaluate\n def merge_w2x\n if(/!inc! *([\\/\\w\\d._]+)([\\n])/ =~ @row;@rgx = $~)\n mac = @src_path+'/'+$1 \n src = $~.to_s #;p mac\n if File.exist?(mac)\n pop = $~.captures.pop\n #new = IO.read(mac).delete(\"\\r\").gsub(\"\\n\",\"\\n\"+@spc) \n new = read_w2tags(IO.read(mac))\n @doc_src= @row.gsub(src,new).split(\"\\n\")+@doc_src\n @row= @doc_src.shift+\"\\n\"\n parse_spc\n else\n @row.gsub!(src,\"<!--\"+mac+\", Not Found-->\\n\") \n nil\n end\n end\n end\n \n #get space (tab and spaces) on the left of the code and save it to instance\n #it will be use if row replace with more than one row and replacement row\n #must continue with current column (indent). \n def parse_spc\n @spc = @row[/(^[ \\t]+)/,1].to_s #sometime result is nil\n @ron = @row.strip.size\n end\n \n #do the translation from the params inside function like:\n # %a par1;par2;par3\n #it do following job:\n # * replace constanta (&var!) inside params of the function\n # * replace constanta (&var!) inside new line of source code \n # (inside instance var @new)\n # * replace var $0 - $9 inside var @new from params if function have\n # 3 params so 3 var $ will be replace from the params and if var @new\n # have var # more than what function params suply, it will replace with\n # an empty string\n # * if in var @new define only 1 var $ and function params got more than \n # 1, it will multiply the @new line with total number of lparams\n # to get the illustrate I'll show you with an example:\n # inside hot file :\n # >>td\n # <td>$0</td>\n # --------------------\n # function call: @td(col1;col2) # will result in \n # --------------------\n # <td>col1</td>\n # <td>col2</td>\n # * some of the replacement behaviour for var $ are :\n # 1. optional meaning that var $ inside [ xxx $ xxxx ] sequare bracket are\n # optional if not suply from params it will an emppty replacement\n # 2. default value meaning that var $ inside [ xxx $ left sequare bracket\n # are a default if not suply from params but if it suply from params it\n # will empty the default and relace var $ from the params\n # 3. execute String.method if var $ in the left got \":\", example\n # inside hot file:\n # >>td\n # <td>:capitalize$0</td> \n # --------------------\n # function call: @td(col1;col2) # will result in \n # --------------------\n # <td>Col1</td>\n # <td>Col2</td>\n def get_dollar(prms,ends=nil) #prms='@0;@1;@2' from hot\n @mem_var.each do |k,v| #;p \"#{k}, #{v}\"\n prms.gsub!(k,v)\n if k[0,1]=='*' and Regexp.new(\"~([^~]+)~#{k}\".gsub('*','\\\\*')) =~ @new\n @new.gsub!($~.to_s,(v!='' ? v : $1)) \n else\n @new.gsub!(k,v)\n end\n end\n prms.gsub!(/\\\\\\\\/,'\u001e') #esc char \\\\\n prms.gsub!('\\}','\u001c') #esc char \\}\n prms.gsub!('\\;','\u001d') #esc char \\;\n prms = prms.split(';') #W2Tags::splitter(prms)\n new_prms = @new.scan(/\\$[0-9]/).uniq\n new_alls = @new.scan(/\\$\\*/) #;p 'rpl:',new_alls,new_prms,prms\n @new.gsub!($1,\"<%= \\\"#{$2}\\\" %>\") if /(==(\\$[0-9]))/ =~ @new\n @new.gsub!($1,\"<%= #{$2} %>\") if /(=(\\$[0-9]))/ =~ @new\n if /^@[0-9]$/ =~ prms[0]\n rpl = prms.shift.gsub('@','$')\n repeat = @new\n repeat.gsub!('$0',prms.shift) #repeat.gsub!('$*',rpl)\n @new = ''\n prms.each_with_index do |x,i| #;p \"$0 #{x} => #{repeat}\"\n @new += repeat.gsub(rpl,x)\n if i+1<prms.size\n @new += \"\\n\"+@spc+ends.join(\"\\n\") if ends \n @new += \"\\n\"+@spc \n end\n end\n p \"Rept1: #{@new}\" if @dbg[:parse] \n elsif new_alls==[] && new_prms.size==1 && prms.size>1 \n tmp = \"\"\n rpt = @rgx.to_s.gsub(@rgx[3]+\"\\n\",\"\")\n #multi key params(class,attribute,etc)\n classs = rpt[/([.:#].*\\{.*?\\}.*?) /,1] \n classs = rpt[/(\\{.*?\\}.*?) /,1] if !classs \n classs = rpt[/([.:#].*?) /,1] if !classs \n classs.sub!(/=$/,'') if classs\n clsmlt = classs.to_s.split(';')\n clscnt = clsmlt.length\n clsmlt+= clscnt==1 ? clsmlt*prms.length : ['']*prms.length\n prms.each_with_index do |x,i|\n y = x.strip\n if /^~[-%]/ =~ y\n tmp<< y[1,y.length-1]\n tmp<< \"\\n#{@spc}\" if i+1<prms.size\n else\n line = rpt+x #tmp<< @new.gsub(new_prms[0],x) \n #implement multi class params ^.d;.g canggh;bow\n line.gsub!(classs,clsmlt[i]) if classs\n tmp<< line\n tmp<< \"\\n#{@spc}\" if i+1<prms.size\n end\n end\n p \"Rept2: #{tmp}\" if @dbg[:parse] \n @new = tmp\n else\n i = new_prms.size - 1\n new_prms.sort.reverse.each do |x|\n while Regexp.new('\\\\'+x+':(\\d+)') =~ \"\\n#{@new}\" do\n idx = $1\n src = $~.to_s\n rpl = idx ? prms[i].split(':')[idx.to_i].to_s.strip : ''\n p \"Splt : #{prms[i]} => #{idx}\" if @dbg[:parse] \n @new.gsub!(src,rpl)\n end\n \n rgx = '\\\\'+x+'\\.([^~ ]+)~' #/\\$0\\.([^~ ]~)/ => fix: next-tag (~^)\n eva_v = Regexp.new(rgx) #Ex:$1.upcase~\n while eva_v=~ \"\\n#{@new}\" do\n src = \"#{x}.#{$1}~\" #p \"\\n#{@new} => #{src}\"\n evl = \"\\\"#{prms[i]}\\\".#{$1}\" #p \"====> #{evl} <==\"\n p \"Eval : #{evl}\" if @dbg[:parse] \n rpl = prms[i] ? eval(evl).to_s : \"\"\n @new.gsub!(src,rpl)\n end\n \n opt_v = Regexp.new('~([^$]*)\\\\' +x+'([^~]*)~') \n def_v = Regexp.new('~([^~]+)~\\\\'+x) \n if opt_v =~ @new #;p $1\n rpl = ''\n rpl = \"#{$1.to_s}#{prms[i]}#{$2.to_s}\" if prms[i] && prms[i].strip!=\"\"\n @new.gsub!(opt_v,rpl)\n #p \"options: #{rpl} >> #{@new}\"\n elsif def_v =~ @new #;p $1\n src = $~.to_s\n rpl = (prms[i] && prms[i].strip!=\"\" ? prms[i] : $1)\n @new.gsub!(src,rpl) \n #p \"default: #{@new}\"\n end\n #p \"rest: #{x} => #{prms[i].to_s}\"\n @new.gsub!(x,prms[i].to_s)\n i = i -1\n end\n @new.gsub!(/\\$\\*/,prms[new_prms.size,99].to_a.join(';') )\n @new.gsub!(/\\n\\t+$/,'') #remove line if only tabs\n end\n end\n \n #pop up end tags from the stack \n def multi_end2(ttls)\n rpls = ''\n ttl = @tg_end.size-1\n ttl = ttls-1 if ttls\n ttl.downto(0) do |i|\n sz = @tg_end[i][/^ +/].to_s.size\n if ttls || @spc.size <= sz\n send = @tg_end.pop\n if send.strip[0,5]==\"!run!\"\n scrpt = send.gsub(\"\\n\",\"\\n#{@spc}\").split(\"\\n\")\n @doc_src = scrpt[1,99]+@doc_src\n else\n spc = send[/(^[ \\t]*)/,1].to_s\n rpls << (send.gsub(\"\\n\",\"\\n#{spc}\") + \"\\n\") \n end\n end\n end\n p \"End2 : #{rpls}\" if @dbg[:parse] && rpls!= ''\n rpls\n end\n \n #command execution \"-key\", internally parsed to \"%_key~\", so both command\n #are the same except that command \"-key\" need to translate to \"%_key~\" and\n #it goes to Hot files key definition to lookup to. some of these definition\n # built in (for erb: %_if , %_elsif , %_else , %_end , ... etc)\n # -if => %_if\n # -li => %_li\n def shortcut_exec(regex)\n if(regex =~ @row;@rgx = $~)\n srcs = @rgx.to_s\n rplc = \"#{@rgx[1]}%!_#{@rgx[2]}~ #{@rgx[3]}\\n\"\n @row.gsub!(srcs,rplc)\n p \"reExe_ #{@row}\" if @dbg[:parse]\n end\n end\n \n #command execution \"=\", internally parsed to \"%=~\", so both command\n #are the same except that command \"=\" need to translate to \"%=~\" and\n #it goes to Hot files key definition to lookup to. you can redefine it.\n def shortcut_equal(regex)\n if(regex =~ @row;@rgx = $~)\n srcs = @rgx.to_s\n rplc = \"#{@rgx[1]}%!=~#{@rgx[3]}\\n\"\n @row.gsub!(srcs,rplc)\n p \"reEqu_ #{rplc}\" if @dbg[:parse]\n end\n end\n \n #this command is the selector from command \n # %..key.. params1;paramsN \\n\n #ex: \n # %div<space>params\\n or %div<\\n>. \n #if key div fine in hot, it will translate to HOT tags, but if not \n #it become w2tags\n def get_hot_simple(regex)\n if regex =~ @row ;@rgx = $~ \n chk1= @rgx[2][-1,1] + @rgx[3][0,2].to_s \n chk2= @rgx[2][/\"\\}!/]\n chk3= @rgx[2][/\"\\}~/]\n # already become w2tags, ignore!!!\n if (/[=\\}][!~][ ]?/ !~ chk1 && chk2 == nil && chk3 == nil) \n keys = @rgx[2].strip\n opts = @rgx[3]\n #p chk1\n # FIX for: \n # %form#dodol{action=\"<%= #{aaa} %>\"} <%= #{bbb} %>\n # <form id=\"dodol\" action=\"<%= #{aaa} %>\"><%= #{bbb}%></form>\n # when wrong splitting, fix the splitting...\n # assume last attribute don't have spaceses!!! ==>{opt=\"blah\"}<==\n fixd = keys.split('\"} ')\n if fixd.length>1\n keys = fixd[0]+'\"}'\n opts = fixd[1]+opts\n end\n \n srcs = @rgx.captures.join\n opts = $1 << opts if keys.gsub!(/(\\/)$/,'')\n hots = keys.gsub(/\\{.*\\}$/,'').gsub(/[:#.][\\w\\-#.=]*$/,'')\n rplc = @tg_hot[hots]!=nil ? \n \"%!#{keys}~ #{opts}\" : \n \"%!#{keys}! #{opts}\" \n @row.gsub!(srcs,rplc)\n p \"reHot> #{@row} << -H-O-T-\" if @dbg[:parse]\n end\n end\n end\n \n #translation for tags with shortcut of name, id, or class and put in constants\n # ex: %div:name#id.class{attribute}=\n #will result in some of this var:\n # @mem_var['$$' ] => :name#id.class{attribute}==\n # @mem_var['$:' ] => :name\n # @mem_var['$#' ] => #id\n # @mem_var['$.' ] => .class\n # @mem_var['$@' ] => {attribute}\n # @mem_var['*:' ] => name\n # @mem_var['*#' ] => id\n # @mem_var['*.' ] => class\n # @mem_var['*@' ] => attribute\n # @mem_var['*all*' ] => name=\"name\" id=\"id\" class=\"class\"\n # @mem_var['*name*' ] => name=\"name\"\n # @mem_var['*id*' ] => id=\"id\"\n # @mem_var['*class*'] => class=\"class\"\n # this var will be use in parsing w2tags/hot command\n def nameidclass_var()\n #@key = keys = @rgx[2].strip.gsub(/(\\{(.*)\\})/,'') #greedy :)\n @key = keys = @key.strip.gsub(/(\\{(.*)\\})(=*)/,'') #greedy :)\n @att = $2.to_s.strip\n lkey = $3.to_s.strip\n @mem_var['$$' ]= ''\n @mem_var['$&' ]= ''\n @mem_var['$:' ]= ''\n @mem_var['$#' ]= ''\n @mem_var['$.' ]= ''\n @mem_var['$@' ]= $1.to_s\n @mem_var['$=' ]= ''\n @mem_var['*&' ]= ''\n @mem_var['*:' ]= ''\n @mem_var['*#' ]= ''\n @mem_var['*.' ]= ''\n @mem_var['*@' ]= @att=='' ? '' : @att+' '\n @mem_var['*all*' ]= ''\n @mem_var['*name*' ]= ''\n @mem_var['*id*' ]= ''\n @mem_var['*class*']= ''\n @mem_var['*code*' ]= ''\n #p keys\n if @key.gsub!(/([:#.&=])([\\/\\t\\w\\-#.\\[\\]&= ]*$)/,'')\n keys = $1+$2\n @mem_var['$$'] = keys.clone\n if keys.gsub!(/^:([\\w\\-.\\[\\]]*)/,'')\n if $1!=''\n @mem_var['$:' ] = \":#{$1}\"\n @mem_var['*:' ] = $1\n @mem_var['*name*' ] = \"name=\\\"#{$1}\\\" \" \n @mem_var['*all*' ]<< \"name=\\\"#{$1}\\\" \" \n end \n end\n if keys.gsub!(/^#([\\w\\-]*)/,'')\n if $1!=''\n @mem_var['$#' ] = \"##{$1}\"\n @mem_var['*#' ] = $1\n @mem_var['*id*' ] = \"id=\\\"#{$1}\\\" \" \n @mem_var['*all*' ]<< \"id=\\\"#{$1}\\\" \" \n end \n end\n if keys.gsub!(/^\\.([\\w\\-\\.]*)/,'')\n if $1!=''\n cl = $1\n cx = cl.split('.').collect {|x|x.strip}.join(' ')\n @mem_var['$.' ] = \".#{cl}\"\n @mem_var['*.' ] = cx\n @mem_var['*class*'] = \"class=\\\"#{cx}\\\" \"\n @mem_var['*all*' ]<< \"class=\\\"#{cx}\\\" \"\n end \n end\n if keys.gsub!(/^&([\\/\\w\\-.]*)/,'')\n if $1!=''\n @mem_var['$&' ] = \"&#{$1}\"\n @mem_var['*&' ] = $1\n end \n end\n @key << keys\n end\n @mem_var['*all*'] << @mem_var['*@']\n @mem_var['*att*'] = @mem_var['*@']\n if @key[0,1]!='='\n @key << lkey\n if @key.gsub!(/==+$/,'')\n @mem_var['*code*'] = '<%= \"$*\" %>'\n @mem_var['$@']<< \"==\"\n @mem_var['$='] = \"==\"\n elsif @key.gsub!(/=$/,'')\n @mem_var['*code*'] = \"<%= $* %>\"\n @mem_var['$@']<< \"=\"\n @mem_var['$='] = \"=\"\n end\n end\n end\n \n #these not really visible for end user, since user usualy see the command as\n #a HAML like command and translate to this HOT files. the translation usually\n #came from method in:\n # shortcut_exec\n # get_hot_simple\n #format for this command is \n # %...key...~..params1;paramsN..\\n\n def parse_hot \n eva = ''\n col = @row.split('%')\n return false if col.size==1\n (col.size-1).downto(0) do |c|\n eva = \"%#{col[c]}\" << eva\n @rg_hot.each do |ht|\n if(ht =~ eva;@rgx = $~)\n @key = @rgx[2]\n prms = @rgx[3].to_s.strip\n if /^\\!/ =~ @key\n @new = (multi_end2(nil)+@spc+@rgx.to_s.gsub('%!','%')).split(\"\\n\")\n swap_last_empt_src_with_end_tg(@new) #@new array of src\n @row = ''\n else\n nameidclass_var()\n # Auto closing, see in \"erb.hot\": _elsif _else:\n # when last doc out is <% end %> and hot command is %_elsif or %_else\n # then remove the last doc out <% end %>\n if @doc_out[-1] and @doc_out[-1].strip=='<% end %>'\n @doc_out.pop if %w[else elsif].include? prms.split(' ')[0]\n end\n params_inline prms #concenation line if params end with \\\n @mem_var[\"$tag\"] = @key\n if @tg_hot[@key]\n hots = @tg_hot[@key] \n hots[1]='' if !hots[1] #remark if not error!\n @new = hots[0].call(self).clone \n if @new.strip==\"\" #&& @tg_end[-1]\n @tg_end << \"#{@spc}#{hots[1][0]}\"\n empt = @row.gsub!(@rgx.to_s,\"\").strip\n @row = empt if empt == \"\" #remove if empty (only \\t,\\n)\n else\n @tg_end << \"#{@spc}#{hots[1][0]}\" if hots[1]\n @new.gsub!(/( *~\\^.*[^\\n]+)/,\"^~^~^\")\n setvar = $1 # don't parse SetMem ~^\n @new.gsub!(/\\n/,\"\\n#{@spc}\")\n get_dollar(prms,hots[1]) \n @new.gsub!(/\\^~\\^~\\^/,setvar) if setvar #restore SetMem\n re_indent(@rgx.to_s)\n end\n p \"Func>> #{@new}\" if @dbg[:parse]\n else\n @row.gsub!(@rgx.to_s,\"<!-- no hot for:#{@key} -->\")\n end\n end\n break\n end\n end\n break if @rgx\n end\n @rgx!=nil\n end\n \n def re_indent(srcs)\n new_rows = @row.gsub(srcs,@new).split(\"\\n\").select {|x|!(/^ *$/=~x)}\n while @doc_src[0] && /^ *$/ =~ @doc_src[0] #remove empty/space line\n @doc_src.shift\n end\n spc_row1 = (/[^ ]/ =~ new_rows[ 0]).to_i\n spc_last = (/[^ ]/ =~ new_rows[-1]).to_i\n spc_adds = spc_last - spc_row1 \n #p \"SPACE ADD #{spc_row1} #{spc_last} #{(/[^ ]/ =~ @doc_src[0]).to_i}\"\n #p new_rows\n #p [@doc_src[0]]\n if spc_adds > 0 \n idx = 0\n spc = ' '*spc_adds\n while @doc_src[idx] && (/[^ ]/ =~ @doc_src[idx]).to_i > spc_row1\n @doc_src[idx] = spc + @doc_src[idx]\n idx += 1\n end\n end \n #@doc_src = @row.gsub(srcs,@new).split(\"\\n\")+@doc_src\n @doc_src = new_rows + @doc_src\n @row = @doc_src.shift+\"\\n\"\n parse_spc\n end\n\n #internal use call from \n # get_div\n # get_input\n def get_shortcut(regex,tag)\n if(regex =~ @row;@rgx = $~)\n src = @rgx.captures.join\n keys= @rgx[1,2].join.strip\n opts= @rgx[3].to_s\n opts= $1 << opts if keys.gsub!(/(\\/)$/,'')\n #tgt = \"%!#{tag}#{keys}!#{opts}\"\n tgt = \"%#{tag}#{keys} #{opts}\"\n @row.gsub!(src,tgt)\n p \"to#{tag.capitalize[0,3]}: #{tgt}\" if @dbg[:parse]\n end\n @rgx!=nil\n end\n \n #shortcut for \n # \"%...div...!params\", \n #and user no need to write \n # \"%div\" \n #if user supply the command with ID or CLASS.\n # %div#key my key features \n #same as:\n # #key my key features \n #\n # %div.okey my key features \n #same as:\n # .okey my key features \n def get_div( regex)\n get_shortcut(regex,'div')\n end\n \n #shortcut for \n # \"%...input...!params\", \n #and user no need to write \n # \"%input\" \n #if user supply the command with NAME\n # %input:wharsojo my key features \n #same as:\n # :wharsojo my key features \n def get_input(regex)\n get_shortcut(regex,'input')\n end\n \n #popup the closing tags when indentation are less than the previous.\n def auto_close\n if @tg_end.size>1\n sz = @tg_end[-1][/^ +/].to_s.size\n if @spc.size <= sz\n ed = multi_end(nil).rstrip\n p \"AutE:#{ed}#{@row}\" if @dbg[:parse]\n @doc_out += [ed,(@doc_out[-1].to_s[-1,1]==\"\\n\" ? '' : \"\\n\"),@row]\n @row = ''\n true\n end\n end\n end\n \n #all regex for line will be parse in this methods return value of not nill\n #will try to parse the line (@row) again, if finish parsing (return nil)\n #it try to check the indentation to auto_close the line.\n def parse_all\n #check for skipping the block using add on module...\n parse_spc\n if @skiper.select{|f|send(f)}.length>0\n p \"skip > #{@row}\" if @dbg[:parse]\n else\n @plt_opt= '' \n #rtn= true if @selector.select{|f|send(f)}.length>0\n rtn = true if shortcut_exec( /(^[\\t ]*)\\-([\\w\\-&\\/:#.%]*\\{.*\\}=*) *([^\\n]*)\\n/) \n rtn = true if shortcut_exec( /(^[\\t ]*)\\-([\\w\\-&\\/:#.%=]*) *([^\\n]*)\\n/) \n rtn = true if shortcut_equal( /(^[\\t ]*)=([\\w\\-&\\/:#.%=]*) *([^\\n]*)\\n/) \n \n rtn = true if get_hot_simple(/^[\\t ]*(%)([\\$\\w\\-&\\/:#.\\[\\]]+\\{.*?\\}[= ]*)([^\\n]*)\\n/)\n rtn = true if get_hot_simple(/^[\\t ]*(%)([\\$\\w\\-&\\/:#.\\[\\]]+\\{.*?\\}[= ]*)()\\n/)\n rtn = true if get_hot_simple(/^[\\t ]*(%)([\\$\\w\\-&\\/:#.\\[\\]%=]+ )([^\\n]*)\\n/) \n rtn = true if get_hot_simple(/^[\\t ]*(%)([\\$\\w\\-&\\/:#.\\[\\]%=]+)()\\n/) \n \n rtn = true if get_div(/^[\\t ]*([#.])([\\w\\-&\\/.]*\\{.*\\}[= ]*)([^\\n]*)\\n/)\n rtn = true if get_div(/^[\\t ]*([#.])([\\w\\-&\\/.]*\\{.*\\}[= ]*)()\\n/)\n rtn = true if get_div(/^[\\t ]*([#.])([\\w\\-&\\/.=]* )([^\\n]*)\\n/) \n rtn = true if get_div(/^[\\t ]*([#.])([\\w\\-&\\/.=]*)()\\n/) \n rtn = true if get_input( /^[\\t ]*(:)([\\w\\-&\\/#.]*\\{.*\\}[= ]*)([^\\n]*)\\n/)\n rtn = true if get_input( /^[\\t ]*(:)([\\w\\-&\\/#.]*\\{.*\\}[= ]*)()\\n/)\n rtn = true if get_input( /^[\\t ]*(:)([\\w\\-&\\/#.=]* )([^\\n]*)\\n/) \n rtn = true if get_input( /^[\\t ]*(:)([\\w\\-&\\/#.=]*)()\\n/) \n rtn = true if parse_hot\n rtn = true if merge_hot\n rtn = true if merge_w2x\n rtn = true if parse_set_var\n rtn = true if parse_set_mem\n rtn = true if parse_get_mem\n rtn = true if inline_tag\n rtn = true if parse_end\n if parse_tags\n rtn = nil\n elsif !rtn\n auto_close \n end\n end\n rtn\n end\n \n #remember command \"^\", not really use but if you want less typing you can\n #define this command inside HOT file for the next command to be execute like:\n # HOT file:\n # >>_tr\n # ~^%td\n #\n # Source file:\n # -tr\n # ^ inside td\n #I think its Ok.\n def parse_set_mem\n if @row.gsub!(/([ \\t]*~\\^)([^\\n]+\\n)/,'')\n set_mem = $2 \n if !global_set_mem(set_mem)\n p \"setMem ^ => #{set_mem}\" if @dbg[:parse]\n @mem_tag[\"^\"]= set_mem\n end \n end\n end\n \n def global_set_mem(set_mem)\n return nil if !(/^%(\\w+)([%-].+)/ =~ set_mem)\n @tg_nex[$1]= [0,proc { @mem_tag[\"^\"] = $2}]\n end\n \n #remember command \"^\", not really use but if you want less typing you can\n #define this command inside HOT file for the next command to be execute like:\n # HOT file:\n # >>_tr\n # ~^%td\n #\n # Source file:\n # -tr\n # ^ inside td\n #I think its Ok.\n def parse_get_mem\n if(/^ *([\\^*])([^ ]*) *([^\\n]*)(\\n)/ =~ @row;@rgx = $~)\n # BUG!!! %td{align=\"right\"}= row[:price] * wowow => %td{align=\"right\"}= row[:price] * wowow\n # from /([\\^*])([^ ]*) *([^\\n]*)(\\n)/ \n # to /^ *([\\^*])([^ ]*) *([^\\n]*)(\\n)/\n keys,tmp,prms,opt,ends= @rgx.captures\n if opt=='!'\n opt=''\n @mem_hot=nil\n end\n keys.sub!('*','^')\n params_inline prms #concenation line if params end with \\\n @new = @mem_tag[keys].split(' ')\n @new[0] << tmp\n @new = @new.join(\" \") << \"\\n\"\n get_dollar(prms)\n rpl = @new #+opt.to_s+ends.to_s\n p \"stMem> #{rpl}\" if @dbg[:parse]\n @row.gsub!(@rgx.to_s,rpl)\n rows = @row.split(\"\\n\") \n if rows.size>1\n @doc_src = rows+@doc_src\n @row = @doc_src.shift+\"\\n\"\n end\n end\n @rgx!=nil\n end\n \n #it call from parse_end\n def get_end(regex)\n if(regex =~ @row;@rgx = $~)\n if @rgx[1]=='~' \n @new = ''\n @new = multi_end(1) if @tg_end.size>0\n else\n case @rgx[1]\n when '!';@new = multi_end(nil)\n when ',';@new = multi_end(@tg_end.size)\n else ;@new = multi_end(@rgx[1].size)\n end\n end\n @doc_src = @row.gsub(@rgx.to_s,@new).split(\"\\n\")+@doc_src\n @row = ''\n end\n end\n \n #user can popup the end tags using these folowing command:\n # ,/ all end tags will be popup\n # ~/ one or multi end tags will be popup (depend on how many ~ you write)\n # !/ popup until the same indentation of \"!/\"\n def parse_end\n (get_end(/^(,)\\/(\\n)/) ? true : \\\n (get_end(/^[ \\t]*(~+)\\/(\\n)/) ? true : \\\n get_end(/^[ \\t]*(!)\\/(\\n)/)))\n end\n\n #parsing w2tags commands\n def parse_tags\n @rgx = nil\n par = []\n rgs = @rg_tag.collect {|r|par << (r =~ @row);$~}\n if(max = par.compact.sort.pop) #have any to parse?\n @rgx = rgs[par.index(max)]\n @key = @rgx[2]\n @txt = @rgx[3].strip\n \n # when wrong splitting, fix the splitting...\n # assume last attribute don't have spaceses!!! ==>{opt=\"blah\"}<==\n fixd = @key.split('\"} ')\n if fixd.length>1\n @key = fixd[0]+'\"}'\n @txt = fixd[1]+@txt\n end\n \n if /^\\!/ =~ @key\n @new = (multi_end(nil)+@rgx.to_s.gsub('%!','%')).split(\"\\n\")\n swap_last_empt_src_with_end_tg(@new)\n @row = ''\n p \"W2Tag: try closing tag by indentation...\" if @dbg[:parse]\n return true\n else\n params_inline @txt #concenation line if params end with \\\n @mem_var[\"$tag\"] = @key\n nameidclass_var()\n srcs = @rgx.to_s.gsub!(/^[ \\t]*/,'')\n tag_next = @tg_nex[@key] #;p \"%mem_hot:#{@mem_hot}:#{@key}\"\n tag_next[1].call if tag_next && @mem_hot==nil\n rplc = @tagr.call(self); \n @mem_var.each do |k,v|\n rplc.gsub!(k,v)\n end\n @row.gsub!(srcs,rplc)\n end\n p \"W2Tag: #{@row}\" if @dbg[:parse]\n end \n @rgx!=nil\n end\n \n #inline parsing \n #I Like (%strong.bold{banana=\"boys\"} (%i.italic cake%)%)!\n #I Like <strong class=\"bold\" banana=\"boys\"><i class=\"italic\">cake</i></strong>!\n def inline_tag()\n if(/\\(%(.*?)%\\)/ =~ @row;@rgx = $~)\n src = $1.split(/\\(%/)\n txt = src.length>1 ? src.pop : src[0]\n tmp = txt.lstrip.split(' ')\n @key= tmp.shift\n @txt= tmp.join(\" \")\n nameidclass_var()\n @key.strip!\n html= @mem_var[\"*code*\"]\n html= html=='' ? @txt : html.gsub(\"$*\",@txt)\n tags_created = \"<#{@key}\"\n tags_created << \" #{@mem_var[\"*all*\"].strip}\" if @mem_var[\"*all*\"]!='' \n tags_created << \">#{html}</#{@key}>\"\n @row.gsub!(\"(%#{txt}%)\",tags_created)\n p \"InLin: #{@row}\" if @dbg[:parse]\n end\n @rgx\n end\n \n #concenation line if params end with \\\n def params_inline prms\n while prms[-1,1]=='\\\\' do \n prms.gsub!(/\\\\$/,'') << @doc_src.shift.strip\n end\n end\n end", "def parse(source_buffer); end", "def parse(source_buffer); end", "def parse(source_buffer); end", "def parse_remaining_files; end", "def analyze_component_breakdown\n\n end", "def construct_blame(file = '', opts = {})\n @lines = {}\n\n opts[:file] = file\n\n lines = @base.lib.blame(opts)\n\n parsed_lines = {}\n commits = {}\n\n commit = nil\n\n lines.each do |line|\n new_commit = line.match(/^[a-fA-F0-9]{40}/)\n\n if ! new_commit.nil?\n commit = new_commit[0]\n\n line_num = line.sub(/^[a-f0-9]{40} [0-9]+ /, '')\n\n if line_num.match(/\\s[0-9]+/)\n block_length = line_num.sub(/^[0-9]+\\s/, '').sub(/\\s.*$/, '')\n\n line_num = line_num.sub(/\\s[0-9]+.*$/, '')\n else\n block_length = 1\n end\n\n # this looks odd, but it's correct... we're initializing this commit's hash, which\n # should contain a :hash -> <sha hash> element, among other things, and the hash\n # OF commit hashes is indexed on the sha hash, so... yeah :)\n #\n commits[commit] = {:commit => commit} if ! commits[commit]\n\n for i in line_num.to_i..(line_num.to_i + block_length.to_i - 1)\n parsed_lines[i] = commit\n end\n end\n\n if /^author\\s/.match(line)\n commits[commit][:author] = line.sub(/^author\\s/, '')\n elsif /^author-mail\\s/.match(line)\n commits[commit][:author_email] = line.sub(/^author-mail\\s/, '')\n elsif /^author-time\\s/.match(line)\n commits[commit][:author_timestamp] = line.sub(/^author-time\\s/, '')\n elsif /^author-tz\\s/.match(line)\n commits[commit][:author_timezone] = line.sub(/^author-tz\\s/, '')\n elsif /^committer\\s/.match(line)\n commits[commit][:committer] = line.sub(/^committer\\s/, '')\n elsif /^committer-mail\\s/.match(line)\n commits[commit][:committer_email] = line.sub(/^committer-mail\\s/, '')\n elsif /^committer-time\\s/.match(line)\n commits[commit][:committer_timestamp] = line.sub(/^committer-time\\s/, '')\n elsif /^committer-tz\\s/.match(line)\n commits[commit][:committer_timezone] = line.sub(/^committer-tz\\s/, '')\n elsif /^summary\\s/.match(line)\n commits[commit][:summary] = line.sub(/^summary\\s/, '')\n end\n end\n\n parsed_lines.each do |line, commit|\n commits[commit][:line] = line\n\n @lines[line] = BlameLine.new(line, commits[commit])\n end\n end", "def analyze (file_path)\n\n states = decompose(file_path)\n\n states.each do |state|\n\n next if state.dynamic.length < 1\n\n puts\n puts state.to_s\n puts\n end\n end", "def main()\n oFile = \"outputparser\"\n sd = 'ca_san_francisco_2020_04_01.csv'\n sf = 'ca_san_diego_2020_04_01.csv'\n no = 'la_new_orleans_2020_04_01.csv'\n chi = 'il_chicago_2020_04_01.csv'\n mt = 'mt_statewide_2020_04_01.csv'\n\n [sd, sf, no, chi, mt].each_with_index do |file, ind| \n vio = Hash.new(0); \n rac = Hash.new(0); \n sex = Hash.new(0);\n age = []\n count = parse_all(file, vio, rac, sex, age); \n\n File.open(\"#{oFile}#{file}.txt\", \"w\"){|f| f.write(\"\")}\n File.open(\"#{oFile}#{file}.txt\", \"a\") do |f|\n if (ind < 3); analyze_file(ind, vio, rac, sex, file, f, count, age)\n else \n f.write(\"#{if file == chi; \"Chicago\"; else; \"Montana State\"end} Statistics\\n__________________________________________\")\n output(f, vio, 0, count)\n end\n end \n end\nend", "def parse_imports(params)\n data = params[:rawdata]\n rows = data.split(/[\\n\\r]+/)\n rowsandcolumns = []\n\n\n rows.each do |row|\n columns = row.split(\"\\t\")\n rowsandcolumns.push columns\n end\n\n @data = rowsandcolumns\n end", "def parse_output(output)\n Formatter.parse_output(output)\n end", "def before_results(controller_params)\n @num_seqs = 0\n @header = []\n @aln_blocks = []\n \n resfile = File.join(job_dir, jobid+\".out\")\n raise(\"ERROR with resultfile!\") if !File.readable?(resfile) || !File.exists?(resfile) || File.zero?(resfile)\n res = IO.readlines(resfile).map {|line| line.chomp}\n \n sequencefile = File.join(job_dir, jobid+\".fasta\")\n seqs = IO.readlines(sequencefile).map {|line| line.chomp}\n \n hits = []\n res.each do |line|\n \thits << line.split(/ /)[0]\n end\n logger.debug \"Hits: #{hits.inspect}\"\n\n seqfile = File.join(job_dir, jobid+\".seq\")\n \n # write one sequencs of each cluster in seqfile\n check = false\n File.open(seqfile, 'w') do |file|\n seqs.each do |line|\n if (line =~ /^>(.*)$/)\n header = ($1.split(/ /))[0]\n check = false\n if (hits.include?(header) || (header =~ /gi\\|(\\d+)\\|/ && hits.include?($1)))\n file.write(line + \"\\n\")\n check = true\n end\n else\n if check\n file.write(line + \"\\n\")\n end\n end\n end\n end\n\n\n # read in sequences for output\n res = IO.readlines(seqfile).map {|line| line.chomp}\n\n seq = \"\"\n res.each do |line|\n if (line =~ /^>/)\n if (!seq.empty?) then @aln_blocks.push(seq) end\n @header.push(line)\n @num_seqs += 1\n seq = \"\"\n else\n seq += line + \"\\n\"\n end\n end\n if (!seq.empty?) then @aln_blocks.push(seq) end\n \n # write sequences in lines with 80 characters\n @aln_blocks.map! do |seq|\n \ti = 0\n \tnew_seq = \"\"\n \twhile (i+80 < seq.length)\n \t\tnew_seq += seq.slice(i...i+80) + \"\\n\"\n \t\ti += 80\n \tend\n \tnew_seq += seq.slice(i...i+80) + \"\\n\"\n end\n end", "def parse\n lines = text.lines.to_a\n\n @header = lines.shift.strip\n\n parse_release_stamp(@header)\n\n # remove blank lines from top\n lines.shift until lines.first !~ /^\\s+$/\n\n idx = find_changes(lines)\n\n if idx.nil?\n @notes = lines.join\n @changes = ''\n elsif idx > 0\n @notes = lines[0...idx].join\n @changes = lines[idx..-1].join\n else # hmmm... is this ever used?\n gap = lines.index{ |line| /^\\s*$/ =~ line }\n @changes = lines[0...gap].join\n @notes = lines[gap..-1].join\n end\n end", "def parse_sections\n AIPP::Downloader.new(storage: AIPP.options.storage, source: sources_file) do |downloader|\n @dependencies.tsort(AIPP.options.section).each do |section|\n info(\"parsing #{section.sectionize}\")\n class_for(section).new(\n downloader: downloader,\n aixm: aixm\n ).attach_patches.tap(&:parse).detach_patches\n end\n end\n end", "def parseShow(output, server, user, pass)\n status = \"\"\n lines = []\n output.split(\"\\n\").each do |line|\n if (line =~/^Queued/)\n status =\"queued\"\n elsif (line =~ /^Running/)\n status = \"running\"\n elsif (line =~/^Completed/)\n status = \"completed\"\n elsif(line =~/^CLI|^CGI/)\n job, u, group, p, desc = line.chomp.split(\" \")\n if (status == \"running\" && u == user)\n done = `dc_show -job #{job} -user #{user} -password #{pass} -server #{server}`\n if (done =~/([0-9|\\.]+\\%)/)\n status = status + \" \" + $1\n end\n end\n if (status != \"completed\")\n lines.push([job, user, server, status].join(\"\\t\"))\n end\n end\n end\n return lines\nend", "def parser\n\t\t# read mail header from the file\n\t\tfile= File.open(\"header.txt\",\"r\")\n header=\"\"\n\t\tfile.each_line { |line|\n header= get_header_content(line).to_s\n check_google_apps(line)\n line=line.downcase\n\t\t\t#parser received value from mail header\n\t\t\tparser_received(line)\n parser_email(line)\n check_google_apps(line)\n\t\t}\n lower_case_header=header.downcase;\n check_microsoft_exchange(lower_case_header)\n check_lotus_notes(lower_case_header)\n check_novell_grouwpise(lower_case_header)\n check_other_apps(lower_case_header)\n check_software_conflicts()\n check_software_version_conflicts()\n get_security_software(lower_case_header)\n\tend", "def parse_file(file)\n comment_symbol = \"//\"\n comment_matcher = Regexp.new('^\\\\s*' + comment_symbol + '\\\\s?')\n comment_filter = Regexp.new('(^#![/]|^\\\\s*#\\\\{)')\n\n docs_text = code_text = '';\n has_code = false\n \n if @filename\n #puts \"FILE: #{@filename}\" #debugging\n #get file as one string for class detecting\n f = File.new(@filename)\n text = f.read\n f.close\n \n code = IO.readlines(@filename)\n code.each_with_index do |line, index|\n if comment_matcher.match(line) and !comment_filter.match(line) \n if has_code\n save_section(docs_text, code_text)\n \n #reset docs and code\n docs_text = code_text = ''\n has_code = false\n end\n\n #docs_text += line.sub(comment_matcher, '') + \"\\n\"\n docs_text += line.sub(comment_matcher, '')\n else\n #remove tabs\n #line.gsub!(\"\\t\", \"\")\n line.gsub!(\"\\t\", \" \")\n\n #remove newlines\n line.gsub!(/\\n+/, \"\")\n\n #remove whitespace\n line.gsub!(/$\\s+/, \"\")\n line.gsub!(/^\\s+/, \"\")\n\n line = line.gsub('\\t', \"\").gsub('\\n',\"\").gsub(/\\s+1/,\"\")\n\n has_code = true\n code_text += line + \"\\n\"\n #code_text += line\n \n if line.match(/(class|public|private)\\s+((?!boost)\\w+\\s*)(\\s+|;|:|\\{)?/)\n keyword = $2\n thirdComponent = $3\n #remove all beginning and trailling whitespace\n keyword = keyword.gsub(/^\\s+/, \"\").gsub(/\\s+$/, \"\")\n\n pKeyword = PotionKeyword.new(keyword)\n pKeyword.origin = @filename.split('/').last\n #puts \"\\tChecking #{pKeyword.word}...\" #debugging\n if @master_list_ref.contains_keyword(keyword) == false && thirdComponent != \";\" && keyword.length > 1\n @master_list_ref.keywords << pKeyword \n #puts \"\\tMatched Line: #{line}\" #debugging\n #puts \"\\tAdded #{keyword} to the master list\\n\\n\" #debugging\n end\n end\n end\n end\n\n save_section(docs_text, code_text)\n end\n end", "def parse\n _build_document\n _close_open_block_commands\n @document\n end", "def parse_entry(io)\n # Read INSDC or RefSeq entry\n Bio::FlatFile.auto(io).each do |entry|\n @entry = entry\n @features = entry.features\n @source = @features.shift\n parse_sequence\n parse_source\n #parse_genes\n parse_features\n end\n end", "def process_and_build_components \n end", "def process_results\n # Clean up some of the files that are not needed\n %w(runmanager.db).each do |f|\n logger.debug \"Removing file: #{@simulation.run_path}/#{f}\"\n File.delete File.join(@simulation.run_path, f) if File.exist? File.join(@simulation.run_path, f)\n end\n\n json = {}\n Dir[\"#{@simulation.run_path}/*\"].each do |f|\n if f =~ /AnalysisResults-BEES.pdf/\n logger.info 'saving the compliance report path to model'\n @simulation.compliance_report_pdf_path = f\n elsif f =~ /.*\\s-\\sAnalysisResults-BEES.xml/\n logger.info \"BEES XML #{f}\"\n @simulation.compliance_report_xml = f\n elsif f =~ /.*\\s-\\sAnalysisResults.xml/\n logger.info \"XML #{f}\"\n @simulation.analysis_results_xml = f\n elsif f =~ /CbeccComWrapper.json/\n # Save the state based on the CbeccComWrapper.json file that is persisted\n json = MultiJson.load(File.read(f), symbolize_keys: true) if File.exist?(f)\n logger.info \"pyCBECC responded with: #{json}\"\n\n @simulation.cbecc_code = json.keys.first.to_s.to_i\n @simulation.cbecc_code_description = json.values.first\n elsif f =~ /.*\\s-\\sab.*/\n logger.info \"Annual baseline results #{f}\"\n @simulation.openstudio_model_baseline = f if File.extname(f) == '.osm'\n\n elsif f =~ /.*\\s-\\szb.*/\n logger.info \"Sizing simulation results #{f}\"\n elsif f =~ /.*\\s-\\sap.*/\n logger.info \"Annual proposed results #{f}\"\n @simulation.openstudio_model_proposed = f if File.extname(f) == '.osm'\n end\n end\n\n # TODO: remove other files\n\n # parse the log file for any errors\n errors = []\n log_file = find_log_file\n if log_file && File.exist?(log_file)\n s = File.read log_file\n s.scan(/Error:\\s{2}.*$/).each do |error|\n errors << error[/Error:\\s{2}(.*)/, 1].chomp\n end\n\n # This appeared once, but haven't seen it since.\n s.scan(/error\\(s\\) encountered simulating.*/i).each do |error|\n errors << error.chomp\n end\n\n # and this error: Compliance report(s) called for but bypassed due to report generator website not accessible.\n if s =~ /compliance report.*called for but bypassed due to report generator website not accessible/i\n @simulation.warning_messages << \"Could not generate Compliance Reports because report generate website was not accessible\"\n end\n\n @simulation.error_messages = errors\n end\n\n # TODO: zip up everything and remove what we don't care about\n\n # success is defined as no error messages\n if !json.keys.empty? && json.keys.first != :'0'\n return false\n end\n\n if !@simulation.error_messages.empty?\n return false\n end\n\n true\n end", "def handle_submodels(temp_parts)\n @submodels.each do |submodel|\n count = 0\n store_lines = false\n\n @lines.each_with_index do |line, i|\n store_lines = true if (line.downcase == \"0 file #{submodel.downcase}#{@line_break}\" || line.downcase == \"0 file #{submodel.downcase}\") && i > 5\n next unless store_lines == true\n\n @submodels << line.match(/\\w+\\.ldr/).to_s.downcase if line.match(/^1/) && (line.match(/\\.ldr#{@line_break}$/) || line.match(/\\.ldr$/))\n @lsynthed_parts << line.gsub('0 SYNTH BEGIN', '').split if line =~ /^0 SYNTH BEGIN/\n break if line.match(/0 FILE/) && i > 5\t&& (line.downcase != \"0 file #{submodel.downcase}#{@line_break}\" && line.downcase != \"0 file #{submodel.downcase}\")\n next unless line.match(/^1/) && (line.match(/.dat#{@line_break}$/) || line.match(/.dat$/))\n\n count += 1\n part = line.match(/\\w+\\.dat/).to_s.gsub!('.dat', '')\n next if lsynth_part?(part)\n\n color = line.match(/^1\\s\\d+/).to_s.gsub!('1 ', '')\n bl_part = get_bl_part_number(part)\n temp_parts << [bl_part, color, part]\n end\n # puts \"#{submodel} has #{count} parts\"\n end\n\n temp_parts\n end", "def parse(file)\n line = file.gets\r\n if line == nil then return end\r\n counter = 0\r\n increase = 0\r\n \r\n # read 1st line, must be maze header, check if valid\r\n if line !~ /^maze:\\s([\\d]+)\\s([\\d]+):([\\d]+)\\s->\\s([\\d]+):([\\d]+)$/\r\n if $tag\r\n $invalid[increase] = \"invalid maze\"\r\n increase = increase + 1\r\n $tag = false\r\n end\r\n $invalid[increase] = line\r\n increase = increase + 1\r\n else\r\n $result[counter] = \"#{$1} #{$2} #{$3} #{$4} #{$5}\"\r\n counter = counter + 1\r\n end\r\n\r\n # read additional lines\r\n while line = file.gets do\r\n x_y = '(\\d),(\\d)'\r\n direc = '([u|d|l|r]*)'\r\n mass = '([0-9]*).([0-9]*)'\r\n mass_s = '([0-9]*).([0-9]*)'\r\n total = mass_s + ',' + mass_s + ',' + mass_s + ',' + mass_s\r\n sum = Regexp.new('^' + x_y + ':\\s' + direc + '\\s' + total + '$')\r\n \r\n # begins with \"path\", must be path specification\r\n if line =~ /^\"[^:\\s]+:\\([\\d]+,[\\d]+\\)/\r\n line_o = line.split(/\",\"/)\r\n \r\n i = 0\r\n while i < line_o.size\r\n if line_o[i] !~ /^\"/\r\n line_o[i] = \"\\\"#{line_o[i]}\"\r\n end\r\n \r\n if line_o[i] !~ /\"$/\r\n line_o[i] = \"#{line_o[i]}\\\"\"\r\n end\r\n i = i + 1\r\n end\r\n \r\n i = 0\r\n while i < line_o.size\r\n if line_o[i] =~ /^\"([^:\\s]+):\\(([\\d]+),([\\d]+)\\),(([udlr],)*[udlr])\"$/\r\n a = String.new(\"#{$1}\")\r\n b = String.new(\"#{$2}\")\r\n c = String.new(\"#{$3}\")\r\n d = String.new(\"#{$4}\")\r\n d.delete! \",\"\r\n \r\n j = 0\r\n while j < a.size\r\n if a[j] == 92 && a[j + 1] == 34\r\n a[j] = \"\"\r\n end\r\n j = j + 1\r\n end\r\n \r\n $result[counter] = \"path #{a} #{b} #{c} #{d}\"\r\n counter = counter + 1\r\n else\r\n if $tag\r\n $invalid[increase] = \"invalid maze\"\r\n increase = increase + 1\r\n $tag = false\r\n end\r\n $invalid[increase] = line\r\n increase = increase + 1\r\n i = line_o.size\r\n end\r\n i = i + 1\r\n \r\n end\r\n \r\n # otherwise must be cell specification (since maze spec must be valid)\r\n elsif line =~ /^([\\d]+),([\\d]+):\\s*$/\r\n $result[counter] = \"#{$1} #{$2}\"\r\n counter = counter + 1\r\n elsif line =~ /^([\\d]+),([\\d]+): ([udlr]) ([0-9]+).([0-9]+)$/\r\n $result[counter] = \"#{$1} #{$2} #{$3} #{$4}.#{$5}\"\r\n counter = counter + 1\r\n elsif line =~ /^([\\d]+),([\\d]+): ([udlr][udlr]) ([0-9]+).([0-9]+),([0-9]+).([0-9]+)$/\r\n $result[counter] = \"#{$1} #{$2} #{$3} #{$4}.#{$5} #{$6}.#{$7}\"\r\n counter = counter + 1\r\n elsif line =~ /^([\\d]+),([\\d]+): ([udlr][udlr][udlr]) ([0-9]+).([0-9]+),([0-9]+).([0-9]+),([0-9]+).([0-9]+)$/\r\n $result[counter] = \"#{$1} #{$2} #{$3} #{$4}.#{$5} #{$6}.#{$7} #{$8}.#{$9}\"\r\n counter = counter + 1\r\n elsif line =~ /^([\\d]+),([\\d]+): ([udlr][udlr][udlr][udlr]) ([0-9]+).([0-9]+),([0-9]+).([0-9]+),([0-9]+).([0-9]+),([0-9]+).([0-9]+)$/\r\n $result[counter] = \"#{$1} #{$2} #{$3} #{$4}.#{$5} #{$6}.#{$7} #{$8}.#{$9} #{$10}.#{$11}\"\r\n counter = counter + 1\r\n else\r\n if $tag\r\n $invalid[increase] = \"invalid maze\"\r\n increase = increase + 1\r\n $tag = false\r\n end\r\n $invalid[increase] = line\r\n increase = increase + 1\r\n end\n end\r\n \r\n if $tag\r\n $result.collect{|i| puts i}\r\n else\r\n $invalid.collect{|i| puts i}\r\n end\r\n end" ]
[ "0.59766674", "0.593385", "0.593385", "0.5905647", "0.57631016", "0.55680686", "0.55493873", "0.55393714", "0.553312", "0.55093956", "0.5483597", "0.5483597", "0.5423291", "0.5418414", "0.539924", "0.53982705", "0.5389963", "0.5373868", "0.5362725", "0.5362725", "0.5362725", "0.5361411", "0.5334953", "0.5314052", "0.5312036", "0.5303859", "0.52955467", "0.5273246", "0.5271923", "0.5247871", "0.5234532", "0.5233955", "0.5214606", "0.5210924", "0.52057374", "0.51850027", "0.51813644", "0.5164826", "0.5145535", "0.5143022", "0.5134171", "0.5133357", "0.51213944", "0.51213944", "0.51213944", "0.51213944", "0.5115239", "0.51138633", "0.5108756", "0.5107321", "0.5104946", "0.50960606", "0.50879586", "0.50877804", "0.50815576", "0.5079278", "0.5071756", "0.5069349", "0.50641036", "0.506114", "0.5058568", "0.50576854", "0.50511193", "0.50422794", "0.50411576", "0.50348896", "0.50285673", "0.50261384", "0.5025579", "0.5022216", "0.50202924", "0.5019875", "0.50163746", "0.50146806", "0.50140554", "0.50139576", "0.5012673", "0.50120974", "0.5011806", "0.50056463", "0.50056463", "0.50056463", "0.49983668", "0.49866277", "0.49849457", "0.4984561", "0.4976839", "0.4971714", "0.49712545", "0.49608943", "0.4960285", "0.49598318", "0.4954225", "0.49541712", "0.49539614", "0.4948962", "0.4944025", "0.49412015", "0.49339977", "0.49329466", "0.49318713" ]
0.0
-1
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
def instance_config project_id:, instance_config_id: # [START spanner_get_instance_config] # project_id = "Your Google Cloud project ID" # instance_config_id = "Spanner instance config ID" require "google/cloud/spanner" require "google/cloud/spanner/admin/instance" instance_admin_client = Google::Cloud::Spanner::Admin::Instance.instance_admin instance_config_path = instance_admin_client.instance_config_path \ project: project_id, instance_config: instance_config_id config = instance_admin_client.get_instance_config name: instance_config_path puts "Available leader options for instance config #{config.name} : #{config.leader_options}" # [END spanner_get_instance_config] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def implementation; end", "def implementation; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version\n not_implemented\n end", "def missing; end", "def standalone; end", "def implemented_in; end", "def available; end", "def available; end", "def ios; end", "def user_os_complex\r\n end", "def version_mismatch_detected\n end", "def interface; end", "def interface; end", "def spec; end", "def spec; end", "def internal; end", "def support\n raise \"Not implemented\"\n end", "def one_gradable_ex_only\n end", "def requirements; end", "def requirements; end", "def requirements; end", "def requirements; end", "def used?; end", "def who_we_are\r\n end", "def target_version; end", "def implausible_common_name; end", "def def_version; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def apis; end", "def sitemaps; end", "def hidden_apis; end", "def extra; end", "def version\n 1\n end", "def weber; end", "def api_mode; end", "def interface_cache; end", "def platform_endpoint; end", "def missing?; end", "def missing?; false; end", "def internal?; end", "def common_pods\n# pod 'AESCrypt-ObjC’\n pod 'AFNetworking’\n pod 'Aspects'\n \n pod 'FCUUID'\n pod 'FMDB'\n \n pod 'IQKeyboardManager'\n# pod 'iCarousel’\n \n# pod 'JPush'\n# pod 'JZLocationConverter'\n \n pod 'MBProgressHUD'\n pod 'MJExtension'\n pod 'MJRefresh'\n pod 'Masonry'\n \n# pod 'PopoverView'\n pod 'PPNumberButton'\n \n pod 'SDCycleScrollView'\n pod 'SDWebImage'\n pod 'SVProgressHUD'\n pod 'SocketRocket'\n pod 'Toast'\n \n# pod 'UICKeyChainStore'\n \n pod 'YBAttributeTextTapAction'\n \n# pod 'YYKit'\n pod 'YYCache'\n pod 'YYCategories'\n pod 'YYWebImage’\n pod 'YYModel’\n# pod 'YZPullDownMenu'\n# pod 'ZYCornerRadius'\n \n# pod 'UMengAnalytics-NO-IDFA'\n \n# pod 'AMapSearch-NO-IDFA'\n# pod 'AMapLocation-NO-IDFA'\n# pod 'AMapNavi-NO-IDFA'\n \n # 主模块(必须)\n# pod 'mob_sharesdk'\n# pod 'mob_sharesdk/ShareSDKUI'\n# pod 'mob_sharesdk/ShareSDKExtension'# 扩展模块(在调用可以弹出我们UI分享方法的时候是必需的)\n# pod 'mob_sharesdk/ShareSDKPlatforms/QQ'\n# pod 'mob_sharesdk/ShareSDKPlatforms/SinaWeibo'\n# pod 'mob_sharesdk/ShareSDKPlatforms/WeChatFull' #(微信sdk带支付的命令,和上面不带支付的不能共存,只能选择一个)\n# pod 'PromiseKit'\n\n pod 'NNGloble'\n pod 'NNCategoryPro'\n \n pod 'TZImagePickerController'\n \n# pod 'LookinServer', :configurations => ['Debug']\n# pod 'EchoSDK', :configurations => [\"Debug\"]\n pod 'Reveal-SDK', :configurations => ['Debug']\n\n end", "def google_package\n return nil\n end", "def public; end", "def public; end", "def metadata; end", "def metadata; end", "def metadata; end", "def metadata; end", "def metadata; end", "def metadata; end", "def metadata; end", "def custom; end", "def custom; end", "def driver; end", "def terms_of_use\n end", "def platform; end", "def platform; end", "def platform; end", "def library; end", "def library; end", "def conscientious_require; end", "def signature; end", "def signature; end", "def signature; end", "def signature; end", "def signature; end", "def signature; end", "def signature; end", "def signature; end", "def signature; end", "def signature; end", "def stand_alone?; end", "def stand_alone?; end", "def macro; raise NotImplementedError; end" ]
[ "0.66184175", "0.5639416", "0.5639416", "0.5544618", "0.5544618", "0.5544618", "0.5544618", "0.5544618", "0.5544618", "0.5544618", "0.5544618", "0.5544618", "0.5544618", "0.5544618", "0.5544618", "0.5544618", "0.5544618", "0.5544618", "0.5544618", "0.5544618", "0.5544618", "0.5544618", "0.5544618", "0.5544618", "0.5544618", "0.5544618", "0.55396724", "0.5508253", "0.5488923", "0.54378736", "0.5408807", "0.5408807", "0.5394952", "0.5390685", "0.53711754", "0.5350748", "0.5350748", "0.5348079", "0.5348079", "0.53156", "0.53055835", "0.5291988", "0.5291043", "0.5291043", "0.5291043", "0.5291043", "0.5268404", "0.5264975", "0.5263456", "0.52504224", "0.52494127", "0.52481043", "0.52481043", "0.52481043", "0.52481043", "0.5239073", "0.5236939", "0.5224105", "0.5210034", "0.52063984", "0.51910204", "0.51843274", "0.51805514", "0.51782054", "0.5149303", "0.5139625", "0.5132253", "0.5118859", "0.5116342", "0.5087591", "0.5087591", "0.5087511", "0.5087511", "0.5087511", "0.5087511", "0.5087511", "0.5087511", "0.5087511", "0.5080602", "0.5080602", "0.5078574", "0.50745434", "0.50606745", "0.50606745", "0.50606745", "0.5052838", "0.5052838", "0.503753", "0.50372815", "0.50372815", "0.50372815", "0.50372815", "0.50372815", "0.50372815", "0.50372815", "0.50372815", "0.50372815", "0.50372815", "0.503626", "0.503626", "0.5033346" ]
0.0
-1
Configure the connection instance in a generic manner. Each client can modify the connection in a specific way, when the application requires special handling. Just overwrite the +configure+ method, and call +super(con)+. Here is a full example: def configure(con) super(con) con.request :url_encoded con.response :logger con.adapter Faraday.default_adapter end
def configure(con) con.use :instrumentation # The definition order is execution order con.request :ph_data_sanitization con.request :ph_default_headers con.request :json con.request :multipart con.request :url_encoded # The definition order is reverse to the execution order con.response :ph_recursive_open_struct con.response :ph_data_sanitization con.response :dates con.response :json, content_type: /\bjson$/ con.response :follow_redirects con.adapter Faraday.default_adapter end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configure_connection\n end", "def configure_connection\n end", "def configure(conf)\n super\n end", "def configure(settings = {})\n abstract_method\n end", "def configure(&block)\n @config = Logger::Config.new\n\n yield @config\n\n ensure_required_options_exist\n initialize_connection unless disabled?\n @configured = true\n end", "def configure\n yield(configuration) if block_given?\n\n self.logger = configuration.logger\n\n # remove :// from scheme\n configuration.scheme.sub!(/:\\/\\//, '')\n\n # remove http(s):// and anything after a slash\n configuration.host.sub!(/https?:\\/\\//, '')\n\n # Add leading and trailing slashes to base_path\n configuration.base_path = \"\" if configuration.base_path == \"/\"\n end", "def connection_options(data)\n opts = super.merge! data\n\n opts.merge! logger: logger if !opts.key? :logger\n\n opts\n end", "def initialize(config)\n super\n @connection = Faraday.new(url: (config['rest']).to_s) do |builder|\n builder.response :json\n builder.response :logger if config['debug']\n builder.adapter(@adapter)\n unless config['verify_ssl'].nil?\n builder.ssl[:verify] = config['verify_ssl']\n end\n end\n @ping_set = false\n @rest = (config['rest']).to_s\n @ws_url = (config['websocket']).to_s\n end", "def initialize(...)\n super()\n configure(...)\n end", "def faraday_configuration(config)\n config.configure_faraday do |conn|\n conn.request :url_encoded\n conn.use :instrumentation\n conn.response :logger\n conn.response :follow_redirects\n end\n end", "def configure\n @mauth_client = ::MAuth::Client.new(mauth_config)\n\n @connection = Faraday.new do |builder|\n builder.use MAuth::Faraday::MAuthClientUserAgent, \"MediTAF Mauth Client Adapter\"\n builder.use MAuth::Faraday::RequestSigner, :mauth_client => @mauth_client\n builder.use MAuth::Faraday::ResponseAuthenticator, :mauth_client => @mauth_client if mauth_config[:authenticate_response]\n builder.use FaradayMiddleware::ParseJson, content_type: /\\bjson$/\n builder.use FaradayMiddleware::ParseXml, content_type: /\\bxml$/\n builder.adapter Faraday.default_adapter\n end\n end", "def configure\n yield(self)\n end", "def real_connect(*args)\n @connection_params = args unless args.empty?\n super(*@connection_params)\n end", "def configure\n yield(self)\n end", "def build_connection(options = FmRest.default_connection_settings, &block)\n base_connection(options) do |conn|\n conn.use RaiseErrors\n conn.use TokenSession, options\n\n # The EncodeJson and Multipart middlewares only encode the request\n # when the content type matches, so we can have them both here and\n # still play nice with each other, we just need to set the content\n # type to multipart/form-data when we want to submit a container\n # field\n conn.request :multipart\n conn.request :json\n\n if options[:log]\n conn.response :logger, nil, bodies: true, headers: true\n end\n\n # Allow overriding the default response middleware\n if block_given?\n yield conn\n else\n conn.response :json\n end\n\n conn.adapter Faraday.default_adapter\n end\n end", "def configure(options={})\n Configuration.configure(options)\n end", "def configure\n yield(self)\n end", "def configure\n yield client\n end", "def configure(opts)\n #This is a stub, used for indexing\n end", "def configure opts\n configuration.merge!(opts)\n end", "def configure\n yield self\n\n pool_size = 5\n host = @host.nil? ? 'minfraud.maxmind.com' : @host\n @connection_pool = ConnectionPool.new(size: pool_size) do\n make_http_client.persistent(\"https://#{host}\")\n end\n end", "def configure\n yield self\n end", "def configure\n yield self\n end", "def configure\n yield self\n end", "def configure\n yield self\n end", "def configure\n yield self\n end", "def configure\n yield self\n end", "def configure\n yield self\n end", "def configure\n yield self\n end", "def configure\n yield self\n end", "def configure\n yield self\n end", "def configure\n yield self\n end", "def configure\n yield self\n end", "def configure\n yield self\n end", "def configure\n yield self\n end", "def configure\n yield self\n end", "def configure\n yield self\n end", "def configure\n yield self\n end", "def configure\n yield self\n end", "def configure\n yield self\n end", "def configure\n yield self\n end", "def configure\n yield self\n end", "def configure\n yield self\n end", "def configure\n yield self\n end", "def configure\n yield self\n end", "def configure\n yield self\n end", "def configure\n yield self\n end", "def configure\n yield self\n end", "def configure\n yield self\n end", "def configure\n yield self\n end", "def configure\n yield self\n end", "def configure\n yield self\n end", "def configure\n yield self\n end", "def configure\n yield self\n end", "def configure\n yield self\n end", "def configure\n yield self\n end", "def configure\n yield self\n end", "def configure\n yield self\n end", "def configure\n yield self\n end", "def configure\n yield self\n end", "def configure\n yield self\n end", "def configure\n yield self\n end", "def configure\n yield self\n end", "def configure\n yield self\n end", "def configure\n yield self\n end", "def configure\n yield self\n end", "def configure\n yield self\n end", "def configure\n yield self\n end", "def configure\n yield self\n end", "def configure\n yield self\n end", "def configure\n yield self\n end", "def configure\n yield self\n end", "def configure\n yield self\n end", "def configure\n yield self\n end", "def configure\n yield self\n end", "def configure\n yield self\n end", "def configure\n yield self\n end", "def configure\n yield self\n end", "def configure\n yield self\n end", "def configure\n yield self\n end", "def configure\n yield(config)\n end", "def configure(&block)\n yield(self)\n end", "def configure(&block)\n yield(self)\n end", "def configure\n yield self\n end", "def configure\n yield self\n end", "def configure\n yield self\n end", "def configure\n yield self\n end", "def configure\n yield self\n end", "def configure\n yield self\n\n self\n end", "def configure_faraday(&config)\n @configuration[:faraday_configuration] = config\n end", "def configure\n yield config\n end", "def configure\n yield config\n end", "def configure\n yield config\n end", "def configure(*args)\n # Load config from the arguments passed to the constructor.\n # This *may* override defaults and it's a feature.\n infer_config(*args) unless args.empty?\n\n # Load adapters explicitly here to ensure their plugins are present for later use\n load_adapters\n\n # Allow customizations now\n yield(self, config) if block_given?\n\n # Register gateway components based on current config\n register_gateways\n\n self\n end", "def configure\n yield config\n end", "def configure\n yield config\n end", "def configure\n yield configuration\n end", "def configure\n yield configuration\n end", "def configure\n yield configuration\n end", "def configure\n yield configuration\n end" ]
[ "0.69118875", "0.6892308", "0.6635147", "0.6527062", "0.64633083", "0.6451594", "0.6320453", "0.62772256", "0.6216108", "0.6192429", "0.6178731", "0.61609817", "0.6159202", "0.61010367", "0.6091954", "0.6083834", "0.60795146", "0.6059017", "0.60533184", "0.60489523", "0.6048172", "0.60299504", "0.60233945", "0.60233945", "0.60233945", "0.60233945", "0.60233945", "0.60233945", "0.60233945", "0.60233945", "0.60233945", "0.60233945", "0.60233945", "0.60233945", "0.60233945", "0.60233945", "0.60233945", "0.60233945", "0.60233945", "0.60233945", "0.60233945", "0.60233945", "0.60233945", "0.60233945", "0.60233945", "0.60233945", "0.60233945", "0.60233945", "0.60233945", "0.60233945", "0.60233945", "0.60233945", "0.60233945", "0.60233945", "0.60233945", "0.60233945", "0.60233945", "0.60233945", "0.60233945", "0.60233945", "0.60233945", "0.60233945", "0.60233945", "0.60233945", "0.60233945", "0.60233945", "0.60233945", "0.60233945", "0.60233945", "0.60233945", "0.60233945", "0.60233945", "0.60233945", "0.60233945", "0.60233945", "0.60233945", "0.60233945", "0.60233945", "0.60233945", "0.60233945", "0.5987157", "0.59870183", "0.59870183", "0.59818596", "0.59818596", "0.59818596", "0.59818596", "0.59818596", "0.5979543", "0.59788656", "0.5966688", "0.5966688", "0.5966688", "0.59614027", "0.59572095", "0.59572095", "0.5949302", "0.5949302", "0.5949302", "0.5949302" ]
0.7414548
0
rubocop:enable Metrics/MethodLength Create a new Faraday connection on the first shot, and pass the cached connection object on subsequent calls.
def connection @connection ||= Faraday.new(url: PriceHubble.configuration.base_url, &method(:configure)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connection\n @connection ||= begin\n conn = Faraday.new(url: url)\n conn.build do |b|\n conn_build.call(b)\n end if conn_build\n conn\n end\n end", "def faraday_connection(url=nil)\n url ||= self.root\n key = \"faraday_connection_#{url}\"\n return Thread.current[key] if Thread.current[key]\n\n fc = Faraday.new(:url => url)\n fc.headers.merge!('User-Agent' => \"HyperResource #{HyperResource::VERSION}\")\n fc.headers.merge!(self.headers || {})\n if ba=self.auth[:basic]\n fc.basic_auth(*ba)\n end\n Thread.current[key] = fc\n end", "def faraday\n mutex.synchronize do\n @faraday ||= create_faraday\n end\n end", "def conn\n @conn ||= Faraday.new(base_url, headers: @headers, ssl: ssl_options, request: timeout) do |faraday|\n faraday.use :breakers\n faraday.use Faraday::Response::RaiseError\n faraday.use EVSS::ErrorMiddleware\n faraday.response :betamocks if @use_mock\n faraday.response :snakecase, symbolize: false\n faraday.response :json_parser\n faraday.use :remove_cookies\n faraday.adapter :httpclient\n end\n end", "def connection\n @conn ||= Faraday.new(base_path, headers: base_request_headers, request: request_options) do |faraday|\n faraday.use :breakers\n faraday.use Faraday::Response::RaiseError\n\n faraday.response :betamocks if mock_enabled?\n faraday.response :json\n faraday.adapter Faraday.default_adapter\n end\n end", "def connection\n @connection ||= begin\n conn = Faraday.new(site, options[:connection_opts])\n conn.build do |b|\n options[:connection_build].call(b)\n end if options[:connection_build]\n conn\n end\n end", "def connection\n @connection = begin\n connection_options = {:builder => @middleware}\n connection_options[:ssl] = {:verify => true} if @endpoint[0..4] == 'https'\n connection_options[:proxy] = @proxy if @proxy\n Faraday.new(@endpoint, @connection_options.merge(connection_options))\n end\n end", "def connection\n @connection ||= begin\n conn = Faraday.new(:url => @url) do |b|\n b.use Faraday::Request::UrlEncoded # convert request params as \"www-form-urlencoded\"\n b.use Faraday::Request::JSON # encode request params as json\n b.use Faraday::Response::Logger # log the request to STDOUT\n b.use Faraday::Adapter::NetHttp # make http requests with Net::HTTP \n end\n conn\n end\n end", "def connection\n @connection ||= Faraday.new @url do |c|\n c.headers[\"X-Api-Token\"] = @token\n c.use FaradayMiddleware::ParseJson, content_type: \"application/json\"\n #c.use Faraday::Response::Logger, Logger.new(\"tmp/faraday.log\")\n c.use FaradayMiddleware::FollowRedirects, limit: 3\n c.use Faraday::Response::RaiseError # raise exceptions on 40x, 50x responses\n c.use Faraday::Adapter::NetHttp\n end\n end", "def connection\n @conn ||= Faraday.new(base_path, headers: base_request_headers, request: request_options) do |faraday|\n faraday.use :breakers\n faraday.use Faraday::Response::RaiseError\n\n faraday.request :multipart\n faraday.request :json\n\n faraday.response :betamocks if mock_enabled?\n faraday.response :json\n faraday.adapter Faraday.default_adapter\n end\n end", "def connection\n @conn ||= Faraday.new(base_path, headers: base_request_headers, request: request_options) do |faraday|\n faraday.use :breakers\n faraday.use Faraday::Response::RaiseError\n\n faraday.request :multipart\n faraday.request :json\n\n faraday.response :betamocks if mock_enabled?\n faraday.response :json\n faraday.adapter Faraday.default_adapter\n end\n end", "def connection\n @conn ||= Faraday.new(base_path, headers: base_request_headers, request: request_options) do |faraday|\n faraday.use :breakers\n faraday.use Faraday::Response::RaiseError\n faraday.request :json\n\n faraday.response :betamocks if use_mocks?\n faraday.response :snakecase, symbolize: false\n faraday.response :json, content_type: /\\bjson/\n\n faraday.adapter Faraday.default_adapter\n end\n end", "def connection\n @connection ||=\n begin\n conn_opts = {}\n conn_opts[:url] = url\n #conn_opts[:proxy] = proxy if proxy\n conn_opts[:request] = options.slice(:timeout, :open_timeout)\n conn_opts[:request][:params_encoder] = Faraday::FlatParamsEncoder\n\n retry_opt = {\n max: options[:retry_after_limit],\n interval: 0.05,\n interval_randomness: 0.5,\n backoff_factor: 2,\n }\n\n Faraday.new(conn_opts) do |conn|\n conn.use :ils_caching_middleware\n conn.request :retry, retry_opt\n conn.response :raise_error\n conn.adapter options[:adapter] || Faraday.default_adapter\n end\n end\n end", "def connection\n @connection ||= Faraday.new(request: { timeout: ForecastIO.timeout })\n end", "def connection\n @connection ||= Faraday.new(url: base_url, headers: default_headers, ssl: {verify: false}) do |builder|\n builder.use Faraday::Request::UrlEncoded\n builder.use Faraday::Response::Mashify\n builder.use Faraday::Response::ParseJson\n builder.adapter Faraday.default_adapter\n end\n end", "def connection\n @connection ||= Faraday.new(self.api_url, { ssl: { verify: false } })\n end", "def connection\n @connection ||= Faraday.new(@endpoint, @connection_options, &@middleware)\n end", "def connection\n @connection ||= Faraday.new(@endpoint, @connection_options.merge(:builder => @middleware))\n end", "def connection\n @connection ||= Faraday.new(@endpoint, @connection_options.merge(:builder => @middleware))\n end", "def connection\n @connection ||= Faraday.new(@endpoint, @connection_options.merge(:builder => @middleware))\n end", "def connection\n @connection ||= Faraday.new(@endpoint, @connection_options.merge(:builder => @middleware))\n end", "def connection\n @connection ||= begin\n connection_options = {:builder => @middleware}\n connection_options[:ssl] = {:verify => true} if @endpoint[0..4] == 'https'\n Faraday.new(@endpoint, @connection_options.merge(connection_options))\n end\n end", "def connection\n # @connection ||= Faraday.new connection_options do |conn|\n @faraday_connection ||= Faraday.new(:url => @url) do |conn|\n # Follow redirects\n # conn.use FaradayMiddleware::FollowRedirects, limit: 5\n conn.response :logger # log requests to STDOUT\n # Convert request params to \"www-form-encoded\"\n conn.request :url_encoded\n # Parse responses as JSON\n # conn.use FaradayMiddleware::ParseJson, content_type: 'application/json'\n # Use Faraday's default HTTP adapter\n conn.adapter Faraday.default_adapter\n #pass api_key and api_username on every request\n # conn.params['api_key'] = api_key\n # conn.params['api_username'] = api_username\n end\n return @faraday_connection\n end", "def build_connection\n connection = Faraday.new(url: base_url)\n connection.adapter *connection_adapter\n end", "def connection\n @connection ||= begin\n connection_options = { builder: @middleware }\n connection_options[:ssl] = { verify: true } if @endpoint[0..4] == 'https'\n Faraday.new(@endpoint, @connection_options.merge(connection_options))\n end\n end", "def connection\n @connection ||= Faraday.new(@server_uri, :ssl => {:verify => false}) do |builder|\n builder.request :url_encoded # Encode request parameters as \"www-form-urlencoded\"\n builder.response :logger # Log request and response to STDOUT\n builder.adapter :net_http # Perform requests with Net::HTTP\n end\n end", "def faraday\n @faraday ||= Faraday.new ssl: { verify: ssl_verify } do |faraday|\n authenticate!(faraday)\n\n faraday.request(:retry, max: retries) if retries\n faraday.options.timeout = read_timeout if read_timeout\n faraday.options.open_timeout = open_timeout if open_timeout\n\n faraday.request :url_encoded # Form-encode POST params\n faraday.response :raise_error\n faraday.use :http_cache, store: http_cache, serializer: Marshal\n faraday.use Faraday::CacheHeaders\n faraday.response :json, content_type: /\\bjson$/\n faraday.adapter :excon\n end\n end", "def connection\n @connection ||= Faraday.new(endpoint, connection_options)\n end", "def connection\n @connection ||= faraday(config, logger)\n end", "def connection\n @connection ||= Faraday.new(base_url) do |builder|\n build_middleware(builder)\n builder.adapter Faraday.default_adapter\n end\n end", "def connection(options = {})\n conn_options = default_options(options).keep_if { |k, _| ALLOWED_OPTIONS.include?(k) }\n clear_cache unless options.empty?\n puts \"OPTIONS:#{conn_options.inspect}\" if ENV[\"DEBUG\"]\n\n Faraday.new(conn_options.merge(builder: stack(options)))\n end", "def create_connection\n\t\t@connection = Faraday.new(:url => @base_url) do |faraday|\n\t\t\tfaraday.headers['Accept'] = 'application/json'\n\t\t\tfaraday.adapter Faraday.default_adapter\n\t\tend\n\tend", "def connection\n params = {}\n @connection ||= Faraday::Connection.new(:url => api_url, :ssl => ssl, :params => params, :headers => default_headers) do |builder|\n @connection_middleware.each do |middleware|\n builder.use *middleware\n end\n builder.adapter Faraday.default_adapter\n end\n end", "def connection\n @connection ||= Faraday.new do |conn|\n conn.use Signature::Authentication, endpoint.secret\n\n yield conn if block_given?\n\n unless conn.builder.handlers.any? { |h| h.name.include? ':Adapter:' }\n conn.adapter Faraday.default_adapter\n end\n end\n end", "def connection\n Faraday.new(base_path, headers: base_request_headers, request: request_options) do |faraday|\n faraday.use :breakers\n faraday.request :json\n\n faraday.response :raise_error, error_prefix: service_name\n faraday.response :betamocks if mock_enabled?\n faraday.response :json\n faraday.adapter Faraday.default_adapter\n end\n end", "def __build_connection(host, options={}, block=nil)\n client = ::Faraday::Connection.new(__full_url(host), options, &block)\n Connections::Connection.new :host => host, :connection => client\n end", "def connection\n @conn ||= Faraday.new(base_path, headers: base_request_headers, request: request_options) do |faraday|\n faraday.use :breakers\n faraday.use Faraday::Response::RaiseError\n\n faraday.request :multipart\n faraday.request :json\n\n faraday.response :json\n faraday.adapter Faraday.default_adapter\n end\n end", "def connection\n options = { url: api_url, ssl: { verify: false } }\n\n connection = Faraday.new(options) do |conn|\n conn.response :readmill_errors\n conn.response :mashify\n conn.response :json\n\n conn.adapter adapter\n end\n\n connection\n end", "def connection\n Faraday.new(base_path, headers: base_request_headers, request: request_options) do |faraday|\n faraday.use :breakers\n faraday.request :json\n\n faraday.response :raise_error, error_prefix: service_name\n faraday.response :caseflow_errors\n faraday.response :betamocks if mock_enabled?\n faraday.response :json\n faraday.adapter Faraday.default_adapter\n end\n end", "def connection\n Faraday.new(url:, headers:) do |conn|\n conn.request :json\n conn.use :breakers\n conn.use Faraday::Response::RaiseError\n conn.response :raise_error, error_prefix: service_name\n conn.response :json\n conn.response :betamocks if mock_enabled?\n conn.adapter Faraday.default_adapter\n end\n end", "def faraday_connection(url = nil)\n url ||= URI.join(root, href)\n\n Faraday.new(faraday_options.merge(url: url)) do |builder|\n builder.headers.merge!(headers || {})\n builder.headers['User-Agent'] = Aptible::Resource.configuration\n .user_agent\n\n if (ba = auth[:basic])\n builder.basic_auth(*ba)\n end\n\n builder.request :url_encoded\n builder.request :retry\n builder.adapter Faraday.default_adapter\n end\n end", "def connection\n @connection ||= begin\n Faraday.new(:url => \"http://#{configuration.server}:#{configuration.port}\", &connection_block)\n end\n end", "def build_connection\n Faraday.new(url) do |f|\n f.request :retry, max: 2, interval: 0.1, backoff_factor: 2\n\n f.headers['Content-Type'] = content_type\n f.headers['User-Agent'] = user_agent\n\n f.options.timeout = timeout\n f.options.open_timeout = open_timeout\n\n f.adapter :typhoeus\n end\n end", "def connection\n @connection ||= Faraday.new(faraday_options) do |builder|\n builder.use Faraday::Request::UrlEncoded\n # builder.use QuickbooksOnlineRuby::Middleware::Mashify, nil, @options\n builder.response :json\n\n if QuickbooksOnlineRuby.log?\n builder.use QuickbooksOnlineRuby::Middleware::Logger,\n QuickbooksOnlineRuby.configuration.logger,\n @options\n end\n\n builder.adapter @options[:adapter]\n end\n end", "def connection\n @connection ||= Faraday.new(url: api_endpoint) do |faraday|\n faraday.use Faraday::Request::UrlEncoded\n faraday.use Redd::Response::RaiseError\n faraday.use Redd::Response::ParseJson\n faraday.adapter Faraday.default_adapter\n\n faraday.headers = headers\n end\n end", "def conn\n @conn ||= Faraday.new(:url => uri.to_s) do |builder|\n builder.adapter self.class.adapter\n end\n end", "def connection\n self.faraday_connection ||= Faraday.new(configuration.faraday_options) do |f|\n if configuration.authenticated?\n f.request :authorization, :basic, configuration.username, configuration.password\n end\n f.request :multipart\n f.request :url_encoded\n unless options[:raw]\n f.response :mashify\n f.response :json\n end\n\n f.response :raise_error\n f.adapter configuration.adapter\n end\n end", "def connection\n @connection ||= begin\n connection_options = {:builder => @middleware}\n Faraday.new(@endpoint, @connection_options.merge(connection_options))\n end\n end", "def connection\n @connection ||= Faraday.new(ENDPOINT, connection_options)\n end", "def connection\n return unless @url\n\n @connection ||= Faraday::Connection.new(@url) do |b|\n middleware.each { |m, opts| b.use(m, opts) }\n b.request :url_encoded\n b.adapter :net_http\n end\n \n @connection.basic_auth(*@basic_auth) if @basic_auth\n @connection.token_auth(*@token_auth) if @token_auth\n @connection.authorization(*@authorization) if @authorization\n @connection\n end", "def connection\n @connection ||= Faraday.new(ENDPOINT, connection_options)\n end", "def conn\n Faraday.new(:url => @config.url) do |c|\n c.adapter Faraday.default_adapter\n c.headers['User-Agent'] = @config.usr_agent\n c.params = self.options\n end\n end", "def connection\n @connection ||= Faraday.new(url: Leo.route_base) do |faraday|\n faraday.options.timeout = Leo.read_timeout\n faraday.options.open_timeout = Leo.open_timeout\n faraday.use Faraday::Response::RaiseError\n faraday.request :url_encoded\n faraday.adapter Faraday.default_adapter\n end\n end", "def connection\n @connection ||= Faraday.new(api_endpoint) do |http|\n http.headers[:accept] = \"application/json, */*\"\n http.headers[:user_agent] = user_agent\n\n http.request :authorization, :Bearer, -> { token_store.get_token }\n http.request :json\n\n http.use Keap::REST::Response::RaiseError\n\n http.response :dates\n http.response :json, content_type: \"application/json\"\n # http.response :logger do |logger|\n # logger.filter(/(Bearer) (\\w+)/, '\\1 [FILTERED]')\n # end\n\n http.adapter adapter, @stubs\n end\n end", "def connection(options = {})\n\n options = self.connection_options(options)\n \n if @connection_options != options\n @connection = nil\n @connection_options = options\n end\n\n @connection ||= Faraday.new(@connection_options.merge(:builder => self.stack))\n end", "def connection\n Faraday.new(:url => host) do |faraday|\n #faraday.response :logger # log requests to STDOUT\n faraday.response :xml, :content_type => /\\bxml$/\n faraday.adapter Faraday.default_adapter # make requests with Net::HTTP\n end\n end", "def connection\n @connection ||= Faraday.new(@options[:instance_url]) do |builder|\n builder.use Restforce::Middleware::Mashify, self, @options\n builder.use Restforce::Middleware::Multipart\n builder.request :json\n builder.use authentication_middleware, self, @options if authentication_middleware\n builder.use Restforce::Middleware::Authorization, self, @options\n builder.use Restforce::Middleware::InstanceURL, self, @options\n builder.response :json\n builder.use Restforce::Middleware::Caching, cache, @options if cache\n builder.use FaradayMiddleware::FollowRedirects\n builder.use Restforce::Middleware::RaiseError\n builder.use Restforce::Middleware::Logger, Restforce.configuration.logger, @options if Restforce.log?\n builder.use Restforce::Middleware::Gzip, self, @options\n builder.adapter Faraday.default_adapter\n end\n end", "def mk_conn(path, headers = {})\n url = format('%s://%s%s', net[:scheme], net[:endpoint],\n [net[:api_base], path].uri_concat)\n Faraday.new(url: Addressable::URI.encode(url),\n headers: net[:headers].merge(headers))\n end", "def connection\n Faraday.new(base_path, headers: base_request_headers, request: request_options, ssl: ssl_options) do |conn|\n conn.use :breakers\n conn.request :soap_headers\n\n conn.response :soap_parser\n conn.response :betamocks if Settings.emis.mock\n conn.adapter Faraday.default_adapter\n end\n end", "def create_faraday\n faraday_options = options.slice(:headers, :params)\n if options[:insecure]\n faraday_options[:ssl] = { verify: false }\n end\n Faraday.new(nil, faraday_options) do\n # options\n if options[:url_prefix]\n _1.url_prefix = options[:url_prefix]\n end\n _1.options.timeout = options[:timeout]\n\n #\n # middleware that runs on both disk/network requests\n #\n\n # cookie middleware\n _1.use :cookie_jar\n\n # auto-encode form bodies\n _1.request :url_encoded\n\n # Before httpdisk so each redirect segment is cached\n # Keep track of redirect status for logger\n _1.response :follow_redirects, callback: ->(_old_env, new_env) { new_env[:redirect] = true }\n\n #\n # httpdisk\n #\n\n httpdisk_options = options.slice(:dir, :expires, :force, :force_errors, :ignore_params, :utf8)\n _1.use :httpdisk, httpdisk_options\n\n #\n # middleware below only used it httpdisk uses the network\n #\n\n # rate limit\n rate_limit = options[:rate_limit]\n _1.request :rate_limiter, interval: rate_limit\n\n # After httpdisk so that only non-cached requests are logged.\n # Before retry so that we don't log each retry attempt.\n _1.response :logger, nil, formatter: Middleware::LogFormatter if !options[:silent]\n\n retry_options = {\n max_interval: rate_limit, # very important, negates Retry-After: 86400\n max: options[:retries],\n methods: %w[delete get head options patch post put trace],\n retry_statuses: (500..600).to_a,\n retry_if: ->(_env, _err) { true },\n }\n _1.request :retry, retry_options\n end\n end", "def conn\n @conn ||= Faraday.new(url: authentication_uri.to_s) do |builder|\n builder.adapter Faraday.default_adapter\n end\n end", "def initialize(faraday_connection)\n @faraday_connection = faraday_connection\n flush_out_buffer\n end", "def connection\n @connection ||= begin\n conn = Faraday.new(url: Settings.SCIENCEWIRE.BASE_URI) do |faraday|\n faraday.use Faraday::Response::RaiseError\n faraday.request :retry, max: 2,\n interval: 0.5,\n interval_randomness: 0.5,\n backoff_factor: 2\n faraday.adapter :httpclient\n end\n conn.options.timeout = timeout_period\n conn.options.open_timeout = 10\n conn\n end\n end", "def connection(force_ssl = false)\n opts = {\n :headers => headers\n }\n if(force_ssl || self.ssl)\n opts[:ssl] = {:verify => false } unless self.ssl_verify\n opts[:url] = @endpoint.sub REG_HTTP, HTTPS_SCHEME\n else \n opts[:url] = @endpoint.sub REG_HTTPS, HTTP_SCHEME\n end\n\n if self.compress\n opts[:headers][ACCEPT_ENCODING] = COMPRESS_ACCEPT_ENCODING\n end\n\n if request_id_chain\n opts[:headers][X_REQUEST_ID_CHAIN] = request_id_chain\n end\n\n conn = Faraday.new(opts) do |conn|\n conn.response self.middleware.to_sym\n conn.options[:timeout] = self.timeout\n conn.adapter Faraday.default_adapter\n end\n SparkApi.logger.debug { \"Connection: #{conn.inspect}\" }\n conn\n end", "def connection\n Faraday.new(api_url, ssl: { verify: true }) do |conn|\n conn.adapter Faraday.default_adapter\n end\n end", "def endpoint_connection\n @endpoint_connection ||= Faraday.new(url: endpoint_url) do |faraday|\n faraday.adapter :net_http\n end\n end", "def connection\n @connect ||= Faraday.new do |f|\n f.adapter :net_http\n f.headers = connection_headers\n f.url_prefix = \"#{default_url_prefix}/api/v#{api_version}/\"\n f.response :json, content_type: /\\bjson$/\n end\n end", "def connection\n return unless @url\n\n @connection ||= Faraday::Connection.new(@url) do |b|\n b.request :url_encoded\n b.adapter :net_http\n end\n\n @connection.basic_auth(*@basic_auth) if @basic_auth\n @connection\n end", "def endpoint_connection\n @endpoint_connection ||= Faraday.new(url: endpoint_url) do |faraday|\n faraday.params = datasource_params\n faraday.adapter :net_http\n end\n end", "def endpoint_connection\n @endpoint_connection ||= Faraday.new(url: endpoint_url) do |faraday|\n faraday.params = datasource_params\n faraday.adapter :net_http\n end\n end", "def connection\n Faraday.new(url: url) do |conn|\n conn.use :breakers\n conn.response :check_in_errors\n conn.use :check_in_logging\n conn.response :raise_error, error_prefix: service_name\n conn.adapter Faraday.default_adapter\n end\n end", "def connection\n params = {}\n params[:oauth_token] = @access_token if @access_token\n @connection ||= Faraday.new(:url => api_url, :params => params, :headers => default_headers) do |builder|\n builder.use Faraday::Request::UrlEncoded\n builder.use Faraday::Response::Mashify\n builder.use Faraday::Response::ParseJson\n builder.adapter Faraday.default_adapter\n end\n end", "def patch_initialize\n ::Faraday::Connection.module_eval do\n alias_method :initialize_original, :initialize\n\n def initialize(url = nil, options = nil, &block)\n # initialize the connection as usual\n initialize_original(url, options, &block)\n\n # before we let go, add the Faraday tracer to the beginning of the stack\n @builder.insert(0, ::Faraday::Tracer)\n end\n end\n end", "def setup_connection\n Faraday.new(:url => @api_url) do |connection|\n #connection.request :url_encoded\n connection.request :json\n #connection.request :retry\n\n connection.response :logger if debug?\n connection.response :raise_error\n connection.response :json, :content_type => /\\bjson$/\n\n connection.use :instrumentation\n connection.adapter Faraday.default_adapter\n end\n end", "def base_connection(settings = FmRest.default_connection_settings, faraday_options = nil, &block)\n settings = ConnectionSettings.wrap(settings)\n\n host = settings.host!\n\n # Default to HTTPS\n scheme = \"https\"\n\n if host.match(/\\Ahttps?:\\/\\//)\n uri = URI(host)\n host = uri.hostname\n host += \":#{uri.port}\" if uri.port != uri.default_port\n scheme = uri.scheme\n end\n\n faraday_options = (faraday_options || {}).dup\n faraday_options[:ssl] = settings.ssl if settings.ssl?\n faraday_options[:proxy] = settings.proxy if settings.proxy?\n\n database = V1.url_encode(settings.database!)\n\n Faraday.new(\n \"#{scheme}://#{host}#{DATABASES_PATH}/#{database}/\".freeze,\n faraday_options,\n &block\n )\n end", "def reset_base_connection\n headers = PDC::Request.default_headers\n PDC::Base.connection = Faraday.new(url: api_url, headers: headers) do |c|\n c.request :append_slash_to_path\n c.request :authorization, 'Token', token if config.requires_token\n\n c.response :logger, config.logger\n c.response :pdc_paginator\n c.response :pdc_json_parser\n c.response :raise_error\n c.response :pdc_raise_error\n\n c.use FaradayMiddleware::FollowRedirects\n\n unless config.disable_caching\n c.use Faraday::HttpCache, store: cache_store,\n logger: PDC.logger,\n instrumenter: ActiveSupport::Notifications\n end\n c.adapter Faraday.default_adapter\n end\n end", "def endpoint_connection\n @endpoint_connection ||= Faraday.new(url: endpoint_url) do |faraday|\n faraday.request :basic_auth, user, password\n faraday.params = datasource_params\n faraday.adapter :net_http\n end\n end", "def connection\n return unless @url\n\n @connection ||= Faraday::Connection.new(@url) do |b|\n b.request :url_encoded\n b.adapter :net_http\n end\n\n proc_or_username = @basic_auth.first\n if proc_or_username.respond_to?(:call)\n username_password = proc_or_username.call\n @connection.basic_auth(*username_password)\n elsif proc_or_username\n @connection.basic_auth(*basic_auth)\n end\n\n @connection\n end", "def connection\n @connection ||= Faraday.new(\"#{URL_PREFIX}\", connection_options) do |conn|\n conn.basic_auth(api_key, nil)\n end\n end", "def get_conn url\n return Faraday.new(:url => url, :ssl => @@ssl) do |faraday|\n faraday.adapter Faraday.default_adapter\n faraday.response :logger\n end\n end", "def connection(force_ssl = false)\n opts = {\n :headers => headers\n }\n domain = @endpoint \n if(force_ssl || self.ssl)\n opts[:ssl] = {:verify => false }\n opts[:url] = @endpoint.sub /^http:/, \"https:\"\n else \n opts[:url] = @endpoint.sub /^https:/, \"http:\"\n end\n conn = Faraday::Connection.new(opts) do |builder|\n builder.adapter Faraday.default_adapter\n builder.use Faraday::Response::ParseJson\n builder.use FlexmlsApi::FaradayExt::FlexmlsMiddleware\n end\n FlexmlsApi.logger.debug(\"Connection: #{conn.inspect}\")\n conn\n end", "def connection(address)\n service_connection = Faraday.new(:url => \"#{address}\") do |faraday|\n faraday.request :url_encoded # form-encode POST params\n #faraday.response :logger # log requests to STDOUT\n faraday.adapter Faraday.default_adapter # make requests with Net::HTTP\n end\n return service_connection\nend", "def endpoint_connection\n @conn ||= Faraday.new(url: ENDPOINT_URL) do |faraday|\n faraday.adapter :net_http\n end\n rsp = @conn.get do |request|\n request.params = data_params\n end\n end", "def json_connection\n @json_connection ||= Faraday.new(@json_endpoint, @connection_options.merge(:builder => @middleware))\n end", "def base_connection(options = FmRest.default_connection_settings, &block)\n host = options.fetch(:host)\n\n # Default to HTTPS\n scheme = \"https\"\n\n if host.match(/\\Ahttps?:\\/\\//)\n uri = URI(host)\n host = uri.hostname\n host += \":#{uri.port}\" if uri.port != uri.default_port\n scheme = uri.scheme\n end\n\n faraday_options = {}\n faraday_options[:ssl] = options[:ssl] if options.key?(:ssl)\n faraday_options[:proxy] = options[:proxy] if options.key?(:proxy)\n\n Faraday.new(\n \"#{scheme}://#{host}#{BASE_PATH}/#{URI.escape(options.fetch(:database))}/\".freeze,\n faraday_options,\n &block\n )\n end", "def connection(options = {})\n default_options = {\n :headers => {\n :accept => 'application/json',\n :user_agent => user_agent,\n :host => EdgeCast::Config::DEFAULT_HOST\n },\n :ssl => { :verify => false },\n :url => endpoint,\n }\n\n @connection ||= Faraday.new(default_options.merge(connection_options)) do |builder|\n builder.request :auth, api_token\n builder.request :json\n builder.request :multipart\n builder.request :url_encoded\n\n builder.response :client_error\n builder.response :json\n builder.response :server_error\n\n builder.adapter(adapter)\n end\n end", "def connection\n log :debug, '.connection'\n\n @conn ||= Faraday.new(url: options.cas_server, ssl: ssl_hash) do |conn|\n conn.headers = headers\n conn.response :logger # log requests to STDOUT\n format = options.format\n conn.response(:xml, content_type: /\\bxml$/) if format == 'xml'\n conn.response(:json, content_type: /\\bjson$/) if format == 'json'\n conn.adapter :excon\n end\n end", "def connection\n return @connection if defined? @connection\n\n options = {\n request: {\n timeout: Nominatim.config.timeout\n }\n }\n\n @connection = Faraday.new Nominatim.config.endpoint, options do |builder|\n builder.use Nominatim::Response::ParseJson\n builder.adapter Faraday.default_adapter\n end\n\n @connection.params[:format] = 'json'\n @connection.params[:email] = Nominatim.config.email if Nominatim.config.email\n @connection.params[:key] = Nominatim.config.key if Nominatim.config.key\n\n @connection.headers[:user_agent] = Nominatim.config.user_agent\n @connection.headers[:\"accept-language\"] = Nominatim.config.accept_language\n\n @connection\n end", "def establish_connection(url, token)\n Faraday.new(url: url) do |faraday|\n faraday.request :json\n faraday.headers[\"Authorization\"] = token\n faraday.headers['Accept'] = 'application/json'\n faraday.response :json\n faraday.response :raise_error\n faraday.options.open_timeout = 2\n faraday.options.timeout = 100\n faraday.adapter Faraday.default_adapter\n end\n end", "def faraday_redirect\n @faraday_redirect ||= faraday_base do |conn|\n conn.request :json\n\n conn.request(:retry, RETRY_OPTIONS)\n conn.request(:gitlab_error_callback, ERROR_CALLBACK_OPTIONS)\n conn.adapter :net_http\n end\n end", "def connection\n Faraday.new(url: self.configuration.base_url) do |f|\n f.response :xml, :content_type => /\\bxml$/\n f.adapter :net_http\n f.basic_auth self.configuration.username, self.configuration.password\n end\n end", "def connection(options={})\n default_options = {\n :headers => {\n :accept => 'application/json',\n :user_agent => user_agent,\n },\n :ssl => {:verify => false},\n :url => options.fetch(:endpoint, endpoint),\n }\n @connection ||=Faraday.new(default_options.deep_merge(connection_options)) do |builder|\n builder.use TumblrV2Api::Request::TumblrV2ApiOAuth, credentials if credentials?\n builder.use Faraday::Request::UrlEncoded\n builder.use TumblrV2Api::Response::ParseJson\n builder.use TumblrV2Api::Response::RaiseClientError\n builder.use TumblrV2Api::Response::RaiseServerError\n builder.response :logger\n builder.adapter(adapter)\n end\n end", "def create_connection(accept_type='application/json')\n @connection = Faraday.new(:url => @base_url, :ssl => { :verify => @ssl_verify }) do |faraday|\n faraday.headers['Accept'] = accept_type\n faraday.request :att_multipart\n faraday.adapter Faraday.default_adapter\n end\n end", "def default_connection\n @default_connection ||= begin\n url = Restish.default_url\n Faraday.new(url: url) do |faraday|\n faraday.request :json\n faraday.response :json\n faraday.use :instrumentation\n logger = Rails.logger if defined?(Rails)\n faraday.use :http_cache, logger: logger\n faraday.adapter Faraday.default_adapter\n end\n end\n end", "def connection\n options = {\n :headers => {'Accept' => \"application/#{SponsorPay.format}; charset=utf-8\", \n 'User-Agent' => SponsorPay.user_agent, \n 'Connection' => 'Keep-Alive'}, \n #'Accept-Encoding' => 'gzip ...' # => automatically added by net::http\n :ssl => {:verify => false},\n :url => SponsorPay.endpoint,\n }\n Faraday::Connection.new(options) do |connection|\n connection.use FaradayMiddleware::Mashify\n connection.use Faraday::Response::ParseJson if SponsorPay.format.to_s.downcase == 'json'\n connection.adapter SponsorPay.adapter\n end\n end", "def connection\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"base_url=#{base_url}\",\n \"username=#{username}\",\n # \"password=#{password}\",\n \"\" ], bold_puts: debug_verbose_puts if debug_verbose\n rv = Faraday.new(url: base_url) do |c|\n c.basic_auth(username, password)\n c.adapter(Faraday.default_adapter)\n end\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"rv=#{rv}\",\n \"\" ], bold_puts: debug_verbose_puts if debug_verbose\n return rv\n end", "def conn\n @conn ||= connect\n if block_given?\n yield @conn\n else\n @conn\n end\n rescue *HttpExceptions\n @conn = connect\n return if defined?(once)\n once = true && retry\n end", "def make_connection(url, adapter_args = nil, opts = {})\n adapter_args ||= [Faraday.default_adapter]\n options = { :headers => { :user_agent => USER_AGENT } }.merge(opts)\n\n if token = PuppetForge::Connection.authorization\n options[:headers][:authorization] = token =~ AUTHORIZATION_TOKEN_REGEX ? \"Bearer #{token}\" : token\n end\n\n if lang = PuppetForge::Connection.accept_language\n options[:headers]['Accept-Language'] = lang\n end\n\n if proxy = PuppetForge::Connection.proxy\n options[:proxy] = proxy\n end\n\n Faraday.new(url, options) do |builder|\n builder.use Faraday::FollowRedirects::Middleware\n builder.response(:json, :content_type => /\\bjson$/, :parser_options => { :symbolize_names => true })\n builder.response(:raise_error)\n builder.use(:connection_failure)\n\n builder.adapter(*adapter_args)\n end\n end", "def setup_http_connection(host, opt)\n conn = Faraday.new(url: host) do |client|\n client.request :url_encoded\n client.request :oauth, opt\n client.adapter Faraday.default_adapter\n end\n conn\n end", "def gamebus_connection\n connection = Faraday.new url: Rails.application.secrets.gamebus_url do |faraday|\n faraday.request :url_encoded # form-encode POST params\n faraday.response :logger if Rails.env.development? || ENV['DEBUG_FARADAY'] # log requests to STDOUT\n faraday.adapter Faraday.default_adapter # make requests with Net::HTTP\n end\n connection.headers['Authorization'] = \"Bearer #{gamebus_key}\"\n connection.headers['Content-Type'] = 'application/json'\n return connection\n end" ]
[ "0.76702726", "0.7626552", "0.74242043", "0.7394347", "0.7366933", "0.73524314", "0.7320439", "0.72897077", "0.7238186", "0.7194645", "0.7194645", "0.7187595", "0.71869045", "0.7181838", "0.7167381", "0.7161359", "0.71354043", "0.71345055", "0.71345055", "0.71345055", "0.71345055", "0.712981", "0.71236026", "0.7103644", "0.7101611", "0.7098376", "0.7092549", "0.7073753", "0.70736116", "0.70600486", "0.7034025", "0.702155", "0.70203364", "0.701812", "0.7003113", "0.6983222", "0.69800764", "0.6971045", "0.6958533", "0.6947213", "0.69441414", "0.69434595", "0.694009", "0.6925273", "0.6911914", "0.68960094", "0.6892062", "0.6876716", "0.6855806", "0.6841111", "0.681899", "0.6807354", "0.6785141", "0.67685", "0.67461485", "0.67334145", "0.67267895", "0.6722456", "0.6701251", "0.6637899", "0.6567929", "0.65644777", "0.6549971", "0.65496063", "0.6545436", "0.6543783", "0.65402913", "0.65397346", "0.65189546", "0.65189546", "0.6515025", "0.6510447", "0.6478976", "0.64742744", "0.64711094", "0.6462164", "0.6455792", "0.6404568", "0.63608885", "0.6326103", "0.63243765", "0.6314219", "0.6268433", "0.62279886", "0.6208914", "0.6178638", "0.6157633", "0.61572814", "0.6124544", "0.6123924", "0.6115583", "0.61140555", "0.6108966", "0.6096043", "0.60624635", "0.60506487", "0.60506433", "0.6046439", "0.6018732", "0.6000916" ]
0.6771172
53
GET /paperitems GET /paperitems.json
def index if current_user.has_role? :admin @paperitems = Paperitem.all else @paper = Paper.find(session[:paper_id]) @paperitems = Paperitem.where(paper_id: @paper.id).order(:serial) ## 如果已经有了测验会话,则继续测验 if session[:papertest_id] @papertest = Papertest.find(session[:papertest_id]) ## 如果没有测验会话 else ### 并且不是出卷人,则新建测验会话开始测验。 if @paper.user_id != current_user.id unless Master.find_by(id: current_user.id) @papertest = Papertest.create{|pt| pt.user_id = current_user.id pt.paper_id = @paper.id pt.end_at = Time.now + @paper.duration * 60 } session[:papertest_id] = @papertest.id end end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @paper_items = PaperItem.all\n end", "def index\n @papers = Paper.all\n\n render json: @papers\n end", "def show\n render json: @paper\n end", "def items\n\t\tresponse = self.get('items').body\n\t\titems = JSON.parse(response)\n\t\tparse_items(items)\n\t\treturn items\n\tend", "def set_paper_item\n @paper_item = PaperItem.find(params[:id])\n end", "def show\n @paper = Paper.find(params[:id])\n @document = Document.where(paper_id: @paper.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @paper }\n end\n end", "def get_items\n @items\n end", "def get_books(response)\n response[\"items\"]\nend", "def set_paperitem\n @paperitem = Paperitem.find(params[:id])\n end", "def index\n @pitches = Pitch.page(params[:page]).order(id: :desc)\n rv = {\n items: @pitches.map {|pitch| pitch.as_json},\n total_pages: @pitches.total_pages,\n }\n api_success rv\n end", "def getItems()\n return mergeWithAPI(@item_json)['data']\n end", "def items\n response[\"items\"]\n end", "def paper_item_params\n params.require(:paper_item).permit(:paper_id, :question_id)\n end", "def show\n @items = Item.find(params[:id])\n render json: @items\n end", "def latest_paper(items)\r\n\t\t#latest_items = Document.has_photos.last(items)\r\n\t\tlatest_items = Document.has_photos.joins(:document_type).where(\"document_types.paper = ?\", true).limit(12).order('id desc')\r\n\tend", "def index\n @paper_words = PaperWord.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @paper_words }\n end\n end", "def items\n @items = current_user.items.paginate(:page => params[:page])\n end", "def list_items( args={} )\n @session.base_url = \"http://my.cl.ly\"\n \n url = \"/items\"\n args.each do |k, v|\n # probably a nicer way to do this\n if url == \"/items\"\n url << \"?#{k.to_s}=#{v.to_s}\"\n else\n url << \"&#{k.to_s}=#{v.to_s}\"\n end\n end\n resp = @session.get( url )\n \n raise AuthorizationError if resp.status == 401\n Crack::JSON.parse(resp.body)\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 @items = current_user.items\n respond_to do |format|\n format.html\n format.json { render json: @items }\n end\n end", "def item(uuid)\n http.get \"/items/#{uuid}\"\n end", "def index\n @papers = Paper.all\n end", "def index\n @papers = Paper.all\n end", "def index\n @papers = Paper.all\n end", "def index\n @papers = Paper.all\n end", "def my\n items = current_user.items\n render json: items\n end", "def items\n @items ||= items_from_response\n end", "def items\n @items\n end", "def items\n @items\n end", "def items\n @items\n end", "def items\n @items\n end", "def index\n @papers = Paper.from_user(current_user.id).paginate(:page => params[:page], :per_page => 10)\n end", "def index\n @paper_products = PaperProduct.all\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.find_by_user_id(Session[user_id])\n @items = Item.all\n render json: @items\n end", "def show\n @paper_type = PaperType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @paper_type }\n end\n end", "def items\n @document.xpath('//results/page/items/*')\n end", "def show\n @item = Item.all.where(collection_id: params[:id])\n render :json => @item\n end", "def update\n respond_to do |format|\n if @paperitem.update(paperitem_params)\n format.html { redirect_to @paperitem, notice: 'Paperitem was successfully updated.' }\n format.json { render :show, status: :ok, location: @paperitem }\n else\n format.html { render :edit }\n format.json { render json: @paperitem.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @papers = Paper.all\n end", "def create\n @paper = current_paper\n question = Question.find(params[:question_id])\n @paper_item = @paper.paper_items.build(:question=> question)\n\n respond_to do |format|\n if @paper_item.save\n format.html { redirect_to @paper_item, notice: 'Paper item was successfully created.' }\n format.json { render action: 'show', status: :created, location: @paper_item }\n else\n format.html { render action: 'new' }\n format.json { render json: @paper_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @paperposts = Paperpost.all\n end", "def collection\n return @client.api_helper.collection(\"items\")\n end", "def new\n @paper = Paper.new\n @document = @paper.documents.new\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @paper }\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 render json: Item.paginate(page: params[:page], per_page: 25)\n end", "def items(); @items || CrateAPI::Items.new(); end", "def items\n @beverages = Beverage.available\n respond_to do |format|\n format.json { render :json => @beverages.to_json(methods: :image_url)}\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 @pubs = Pub.all\n\n render json: @pubs\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 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 paperitem_params\n params.require(:paperitem).permit(:user_id, :paper_id, :practice_id, :score, :serial, :memo, :deleted_at)\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 index\n @rentable_items = RentableItem.all\n render json: @rentable_items\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 get_items(product_id, params={})\n self.client.get(\"products/#{product_id}/items\", params)\n end", "def item\n fetch('sword_art_online.item')\n end", "def show\n @author_paper = AuthorPaper.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @author_paper }\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 items\n product.items\n end", "def path\n \"/{databaseId}/items/list/\"\n end", "def destroy\n @paper_item.destroy\n respond_to do |format|\n format.html { redirect_to paper_items_url }\n format.json { head :no_content }\n end\n end", "def fetch\n data = WebApi.json! \"IEconItems_#{app_id}\", 'GetSchema', 1, language: language\n\n @attributes = {}\n data[:attributes].each do |attribute|\n @attributes[attribute[:defindex]] = attribute\n @attributes[attribute[:name]] = attribute\n end\n\n @effects = {}\n data[:attribute_controlled_attached_particles].each do |effect|\n @effects[effect[:id]] = effect[:name]\n end\n\n @items = {}\n @item_names = {}\n data[:items].each do |item|\n @items[item[:defindex]] = item\n @item_names[item[:name]] = item[:defindex]\n end\n\n @item_levels = {}\n data[:item_levels].each do |item_level_type|\n @item_levels[item_level_type[:name]] = {}\n item_level_type[:levels].each do |level|\n @item_levels[item_level_type[:name]][level[:level]] = level[:name]\n end\n end if data.key? :item_levels\n\n @item_sets = {}\n data[:item_sets].each do |item_set|\n @item_sets[item_set[:item_set]] = item_set\n end\n\n @origins = []\n data[:originNames].each do |origin|\n @origins[origin[:origin]] = origin[:name]\n end\n\n @qualities = []\n data[:qualities].keys.each_with_index do |key, index|\n @qualities[index] = data[:qualityNames][key] || key.to_s.capitalize\n end\n end", "def show\n session[:papertest_id] = @papertest.id\n @paper = @papertest.paper\n @paperitems = @paper.paperitems\n end", "def items\n return @items\n end", "def item\n @item = Item.find(params[:id])\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 @item_print = ItemPrint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item_print }\n end\n end", "def show\n item = Item.find(params[:id])\n render json: item\n end", "def show\n render json: Item.find(params[:id])\n end", "def show\n @potluck_item = PotluckItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @potluck_item }\n end\n end", "def show\n render json: Item.find(params[\"id\"])\n end", "def index\n @items = @user.items\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 update\n respond_to do |format|\n if @paper_item.update(paper_item_params)\n format.html { redirect_to @paper_item, notice: 'Paper item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @paper_item.errors, status: :unprocessable_entity }\n end\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 @paper_word = PaperWord.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @paper_word }\n end\n end", "def show\n render json: @item\n end", "def index\n @api_v1_items = Item.all\n render json: @api_v1_items\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: @boards }\n end\n end", "def index\n @item_type = params[:type] = \"C\"\n \n params[:id] = nil\n \n # 찜한 상품, 콜렉션\n @collections = Collection.itemList(params)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @collections }\n end\n \n end", "def search_limit\n myparams = {}\n myparams = params[:params]\n pas = []\n pas = GroupAn.paperInfo myparams\n render :json => pas\n end", "def items()\n data['galleries']\n end", "def items(params = {})\n if instance_variable_defined?(:@items)\n # TODO raise error if params are passed here, since they're meaningless\n @items\n else\n @items = load_page(params)\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 @priced_items = PricedItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @priced_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\t\t@auction_items = @auction.auction_items\n\t\trender json: @auction_items.as_json\n\tend", "def items\n authors\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 show\n render json: @rentable_item\n end", "def embedded_item\n @embedded_item\n end", "def index\r\n @items = Item.paginate(:page => params[:page])\r\n end", "def index\n @prayers = Prayer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @prayers }\n end\n end", "def index\n @appeals = @conference.appeals\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @appeals }\n end\n end", "def show\n @venue = Venue.find(params[:id])\n @papers = @venue.papers.order(:listorder)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @venue }\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" ]
[ "0.7294244", "0.64252704", "0.6221957", "0.61366534", "0.6053562", "0.60098606", "0.5966599", "0.59658164", "0.59639955", "0.5945867", "0.5938329", "0.59294647", "0.5924382", "0.59029573", "0.590159", "0.58515126", "0.58447504", "0.58360595", "0.5824796", "0.5821241", "0.57670337", "0.5765008", "0.5765008", "0.5765008", "0.5765008", "0.5764643", "0.57590145", "0.5728369", "0.5728369", "0.5728369", "0.5728369", "0.5715863", "0.571462", "0.5713552", "0.56974083", "0.56959605", "0.56948656", "0.5692724", "0.56741446", "0.5662542", "0.56542456", "0.56447405", "0.56401366", "0.5639646", "0.5638921", "0.5638921", "0.5638921", "0.5638921", "0.56322134", "0.56168145", "0.560096", "0.55996007", "0.5596659", "0.5588072", "0.55849695", "0.5562917", "0.5553106", "0.55262214", "0.5524617", "0.5514225", "0.5514113", "0.55072266", "0.54916865", "0.5480373", "0.54770803", "0.54769385", "0.547443", "0.546819", "0.5462786", "0.5459256", "0.54583234", "0.5443617", "0.5439071", "0.5433257", "0.54185265", "0.5399879", "0.5398018", "0.5394689", "0.5386663", "0.53571016", "0.5345253", "0.5343532", "0.5342727", "0.5340832", "0.5337925", "0.53301436", "0.53213817", "0.53183836", "0.53182924", "0.5317365", "0.5317165", "0.530777", "0.5306551", "0.53050685", "0.53046", "0.5303104", "0.5302588", "0.5302033", "0.53005046", "0.5297668", "0.5290815" ]
0.0
-1
GET /paperitems/1 GET /paperitems/1.json
def show if current_user.has_role? :admin else session[:paperitem_id] = @paperitem.id @paper = @paperitem.paper @papertest_ids = @paper.papertests.map{|p|p.id} @evaluations = Evaluation.where(practice_id: @paperitem.practice_id, papertest: @papertest_ids).order(id: :desc) # 下面生成“上一题”和“下一题” all_paperitem_ids = Paperitem.where(paper_id: @paper.id).order(:serial).pluck(:id) index = all_paperitem_ids.find_index(@paperitem.id) if index - 1 < 0 @previous_paperitem = nil else previous_paperitem = all_paperitem_ids[index - 1] @previous_paperitem = Paperitem.find(previous_paperitem) end if index + 1 == all_paperitem_ids.length @next_paperitem = nil else next_paperitem = all_paperitem_ids[index + 1] @next_paperitem = Paperitem.find(next_paperitem) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @paper_items = PaperItem.all\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 item(uuid)\n http.get \"/items/#{uuid}\"\n end", "def show\n render json: @paper\n end", "def set_paper_item\n @paper_item = PaperItem.find(params[:id])\n end", "def show\n @item = Item.all.where(collection_id: params[:id])\n render :json => @item\n end", "def show\n @paper = Paper.find(params[:id])\n @document = Document.where(paper_id: @paper.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @paper }\n end\n end", "def show\n @items = Item.find(params[:id])\n render json: @items\n end", "def set_paperitem\n @paperitem = Paperitem.find(params[:id])\n end", "def index\n @papers = Paper.all\n\n render json: @papers\n end", "def show\n @paper_type = PaperType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @paper_type }\n end\n end", "def item\n @item = Item.find(params[:id])\n end", "def show\n item = Item.find(params[:id])\n render json: item\n end", "def latest_paper(items)\r\n\t\t#latest_items = Document.has_photos.last(items)\r\n\t\tlatest_items = Document.has_photos.joins(:document_type).where(\"document_types.paper = ?\", true).limit(12).order('id desc')\r\n\tend", "def show\n render json: Item.find(params[\"id\"])\n end", "def show\n render json: Item.find(params[:id])\n end", "def get_books(response)\n response[\"items\"]\nend", "def show\n @potluck_item = PotluckItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @potluck_item }\n end\n end", "def show\n @item_print = ItemPrint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item_print }\n end\n end", "def get_item\n @item = Item.find_by_id(params[:id])\n if @item\n return @item\n else \n render json: {\"message\": {\"type\": \"error\", \"content\": \"The item could not be found!\"}}\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 item\n fetch('sword_art_online.item')\n end", "def update\n respond_to do |format|\n if @paperitem.update(paperitem_params)\n format.html { redirect_to @paperitem, notice: 'Paperitem was successfully updated.' }\n format.json { render :show, status: :ok, location: @paperitem }\n else\n format.html { render :edit }\n format.json { render json: @paperitem.errors, status: :unprocessable_entity }\n end\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 @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 render json: @item\n end", "def getItems()\n return mergeWithAPI(@item_json)['data']\n end", "def index\n @pitches = Pitch.page(params[:page]).order(id: :desc)\n rv = {\n items: @pitches.map {|pitch| pitch.as_json},\n total_pages: @pitches.total_pages,\n }\n api_success rv\n end", "def new\n @paper = Paper.new\n @document = @paper.documents.new\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @paper }\n end\n end", "def index\n @api_v1_items = Item.all\n render json: @api_v1_items\n end", "def get_items\n @items\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.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.find_by_user_id(Session[user_id])\n @items = Item.all\n render json: @items\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 create\n @paper = current_paper\n question = Question.find(params[:question_id])\n @paper_item = @paper.paper_items.build(:question=> question)\n\n respond_to do |format|\n if @paper_item.save\n format.html { redirect_to @paper_item, notice: 'Paper item was successfully created.' }\n format.json { render action: 'show', status: :created, location: @paper_item }\n else\n format.html { render action: 'new' }\n format.json { render json: @paper_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def paper_item_params\n params.require(:paper_item).permit(:paper_id, :question_id)\n end", "def item; @item; end", "def item; @item; 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 show\n @author_paper = AuthorPaper.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @author_paper }\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 items\n\t\tresponse = self.get('items').body\n\t\titems = JSON.parse(response)\n\t\tparse_items(items)\n\t\treturn items\n\tend", "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 my\n items = current_user.items\n render json: items\n end", "def destroy\n @paper_item.destroy\n respond_to do |format|\n format.html { redirect_to paper_items_url }\n format.json { head :no_content }\n end\n end", "def path\n \"/{databaseId}/items/list/\"\n end", "def item\n $data_items[1]\n end", "def index\n render json: Item.paginate(page: params[:page], per_page: 25)\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 index\n @items = Item.all\n @budget = Budget.find params[:budget_id]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def update\n respond_to do |format|\n if @paper_item.update(paper_item_params)\n format.html { redirect_to @paper_item, notice: 'Paper item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @paper_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @item_type = params[:type] = \"C\"\n \n params[:id] = nil\n \n # 찜한 상품, 콜렉션\n @collections = Collection.itemList(params)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @collections }\n end\n \n end", "def show\n @feed_item = Item.find(params[:id])\n\n render json: @feed_item\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 index\n @paper_words = PaperWord.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @paper_words }\n end\n end", "def get_item(course_id, item_id)\r\n relative_url = PATH_COURSES_ITEMS_ % [course_id, item_id]\r\n get(relative_url)\r\n end", "def show\n @paper_word = PaperWord.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @paper_word }\n end\n end", "def index\n @pubs = Pub.all\n\n render json: @pubs\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 items\n response[\"items\"]\n end", "def show\n @research_item = ResearchItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @research_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 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 get_single_item(item_id, payload = {})\n payload = payload.merge('ItemID' => item_id)\n request('GetSingleItem', payload)\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 @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 items(); @items || CrateAPI::Items.new(); end", "def findItem\n item = Item.find(params[:id])\n if item\n return item\n else\n return render json: {data: \"Failure, could not find this item.\"}, status: :not_found\n end\n end", "def item_page\n @item_page ||= ApiBucket::Base::Element.get(@doc, \"//ItemPage\").to_i\n end", "def show\n session[:papertest_id] = @papertest.id\n @paper = @papertest.paper\n @paperitems = @paper.paperitems\n end", "def show\n render json: @rentable_item\n end", "def get(item)\n run(\"show #{ item }\")\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 get_item_from_body(body)\n get_item_from_result(body.fetch('Item', {}))\n end", "def index\n @papers = Paper.all\n end", "def index\n @papers = Paper.all\n end", "def index\n @papers = Paper.all\n end", "def index\n @papers = Paper.all\n end", "def view\n res = @client.get(path)\n @attributes = res.json if res.success?\n end" ]
[ "0.6998211", "0.6408055", "0.6305317", "0.62869877", "0.62258196", "0.6203707", "0.62015474", "0.6183967", "0.6177961", "0.6114213", "0.60679924", "0.60595286", "0.60313183", "0.5989586", "0.59498775", "0.5948773", "0.59012043", "0.5889972", "0.5872183", "0.58697534", "0.58443797", "0.58297044", "0.5807324", "0.58065575", "0.5792415", "0.57757604", "0.5773157", "0.5770417", "0.57703024", "0.5748968", "0.573495", "0.5729549", "0.5729549", "0.5729549", "0.5729549", "0.5728941", "0.5723919", "0.5692455", "0.5687014", "0.5680272", "0.56795174", "0.56795174", "0.5677673", "0.5667091", "0.56619596", "0.56619596", "0.56619596", "0.56619596", "0.56619596", "0.56619596", "0.56619596", "0.56619596", "0.56619596", "0.56619596", "0.56619596", "0.56619596", "0.56619596", "0.56619596", "0.56619596", "0.56619596", "0.56619596", "0.56619596", "0.56619596", "0.5655073", "0.56543034", "0.56406736", "0.5639303", "0.5627049", "0.5617937", "0.5617935", "0.56106186", "0.56048745", "0.5601438", "0.5595685", "0.5593951", "0.55919147", "0.5587393", "0.5584048", "0.55816805", "0.5581639", "0.55744636", "0.5560972", "0.5551593", "0.55501133", "0.5538324", "0.5535879", "0.5530818", "0.5522846", "0.5521619", "0.5518971", "0.5516229", "0.55137104", "0.5506659", "0.5506599", "0.55025464", "0.55011755", "0.54983515", "0.54983515", "0.54983515", "0.54983515", "0.54886556" ]
0.0
-1
POST /paperitems POST /paperitems.json
def create @paperitem = Paperitem.new(paperitem_params) unless @paperitem.practice_id @paperitem.practice_id = 0 @paperitem.user_id = current_user.id @paperitem.paper_id = session[:paper_id] @paperitem.score = 0 end respond_to do |format| if @paperitem.save format.html { redirect_to @paperitem, notice: 'Paperitem was successfully created.' } format.json { render :show, status: :created, location: @paperitem } else format.html { render :new } format.json { render json: @paperitem.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @paper = current_paper\n question = Question.find(params[:question_id])\n @paper_item = @paper.paper_items.build(:question=> question)\n\n respond_to do |format|\n if @paper_item.save\n format.html { redirect_to @paper_item, notice: 'Paper item was successfully created.' }\n format.json { render action: 'show', status: :created, location: @paper_item }\n else\n format.html { render action: 'new' }\n format.json { render json: @paper_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def paper_item_params\n params.require(:paper_item).permit(:paper_id, :question_id)\n end", "def paperitem_params\n params.require(:paperitem).permit(:user_id, :paper_id, :practice_id, :score, :serial, :memo, :deleted_at)\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(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 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 set_paper_item\n @paper_item = PaperItem.find(params[:id])\n end", "def create\n @paper = Paper.new(paper_params)\n\n if @paper.save\n render json: @paper, status: :created, location: @paper\n else\n render json: @paper.errors, status: :unprocessable_entity\n end\n end", "def set_paperitem\n @paperitem = Paperitem.find(params[:id])\n end", "def create\n @paper = Paper.new(paper_params)\n respond_to do |format|\n if @paper.save\n format.html { redirect_to @paper, notice: 'Paper was successfully created.' }\n format.json { render :show, status: :created, location: @paper }\n else\n format.html { render :new }\n format.json { render json: @paper.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @paper = Paper.new(paper_params)\n\n respond_to do |format|\n if @paper.save\n format.html { redirect_to @paper, notice: 'Paper was successfully created.' }\n format.json { render :show, status: :created, location: @paper }\n else\n format.html { render :new }\n format.json { render json: @paper.errors, status: :unprocessable_entity }\n end\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.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 create\n @paper = Paper.new(paper_params)\n\n respond_to do |format|\n if @paper.save\n format.html { redirect_to \"/trabalhos\", notice: 'Trabalho criado com sucesso.' }\n format.json { render :show, status: :created, location: @paper }\n else\n format.html { render :new }\n format.json { render json: @paper.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @paper_items = PaperItem.all\n end", "def item_params\n params.require(:item).permit(:item, :body)\n end", "def create\n\t\titem = Item.create(item_params)\n\t\trender json: item\n\tend", "def update\n respond_to do |format|\n if @paperitem.update(paperitem_params)\n format.html { redirect_to @paperitem, notice: 'Paperitem was successfully updated.' }\n format.json { render :show, status: :ok, location: @paperitem }\n else\n format.html { render :edit }\n format.json { render json: @paperitem.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 create\n @item = Item.new(params[:item])\n @item.save\n respond_with @item\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 create\n params = paper_params\n authors = params.delete(:authors).split(\",\").map do |aname|\n Author.find_or_create_by(name: aname.strip)\n end\n\n awards = params.delete(:awards).split(\",\").map do |abody|\n Award.find_or_create_by(body: abody.strip, year: paper_params[:year])\n end\n\n @paper = Paper.new(params)\n @paper.authors = authors\n @paper.awards = awards\n\n respond_to do |format|\n if @paper.save\n format.js { render json: @paper }\n else\n format.js { render json: { error: @paper.errors } }\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(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 @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 = 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(attributes)\n response = JSON.parse(@client.post('items', attributes).body)\n Promisepay::Item.new(@client, response['items'])\n end", "def create\n @item_collection = ItemCollection.new(item_collection_params)\n\n respond_to do |format|\n if @item_collection.save\n format.html { redirect_to @item_collection, notice: \"La collection a été correctement créée\" }\n format.json { render :show, status: :created, location: @item_collection }\n else\n format.html { render :new }\n format.json { render json: @item_collection.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @part_types = Constants::PART_TYPES\n @item = Item.new(item_params.merge(user_id: current_user.id))\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 @paperpost = Paperpost.new(paperpost_params)\n\n respond_to do |format|\n if @paperpost.save\n format.html { redirect_to @paperpost, notice: 'Paperpost was successfully created.' }\n format.json { render :show, status: :created, location: @paperpost }\n else\n format.html { render :new }\n format.json { render json: @paperpost.errors, status: :unprocessable_entity }\n end\n end\n end", "def item_params\n params.require(:item).permit(:title, :body)\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 = 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(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_item(user_id, data) \n data = data.just(SETTABLE_ITEM_FIELDS)\n data[:user_id] = user_id\n data[:title] ||= 'item'\n data[:price] ||= 5\n data[:price] = data[:price].to_i\n data[:slug] = get_unique_slug($items,:slug,data[:title])\n\n data[:imgs] = data[:imgs].to_a.map {|link| {link: link}}\n data[:videos] = data[:videos].to_a.map {|link| {link: link}}\n data[:status] = :pending\n item = $items.add(data)\nend", "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 associate_paper\n @paper = params[:pname]\n @data = Paper.new.pull_info(@paper, Integer(params[:index]))\n @paper = create_paper(@data[:title], @data[:titlelink], @data[:citations], @data[:author])\n redirect_to :action => :edit, :id => @paper.id\n end", "def create\n @go_down_item = GoDownItem.new(go_down_item_params)\n\n respond_to do |format|\n if @go_down_item.save\n format.html { redirect_to @go_down_item, notice: 'Go down item was successfully created.' }\n format.json { render :show, status: :created, location: @go_down_item }\n else\n format.html { render :new }\n format.json { render json: @go_down_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @survey_item = SurveyItem.new(survey_item_params)\n\n respond_to do |format|\n if @survey_item.save\n format.html { redirect_to @survey_item, notice: 'Survey item was successfully created.' }\n format.json { render :show, status: :created, location: @survey_item }\n else\n format.html { render :new }\n format.json { render json: @survey_item.errors, status: :unprocessable_entity }\n end\n end\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", "def create\n @bibliography_item = BibliographyItem.new(bibliography_item_params)\n\n respond_to do |format|\n if @bibliography_item.save\n format.html { redirect_to @bibliography_item, notice: 'Bibliography item was successfully created.' }\n format.json { render :show, status: :created, location: @bibliography_item }\n else\n format.html { render :new }\n format.json { render json: @bibliography_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def writeItem(app, repo_url, item)\n headers = defaultHeaders(app[\"token\"])\n data = item.to_json\n response = HTTParty.post(repo_url,\n headers: headers,\n body: data)\n response\nend", "def item_params\n params.require(:item).permit!\n end", "def create\n @item_print = ItemPrint.new(item_print_params)\n\n respond_to do |format|\n if @item_print.save\n format.html { redirect_to @item_print, notice: 'Item print was successfully created.' }\n format.json { render json: @item_print, status: :created, location: @item_print }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item_print.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(item_params)\n @item.save\n redirect_to @item\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 save\n @items.to_json\n end", "def create\n @item = current_user.items.create(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to [current_user, @item], notice: 'Item was successfully created.' }\n format.json { render action: 'show', status: :created, location: @item }\n else\n @item.pictures.build\n format.html { render action: 'new', :locals => {item:@item} }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @survey_answer_item = SurveyAnswerItem.new(params[:survey_answer_item])\n\n respond_to do |format|\n if @survey_answer_item.save\n format.html { redirect_to @survey_answer_item, notice: 'Survey answer item was successfully created.' }\n format.json { render json: @survey_answer_item, status: :created, location: @survey_answer_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @survey_answer_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 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(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 @track_painter_item = TrackPainterItem.new(track_painter_item_params)\n\n respond_to do |format|\n if @track_painter_item.save\n format.html { redirect_to @track_painter_item, notice: 'Track painter item was successfully created.' }\n format.json { render :show, status: :created, location: @track_painter_item }\n else\n format.html { render :new }\n format.json { render json: @track_painter_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @papertest = Papertest.new(papertest_params)\n\n respond_to do |format|\n if @papertest.save\n format.html { redirect_to @papertest, notice: 'Papertest was successfully created.' }\n format.json { render :show, status: :created, location: @papertest }\n else\n format.html { render :new }\n format.json { render json: @papertest.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(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 pcp_item_params\n params.require( :pcp_item ).permit( :author, :reference, :description, :assessment )\n end", "def item_params\n params.require(:item).permit!\n end", "def create\n @item = @list.items.create(item_params)\n redirect_to @list\n end", "def paper_params\n params.require(:paper).permit(:name, :test_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 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 paper_params\n params.require(:paper).permit(:name, :template_id, :user_id)\n end", "def create\n @user = User.find(current_user.id)\n @item = @user.items.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 :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 destroy\n @paper_item.destroy\n respond_to do |format|\n format.html { redirect_to paper_items_url }\n format.json { head :no_content }\n end\n end", "def new\n @paper = Paper.new\n @document = @paper.documents.new\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @paper }\n end\n end", "def create\n @item = current_user.items.build(item_params)\n\n\n respond_to do |format|\n if @item.save\n\n format.html { redirect_to edit_pics_path(:id => @item.id), notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n\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 '/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 add\n if ! @collection.write?(@user, @client)\n render_json :status => :forbidden, :messages => \"This collection belongs to another client.\" and return\n end\n render_json :status => :bad_request and return unless @collection.create_item(params[:item], @user, @client)\n @item = @collection.items[-1]\n entry = ( @item.class == Collection ? @item.to_hash(@user, @client) : @item )\n render_json :status => :created, :entry => entry and return\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 @budget = Budget.find(params[:budget_id])\n @proposed_item = @budget.proposed_items.build(proposed_item_params)\n\n respond_to do |format|\n if @proposed_item.save\n format.html { redirect_to @budget, notice: 'Proposed item was successfully created.' }\n format.json { render :show, status: :created, location: @proposed_item }\n else\n format.html { render :new }\n format.json { render json: @proposed_item.errors, status: :unprocessable_entity }\n end\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 \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 create\n @paper_type = PaperType.new(params[:paper_type])\n\n respond_to do |format|\n if @paper_type.save\n format.html { redirect_to @paper_type, notice: 'Paper type was successfully created.' }\n format.json { render json: @paper_type, status: :created, location: @paper_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @paper_type.errors, status: :unprocessable_entity }\n end\n end\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 create\n @research_item = ResearchItem.new(params[:research_item])\n\n respond_to do |format|\n if @research_item.save\n format.html { redirect_to @research_item, :notice => 'Research item was successfully created.' }\n format.json { render :json => @research_item, :status => :created, :location => @research_item }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @research_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @paper_item.update(paper_item_params)\n format.html { redirect_to @paper_item, notice: 'Paper item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @paper_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" ]
[ "0.71196145", "0.6931301", "0.6668755", "0.63936496", "0.6215943", "0.61679894", "0.6131102", "0.60715365", "0.60362417", "0.6014292", "0.6008369", "0.60058945", "0.5849308", "0.57866037", "0.5779479", "0.5765568", "0.57343155", "0.5728311", "0.5719931", "0.57191", "0.5716803", "0.5706898", "0.56930226", "0.5691707", "0.56810045", "0.56736374", "0.56725055", "0.5653933", "0.5642371", "0.56418806", "0.56286484", "0.5616894", "0.5608488", "0.55901194", "0.5578931", "0.5577438", "0.55773276", "0.55773276", "0.55773276", "0.55773276", "0.55773276", "0.55773276", "0.55773276", "0.55737317", "0.5572724", "0.5567234", "0.5563297", "0.55609804", "0.55466723", "0.55443186", "0.55438524", "0.55317193", "0.55291474", "0.55276465", "0.5524905", "0.55246276", "0.5518049", "0.55090064", "0.5507251", "0.5507251", "0.5507251", "0.5507251", "0.5507251", "0.5507251", "0.5507251", "0.5507251", "0.5507251", "0.5507251", "0.5507251", "0.5507251", "0.5507251", "0.5507251", "0.5507251", "0.5507251", "0.55035424", "0.55012554", "0.54982936", "0.5493014", "0.5490117", "0.5485648", "0.5480465", "0.54781866", "0.5477711", "0.5474789", "0.5474548", "0.54734385", "0.546617", "0.54601204", "0.5459045", "0.5454626", "0.54518527", "0.54518473", "0.5449032", "0.5446346", "0.54445267", "0.54222345", "0.5412962", "0.5411345", "0.5406633", "0.5401773" ]
0.6359009
4
PATCH/PUT /paperitems/1 PATCH/PUT /paperitems/1.json
def update respond_to do |format| if @paperitem.update(paperitem_params) format.html { redirect_to @paperitem, notice: 'Paperitem was successfully updated.' } format.json { render :show, status: :ok, location: @paperitem } else format.html { render :edit } format.json { render json: @paperitem.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @paper_item.update(paper_item_params)\n format.html { redirect_to @paper_item, notice: 'Paper item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @paper_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 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 = @client.items.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 { 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 if @api_v1_item.update(api_v1_item_params)\n render json: @api_v1_item\n else\n render json: @api_v1_item.errors\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\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 @paper = Paper.find(params[:id])\n\n respond_to do |format|\n if @paper.update_attributes(params[:paper])\n format.html { redirect_to @paper, notice: 'Paper was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @paper.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 \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 @paper.update(paper_params)\n format.html { redirect_to @paper, notice: 'Paper was successfully updated.' }\n format.json { render :show, status: :ok, location: @paper }\n else\n format.html { render :edit }\n format.json { render json: @paper.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @paper.update(paper_params)\n format.html { redirect_to @paper, notice: 'Paper was successfully updated.' }\n format.json { render :show, status: :ok, location: @paper }\n else\n format.html { render :edit }\n format.json { render json: @paper.errors, status: :unprocessable_entity }\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 @item.update!(item_params)\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(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(item_attrs = {})\n body = { update: item_attrs }\n Iterable.request(conf, base_path).patch(body)\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 @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 @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 @pet_item.update(pet_item_params)\n format.html { redirect_to @pet_item, notice: 'Pet item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @pet_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 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 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 respond_to do |format|\n if @paper.update(paper_params)\n format.html { redirect_to @paper, notice: 'Paper was successfully updated.' }\n format.json { render :show, status: :ok, location: @paper }\n else\n format.html { render :edit }\n format.json { render json: @paper.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 change_multiple_items\n @items = params[:items]\n\n @items.each do |item|\n @current_item = Item.find(item[:id])\n @current_item.update(quantity: item[:quantity])\n end\n\n render :json => @items.to_json\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 @paper.update(paper_params)\n format.html { redirect_to \"/trabalhos\", notice: 'Trabalho alterado com sucesso.' }\n format.json { render :show, status: :ok, location: @paper }\n else\n format.html { render :edit }\n format.json { render json: @paper.errors, status: :unprocessable_entity }\n end\n end\n end", "def update # PATCH\n raise NotImplementedError\n end", "def update\n set_proposed_item\n\n respond_to do |format|\n if @proposed_item.update(proposed_item_params)\n format.html { redirect_to @budget, notice: 'Proposed item was successfully updated.' }\n format.json { render :show, status: :ok, location: @proposed_item }\n else\n format.html { render :edit }\n format.json { render json: @proposed_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\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 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\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 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 api_patch(path, data = {})\n api_request(:patch, path, :data => data)\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 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 @part_types = Constants::PART_TYPES\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 @paper = Paper.find(params[:id])\n\n if @paper.update(paper_params)\n head :no_content\n else\n render json: @paper.errors, status: :unprocessable_entity\n end\n end", "def update\n json_response(@food_item.update!(food_item_params))\n end", "def update!(**args)\n @items = args[:items] if args.key?(:items)\n @request_id = args[:request_id] if args.key?(:request_id)\n end", "def update!(**args)\n @items = args[:items] if args.key?(:items)\n @request_id = args[:request_id] if args.key?(:request_id)\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 @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 @potluck_item = PotluckItem.find(params[:id])\n\n respond_to do |format|\n if @potluck_item.update_attributes(params[:potluck_item])\n format.html { render :action => :show }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\", status: :unprocessable_entity }\n format.json { render json: @potluck_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_path, notice: 'Item was updated successfully' }\n format.json { render :show, status: :ok, location: items_path }\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 @user = current_user\n @paperedit = @user.paperedits.find( params[:id])\n\n\n respond_to do |format|\n if @paperedit.update(paperedit_params)\n format.html { redirect_to paperedit_papercuts_path(@paperedit), notice: 'Paperedit was successfully updated.' }\n format.json { render :show, status: :ok, location: @paperedit }\n else\n format.html { render :edit }\n format.json { render json: @paperedit.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 new_params = paper_set_params\n if params[:paper_set][:paper_ids]\n new_params[:paper_ids] = params[:paper_set][:paper_ids].split(\",\")\n end\n respond_to do |format|\n if @paper_set.update(new_params)\n format.html { redirect_to paper_sets_path, notice: '成功編輯試卷包' }\n format.json { render :index, status: :ok, location: @paper_set }\n else\n format.html { render :edit }\n format.json { render json: @paper_set.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_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 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.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 }\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 if item.user == current_user\n if item.update(item_params)\n render json: item\n else\n render json: {errors: item.errors}, status: :unprocessable_entity\n end\n else\n render json: {errors: \"you can't do it\"}, status: :unprocessable_entity\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\n\n end" ]
[ "0.7298528", "0.68244535", "0.65368", "0.65147763", "0.6473924", "0.6460453", "0.6457427", "0.6450522", "0.6409075", "0.639189", "0.63773245", "0.63773245", "0.63341373", "0.63212675", "0.6317687", "0.63074917", "0.63025326", "0.63017166", "0.630061", "0.62975484", "0.62911826", "0.6283981", "0.62835836", "0.627128", "0.62680674", "0.6262961", "0.6262961", "0.6262961", "0.6262961", "0.6262961", "0.6262961", "0.6262961", "0.6262961", "0.6262961", "0.6262961", "0.6262961", "0.62483525", "0.6245038", "0.6245038", "0.6240376", "0.6219408", "0.6213333", "0.62074214", "0.619917", "0.61976975", "0.61971116", "0.619401", "0.618867", "0.6188141", "0.61827856", "0.61827856", "0.61827856", "0.61827856", "0.61827856", "0.61827856", "0.61827856", "0.61827856", "0.61827856", "0.61810213", "0.6163907", "0.61602026", "0.6158394", "0.6158394", "0.6119914", "0.6105334", "0.60991615", "0.6090971", "0.60860986", "0.6078535", "0.6069965", "0.6068399", "0.6061417", "0.60578156", "0.6057593", "0.6057363", "0.6057363", "0.6057363", "0.6057363", "0.6057363", "0.6057363", "0.6057363", "0.6057363", "0.6057363", "0.6057363", "0.6057363", "0.6057363", "0.6057363", "0.6057363", "0.6057363", "0.6057363", "0.6057363", "0.6057363", "0.6057363", "0.6057363", "0.6057363", "0.6057363", "0.6057363", "0.6057363", "0.6048571", "0.60480326" ]
0.7192861
1
DELETE /paperitems/1 DELETE /paperitems/1.json
def destroy @paperitem.destroy respond_to do |format| format.html { redirect_to paperitems_url, notice: 'Paperitem was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @paper_item.destroy\n respond_to do |format|\n format.html { redirect_to paper_items_url }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Item.delete(params[\"id\"])\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 @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 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.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 items_path }\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 end\n end", "def delete_item(id)\n record \"/todos/delete_item/#{id}\"\n end", "def delete_item(item)\n @get_items.delete(item)\n end", "def destroy\n @item = @client.items.find(params[:id])\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully removed from Inventory.' }\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 respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\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 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 destroy\n @item = @user.items.find(params[:id])\n @item.destroy\n\n\n respond_to do |format|\n format.html { redirect_to user_items_path(@user) }\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 @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 = 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.destroy\n head :no_content\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 @paper = Paper.find(params[:id])\n @paper.destroy\n\n respond_to do |format|\n format.html { redirect_to papers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @line_item1 = LineItem1.find(params[:id])\n @line_item1.destroy\n\n respond_to do |format|\n format.html { redirect_to line_item1s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @resource_item.destroy\n respond_to do |format|\n format.html { redirect_to resource_items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_v1_item.destroy\n render json: {message: 'deletado com sucesso'}\n end", "def destroy\n return if new_record?\n \n @api.delete \"/items/#{shortcode_url}.json\"\n end", "def destroy\n @sub1_line_item.destroy\n respond_to do |format|\n format.html { redirect_to sub1_line_items_url, notice: 'Sub1 line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to lists_url }\n format.json { head :ok }\n end\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 @paper.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_path }\n format.json { head :ok }\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 delete_item\n\nend", "def destroy\n @item_collection.destroy\n respond_to do |format|\n format.html { redirect_to item_collections_url, notice: 'La collection a été détruite' }\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) }\n format.xml { head :ok }\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', notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n end\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 @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 @ordereditem.destroy\n respond_to do |format|\n format.html { redirect_to ordereditems_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 :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 @admin_item = Admin::Item.find(params[:id])\n @admin_item.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_item = Admin::Item.find(params[:id])\n @admin_item.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_items_url }\n format.json { head :no_content }\n end\n end", "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 destroy\n @item = current_user.items.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 @pet_item.destroy\n respond_to do |format|\n format.html { redirect_to pet_items_url }\n format.json { head :no_content }\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_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 destroy\n\t\tif Rails.env.production?\n\t\t\tRestClient.patch(\"https://lensshift-drive.firebaseio.com/resources_deleted/#{@resource_item.google_doc_id}.json\", @resource_item.to_json)\n\t\t\tRestClient.delete(\"https://lensshift-drive.firebaseio.com/resources/#{@resource_item.google_doc_id}.json\")\n\t\tend\n\t\t@resource_item.destroy\n\t respond_to do |format|\n\t format.html { redirect_to fellow_resource_items_url, notice: 'Resource item was successfully destroyed.' }\n\t format.json { head :no_content }\n\t end\n\tend", "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 = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :ok }\n end\n end", "def delete_menu_item\n @menu_item = MenuItem.find(params[:menu_item_id])\n\n MenuItem.delete_menu_item @menu_item\n\n render :json => {:success => true}.to_json\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 destroy\n @item_print = ItemPrint.find(params[:id])\n @item_print.destroy\n\n respond_to do |format|\n format.html { redirect_to item_prints_url }\n format.json { head :no_content }\n end\n end", "def delete\n item = FormTemplate.last\n id = item[:id]\n item.destroy\n render json: {id: id}\n end", "def destroy\n\t\t@item.destroy\n\t\thead :no_content\n\tend", "def destroy\n @item.destroy!\n end", "def destroy\n @item.destroy\n render json: ItemSerializer.new(@item)\n end", "def destroy\n @research_item = ResearchItem.find(params[:id])\n @research_item.destroy\n\n respond_to do |format|\n format.html { redirect_to research_items_url }\n format.json { head :ok }\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 @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(budget_items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @shared_item = SharedItem.find(params[:id])\n @shared_item.destroy\n\n respond_to do |format|\n format.html { redirect_to shared_items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @paper_type = PaperType.find(params[:id])\n @paper_type.destroy\n\n respond_to do |format|\n format.html { redirect_to paper_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @item = Item.find(params[:id])\r\n @item.destroy\r\n redirect_to items_url\r\n end" ]
[ "0.7619962", "0.7118266", "0.70054746", "0.6773249", "0.67275685", "0.6701529", "0.6701408", "0.6701408", "0.6701408", "0.6701408", "0.6701408", "0.6701408", "0.6701408", "0.6701408", "0.6701408", "0.6701408", "0.6701408", "0.6701408", "0.6701408", "0.6701408", "0.6701408", "0.6701241", "0.66981995", "0.6697242", "0.6676876", "0.66627824", "0.66602653", "0.66481215", "0.66481215", "0.66481215", "0.66481215", "0.66481215", "0.66481215", "0.66481215", "0.66481215", "0.66481215", "0.66481215", "0.66216356", "0.6615026", "0.66148216", "0.6604903", "0.66035897", "0.6595172", "0.65843904", "0.6575593", "0.6573341", "0.6573341", "0.65723574", "0.65648216", "0.65569735", "0.65538985", "0.65404516", "0.6530854", "0.6526086", "0.65253544", "0.652422", "0.6514296", "0.65108514", "0.6509154", "0.65033513", "0.6503104", "0.64986545", "0.64981186", "0.64911216", "0.64911216", "0.64911216", "0.64911216", "0.648869", "0.64853567", "0.6469098", "0.6466598", "0.6466598", "0.6466062", "0.6464204", "0.6461485", "0.6459338", "0.64567083", "0.64481074", "0.6437029", "0.6436985", "0.6425892", "0.64127016", "0.64123046", "0.6404302", "0.64031285", "0.6396092", "0.6394604", "0.63931316", "0.63847035", "0.63822556", "0.63822556", "0.63822556", "0.63822556", "0.63822556", "0.63822556", "0.638186", "0.6381148", "0.6379458", "0.63772047", "0.6375356" ]
0.73722816
1
Use callbacks to share common setup or constraints between actions.
def set_paperitem @paperitem = Paperitem.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 paperitem_params params.require(:paperitem).permit(:user_id, :paper_id, :practice_id, :score, :serial, :memo, :deleted_at) 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
The Clever Algorithms Project: (c) Copyright 2010 Jason Brownlee. Some Rights Reserved. This work is licensed under a Creative Commons AttributionNoncommercialShare Alike 2.5 Australia License.
def onemax(bitstring) sum = 0 bitstring.each_char {|x| sum+=1 if x=='1'} return sum end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def alg; end", "def ca; end", "def algorithms; end", "def algorithms; end", "def algorithms; end", "def algorithms; end", "def algorithms; end", "def cops; end", "def cops; end", "def cops; end", "def villian; end", "def king_richard_iii; end", "def celebrity; end", "def celebrity; end", "def strain; end", "def main(argv = [])\n\n # Parameters and keyway path taken from GMS MX keyway project\n width = 2.34\n height = 8.56\n epsilon = 0.1\n\n path = [\n [0.00, 0.00],\n [0.00, 0.75], [0.65, 0.75],\n [1.41, 2.48], [0.00, 2.48],\n [0.00, 5.13],\n [1.23, 5.65],\n [0.11, 6.97],\n [0.75, 8.56], [1.67, 8.56],\n [1.11, 7.00],\n [2.23, 5.70],\n [2.23, 5.38],\n [0.81, 4.83],\n [0.81, 3.29], [2.15, 3.29],\n [2.34, 2.86],\n [1.45, 0.75], [2.34, 0.75],\n [2.34, 0.00]\n ]\n\n # This is the target polygon from the path\n polygon = Polygon.new(path)\n\n # Find closest point to each corner, so we know which wall to ramp towards\n idx_bottom_left = polygon.closest_point_index(0, 0)\n idx_top_left = polygon.closest_point_index(0, height)\n idx_top_right = polygon.closest_point_index(width, height)\n idx_bottom_right = polygon.closest_point_index(width, 0)\n\n puts (<<-\"end\").gsub(/^ /, ''), ''\n // OpenSCAD chamfers() module autogenerated by #{File.basename($0)}\n // Andrew Ho (andrew@zeuscat.com)\n\n module chamfers(distance) {\n // Epsilon value for creating tiny solid segments from 2D shapes\n e = #{epsilon};\n\n // Draw polygons at start (rectangle) and end (polygon) area\n module start_polygon(points) {\n translate([0, 0, -e]) linear_extrude(e) polygon(points);\n }\n module end_polygon(points) {\n translate([0, 0, distance - e]) linear_extrude(e) polygon(points);\n }\n\n // Draw starting cube and extruded polygon\n translate([0, 0, -e]) cube([#{width}, #{height}, e]);\n linear_extrude(distance) polygon(#{polygon.to_openscad});\n end\n\n polygon.lines.each_with_index do |line, i|\n # Create epsilon-length vector, starting from midpoint, pointing inwards\n perpendicular = line.\n scale_to_length(epsilon).\n translate_to_point(line.midpoint).\n rotate(-Math::PI / 2)\n\n # Create tiny epsilon-height triangle for end polygon\n end_vertex = perpendicular.p2\n end_polygon = Polygon.new(line, end_vertex)\n\n # Create start polygon with edge points at whichever wall we ramp towards\n start_polygon = Polygon.new(line.p2, end_vertex, line.p1)\n if i >= idx_bottom_left && i < idx_top_left\n start_polygon << Point.new(0, line.y1)\n start_polygon << Point.new(0, line.y2)\n elsif i >= idx_top_left && i < idx_top_right\n start_polygon << Point.new(line.x1, height)\n start_polygon << Point.new(line.x2, height)\n elsif i >= idx_top_right && i < idx_bottom_right\n start_polygon << Point.new(width, line.y1)\n start_polygon << Point.new(width, line.y2)\n elsif i >= idx_bottom_right && i < idx_bottom_left\n start_polygon << Point.new(line.x1, 0)\n start_polygon << Point.new(line.x2, 0)\n end\n\n # Output hull of start and end polygons\n puts (<<-\"end\").gsub(/^ /, '')\n hull() {\n start_polygon(#{start_polygon.to_openscad});\n end_polygon(#{end_polygon.to_openscad});\n }\n end\n end\n\n # Finish off module definition from above\n puts '}'\n\n 0\nend", "def berlioz; end", "def celebration; end", "def schumann; end", "def getc() end", "def getc() end", "def getc() end", "def cac2\n 0\n end", "def dh; end", "def schubert; end", "def jack_handey; end", "def anchored; end", "def c\n end", "def algorithm=(_); end", "def algorithm=(_); end", "def algorithm=(_); end", "def algorithm=(_); end", "def herald; end", "def electromechanical; end", "def circuit_breaker; end", "def mitch_hedberg; end", "def leeway; end", "def leeway; end", "def alpha; end", "def challenge; end", "def jumpingOnClouds(c)\n\n\nend", "def cobasysprog\n end", "def test_ce_deBoer_2\n NArray.srand(567) # must use NArray's generator, not Ruby's\n\n # Cost matrix\n n = 5\n c = NArray[[0,1,3,5,6],\n [1,0,3,6,5],\n [3,3,0,2,2],\n [5,6,2,0,2],\n [6,5,2,2,0]]\n\n mp = CrossEntropy::MatrixProblem.new\n mp.pr = NArray.float(2, n).fill!(0.5)\n mp.pr[true,0] = NArray[0.0,1.0] # put vertex 0 in subset 1\n mp.num_samples = 50\n mp.num_elite = 5\n mp.max_iters = 10\n smooth = 0.4\n\n max_cut_score = proc do |sample|\n weight = 0\n for i in 0...n\n for j in 0...n\n weight += c[j,i] if sample[i] < sample[j]\n end\n end\n -weight # to be minimized\n end\n best_cut = NArray[1,1,0,0,0]\n assert_equal(-15, max_cut_score.call(NArray[1,0,0,0,0]))\n assert_equal(-28, max_cut_score.call(best_cut))\n\n mp.to_score_sample(&max_cut_score)\n\n mp.to_update do |pr_iter|\n smooth*pr_iter + (1 - smooth)*mp.pr\n end\n\n mp.for_stop_decision do\n #p mp.pr\n mp.num_iters >= mp.max_iters\n end\n\n mp.solve\n\n if best_cut != mp.most_likely_solution\n warn \"expected #{best_cut}; found #{mp.most_likely_solution}\" \n end\n assert mp.num_iters <= mp.max_iters\n end", "def generate_comprehensive\n\n end", "def cpl\n end", "def blg; end", "def comp\nend", "def getc()\n #This is a stub, used for indexing\n end", "def hiss; end", "def credits; end", "def compilereturn\n\n end", "def surge; end", "def constellation; end", "def cvss(data)\n\tav = data[\"av\"].downcase\n\tac = data[\"ac\"].downcase\n\tau = data[\"au\"].downcase\n\tc = data[\"c\"].downcase\n\ti = data[\"i\"].downcase\n\ta = data[\"a\"].downcase\n\te = data[\"e\"].downcase\n\trl = data[\"rl\"].downcase\n\trc = data[\"rc\"].downcase\n\tcdp = data[\"cdp\"].downcase\n\ttd = data[\"td\"].downcase\n\tcr = data[\"cr\"].downcase\n\tir = data[\"ir\"].downcase\n\tar = data[\"ar\"].downcase\n\tif ac == \"high\"\n\t cvss_ac = 0.35\n\telsif ac == \"medium\"\n\t cvss_ac = 0.61\n\telse\n\t cvss_ac = 0.71\n\tend\n\n\tif au == \"none\"\n\t cvss_au = 0.704\n\telsif au == \"single\"\n\t cvss_au = 0.56\n\telse\n\t cvss_au = 0.45\n\tend\n\n\tif av == \"local\"\n\t cvss_av = 0.395\n\telsif av == \"local network\"\n\t cvss_av = 0.646\n\telse\n\t cvss_av = 1\n\tend\n\n\tif c == \"none\"\n\t cvss_c = 0\n\telsif c == \"partial\"\n\t cvss_c = 0.275\n\telse\n\t cvss_c = 0.660\n\tend\n\n\tif i == \"none\"\n\t cvss_i = 00\n\telsif i == \"partial\"\n\t cvss_i = 0.275\n\telse\n\t cvss_i = 0.660\n\tend\n\n\tif a == \"none\"\n\t cvss_a = 0\n\telsif a == \"partial\"\n\t cvss_a = 0.275\n\telse\n\t cvss_a = 0.660\n\tend\n\n\n\t# temporal score calculations\n\tif e == \"unproven exploit exists\"\n\t cvss_e = 0.85\n\telsif e == \"proof-of-concept code\"\n\t cvss_e = 0.90\n\telsif e == \"functional exploit exists\"\n\t cvss_e = 0.95\n\telse\n\t cvss_e = 1\n\tend\n\n\tif rl == \"official fix\"\n\t cvss_rl = 0.87\n\telsif rl == \"temporary fix\"\n\t cvss_rl = 0.90\n\telsif rl == \"workaround\"\n\t cvss_rl = 0.95\n\telse\n\t cvss_rl = 1\n\tend\n\n\tif rc == \"unconfirmed\"\n\t cvss_rc = 0.90\n\telsif rc == \"uncorroborated\"\n\t cvss_rc = 0.95\n\telse\n\t cvss_rc = 1\n\tend\n\n\n\t#environemental\n\tif cdp == \"low\"\n\t cvss_cdp = 0.1\n\telsif cdp == \"low-medium\"\n\t cvss_cdp = 0.3\n\telsif cdp == \"medium-high\"\n\t cvss_cdp = 0.4\n\telsif cdp == \"high\"\n\t cvss_cdp = 0.5\n\telse\n\t cvss_cdp = 0\n\tend\n\n\tif td == \"none\"\n\t cvss_td = 0\n\telsif td == \"low\"\n\t cvss_td = 0.25\n\telsif td == \"medium\"\n\t cvss_td = 0.75\n\telse\n\t cvss_td = 1\n\tend\n\n\tif cr == \"low\"\n\t cvss_cr = 0.5\n\telsif cr == \"high\"\n\t cvss_cr = 1.51\n\telse\n\t cvss_cr = 1\n\tend\n\n\tif ir == \"low\"\n\t cvss_ir = 0.5\n\telsif ir == \"high\"\n\t cvss_ir = 1.51\n\telse\n\t cvss_ir = 1\n\tend\n\n\tif ar == \"low\"\n\t cvss_ar = 0.5\n\telsif ar == \"high\"\n\t cvss_ar = 1.51\n\telse\n\t cvss_ar = 1\n\tend\n\n\n\tcvss_impact = 10.41 * (1 - (1 - cvss_c) * (1 - cvss_i) * (1 - cvss_a))\n\tcvss_exploitability = 20 * cvss_ac * cvss_au * cvss_av\n\tif cvss_impact == 0\n\t cvss_impact_f = 0\n\telse\n\t cvss_impact_f = 1.176\n\tend\n\tcvss_base = (0.6*cvss_impact + 0.4*cvss_exploitability-1.5)*cvss_impact_f\n\n\tcvss_temporal = cvss_base * cvss_e * cvss_rl * cvss_rc\n\n\tcvss_modified_impact = [10, 10.41 * (1 - (1 - cvss_c * cvss_cr) * (1 - cvss_i * cvss_ir) * (1 - cvss_a * cvss_ar))].min\n\n\tif cvss_modified_impact == 0\n\t cvss_modified_impact_f = 0\n\telse\n\t cvss_modified_impact_f = 1.176\n\tend\n\n\tcvss_modified_base = (0.6*cvss_modified_impact + 0.4*cvss_exploitability-1.5)*cvss_modified_impact_f\n\tcvss_adjusted_temporal = cvss_modified_base * cvss_e * cvss_rl * cvss_rc\n\tcvss_environmental = (cvss_adjusted_temporal + (10 - cvss_adjusted_temporal) * cvss_cdp) * cvss_td\n\n\tif cvss_environmental\n\t cvss_total = cvss_environmental\n\telsif cvss_temporal\n\t cvss_total = cvss_temporal\n\telse\n\t cvss_total = cvss_base\n\tend\n\n\n\tdata[\"cvss_base\"] = sprintf(\"%0.1f\" % cvss_base)\n\tdata[\"cvss_impact\"] = sprintf(\"%0.1f\" % cvss_impact)\n\tdata[\"cvss_exploitability\"] = sprintf(\"%0.1f\" % cvss_exploitability)\n\tdata[\"cvss_temporal\"] = sprintf(\"%0.1f\" % cvss_temporal)\n\tdata[\"cvss_environmental\"] = sprintf(\"%0.1f\" % cvss_environmental)\n\tdata[\"cvss_modified_impact\"] = sprintf(\"%0.1f\" % cvss_modified_impact)\n\tdata[\"cvss_total\"] = sprintf(\"%0.1f\" % cvss_total)\n\n\treturn data\nend", "def pcc(*args)\n return\n end", "def hcf(i,j)\n \nend", "def analyze_component_breakdown\n\n end", "def stderrs; end", "def getc\n end", "def getc\n end", "def cvss(data)\n\tav = data[\"av2\"]\n\tac = data[\"ac2\"]\n\tau = data[\"au2\"]\n\tc = data[\"c2\"]\n\ti = data[\"i2\"]\n\ta = data[\"a2\"]\n\te = data[\"e2\"]\n\trl = data[\"rl2\"]\n\trc = data[\"rc2\"]\n\tcdp = data[\"cdp\"]\n\ttd = data[\"td\"]\n\tcr = data[\"cr2\"]\n\tir = data[\"ir2\"]\n\tar = data[\"ar2\"]\n\n\tif ac == \"High\"\n\t cvss_ac = 0.35\n\telsif ac == \"Medium\"\n\t cvss_ac = 0.61\n\telse\n\t cvss_ac = 0.71\n\tend\n\n\tif au == \"None\"\n\t cvss_au = 0.704\n\telsif au == \"Single\"\n\t cvss_au = 0.56\n\telse\n\t cvss_au = 0.45\n\tend\n\n\tif av == \"Local\"\n\t cvss_av = 0.395\n\telsif av == \"Local Network\"\n\t cvss_av = 0.646\n\telse\n\t cvss_av = 1\n\tend\n\n\tif c == \"None\"\n\t cvss_c = 0\n\telsif c == \"Partial\"\n\t cvss_c = 0.275\n\telse\n\t cvss_c = 0.660\n\tend\n\n\tif i == \"None\"\n\t cvss_i = 00\n\telsif i == \"Partial\"\n\t cvss_i = 0.275\n\telse\n\t cvss_i = 0.660\n\tend\n\n\tif a == \"None\"\n\t cvss_a = 0\n\telsif a == \"Partial\"\n\t cvss_a = 0.275\n\telse\n\t cvss_a = 0.660\n\tend\n\n\n\t# temporal score calculations\n\tif e == \"Unproven Exploit Exists\"\n\t cvss_e = 0.85\n\telsif e == \"Proof-of-Concept Code\"\n\t cvss_e = 0.90\n\telsif e == \"Functional Exploit Exists\"\n\t cvss_e = 0.95\n\telse\n\t cvss_e = 1\n\tend\n\n\tif rl == \"Official Fix\"\n\t cvss_rl = 0.87\n\telsif rl == \"Temporary Fix\"\n\t cvss_rl = 0.90\n\telsif rl == \"Workaround\"\n\t cvss_rl = 0.95\n\telse\n\t cvss_rl = 1\n\tend\n\n\tif rc == \"Unconfirmed\"\n\t cvss_rc = 0.90\n\telsif rc == \"Uncorroborated\"\n\t cvss_rc = 0.95\n\telse\n\t cvss_rc = 1\n\tend\n\n\n\t#environemental\n\tif cdp == \"Low\"\n\t cvss_cdp = 0.1\n\telsif cdp == \"Low-Medium\"\n\t cvss_cdp = 0.3\n\telsif cdp == \"Medium-High\"\n\t cvss_cdp = 0.4\n\telsif cdp == \"High\"\n\t cvss_cdp = 0.5\n\telse\n\t cvss_cdp = 0\n\tend\n\n\tif td == \"None\"\n\t cvss_td = 0\n\telsif td == \"Low\"\n\t cvss_td = 0.25\n\telsif td == \"Medium\"\n\t cvss_td = 0.75\n\telse\n\t cvss_td = 1\n\tend\n\n\tif cr == \"Low\"\n\t cvss_cr = 0.5\n\telsif cr == \"High\"\n\t cvss_cr = 1.51\n\telse\n\t cvss_cr = 1\n\tend\n\n\tif ir == \"Low\"\n\t cvss_ir = 0.5\n\telsif ir == \"High\"\n\t cvss_ir = 1.51\n\telse\n\t cvss_ir = 1\n\tend\n\n\tif ar == \"Low\"\n\t cvss_ar = 0.5\n\telsif ar == \"High\"\n\t cvss_ar = 1.51\n\telse\n\t cvss_ar = 1\n\tend\n\n\n\tcvss_impact = 10.41 * (1 - (1 - cvss_c) * (1 - cvss_i) * (1 - cvss_a))\n\tcvss_exploitability = 20 * cvss_ac * cvss_au * cvss_av\n\tif cvss_impact == 0\n\t cvss_impact_f = 0\n\telse\n\t cvss_impact_f = 1.176\n\tend\n\tcvss_base = (0.6*cvss_impact + 0.4*cvss_exploitability-1.5)*cvss_impact_f\n\n\tcvss_temporal = cvss_base * cvss_e * cvss_rl * cvss_rc\n\n\tcvss_modified_impact = [10, 10.41 * (1 - (1 - cvss_c * cvss_cr) * (1 - cvss_i * cvss_ir) * (1 - cvss_a * cvss_ar))].min\n\n\tif cvss_modified_impact == 0\n\t cvss_modified_impact_f = 0\n\telse\n\t cvss_modified_impact_f = 1.176\n\tend\n\n\tcvss_modified_base = (0.6*cvss_modified_impact + 0.4*cvss_exploitability-1.5)*cvss_modified_impact_f\n\tcvss_adjusted_temporal = cvss_modified_base * cvss_e * cvss_rl * cvss_rc\n\tcvss_environmental = (cvss_adjusted_temporal + (10 - cvss_adjusted_temporal) * cvss_cdp) * cvss_td\n\n\tif cvss_environmental\n\t cvss_total = cvss_environmental\n\telsif cvss_temporal\n\t cvss_total = cvss_temporal\n\telse\n\t cvss_total = cvss_base\n\tend\n\n#if cvss_total == 0\n#data[\"risk_cvss_v2\"]=0\n##data[\"risk\"]=0\n\n#elsif (cvss_total >= 0.1 and cvss_total <= 3.9)\n#data[\"risk_cvss_v2\"]=1\n#data[\"risk\"]=1\n\n#elsif (cvss_total >= 4.0 and cvss_total <= 6.9)\n#data[\"risk_cvss_v2\"]=2\n#data[\"risk\"]=2\n\n#elsif (cvss_total >= 7.0 and cvss_total <= 8.9)\n#data[\"risk_cvss_v2\"]=3\n#data[\"risk\"]=3\n\n#else\n#data[\"risk_cvss_v2\"]=4\n#data[\"risk\"]=4\n#end\n\n data[\"risk_cvss_v2\"]=data[\"risk\"]\n\n\tdata[\"cvss_base2\"] = sprintf(\"%0.1f\" % cvss_base)\n\tdata[\"cvss_impact2\"] = sprintf(\"%0.1f\" % cvss_impact)\n\tdata[\"cvss_exploitability2\"] = sprintf(\"%0.1f\" % cvss_exploitability)\n\tdata[\"cvss_temporal2\"] = sprintf(\"%0.1f\" % cvss_temporal)\n\tdata[\"cvss_environmental2\"] = sprintf(\"%0.1f\" % cvss_environmental)\n\tdata[\"cvss_modified_impact2\"] = sprintf(\"%0.1f\" % cvss_modified_impact)\n\tdata[\"cvss_total2\"] = sprintf(\"%0.1f\" % cvss_total)\n\n\treturn data\nend", "def main; end", "def feruchemist; end", "def star_cluster; end", "def bellini; end", "def hiddens; end", "def cp_c\n end", "def private; end", "def gounod; end", "def cc\n preorder, postorder, visited, cc, ccs = [], [], [], [], []\n @count = 0\n id = {}\n adj_lists.each do |v|\n if !visited.include?(v.name)\n dfs_visit(v.name, adj_lists, id, visited, preorder, postorder)\n @count += 1\n puts \"***Back in cc method***\\n\"\n end\n end\n\n puts \"id = #{id}\\n\\n\"\n\n (0..id.values.last).each do |i|\n id.each do |vertex, component|\n cc << vertex if i == component\n end\n ccs << cc.sort if cc != []\n cc = []\n end\n print \"ccs: #{ccs}\\n\\n\"\n ccs\n end", "def standard_cost_code; end", "def sub_c\n end", "def prepare_preferred_algorithms!; end", "def cardinal; end", "def silly_adjective; end", "def scientist; end", "def wagner; end", "def ccf\n end", "def minimize; end", "def internship_passed; end", "def bizet; end", "def superweening_adorningly(counterstand_pyrenomycetales)\n end", "def terpene; end", "def england\n end", "def arc_test_2(mill = nil)\r\n# - - - - - - - - - - - - - - - - - - - -\r\n #############\r\n ### ARC TEST #1\r\n #############\r\n if (mill == nil)\r\n mill = CNCMill.new\r\n mill.job_start()\r\n mill.home()\r\n end #if\r\n\r\n cx = 3\r\n cy = 2.5\r\n seg_beg_min_radius = 1.0\r\n seg_beg_max_radius = 1.1\r\n seg_end_min_radius = 0.9\r\n seg_end_max_radius = 2.4\r\n beg_angle = 230\r\n end_angle = beg_angle + 80\r\n degree_inc = 3\r\n depth = -1.5\r\n\r\n\r\n aRes = arc_pocket_adv(mill, cx,cy,\r\n seg_beg_min_radius, \r\n seg_beg_max_radius,\r\n beg_angle,\r\n seg_end_min_radius, \r\n seg_end_max_radius,\r\n end_angle, \r\n depth,\r\n degree_inc)\r\n\t\t \r\n return aRes\r\nend", "def guct\n end", "def verdi; end", "def main\n\n # Print the heading. Note the highly advanced lower-case letters.\n puts ' '*33 + \"Bunny\"\n puts ' '*15 + \"Creative Computing Morristown, New Jersey\"\n\n # Print blank lines.\n print \"\\n\\n\\n\"\n\n # The positions to write; this is ripped from the BASIC program's\n # DATA statements.\n positions = [\n 1,2,-1,0,2,45,50,-1,0,5,43,52,-1,0,7,41,52,-1, \n 1,9,37,50,-1,2,11,36,50,-1,3,13,34,49,-1,4,14,32,48,-1,\n 5,15,31,47,-1,6,16,30,45,-1,7,17,29,44,-1,8,19,28,43,-1,\n 9,20,27,41,-1,10,21,26,40,-1,11,22,25,38,-1,12,22,24,36,-1,\n 13,34,-1,14,33,-1,15,31,-1,17,29,-1,18,27,-1,\n 19,26,-1,16,28,-1,13,30,-1,11,31,-1,10,32,-1,\n 8,33,-1,7,34,-1,6,13,16,34,-1,5,12,16,35,-1,\n 4,12,16,35,-1,3,12,15,35,-1,2,35,-1,1,35,-1,\n 2,34,-1,3,34,-1,4,33,-1,6,33,-1,10,32,34,34,-1,\n 14,17,19,25,28,31,35,35,-1,15,19,23,30,36,36,-1,\n 14,18,21,21,24,30,37,37,-1,13,18,23,29,33,38,-1,\n 12,29,31,33,-1,11,13,17,17,19,19,22,22,24,31,-1,\n 10,11,17,18,22,22,24,24,29,29,-1,\n 22,23,26,29,-1,27,29,-1,28,29,-1,\n ]\n\n # The text we're writing.\n text = \"BUNNY\"\n\n # Draw the bunny.\n last_pos = 0\n while positions.size > 0\n first = positions.shift\n\n # If we've found -1, start a new line\n if first == -1\n puts\n last_pos = 0\n next\n end \n\n # Advance to start of the range\n print ' '*(first - last_pos)\n last_pos = first\n\n # Now, draw pixels:\n second = positions.shift\n for i in first .. second\n print text[i % text.size] # choose the letter according to the column\n last_pos += 1\n end\n end\n\n # Print the final blank line\n puts\nend", "def cp_l\n end", "def algorithms=(_arg0); end", "def algorithms=(_arg0); end", "def sweep; end", "def weber; end", "def cvss3(data)\n\tav = data[\"av\"]\n\tac = data[\"ac\"]\n\tpr = data[\"pr\"]\n\tui = data[\"ui\"]\n\tc = data[\"c\"]\n\ti = data[\"i\"]\n\ta = data[\"a\"]\n\ts = data[\"s\"]\n\te = data[\"e\"]\n\trl = data[\"rl\"]\n\trc = data[\"rc\"]\n\t#CVSS3\n\tmav = data[\"mav\"]\n\tmac = data[\"mac\"]\n\tmpr = data[\"mpr\"]\n\tmui = data[\"mui\"]\n\tms = data[\"ms\"]\n\tmc = data[\"mc\"]\n\tmi = data[\"mi\"]\n\tma = data[\"ma\"]\n\tcr = data[\"cr\"]\n\tir = data[\"ir\"]\n\tar = data[\"ar\"]\n\n\n if av == \"Local\"\n\t cvss_av = 0.55\n\telsif av == \"Adjacent Network\"\n\t cvss_av = 0.62\n\telsif av == \"Network\"\n\t cvss_av = 0.85\n\telsif av == \"Physical\"\n\t cvss_av = 0.2\n\tend\n\n\tif ac == \"High\"\n\t cvss_ac = 0.44\n\telsif ac == \"Low\"\n\t cvss_ac = 0.77\n\tend\n\n\tif pr == \"None\"\n\t cvss_pr = 0.85\n\telsif pr == \"Low\" and s == \"Unchanged\"\n\t cvss_pr = 0.62\n elsif pr == \"Low\" and s == \"Changed\"\n\t cvss_pr = 0.68\n\telsif pr == \"High\" and s == \"Unchanged\"\n\t cvss_pr = 0.27\n elsif pr == \"High\" and s == \"Changed\"\n\t cvss_pr = 0.5\n\tend\n\n\tif ui == \"None\"\n\t cvss_ui = 0.85\n\telsif ui == \"Required\"\n\t cvss_ui = 0.62\n\tend\n\n\tif c == \"None\"\n\t cvss_c = 0\n\telsif c == \"Low\"\n\t cvss_c = 0.22\n\telsif c == \"High\"\n\t cvss_c = 0.56\n\tend\n\n\tif i == \"None\"\n\t cvss_i = 0\n\telsif i == \"Low\"\n\t cvss_i = 0.22\n\telsif i == \"High\"\n\t cvss_i = 0.56\n\tend\n\n\tif a == \"None\"\n\t cvss_a = 0\n\telsif a == \"Low\"\n\t cvss_a = 0.22\n\telsif a == \"High\"\n\t cvss_a = 0.56\n\tend\n\n\n\t# temporal score calculations\n\tif e == \"Unproven Exploit Exists\"\n\t cvss_e = 0.91\n\telsif e == \"Proof-of-Concept Code\"\n\t cvss_e = 0.94\n\telsif e == \"Functional Exploit Exists\"\n\t cvss_e = 0.97\n\telse\n\t cvss_e = 1\n\tend\n\n\tif rl == \"Official Fix\"\n\t cvss_rl = 0.95\n\telsif rl == \"Temporary Fix\"\n\t cvss_rl = 0.96\n\telsif rl == \"Workaround\"\n\t cvss_rl = 0.97\n\telse\n\t cvss_rl = 1\n\tend\n\n\tif rc == \"Unknown\"\n\t cvss_rc = 0.92\n\telsif rc == \"Reasonable\"\n\t cvss_rc = 0.96\n\telse\n\t cvss_rc = 1\n\tend\n\n\n\t#environemental\n\n\tif ms == \"Not Defined\"\n\t\t ms = s\n\tend\n\n\tif mav == \"Local\"\n\t cvss_mav = 0.55\n\telsif mav == \"Adjacent Network\"\n\t cvss_mav = 0.62\n\telsif mav == \"Network\"\n\t cvss_mav = 0.85\n\telsif mav == \"Physical\"\n\t cvss_mav = 0.2\n\telsif mav == \"Not Defined\"\n\t\t\tcvss_mav = cvss_av\n\tend\n\n\tif mac == \"High\"\n\t cvss_mac = 0.44\n elsif mac == \"Low\"\n\t\t\tcvss_mac = 0.77\n\telsif mac == \"Not Defined\"\n\t cvss_mac = cvss_ac\n\tend\n\n\tif mpr == \"None\"\n\t cvss_mpr = 0.85\n\telsif mpr == \"Low\" and ms == \"Unchanged\"\n\t cvss_mpr = 0.62\n elsif mpr == \"Low\" and ms == \"Changed\"\n\t cvss_mpr = 0.68\n\telsif mpr == \"High\" and ms == \"Unchanged\"\n\t cvss_mpr = 0.27\n elsif mpr == \"High\" and ms == \"Changed\"\n\t cvss_mpr = 0.5\n\telsif mpr == \"Not Defined\"\n\t\tcvss_mpr = cvss_pr\n\tend\n\n\tif mui == \"None\"\n\t cvss_mui = 0.85\n elsif mui == \"Required\"\n\t\t cvss_mui = 0.62\n\telsif mui == \"Not Defined\"\n\t cvss_mui = cvss_ui\n\tend\n\n\n\tif mc == \"None\"\n\t cvss_mc = 0\n\telsif mc == \"Low\"\n\t cvss_mc = 0.22\n\telsif mc == \"Low\"\n\t\t cvss_mc = 0.56\n\telsif mc == \"Not Defined\"\n\t cvss_mc = cvss_c\n\tend\n\n\tif mi == \"None\"\n\t cvss_mi = 00\n\telsif mi == \"Low\"\n\t cvss_mi = 0.22\n\telsif mi == \"High\"\n\t\t cvss_mi = 0.56\n\telsif mi == \"Not Defined\"\n\t cvss_mi = cvss_i\n\tend\n\n\tif ma == \"None\"\n\t cvss_ma = 0\n\telsif ma == \"Low\"\n\t cvss_ma = 0.22\n\telsif ma == \"High\"\n\t\t\tcvss_ma = 0.56\n\telsif ma == \"Not Defined\"\n\t cvss_ma = cvss_a\n\tend\n\n\n\n\tif cr == \"Low\"\n\t cvss_cr = 0.5\n\telsif cr == \"High\"\n\t cvss_cr = 1.50\n\telse\n\t cvss_cr = 1\n\tend\n\n\tif ir == \"Low\"\n\t cvss_ir = 0.5\n\telsif ir == \"High\"\n\t cvss_ir = 1.50\n\telse\n\t cvss_ir = 1\n\tend\n\n\tif ar == \"Low\"\n\t cvss_ar = 0.5\n\telsif ar == \"High\"\n\t cvss_ar = 1.50\n\telse\n\t cvss_ar = 1\n\tend\n\n\t# Score de Base\n\tcvss_impact_base = (1 - (1 - cvss_c) * (1 - cvss_i) * (1 - cvss_a))\n\tcvss_exploitability = 8.22 * cvss_ac * cvss_pr * cvss_av * cvss_ui\n\t# ici voir si la puissance 15 est correcte\n\tif s == \"Unchanged\"\n\t\tcvss_impact = 6.42 * cvss_impact_base\n\telse\n\t\tcvss_impact = 7.52 * (cvss_impact_base - 0.029) - 3.25 * ((cvss_impact_base - 0.02)**15)\n\tend\n\n\tif cvss_impact <= 0\n\t cvss_base = 0.0\n\telsif s == \"Unchanged\"\n\t\t\t#la fonction ceil2 = RoundUp\n\t cvss_base = ([(cvss_impact + cvss_exploitability),10].min).ceil2(1)\n\telsif s == \"Changed\"\n\t cvss_base = ([(1.08*(cvss_impact + cvss_exploitability)),10].min).ceil2(1)\n\tend\n\n\t# Score temporel\n\tcvss_temporal = (cvss_base * cvss_e * cvss_rl * cvss_rc).ceil2(1)\n\n\t#Score enviromental\n\tcvss_impact_modified = [(1 - (1 - cvss_mc*cvss_cr) * (1 - cvss_mi*cvss_ir) * (1 - cvss_ma*cvss_ar)),0.915].min\n\tcvss_modified_exploitability = 8.22 * cvss_mac * cvss_mpr * cvss_mav * cvss_mui\n\n\tif ms == \"Unchanged\"\n\t\tcvss_modified_impact = 6.42 * cvss_impact_modified\n\telsif ms == \"Changed\"\n\t\tcvss_modified_impact = 7.52 * (cvss_impact_modified - 0.029) - 3.25 * ((cvss_impact_modified - 0.02)**15)\n\tend\n\n\n\tif cvss_modified_impact <= 0\n\t cvss_environmental = 0.0\n\telsif ms == \"Changed\"\n\t cvss_environmental = (([1.08*(cvss_modified_impact + cvss_modified_exploitability),10].min).ceil2(1) * cvss_rl * cvss_rc * cvss_e).ceil2(1)\n\telsif ms == \"Unchanged\"\n\t cvss_environmental = (([(cvss_modified_impact + cvss_modified_exploitability),10].min).ceil2(1) * cvss_rl * cvss_rc * cvss_e).ceil2(1)\n\tend\n\n\t#choix du score total\n\tif cvss_environmental\n\t cvss_total = cvss_environmental\n\telsif cvss_temporal\n\t cvss_total = cvss_temporal\n\telse\n\t cvss_total = cvss_base\n\tend\n\n if cvss_total == 0\n data[\"risk_cvss_v3\"]=0\n #data[\"risk\"]=0\n\n elsif (cvss_total >= 0.1 and cvss_total <= 3.9)\n data[\"risk_cvss_v3\"]=1\n #data[\"risk\"]=1\n\n elsif (cvss_total >= 4.0 and cvss_total <= 6.9)\n data[\"risk_cvss_v3\"]=2\n #data[\"risk\"]=2\n\n elsif (cvss_total >= 7.0 and cvss_total <= 8.9)\n data[\"risk_cvss_v3\"]=3\n #data[\"risk\"]=3\n\n else\n data[\"risk_cvss_v3\"]=4\n #data[\"risk\"]=4\n end\n\n\tdata[\"cvss_base\"] = sprintf(\"%0.1f\" % cvss_base)\n\t#data[\"cvss_base\"] = sprintf(\"%0.3f\" % cvss_base)\n\tdata[\"cvss_impact\"] = sprintf(\"%0.1f\" % cvss_impact)\n\tdata[\"cvss_exploitability\"] = sprintf(\"%0.1f\" % cvss_exploitability)\n\tdata[\"cvss_temporal\"] = sprintf(\"%0.1f\" % cvss_temporal)\n\tdata[\"cvss_environmental\"] = sprintf(\"%0.1f\" % cvss_environmental)\n\tdata[\"cvss_modified_impact\"] = sprintf(\"%0.1f\" % cvss_modified_impact)\n\tdata[\"cvss_total\"] = sprintf(\"%0.1f\" % cvss_total)\n\n\treturn data\nend", "def probers; end", "def lcs_phase_two(arr)\n return arr.max if arr.max < 0 #edge case\n\n current = 0\n largest = 0\n\n arr.each do |ele|\n current += ele\n current = 0 if current < 0 #bookmark\n largest = current if largest < current\n end\n\n largest\nend", "def intensifier; end", "def spouse; end", "def isp; end", "def isp; end", "def coolingtower\n\n end" ]
[ "0.6706549", "0.6273459", "0.6248101", "0.6248101", "0.6248101", "0.6248101", "0.6248101", "0.61685634", "0.61685634", "0.61685634", "0.60687137", "0.59263885", "0.59144986", "0.59144986", "0.58673203", "0.5854937", "0.5835647", "0.5833234", "0.5790324", "0.57768756", "0.57768756", "0.57768756", "0.5772846", "0.5758787", "0.5758487", "0.5755166", "0.5720292", "0.5717159", "0.5711552", "0.5711552", "0.5711552", "0.5711552", "0.57110286", "0.56877655", "0.5661126", "0.561227", "0.5611567", "0.5611567", "0.5605795", "0.5591918", "0.55890375", "0.5581183", "0.5579582", "0.5558001", "0.55270535", "0.55250025", "0.5520504", "0.54756373", "0.54711413", "0.5451141", "0.54491746", "0.5424113", "0.541514", "0.53686523", "0.5368336", "0.5363127", "0.53606474", "0.53578043", "0.5353208", "0.5353208", "0.5348292", "0.53437304", "0.5337975", "0.5320845", "0.5320358", "0.53158426", "0.53130895", "0.5307113", "0.5304469", "0.528451", "0.52665955", "0.5262479", "0.52548665", "0.52327496", "0.5232534", "0.52269804", "0.52268827", "0.5223773", "0.5223379", "0.5221038", "0.5217385", "0.52144086", "0.5210971", "0.5199312", "0.5175343", "0.5173885", "0.5170208", "0.51692325", "0.51689994", "0.51679486", "0.51679486", "0.51653844", "0.5158325", "0.51562244", "0.51514786", "0.5149187", "0.51459324", "0.51423764", "0.5132313", "0.5132313", "0.51322794" ]
0.0
-1
VIEW HELPERS. Return a link with the "http(s)://( prefix stripped away.
def website_link return unless website? @website_link ||= website.split("//")[1].sub(/^www\./, "") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def link() url; end", "def link() url; end", "def linkify(str)\n\t\t\tstr.gsub( %r{http://[^\"\\s]+} ) do |url|\n\t\t\t\tshort = url.gsub(%r{^.*#{Regexp.quote(request.host_with_port)}}, '')\n \t\t\"<a href='#{url}'>#{short}</a>\"\n\t\t\tend\n\tend", "def link\n @link ||= uri.to_s\n end", "def reformat_link\n reg = /^https?:\\/\\//\n link = self.link\n if link.present? && !link.match(reg)\n link.insert(0,\"http://\")\n end\n self.link = link\n end", "def fixup_url\n unless @view.app.url.starts_with?('http')\n unless @view.app.url.starts_with?('www')\n @view.app.url = 'www.' << @view.app.url\n end\n @view.app.url = 'http://' << @view.app.url\n end\n @view.app.url\n end", "def human_url\n return self.alternate_link\n end", "def link_helper(url)\n # set up another variable for the link\n link = url\n\n # add http if missing from url\n if !url.include?(\"http://\") && !url.include?(\"https://\")\n url = \"http://\" + url\n end\n\n # strip out http/https from link\n if link.include?(\"http://\") || link.include?(\"https://\")\n link = link.split(\"://\")[1]\n end\n\n # strip out the www from the link\n link = link.split(\"www.\")[1] if link.include?(\"www.\")\n\n # remove trailing slash\n link = link[0..(link.length - 2)] if link[link.length - 1].eql?(\"/\")\n\n # return a link_to with the final link and url\n link_to(link, url)\n end", "def link\n '-'\n end", "def full_url display_url\n if display_url.blank?\n return nil\n end\n return (display_url[0..6] == \"http://\" or display_url[0..7] == \"https://\") ? display_url : \"http://#{display_url}\"\n end", "def get_hyperlink(row)\n URI.join(native_host, row.dig('uri')).to_s\n end", "def url\n u = read_attribute(:url)\n u !~ /\\Ahttp/i ? \"http://#{u}\" : u\n end", "def url(link)\n '#'\n end", "def text_url\n link_uri\n end", "def link\n Html::Link.new(:href => url) << display_name\n end", "def sexy(body)\n body.gsub(URL_MATCHER, link_to(\"http://\\\\2\", \"http://\\\\2\", :target => \"_blank\"))\n end", "def gen_url(url, text)\n if url =~ /([A-Za-z]+):(.*)/ then\n type = $1\n path = $2\n else\n type = \"http\"\n path = url\n url = \"http://#{url}\"\n end\n\n if type == \"link\" then\n url = if path[0, 1] == '#' then # is this meaningful?\n path\n else\n self.class.gen_relative_url @from_path, path\n end\n end\n\n if (type == \"http\" or type == \"link\") and\n url =~ /\\.(gif|png|jpg|jpeg|bmp)$/ then\n \"<img src=\\\"#{url}\\\" />\"\n else\n \"<a href=\\\"#{url}\\\">#{text.sub(%r{^#{type}:/*}, '')}</a>\"\n end\n end", "def href; end", "def make_links(html, **opt)\n opt[:rel] ||= 'noreferrer'\n opt[:target] ||= '_blank' unless params[:action] == 'v2'\n html.to_s.gsub(%r{&quot;https?://.+&quot;}) do |s|\n url = href = s.split('&quot;')[1].html_safe\n url = make_link(url, href, **opt) if href.present?\n \"&quot;#{url}&quot;\"\n end\n end", "def _url\n return @link['href'] unless _templated?\n\n @url ||= _uri_template.expand(@uri_variables || {}).to_s\n end", "def link uri\n self.apply_hyperlink java.net.URI.new(uri)\n end", "def link_urls(tweet)\n tweet.gsub(/([A-Z]+:\\/\\/[^\\s]+)/i, '<a href=\"\\1\">\\1</a>')\n end", "def click_through_link\n\t\treturn '/items/' + self.items.first.slug if !self.items.first.blank?\n\t\treturn '/blog/' + self.blogs.first.slug if !self.blogs.first.blank?\n\t\treturn \"#\"\n\tend", "def to_link\n \"<a href=\\\"#{self.url}\\\">#{self.name}</a>\"\n end", "def to_link(text)\n URI::encode(@base_url + text.strip.gsub(/\\s+/, @space_replacement))\n end", "def plain_url\n\t\t# same as above\n\t\tRails.application.routes.url_helpers.plain_fyle_url(id: self.id.to_s.rjust(3, \"0\"), format: 'txt')\n\tend", "def nice_url\n\t\t# i want to take thr url and remove http:// and www.\n\t\t# gsub is global subsitution\n\t\turl.gsub(\"http://\", \"\").gsub(\"www.\", \"\")\n\tend", "def url() \n\t #'http://' << ENV['DOMAIN'] << \n\t '/' << self.author.username.to_s << '/' << self.name.to_s\n end", "def gen_url url, text\n scheme, url, id = parse_url url\n\n if %w[http https link].include?(scheme) and\n url =~ /\\.(gif|png|jpg|jpeg|bmp)$/ then\n \"<img src=\\\"#{url}\\\" />\"\n else\n if scheme != 'link' and %r%\\A((?!https?:)(?:[^/#]*/)*+)([^/#]+)\\.(rb|rdoc|md)(?=\\z|#)%i =~ url\n url = \"#$1#{$2.tr('.', '_')}_#$3.html#$'\"\n end\n\n text = text.sub %r%^#{scheme}:/*%i, ''\n text = text.sub %r%^[*\\^](\\d+)$%, '\\1'\n\n link = \"<a#{id} href=\\\"#{url}\\\">#{text}</a>\"\n\n link = \"<sup>#{link}</sup>\" if /\"foot/ =~ id\n\n link\n end\n end", "def view_url(url='', max_size=30)\n rexp = /(http|https):\\/\\/[a-z0-9]+([\\-\\.]{1}[a-z0-9]+)*/ix\n\n if rexp.match(url)\n link_to h(url.etc max_size), url, :title => \"Go to #{url}\", :popup => true\n else\n content_tag :span, :title => \"#{url}\" do\n url.etc max_size\n end\n end\n end", "def unlink(text)\n return text.html_safe if text =~ /<a / # They already linked it.\n text.gsub(URI::ABS_URI) { |match|\n if match.size < 20\n \"<a href=\\\"#{match}\\\">#{match}</a>\"\n else\n host = URI::parse(match).host\n \"<a href=\\\"#{match}\\\">#{host}</a>\"\n end\n }.html_safe\n end", "def format_url\n self.url.chomp\n if self.url.match(\"https://\") || self.url.match(\"http://\")\n else self.url = \"http://\" + url\n end\n self.url\n end", "def link\n \"<a href='http://www.mailgun.com/'>Mailgun</a>\"\n end", "def gen_url url, text\n if url =~ /^rdoc-label:([^:]*)(?::(.*))?/ then\n type = \"link\"\n elsif url =~ /([A-Za-z]+):(.*)/ then\n type = $1\n else\n type = \"http\"\n end\n\n if (type == \"http\" or type == \"https\" or type == \"link\") and\n url =~ /\\.(gif|png|jpg|jpeg|bmp)$/ then\n ''\n else\n text.sub(%r%^#{type}:/*%, '')\n end\n end", "def url\n ''\n end", "def short_url\n return nil if url.nil?\n url.gsub(\"http://\",\"\").gsub(\"www.\", \"\")\n end", "def url_for_link( project, opts )\n if (opts[:link])\n (opts[:link] =~ /^(https?:\\/\\/|\\/)/i) ? opts[:link] : url_for_page( project, opts.update(:page_name => opts[:link]) )\n end\n end", "def url(href)\n a href, :href => href\n end", "def urls_to_links(s)\n urls = /((https?:\\/\\/|www\\.)([-\\w\\.]+)+(:\\d+)?(\\/([\\w\\/_#:\\.\\-\\%]*(\\?\\S+)?)?)?)/\n s.gsub(urls) {\n url = text = $1\n url = \"http://#{url}\" if $2 == 'www.'\n if $1[-1..-1] == '.'\n url = url.chop\n text = text.chop\n '<a rel=\"nofollow\" href=\"'+url+'\">'+text+'</a>.'\n else\n '<a rel=\"nofollow\" href=\"'+url+'\">'+text+'</a>'\n end\n }\nend", "def link_markup(descr = nil)\n descr = \"View resource.\" if descr == nil\n\n link = @reference_action_def.doi\n link = @reference_action_def.link if link.empty?\n return \"<a href=\\\"#{link}\\\" target=\\\"_blank\\\">#{descr}</a>\"\n end", "def ensure_http_link\t\t\n\t\tself.link = \"http://\" + self.link if !self.link.nil? and !self.link.start_with?(\"http://\")\n\tend", "def format_website\n if self.website.present? and self.website !~ /^http/i\n self.website = \"http://#{self.website}\"\n end\n end", "def url\n if links.alternate\n links.alternate.href\n elsif links.self\n links.self.href\n else\n links.map.each do |l|\n l.href\n end.compact.first\n end\n end", "def html_link(item)\n tag :a, yield, :href => item.url\n end", "def link(link, title, content)\n link = OodAppkit.files.api(path: @app_path.to_s + '/' + link).to_s if @app_path && relative?(link)\n return \"<a href=\\\"#{link}\\\" rel=\\\"noopener\\\" target=\\\"_blank\\\">#{content}</a>\" unless id_link?(link)\n return \"<a href=\\\"#{link}\\\">#{content}</a>\"\n end", "def url\n \t@url.to_s\n end", "def href\n super || '#'\n end", "def relative_link(link)\n # REMEMBER TO ADD ROUTES TO HANDLE THESE LINKS\n link.gsub!(@base, \"\").gsub!(\".html\", \"\").gsub!(\"-\", \"_\")\n end", "def add_http_to_url\n if !self.website_url.blank?\n unless self.website_url[/\\Ahttp:\\/\\//] || self.website_url[/\\Ahttps:\\/\\//]\n self.website_url = \"http://#{self.website_url}\"\n end\n end\n end", "def web_link\n return @web_link\n end", "def hyperlink\n @hyperlink_rel ? @hyperlink_rel.target : ''\n end", "def url\n \"http://#{self.cms_site.hostname}#{self.full_path}\"\n end", "def get_viewer_link(urn,access_token)\n #absolute url = request.base_url\n url = \"/viewer1.html?token=#{access_token}&urn=#{urn}\"\n link = \"<a href=\\\"#{url}\\\" target=\\\"_blank\\\">View Model</a>\"\n return link\n end", "def to_s; @url; end", "def link_to_external url ,link_label\n link_to \"#{link_label}\" ,\"#{url}\" , :target=>'_blank'\n end", "def turn_bare_urls_into_links(str)\n Rinku.auto_link(str) do |text|\n \"<i class=\\\"fa fa-external-link\\\" aria-hidden=\\\"true\\\"></i>&nbsp;#{text}\"\n end\n end", "def to_s\n url\n end", "def link(link, title, content)\n\t \"<u><link href='#{link}'>#{content}</link></u>\"\n\t end", "def fullurl\n if Rails.env == 'development'\n 'http://localhost:3000' + object.url.to_s\n else\n 'http://signlab-rails.herokuapp.com' + object.url.to_s\n end\n end", "def link aUrl, aName = nil, aTitle = nil\n aName ||= aUrl\n %{<a href=\"#{aUrl}\"#{%{ title=\"#{aTitle}\"} if aTitle}>#{aName}</a>}\n end", "def urls_to_links(s)\n urls = /((https?:\\/\\/|www\\.)([-\\w\\.]+)+(:\\d+)?(\\/([\\w\\/_\\.\\-\\%]*(\\?\\S+)?)?)?)/\n s.gsub(urls) {\n if $1[-1..-1] == '.'\n url = $1.chop\n '<a href=\"'+url+'\">'+url+'</a>.'\n else\n '<a href=\"'+$1+'\">'+$1+'</a>'\n end\n }\n end", "def url_with_prefix\n\t\t( url.blank? ) ? '' :\n\t\t\t( url.match(/^http(s)?:\\/\\//) ? url : \"http://#{url}\" )\n\tend", "def full_url\n if website.match(/[A-Za-z]:\\/\\//)\n website\n else\n \"http://#{website}\"\n end\n end", "def nice_url\n if homepage\n if Addressable::URI.parse(homepage)\n Addressable::URI.parse(homepage).host\n else\n homepage.first(15)\n end\n else\n \"\"\n end\n end", "def nice_url\n if homepage\n if Addressable::URI.parse(homepage)\n Addressable::URI.parse(homepage).host\n else\n homepage.first(15)\n end\n else\n \"\"\n end\n end", "def link(opts)\n \"#{opts[:name]} !LINK_OPEN_TAG!#{opts[:href]}!LINK_CLOSE_TAG!\"\n end", "def link\n # => slug_link(self.name)\n if self.weiterleitung && self.externer_link && !self.externer_link.blank?\n self.externer_link\n elsif self.verteiler\n '#'\n else\n if self.ueber_seite\n full_slug.to_slash\n else\n slug.to_slash\n end\n end\n end", "def href\n href = (@url || @dos).to_s.dup\n if @fragment\n href << client('#', 'UTF-8') << @fragment\n end\n href\n end", "def pretty_url\n Iconv.iconv(\"ASCII//IGNORE//TRANSLIT\", \"UTF-8\", self).join.sanitize\n rescue\n self.sanitize\n end", "def link(url, title) # :nodoc:\n \"[#{title}](#{url})\"\n end", "def to_s\n \"#<\" + self.class.name + \": \" + href + \">\"\n end", "def convert_urls_to_links(text)\n # url = /(((file|gopher|news|nntp|telnet|http|ftp|https|ftps|sftp):\\/\\/)|(www\\.))+(([a-zA-Z0-9\\._-]+\\.[a-zA-Z]{2,6})|([0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}))(\\/[a-zA-Z0-9\\&amp;%_\\.\\/-~-]*)?/\n # url = /( |^)http:\\/\\/([^\\s]*\\.[^\\s]*)( |$)/\n\n # while text =~ url\n # name = $2\n # text.sub! /( |^)http:\\/\\/#{name}( |$)/, \" <a href='http://#{name}' >#{name}</a> \"\n # end\n\n Rinku.auto_link(text)\n end", "def pdef_replace_link(txt)\n # NOTE: it works with only link\n link_url = nil\n str_after = ''\n str_before = ''\n aa = txt.split('link:')\n if aa.size == 2\n aa[1].lstrip!\n bb = aa[1].index(/[\\)\\, ]/)\n link_url = aa[1][0..bb - 1]\n str_after = aa[1][bb..-1]\n str_before = aa[0]\n end\n\n if link_url\n str_link = \"<c:alink uri=\\\"#{link_url}\\\">#{link_url.gsub(\"http://\", \"\")}</c:alink>\"\n str_res = str_before + str_link + str_after\n else\n return txt\n end\n end", "def format_url(url)\n url.gsub(%r{^(https?:\\/\\/)}, '')\n end", "def formatted_link\n host = ENV['HEROKU_APP_NAME'] ? \"#{ENV['HEROKU_APP_NAME']}.herokuapp.com\" : 'localhost:3000'\n \"<#{Rails.application.routes.url_helpers.thread_url(id, host: host, format: :json)}|this thread>\"\n end", "def to_s\n \"#{self.class}#url: #{url}\"\n end", "def uri\n \"http://example.com#{base_path}#{anchor}\"\n end", "def url_for(page)\n base_url_for(\"#{model.link}/#{page}\")\n end", "def display_link\n link.sub(SCHEME_PATTERN, '').truncate(48) if link\n end", "def link_to(title, path, opts={}, base=true)\n unless is_uri?(path) || base == false\n path = url(path)\n end\n \n return \"<a href=\\\"#{path}\\\"#{parse_options(opts)}>#{title}</a>\"\n end", "def linkify(text)\n text.gsub(URL_REGEXP, '<a href=\"\\0\">\\0</a>') rescue text\n end", "def handle_special_HYPERLINK(special)\n url = special.text\n gen_url url, url\n end", "def link_to_url\n return redirect_url unless redirect_url.blank?\n path\n end", "def link_to_book(book)\n # If a custom domain hasn't been specified, return the default github pages url.\n if book.domain.nil? || book.domain.empty?\n get_github_pages_url(book)\n else\n # A custom domain has been specified.\n return 'http://' + Rack::Utils.escape_html(book.domain)\n end\n end", "def original_url; end", "def link(target)\n File.join(site.url, target)\n end", "def short_url\n \"http://redd.it/#{self[:id]}\"\n end", "def linkify(options = {})\n url = options[:value].first\n link_to url, url\n end", "def prepend_http_to_url\n self.url = \"http://#{url}\" unless url.blank? || url.starts_with?('http://') || url.starts_with?('https://')\n end", "def link_to(name, url, options = {}); end", "def link(link, title, content)\n if no_links\n content\n else\n # \"<a href=\\\"#{DashboardRouter.normalize(link)}\\\" target=\\\"_top\\\">#{content}</a>\"\n \"<a href=\\\"#{link}\\\">#{content}</a>\"\n end\n end", "def strip_blanks\n self.link = self.link.strip\n end", "def clean_destination_url\n if !self.url.blank? and self.url !~ REGEX_LINK_HAS_PROTOCOL\n self.url.insert(0, URL_PROTOCOL_HTTP)\n end\n end", "def url_preview\n parsed_url = Domainatrix.parse(self.url)\n return \"#{parsed_url.domain}.#{parsed_url.public_suffix}\"\n end", "def old_url\n \"http://#{site.default_host.hostname}#{path}\"\n end", "def fix_url\n\t if self.url and not self.url.match(/^(http|https):\\/\\/.*/)\n\t self.url = 'http://' + self.url\n end\n\tend", "def external_link(label, path, **opt, &block)\n opt[:target] = '_blank' unless opt.key?(:target)\n make_link(label, path, **opt, &block)\n end", "def link_to_url(link)\n uri = URI.parse(link)\n if uri.absolute?\n if uri.host != URI.parse(host).host\n Grell.logger.debug \"GRELL does not follow links to external hosts: #{link}\"\n nil\n else\n link # Absolute link to our own host\n end\n else\n if uri.path.nil?\n Grell.logger.debug \"GRELL does not follow links without a path: #{uri}\"\n nil\n end\n if uri.path.start_with?('/')\n host + link #convert to full URL\n else #links like href=\"google.com\" the browser would go to http://google.com like \"http://#{link}\"\n Grell.logger.debug \"GRELL Bad formatted link: #{link}, assuming external\"\n nil\n end\n end\n\n rescue URI::InvalidURIError #We will have invalid links propagating till we navigate to them\n link\n end", "def to_url(host)\n uri = URI.parse(href)\n if uri.absolute?\n if uri.host != URI.parse(host).host\n Grell.logger.debug \"GRELL does not follow links to external hosts: #{href}\"\n nil\n else\n href # Absolute link to our own host\n end\n else\n if uri.path.nil?\n Grell.logger.debug \"GRELL does not follow links without a path: #{uri}\"\n nil\n end\n if uri.path.start_with?('/')\n host + href # convert to full URL\n else # links like href=\"google.com\" the browser would go to http://google.com like \"http://#{link}\"\n Grell.logger.debug \"GRELL Bad formatted link: #{href}, assuming external\"\n nil\n end\n end\n rescue URI::InvalidURIError # Invalid links propagating till we navigate to them\n href\n end", "def urls_to_links(options = {})\n wrap_with = options[:wrap_with] || ['','']\n html_options = options[:html_options] || ''\n\n # ascii_only option - show URLs with warning about contain non-latin characters\n if options[:ascii_only]\n validate_url_contains_ascii(@modified_string, html_options, wrap_with)\n else\n @modified_string.gsub!(\n /(\\s|^|\\A|\\n|\\t|\\r)((http|https):\\/\\/.*?)([,.])?(\\s|$|\\n|\\Z|\\t|\\r|<)/,\n '\\1<a href=\"\\2\" ' + html_options + '>\\2</a>\\4\\5'\n )\n end\n self\n end" ]
[ "0.7125662", "0.7125662", "0.7105084", "0.67459285", "0.6732336", "0.67315036", "0.66884965", "0.66864663", "0.66809696", "0.6633163", "0.6610444", "0.6589095", "0.6582854", "0.65626395", "0.65278137", "0.6499147", "0.6497", "0.6475981", "0.6436557", "0.6427511", "0.6400324", "0.6396578", "0.6390521", "0.63871956", "0.6363705", "0.6353161", "0.63465136", "0.63397545", "0.63180006", "0.63174504", "0.6313553", "0.62665516", "0.6260587", "0.6259624", "0.6241378", "0.6218337", "0.62168574", "0.62109745", "0.6205232", "0.61981857", "0.6184365", "0.6178588", "0.61757565", "0.61734414", "0.61689407", "0.6159544", "0.6159392", "0.6156541", "0.61546236", "0.6145591", "0.6145289", "0.614357", "0.6141923", "0.61382824", "0.6137946", "0.61244863", "0.6118753", "0.6115033", "0.61104083", "0.60975575", "0.60878694", "0.6086454", "0.6079293", "0.6060114", "0.6060114", "0.6056915", "0.60559314", "0.6051779", "0.60512674", "0.60491717", "0.60398835", "0.60389024", "0.6031206", "0.6031125", "0.6027217", "0.6023734", "0.60231835", "0.60124314", "0.60115916", "0.60105354", "0.60093963", "0.60066897", "0.6006649", "0.6001128", "0.6000713", "0.59988034", "0.5996784", "0.59955955", "0.5995307", "0.59881985", "0.598799", "0.598729", "0.59852403", "0.5984483", "0.5983152", "0.59715503", "0.5970641", "0.5969654", "0.596418", "0.59587926" ]
0.61279213
55
arguments: symbol name of the field, FieldDefs parent object
def initialize(field_name, defs) #:nodoc: @field_name = field_name @for_model = defs.for_model end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def field(name); end", "def get_field(field_name)\n\t\tend", "def process_field(field_name)\n if ['id', 'name', 'first_name', 'node_id'].include?(field_name)\n \"#{table}.#{field_name}\"\n else\n super # raises\n end\n end", "def start_field=(_arg0); end", "def add_field(field)\n\t\tend", "def field_called(field_name)\n return nil if field_name.to_s.empty?\n # return nil if field_name.to_s.empty?\n @fields[field_name.to_sym]\n end", "def named(name)\n super || load_field(owner.field_prototypes[name.to_sym])\n end", "def [](name)\n fields[name.to_sym] || parent && parent.provide(name)\n end", "def get_field_name\n\t\tend", "def end_field=(_arg0); end", "def field\n @field ||= quoted_field(field_name)\n end", "def field(name)\n attr_accessor name\n end", "def field=(field_name)\n parameters[:field] = field_name\n end", "def get_char_field(field_name)\n\t\tend", "def configure_field\n end", "def field name\n @fields[name]\n end", "def field(*args)\n _instantiate_and_store(:field, *args)\n end", "def field(*args_or_name, block)\n def_args = extract_definition_args(args_or_name)\n require_arg def_args, :name\n\n return unless check_when(def_args, @current_source)\n return unless version_wanted(def_args)\n\n value = field_value(def_args, block)\n # Rails.logger.debug \"Field #{def_args[:name]} <= #{value} current_source=#{@current_source}\"\n put_field def_args[:name], value\n end", "def method_missing(meth, *args, &blk)\n super unless Fields.all.include?(meth)\n field meth, *args\n end", "def get_field_defs_field(view_control)\n if (self.respond_to? :field_defs) && this_field = field_defs.field_called(view_control.name)\n this_field\n end\n end", "def process_field(builder, field)\n builder.send(field.field_type.to_sym,\n field.field_name.to_sym,\n\n # Homespree Project Type Optional params\n {\n label: field.label,\n data: field.field_data,\n default: field.default,\n required: field.required,\n position: field.position,\n size: field.size,\n toggleable: field.toggleable\n }\n )\n end", "def field_name\n self.class.name.split(\"::\").last.downcase.sub(\"of\", \"_of_\"). \\\n sub(\"field\", \"\").downcase\n end", "def update_field_name\n self.field = field_name\n end", "def has_field(field_name)\n\t\tend", "def field_name\n @field.name\n end", "def field(ffield, length, sourcetag, default = nil, &block)\n @fields << {\n afield: ffield,\n length: length, \n stag: sourcetag,\n default: default,\n block: block\n }\n end", "def main_field= field_name\n name = field_name.to_s.alpha_numeric.to_sym\n raise ArgumentException, \"Not a valid field name: #{field_name}\" if !valid_field_name?(name)\n @main_field ||= name\n end", "def main_field= field_name\n name = field_name.to_s.alpha_numeric.to_sym\n raise ArgumentException, \"Not a valid field name: #{field_name}\" if !valid_field_name?(name)\n @main_field ||= name\n end", "def general_field(name)\n self.general_fields.where(fieldable_id: self.id).where(\"payload->>'key' = ?\", name).first\n end", "def _ field\n as_name = [name, field].join(\"_\").to_sym\n AS[\"#{relationize}.(#{field})\", as_name, Bag.new([field, field_type(field)]), nil, :skip_type]\n end", "def field_name\n @gapi.field_name\n end", "def field_name= new_field_name\n frozen_check!\n @gapi.field_name = new_field_name\n end", "def get_field(parent_type, field_name)\n with_definition_error_check do\n parent_type_name = case parent_type\n when GraphQL::BaseType, Class, Module\n parent_type.graphql_name\n when String\n parent_type\n else\n raise \"Unexpected parent_type: #{parent_type}\"\n end\n\n defined_field = @instrumented_field_map[parent_type_name][field_name]\n if defined_field\n defined_field\n elsif parent_type == query && (entry_point_field = introspection_system.entry_point(name: field_name))\n entry_point_field\n elsif (dynamic_field = introspection_system.dynamic_field(name: field_name))\n dynamic_field\n else\n nil\n end\n end\n end", "def method_missing name, *args, &block\n if name.to_s =~ /^(.+)_fields$/\n self.fields.select {|f| f.data_type.to_s.parameterize.underscore == $1 } || super\n else \n super\n end\n end", "def configure_field\n end", "def read_field\n end", "def get_field_type(field_name)\n\t\tend", "def add_child_field(child_field_name)\n\n child_fields[child_field_name] = ''\n\n self.class.send :define_method, \"set_#{child_field_name}\" do |arg|\n\n child_fields[child_field_name] = arg\n\n end\n\n return method(\"set_#{child_field_name}\")\n\n end", "def get_string_field(field_name)\n\t\tend", "def handle_field(type, name)\n @records ||= Hash.new\n @classname ||= self.to_s.to_sym\n @fields ||= Hash.new\n @fields[name] = type\n self.instance_variable_set(\"@#{name}\".to_sym, nil)\n if RGSS_TYPES.include?(type)\n accessor = Proc.new do\n instance_var = self.instance_variable_get(\"@#{name}\".to_sym)\n CommonDB.rgss_access(type, instance_var) if instance_var\n end\n self.send(:define_method, name.to_sym, &accessor)\n else\n self.send(:attr_reader, name.to_sym)\n end\n self.send(:attr_writer, name.to_sym)\n return name\n end", "def add_field(field_defn)\n own_fields[field_defn.name] = field_defn\n if !method_defined?(field_defn.method_sym)\n # Only add the super method if there isn't one already.\n add_super_method(field_defn.name.inspect, field_defn.method_sym)\n end\n nil\n end", "def field(name, *args)\n ensure_setup!\n field_set.field(name, *args)\n end", "def add_facet_field(*) super end", "def field_named(name)\n ensure_setup!\n field_set.field_named(name)\n end", "def get_field(parent_type, field_name)\n with_definition_error_check do\n parent_type_name = case parent_type\n when GraphQL::BaseType\n parent_type.name\n when String\n parent_type\n else\n raise \"Unexpected parent_type: #{parent_type}\"\n end\n\n defined_field = @instrumented_field_map[parent_type_name][field_name]\n if defined_field\n defined_field\n elsif parent_type == query && (entry_point_field = introspection_system.entry_point(name: field_name))\n entry_point_field\n elsif (dynamic_field = introspection_system.dynamic_field(name: field_name))\n dynamic_field\n else\n nil\n end\n end\n end", "def related_fields(method)\n \n end", "def set_field(field_name, field_value)\n super field_name.to_s, field_value.to_s\n end", "def start_field; end", "def fields_for(record_name, record_object = T.unsafe(nil), fields_options = T.unsafe(nil), &block); end", "def field_name\n self.well_info.field_name\n end", "def sub_field(named, human_name = nil, &block)\n human_name ||= named\n @sub_fields << QueryBuilder::Field.new(named, human_name, self.depth+1, &block)\n end", "def field(rec, form_drawer)\n form_drawer.draw_field(rec, self)\n end", "def fields; end", "def fields; end", "def fields; end", "def field(field_name, field_type=Object, field_validations={})\n if !@fields.include?(field_name)\n @fields[field_name.to_sym] = field_type\n define_method(field_name) { instance_variable_get(\"@#{field_name}\") }\n define_method((\"#{field_name}=\").to_sym) do |field_value|\n self.class.validate(field_value, field_type, field_validations)\n instance_variable_set(\"@#{field_name}\", field_value)\n end\n end\n end", "def field(name)\n unless (@fields ||= []).include?(name)\n @fields << name\n\n # field reader\n define_method(name) do\n instance_variable_get(\"@%s\" % name)\n end\n\n # field writer\n define_method(\"%s=\" % name) do |val|\n val = Time.parse(val) if name == :timestamp and val.kind_of?(String)\n instance_variable_set(\"@%s\" % name, val)\n end\n end\n end", "def register_field_handler(name, handler); end", "def field(*args)\n options = args.extract_options!\n field_name = args.first\n exports_to = options.delete(:exports_to)\n\n export_mappings[exports_to] = field_name if exports_to\n\n attribute(*args)\n validates(field_name, options) if options.present?\n end", "def field_def(name)\n @@known_fields_lookup[name] || # the fast way\n @@known_fields.find{|hfd| hfd === name} || # the slow way\n FieldDesc.new(name.to_s.downcase.gsub(/^.|[-_\\s]./) { |x| x.upcase }.gsub('_', '-'), :repeatable => true) # make up as we go\n end", "def field_instance(field)\n raise \"Not implemented\"\n end", "def get_binary_field(field_name)\n\t\tend", "def semantic_fields_for(name, *args, &block)\n use_semantic_builder(:fields_for, name, *args, &block)\n end", "def layoutField(fld, idx)\r\n insert_item(idx, fld.name)\r\n set_item(idx, 1, fld.df.desc)\r\n set_item(idx, 2, fld.generator.klass_name)\r\n set_edit_attr(idx, 2, InplaceEditListCtrl::EDIT_TYPE_CHOICE, @value_types)\r\n case fld.generator\r\n when ValueTypeFixed\r\n set_item(idx, 3, fld.generator.value)\r\n set_edit_attr(idx, 3, InplaceEditListCtrl::EDIT_TYPE_EDIT)\r\n when ValueTypeFromConfig\r\n when ValueTypeVariableCard\r\n set_item(idx, 3, fld.generator.column)\r\n set_edit_attr(idx, 3, InplaceEditListCtrl::EDIT_TYPE_CHOICE, Card.columns)\r\n when ValueTypeVariableAcquirer\r\n set_item(idx, 3, fld.generator.column)\r\n set_edit_attr(idx, 3, InplaceEditListCtrl::EDIT_TYPE_CHOICE, Acquirer.columns)\r\n when ValueTypePreviousOutgoing\r\n set_item(idx, 3, fld.generator.field_name)\r\n set_edit_attr(idx, 3, InplaceEditListCtrl::EDIT_TYPE_CHOICE, @fullnameList)\r\n when ValueTypePreviousIncoming\r\n set_item(idx, 3, fld.generator.field_name)\r\n set_edit_attr(idx, 3, InplaceEditListCtrl::EDIT_TYPE_CHOICE, @fullnameList)\r\n end # end of case\r\n end", "def field(field_name, value)\n flush_field\n @current_field = field_name\n @current_value = value.dup\n end", "def call_field(field)\n field.to_s.split('__').inject(self) { |a, e| a.send(e) unless a.nil? }\n end", "def get_field(field_name)\n field_name = field_name.to_sym\n field = @field_references[field_name]\n if field.nil?\n unless @@is_a_java_class\n field = method(field_name).call\n else\n field_object = nil\n [field_name.to_s, field_name.camelize, field_name.camelize(false)].uniq.each do |name|\n begin\n field_object = self.class.send(:class_variable_get, :@@java_class).java_class.declared_field(name)\n rescue NameError, NoMethodError => e\n end\n break unless field_object.nil?\n end\n raise UndefinedControlError, \"There is no control named #{field_name} on view #{@main_view_component.class}\" if field_object.nil?\n \n field_object.accessible = true\n field = Java.java_to_ruby(field_object.value(Java.ruby_to_java(@main_view_component)))\n end\n @field_references[field_name] = field\n end\n field\n end", "def add_field!(field_name, value = T.unsafe(nil)); end", "def fields_for(record_or_name_or_array, *args, &block)\n options = args.extract_options!.merge(:builder => self.class)\n super(record_or_name_or_array, *(args + [options]), &block)\n end", "def field_class\n 'info'\n end", "def get_F32_field(field_name)\n\t\tend", "def field name\n f = fields.find { |fld| fld.name == name.to_s }\n return nil if f.nil?\n yield f if block_given?\n f\n end", "def field(name, options = {}, &block)\n name = name.to_sym\n fields.delete_if { |f| f.name == name }\n fields << field = Field.new(name, options, block)\n instance_eval { attr_reader field.name }\n end", "def get_field(field_name)\n fields = @data_source['fields']\n \n fields.each do | f |\n if f['name'] == filed_name\n return f\n end\n end \n return nil\n end", "def add_field!(field_name, value = nil)\n fields << Field.new({'name' => field_name}, value)\n end", "def define_field(name, options)\n add_field Field.new(options.merge(name: name.to_sym))\n end", "def has_field?(field_name); end", "def field(p,field_name)\n f = p.fields.find {|f| f.name == field_name}\n if f.nil? then\n return nil\n else\n return f.value\n end\nend", "def fields_for(record_or_name_or_array, *args, &block) #:nodoc:\n opts = args.extract_options!\n opts.merge!(:builder => Transit::Builders::FormBuilder)\n args.push(opts)\n super(record_or_name_or_array, *args, &block)\n end", "def field(name, options={})\n (@value[:fields] ||= {}).update name.to_sym => options\n end", "def fields_for(record_name, record_object = T.unsafe(nil), options = T.unsafe(nil), &block); end", "def get_field_type\n\t\tend", "def [](field_name); end", "def field(name, *params)\r\n @model.translated_attribute_names = (@model.translated_attribute_names + [name.to_sym])\r\n @model.translated_attr_accessor(name)\r\n @model.translation_class.field name, *params\r\n end", "def field(model_attrib_sym, options = {}, &block)\n field_manager.add(scope, model_attrib_sym, options, &block)\n end", "def define_set_field_method(field)\n define_method \"#{field.name}=\" do |object|\n if object.nil?\n self.send \"#{field.foreign_key}=\", nil\n elsif object.is_a?(Symbol)\n self.send \"#{field.foreign_key}=\", self.class.send(field.name, object).id\n elsif object.kind_of?(ActsAsEnumField::InstanceMethods)\n self.send \"#{field.foreign_key}=\", object.id\n else\n raise \"BUG: invalid argument \" + object.class.name\n end\n end\n end", "def field(f, val = nil)\n name = f.downcase\n\n return self.fields[name] unless val\n\n self.fields[name] = val\n\n return self\n end", "def initialize(name = '', parent = false)\n\n @parent = parent\n @name = name\n # child_fields will contain field_name, value pairs\n @child_fields = {}\n # child_field_groups will contain field_group_name, DynamicFieldGroupBuilder instance pairs\n @child_field_groups = {}\n # the following helps organize th e DynamicFieldGroupBuilder instance by type of dymamic field group\n # which will helps us when we print out repeatable dynamic field groups\n @child_dynamic_field_groups_by_type = {}\n\n end", "def dfield_params\n params.require(:dfield).permit(:field_name, :field_type, :is_required, :is_show_in_list, :is_editable, :api, :brick_id, )\n end", "def replace_field_handler(name, handler); end", "def get_field(name)\n self[name]\n end", "def add_field(name, options = {})\n # aliased = options[:as]\n # aliased_fields[aliased.to_s] = name if aliased\n field = field_for(name, options)\n fields[name] = field\n # add_defaults(field)\n create_accessors(name, name, options)\n # process_options(field)\n # create_dirty_methods(name, name)\n # create_dirty_methods(name, aliased) if aliased\n field\n end", "def field_base\n @field_base ||= lambda do\n el = Placeholder::FIELD\n [Func::UNACCENT].each do |func|\n el = \"#{func}(#{el})\"\n end\n el\n end.call\n end", "def field(sym, options={})\n options[:type] ||= Integer\n @fields[sym.to_sym] = options\n end", "def field(spec, name = nil, data_lambda = nil)\n add_field Field.new(String, spec, name || next_unknown_field_name, data_lambda)\n end", "def field\n @field ||= @options.fetch(:field, repository.adapter.field_naming_convention.call(name))\n end", "def define_field_name(field)\n (field.to_s + '_field').to_sym.tap do |field_method_name|\n field_method_names << field_method_name\n end\n end", "def add_fields(fields)\n\t\tend", "def has_field?(field_name)\n direct_fields = self.fields\n foreigns.each do |f|\n foreign_dataset = self.class.dataset_from f\n if foreign_dataset\n direct_fields.concat foreign_dataset.fields\n end\n end\n direct_fields.include? field_name\n end", "def field(name)\n _unique(name)\n value = _field(name)\n fields[name] = field_class.new(self, name, value)\n end" ]
[ "0.74475235", "0.69970655", "0.6650262", "0.66497535", "0.65533406", "0.6435762", "0.6430852", "0.63948786", "0.63327855", "0.63005465", "0.6269922", "0.62695867", "0.6257703", "0.62473214", "0.6217794", "0.61956716", "0.61803186", "0.61787516", "0.6172737", "0.6166402", "0.61270094", "0.6114966", "0.6099898", "0.6096485", "0.6087777", "0.6085806", "0.60742426", "0.6073654", "0.60620344", "0.6036433", "0.6012208", "0.6006306", "0.60051054", "0.6005095", "0.60018945", "0.5991331", "0.5988765", "0.59854406", "0.5984303", "0.5980785", "0.597737", "0.5965938", "0.5958176", "0.59536505", "0.5944291", "0.59383166", "0.59312576", "0.5929611", "0.59212244", "0.59153265", "0.59150743", "0.59108365", "0.58992034", "0.58992034", "0.58992034", "0.5896525", "0.5889625", "0.58829165", "0.5882727", "0.5861877", "0.5834671", "0.5829275", "0.58227146", "0.582181", "0.5809886", "0.5809626", "0.58025885", "0.58011425", "0.57963145", "0.5795203", "0.5793579", "0.57886755", "0.5788362", "0.5784138", "0.57697743", "0.5767217", "0.57635325", "0.5756911", "0.5753121", "0.5748752", "0.5746651", "0.5736785", "0.57293236", "0.5712943", "0.5708084", "0.5701542", "0.5691601", "0.5690264", "0.56812996", "0.5678173", "0.56757253", "0.56707203", "0.5668366", "0.5663582", "0.5662367", "0.5661553", "0.5657439", "0.5649073", "0.5648854", "0.56483823" ]
0.6184642
16
used for applying labels to fields, you can then find all fields with a given lable by using FieldDefs.all_attributes_labeled
def label(label_name) @labels ||= [] @labels << label_name.to_sym self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_attributes_labeled(label_name)\n to_return = {}\n @fields.each do |key, field|\n if field.has_label?(label_name.to_sym)\n to_return[key] = field.human_name\n end\n end\n to_return\n end", "def all_fields_labeled(label_name)\n @fields.values.reject do |field|\n !field.has_label?(label_name.to_sym)\n end\n end", "def labeled\r\n attrs.fetch(:labeled, {})\r\n end", "def labels\n fields[\"labels\"]\n end", "def field_names\n label_fields.to_h\n end", "def label_fields\n @label_fields ||= LabelFields.new do |lf|\n labels.each { |label| lf.add(label) }\n end\n end", "def label(attribute_name, *args); end", "def labels!(lbl)\n save!(\"fields\" => { \"labels\" => lbl.uniq }) unless lbl.empty?\n end", "def label\n attributes.fetch(:label)\n end", "def label\n attributes.fetch(:label)\n end", "def label\n attributes.fetch(:label)\n end", "def label\n attributes.fetch(:label)\n end", "def label\n attributes.fetch(:label)\n end", "def label\n attributes.fetch(:label)\n end", "def document_show_field_labels\n Blacklight.config[:show_fields][:labels]\n end", "def label\n @attributes[:label]\n end", "def label\n read_attr :label\n end", "def generate_label_for_attribute?; end", "def label\n attribute :label\n end", "def labels\n inject_block(:name, :label)\n end", "def index_field_labels\n Blacklight.config[:index_fields][:labels]\n end", "def labeled_fields_for(object_name, object, options = {}, &proc)\n fields_for(object_name, object, {:builder => LabeledFormBuilder}, &proc)\n end", "def label\n <<-HTML\n\n <label id=\"#{label_id}\" class=\"string #{label_classes}\">#{attribute_name.to_s.titleize}</label>\n HTML\n end", "def label_with_id\n text_and_id( :label )\n end", "def label_with_id\n text_and_id( :label )\n end", "def label_with_id\n text_and_id( :label )\n end", "def manifestation_index_field_labels\n Blacklight.config[:manifestation_index_fields][:labels]\n end", "def collect_attribute_labels(original_data)\n original_data.keys\nend", "def label_details\n attributes.fetch(:labelDetails)\n end", "def label_field\n self.find_field(self.label_field_name) || self.fields.first\n end", "def set_label(l); end", "def labeled(label)\n wrap(\n @inner.select do |event|\n event['event'] == 'labeled' &&\n event['label'].name.downcase == label.downcase\n end,\n )\n end", "def labeled\n @labeled ||= ImageLabel.where(:image_id => self.id).where.not(:label_id => nil).map{ |il| il.label }\n end", "def labels() = @labels ||= labels_hash", "def label(lname)\n $labels[lname] = $iptr\nend", "def labels; end", "def imprint_label(field)\n label_subfields = field.subfields.select { |sf| sf.value if sf.code == '3' }\n label_subfields.compact.map { |sf| sf.value.strip }.join(' ').gsub(/[,;:.]*$/, '').strip\n end", "def labels\n multi_value? ? label_ids.collect{|l_id| Label.find(l_id) } : []\n end", "def label_support\n attributes.fetch(:labelSupport)\n end", "def label(model, field_name, label_text, options={})\n # Use the field_name option if supplied\n # The value for the for attribute.\n label_for = (model.to_s + '_' + field_name).downcase\n # The <label> tag\n label_tag = content_tag('label', label_text, :for => label_for)\n # Add an asterisk if :required option specified.\n label_tag += '*' if options[:required]\n # Finish off the label.\n label_tag += ':'\n # Wrap the <label> tag in a <strong> tag.\n content_tag('strong', label_tag)\nend", "def label\n if respond_to?(\"#{@attribute}_label\".to_sym)\n send(\"#{@attribute}_label\".to_sym)\n else\n @attribute.to_s.titleize\n end\n end", "def form_label(model, label_text, options={})\n\t\tfield_name = options[:field_name]\n\t\tfield_name ||= label_text.gsub(' ', '_')\n\t\tlabel_for = (model.to_s + '_' + field_name).downcase\n\t\tlabel_tag = content_tag('label', label_text, label_for)\n\t\tlabel_tag += '*' if options[:required]\n\t\t#label_tag += ':'\n\t\tcontent_tag('strong', label_tag)\n\tend", "def get_label\n get_field_config['label']\n end", "def show_labels\r\n labels = Document.new(self).get_labels\r\n puts \"There are #{labels.length} labels\"\r\n index = 1\r\n labels.each do |l|\r\n puts \"label: name: #{l.name}\"\r\n puts \" id: #{l.id}\"\r\n puts \" for: #{l.for}\"\r\n puts \" index: #{index}\"\r\n index += 1\r\n end\r\n end", "def labels\n [label()]\n end", "def present_field_as_label(field)\n field.to_s.sub(/_id$/, '').split('_').map(&:capitalize).join(' ')\n end", "def labels\n @labels ||=\n search('label').map { |node| Label.new(node, self) }\n end", "def labels\n @labels ||=\n search('label').map { |node| Label.new(node, self) }\n end", "def fields\n @field_labels.collect { |k, v| { sym: k, name: v } }\n end", "def _label\n field = self.content_type.label_field\n value = self.dynamic_getter(field.name)\n\n if field.type == :belongs_to\n value.try(:_label)\n else\n value\n end\n end", "def label\n end", "def input_label(name)\n field = field_content(name)\n label(field, name)\n end", "def field_detect(label)\n @field = fields.detect { |item| item.text.include? label }\n\n raise \"Field '#{label}' was not found on form.\" unless @field\n end", "def nested_form_field label_text, form, method, field, *args\n if form.is_a? Array\n if form.length > 1\n form.shift.fields_for form.first do |builder|\n form[0] = builder\n nested_form_field label_text, form, method, field, *args\n end\n else\n nested_form_field label_text, form.first, method, field, *args\n end\n else\n if label_text.nil?\n form.send method, field, *args\n else\n %Q(<div class=row>\n <div class=span4>#{label_text}</div>\n #{ form.send method, field, *args }\n </div>).html_safe\n end\n end\n end", "def label\n self['label']\n end", "def required_label_text; end", "def name label\n label(label)\n end", "def label\n elements.select { |e| e.respond_to?(:label) }.first.label\n end", "def finderlabels\n %w{ Image Title Description }\n end", "def label_as label\n @label = label\n end", "def label_for_field(record, controller = self.controller)\n renderer = controller.record_select_config.label\n case renderer\n when Symbol, String\n # find the <label> element and grab its innerHTML\n description = render_record_from_config(record, File.join(controller.controller_path, renderer.to_s))\n description.match(/<label[^>]*>(.*)<\\/label>/)[1]\n\n when Proc\n # just return the string\n render_record_from_config(record, renderer)\n end\n end", "def labeled?(name)\n @labels.key?(name.to_sym)\n end", "def label; end", "def label; end", "def label(method, text = nil, options = {}, &block) #:nodoc:\n\n options, text = text, nil if text.is_a?(Hash)\n text ||= method.to_s.humanize\n\n options.stringify_keys!\n klasses = (options.delete(['class']) || \"\").split(\" \")\n klasses << 'field_with_errors' if errors_on_attribute?(method)\n options['class'] = klasses.join(\" \") unless klasses.compact.empty?\n\n text = \"#{text} <abbr title='Required'>*</abbr>\".html_safe if attribute_required?(method) || required_by_option?(options.delete('required')) \n super(method, text, options, &block)\n\n end", "def label_target\n :\"#{attribute_name}_gteq\"\n end", "def label_for_field(field, options = {})\n return ''.html_safe if options.delete(:no_label)\n text = ''\n text += yield if block_given?\n text += options[:label].is_a?(Symbol) ? l(options[:label]) : options[:label] if options[:label]\n text += @template.t(field.to_s, :scope => [:activerecord, :attributes, object_name.underscore]) unless options[:label]\n @template.content_tag(:label, text.html_safe,\n :class => (block_given? ? \"checkbox \" : \"control-label \").to_s + (@object && @object.errors[field].present? ? \"error\" : nil).to_s,\n :for => (@object_name.to_s.gsub(/[\\[\\]]/,'_') + \"_\" + field.to_s).gsub(/__/, '_'))\n end", "def name\n label\n end", "def label\n return @label\n end", "def field_label(field)\n @__field_label_cache ||= {}\n @__field_label_cache[field] ||= field.to_s.sub(/_facet$|_display$|_[a-z]$/,'').gsub(/_/,' ')\n @__field_label_cache[field]\n end", "def busr_lbl; catdet.form(:name, 'rpcControlRemSettingForm').text_field(:name, 'label'); end", "def label_for_field(method, options = {})\n return '' if options[:no_label]\n label_text = options.delete(:label) || l((\"field_\"+method.to_s.gsub(/\\_id$/, \"\")).to_sym)\n label_text += @options[:read_only] ? \":\" : options[:required] ? @template.content_tag(\"span\", \" *\", :class => \"required\"): \"\"\n @template.content_tag(\"div\",\n @template.content_tag(\"label\", label_text, \n :class => (object_has_errors?(method) ? \"error\" : nil), \n :for => \"#{@object_name}_#{method}\"), \n :class => \"label\")\n end", "def label(label = nil)\n @label = label if label\n @label\n end", "def label_columns\n ensure_full_data!\n Array(@gapi_json[:labelColumns]).map do |field_gapi_json|\n field_gapi = Google::Apis::BigqueryV2::StandardSqlField.from_json field_gapi_json.to_json\n StandardSql::Field.from_gapi field_gapi\n end\n end", "def facet_field_labels\n Blacklight.config[:facet][:labels]\n end", "def label label = nil\n @label = label if label\n @label\n end", "def label\n @sax_document.label || @structmap.label\n end", "def label\n @sax_document.label || @structmap.label\n end", "def label_for_table\r\n label.to_s.gsub(/ /, '_').downcase\r\n end", "def all_labels # :yields: Array of Strings\n # includes plurals etc.\n self.labels.inject([]){|sum, l| sum + l.all_forms}.sort\n end", "def label\n @params['label']\n end", "def tlabel attribute_name, model_name=nil \n if model_name.nil? then\n index=attribute_name.index('.')\n if !index.nil? && attribute_name.count('.') == 1 then\n names=attribute_name.split('.')\n model_name=names[0]\n attribute_name = names[1]\n end\n end\n \n if model_name.nil? then\n ret_val = I18n.t($FL+attribute_name)\n else\n ret_val = I18n.t($ARA + model_name +\".\" + attribute_name)\n end\n tm= $TM\n if ret_val.index(tm) then\n if attribute_name.end_with? \"_id\" then\n ret_val2 = tlabel(attribute_name[0..(attribute_name.length-4)], model_name)\n if ! ret_val2.index(tm) then\n ret_val= ret_val2\n end\n end\n end\n return ret_val\n end", "def get_labels_and_nicks(field_info)\n labels_and_nicks = {}\n field_info.each { |field| labels_and_nicks.store(field['name'], field['nick']) }\n labels_and_nicks\n end", "def new_labels\n found_labels.map{ |label| LABEL_MAP[label] }\n end", "def label(*args)\n current_form_context.label(*args)\n end", "def label\n nome\n end", "def add_label label\n @labels[label] = true\n\n label\nend", "def generic_render_document_field_label(config_field, document, field: field_name)\n send(:\"render_document_#{config_field}_label\", document, field: field)\n end", "def generic_render_document_field_label(config_field, document, field: field_name)\n send(:\"render_document_#{config_field}_label\", document, field: field)\n end", "def label(model = nil)\n model ||= @core.label(:count => 2)\n @label ? as_(@label) : as_(:update_model, :model => model)\n end", "def labels\n return @labels\n end", "def labels\n return @labels\n end", "def create_label(node)\n if node.attributes['id'] and @labels[node.attributes['id']]\n label = @labels[node.attributes['id']]\n else\n label = @factory.new_label\n @labels[node.attributes['id']] = label\n end\n \n # Read all defined data fields\n label.id = node.attributes['id']\n if node.attributes['type']\n label.type = Utils.add_namespace(node.attributes['type'])\n end\n \n label.name = node.elements['name'].text if node.elements['name']\n label.sort_name = node.elements['sort-name'].text if node.elements['sort-name']\n label.code = node.elements['label-code'].text if node.elements['label-code']\n label.disambiguation = node.elements['disambiguation'].text if node.elements['disambiguation']\n label.country = node.elements['country'].text if node.elements['country']\n \n if life_span = node.elements['life-span']\n label.begin_date = read_date_attribute(life_span, 'begin')\n label.end_date = read_date_attribute(life_span, 'end')\n end\n \n # Read the alias list\n read_alias_list(node.elements['alias-list'], label.aliases)\n \n # Read the release list\n read_release_list(node.elements['release-list'], label.releases)\n \n # Read the relation list\n if node.elements['relation-list']\n node.elements.each('relation-list') {|relation_node|\n read_relation_list(relation_node) {|relation|\n label.add_relation relation\n }\n }\n end\n \n # Read the tag list\n read_tag_list(node.elements['tag-list'], label.tags)\n \n return label \n end", "def found_labels\n found = get(\"title\").scan(/\\[(.*?)\\]/).map { |label_arr|\n label = label_arr[0].downcase\n label.to_sym\n }.select{ |label|\n LABEL_MAP.keys.include? label\n }\n end", "def label_for(key)\n if !@labels\n labels\n end\n @labels[key.to_sym]\n end", "def pusr_lbl; catdet.form(:name, 'rpcControlApsSettingForm').text_field(:name, 'label'); end", "def labels\n # TODO: Make a proper Label class to represent this structure...\n Array @gapi[\"labels\"]\n end", "def label\n @label || \"unknown\"\n end", "def labels\n @labels ||= parser.labels\n end", "def label(name)\n @labels[name.to_sym]\n end", "def label\r\n @label ? @label : \"#{table_alias || from_table_name}_#{name}\"\r\n end" ]
[ "0.7770568", "0.72955835", "0.72811604", "0.7176707", "0.7165646", "0.711778", "0.67014897", "0.6700405", "0.6683422", "0.6683422", "0.6683422", "0.6683422", "0.6683422", "0.6683422", "0.6658331", "0.65247697", "0.64326954", "0.6423094", "0.63937145", "0.6371045", "0.63656807", "0.6356905", "0.6333998", "0.6318868", "0.6318868", "0.6318868", "0.63094485", "0.6238057", "0.62354916", "0.6164947", "0.61612767", "0.61396044", "0.6136835", "0.6109054", "0.60851574", "0.605642", "0.6036148", "0.60056907", "0.5955433", "0.59547746", "0.5952109", "0.59331536", "0.59248847", "0.59223634", "0.59172535", "0.59053224", "0.5903479", "0.5903479", "0.59016204", "0.5880647", "0.58610845", "0.5838591", "0.58130574", "0.579728", "0.578711", "0.57836413", "0.5780158", "0.5773954", "0.576981", "0.5765786", "0.5760964", "0.5755431", "0.57466465", "0.57466465", "0.57380277", "0.57362825", "0.5735228", "0.5733143", "0.5723988", "0.5720063", "0.5711354", "0.57078344", "0.5692533", "0.5692232", "0.5687397", "0.5680541", "0.5674402", "0.5674402", "0.5674342", "0.56739795", "0.56670886", "0.5663716", "0.5659768", "0.56526", "0.56511563", "0.56498677", "0.56364524", "0.5634773", "0.5634773", "0.56220716", "0.5608128", "0.5608128", "0.5591106", "0.55813897", "0.5579419", "0.55786985", "0.5576619", "0.556903", "0.556732", "0.5564628", "0.5560313" ]
0.0
-1
returns true/false based on if this field has the label asked for
def has_label?(label_name) (@labels || []).include?(label_name.to_sym) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_label?\n\t\tnot @label.nil?\n\tend", "def label?(label)\n self.labels.keys.include?(label)\n end", "def label?\n not elements.select { |e| e.respond_to?(:label) }.empty?\n end", "def has_extended_label?\n extended_label != nil\n end", "def label_present?\n preferred_label != rdf_subject.to_s\n end", "def default_label?\n true\n end", "def labeled?\r\n false\r\n end", "def localized?\n field = self.content_type.label_field\n !!field.try(:localized)\n end", "def generated_label?\n return true if @attribute && @generated_name_classes.any?\n return false\n end", "def generated_label?\n return true if @attribute && @generated_name_classes.any?\n\n false\n end", "def label_defined?(name)\n @labels.has_key? name.to_s\n end", "def has_expression_label?\n !self.default_options[:expression_label].blank?\n end", "def field?\n true \n end", "def default_label?\n if self.style == 'acceptance'\n false # template provides its own label\n else\n true\n end\n end", "def field_detect(label)\n @field = fields.detect { |item| item.text.include? label }\n\n raise \"Field '#{label}' was not found on form.\" unless @field\n end", "def field?\n false \n end", "def labeled?(name)\n @labels.key?(name.to_sym)\n end", "def has_label?(id)\n if labels_config[id] && labels_config[id][:label]\n return true if labels_config[id][:label][I18n.locale.to_s]\n return true if labels_config[id][:label][:en]\n end\n return false\n end", "def field?(name)\n @attributes.key?(name)\n end", "def has_field?(field_name); end", "def a_label?(item)\n item.is_a?(Hash) && item.keys.first == HumanComputer::Macros::Label\n end", "def field?(name)\n ! self[name].nil?\n end", "def text_field?(field_name); end", "def has_field(field_name)\n\t\tend", "def required_label_text; end", "def has_label?(label_set, label)\n label_set && label_set.split(Run::IN_Separator).map(&:strip).include?(label)\n end", "def show_field?(name)\n show_fields.key?(name)\n end", "def field? name\n !!self.fields[name]\n end", "def label_field\n self.find_field(self.label_field_name) || self.fields.first\n end", "def options_are_labeled?\n @options.any? {|option| option.label }\n end", "def includes_special_label?(label)\n ids.first.to_s.downcase == label || usernames.map(&:downcase).include?(label)\n end", "def has_sub_label?(id, sub_id)\n # we don't care about :edit_label here because we assume that we have an edit_label only if we also have :label\n if labels_config[id] && labels_config[id][:fields] && labels_config[id][:fields][sub_id] && labels_config[id][:fields][sub_id][:label]\n return true if labels_config[id][:fields][sub_id][:label][I18n.locale.to_s]\n return true if labels_config[id][:fields][sub_id][:label][:en]\n end\n return false\n end", "def yaml_field? name\n !!self.yaml_fields[name]\n end", "def generate_label_for_attribute?; end", "def is_field_with_ui_enabled?(id_or_name)\n self.find_entries_custom_field(id_or_name)&.ui_enabled?\n end", "def use_for_labels?(*labels)\n return true if labels.empty? || options[:labels].nil? || options[:labels].include?(:any)\n !(options[:labels] & labels).empty?\n end", "def should_render_show_field? document, field_config\n should_render_field?(field_config, document) && document_has_value?(document, field_config)\n end", "def field_has_data(title, field, pregnant)\n\t\tif field_data_is_true(field) && title_should_be_shown(title, pregnant)\n\t\t\t\n\t\t\tif title == \"pregnant\" && !pregnant || title == \"pregnant_due_date\" && !pregnant\n\t\t\t\treturn false\n\t\t\tend\n\n\t\t\ttrue\t\t\t\n\t\tend\n\tend", "def cdl_label(value)\n value ? \"Yes\" : \"No\"\n end", "def custom_fields_for?(name)\n self.class.custom_fields_for?(name)\n end", "def field_value\n checked?\n end", "def clean_label\n return true unless self.label\n self.label = self.label.strip\n true\n end", "def value_for_tag?(tag)\n @set_fields[tag] || false\n end", "def labels_include?(labels_hash)\n labels_hash <= private_labels_to_hash\n end", "def hf_show_email_selector? ra\n show_fname?(ra, :pk_fieldname) && ra.pk_enum.size > 1 # Excluding [\"All\", '']\n end", "def english_name?\n read_attribute(:name).present?\n end", "def display_name?\n !display_name.to_s.empty?\n end", "def has_field?(name)\n fields.key?(name.to_sym)\n end", "def can_display_in?(screen, field)\n return self.kind == field.kind\n end", "def get_boolean_field(field_name)\n\t\tend", "def boolean_field_registered?(name)\n return boolean_fields[name.to_s] != nil\n end", "def has_field?(name)\n aliased_fields.has_key?(name) || fields.has_key?(name)\n end", "def value_present_or_checkboxes?(response_field)\n response_field.field_type == 'checkboxes' || value_present?(response_field)\n end", "def can_see_me? (fld)\n title = datamart_user.datamart_user_profile.title rescue ''\n case title\n when 'Processor'\n return true if fld.eql?('per_loan_processed') or fld.eql?('per_loan_branch_processed')\n when 'Branch Manager / NON Storefront' \n when 'Branch Manager Storefront'\n return true if fld.eql?('bmsf_override')\n when 'Branch Sales Manager'\n return true if fld.eql?('bsm_override')\n end\n false\n end", "def has_actual_input?\n\t\t\tself.text != @help_text\n\t\tend", "def hidden_field?(field_name); end", "def show_your_courses_label?\n return true if submitted_and_current_courses?\n return false if only_past_submitted_courses?\n return true if submitted_but_no_current_or_past_courses?\n return true if current_courses_but_incomplete_instructor_training?\n end", "def true_label\n raise 'Called true_label from a Non Single CheckBox type' unless single_value?\n \n label = Label.find(true_label_id)\n \n raise \"True label not set for CustomFields::CheckBox id=#{self[:id]}\" if label.nil?\n\n label\n end", "def label\n read_attr :label\n end", "def is_placeholder?(fieldname)\n self.class.placeholders.include?(fieldname.to_sym)\n end", "def loaded?\n Unit.units.has_key? @label\n end", "def textarea_field?(field_name); end", "def show_user_field?(field)\n return true unless @setup or current_user.blank?\n return true if @setup and current_user.required_profile_elements.include?(field)\n return false\n end", "def shine?\n label.name == \"shine\" if label\n end", "def false_label\n raise 'Called false_label from a Non Single CheckBox type' unless single_value?\n \n label = Label.find(false_label_id)\n\n raise \"True label not set for CustomFields::CheckBox id=#{self[:id]}\" if label.nil?\n\n label\n end", "def categorizing?\n instance_variable_defined?(:@required_forms)\n end", "def field_exists?(name)\n @fields.key?(name.to_s) || @fields.key?(name.to_sym)\n end", "def get_boolean_value(field_name)\n\t\tend", "def has_field?(field_name)\n direct_fields = self.fields\n foreigns.each do |f|\n foreign_dataset = self.class.dataset_from f\n if foreign_dataset\n direct_fields.concat foreign_dataset.fields\n end\n end\n direct_fields.include? field_name\n end", "def document_show_field_labels\n Blacklight.config[:show_fields][:labels]\n end", "def label\n attributes.fetch(:label)\n end", "def label\n attributes.fetch(:label)\n end", "def label\n attributes.fetch(:label)\n end", "def label\n attributes.fetch(:label)\n end", "def label\n attributes.fetch(:label)\n end", "def label\n attributes.fetch(:label)\n end", "def handles?(field); end", "def label\n end", "def has_same_identity_as?(other)\n @label == other.label && !@label.nil?\n end", "def text_field?(field_name)\n texts.find { |f| f.name == field_name }\n end", "def issue_has_label?(issue_id, repo, label_name)\n get_labels(issue_id, repo).each do |label|\n if label[\"name\"] == label_name\n return true\n end\n end\n return false\n rescue => e\n # Something went wrong but as far as we are\n # concerned, this issue does not have the label\n $stderr.puts \" [e.class] #{e.message}\"\n return false\n end", "def label\n @given_label || I18n.t(\"bureaucrat.#{form_name}.#{name}.label\", default: name.to_s.humanize)\n end", "def subset_field? name\n subset_fields.include?(name) if subset_fields\n end", "def has_field?(field_name)\n @data.has_key?(AudioMetadata.field_name_for(field_name))\n end", "def has_key?(field_name); end", "def one_subfield?(**args)\n self.subfield_search(args).count == 1\n end", "def label\n @label || \"unknown\"\n end", "def label() @positive end", "def draw?\n @fields.index(' ') == nil\n end", "def has_session_label_input?(descriptor = self.class.full_descriptor)\n descriptor['inputs'].detect { |struct| struct['id'] == 'session_label' }\n end", "def show_fname? ra, fname\n fval = ra.send(fname).to_s\n return false if fval.empty? # not specified in ra\n #return false if @hidden_fields.include?(fval)\n return true\n end", "def label\n return @label\n end", "def has_value?(field_cfg)\n index_view ||\n field_cfg.accessor ||\n document.has?(field_cfg.field) ||\n (document.has_highlight_field?(field_cfg.field) if field_cfg.highlight)\n end", "def label\n attribute :label\n end", "def label\n @attributes[:label]\n end", "def map_field?(field_descriptor)\n (field_descriptor.label == :repeated) &&\n (field_descriptor.subtype.name.include? '_MapEntry_')\n end", "def has_valid_form\n is_predefined_by_ak || has_valid_prefix\n end", "def localized?\n self.entries_custom_fields.where(localized: true).count > 0\n end", "def hasinfo?(field)\n @info[field] ? true : false\n end", "def document_show_field_label(document, field)\n lookup_display_name(document, field) || super\n end" ]
[ "0.81016797", "0.74153674", "0.73295045", "0.73185045", "0.7298243", "0.7247018", "0.7202353", "0.712427", "0.710574", "0.7104708", "0.6979164", "0.6834891", "0.6829568", "0.6795901", "0.669731", "0.6688157", "0.66489685", "0.66413325", "0.6592044", "0.6587566", "0.65769184", "0.65445554", "0.6513217", "0.6511536", "0.6509991", "0.65067625", "0.64480716", "0.64368236", "0.63998693", "0.63905275", "0.6365613", "0.6362179", "0.6336498", "0.63161296", "0.6295859", "0.62904465", "0.62814707", "0.626475", "0.62459815", "0.62410164", "0.623118", "0.61915094", "0.6190332", "0.6187975", "0.61398125", "0.6135245", "0.6127747", "0.6084258", "0.6077234", "0.60712385", "0.60643077", "0.60314816", "0.6026786", "0.6024122", "0.6023458", "0.60227257", "0.6018057", "0.60108286", "0.6003264", "0.5978862", "0.59735054", "0.5966076", "0.59373283", "0.5934138", "0.59320045", "0.59142905", "0.59135854", "0.59007627", "0.58990407", "0.5897983", "0.58954626", "0.58954626", "0.58954626", "0.58954626", "0.58954626", "0.58954626", "0.58865875", "0.5884547", "0.5860423", "0.5858818", "0.58537525", "0.58524656", "0.5847006", "0.5845258", "0.5842549", "0.5822309", "0.5818283", "0.58130753", "0.5792107", "0.5784931", "0.5783619", "0.57809263", "0.57772326", "0.5776062", "0.5775877", "0.577192", "0.57704496", "0.5770127", "0.57685786", "0.5760082" ]
0.70511675
10
give me a block that describes how to display a potential value for the named field. If you call me without a block, I will return either the last block you sent me, or the default display_proc. Block should take 1 arg (being the value to format) and return the value, formatted. default proc just runs to_s on the value.
def display_proc(&block) #defined by default_for_proc_type in initialize! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format!\n if block\n captured_value\n else\n to_s\n end\n end", "def format(value = nil, &block)\n __define__(:format, value, block)\n end", "def format_submission_field(field, value, &block)\n FormSubmissionFieldDisplay.new(self, field, value, &block)\n end", "def display_for(object, field_name)\n fdef = field_called(field_name)\n fdef.display_proc.call(fdef.reader_proc.call(object))\n end", "def format_variable!(variable, value, &block)\n block ||= @variable_formatters[variable] || @variable_formatters[nil]\n result = block.arity == 1 ? block.call(value) : block.call(variable, value) if block\n \n case result\n when Localized then result\n when true, nil then value\n when false then nil\n else Localized.new(value, self, format(result))\n end\n end", "def format(&block)\n @format = block if block\n @format\n end", "def format_fancygrid_value(record, leaf, value=nil, &format_block)\n if block_given?\n if defined?(Haml::Helpers) && is_haml?\n capture_haml(leaf, record, value, &format_block)\n else\n capture(leaf, record, value, &format_block)\n end\n else\n render( :template => leaf.root.template, :locals => { \n :grid => leaf.root, :table => leaf.root,\n :record => record, \n :cell => leaf, :column => leaf, \n :value => value \n })\n end\n end", "def display_field\n current_field_values_with_field_type_id(field_types.first.id).first.try(:value) || 'no display field available'\n end", "def format\n unless block\n fields.inject(\"\".html_safe) do |html, field|\n html << view(field)\n end\n end\n end", "def format(meth=nil, &block)\n @value_format ||= (meth ? meth : block)\n end", "def to_s\n label = @field.label\n val = @template.send(:h, formatted_value)\n if @block\n @template.concat(@template.capture(label, val, &@block), @block.binding)\n else\n <<-EOF\n<div class=\"form_submission_field_display\">\n <strong class=\"label\">#{label}</strong>\n <span class=\"response\">#{val}</span>\n</div>\nEOF\n end\n end", "def show_field( name, val, indent )\n return if val.nil?\n return if val.respond_to?( :empty? ) && val.empty?\n puts \"#{indent}#{name} => #{val}\"\n end", "def get_field_display_rtpl\n # TODO: revisit when implementing save/display of multiselct values\n # if(isset($this->multiple) && $this->multiple != '')\n # $multiple = $this->multiple;\n # else $multiple = '';\n\n field_string = '{%=' + @model_name + '[:' + @name + '_display]%}'\n field_string\n end", "def display_format\n value = self.format_str ||\n I18n.t(self.format, :scope => [:bento_search, :format], :default => self.format.to_s.titleize)\n\n return value.blank? ? nil : value\n end", "def render_field(field, loopob = {})\n # :afield, :length, :stag, :block\n # we have to find the corresponding object\n f = nil\n ob = if loopob.member? field[:stag]\n loopob[field[:stag]]\n else\n @objects[field[:stag]]\n end\n f = field[:block].call(ob) unless ob.nil? || field[:block].nil?\n f = field[:default] if f.nil? or f.to_s.size == 0\n f = f.to_s[0...field[:length]]\n f.ljust field[:length]\n end", "def inplace_editable_default_display_with(value); value; end", "def output\n val = parent.get(@value)\n if @blocks.has_key?(val)\n @blocks[val].output\n else\n @default.output\n end\n end", "def format(value, &block)\n if block_given?\n respond_to do |f|\n f.data { value }\n f.html do\n instance_exec(value, &block)\n end\n end\n else\n # Ruby Object#format exists.\n # We don't want to change the behaviour and overwrite it.\n super\n end\n end", "def display(row)\n field_components = @display_field.split(\".\")\n field_components.inject(row) do |object, field|\n object.try(field) || \"n/a\"\n end\n end", "def get_field_display_rtpl\n '{%=' + @model_name + '[:' + @name + ']%}'\n end", "def render_field_with_block(label, &block)\n content = with_output_buffer(&block)\n render_field_content(label, content)\n end", "def formatted_value\n return @value if @value.blank?\n\n set_type\n end", "def format_value(value)\n case value_format\n when Proc\n value_format.call(value)\n when nil\n value.to_f\n else\n value.send value_format\n end\n end", "def for_display_type display_type, &_block\n fields_for_type[display_type] ||= self.class.new\n\n fields_for_type[display_type].tap do |conf|\n yield(conf) if block_given?\n end\n end", "def value_for(**options)\n\t\t\t\t\tif value = raw_value_for(**options)\n\t\t\t\t\t\tself.format(value, **options)\n\t\t\t\t\tend\n\t\t\t\tend", "def format_null(params = {}, &block)\n component[:null_formatter] = (params[:using] or block)\n component[:null_formatter] ||= proc do |value|\n params[:with] % value\n end\n end", "def format(format, description, &block)\n @formats[format] = {\n :desc => description,\n :proc => block\n }\n end", "def render_column(record, column)\r\n # check for an override helper\r\n if column_override? column\r\n # we only pass the record as the argument. we previously also passed the formatted_value,\r\n # but mike perham pointed out that prohibited the usage of overrides to improve on the\r\n # performance of our default formatting. see issue #138.\r\n send(column_override(column), record)\r\n else\r\n value = record.send(column.name)\r\n if column.association.nil? or column_empty?(value)\r\n formatted_value = clean_column_value(format_column(value))\r\n else\r\n case column.association.macro\r\n when :has_one, :belongs_to\r\n formatted_value = clean_column_value(format_column(value.to_label))\r\n\r\n when :has_many, :has_and_belongs_to_many\r\n firsts = value.first(4).collect { |v| v.to_label }\r\n firsts[3] = '…' if firsts.length == 4\r\n formatted_value = clean_column_value(format_column(firsts.join(', ')))\r\n end\r\n end\r\n\r\n formatted_value\r\n end\r\n end", "def get_for_display(verse)\n self.class.format_for_display(super)\n end", "def edit_and_show_as(arg = nil, &proc) # :yields: field_def or nil\n edit_as(arg, &proc)\n show_as(arg, &proc)\n end", "def value\n View.format(value_or_resource, options, template, &block)\n end", "def formatter(value=nil,&block)\n if block_given?\n @formatter=Lolita::Support::Formatter.new(value,&block) \n elsif value || !@formatter\n if value.kind_of?(Lolita::Support::Formatter)\n @formatter=value\n else\n @formatter=Lolita::Support::Formatter::Rails.new(value)\n end\n end\n @formatter\n end", "def format(value = nil)\n if value.nil?\n @format ||= nil\n else\n @format = value\n end\n end", "def format_with_label(field, options, tag_output, &block)\n # see if we have an error on the field\n errors_on = object.send(:errors).send(:on, field)\n has_error = true unless errors_on.blank?\n\n # set field options\n options[:field] ||= {}\n options[:field].merge!(:has_error => has_error, :field_type => options[:field_type])\n\n # find label name\n label_name = options[:label] || field.to_s.humanize\n options[:separator] ||= default_separator\n label_name = \"#{label_name}#{options.delete(:separator)}\"\n \n # build output html\n output_html = @template.field_tag(options[:field], [\n @template.label(@object_name, field, label_name),\n tag_output,\n block_given? ? @template.capture(&block) : nil,\n @template.validation_tag(@object, field)\n ].compact.join(\"\\n\"))\n\n if block_given?\n # concat to page if block was given\n @template.concat(output_html)\n return nil\n else\n # otherwise return html directly\n return output_html\n end\n end", "def format(label, value)\n \" - #{label}: #{value}\"\n end", "def display_value(obj)\n case\n when obj && observed_name\n \"#{obj.name} (#{observed_name})\"\n when obj\n \"#{obj.name}\"\n when observed_name\n \"#{observed_name}\"\n else\n \"\"\n end\n end", "def format(format, &block)\n scope :format => format, &block\n end", "def get_display_field_header\n self.statement\n end", "def bp (name, value)\n if name != \"\" \n return \"\\n$bp-#{name} : #{value};\"\n else\n return \"\"\n end\nend", "def format_value(item, name)\n value = item.send(name)\n if item.class.reflections[name.gsub(/_id/,\"\").to_sym] && value\n obj = Object.const_get(item.class.reflections[name.gsub(/_id/,\"\").to_sym].class_name).find(value)\n value = (obj.respond_to? :to_label) ? (obj.to_label) : (obj.name)\n end\n value = image_tag( url_for_file_column(item, name, :absolute => true) ) if name.to_s.ends_with?(\"file_column\") && value\n return value ? value : \"---\"\n end", "def render_value(value, field:, **opt)\n if present? && object.field_names.include?(field)\n object[field] || EMPTY_VALUE\n end || super\n end", "def getPropertyStatementDisplay(statement, property_uri, property_domain_uri, property_range_uri, property_type, partial_name, property_template_name, property_collated_by_subclass = false)\n \n display_statement_values = \"\"\n # Data property default\n if(statement.has_key?(\"value\") and statement[\"value\"] != nil and statement[\"value\"].gsub(/\\s+/, \"\") != \"\")\n \n Rails.logger.debug(\"Property #{property_uri.inspect} and data PROP and partial not nil #{partial_name.inspect}\")\n display_statement_values= render(partial: partial_name, locals: {statement: statement,\n property_uri: property_uri,\n property_domain_uri: property_domain_uri,\n property_range_uri: property_range_uri,\n property_type: property_type, property_template_name: property_template_name})\n \n \n \n \n end #if statement.has_key\n # if object, we may be in for a different situation\n if(property_type == \"object\" and statement.has_key?(\"allData\")) \n # Print out all the data\n display_statement_values = render(partial: partial_name, locals: {statement: statement,\n property_uri: property_uri,\n property_domain_uri: property_domain_uri,\n property_range_uri: property_range_uri,\n property_type: property_type, property_template_name: property_template_name, property_collated_by_subclass: property_collated_by_subclass})\n \n end\n \n return display_statement_values\n end", "def display(format, show_description:)\n @genre.display() if show_description\n super(format) # Invoke display method in Collection, \n # explicitly passing it the format argument \n end", "def show_as(*args, &proc)\n # RAILS_DEFAULT_LOGGER.debug('set show_as proc to ' + proc.inspect)\n opts = (args.last.is_a?(Hash) && args.pop) || {}\n if opts[:show_wrap_proc]\n if opts[:show_wrap_proc].is_a?(Proc)\n self.show_wrap_proc = opts[:show_wrap_proc]\n end\n else\n self.show_wrap_proc = nil\n end\n if block_given?\n self.show_as_proc = proc\n else\n if args.first\n self.show_as_proc = Proc.new do\n args.first.to_s\n end\n end\n end\n end", "def render_block(block)\n block.map do |prop, value|\n render_property prop, value\n end.join('')\n end", "def show_value_label_method\n value.to_s\n end", "def display\n\t\tname\n\tend", "def display\n\t\tname\n\tend", "def display\n\t\tname\n\tend", "def display\n\t\tname\n\tend", "def display(&block)\n raise \"block required\" unless block_given?\n @display_callbacks ||= []\n @display_callbacks << block\n end", "def show_field(model, field, label = nil)\n label ||= field.to_s.titlecase\n show_value(model.send(field), label)\n end", "def format_string(record, attribute, val)\n val\n end", "def format_str(value)\n value ||= '<none>'\n fmt ? (fmt % [value]) : value\n end", "def pretty_print(pp)\n pp.group(1) do\n fields_desc.each do |field|\n val = self.send(field[0])\n unless (val.respond_to?(:blank?) and val.blank?) or val.nil? or val == ''\n pp.breakable\n pp.text(field[0].to_s+':')\n pp.pp(val)\n end\n end\n end\n end", "def display\n # If the DUT responds to a sub_block \"display\" return the sub_block\n if model.sub_blocks.include? 'display'\n Origen.log.debug \"Found a sub_block \\'display\\', passing control to the #{model.class}...\"\n model.sub_blocks['display']\n else\n # Else, pass control to the ruby core.\n super\n end\n end", "def format_as_block_html(name, attr, body, indent); end", "def handle_blank(value)\n if value.present?\n if block_given?\n yield\n else\n value.to_s\n end\n else\n h.raw('<span class=\"metadata\">not available</span>')\n end\n end", "def format _label, _value\n raise NotImplementedError, self\n end", "def show_value\n return @show_value\n end", "def formatted_value\n @formatted_value\n end", "def display_for(doc, field)\n highlights_for(doc['unique_id'], field) || doc[field]\n end", "def format_for_inspect(name, value)\n if value.nil?\n value.inspect\n else\n inspected_value =\n case value\n when Date, Time then %Q(\"#{value.to_s(:inspect)}\")\n else value.inspect\n end\n # noinspection RubyMismatchedReturnType\n inspection_filter.filter_param(name, inspected_value)\n end\n end", "def format_range_display_value(value)\n if view_context.method(:format_range_display_value).owner == RangeLimitHelper\n value\n else\n Deprecation.warn(BlacklightRangeLimit, 'Helper method #format_range_display_value has been overridden; implement a custom FacetItemPresenter instead')\n view_context.format_range_display_value(value, key)\n end\n end", "def display_field(field, depth = 0, parents = [])\n my_parents = parents.dup\n field_str = ''\n name = field[:name]\n if field[:class] == BinData::Array\n field_str = \"\\n\" + (\"\\t\" * depth) + name.to_s.upcase\n parent = self\n my_parents.each do |pfield|\n parent = parent.send(pfield)\n end\n array_field = parent.send(name)\n field_str << process_array_field(array_field, (depth + 1))\n else\n if my_parents.empty?\n label = \"\\n\" + (\"\\t\" * depth) + name.to_s.upcase\n if field[:class].ancestors.include? BinData::Record\n field_str = label\n else\n value = send(name)\n field_str = format '%-30s %s', label, value\n end\n else\n parent = self\n my_parents.each do |pfield|\n parent = parent.send(pfield)\n end\n value = parent.send(name)\n label = field[:label] || name.to_s.capitalize\n label = \"\\n\" + (\"\\t\" * depth) + label\n field_str = format '%-30s %s', label, value\n end\n end\n my_parents << name\n field[:fields].each do |sub_field|\n field_str << display_field(sub_field, (depth + 1), my_parents)\n end\n field_str\n end", "def display\n @attributes[:display]\n end", "def _PreformattedBlock\n\n _save = self.pos\n while true # choice\n _tmp = apply(:_PreformattedBlockComplex)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_PreformattedBlockSimple)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_PreformattedBlockFence)\n break if _tmp\n self.pos = _save\n break\n end # end choice\n\n set_failed_rule :_PreformattedBlock unless _tmp\n return _tmp\n end", "def render_document_show_field_value *args\n render_field_value(*args)\n end", "def display_name\n temp = display_number\n if !name.blank?\n temp += ': ' + name\n end\n return temp\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 block_name\n if @split_across\n if @block_method == :count\n \"Block #{@block_num}/#{@num_blocks} (across dataset)\"\n else\n \"Block #{@block_num} of #{@block_size} words (across dataset)\"\n end\n else\n if @block_method == :count\n \"Block #{@block_num}/#{@num_blocks} (within \\\"#{@current_doc.title}\\\")\"\n else\n \"Block #{@block_num} of #{@block_size} words (within \\\"#{@current_doc.title}\\\")\"\n end\n end\n end", "def register_formatter(name, &block)\n Valuable::Utils.formatters[name] = block\n end", "def display\n puts \" 0 1 2 3 4 5 6 7 \"\n puts \"#{format}\"\n end", "def document_show_field_label(document, field)\n lookup_display_name(document, field) || super\n end", "def format=(procedure); end", "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 scaffold_default_field_wrapper\n Proc.new{|label, tag| \"<tr><td>#{label}</td><td>#{tag}</td></tr>\\n\"}\n end", "def the_field(field_key, default_val = '')\n h.do_shortcode(object.get_field(field_key, default_val).to_s.translate(@_deco_locale), object)\n end", "def display_item_value(item, data_item)\n if data_item.list_preview_handler.nil?\n value = item.send(data_item.list_preview_accessor)\n return display_upload_item(value) if data_item.has_uploader?\n return display_related_item(data_item, item, value) if data_item.has_relation?\n else\n value = data_item.list_preview_handler.call(item)\n end\n return display_boolean_item(value) if !!value == value\n value.to_s.html_safe\n end", "def show_val(value,\n str_if_empty='____',\n value_style='form_data',\n prefix='',\n suffix='',\n prefix_style='field_label')\n value_style = 'form_data' if value_style.blank?\n isblank = value.blank?\n if isblank && str_if_empty=='suppress'\n return ''\n end\n value = str_if_empty if isblank\n s = ''\n s << \"<span class='#{prefix_style}'>\" + prefix + \"</span>\" unless prefix.blank?\n s << \"<span class='#{value_style}'>#{value}</span>\"\n if (!isblank) && (!suffix.blank?) && (suffix != value.to_s[-1,1])\n s << suffix\t#\tAppend suffix if it not already the last character in the string (e.g., avoids double periods)\n end\n return s.html_safe\n end", "def attribute_show_value(params)\n column = param(params, :name)\n item = param(params, :item)\n\n if column && item\n type = param(params,:type,(item.attributes.include?(column.to_s) ? item.column_for_attribute(column).type : \"other\").to_s).to_s\n type = \"other_record\" if type == \"other\" && item.respond_to?(column.to_s + \"_id\")\n return case type\n when 'boolean' then item.send(attribute_name(params)) ? image_tag(\"/autocrud/images/tick.png\", :alt => t('true'), :title => t('true')) : image_tag(\"/autocrud/images/cross.png\", :alt => t('false'), :title => t('false'))\n when 'custom' then send(@singular.underscore+\"_\"+column.to_s+\"_show_value\".to_s, item)\n when 'other_record' then item.send(column).to_s\n when 'date' then item.send(attribute_name(params)) ? item.send(attribute_name(params)).strftime(\"%d-%m-%Y\") : \"\"\n when 'time' then item.send(attribute_name(params)) ? item.send(attribute_name(params)).strftime(\"%H:%M\") : \"\"\n when 'datetime' then item.send(attribute_name(params)) ? l(item.send(attribute_name(params))) : \"\"\n when 'paperclip' then item.send(column.to_s+'?') ? image_tag(item.send(column.to_s, param(params, :size))) : \"-\"\n when 'currency' then number_to_currency(item.send(attribute_name(params)).to_f, :format => \"<span class='currency_show_symbol'>%u</span><span class='currency_show_value'>%n</span>\")\n when 'percentage' then number_to_percentage(item.send(attribute_name(params)).to_f)\n when 'ckeditor' then content_tag(\"span\", item.send(attribute_name(params)), :class => 'ckdata')\n when 'select' then \n values = param(params,:select).collect{|element| element.is_a?(Array) && element.length == 2 ? element : [element.to_s, element.to_s]}.collect{|element| element[1] == item.send(attribute_name(params)).to_s ? element[0] : nil}.compact\n values.length > 0 ? values.first : item.send(attribute_name(params)).to_s\n else class_exists?('Lico::AutoCrud::Types::' + type.classify) ? get_class('Lico::AutoCrud::Types::' + type.classify).to_show_value(item, attribute_name(params)) : (item_raw_value(item, params) || \"\")\n end\n\t\t\t\telse\n \treturn ''\n\t\t\t\tend\n end", "def print_value\n\t\t\treturn @value\n\t\tend", "def print_value\n\t\t\treturn @value\n\t\tend", "def display_value\n case self.value_type\n when 'Numeric'\n unless self.multiplier.nil? || self.multiplier.blank?\n \"#{self.value} #{self.multiplier}(s) <span class='badge'>#{self.convert_value_by_type} bytes</span>\"\n else\n self.value\n end\n when 'Boolean'\n self.value == '1' ? 'Yes' : 'No'\n else\n self.value\n end\n end", "def format\n display_name = if @display_name.nil?\n\t\t nil\n\t\t elsif @display_name =~ /^[-\\/\\w=!#\\$%&'*+?^`{|}~ ]+$/\n\t\t @display_name\n\t\t else\n\t\t '\"' + @display_name.gsub(/[\"\\\\]/, '\\\\\\\\\\&') + '\"'\n\t\t end\n local = if (@local !~ /^[-\\w=!#\\$%&'*+?^`{|}~\\.\\/]+$/ ||\n\t\t @local =~ /^\\./ ||\n\t\t @local =~ /\\.$/ ||\n\t\t @local =~ /\\.\\./)\n\t\t'\"' + @local.gsub(/[\"\\\\]/, '\\\\\\\\\\&') + '\"'\n\t else\n\t\t@local\n\t end\n domain = if (!@domain.nil? and\n\t\t (@domain !~ /^[-\\w=!#\\$%&'*+?^`{|}~\\.\\/]+$/ ||\n\t\t @domain =~ /^\\./ ||\n\t\t @domain =~ /\\.$/ ||\n\t\t @domain =~ /\\.\\./))\n\t then\n\t\t '[' + if @domain =~ /^\\[(.*)\\]$/\n\t\t\t $1\n\t\t else\n\t\t\t @domain\n\t\t end.gsub(/[\\[\\]\\\\]/, '\\\\\\\\\\&') + ']'\n\t else\n\t\t @domain\n\t end\n address = if domain.nil?\n\t\t local\n\t\telsif !display_name.nil? or domain[-1] == ?]\n\t\t '<' + local + '@' + domain + '>'\n\t\telse\n\t\t local + '@' + domain\n\t\tend\n comments = nil\n comments = unless @comments.nil?\n\t\t @comments.collect { |c|\n\t '(' + c.gsub(/[()\\\\]/, '\\\\\\\\\\&') + ')'\n\t}.join(' ')\n\t\t end\n [display_name, address, comments].compact.join(' ')\n end", "def format_symbol\n\t\t:format\n\tend", "def formatted(field, wrap_in = :span)\n value = value_for(field)\n options = @options[field]\n\n if value.blank?\n # If the field is blank, we want to return _unless_ the field is the\n # right subtitle, and a right title is set (in which case a title\n # element is needed to push the subtitle down).\n if field != :right_title || value_for(:right_subtitle).blank?\n return nil\n else\n value = '&nbsp;'\n options[:no_escape] = true\n end\n end\n\n # Escape required?\n unless options.delete(:no_escape)\n value = Merb::Parse.escape_xml(value)\n end\n\n # Link required?\n if options.has_key?(:link)\n value = %[<a href=\"#{options.delete(:link)}\"] +\n %[ title=\"#{value}\">#{value}</a>]\n end\n\n # Set the CSS class.\n if options[:class]\n options[:class] = [options[:class], CSS_CLASSES[field]].join(' ')\n elsif CSS_CLASSES[field] != ''\n options[:class] = CSS_CLASSES[field]\n end\n\n tag(wrap_in, value, options)\n end", "def render_field(label, value)\n render_field_content(label, (h value))\n end", "def format_field(f, row)\n if respond_to?(\"format_#{f}\")\n send(\"format_#{f}\", row)\n else\n row[f].to_s\n end\n end", "def full_display\n if displayName.blank? || netid.blank?\n short_display\n else\n \"#{displayName} (#{netid})\"\n end\n end", "def full_title(field = nil)\n field && find_record_value(field) || super()\n end", "def field_block(cols = 2, &block)\n css_class = \"float_left\"\n css_class << \"_#{cols}\" unless cols == 2\n concat('<div class=\"'+ css_class +'\">', block.binding)\n yield\n concat('</div>', block.binding)\n concat('<div style=\"clear:both;\"></div>', block.binding)\n end", "def print_value\n\t\treturn @value\n\tend", "def print(label, value)\n printf \"%-25s %s\\n\", \" - #{label}:\", value\n end", "def render_display_link args\n label = blacklight_config.display_link[args[:field]][:label]\n links = args[:value]\n #Rails.logger.debug(\"es287_debug #{__FILE__}:#{__LINE__} links = #{links.inspect}\")\n links ||= args[:document].fetch(args[:field], :sep => nil) if args[:document] and args[:field]\n #Rails.logger.debug(\"es287_debug #{__FILE__}:#{__LINE__} links = #{links.inspect}\")\n render_format = args[:format] ? args[:format] : 'default'\n\n value = links.map do |link|\n #Check to see whether there is metadata at the end of the link\n url, *metadata = link.split('|')\n if links.size == 1 && render_format == 'url'\n return url.html_safe\n end\n if metadata.present?\n label = metadata[0]\n end\n link_to(process_online_title(label), url.html_safe, {:class => 'online-access', :onclick => \"javascript:_paq.push(['trackEvent', 'itemView', 'outlink']);\"})\n end\n\n #Rails.logger.debug(\"es287_debug #{__FILE__}:#{__LINE__} field = #{args[:field].inspect}\")\n #Rails.logger.debug(\"es287_debug #{__FILE__}:#{__LINE__} render_format = #{render_format.inspect}\")\n #Rails.logger.debug(\"es287_debug #{__FILE__}:#{__LINE__} value = #{value.inspect}\")\n if render_format == 'raw'\n return value\n else\n case args[:field]\n when'url_findingaid_display'\n return value[0]\n when 'url_bookplate_display'\n Rails.logger.debug(\"es287_debug #{__FILE__}:#{__LINE__} field = #{args[:field].inspect}\")\n return value.uniq.join(',').html_safe\n when 'url_other_display'\n return value.join('<br>').html_safe\n else\n fp = Blacklight::FieldPresenter.new( self, args[:document], blacklight_config.show_fields[args[:field]], :value => label)\n fp.render\n end\n end\n end", "def format_string(val, istruct, width = nil)\n val = istruct.nil_text if val.nil?\n val =\n case istruct.case\n when :lower\n val.downcase\n when :upper\n val.upcase\n when :title\n # Note: fat_core entitle keeps all uppercase words as upper case,\n val.downcase.entitle\n when :none\n val\n end\n if width && aligned?\n pad = width - width(val)\n case istruct.alignment\n when :left\n val += ' ' * pad\n when :right\n val = ' ' * pad + val\n when :center\n lpad = pad / 2 + (pad.odd? ? 1 : 0)\n rpad = pad / 2\n val = ' ' * lpad + val + ' ' * rpad\n else\n val = val\n end\n val = ' ' + val + ' '\n end\n val\n end", "def field_value(field)\n field_config = blacklight_config.show_fields[field]\n Blacklight::ShowPresenter.new(@document, self).field_value field_config\n end", "def initialize(template, field, value, &block)\n @field = field\n @value = value\n @template = template\n if @block = block\n to_s # render when block passed in <% ... %> tags\n end\n end", "def format_string(val, istruct, width = nil)\n val = istruct.nil_text if val.nil?\n val =\n case istruct.case\n when :lower\n val.downcase\n when :upper\n val.upcase\n when :title\n # Note: fat_core entitle keeps all uppercase words as upper case,\n val.downcase.entitle\n when :none\n val\n end\n if width && aligned?\n pad = [width - width(val), 0].max\n case istruct.alignment\n when :left\n val += ' ' * pad\n when :right\n val = ' ' * pad + val\n when :center\n lpad = pad / 2 + (pad.odd? ? 1 : 0)\n rpad = pad / 2\n val = ' ' * lpad + val + ' ' * rpad\n else\n val = val\n end\n val = ' ' + val + ' '\n end\n val\n end", "def format_value(prop,value)\n case prop\n when :plan_id\n case value\n when 'free' then 'Free'\n when 'silver' then 'Silver'\n else value && value.capitalize || nil\n end\n when :visible_to_ssh?\n value || nil\n when :creation_time, :created_at\n date(value)\n when :scales_from,:scales_to\n (value == -1 ? \"available\" : value)\n when :gear_info\n format_gear_info(value)\n when :base_gear_storage,:additional_gear_storage\n ((value.nil? or value == 0) ? \"None\" : \"#{value}GB\")\n when :aliases\n value.kind_of?(Array) ? value.join(', ') : value\n when :expires_in_seconds\n distance_of_time_in_words(value)\n when :activations\n value.collect{|item| date(item.created_at.to_s)}.join(\"\\n\")\n when :auto_deploy\n value ? 'auto (on git push)' : \"manual (use 'rhc deploy')\"\n else\n case value\n when Array then value.empty? ? '<none>' : value.join(', ')\n else value\n end\n end\n end" ]
[ "0.67699414", "0.6548284", "0.64155734", "0.6355904", "0.6308477", "0.6200092", "0.61819214", "0.60970324", "0.6069356", "0.5991577", "0.5970047", "0.59550935", "0.59262466", "0.5898025", "0.57645", "0.5736172", "0.5714861", "0.5695842", "0.56460404", "0.56246173", "0.5588536", "0.55795723", "0.5556618", "0.5554238", "0.55324614", "0.5509182", "0.5502331", "0.54799056", "0.5432453", "0.54286385", "0.5412497", "0.53887314", "0.53842", "0.53761476", "0.53714013", "0.5370229", "0.5349771", "0.5348969", "0.53486156", "0.5342404", "0.5332347", "0.533132", "0.5328319", "0.5318975", "0.53159094", "0.5313938", "0.5308193", "0.5308193", "0.5308193", "0.5308193", "0.5301259", "0.52934897", "0.5288023", "0.52800417", "0.52762944", "0.52680326", "0.5260527", "0.52483165", "0.52257276", "0.521961", "0.5208903", "0.52081436", "0.5204848", "0.5204126", "0.52003527", "0.5199535", "0.51989484", "0.51980287", "0.519056", "0.51776814", "0.51705605", "0.5165473", "0.51607907", "0.5158255", "0.5153698", "0.5143807", "0.51430035", "0.5127867", "0.51269895", "0.51196504", "0.5108586", "0.51062566", "0.51062566", "0.5104147", "0.5102275", "0.51016176", "0.50988394", "0.5080761", "0.507998", "0.5075226", "0.5071768", "0.5066927", "0.5062958", "0.5059112", "0.505564", "0.5051687", "0.5048055", "0.50467765", "0.5045494", "0.5041702" ]
0.7153447
0
give me a block that describes how to retrieve the value for the named field from a given entity If you call me wthout a block, I will return either the last block you send me, or the default reader_proc Block should take 1 arg (being the entity) and return the value retrieved default proc just assumes there is a method with the same name as field_name on the entity
def reader_proc(&block) #defined by default_for_proc_type in initialize! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def field name\n f = fields.find { |fld| fld.name == name.to_s }\n return nil if f.nil?\n yield f if block_given?\n f\n end", "def get_field(field_name)\n\t\tend", "def fetch_field(expected_key = nil, &block)\n find_field(expected_key, &block) ||\n (raise FieldNotFound,\n \"no such field `#{expected_key}` for #{self}.\")\n end", "def dynamic_getter(name)\n field = self.content_type.find_field(name)\n value = self.localized_dynamic_attribute_value(field)\n\n case field.type\n when :date, :date_time\n value.is_a?(String) ? Chronic.parse(value) : value\n when :file\n value.present? ? { 'url' => value } : nil\n when :belongs_to\n field.klass.find_entry(value)\n when :has_many\n field.klass.find_entries_by(field.inverse_of, [self._label, self._permalink])\n when :many_to_many\n field.klass.find_entries_among(value)\n else\n # :string, :text, :select, :boolean, :email, :integer, :float, :tags\n value\n end\n end", "def field_reader(name)\n class_eval <<-READER\n def #{name}\n @#{name} ||= fields[:#{name}].default\n end\n READER\n end", "def read_field\n end", "def fetch\n if raw\n field_config.accessor ? retieve_using_accessor : retrieve_simple\n else\n super\n end\n end", "def get_field(field_name)\n fields = @data_source['fields']\n \n fields.each do | f |\n if f['name'] == filed_name\n return f\n end\n end \n return nil\n end", "def find_field(expected_key = nil, &block)\n if block_given?\n each_field do |key, field|\n return field if block.call(key, field)\n end\n else\n each_field do |key, field|\n return field if expected_key == key\n end\n end\n nil\n end", "def field(*args_or_name, block)\n def_args = extract_definition_args(args_or_name)\n require_arg def_args, :name\n\n return unless check_when(def_args, @current_source)\n return unless version_wanted(def_args)\n\n value = field_value(def_args, block)\n # Rails.logger.debug \"Field #{def_args[:name]} <= #{value} current_source=#{@current_source}\"\n put_field def_args[:name], value\n end", "def getter\r\n @getter ||= Field.getter(@name)\r\n end", "def field(p,field_name)\n f = p.fields.find {|f| f.name == field_name}\n if f.nil? then\n return nil\n else\n return f.value\n end\nend", "def create_field_getter(name, meth, field)\n generated_methods.module_eval do\n define_method(\"#{ meth }\") do\n value = instance_variable_get \"@#{ name }\"\n value.nil? ? field.default_val : value\n end\n end\n end", "def field(name); end", "def read_metadata_field(field_name)\n @client.get(\"#{metadata_path}/#{field_name}\")\n end", "def get_field(name)\n self[name]\n end", "def fetch_field\n return nil if @field_index >= @fields.length\n ret = @fields[@field_index]\n @field_index += 1\n ret\n end", "def get_field(tag_or_name)\n self.class.get_field(tag_or_name)\n end", "def get_field(tag_or_name)\n self.class.get_field(tag_or_name)\n end", "def read(name, &block)\n reader = readers[name]\n\n if block\n yield(reader)\n else\n reader\n end\n end", "def get_field_by_name(name)\n self.class.get_field_by_name(name)\n end", "def get_field_by_name(name)\n self.class.get_field_by_name(name)\n end", "def [](field_name)\n f = field(field_name)\n f && f.value\n end", "def semantic_fields_for(record_or_name_or_array, *args, &block)\n fields_for(record_or_name_or_array, *args, &block)\n end", "def semantic_fields_for(name, *args, &block)\n use_semantic_builder(:fields_for, name, *args, &block)\n end", "def param(field_name, param_name, default = nil)\n if field?(field_name)\n params = params_quoted(field_name)\n value = params[param_name]\n return Utils.unquote(value) if value\n end\n if block_given?\n yield field_name, param_name\n else\n default\n end\n end", "def fetch name\n raise \"ERROR: Field with name #{name} does not exist!\" if !@format[name]\n @format[name]\n end", "def get_field(parent_type, field_name)\n with_definition_error_check do\n parent_type_name = case parent_type\n when GraphQL::BaseType\n parent_type.name\n when String\n parent_type\n else\n raise \"Unexpected parent_type: #{parent_type}\"\n end\n\n defined_field = @instrumented_field_map[parent_type_name][field_name]\n if defined_field\n defined_field\n elsif parent_type == query && (entry_point_field = introspection_system.entry_point(name: field_name))\n entry_point_field\n elsif (dynamic_field = introspection_system.dynamic_field(name: field_name))\n dynamic_field\n else\n nil\n end\n end\n end", "def get_field(parent_type, field_name)\n with_definition_error_check do\n parent_type_name = case parent_type\n when GraphQL::BaseType, Class, Module\n parent_type.graphql_name\n when String\n parent_type\n else\n raise \"Unexpected parent_type: #{parent_type}\"\n end\n\n defined_field = @instrumented_field_map[parent_type_name][field_name]\n if defined_field\n defined_field\n elsif parent_type == query && (entry_point_field = introspection_system.entry_point(name: field_name))\n entry_point_field\n elsif (dynamic_field = introspection_system.dynamic_field(name: field_name))\n dynamic_field\n else\n nil\n end\n end\n end", "def method_missing method, *args, &block\n self.class.send(:define_method, method) do \n return @fields[method.to_sym]\n end\n self.send method, *args, &block\n end", "def get_field_value(data, field_name)\n data[field_name]['__content__'] if data[field_name]\n end", "def get(field)\n self.class.get(field, @data)\n end", "def get_field(tag_or_name)\n case tag_or_name\n when Integer then get_field_by_tag(tag_or_name)\n when String, Symbol then get_field_by_name(tag_or_name)\n else raise TypeError, tag_or_name.class\n end\n end", "def _read_attribute(attr_name, &block) # :nodoc:\n @attributes.fetch_value(attr_name, &block)\n end", "def get_value(field)\n field = item_type.find_field(field) unless field.is_a? Field\n field.value_for_item(self)\n end", "def imported_field_value(field)\n resource.try(field) || resource.try(:primary_imported_metadata)&.[](field) || parent_resource&.try(field) || parent_resource&.try(:primary_imported_metadata)&.[](field)\n end", "def value(serializer)\n if block\n serializer.instance_eval(&block)\n else\n serializer.read_attribute_for_serialization(name)\n end\n end", "def getFieldValue( name , formName = \"\" , frameName = \"\" )\n # returns the current value of the field\n \n fname = getFunctionName()\n log fname + ' Starting. getting value for field with name: ' + name if $debuglevel >=0\n\n begin # if there are 2 elements with the same name, we get an exception - so we need a different version of this method\n\n container = getObjectContainer( name , formName , frameName )\n\n o = nil\n v = \"\"\n container.all.each do |c|\n next unless o == nil\n begin\n if c.name.to_s == name \n #log 'Hack:: found the object. '\n o = c\n end\n rescue\n # probably no name\n end\n end\n if o != nil\n v = o.value.to_s\n else\n v = nil\n end\n\n rescue => e\n showException(e)\n v = nil \n end \n return v\n \n end", "def fields_for(record_name, record_object = T.unsafe(nil), fields_options = T.unsafe(nil), &block); end", "def field_fetch(tag, skip = 0)\n unless @data[tag]\n @data[tag] = fetch(tag, skip)\n end\n return @data[tag]\n end", "def custom_reader(key)\n value = regular_reader(convert_key(key))\n yield value if block_given?\n value\n end", "def get(*nested_field_names, &b)\n if nested_field_names.size == 1\n field_name = nested_field_names.first\n field = self.class.field_for_name(field_name)\n raise ArgumentError.new unless field\n unless self.value_for_tag?(field.tag)\n return b ? b.call : nil\n end\n return self.value_for_tag(field.tag)\n end\n last_proto = nested_field_names[0..-2].inject(self) do |sub_proto, ifield_name|\n sub_field = sub_proto.class.field_for_name(ifield_name)\n raise ArgumentError.new unless sub_field\n raise ArgumentError.new unless sub_field.is_a?(ProtocolBuffers::Field::MessageField)\n unless sub_proto.value_for_tag?(sub_field.tag)\n return b ? b.call : nil\n end\n sub_proto.value_for_tag(sub_field.tag)\n end\n last_field_name = nested_field_names.last\n last_field = last_proto.class.field_for_name(last_field_name)\n unless last_proto.value_for_tag?(last_field.tag)\n return b ? b.call : nil\n end\n last_proto.value_for_tag(last_field.tag)\n end", "def read\n value = record.send(\"#{name}_data\")\n value unless value.nil? || value.empty?\n end", "def method_field(name)\n self.method_fields.where(fieldable_id: self.id).where(\"payload->>'key' = ?\", name).first\n end", "def field name\n @fields[name]\n end", "def define_getter_for(name)\n define_method(\"#{name}\") do\n instance_variable_get(\"@#{name}\") or\n instance_variable_set(\"@#{name}\", deserialize(name)) or\n instance_variable_set(\"@#{name}\", load_associated(name))\n end\n end", "def read_attribute_with_dynamo(field_name)\n field_name = field_name.to_s\n if is_dynamo_field?(field_name)\n \n # If the model's id is nil then we know there aren't going to be any values to read.\n # example: If this is a supplier model and we are creating a new supplier at this point its id is nil\n # Because of this fact we know there are no dynamo_field_values associated with it so return.\n # If we didn't return here then when checking for values we would create extra queries.\n # Any time we do a df.dynamo_field_values we create overhead so we only want to do that when we have to.\n return if self.id == nil\n \n # We're doing a real read now so get the dynamo_field from the cache then query to get the correct value.\n dynamo_field = cached_dynamo_field_by_name(field_name)\n \n # Get all the dynamo field values for this model from the cache.\n dynamo_field_value = cached_dynamo_field_values.detect{|dyn_field_val| dyn_field_val.dynamo_field_id == dynamo_field.id && dyn_field_val.model_id == self.id }\n \n return nil if dynamo_field_value.blank?\n return dynamo_field_value.send(dynamo_field.field_type)\n end\n # If its a 'normal' attribute let rails handle it in its usual way\n read_attribute_without_dynamo(field_name)\n end", "def general_field(name)\n self.general_fields.where(fieldable_id: self.id).where(\"payload->>'key' = ?\", name).first\n end", "def fields_for(record_name, record_object = T.unsafe(nil), options = T.unsafe(nil), &block); end", "def field(identifier)\n ensure_loaded do\n fields.each do |f|\n return f if f.identifier == identifier\n end\n end\n \n nil\n end", "def read_attr(name, record=false)\n result =\n case value = instance_variable_get(\"@#{name}\")\n when nil\n yield if block_given?\n when Proc\n value.to_proc.call(self)\n else\n value\n end\n instance_variable_set(\"@#{name}\", result) if record\n result\n end", "def gen_field(name)\n ar_class = name.camelize.constantize\n graphql_type = \"Types::#{name.camelize}Type\".constantize\n\n field name.to_sym do\n type graphql_type\n argument :id, types.ID, \"Get one #{ar_class} by id\"\n description \"Find one #{ar_class}\"\n resolve ->(_obj, args, _ctx) do\n ar_class.find(args['id']) if args['id']\n end\n complexity ->(_ctx, _args, child_complexity) do\n (BASE * 25) + (child_complexity > 1 ? child_complexity : 1)\n end\n end\n\n field name.pluralize.to_sym do\n type types[graphql_type]\n argument :ids, types[types.ID], 'A list of Metasmoke IDs'\n argument :last, types.Int, \"Last n items from selection. Can be used in conjunction with any other options except 'first'\"\n argument :first, types.Int, \"First n items from selection. Can be used in conjunction with any other options except 'last'\"\n argument :offset, types.Int, 'Number of items to offset by. Offset counted from start unless ' \\\n \"the 'last' option is used, in which case offset is counted from the end.\", default_value: 0\n description \"Find multiple #{ar_class.to_s.pluralize}. Maximum of 200 returned.\"\n resolve ->(_obj, args, _ctx) do\n things = ar_class.all\n things = things.where(id: args['ids']) if args['ids']\n return GraphQL::ExecutionError.new(\"You can't use 'last' and 'first' together\") if args['first'] && args['last']\n things = things.offset(args['offset']).first(args['first']) if args['first']\n things = things.reverse_order.offset(args['offset']).first(args['last']) if args['last']\n things = things.limit(200) if things.respond_to? :limit\n Array(things)\n end\n complexity ->(_ctx, args, child_complexity) do\n children = 0\n children += args['ids'].length if args['ids']\n children += (args['last'] || args['first'] || 0)\n children = 200 if children == 0\n (BASE * 25) + children * (child_complexity > 1 ? child_complexity : 1)\n end\n end\n end", "def get_field_value(obj, name)\n begin\n @struct_field_getter.call(obj, name)\n rescue\n 0\n end\n end", "def field_by_name(name = nil)\n @fields.find { |h| h[:name].to_snym == name.to_snym }\n end", "def fetch(*args, &block)\n if(block_given?)\n default_value = block\n elsif(args.size > 1)\n default_value = args.pop\n elsif(args.size < 1)\n raise ArgumentError,\n \"Default value must be provided for #fetch\"\n end\n result = retrieve(*args)\n if(result == NO_VALUE)\n block_given? ? default_value.call(self) : default_value\n else\n result\n end\n end", "def fetch\n if raw\n values = Array.wrap(super)\n (field =~ /_[a-z]$/) ? values : values.first\n else\n super\n end\n end", "def fieldBoost field\n f = self.get(field)\n if f\n return f.getBoost\n else\n return nil\n end\n end", "def range_getter(name, json_field = nil)\n if json_field\n lambda { |r| Marty::Util.pg_range_to_human(r.send(json_field)[name]) }\n else\n lambda { |r| Marty::Util.pg_range_to_human(r.send(name)) }\n end\n end", "def get_coll_field_val(fedora_obj, desired_field)\n if (desired_field.is_a?(String))\n desired_field = desired_field.to_sym\n end\n if (fedora_obj.collections.size > 0)\n coll_obj = HypatiaCollection.load_instance(fedora_obj.collections[0].pid)\n return get_values_from_datastream(coll_obj, \"descMetadata\", desired_field).first\n elsif (fedora_obj.sets.size > 0)\n # we can load the parent object as a set because we are only going to check \"collections\" and \"sets\"\n return values = get_coll_field_val(HypatiaSet.load_instance(fedora_obj.sets[0].pid), desired_field)\n end\n return \"\"\n end", "def field\n @field ||= quoted_field(field_name)\n end", "def [](field_name)\n get(field_name)\n end", "def get(name)\n if @fields.has_key?(name.lexeme)\n @fields[name.lexeme]\n else\n method = @klass.find_method name.lexeme\n unless method.nil?\n method.bind self\n else\n message = \"Undefined property '#{name.lexeme}'.\"\n raise LoxRuntimeError.new(name, message)\n end\n end\n end", "def field_locator(name)\n locator_by_type(:field, name)\n end", "def read_attribute(attr_name, &block)\n name = attr_name.to_s\n name = self.class.attribute_aliases[name] || name\n\n return @attributes.fetch_value(name, &block) unless name == \"id\" && @primary_key\n\n if self.class.composite_primary_key?\n @attributes.fetch_value(\"id\", &block)\n else\n if @primary_key != \"id\"\n ActiveRecord.deprecator.warn(<<-MSG.squish)\n Using read_attribute(:id) to read the primary key value is deprecated.\n Use #id instead.\n MSG\n end\n @attributes.fetch_value(@primary_key, &block)\n end\n end", "def record name, description: nil, mode: nil\n record_check!\n\n # TODO: do we need to raise if no block was given?\n raise ArgumentError, \"a block is required\" unless block_given?\n\n nested_field = add_field name, :record, description: description, mode: mode\n yield nested_field\n nested_field\n end", "def valGetter\n \"#{DataMetaDom.getterName(@fld)}()\" + ( isMapping ? '.getKey()' : '')\n end", "def process record\n yield get(self.part, record)\n end", "def get(field)\n @dataset.get(field)\n end", "def get_field(field_name)\n fields[field_name] || interface_fields[field_name]\n end", "def field\n @field ||= @options.fetch(:field, repository.adapter.field_naming_convention.call(name))\n end", "def fields_for(record_or_name_or_array, *args, &block)\n raise ArgumentError, \"Missing block\" unless block_given?\n options = args.extract_options!\n \n case record_or_name_or_array\n when String, Symbol\n object_name = record_or_name_or_array\n object = args.first\n else\n object = record_or_name_or_array\n object_name = ActionController::RecordIdentifier.singular_class_name(object)\n end\n \n builder = options[:builder] || ActionView::Base.default_form_builder\n # to_s is required because capture result might be buffer object (which is not necessarily a string)\n result = capture(builder.new(object_name, object, self, options, block), &block).to_s\n \n if block_called_from_erb?(block)\n concat result\n else\n result\n end\n \n end", "def field(name, options={}, &blk)\n slice(name, {:count=>1, :collapse=>true}.merge(options), &blk)\n end", "def get_object_value(object, fieldname)\n # first, attempt to split the fieldname based on the '.' character\n # (if it exists in the string)\n dot_split = fieldname.split('.')\n if dot_split.size > 1\n # if it's a dot-separated form, then drill down until we find the\n # value that the dot-separated form refers to and return that value\n value = object\n prev_key = dot_split[0]\n dot_split.each { |keyname|\n # throw an error if the 'value' is not a hash (before attempting to retrieve the next 'value')\n raise ProjectHanlon::Error::Slice::InputError, \"Parsing of '#{fieldname}' failed; field '#{prev_key}' is not a Hash value\" unless value.is_a?(Hash)\n # if get here, then just retrieve the next element from nested hash maps referred\n # to in the dot-separated form (note that for top-level fields the keys will be\n # prefixed with an '@' character but for lower-level fields that will not be the\n # case, this line will retrieve one or the other)\n value = value[\"@#{keyname}\"] || value[keyname]\n # throw an error if a field with the key 'keyname' was not found (it's an illegal reference in that case)\n raise ProjectHanlon::Error::Slice::InputError, \"Parsing of '#{fieldname}' failed; field '#{keyname}' cannot be found\" unless value\n # otherwise, save this keyname for the next time through the loop and continue\n prev_key = keyname\n }\n return value\n end\n # otherwise, retrieve the field referred to by the fieldname and return\n # that value (note that for top-level fields the keys will be prefixed\n # with an '@' character but for lower-level fields that will not be the\n # case, this line will retrieve one or the other)\n object[\"@#{fieldname}\"] || object[fieldname]\n end", "def field_called(field_name)\n return nil if field_name.to_s.empty?\n # return nil if field_name.to_s.empty?\n @fields[field_name.to_sym]\n end", "def find_field_by_name(field_name)\n product_field_id = self.product_fields.find_by(name: field_name).id\n stock_field = self.stock_fields.select do |stock_field|\n stock_field.product_field_id == product_field_id\n end.first\n end", "def name\n self.general_fields.where(fieldable_id: self.id).where(\"payload->>'key' = 'name'\").first.value\n end", "def field_by_name(name)\n @fields.detect{|f|f.name==name}\n end", "def get_value name\n get name\n end", "def read(record, cursor)\n return :NULL if null?(record)\n cursor.name(type.name) { type.reader.read(record, cursor, length(record)) }\n end", "def [](field_name); end", "def fetch_field\n <<-CODE\n t1 = stack_pop();\n t2 = stack_pop();\n stack_push(NTH_FIELD(t2, N2I(t1)));\n CODE\n end", "def get_field(tag_or_name)\n case tag_or_name\n when Integer, String, Symbol\n field_dictionary[tag_or_name]\n else\n raise TypeError, tag_or_name.class\n end\n end", "def field_find(**args)\n # if looking for a specific field, use built-in hash for initial filter,\n # otherwise get all fields.\n fields_in_scope =\n if args[:tag].is_a?(String)\n fields(args[:tag]).dup\n else\n @fields.dup\n end\n fields_in_scope.each { |f| return f if f.meets_criteria?(args) }\n nil\n end", "def read_attribute\n Logging.debug \"Read attribute #{field_name}, got #{object.send(:read_attribute,field_name)} for #{object.inspect}\"\n object.send( :read_attribute, field_name )\n end", "def get_field_name\n\t\tend", "def parse_field(field_name)\n element_spec = @@spec.values.\n select {|v| (v['name']) =~ /^#{field_name}$/i}.\n first\n self.send(element_spec['node'])\n end", "def fetch(name, &block)\n items.fetch(coerce_name(name), &block)\n end", "def define_read_field_method(field_type)\n define_method field_type do\n self[field_type]\n end\n end", "def get_field_values document, _field, field_config, options = {}\n presenter(document).field_values field_config, options\n end", "def field_get(key)\n self.class.fetch_field(key.to_sym) # ensure that the field exists\n send key\n end", "def effective_field field\n each do |container|\n return container.value.send(field) unless container.empty?\n end\n nil\n end", "def get_for_field(name)\n @locations.select { |location| location.field == name }\n end", "def get_field_by_name(name)\n name = name.to_sym\n fields.values.find {|field| field.name == name}\n end", "def _get_entity_detail(detail_name)\n @entity.get_detail(detail_name)\n end", "def read_attribute(attr_name, &block)\n name = if self.class.attribute_alias?(attr_name)\n self.class.attribute_alias(attr_name).to_s\n else\n attr_name.to_s\n end\n\n primary_key = self.class.primary_key\n name = primary_key if name == \"id\" && primary_key\n sync_with_transaction_state if name == primary_key\n _read_attribute(name, &block)\n end", "def field_by_name(name)\n @fields.detect{|f|f.name==name}\n end", "def field_value(field)\n @object.respond_to?(field) ? @object.send(field) : ''\n end", "def stack_load_field(name)\n\n Lib.lua_getfield(@pointer, -1, name)\n end", "def process_field(field_name)\n if ['id', 'name', 'first_name', 'node_id'].include?(field_name)\n \"#{table}.#{field_name}\"\n else\n super # raises\n end\n end", "def get(field)\n result = CONNECTION.execute(\"SELECT * FROM '#{tablename}' WHERE id = ?;\", @id).first\n result[field]\n end" ]
[ "0.6744902", "0.6416119", "0.63977563", "0.63334256", "0.6263338", "0.62179524", "0.61222124", "0.6100709", "0.6063372", "0.60627455", "0.60350156", "0.60061616", "0.60034776", "0.58803684", "0.58663774", "0.5847971", "0.5846034", "0.57646984", "0.57646984", "0.569866", "0.56484425", "0.56484425", "0.56335205", "0.5622039", "0.5616691", "0.561364", "0.5611382", "0.56097317", "0.5595645", "0.55836374", "0.55792093", "0.55688214", "0.55652595", "0.5538579", "0.55286026", "0.5524299", "0.54991287", "0.5492492", "0.5476294", "0.5450203", "0.544835", "0.5446326", "0.54389304", "0.5438585", "0.54185456", "0.5418164", "0.54164344", "0.53829914", "0.5380553", "0.53762966", "0.536522", "0.5358045", "0.5330691", "0.5329038", "0.53280336", "0.5325966", "0.5319588", "0.5317846", "0.5316469", "0.5312031", "0.5305114", "0.5302803", "0.5296068", "0.52947134", "0.52726215", "0.5269964", "0.52619433", "0.5251888", "0.52429974", "0.5239644", "0.52272916", "0.5226027", "0.52195936", "0.52177614", "0.5215057", "0.5214446", "0.52072614", "0.52035743", "0.52006644", "0.5188021", "0.5186088", "0.5185788", "0.51821905", "0.5181411", "0.51810277", "0.5178207", "0.5174389", "0.5173117", "0.51604766", "0.51603025", "0.515858", "0.5157675", "0.5155378", "0.51484704", "0.5143984", "0.5140847", "0.5133885", "0.51255184", "0.51161265", "0.51098174" ]
0.5887053
13
give me a block that describes how to set the value for the named field for the given entity If you call me without a block, I will reeturn either the last block you sent me, or the default writer_proc Block should take 2 args (1st the entity, 2nd the value to be written) default proc assumes there is an = method with the same name as field_name on the entity
def writer_proc(&block) #defined by default_for_proc_type in initialize! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_field_value(name, value)\n\t\tend", "def create_field_setter(name, meth, field)\n generated_methods.module_eval do\n define_method(\"#{ meth }=\") do |value|\n instance_variable_set \"@#{ name }\", value\n end\n end\n end", "def field(field_name, value)\n flush_field\n @current_field = field_name\n @current_value = value.dup\n end", "def set field, *args, &block\n raise \"Field name not given (Typero)\" unless field\n\n if args.first.is_a?(Hash)\n opts = args.first || {}\n else\n opts = args[1] || {}\n opts[:type] ||= args[0]\n end\n\n opts[:type] = :string if opts[:type].nil?\n\n field = field.to_s\n\n if field.include?('!')\n if block\n field = field.sub('!', '')\n @block_type = field.to_sym\n instance_exec &block\n @block_type = nil\n return\n else\n raise ArgumentError.new 'If you use ! you have to provide a block'\n end\n end\n\n # name? - opional name\n if field.include?('?')\n field = field.sub('?', '')\n opts[:required] = false\n end\n\n opts[:required] = opts.delete(:req) unless opts[:req].nil?\n opts[:required] = true if opts[:required].nil?\n\n # array that allows duplicates\n if opts[:type].is_a?(Array)\n opts[:type] = opts[:type].first\n opts[:array] = true\n end\n\n # no duplicates array\n if opts[:type].is_a?(Set)\n opts[:type] = opts[:type].to_a.first\n opts[:array] = true\n end\n\n opts[:type] = @block_type if @block_type\n\n # Boolean\n if opts[:type].is_a?(TrueClass) || opts[:type] == :true\n opts[:required] = false\n opts[:default] = true\n opts[:type] = :boolean\n elsif opts[:type].is_a?(FalseClass) || opts[:type] == :false || opts[:type] == :boolean\n opts[:required] = false if opts[:required].nil?\n opts[:default] = false if opts[:default].nil?\n opts[:type] = :boolean\n end\n\n # model / schema\n if opts[:type].class.ancestors.include?(Typero::Schema)\n opts[:model] = opts.delete(:type)\n end\n opts[:model] = opts.delete(:schema) if opts[:schema]\n opts[:type] = :model if opts[:model]\n\n if block_given?\n opts[:type] = :model\n opts[:model] = Typero.schema &block\n end\n\n opts[:type] ||= 'string'\n opts[:type] = opts[:type].to_s.downcase.to_sym\n\n opts[:description] = opts.delete(:desc) unless opts[:desc].nil?\n\n # chek alloed params, all optional should go in meta\n opts.keys.each do |key|\n type = Typero::Type.load opts[:type]\n type.allowed_opt?(key) {|err| raise ArgumentError, err }\n end\n\n field = field.to_sym\n\n db :add_index, field if opts.delete(:index)\n\n # trigger error if type not found\n Typero::Type.load opts[:type]\n\n @rules[field] = opts\n end", "def set_field(field_name, field_value)\n super field_name.to_s, field_value.to_s\n end", "def field(*args_or_name, block)\n def_args = extract_definition_args(args_or_name)\n require_arg def_args, :name\n\n return unless check_when(def_args, @current_source)\n return unless version_wanted(def_args)\n\n value = field_value(def_args, block)\n # Rails.logger.debug \"Field #{def_args[:name]} <= #{value} current_source=#{@current_source}\"\n put_field def_args[:name], value\n end", "def field_set!(key, value)\n send \"_#{key}_set\", value\n end", "def set_field_value(obj, name, value)\n begin\n @struct_field_setter.call(obj, name, value)\n rescue\n end\n end", "def set(field,value)\n set_method = (field.to_s + \"=\").to_sym\n m = self.method((field.to_s + \"=\").to_sym)\n m.call value\n end", "def update_field(field_name, &block)\n latest = Transaction.current.updated(self).record\n vector = increment_vector_clock(latest['_flowHeader']['vectorClock'])\n header = latest['_flowHeader'].merge('vectorClock' => vector)\n version = {\n 'lastWriterID' => Flow.peer_id,\n 'vectorClockSum' => vector.inject(0) {|sum, entry| sum + entry['count'] }\n }\n new_value = yield version\n self.class.new(latest.merge('_flowHeader' => header, field_name => new_value))\n end", "def []=(field_name, value); end", "def setter\r\n @setter ||= Field.setter(@name)\r\n end", "def method_missing field, *args, &block\n set field, *args, &block\n end", "def field=(field_name)\n parameters[:field] = field_name\n end", "def set(name, value)\n @fields[name.lexeme] = value\n end", "def define_set_and_get_method(name, &block)\n define_instance_dsl_method \"#{name}\" do |value = ''|\n if value == ''\n instance_eval(&block)\n else\n instance_variable_set(\"@#{name}\".to_sym, value)\n end\n end\n end", "def define_write_field_method(field_type)\n define_method \"#{field_type}=\" do |value|\n self[field_type] = value\n end\n end", "def set(fields)\n case self[:value]\n when Proc\n fields.send \"#{self[:key]}=\", self[:value].call(nil)\n else\n attr = if self[:key].to_s.end_with?('?')\n self[:key].to_s[0..-2]\n else\n self[:key]\n end\n fields.send \"#{attr}=\", self[:value]\n end\n end", "def set_field(field_name,value,commit=true)\n values=self.class.to_array(value)\n update_solr(field_name,'set',values,commit)\n execute_callbacks(field_name,values)\n end", "def fld=(val); @fld = val end", "def []=(field_name, value)\n send(\"#{field_name}=\", value)\n end", "def []=(field_name, value)\n set(field_name, value)\n end", "def update_field_name\n self.field = field_name\n end", "def write_field(*args)\n if args.size == 3\n # handles the documented method signature - write_field(field_info, fid, value)\n field_info = args[0]\n fid = args[1]\n value = args[2]\n elsif args.size == 4\n # handles the deprecated method signature - write_field(name, type, fid, value)\n field_info = {:name => args[0], :type => args[1]}\n fid = args[2]\n value = args[3]\n else\n raise ArgumentError, \"wrong number of arguments (#{args.size} for 3)\"\n end\n\n write_field_begin(field_info[:name], field_info[:type], fid)\n write_type(field_info, value)\n write_field_end\n end", "def set_entity(record, name)\n @record = record\n @name = name.to_sym\n\n @context.merge!(record: record, name: name)\n end", "def define_setter_for(name)\n define_method(\"#{name}=\") do |associated|\n instance_variable_set(\"@#{name}\".to_sym, associated)\n\n assign_id_for(name, associated)\n assign_type_for(name, associated)\n assign_serialized_attributes(name, associated)\n end\n end", "def []=(field_name, value)\n f = field(field_name)\n if f\n f.value = value\n else\n add_field!(field_name, value)\n end\n end", "def update_block(name, value)\n ContentBlock.find_or_create_by(name: name.to_s).update!(value: value)\n end", "def set(field, value)\n if @data.set_fields.include?(field)\n raise SqlStmtError, \"trying to set field #{field} again\"\n end\n\n if field\n @data.set_fields << field\n end\n value = value.is_a?(String) ? value : value.to_sql\n @data.set_values << value\n return self\n end", "def replace_field_handler(name, handler); end", "def field(ffield, length, sourcetag, default = nil, &block)\n @fields << {\n afield: ffield,\n length: length, \n stag: sourcetag,\n default: default,\n block: block\n }\n end", "def []=(name, value)\n name = dasherize(name)\n if name.include?(':')\n raise ArgumentError, \"Header names may not contain a colon: #{name.inspect}\"\n end\n fn = name.downcase\n selected = select_field_for(fn)\n \n case\n # User wants to delete the field\n when !Utilities.blank?(selected) && value == nil\n fields.delete_if { |f| selected.include?(f) }\n \n # User wants to change the field\n when !Utilities.blank?(selected) && limited_field?(fn)\n selected.first.update(fn, value)\n \n # User wants to create the field\n else\n # Need to insert in correct order for trace fields\n self.fields << Field.new(name.to_s, value, charset)\n end\n if dasherize(fn) == \"content-type\"\n # Update charset if specified in Content-Type\n params = self[:content_type].parameters rescue nil\n @charset = params[:charset] if params && params[:charset]\n end\n end", "def create_setter\n @model.class_eval <<-EOS, __FILE__, __LINE__\n #{writer_visibility}\n def #{name}=(value)\n self[#{name.inspect}] = value\n end\n EOS\n end", "def set_field(key, value)\n\n Ruote.set(h.fields, key, value)\n end", "def []= (name, value)\n field = schema.fields[name.to_s] || FieldDefinition.new(name, :type => value.class)\n write_attribute(field, value, self)\n end", "def write_attribute(name, value)\n run_callbacks(:before_update)\n @attributes[name] = fields[name].set(value)\n run_callbacks(:after_update)\n notify\n end", "def method_missing(name, *args, &block)\n if self.is_dynamic_field?(name)\n if name.to_s.ends_with?('=')\n name = name.to_s.gsub(/\\=$/, '').to_sym\n self.dynamic_setter(name, args.first)\n else\n self.dynamic_getter(name)\n end\n else\n super\n end\n end", "def name=(value); end", "def write(value)\n record.send(\"#{name}_data=\", value)\n end", "def field(name); end", "def []=(fieldname, val)\n field = lookup(fieldname)\n el = field[0].refer(@pointer.offset(field[2]))\n el.value = val\n end", "def set_Entity(value)\n set_input(\"Entity\", value)\n end", "def set(partition, field, value)\n partition = deep_copy(partition)\n value = deep_copy(value)\n AutoinstCommon.set(@fields, partition, field, value)\n end", "def update!(**args)\n @field_name = args[:field_name] if args.key?(:field_name)\n @name = args[:name] if args.key?(:name)\n @tokens = args[:tokens] if args.key?(:tokens)\n end", "def define_writer_method(mod)\n writer_method_name = \"#{name}=\"\n attribute = self\n\n mod.send(:define_method, writer_method_name) { |value| attribute.set(self, value) }\n mod.send(writer_visibility, writer_method_name)\n\n self\n end", "def attr_writer(*fields)\n check_fields(fields)\n added_fields = jiak.data.writable(*fields)\n added_fields.each do |field|\n class_eval <<-EOM\n def #{field}=(val)\n @jiak.object.data.#{field} = val\n self.class.do_auto_update(self)\n end\n EOM\n end\n nil\n end", "def update_metadata_field(field_name, value)\n @client.put(\"#{metadata_path}/#{field_name}\", nil, { value: value }, \"Content-Type\" => \"application/json\")\n end", "def write_attribute_with_dynamo(field_name, value)\n if is_dynamo_field?(field_name)\n # Store these guys for now. We don't actually save the field value until the model is saved ( i.e my_supplier.save ).\n # If we were to save the field_value now we wouldn't be able to know the id of the model to link this value to it.\n # @see delay_save\n @all_fields_and_values ||= []\n @all_fields_and_values << {:dynamo_field=>cached_dynamo_field_by_name(field_name), :value=>value}\n end\n # If its a 'normal' attribute let rails write it in the usual way.\n write_attribute_without_dynamo(field_name, value)\n end", "def setUserField(userName, fieldName, fieldValue)\n\n if userName != nil && fieldName != \"password\"\n user = loadUser(userName)\n user[fieldName] = fieldValue\n saveUser(userName, user)\n end\n end", "def handle_writer(property)\n define_method \"#{property}=\" do |value|\n value = Economic::Entity::Handle.new(value) if value\n instance_variable_set(\"@#{property}\", value)\n end\n end", "def set_attribute(name, value); end", "def to_setter(field)\n field.to_s.concat(\"=\").to_sym\n end", "def []=(field_name, value)\n @layout.__put(field_name, self, value)\n end", "def define_writer(name, selector)\n define_method(\"#{name}=\") { |value| @browser.find(selector).set(value) }\n end", "def ^ (name, value = nil, &block) update_attribute name, value, &block end", "def create_setter\n @model.class_eval <<-EOS, __FILE__, __LINE__\n #{writer_visibility}\n def #{name}=(value)\n attribute_set(#{name.inspect}, value)\n end\n EOS\n end", "def to_field(field_name, aLambda = nil, &block)\n @index_steps << ToFieldStep.new(field_name, aLambda, block, Traject::Util.extract_caller_location(caller.first) )\n end", "def to_field(field_name, aLambda = nil, &block)\n @index_steps << ToFieldStep.new(field_name, aLambda, block, Traject::Util.extract_caller_location(caller.first) )\n end", "def file_field(name, identifier=nil, &block)\n define_method(\"#{name}=\") do |value|\n return platform.file_field_value_set(identifier.clone, value) unless block_given?\n self.send(\"#{name}_element\").value = value\n end\n define_method(\"#{name}_element\") do\n return call_block(&block) if block_given?\n platform.file_field_for(identifier.clone)\n end\n define_method(\"#{name}?\") do\n return call_block(&block).exists? if block_given?\n platform.file_field_for(identifier.clone).exists?\n end\n end", "def name=(name)\n @name = (name)\n unless parameters.has_key?(:field)\n parameters[:field] = name\n end\n end", "def update!(**args)\n @field_name = args[:field_name] if args.key?(:field_name)\n end", "def []=(field, value)\n self.send(\"#{field}=\", value)\n end", "def field(name)\n unless (@fields ||= []).include?(name)\n @fields << name\n\n # field reader\n define_method(name) do\n instance_variable_get(\"@%s\" % name)\n end\n\n # field writer\n define_method(\"%s=\" % name) do |val|\n val = Time.parse(val) if name == :timestamp and val.kind_of?(String)\n instance_variable_set(\"@%s\" % name, val)\n end\n end\n end", "def set_field(name, value)\n name = name.to_sym\n raise NonexistentFieldError.new(\"'#{name}' field does not exist in form\") unless has_field?(name)\n @stamper.getAcroFields.setField(name.to_s, value.to_s)\n value\n end", "def set_field(name, value)\n field = user_api.mdi.storage.tracking_fields_info.get_by_name(name, self.account)\n if field == nil\n RAGENT.api.mdi.tools.log.warn(\"set_field: Field #{name} not found in local configuration, abort\")\n return self.fields_data\n end\n\n # verify value type\n case field['field_type']\n when 'integer'\n raise \"#{value} is not an integer\" if \"#{value}\" != \"#{value.to_i}\"\n when 'string'\n # NOP\n when 'boolean'\n raise \"#{value} is not a boolean\" if (\"#{value}\" != 'true' and \"#{value}\" != 'false')\n when 'double'\n raise \"#{value} is not a double\" if \"#{value}\" != \"#{value.to_f}\"\n end\n\n raw_value = value\n # decode if Ragent. In VM mode, raw_value = value, nothing else to do\n # let's reproduce the device encoding\n if RAGENT.running_env_name == 'ragent'\n case field['field_type']\n when 'integer'\n # field['value'] = v.to_s.unpack('B*').first.to_i(2)\n # reverse: b64_value = Base64.strict_encode64([demo].pack(\"N\").unpack(\"cccc\").pack('c*'))\n raw_value = [value.to_i].pack(\"N\").unpack(\"cccc\").pack('c*')\n when 'string'\n # field['value'] = v.to_s\n raw_value = value\n when 'boolean'\n # field['value'] = v.to_s == \"\\x01\" ? true : false\n raw_value = value ? \"\\x01\" : \"\\x00\"\n when 'double'\n # field['value'] = v.unpack('E').first # little endian\n raw_value = [value.to_f].pack('E')\n end\n end\n\n field['name'] = name\n field['raw_value'] = raw_value\n field['value'] = value\n field['fresh'] = true\n self.recorded_at = Time.now.to_i\n self.fields_data << field\n self.id = nil # invalid track because some field has changed\n end", "def set(name, value)\n validate_parameter_type(options['type'])\n parameter = get_parameter(name)\n parameter = create_parameter(parameter, options['type'], options['key']) unless parameter.exists?\n parameter.write!(value)\n puts parameter.to_s\n end", "def dynamic_setter(name, value)\n self.dynamic_attributes ||= {}\n self.dynamic_attributes[name.to_sym] ||= {}\n\n field = self.content_type.find_field(name)\n\n if value.is_a?(Hash) # already localized\n value.keys.each { |locale| self.add_locale(locale) }\n self.dynamic_attributes[name.to_sym].merge!(value.symbolize_keys)\n else\n if field.is_relationship? || !field.localized\n self.dynamic_attributes[name.to_sym] = value\n else\n self.add_locale(Locomotive::Mounter.locale)\n self.dynamic_attributes[name.to_sym][Locomotive::Mounter.locale] = value\n end\n end\n end", "def add_property(container, name, &block)\n Nokogiri::HTML::Builder.with(container) do |html|\n html.dl(class: \"entity_#{name}\") do\n html.dt(name.to_s.capitalize)\n html.dd do\n block.call(html)\n end\n end\n end\n end", "def set_field(key, value)\n pdf_field(key).setValue(value.to_s)\n end", "def register_field_handler(name, handler); end", "def writer(brand, accessor, default)\n # classic setter scheme, it does nothing if value\n # parameter is not a `brand` instance though\n define_method \"#{accessor}=\".to_sym do |value|\n instance_variable_set \"@#{accessor}\", value if value.is_a? brand\n end\n\n # pedlar setter `accessor_with`\n # it sets instance variable with :\n # - fitting user-defined method\n # - or instance creation with passed params\n # - or value that must a be an instance of `brand`\n define_method \"#{accessor}_with\".to_sym do |*values|\n instance_variable_set \"@#{accessor}\", peddles(accessor, brand, *values)\n end\n end", "def name= val # Setter - set a value\n @name = val \n end", "def create_setter!\n @target.class_eval <<-EOS\n #{writer_visibility.to_s}\n def #{name}=(value)\n attribute_set(#{name.inspect}, value)\n end\n EOS\n rescue SyntaxError\n raise SyntaxError.new(column)\n end", "def update_column name, value\n name = name.to_s\n self.dynamic_record.send \"#{name}=\", value\n self.raw_write_attribute name, value\n end", "def set_to_column_name(value=nil, &block)\n define_attr_method :to_column_name, value, &block\n end", "def update(field, new_value)\n\t\tself.send(\"#{field}=\", new_value)\n\tend", "def _setter_method\n :\"_#{self[:name]}=\"\n end", "def define_set_field_method(field)\n define_method \"#{field.name}=\" do |object|\n if object.nil?\n self.send \"#{field.foreign_key}=\", nil\n elsif object.is_a?(Symbol)\n self.send \"#{field.foreign_key}=\", self.class.send(field.name, object).id\n elsif object.kind_of?(ActsAsEnumField::InstanceMethods)\n self.send \"#{field.foreign_key}=\", object.id\n else\n raise \"BUG: invalid argument \" + object.class.name\n end\n end\n end", "def method_missing(meth,*args,&block)\n\n method = meth.to_s # convert method name to a string\n setter = method.end_with?('=') # determine if this is a setter method (which would have the last character \"=\" in the method name)\n attribute = setter ? method.chop : method # the attribute name needs to have the \"=\" removed if it is a setter\n multivalued_field = attribute.end_with?(self.class.multivalued_field_marker) # in place editing fields can end with the special character marker, which will join arrays when return; and split them when setting\n attribute.gsub!(self.class.multivalued_field_marker,'') if multivalued_field\n\n solr_field_config=self.class.field_mappings[attribute.downcase.to_sym] # lookup the solr field for this accessor\n if solr_field_config\n solr_field_name=solr_field_config[:field].downcase\n default_value=solr_field_config[:default] || ''\n if setter # if it is a setter, cache the edit if it has changed\n old_values=self[solr_field_name]\n new_values=args.first\n if !self.class.is_equal?(old_values,new_values,multivalued_field) # we should only cache the edit if it actually changed\n value = (multivalued_field ? new_values.split(\"|\") : new_values) # split the values when setting if this is an in place edit field\n cache_edit({solr_field_name.to_sym=>value})\n return value\n else\n return old_values\n end\n else # if it is a getter, return the value\n value = unsaved_edits[solr_field_name.to_sym] || self[solr_field_name] # get the field value, either from unsaved edits or from solr document\n value = default_value if value.blank?\n return (multivalued_field && value.class == Array ? value.join(\" | \") : value) # return a joined value if this is an in place edit field, otherwise just return the value\n end\n else\n super # we couldn't find any solr fields configured, so just send it to super\n end\n\n end", "def setter_method\n :\"#{self[:name]}=\"\n end", "def write(&block)\n @write_block = block\n end", "def set_field(name, options = {})\n meth = options.delete(:as) || name\n fields[name] = Field.new(name, options)\n create_accessors(name, meth, options)\n end", "def configurable_writer(attribute, code=nil, &block)\n if block_given? and not code\n Halcyon.class.send(:define_method, :\"#{attribute}=\", block)\n elsif code and not block_given?\n Halcyon.class.send(:eval, <<-\"end;\")\n def #{attribute.to_s}=(value)\n #{code % [attribute.to_sym.inspect]}\n end\n end;\n else\n raise ArgumentError.new(\"Either a block or a code string should be supplied.\")\n end\n end", "def set_nested(hash, field_name, value)\n field_ref = Java::OrgLogstash::FieldReference.from(field_name)\n # create @metadata sub-hash if needed\n if field_ref.type == Java::OrgLogstash::FieldReference::META_CHILD\n nesting_hash = hash[\"@metadata\"]\n else\n nesting_hash = hash\n end\n\n field_ref.path.each do |token|\n nesting_hash[token] = {} unless nesting_hash.key?(token)\n nesting_hash = nesting_hash[token]\n end\n nesting_hash[field_ref.key] = value\n end", "def set_from_column_name(value = nil, &block)\n define_attr_method :from_column_name, value, &block\n end", "def define_setter\n name = @name\n klass.send :define_method, \"#{name}=\" do |unit|\n send \"#{name}_value=\", unit.value\n send \"#{name}_unit=\", unit.unit.to_s\n end\n end", "def define_writer!(k, definition)\n define_method(\"#{k}=\") do |value|\n # Recursively convert hash and array of hash to schematized objects\n value = ensure_schema value, definition[:schema]\n\n # Initial value\n instance_variable_set \"@#{k}\", value\n\n # Dirty tracking\n self.changed_attributes ||= Set.new\n self.changed_attributes << k\n end\n end", "def semantic_fields_for(name, *args, &block)\n use_semantic_builder(:fields_for, name, *args, &block)\n end", "def []=(name, value)\n modifiable[new_ostruct_member(name)] = value\n end", "def add_field!(field_name, value = T.unsafe(nil)); end", "def set_EntityValue(value)\n set_input(\"EntityValue\", value)\n end", "def _setter_method\n :\"_#{self[:name]}=\"\n end", "def entity=(new_entity)\n @entity = new_entity[0..512]\n end", "def setter_method\n :\"#{self[:name]}=\"\n end", "def assign_custom_fields(key_name_hash, entity_hash)\n names = key_name_hash.map do |key, field|\n name = field.name\n name = name.underscore.gsub(' ','_')\n name = name.gsub('%','percent').gsub(/[^a-zA-Z0-9_]/,'')\n name = transform_field_name(key, name)\n if field.field_type == 'enum'\n option_id = entity_hash[key]\n res_field = field.dup\n res_field.option_id = option_id\n instance_variable_set(\"@#{name}\", res_field)\n else\n instance_variable_set(\"@#{name}\", entity_hash[key])\n end\n name\n end\n self.class.class_eval {attr_accessor *names}\n end", "def instance_write(attr, value)\n setter = :\"#{@name_string}_#{attr}=\"\n instance.send(setter, value) if instance.respond_to?(setter)\n end", "def update!(**args)\n @field_name = args[:field_name] if args.key?(:field_name)\n @location = args[:location] if args.key?(:location)\n @method_match = args[:method_match] if args.key?(:method_match)\n @value = args[:value] if args.key?(:value)\n end", "def set(index,x)\n if index.is_a? Symbol\n index = get_by_sym(index)\n end\n unless x.nil? or x == ''\n if fields_desc[index][1] # we're a repeating field\n x = [x] unless x.is_a? Array\n @fields[index] = x.map { |y| fields_desc[index][2].from_ruby(y)}\n else\n @fields[index] = fields_desc[index][2].from_ruby(x)\n end\n if @fields[index].respond_to?(:separator) && @separator == '^' # we're a field, so it's a subfield\n @fields[index].separator = '&'\n end\n end\n end", "def setFieldBoost field, boost\n f = self.get(field)\n if f\n f.setBoost(boost)\n return boost\n else\n return nil\n end\n end", "def entity=(new_entity)\n if new_entity.nil?\n @entity = nil\n @event = nil\n @blocking = false\n else\n @entity = new_entity\n @blocking = true\n @event = new_entity.respond_to?(:event) ? new_entity.event : nil\n end\n end" ]
[ "0.65005964", "0.6222336", "0.6204971", "0.6196575", "0.6182443", "0.5976424", "0.5937335", "0.5925649", "0.58924073", "0.58897233", "0.5884147", "0.58749115", "0.58186764", "0.58148813", "0.57631576", "0.57437974", "0.5734103", "0.572136", "0.5708385", "0.5689501", "0.56891227", "0.5648583", "0.56057036", "0.55998856", "0.5573429", "0.5551404", "0.55415905", "0.5510787", "0.5504439", "0.5497479", "0.5491989", "0.54419315", "0.54387504", "0.54360026", "0.54237956", "0.54020995", "0.5399808", "0.53961074", "0.5392315", "0.5388819", "0.5373345", "0.5355052", "0.5351426", "0.5338457", "0.53359", "0.5335042", "0.5326329", "0.5323109", "0.53229135", "0.5309159", "0.52904713", "0.52891743", "0.52633774", "0.52589065", "0.52535564", "0.5244957", "0.52435356", "0.52435356", "0.52358824", "0.523154", "0.5230309", "0.52235353", "0.521822", "0.5214526", "0.5194193", "0.51887643", "0.5182242", "0.5161888", "0.51611143", "0.515773", "0.5151169", "0.51501334", "0.5144766", "0.51436335", "0.51410633", "0.51398575", "0.51370203", "0.51363856", "0.5130203", "0.5127628", "0.5125068", "0.51179254", "0.51143026", "0.51125115", "0.51114476", "0.5105843", "0.5104883", "0.51012397", "0.5092835", "0.50805223", "0.5079364", "0.5073521", "0.5063999", "0.5056927", "0.5056299", "0.50546724", "0.5050915", "0.50442845", "0.5033689", "0.5033145" ]
0.54637975
31
give me an arg and I will set a string for how the name of this field should be seen to end users call me with no args and I will give you the human_name you gave me
def human_name(*args) #defined by default_for_arg_type in initialize! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def human_name=(_arg0); end", "def human_name=(_arg0); end", "def human_from_name; end", "def human_to_name; end", "def display_name(opts)\n opts = check_params(opts,[:field_names])\n super(opts)\n end", "def name(arg = nil)\n if !arg.nil?\n validate(\n { name: arg },\n { name: { kind_of: String,\n cannot_be: :blank,\n regex: /^[\\-[:alnum:]_:.]+$/ },\n }\n )\n @name = arg\n else\n @name\n end\n end", "def human_name(*args)\n I18n.t(\"models.#{name.underscore}\", {:count => 1, :default => name.humanize})\n end", "def name(arg = nil)\n set_or_return(\n :name,\n arg,\n kind_of: [ String ]\n )\n end", "def friendly_name(val = NULL_ARG)\n @friendly_name = val unless val.equal?(NULL_ARG)\n @friendly_name || @name.capitalize\n end", "def name(arg = nil)\n # TODO: clean the cache when changed?\n set_or_return(\n :name,\n arg,\n kind_of: String\n )\n end", "def display_name\n override_name ||= name\n # default to name if the value of override_name is empty string\n override_name = name if override_name.strip == \"\"\n override_name\n end", "def display_name\n \t\"#{name}\"\n end", "def display_name\n \"#{name}\"\n end", "def display_name\n \"#{name}\"\n end", "def display_name\n \"#{name}\"\n end", "def display_name\n name\n end", "def display_name\n name\n end", "def display_name\n name\n end", "def real_name\n name\nend", "def name=(_arg0); end", "def name=(_arg0); end", "def name=(_arg0); end", "def name=(_arg0); end", "def name=(_arg0); end", "def name=(_arg0); end", "def name=(_arg0); end", "def name=(_arg0); end", "def name=(_arg0); end", "def name=(_arg0); end", "def name=(_arg0); end", "def name=(_arg0); end", "def name=(_arg0); end", "def name=(_arg0); end", "def name=(_arg0); end", "def name=(_arg0); end", "def name=(_arg0); end", "def name(arg = nil)\n set_or_return(\n :name,\n arg,\n regex: /^[\\-[:alnum:]_\\.]+$/\n )\n end", "def format_name\n put_together_name(:full)\n end", "def display_name\n name || email\n end", "def display_name\n name || email\n end", "def human_name\n @human_name ||= self.to_s.demodulize.titleize\n end", "def get_full_name\n description\n end", "def display_name\n\t\tself.name.titleize\n\tend", "def get_full_name\n \"#{self.name} (desc.: #{self.description})\"\n end", "def display_name\n name\n end", "def display_name\n name\n end", "def friendly_name(val = NULL)\n if null?(val)\n @friendly_name || name.capitalize\n else\n @friendly_name = val\n end\n end", "def friendly_name(val = NULL)\n if null?(val)\n @friendly_name || name.capitalize\n else\n @friendly_name = val\n end\n end", "def long_name\n if @description\n @name + ' ' + @description\n else\n @name\n end\n end", "def display_name \n username\n end", "def member_name\n # does nothing - just here to satisfy text_field_with_auto_complete (which requires a model property)\n end", "def member_name\n # does nothing - just here to satisfy text_field_with_auto_complete (which requires a model property)\n end", "def pretty_name\n super || name.humanize\n end", "def full_name\n name\n end", "def name_with_initial; end", "def display_name\n prefered_name\n end", "def display_name\n NAME\n end", "def display_name\n NAME\n end", "def get_full_name\n title\n end", "def display_name(attr)\n attr.name unless attr.nil?\n end", "def display_name\n self.name\n end", "def two_word_name; end", "def screen_name\n name || nickname\n end", "def briefingName \n \"briefingName\" \n end", "def initialize\n set_human_name\n end", "def name\n display_name\n end", "def name\n super.to_s.titleize\n end", "def display_name\n username\n end", "def display_name\n self.name.blank? ? self.username : self.name\n end", "def name\n full_name\n end", "def real_name; end", "def get_full_name\n self.title.to_s\n end", "def full_name\n '(unknown)'\n end", "def display_name\n @name\n end", "def my_name()\n self.name\n end", "def proper_name\n\t\t\"#{self.first_name} #{self.last_name}\"\n\tend", "def ausgabe\n\t\t@name\n\t\n\tend", "def full_name\n # TODO: update method -> \"${name}, ${last_name}\"\n name\n end", "def display_name\n name\n end", "def field_human_name(field)\n I18n.translate(\"#{model_name}.attributes.#{field}\", :count => 1, :default => Inflections.humanize(field), :scope => :models)\n end", "def human_name\n cn = name\n\n if respond_to?(:is_dynamic_model) && is_dynamic_model || respond_to?(:is_activity_log) && is_activity_log\n cn = cn.split('::').last\n end\n\n cn.underscore.humanize.captionize\n end", "def get_full_name\n \"#{name} (#{description})\"\n end", "def display_name\n @name.titlecase\n end", "def get_full_name\n self.description.to_s\n end", "def name\n @display_name || @name\n end", "def get_verbose_name\n \"'#{name}' (#{description}), e-mail: #{email}, class: #{year_of_birth}, swimmer ID: #{swimmer_id}\"\n end", "def proper_name # method to get the full name of user\n first_name + \" \" + last_name\n end", "def fake_name (first_name, last_name)\n \"#{last_name} #{first_name}\"\nend", "def show_full_name\n name\n end", "def display_name\n if original_name.nil?\n id\n else\n original_name.text.nil? ? id: original_name.text\n end\n end", "def name\n @custom_name || @attribute.to_s.humanize\n end", "def name_with_title\n \"#{self.name}: #{self.title}\"\n end", "def human_name(*args)\n ActiveSupport::Deprecation.warn(\"human_name has been deprecated, please use model_name.human instead\", caller[0,1])\n model_name.human(*args)\n end", "def ausgabe\n\t\t@name\n\tend", "def full_title(field = nil)\n field && find_record_value(field) || super()\n end", "def generate_name\n self.name ||= header ? header.parameterize : id\n end", "def naming\n name || nickname\n end", "def name\n \"Lord Admiral #{@name}\"\n end", "def full_name\n self.to_s\n end", "def display_name\n titre\n end" ]
[ "0.8093905", "0.8093905", "0.70941055", "0.69186366", "0.69056475", "0.6833314", "0.6819889", "0.678319", "0.6781301", "0.6745799", "0.6736689", "0.6712051", "0.6689699", "0.6689699", "0.6689699", "0.6657979", "0.6657979", "0.6657979", "0.6618683", "0.65638477", "0.65638477", "0.65638477", "0.65638477", "0.65638477", "0.65638477", "0.65638477", "0.65638477", "0.65638477", "0.65638477", "0.65638477", "0.65638477", "0.65638477", "0.65638477", "0.65638477", "0.65638477", "0.65638477", "0.65541273", "0.6526124", "0.6524506", "0.6524506", "0.6485058", "0.64720017", "0.645932", "0.6441082", "0.6438631", "0.6438631", "0.6431903", "0.6431903", "0.64304733", "0.6428912", "0.6426896", "0.6426896", "0.64237696", "0.6420382", "0.6418318", "0.64039195", "0.63956004", "0.63956004", "0.6395469", "0.63880706", "0.63815093", "0.6367797", "0.63604575", "0.6356505", "0.6354221", "0.63403314", "0.6334324", "0.63307726", "0.6322843", "0.6312921", "0.6310043", "0.6309077", "0.63025635", "0.6296681", "0.6294936", "0.6286807", "0.6278287", "0.6274529", "0.6269852", "0.6265128", "0.6264332", "0.626398", "0.6263921", "0.6262337", "0.62621206", "0.62606996", "0.625806", "0.6256167", "0.6251939", "0.62360674", "0.62323016", "0.6227464", "0.6225645", "0.62235403", "0.6219452", "0.6219053", "0.6214936", "0.62116057", "0.62032014", "0.62015116" ]
0.776178
2
Convenience method for chaining FieldDefs::Field.display_proc and FieldDefs::Field.reader_proc as intended i.e. instead of: field = field_defs.field_called(:name) field.display_proc.call(field.reader_proc.call(user)) you can do: field_defs.display_for(user, :name)
def display_for(object, field_name) fdef = field_called(field_name) fdef.display_proc.call(fdef.reader_proc.call(object)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit_and_show_as(arg = nil, &proc) # :yields: field_def or nil\n edit_as(arg, &proc)\n show_as(arg, &proc)\n end", "def display_proc(&block)\n #defined by default_for_proc_type in initialize!\n end", "def show_as(*args, &proc) # :yields: field_def or nil\n @view_control.show_as(*args, &proc)\n end", "def document_show_field_label(document, field)\n lookup_display_name(document, field) || super\n end", "def display_user(user)\n user.name\n end", "def display_field\n current_field_values_with_field_type_id(field_types.first.id).first.try(:value) || 'no display field available'\n end", "def display_name_for(user)\n user.first_name.capitalize + ' ' + user.last_name.capitalize + ' ( ID: ' + user.reference_number + ')'\n end", "def render_document_show_field_value *args\n render_field_value(*args)\n end", "def edit_and_show_as(arg = nil, &proc)\n edit_as(arg, &proc)\n show_as(arg, &proc)\n end", "def show_field(model, field, label = nil)\n label ||= field.to_s.titlecase\n show_value(model.send(field), label)\n end", "def display_for(doc, field)\n highlights_for(doc['unique_id'], field) || doc[field]\n end", "def get_display_field_header\n self.statement\n end", "def show_as(*args, &proc)\n # RAILS_DEFAULT_LOGGER.debug('set show_as proc to ' + proc.inspect)\n opts = (args.last.is_a?(Hash) && args.pop) || {}\n if opts[:show_wrap_proc]\n if opts[:show_wrap_proc].is_a?(Proc)\n self.show_wrap_proc = opts[:show_wrap_proc]\n end\n else\n self.show_wrap_proc = nil\n end\n if block_given?\n self.show_as_proc = proc\n else\n if args.first\n self.show_as_proc = Proc.new do\n args.first.to_s\n end\n end\n end\n end", "def get_field_display_rtpl\n # TODO: revisit when implementing save/display of multiselct values\n # if(isset($this->multiple) && $this->multiple != '')\n # $multiple = $this->multiple;\n # else $multiple = '';\n\n field_string = '{%=' + @model_name + '[:' + @name + '_display]%}'\n field_string\n end", "def display_resource(user)\n user.display_name\n end", "def add_show_field(*) super end", "def user_defined_fields\n RubyRedtail::Query.run(\"contacts/#{@id}/udf\", @api_hash, \"GET\")\n end", "def display_field(field, depth = 0, parents = [])\n my_parents = parents.dup\n field_str = ''\n name = field[:name]\n if field[:class] == BinData::Array\n field_str = \"\\n\" + (\"\\t\" * depth) + name.to_s.upcase\n parent = self\n my_parents.each do |pfield|\n parent = parent.send(pfield)\n end\n array_field = parent.send(name)\n field_str << process_array_field(array_field, (depth + 1))\n else\n if my_parents.empty?\n label = \"\\n\" + (\"\\t\" * depth) + name.to_s.upcase\n if field[:class].ancestors.include? BinData::Record\n field_str = label\n else\n value = send(name)\n field_str = format '%-30s %s', label, value\n end\n else\n parent = self\n my_parents.each do |pfield|\n parent = parent.send(pfield)\n end\n value = parent.send(name)\n label = field[:label] || name.to_s.capitalize\n label = \"\\n\" + (\"\\t\" * depth) + label\n field_str = format '%-30s %s', label, value\n end\n end\n my_parents << name\n field[:fields].each do |sub_field|\n field_str << display_field(sub_field, (depth + 1), my_parents)\n end\n field_str\n end", "def display_fields\n [\"user_name\", \"assignment_name\"]\n end", "def get_field_display_rtpl\n '{%=' + @model_name + '[:' + @name + ']%}'\n end", "def edit_as(arg = nil, &proc) # :yields: field_def or nil\n @view_control.edit_as(arg, &proc)\n end", "def evaluate_field_name(field_name_or_proc)\n return field_name_or_proc if field_name_or_proc.nil?\n\n field_name = field_name_or_proc.respond_to?(:call) ? field_name_or_proc.call(controller.const) : field_name_or_proc\n field_name.to_sym\n end", "def with_fields_for_options( direct_callers_proc, record_or_name_or_array, args, original_callers_proc)\n options = args.detect { |argument| argument.is_a?(Hash) }\n if options.nil? # if caller didn't send options, append our own Hash\n options = {}\n args << options\n end\n options.reverse_merge! :controls => true, :scaffold => true # defaults\n controls = options.delete(:controls)\n scaffold = options.delete(:scaffold)\n builder = ( controls ? AirBlade::AirBudd::FormBuilder : AirBlade::AirBudd::DivBuilder)\n builder = ( returning( Class.new( builder ) ) { |c| \n c.wrapper_class = AirBlade::AirBudd::EmptyWrapper } ) unless scaffold\n options[:builder] = builder\n direct_callers_proc.call builder, controls, scaffold, record_or_name_or_array, args, original_callers_proc\n end", "def fields_for(method_or_object, *args, &block)\n options = args.extract_options!\n if @object\n case method_or_object\n when String, Symbol\n object = @object.send method_or_object\n if object.is_a?(Array) or object.is_a?(ActiveRecord::Relation)\n name = options[:name] || \"#{@object_name}[#{method_or_object}_attributes]\"\n return ((0...object.length).collect do |i|\n @template.fields_for(\"#{name}[#{i}]\", object[i], *args, &block)\n end).join.html_safe\n else\n name = options[:name] || method_or_object\n #@template.concat \"<!-- else -->\"\n return super(name, object, *args, &block)\n end\n end\n end\n\n super(method_or_object, *args, &block)\n end", "def display_name(opts)\n opts = check_params(opts,[:field_names])\n super(opts)\n end", "def field_called(field_name)\n return nil if field_name.to_s.empty?\n # return nil if field_name.to_s.empty?\n @fields[field_name.to_sym]\n end", "def display_fields\n @form.fields.each {|f| puts f.name}\n end", "def handler(field_name)\n return @object.public_send(field_name) if user_visible?\n\n nil\n end", "def display_fields\n database_field_names\n end", "def display(format, show_description:)\n @genre.display() if show_description\n super(format) # Invoke display method in Collection, \n # explicitly passing it the format argument \n end", "def display\n\t\tname\n\tend", "def display\n\t\tname\n\tend", "def display\n\t\tname\n\tend", "def display\n\t\tname\n\tend", "def display\n @object.send(Innsights.user_display)\n end", "def get_display_name\n @display_name ||= self.user.display_name\n end", "def display_resource(user)\n user.full_name\n end", "def display_method(method)\n @display.display_method_info method\n end", "def display_name\n name\n end", "def display_name\n name\n end", "def display_name\n name\n end", "def display_name\n if cas_surname and cas_givenname\n cas_givenname + ' ' + cas_surname\n else\n username\n end\n end", "def display_resource(user)\n \"#{user.first_name} - #{user.last_name}\"\n end", "def user_display_name\n @attributes[:user_display_name]\n end", "def display_name\n return @display_name\n end", "def display(*args)\n @__caller_info__ = __caller_info__\n super\n end", "def field(rec, form_drawer)\n form_drawer.draw_field(rec, self)\n end", "def get_field_defs_field(view_control)\n if (self.respond_to? :field_defs) && this_field = field_defs.field_called(view_control.name)\n this_field\n end\n end", "def display_name\n read_attribute :name\n end", "def display_name\n read_attribute :name\n end", "def display_name_without_user_filter(name)\n name[:display_name]\n end", "def display_method name\n out = RDoc::Markup::Document.new\n\n add_method out, name\n\n display out\n end", "def metadata\n return super if block_given?\n\n @metadata || @view_context.render(@metadata_component.new(fields: presenter.field_presenters, show: show?))\n end", "def display_name \n username\n end", "def display_resource(user)\n user.name\n end", "def display_name\n self.email\nend", "def display_name\n self.name\n end", "def name\n\t\tself.rsuser.display_name\n\tend", "def call_field(field)\n field.to_s.split('__').inject(self) { |a, e| a&.send(e) }\n rescue NoMethodError\n ''\n end", "def call_field(field)\n field.to_s.split('__').inject(self) { |a, e| a.send(e) unless a.nil? }\n end", "def hide_as(arg = nil, &proc) # :yields: field_def or nil\n @view_control.hide_as(arg, &proc)\n end", "def display_name\n \"#{self.last_name}, #{self.first_name}\"\n end", "def display_name\n \"#{name}\"\n end", "def display_name\n \"#{name}\"\n end", "def display_name\n \"#{name}\"\n end", "def user_display_name\n return @user_display_name\n end", "def user_display_name\n return @user_display_name\n end", "def user_display_name\n return @user_display_name\n end", "def display_name\n username\n end", "def get_show_view(view_control) # :nodoc:\n to_return = nil\n if(view_control.show_as_proc.nil?)\n to_return = default_show(view_control)\n else\n to_return = capture(get_field_defs_field(view_control), &view_control.show_as_proc)\n end\n if wrap_proc = view_control.show_wrap_proc\n to_return = wrap_proc.call(current_model.to_s.underscore, view_control.name, to_return)\n end\n to_return\n end", "def fields_for(record_or_name_or_array, *args, &block)\n raise ArgumentError, \"Missing block\" unless block_given?\n options = args.extract_options!\n \n case record_or_name_or_array\n when String, Symbol\n object_name = record_or_name_or_array\n object = args.first\n else\n object = record_or_name_or_array\n object_name = ActionController::RecordIdentifier.singular_class_name(object)\n end\n \n builder = options[:builder] || ActionView::Base.default_form_builder\n # to_s is required because capture result might be buffer object (which is not necessarily a string)\n result = capture(builder.new(object_name, object, self, options, block), &block).to_s\n \n if block_called_from_erb?(block)\n concat result\n else\n result\n end\n \n end", "def display_name\n return @display_name\n end", "def name\n\t\tfac_displayname\n\tend", "def display_name\n if !self.first_name.blank?\n self.first_name\n elsif !self.name.blank?\n self.name\n elsif !self.provider_username.blank?\n self.provider_username\n else\n self.email\n end\n end", "def index_field_label(document, field)\n lookup_display_name(document, field) || super\n end", "def editable_if_current_user(user, field)\n\t\tif current_user?(user) \n\t\t\tbest_in_place user, field.to_sym\n\t\telse\n\n\t\t\t\"#{user.send(field)}\"\n\t\tend\n\tend", "def read_field\n end", "def show_fields_for(display_types)\n Array(display_types).inject(show_fields) do |fields, display_type|\n fields.merge(for_display_type(display_type).show_fields)\n end\n end", "def display_name(name = nil)\n name ? @name = name : return_or_call(get_inherited_attribute(\"@name\"))\n end", "def display(row)\n field_components = @display_field.split(\".\")\n field_components.inject(row) do |object, field|\n object.try(field) || \"n/a\"\n end\n end", "def can_display_in?(screen, field)\n return self.kind == field.kind\n end", "def method_missing(meth, *args, &blk)\n super unless Fields.all.include?(meth)\n field meth, *args\n end", "def generic_render_document_field_label(config_field, document, field: field_name)\n send(:\"render_document_#{config_field}_label\", document, field: field)\n end", "def generic_render_document_field_label(config_field, document, field: field_name)\n send(:\"render_document_#{config_field}_label\", document, field: field)\n end", "def get_field(field_name)\n\t\tend", "def formal_format(user)\n user.last_name + ', ' + user.first_name + '.'\n end", "def show_full_name\n name\n end", "def field(name); end", "def display_full_name\n \"#{self.name} #{self.last_name}\"\n end", "def get_for_display(verse)\n self.class.format_for_display(super)\n end", "def format_submission_field(field, value, &block)\n FormSubmissionFieldDisplay.new(self, field, value, &block)\n end", "def record_edit_display\n \"1. Name: #{name}\\n\"\\\n \"2. Email: #{email}\\n\"\\\n \"3. Library: #{libraries_edit_display}\"\n end", "def semantic_fields_for(record_or_name_or_array, *args, &block)\n fields_for(record_or_name_or_array, *args, &block)\n end", "def fields_for_with_form_assistant(record_or_name_or_array, *args, &proc)\n options = args.extract_options!\n # hand control over to the original #fields_for()\n fields_for_without_form_assistant(record_or_name_or_array, *(args << options.merge!(:builder => self.class)), &proc)\n end", "def display_name\n entry = JSON.parse(self.entry)\n user = User.find(user_id)\n \"#{user.display_name} #{entry['text']}\"\n end", "def display_resource(user)\n \"#{user.email}\"\n end", "def crushyfield(col, o={})\n return '' if (o[:type]==:none || model.schema[col][:type]==:none)\n return crushyinput(col,o) if (o[:input_type]=='hidden' || model.schema[col][:input_type]=='hidden')\n default_field_name = col[/^id_/] ? Kernel.const_get(col.sub(/^id_/, '')).human_name : col.tr('_', ' ').capitalize\n field_name = o[:name] || model.schema[col][:name] || default_field_name\n error_list = errors_on(col).map{|e|\" - #{e}\"} if !errors_on(col).nil?\n \"<p class='crushyfield %s'><label for='%s'>%s</label><span class='crushyfield-error-list'>%s</span><br />\\n%s</p>\\n\" % [error_list&&'crushyfield-error', field_id_for(col), field_name, error_list, crushyinput(col, o)]\n end", "def display_name\n name || email\n end", "def display_name\n name || email\n end", "def show_field( name, val, indent )\n return if val.nil?\n return if val.respond_to?( :empty? ) && val.empty?\n puts \"#{indent}#{name} => #{val}\"\n end" ]
[ "0.67662483", "0.6171107", "0.6156245", "0.6135175", "0.5839443", "0.5765052", "0.57484514", "0.5679762", "0.5616974", "0.5616675", "0.5557382", "0.55462784", "0.55382544", "0.5517704", "0.5498199", "0.54641896", "0.54518807", "0.5446169", "0.5443193", "0.5429538", "0.5385006", "0.5370405", "0.5368973", "0.53651136", "0.53384084", "0.5319764", "0.5308018", "0.5299161", "0.52961427", "0.52675277", "0.5264393", "0.5264393", "0.5264393", "0.5264393", "0.52518255", "0.5251375", "0.52419484", "0.523259", "0.5226187", "0.5226187", "0.5226187", "0.5209161", "0.5205463", "0.5192405", "0.51899916", "0.51626796", "0.51497656", "0.5145202", "0.5144461", "0.5144461", "0.5135857", "0.5134522", "0.5124784", "0.5122772", "0.511586", "0.5114219", "0.51007485", "0.5077108", "0.5059858", "0.5054647", "0.5051945", "0.5045869", "0.5040051", "0.5040051", "0.5040051", "0.50400496", "0.50400496", "0.50400496", "0.5027874", "0.501396", "0.5013235", "0.50054824", "0.49939197", "0.49925828", "0.49925002", "0.4991515", "0.49853078", "0.4985233", "0.49761507", "0.49717128", "0.49713248", "0.49545214", "0.49514207", "0.49514207", "0.4950206", "0.49497214", "0.49475566", "0.4945931", "0.49454018", "0.4938721", "0.49362025", "0.49350333", "0.49335772", "0.49313322", "0.49311432", "0.49292058", "0.49264303", "0.4919363", "0.4919363", "0.49154392" ]
0.77835965
0
Get a hash of all fields of the form: field name => human name
def all_attributes @@all_attributes ||= begin to_return = {} @fields.each do |key, field| to_return[key] = field.human_name end to_return end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fields\n iterator = @form_fields.keySet.iterator\n map = {}\n while iterator.hasNext\n key = iterator.next.toString\n map[key.to_sym] = field(key)\n end\n map\n end", "def form_fields\n values = super\n result = {}\n mappings.values.each { |field|\n result[field] = values[field] if values[field]\n }\n result\n end", "def field_names\n fields.keys\n end", "def names\n iterator = @form_fields.keySet.iterator\n set = []\n set << iterator.next.toString.to_sym while iterator.hasNext\n set\n end", "def hashed_fields_for_export\n raise InvalidArgument unless self.form\n\n hash = {}\n\n self.form.questions.map { |q| hash[q.answer_field] = q.text }\n\n hash.merge({\n ip_address: \"IP Address\",\n user_agent: \"User Agent\",\n page: \"Page\",\n referer: \"Referrer\",\n created_at: \"Created At\"\n })\n end", "def fields\n @fields.keys\n end", "def fields\n @fields.keys\n end", "def all_fields\n fields.values\n end", "def fields\r\n @hash.keys\r\n end", "def field_names\n (text_fields + html_fields + atom_fields + datetime_fields +\n number_fields + geo_fields).uniq\n end", "def format_forms(page)\n ret = {}\n page.forms.each do |form|\n ret[form.name] = []\n form.fields.each do |n|\n ret[form.name] << n.name\n end\n end\n return ret\nend", "def all_fields\n @fields.values\n end", "def field_names\n label_fields.to_h\n end", "def get_fields\n _fields = @config['form']['fields']\n _fields.map{|k,v| Field.new(k=>v)}\n end", "def info_hash\n @fields\n end", "def fields_hash\n each_pair.to_h\n end", "def keys\n fields.map { |f| f.name }\n end", "def field_hash\n\n self.yattributes || fields.inject({}) { |r, f| r[f.fkey] = f.value; r }\n end", "def hash\n fields.map { |field| instance_variable_get(field[:name]) }.hash\n end", "def fields\n @field_labels.collect { |k, v| { sym: k, name: v } }\n end", "def values\n iterator = @form_fields.keySet.iterator\n set = []\n set << field(iterator.next.toString) while iterator.hasNext\n set\n end", "def fields\n form = @stamper.getAcroFields\n form.getFields.each_with_object({}) do |(name, value), fields|\n fields[name.to_sym] = form.getField(name)\n end\n end", "def form_fields\n self.class.fields.values.select { |field| field.form }\n end", "def fields()\n if !@custom_fields || @fields.length == 0 then\n @elements.each { |field|\n if field.respond_to?(:is_form_field) then\n @fields << field.name\n @element_map[field.name.to_s] = field\n elsif field.is_a?(Fieldset) then\n @fields << { field.name => field.fields }\n @element_map.update(field.element_map)\n end\n }\n end\n @fields.uniq!\n return @fields\n end", "def fields\n @fields ||= {}\n end", "def fields\n @fields ||= {}\n end", "def fields\n @fields ||= {}\n end", "def fields\n @fields ||= {}\n end", "def fields\n @fields ||= {}\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 get_field_names(template)\n read(template).fields.map{|f| f.name}\n end", "def hashed_fields_for_export\n hash = {}\n\n self.ordered_questions.map { |q| hash[q.answer_field] = q.text }\n\n hash.merge!({\n location_code: \"Location Code\",\n user_agent: \"User Agent\",\n page: \"Page\",\n referer: \"Referrer\",\n created_at: \"Created At\"\n })\n\n if self.organization.enable_ip_address?\n hash.merge!({\n ip_address: \"IP Address\"\n })\n end\n\n hash\n end", "def field_names\n internal_format.keys\n end", "def field_names\r\n return @field_names\r\n end", "def form_fields\n params\n end", "def fields\n to_h.keys\n .reject{|key| key.start_with?('_sm_')}\n .map{|key| key.to_sym}\n .to_set\n end", "def each_field\n self.form.form_fields.each do |field|\n yield field, self.data[field.name.to_sym]\n end\n end", "def fields; h.fields; end", "def to_hash\n @fields\n end", "def attributes\n self.class.fields.inject({}) do |attribute_hash, field|\n attribute_hash[field] = send(field)\n attribute_hash\n end\n end", "def field_names\n @_field_path.map{ |field_| field_.name }\n end", "def fields_hash\n @fields_hash ||=\n begin\n field_sets_hash = Hash.new { |h, k| h[k] = Set.new }\n @types.each do |type|\n Setup.for(type).fields.each do |field|\n field_sets_hash[field.name.to_sym] << field\n end\n end\n fields_hash = {}\n field_sets_hash.each_pair do |field_name, set|\n if set.length == 1\n fields_hash[field_name] = set.to_a.first\n end\n end\n fields_hash\n end\n end", "def form_names\n forms.map(&:name).join(\", \")\n end", "def fields\n @fields ||= form.fields\n end", "def names\n NAME_FIELDS.map { |k| has_field?(k) ? @fields[k].tokens : nil }.flatten.compact\n end", "def get_field_names(template); end", "def form_names\n forms.map(&:name).join(', ')\n end", "def display_fields\n @form.fields.each {|f| puts f.name}\n end", "def all_attributes_labeled(label_name)\n to_return = {}\n @fields.each do |key, field|\n if field.has_label?(label_name.to_sym)\n to_return[key] = field.human_name\n end\n end\n to_return\n end", "def fields_on_form() #:nodoc:\r\n fields = []\r\n if @form['form']['fields']\r\n# read only field elements (key is Fixnum)\r\n @form['form']['fields'].each {|key,options| fields << options if key.class == Fixnum }\r\n else\r\n @form['form']['tabs'].keys.each do |tab|\r\n @form['form']['tabs'][tab].each {|key,options| fields << options if key.class == Fixnum }\r\n end \r\n end\r\n fields\r\nend", "def fields\n properties.keys.map(&:to_sym)\n end", "def fields\n properties.keys.map(&:to_sym)\n end", "def person_name_fields\n \"\".tap do |result|\n fields_for(:person_name) do |f|\n result << f.text_field(:name_prefix)\n result << f.text_field(:first_name)\n result << f.text_field(:middle_name)\n result << f.text_field(:last_name)\n result << f.text_field(:name_suffix)\n end\n end\n end", "def fields_by_name(name)\n @fields.select{|f|f.name==name}\n end", "def fields\n @_fields ||= {}\n end", "def text_fields_hash\n @text_fields_hash ||=\n setups.inject({}) do |hash, setup|\n setup.all_text_fields.each do |text_field|\n (hash[text_field.name] ||= Set.new) << text_field\n end\n hash\n end\n end", "def attachment_fields_hash\n @attachment_fields_hash ||=\n setups.inject({}) do |hash, setup|\n setup.all_attachment_fields.each do |text_field|\n (hash[text_field.name] ||= Set.new) << text_field\n end\n hash\n end\n end", "def hash\n [id, field_type, mode, label, no_wrap, bold, required, appears_by_default, find_enabled, allow_new_choices, sort_as_given, carry_choices, foreign_key, unique, does_data_copy, field_help, audited, num_lines, max_length, append_only, allow_html, has_extension, units, decimal_places, comma_start, number_format, does_average, does_total, blank_is_zero, currency_symbol, currency_format, display_time, display_relative, display_month, default_today, display_day_of_week, display_timezone, work_week, start_field, duration_field, format, hours24, display_user, default_kind, default_value_luid, choices_luid, choices, composite_fields, target_table_id, target_field_id, source_field_id, use_new_window, link_text, exact, display_images, default_domain, display_email, appears_as, abbreviate, auto_save, target_table_name, display_as_link, sort_alpha, version_mode, max_versions, see_versions, width, xml_tag, formula, default_value, comments, master_choice_table_id, master_choice_field_id, snap_field_id, parent_field_id, lookup_target_field_id, lookup_reference_field_id, summary_reference_field_id, summary_target_field_id, summary_function, master_table_tag, permissions].hash\n end", "def get_entered_fields\n @entered_fields = get_used_fields_only(@contact_form_field)\n @entered_fields\n end", "def fields_by_name(name)\n @fields.select{|f|f.name==name}\n end", "def field_names\n attribute_names.map(&:to_sym)\n end", "def fields_for_query\n self.class.fields_coercions.keys.each_with_object({}) do |field_name, results|\n results[field_name] = @fields.each_with_object({}) do |(locale, fields), field_results|\n field_results[locale] = get_value_from(fields, field_name)\n end\n end\n end", "def fields_for_query\n self.class.fields_coercions.keys.each_with_object({}) do |field_name, results|\n results[field_name] = @fields.each_with_object({}) do |(locale, fields), field_results|\n field_results[locale] = get_value_from(fields, field_name)\n end\n end\n end", "def field_names\n @field_names ||= (columns_hash.keys.map(&:to_sym) rescue [])\n end", "def field_options\n self.class.fields.values\n end", "def fields\n @fields\n end", "def fields\n @fields\n end", "def fields\n FIELDS\n end", "def form_fields\n base_json = base_params\n base_json[:nonce] = SecureRandom.hex(15)\n hmac_fields = (base_json.keys + ['hmac_fields']).sort.uniq!\n\n base_json[:hmac_fields] = hmac_fields.join(',')\n hmac_string = hmac_fields.map { |key, _v| \"#{key}=#{base_json[key]}\" }.join('&')\n hmac = OpenSSL::HMAC.hexdigest('sha1', KEY, hmac_string)\n base_json[:hmac] = hmac\n\n base_json\n end", "def field_names(include_hidden = false)\n # collect field names\n names = []\n hidden = no_eval_param(:hide)\n @field_names.each do |name|\n if include_hidden or not hidden.include?(name)\n names << name\n end\n end\n names\n end", "def config_fields\n get_config_fields.map { |f| f[:field_name].to_sym }\n end", "def config_fields\n get_config_fields.map { |f| f[:field_name].to_sym }\n end", "def fields\n FIELDS\n end", "def fields_on_form #:nodoc:\r\n form_fields = []\r\n if @form['form']['fields']\r\n # read only field elements (key is Integer)\r\n @form['form']['fields'].each { |key, options| form_fields << options if key.class == Integer }\r\n else\r\n @form['form']['tabs'].keys.each do |tab|\r\n @form['form']['tabs'][tab].each { |key, options| form_fields << options if key.class == Integer }\r\n end \r\n end\r\n form_fields\r\nend", "def form_field_data\n @attributes[:form_field_data]\n end", "def fields\n klass.members.map(&:to_sym)\n end", "def fields(field_hash = {})\n @fields.merge!(field_hash) unless field_hash.empty?\n @fields\n end", "def form_fields(pairs: nil, **opt)\n fields = AccountConcern::PASSWORD_KEYS\n fields = fields.excluding(:current_password) if manager? || administrator?\n added = fields.map { |k| [k.to_s.titleize, k] }.to_h\n pairs = pairs&.merge(added) || added\n super\n end", "def all_fields\n fields = Set.new(@fields)\n @times.each {|entry| fields += entry.keys} unless fields.size > 0\n return fields.to_a.sort\n end", "def field_names\n @field_names ||= attribute_names.map(&:to_sym)\n end", "def fieldmap\n { \n 'MEMBERID' => 'id',\n 'EMAIL' => 'email',\n 'FNAME' => 'first_name',\n 'LNAME' => 'last_name',\n 'ADDRESS' => 'address',\n 'CITY' => 'city',\n 'STATE' => 'state',\n 'ZIP' => 'zip',\n 'BIRTHDATE' => 'birth_date',\n 'MSINCEDATE' => 'member_since_date',\n 'BILLDATE' => 'next_retry_bill_date',\n 'EXTERNALID' => 'external_id',\n 'GENDER' => 'gender',\n 'PHONE' => 'full_phone_number',\n 'CJOINDATE' => 'current_join_date'\n }\n end", "def forms_fields(form, action)\n section_fields = []\n form.form_sections.each do |section|\n if section['permissions'][\"#{current_user.role.short_name}\"][action] == '1'\n section_fields << section.section_fields.map do |field|\n if field.field_type.field_type.start_with?('select') && field.field_type.options['multivalue'] == '1'\n { field.id.to_s.to_sym => [] }\n else\n field.id.to_s.to_sym\n end\n end\n end\n end\n section_fields\n end", "def fields\n FIELDS\n end", "def fields\n all_fields\n end", "def fields\n a = attributes.keys.to_a\n a.delete_if { | e | e =~ /^id$/ }\n end", "def fields\n @fields\n end", "def names \n all_forms\n end", "def salesforce_attributes ; @salesforce_fields.keys ; end", "def fields\n class_name.constantize.fields\n end", "def fields; end", "def fields; end", "def fields; end", "def fields\n raw['fields']\n end", "def headers\n fields.map(&:name).map(&:to_sym)\n end", "def field_ids\n @fields.keys\n end", "def to_field_hash\n to_values_hash.flatten\n end", "def form_user(form)\r\n {\r\n :email => form['email'],\r\n :password => form['password'],\r\n :name => form['name'] # Make proper greetings if it's nil\r\n }\r\n end", "def form_fields\n @fields.merge(\"AUTHCODE\" => generate_md5string)\n end", "def fields\n displayed_fields = @display_fields.select { |display_field| @document.key?(display_field) }\n pairs = displayed_fields.map do |display_field|\n [display_field, Array.wrap(@document.fetch(display_field))]\n end\n Hash[pairs]\n end", "def field_names(filter = [], include_inherited = true)\n names = fields.keys\n\n if include_inherited && has_parent?\n names.concat(inherited_fields)\n end\n\n unless filter.empty?\n names = names & filter.map(&:to_sym)\n end\n\n names.sort!\n names\n end" ]
[ "0.8123569", "0.7356526", "0.7281278", "0.72111523", "0.71293825", "0.70986676", "0.70986676", "0.70924854", "0.7040434", "0.69130963", "0.68933916", "0.6892606", "0.6873787", "0.6872257", "0.686649", "0.6861421", "0.6856828", "0.6853996", "0.6800241", "0.6798241", "0.67684394", "0.6669889", "0.66577023", "0.6644024", "0.6632159", "0.6632159", "0.6632159", "0.6632159", "0.6632159", "0.6606393", "0.6605607", "0.65871114", "0.6556498", "0.65382224", "0.65239966", "0.6515113", "0.64965856", "0.6490519", "0.64831656", "0.6482618", "0.6475377", "0.6466277", "0.64626926", "0.6455508", "0.6439365", "0.6436743", "0.641044", "0.6409394", "0.6394097", "0.6392857", "0.6390335", "0.6390335", "0.6384722", "0.63595766", "0.63437843", "0.63427734", "0.63159126", "0.6300408", "0.629864", "0.62849855", "0.62768245", "0.6266135", "0.6266135", "0.6240112", "0.6238928", "0.6221064", "0.6221064", "0.62142074", "0.62100774", "0.6207348", "0.62019485", "0.62019485", "0.6193563", "0.61924636", "0.6184882", "0.61826754", "0.6158996", "0.61343616", "0.61264", "0.61206496", "0.6119443", "0.6114105", "0.6112961", "0.6111319", "0.6110222", "0.6108555", "0.6092591", "0.60916007", "0.60757625", "0.60735065", "0.60735065", "0.60735065", "0.6071053", "0.6070524", "0.6068", "0.60678107", "0.6063911", "0.6063075", "0.60605544", "0.60522026" ]
0.6219597
67
Get a hash of all fields of the form: field name => human name Include only those fields that have the given label
def all_attributes_labeled(label_name) to_return = {} @fields.each do |key, field| if field.has_label?(label_name.to_sym) to_return[key] = field.human_name end end to_return end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def field_names\n label_fields.to_h\n end", "def all_fields_labeled(label_name)\n @fields.values.reject do |field|\n !field.has_label?(label_name.to_sym)\n end\n end", "def fields\n iterator = @form_fields.keySet.iterator\n map = {}\n while iterator.hasNext\n key = iterator.next.toString\n map[key.to_sym] = field(key)\n end\n map\n end", "def form_fields\n values = super\n result = {}\n mappings.values.each { |field|\n result[field] = values[field] if values[field]\n }\n result\n end", "def fields\n @field_labels.collect { |k, v| { sym: k, name: v } }\n end", "def label_fields\n @label_fields ||= LabelFields.new do |lf|\n labels.each { |label| lf.add(label) }\n end\n end", "def labels\n fields[\"labels\"]\n end", "def fields_by_name(name)\n @fields.select{|f|f.name==name}\n end", "def fields_by_name(name)\n @fields.select{|f|f.name==name}\n end", "def field_detect(label)\n @field = fields.detect { |item| item.text.include? label }\n\n raise \"Field '#{label}' was not found on form.\" unless @field\n end", "def names\n iterator = @form_fields.keySet.iterator\n set = []\n set << iterator.next.toString.to_sym while iterator.hasNext\n set\n end", "def field_names\n fields.keys\n end", "def all_fields\n fields.values\n end", "def labels!(lbl)\n save!(\"fields\" => { \"labels\" => lbl.uniq }) unless lbl.empty?\n end", "def hashed_fields_for_export\n raise InvalidArgument unless self.form\n\n hash = {}\n\n self.form.questions.map { |q| hash[q.answer_field] = q.text }\n\n hash.merge({\n ip_address: \"IP Address\",\n user_agent: \"User Agent\",\n page: \"Page\",\n referer: \"Referrer\",\n created_at: \"Created At\"\n })\n end", "def values\n iterator = @form_fields.keySet.iterator\n set = []\n set << field(iterator.next.toString) while iterator.hasNext\n set\n end", "def consolidate_under_labels(fields)\n results = {}\n fields.each do |mdv| # ModsDisplay::Values\n results[mdv.label] ||= []\n results[mdv.label] << mdv.values\n results[mdv.label].flatten!\n end\n results\n end", "def get_fields\n _fields = @config['form']['fields']\n _fields.map{|k,v| Field.new(k=>v)}\n end", "def all_fields\n @fields.values\n end", "def field_names(include_hidden = false)\n # collect field names\n names = []\n hidden = no_eval_param(:hide)\n @field_names.each do |name|\n if include_hidden or not hidden.include?(name)\n names << name\n end\n end\n names\n end", "def form_fields\n self.class.fields.values.select { |field| field.form }\n end", "def field_names\n (text_fields + html_fields + atom_fields + datetime_fields +\n number_fields + geo_fields).uniq\n end", "def fields\n @fields.keys\n end", "def fields\n @fields.keys\n end", "def fields()\n if !@custom_fields || @fields.length == 0 then\n @elements.each { |field|\n if field.respond_to?(:is_form_field) then\n @fields << field.name\n @element_map[field.name.to_s] = field\n elsif field.is_a?(Fieldset) then\n @fields << { field.name => field.fields }\n @element_map.update(field.element_map)\n end\n }\n end\n @fields.uniq!\n return @fields\n end", "def format_forms(page)\n ret = {}\n page.forms.each do |form|\n ret[form.name] = []\n form.fields.each do |n|\n ret[form.name] << n.name\n end\n end\n return ret\nend", "def display_fields\n @form.fields.each {|f| puts f.name}\n end", "def fields\n @fields ||= form.fields\n end", "def fields\r\n @hash.keys\r\n end", "def default_fields_for_forms\n [\n { :name => :le_title__get_full_name, :field_label => I18n.t(:le_title, {:scope=>[:activerecord, :models]}),\n # [20121121] For the combo-boxes to have a working query after the 4th char is entered in the edit widget,\n # a lambda statement must be used. Using a pre-computed scope from the Model class prevents Netzke\n # (as of this version) to append the correct WHERE clause to the scope itself (with an inline lambda, instead, it works).\n :scope => lambda { |rel| rel.order(\"name ASC\") }\n },\n { :name => :name, :field_label => I18n.t(:name) },\n { :name => :surname, :field_label => I18n.t(:surname) },\n { :name => :le_contact_type__get_full_name, :field_label => I18n.t(:le_contact_type, {:scope=>[:activerecord, :models]}),\n # [20121121] See note above for the sorted combo boxes.\n :scope => lambda { |rel| rel.order(\"name ASC\") }\n },\n { :name => :is_suspended, :field_label => I18n.t(:is_suspended),\n :default_value => false, :unchecked_value => 'false',\n :field_style => 'min-height: 13px; padding-left: 13px;'\n },\n { :name => :address, :field_label => I18n.t(:address) },\n { :name => :le_city__get_full_name, :field_label => I18n.t(:le_city, {:scope=>[:activerecord, :models]}),\n # [20121121] See note above for the sorted combo boxes.\n :scope => lambda { |rel| rel.order(\"name ASC, area ASC\") }\n },\n { :name => :tax_code, :field_label => I18n.t(:tax_code) },\n { :name => :vat_registration, :field_label => I18n.t(:vat_registration) },\n { :name => :date_birth, :field_label => I18n.t(:date_birth) },\n { :name => :phone_home, :field_label => I18n.t(:phone_home) },\n { :name => :phone_work, :field_label => I18n.t(:phone_work) },\n { :name => :phone_cell, :field_label => I18n.t(:phone_cell) },\n { :name => :phone_fax, :field_label => I18n.t(:phone_fax) },\n { :name => :e_mail, :field_label => I18n.t(:e_mail) },\n\n { :name => :date_last_met, :field_label => I18n.t(:date_last_met) },\n { :name => :notes, :field_label => I18n.t(:notes), :width => 200 },\n { :name => :personal_notes, :field_label => I18n.t(:personal_notes), :width => 200 },\n { :name => :family_notes, :field_label => I18n.t(:family_notes), :width => 200 }\n ]\n end", "def get_entered_fields\n @entered_fields = get_used_fields_only(@contact_form_field)\n @entered_fields\n end", "def keys\n fields.map { |f| f.name }\n end", "def field_hash\n\n self.yattributes || fields.inject({}) { |r, f| r[f.fkey] = f.value; r }\n end", "def forms_fields(form, action)\n section_fields = []\n form.form_sections.each do |section|\n if section['permissions'][\"#{current_user.role.short_name}\"][action] == '1'\n section_fields << section.section_fields.map do |field|\n if field.field_type.field_type.start_with?('select') && field.field_type.options['multivalue'] == '1'\n { field.id.to_s.to_sym => [] }\n else\n field.id.to_s.to_sym\n end\n end\n end\n end\n section_fields\n end", "def get_field_names(template); end", "def hash\n [id, field_type, mode, label, no_wrap, bold, required, appears_by_default, find_enabled, allow_new_choices, sort_as_given, carry_choices, foreign_key, unique, does_data_copy, field_help, audited, num_lines, max_length, append_only, allow_html, has_extension, units, decimal_places, comma_start, number_format, does_average, does_total, blank_is_zero, currency_symbol, currency_format, display_time, display_relative, display_month, default_today, display_day_of_week, display_timezone, work_week, start_field, duration_field, format, hours24, display_user, default_kind, default_value_luid, choices_luid, choices, composite_fields, target_table_id, target_field_id, source_field_id, use_new_window, link_text, exact, display_images, default_domain, display_email, appears_as, abbreviate, auto_save, target_table_name, display_as_link, sort_alpha, version_mode, max_versions, see_versions, width, xml_tag, formula, default_value, comments, master_choice_table_id, master_choice_field_id, snap_field_id, parent_field_id, lookup_target_field_id, lookup_reference_field_id, summary_reference_field_id, summary_target_field_id, summary_function, master_table_tag, permissions].hash\n end", "def all_valuefield_hash\n hash = {}\n items = @all_valuefields\n for vf in items\n hash[vf] = {}\n end\n return hash\n end", "def fields_hash\n @fields_hash ||=\n begin\n field_sets_hash = Hash.new { |h, k| h[k] = Set.new }\n @types.each do |type|\n Setup.for(type).fields.each do |field|\n field_sets_hash[field.name.to_sym] << field\n end\n end\n fields_hash = {}\n field_sets_hash.each_pair do |field_name, set|\n if set.length == 1\n fields_hash[field_name] = set.to_a.first\n end\n end\n fields_hash\n end\n end", "def find_field_names(layout)\n result = {} # hash to be returned: field names for the attributes\n return result if layout.nil? or @model.nil?\n attr_names = @model.attribute_names.map{|name| name.downcase} # model attributes\n fm_fields = layout.field_names.map{|name| name.downcase} # layout's fields\n \n attr_names.each do |attr_name| # for each of the model's attributes\n \n special = @special_field_name[@model] # possibly nil\n f_name = special.nil? ? nil : special[attr_name] # possibly nil\n\n if f_name then\n if fm_fields.include?(f_name)\n result[attr_name] = f_name\n else \n LOG.warn \"WARNING: Field \\\"#{f_name}\\\" not found on layout \\\"#{layout.name}\\\".\"\n next\n end\n\n else # no special field name: guess regular field name\n name_transformations do |transf|\n if fm_fields.include?(transformed = transf.call(attr_name))\n result[attr_name] = transformed\n break # found a match! exit the block\n end\n end\n end\n \n if result[attr_name].nil?\n LOG.warn \"WARNING: No field found for #{@model.to_s}.#{attr_name}\"\n else\n LOG.info \" mapping: #{attr_name} <-- #{result[attr_name]}\"\n end\n \n end\n return result\n end", "def govuk_grouped_fields(form, caption, *attributes)\n attributes_with_errors = attributes.flatten.select { |a| form.object.errors[a].any? }\n attributes_which_are_arrays = attributes.select { |a| form.object[a].is_a? Array }\n\n options = { class: 'govuk-fieldset' }\n options['aria-describedby'] = attributes_with_errors.map { |a| error_id(a) } if attributes_with_errors.any?\n\n tag.fieldset(options) do\n capture do\n concat(list_errors_for_attributes(attributes_which_are_arrays)) if attributes_which_are_arrays.any?\n concat(tag.legend(caption, class: 'govuk-fieldset__legend govuk-fieldset__legend--m'))\n\n attributes.flatten.each do |a|\n yield(form, a)\n end\n end\n end\n end", "def fields_for(hsh, lang)\n separator = LANG_SEP\n suffix = /#{separator}#{lang}\\z/i\n\n hsh.reject{|key, val| val.blank?}.hmap do |key, value|\n [key.sub(suffix, '').to_sym, value]\n end\nend", "def fields\n @fields ||= {}\n end", "def fields\n @fields ||= {}\n end", "def fields\n @fields ||= {}\n end", "def fields\n @fields ||= {}\n end", "def fields\n @fields ||= {}\n end", "def to_hash(nested = true)\n # no need of _position and _visible (unless it's false)\n hash = super.delete_if { |k, v| k == '_position' || (k == '_visible' && v == true) }\n\n # also no need of the content type\n hash.delete('content_type')\n\n # dynamic attributes\n hash.merge!(self.dynamic_attributes.deep_stringify_keys)\n\n # no need of the translation of the field name in the current locale\n label_field = self.content_type.label_field\n\n if label_field.localized\n if !hash[label_field.name].empty?\n hash[label_field.name].delete(Locomotive::Mounter.locale.to_s)\n\n hash.delete(label_field.name) if hash[label_field.name].empty?\n end\n else\n hash.delete(label_field.name)\n end\n\n nested ? { self._label => hash } : hash\n end", "def select_fields_collection(bot)\n fields = [\n [\"\", self.class::FIELDS.map {|k,v| Queries::Field.new(id: k, to_label: v)}]\n ]\n\n if (rich_metrics = bot.dashboards.where(dashboard_type: DASHBOARDS, enabled: true).order(\"dashboard_type ASC\")).count > 0\n fields << [\"User Actions\", to_fields(rich_metrics)]\n end\n\n if (custom_metrics = bot.dashboards.where(dashboard_type: 'custom', enabled: true).order(\"dashboard_type ASC\")).count > 0\n fields << [\"Custom Metrics\", to_fields(custom_metrics)]\n end\n\n fields\n end", "def fields_on_form() #:nodoc:\r\n fields = []\r\n if @form['form']['fields']\r\n# read only field elements (key is Fixnum)\r\n @form['form']['fields'].each {|key,options| fields << options if key.class == Fixnum }\r\n else\r\n @form['form']['tabs'].keys.each do |tab|\r\n @form['form']['tabs'][tab].each {|key,options| fields << options if key.class == Fixnum }\r\n end \r\n end\r\n fields\r\nend", "def each_field\n self.form.form_fields.each do |field|\n yield field, self.data[field.name.to_sym]\n end\n end", "def field_names(filter = [], include_inherited = true)\n names = fields.keys\n\n if include_inherited && has_parent?\n names.concat(inherited_fields)\n end\n\n unless filter.empty?\n names = names & filter.map(&:to_sym)\n end\n\n names.sort!\n names\n end", "def hashed_fields_for_export\n hash = {}\n\n self.ordered_questions.map { |q| hash[q.answer_field] = q.text }\n\n hash.merge!({\n location_code: \"Location Code\",\n user_agent: \"User Agent\",\n page: \"Page\",\n referer: \"Referrer\",\n created_at: \"Created At\"\n })\n\n if self.organization.enable_ip_address?\n hash.merge!({\n ip_address: \"IP Address\"\n })\n end\n\n hash\n end", "def fields_on_form #:nodoc:\r\n form_fields = []\r\n if @form['form']['fields']\r\n # read only field elements (key is Integer)\r\n @form['form']['fields'].each { |key, options| form_fields << options if key.class == Integer }\r\n else\r\n @form['form']['tabs'].keys.each do |tab|\r\n @form['form']['tabs'][tab].each { |key, options| form_fields << options if key.class == Integer }\r\n end \r\n end\r\n form_fields\r\nend", "def fields; h.fields; end", "def get_field_names(template)\n read(template).fields.map{|f| f.name}\n end", "def field_label(field)\n @__field_label_cache ||= {}\n @__field_label_cache[field] ||= field.to_s.sub(/_facet$|_display$|_[a-z]$/,'').gsub(/_/,' ')\n @__field_label_cache[field]\n end", "def kyc_fields_config_with_labels\n\n @kyc_fields_config ||= begin\n data = []\n ::ClientKycConfigDetail.kyc_fields_config.keys.each do |kyc_field|\n data << {\n value: kyc_field.to_sym,\n display_text: kyc_field.titleize\n }\n\n end\n data\n end\n end", "def field_by_name(name)\n @fields.detect{|f|f.name==name}\n end", "def fields(field_hash = {})\n @fields.merge!(field_hash) unless field_hash.empty?\n @fields\n end", "def field_by_name(name)\n @fields.detect{|f|f.name==name}\n end", "def facet_field_names_for_advanced_search\n @facet_field_names_for_advanced_search ||=\n blacklight_config.facet_fields.reject { |_key, field_def|\n field_def.include_in_advanced_search.is_a?(FalseClass)\n }.values.map(&:field)\n end", "def fields\n to_h.keys\n .reject{|key| key.start_with?('_sm_')}\n .map{|key| key.to_sym}\n .to_set\n end", "def hash\n fields.map { |field| instance_variable_get(field[:name]) }.hash\n end", "def info_hash\n @fields\n end", "def label_field\n self.find_field(self.label_field_name) || self.fields.first\n end", "def search_fields\n [ 'name', 'email', 'description' ]\n end", "def fields_for_query\n self.class.fields_coercions.keys.each_with_object({}) do |field_name, results|\n results[field_name] = @fields.each_with_object({}) do |(locale, fields), field_results|\n field_results[locale] = get_value_from(fields, field_name)\n end\n end\n end", "def fields_for_query\n self.class.fields_coercions.keys.each_with_object({}) do |field_name, results|\n results[field_name] = @fields.each_with_object({}) do |(locale, fields), field_results|\n field_results[locale] = get_value_from(fields, field_name)\n end\n end\n end", "def search_fields (code = 'all')\n @available_search_criteria.fetch('AvailableSearchFields',{}).select{|item| item['FieldCode'] == code || code == 'all'}\n end", "def default_fields_for_forms\n [\n { name: :get_verbose_conflicting_row, width: 50,\n label: I18n.t('admin_import.conflicting_row')\n },\n { name: :import_text, flex: 1, label: I18n.t('admin_import.import_text') },\n\n { name: :name, width: 180, label: I18n.t('activerecord.attributes.team.name') },\n { name: :badge_number, width: 100, label: I18n.t('activerecord.attributes.team.zip') },\n\n { name: :data_import_city__name, width: 200,\n label: I18n.t('activerecord.models.data_import_city')\n },\n { name: :city__get_full_name, width: 200, label: I18n.t('activerecord.models.city')\n }\n ]\n end", "def create\n params.each do |key,value|\n if value.present? && !(['unique_id','controller','action','label','label_other','label_color'].include?(key))\n # is this unnecessary ?\n if value.kind_of?(Array)\n value = value[0]\n end \n @found = Field.where(unique_id: params[:unique_id], field_name: key.to_s )\n if @found.blank?\n @field = Field.new()\n else\n @field = @found.first\n end\n @field.field_name = key.to_s\n @field.field_value = value.to_s\n @field.user_id = current_user.id\n @field.form_id = params[:form_id]\n @field.unique_id = params[:unique_id]\n if params[:label] == 'other'\n @field.label = params[:label_other]\n else \n @field.label = params[:label]\n end\n @field.labelcolor = params[:label_color] \n @field.save\n end\n end\n if @found.blank?\n NotificationMailer.saved_email(current_user.email).deliver_now\n end\n @form = Field.where(unique_id: '9fc89d9e-5bcd-4c66-9e60-3ffb93503a88').to_a\n @form_fields = Hash.new\n @form.each do |value|\n @form_fields[value.field_name] = value.field_value\n end\n redirect_to \"/dashboard\"\n end", "def field_names\n @_field_path.map{ |field_| field_.name }\n end", "def form_names\n forms.map(&:name).join(\", \")\n end", "def load_fields!\n attributes = {}\n data_hash.each do |entry|\n next unless entry.is_a? Hash\n entry.keys.each { |key| attributes[key] ||= nil }\n end\n @fields = attributes.keys\n end", "def field_names\r\n return @field_names\r\n end", "def form_fields\n [:description, :status, :magic]\n end", "def all_fields\n found_fields = Array.new\n self.fields.each do |field|\n found_fields << field\n found_fields = found_fields + field.all_fields if field.type == 'ObjectField'\n end\n found_fields\n end", "def fields_hash\n each_pair.to_h\n end", "def fields(filter = nil)\n unless filter\n # Since we're returning the FieldMap object, which the caller\n # may mutate, we precautionarily mark dirty -- unless it's frozen\n # immutable.\n @fields.clean = false unless @fields.frozen?\n return @fields\n end\n @fields.reindex unless @fields.clean\n flds = []\n if filter.is_a?(String) && @fields.tags[filter]\n @fields.tags[filter].each do |idx|\n flds << @fields[idx]\n end\n elsif filter.is_a?(Array) || filter.is_a?(Range)\n @fields.each_by_tag(filter) do |tag|\n flds << tag\n end\n end\n flds\n end", "def fields\n a = attributes.keys.to_a\n a.delete_if { | e | e =~ /^id$/ }\n end", "def show_fields\n self.class.fields.values.select { |field| field.show }\n end", "def save_form_fields\n @save_form_fields ||= collect_save_form_fields\n end", "def form_names\n forms.map(&:name).join(', ')\n end", "def attachment_fields_hash\n @attachment_fields_hash ||=\n setups.inject({}) do |hash, setup|\n setup.all_attachment_fields.each do |text_field|\n (hash[text_field.name] ||= Set.new) << text_field\n end\n hash\n end\n end", "def manifestation_index_field_labels\n Blacklight.config[:manifestation_index_fields][:labels]\n end", "def fields\n @fields ||= @stats.keys.select{ |k| k != RECORDS_LISTING_KEY}.flatten.uniq\n end", "def subset_fields\n self.class.subset_fields(subset.to_sym) if valid_subset?\n end", "def default_fields_for_forms\n [\n { :name => :created_on, :field_label => I18n.t(:created_on), :width => 80, :read_only => true,\n :format => 'Y-m-d', :summary_type => :count },\n { :name => :updated_on, :field_label => I18n.t(:updated_on), :width => 80, :read_only => true,\n :format => 'Y-m-d' },\n { :name => :name, :field_label => I18n.t(:name), :flex => 1 },\n { :name => :is_a_parent, :field_label => I18n.t(:is_a_parent), :qtip => I18n.t(:is_a_parent_tooltip),\n :default_value => false, :unchecked_value => 'false',\n :field_style => 'min-height: 13px; padding-left: 13px;'\n }\n ]\n end", "def field_ids\n @fields.keys\n end", "def text_fields_hash\n @text_fields_hash ||=\n setups.inject({}) do |hash, setup|\n setup.all_text_fields.each do |text_field|\n (hash[text_field.name] ||= Set.new) << text_field\n end\n hash\n end\n end", "def names\n NAME_FIELDS.map { |k| has_field?(k) ? @fields[k].tokens : nil }.flatten.compact\n end", "def get_fields\n FIELD_DESCS\n end", "def pick_fields(*fields)\n self.values.inject({}) do |hsh, node|\n value = self[node.name].pick(*fields)\n if fields.size == 1\n value = value.values.first\n end\n hsh[node.name] = value\n hsh\n end\n end", "def form_fields(pairs: nil, **opt)\n fields = AccountConcern::PASSWORD_KEYS\n fields = fields.excluding(:current_password) if manager? || administrator?\n added = fields.map { |k| [k.to_s.titleize, k] }.to_h\n pairs = pairs&.merge(added) || added\n super\n end", "def default_fields_for_forms\n [\n { name: :get_verbose_conflicting_row, width: 50,\n label: I18n.t('admin_import.conflicting_row')\n },\n { name: :import_text, flex: 1, label: I18n.t('admin_import.import_text') },\n\n { name: :name, width: 160, label: I18n.t('activerecord.attributes.city.name') },\n { name: :zip, width: 80, label: I18n.t('activerecord.attributes.city.zip') },\n { name: :area, width: 100, label: I18n.t('activerecord.attributes.city.area') },\n { name: :country, width: 100, label: I18n.t('activerecord.attributes.city.country') },\n { name: :country_code, width: 40, label: I18n.t('activerecord.attributes.city.country_code') }\n ]\n end", "def required_fields\n required_fields = []\n ignore_fields = [:id, :date_entered, :date_modified]\n self.fields.each_value do |field|\n next if ignore_fields.include? field[\"name\"].to_sym\n required_fields << field[\"name\"].to_sym if field[\"required\"] == 1\n end \n required_fields\n end", "def required_fields\n required_fields = []\n ignore_fields = [:id, :date_entered, :date_modified]\n self.fields.each_value do |field|\n next if ignore_fields.include? field[\"name\"].to_sym\n required_fields << field[\"name\"].to_sym if field[\"required\"] == 1\n end \n required_fields\n end", "def manifestation_facet_field_names\n Blacklight.config[:facet_manifestations][:field_names]\n end", "def document_show_field_labels\n Blacklight.config[:show_fields][:labels]\n end", "def person_name_fields\n \"\".tap do |result|\n fields_for(:person_name) do |f|\n result << f.text_field(:name_prefix)\n result << f.text_field(:first_name)\n result << f.text_field(:middle_name)\n result << f.text_field(:last_name)\n result << f.text_field(:name_suffix)\n end\n end\n end" ]
[ "0.7511716", "0.7379545", "0.7066162", "0.6679022", "0.66658986", "0.6416762", "0.63890654", "0.62618876", "0.62233377", "0.61832553", "0.61760795", "0.6132272", "0.606464", "0.6047817", "0.6040522", "0.60270554", "0.5990106", "0.5962807", "0.5946538", "0.5916742", "0.5914366", "0.5900129", "0.58932287", "0.58932287", "0.5841978", "0.5836725", "0.5778162", "0.577221", "0.57596254", "0.57364035", "0.57308376", "0.5724857", "0.5720565", "0.571679", "0.57140064", "0.57107073", "0.5677259", "0.5668642", "0.5661399", "0.56419325", "0.56398135", "0.5628438", "0.5628438", "0.5628438", "0.5628438", "0.5628438", "0.56207395", "0.5618297", "0.56167054", "0.5568388", "0.5567455", "0.55568534", "0.5548492", "0.5546461", "0.55428195", "0.55307734", "0.55306655", "0.5528883", "0.5519721", "0.5471479", "0.54590493", "0.5453286", "0.5449001", "0.5441593", "0.5440259", "0.54339796", "0.54213077", "0.54213077", "0.54203045", "0.54142964", "0.5413515", "0.5405627", "0.54023385", "0.5397333", "0.5394834", "0.5393556", "0.53929317", "0.53907514", "0.5382821", "0.5379379", "0.5369771", "0.5364109", "0.5349549", "0.5343257", "0.5341937", "0.5340131", "0.5339969", "0.5339001", "0.53320825", "0.5326596", "0.5324588", "0.53174174", "0.531607", "0.5313984", "0.53139156", "0.531254", "0.531254", "0.5303169", "0.5290612", "0.5287922" ]
0.7639816
0
Get an array of all fields thate have the given label
def all_fields_labeled(label_name) @fields.values.reject do |field| !field.has_label?(label_name.to_sym) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def field_names\n label_fields.to_h\n end", "def labels\n fields[\"labels\"]\n end", "def label_fields\n @label_fields ||= LabelFields.new do |lf|\n labels.each { |label| lf.add(label) }\n end\n end", "def all_attributes_labeled(label_name)\n to_return = {}\n @fields.each do |key, field|\n if field.has_label?(label_name.to_sym)\n to_return[key] = field.human_name\n end\n end\n to_return\n end", "def field_detect(label)\n @field = fields.detect { |item| item.text.include? label }\n\n raise \"Field '#{label}' was not found on form.\" unless @field\n end", "def labels\n multi_value? ? label_ids.collect{|l_id| Label.find(l_id) } : []\n end", "def labels!(lbl)\n save!(\"fields\" => { \"labels\" => lbl.uniq }) unless lbl.empty?\n end", "def fields_by_name(name)\n @fields.select{|f|f.name==name}\n end", "def fields_by_name(name)\n @fields.select{|f|f.name==name}\n end", "def fields\n @field_labels.collect { |k, v| { sym: k, name: v } }\n end", "def all_labels # :yields: Array of Strings\n # includes plurals etc.\n self.labels.inject([]){|sum, l| sum + l.all_forms}.sort\n end", "def labels\n @labels ||=\n search('label').map { |node| Label.new(node, self) }\n end", "def labels\n @labels ||=\n search('label').map { |node| Label.new(node, self) }\n end", "def label_columns\n ensure_full_data!\n Array(@gapi_json[:labelColumns]).map do |field_gapi_json|\n field_gapi = Google::Apis::BigqueryV2::StandardSqlField.from_json field_gapi_json.to_json\n StandardSql::Field.from_gapi field_gapi\n end\n end", "def index_field_labels\n Blacklight.config[:index_fields][:labels]\n end", "def field_names\n fields.keys\n end", "def document_show_field_labels\n Blacklight.config[:show_fields][:labels]\n end", "def labels\n # TODO: Make a proper Label class to represent this structure...\n Array @gapi[\"labels\"]\n end", "def manifestation_index_field_labels\n Blacklight.config[:manifestation_index_fields][:labels]\n end", "def found_labels\n found = get(\"title\").scan(/\\[(.*?)\\]/).map { |label_arr|\n label = label_arr[0].downcase\n label.to_sym\n }.select{ |label|\n LABEL_MAP.keys.include? label\n }\n end", "def get_field_value(label)\n field_detect(label)\n element = @field.all(:css, 'div[class*=\"clearfix data-column\"]').first\n element.all(:css, 'span[class^=\"read edit\"]').each do |entry|\n entry.text\n end\n end", "def facet_field_labels\n Blacklight.config[:facet][:labels]\n end", "def labels\n [label()]\n end", "def labels\n return NodeArray.new if new_record? \n get_label_arr.inject(NodeArray.new) do |arr,label_field|\n if n = label_field.split(':')[1].constantize.first(session, :id => label_field.split(':')[0])\n n.session = session\n arr << n\n end\n arr\n end\n end", "def all_fields\n @fields.values\n end", "def labels\n return @labels\n end", "def labels\n return @labels\n end", "def get_field_names(template); end", "def all_fields\n fields.values\n end", "def field_by_name(name)\n @fields.detect{|f|f.name==name}\n end", "def by_label\n @by_label ||= notes.group_by(&:label)\n end", "def values\n iterator = @form_fields.keySet.iterator\n set = []\n set << field(iterator.next.toString) while iterator.hasNext\n set\n end", "def field(tag)\n return @fields.select{|f| f.tag == tag}\n end", "def select_fields_collection(bot)\n fields = [\n [\"\", self.class::FIELDS.map {|k,v| Queries::Field.new(id: k, to_label: v)}]\n ]\n\n if (rich_metrics = bot.dashboards.where(dashboard_type: DASHBOARDS, enabled: true).order(\"dashboard_type ASC\")).count > 0\n fields << [\"User Actions\", to_fields(rich_metrics)]\n end\n\n if (custom_metrics = bot.dashboards.where(dashboard_type: 'custom', enabled: true).order(\"dashboard_type ASC\")).count > 0\n fields << [\"Custom Metrics\", to_fields(custom_metrics)]\n end\n\n fields\n end", "def fields(filter = nil)\n unless filter\n # Since we're returning the FieldMap object, which the caller\n # may mutate, we precautionarily mark dirty -- unless it's frozen\n # immutable.\n @fields.clean = false unless @fields.frozen?\n return @fields\n end\n @fields.reindex unless @fields.clean\n flds = []\n if filter.is_a?(String) && @fields.tags[filter]\n @fields.tags[filter].each do |idx|\n flds << @fields[idx]\n end\n elsif filter.is_a?(Array) || filter.is_a?(Range)\n @fields.each_by_tag(filter) do |tag|\n flds << tag\n end\n end\n flds\n end", "def label_field\n self.find_field(self.label_field_name) || self.fields.first\n end", "def labels\n return @mailer.list_labels\n end", "def find_all_by_service_label(label)\n services = Service.find_all_by_label(label)\n services.map do |service|\n service['credentials']\n end\n end", "def labels\n inject_block(:name, :label)\n end", "def field_by_name(name)\n @fields.detect{|f|f.name==name}\n end", "def label_ids\n self[:value] ||= {}\n self[:value][:label_ids] ||= []\n @label_ids ||= multi_value? ? self[:value][:label_ids].collect{|l_id| l_id.to_i if l_id.to_i > 0 }.compact : []\n end", "def field_names(include_hidden = false)\n # collect field names\n names = []\n hidden = no_eval_param(:hide)\n @field_names.each do |name|\n if include_hidden or not hidden.include?(name)\n names << name\n end\n end\n names\n end", "def all_fields\n found_fields = Array.new\n self.fields.each do |field|\n found_fields << field\n found_fields = found_fields + field.all_fields if field.type == 'ObjectField'\n end\n found_fields\n end", "def search_fields (code = 'all')\n @available_search_criteria.fetch('AvailableSearchFields',{}).select{|item| item['FieldCode'] == code || code == 'all'}\n end", "def field_names\r\n return @field_names\r\n end", "def fields\n @fields.keys\n end", "def fields\n @fields.keys\n end", "def for_field(field)\n @all.select { |f| f.field == field.to_sym }\n end", "def get_field_names(template)\n read(template).fields.map{|f| f.name}\n end", "def simple_fields\n fields.select(&:filterable?)\n end", "def field_ids\n @fields.keys\n end", "def custom_fields_to_show\n begin\n custom_field_names = plugin_setting('custom_fields_shown').to_s\n custom_field_names.split(',').map {|custom_field_name|\n UserCustomField.find_by_name(custom_field_name.strip) \n }.flatten.compact\n rescue\n []\n end\n end", "def find_all_by_service_label(label)\n services = locator.find_all_by_label(label)\n services.map do |service|\n service['credentials']\n end\n end", "def fields\n [*lookup]\n end", "def manifestation_facet_field_labels\n Blacklight.config[:facet_manifestations][:labels]\n end", "def labeled(label)\n wrap(\n @inner.select do |event|\n event['event'] == 'labeled' &&\n event['label'].name.downcase == label.downcase\n end,\n )\n end", "def fields\n []\n end", "def label_list(add_label)\n if params[:labels].present?\n if params[:labels].include? add_label\n return params[:labels]\n else\n return (params[:labels]+\",#{add_label}\")\n end\n else\n return add_label\n end\n end", "def find_all_by_service_label(label)\n credentials.find_all_by_service_label(label)\n end", "def imprint_label(field)\n label_subfields = field.subfields.select { |sf| sf.value if sf.code == '3' }\n label_subfields.compact.map { |sf| sf.value.strip }.join(' ').gsub(/[,;:.]*$/, '').strip\n end", "def names\n iterator = @form_fields.keySet.iterator\n set = []\n set << iterator.next.toString.to_sym while iterator.hasNext\n set\n end", "def by_label(label:)\n @indexed_data_items.fetch(label, nil)\n end", "def [] label\n @values[label]\n end", "def check_form_labels(source=@contents)\n forms = source.css(\"form\")\n error_messages = []\n\t\t\tforms.each do |form|\n\t\t\t\tlabels = form.css(\"label\")\n\t\t\t\tform_fields = []\n\t\t\t\t%w{input select textarea button}.each do |element|\n\t\t\t\t\telement_fields = form.css(element)\n\t\t\t\t\tform_fields << form.css(element) unless element_fields.empty?\n\t\t\t\tend\n\t\t\t\tform_fields.flatten!\n\t\t\t\tform_fields.reject! {|field| field.attr('type') == 'submit' || field.attr('type') == 'reset' || field.attr('type') == 'button' }\n\t\t\t\t\n\t\t\t\tform_fields.each do |field|\n\t\t\t\t\tid = field.attr('id')\n\t\t\t\t\terror_messages.push(\"Line #{field.line}: Missing label for form field with id/name: \" + (id || field.attr('name') || \"\")) if (labels.select {|label| label['for'].to_s == id.to_s }.size < 1)\n\t\t\t\tend\n\t\t\tend\n error_messages\n\t\tend", "def field_names\n @_field_path.map{ |field_| field_.name }\n end", "def keys\n fields.map { |f| f.name }\n end", "def search_facet_fields\n self.content_columns.select {|c| [:boolean,:decimal,:float,:integer,:string,:text].include?(c.type) }.map {|c| c.name }\n end", "def get_fields\n _fields = @config['form']['fields']\n _fields.map{|k,v| Field.new(k=>v)}\n end", "def display_fields\n @form.fields.each {|f| puts f.name}\n end", "def labels\n all.select { |c| c.google_id =~ /^user/ }.collect { |c| Label.new(c.google_id, nil, c.count) }\n end", "def visible_fields\n fields.select {|f| f.visible? }\n end", "def get_fields\n FIELD_DESCS\n end", "def collect_attribute_labels(original_data)\n original_data.keys\nend", "def select(*names)\n result = []\n names.each { |name|\n name = Field.name_canonicalize(name)\n result.concat(find_all { |n, v|\n n.downcase == name\n })\n }\n result\n end", "def field_find_all(**args)\n # if looking for a specific field, use built-in hash for initial filter,\n # otherwise get all fields.\n fields_in_scope =\n if args[:tag].is_a?(String)\n fields(args[:tag]).dup\n else\n @fields.dup\n end\n fields_in_scope.select { |f| f.meets_criteria?(args) }\n end", "def hl_field(document, k)\n if document.has_highlight_field?(k) && !document.highlight_field(k).empty?\n Array(document.highlight_field(k))\n elsif document.has_field?(k)\n Array(document.fetch(k))\n else\n []\n end\n end", "def search_field_list(lens = nil)\n blacklight_config(lens).search_fields.values\n end", "def label\n elements.select { |e| e.respond_to?(:label) }.first.label\n end", "def labels() = @labels ||= labels_hash", "def fields\n self.find('ns:field', :ns => self.class.registered_ns).map do |field|\n Field.new(field)\n end\n end", "def field(field)\n field = field.to_s\n result = []\n keys.sort.each do |name|\n result << self[name].get(field)\n end\n result\n end", "def name_list(*fields, **opt)\n clean = !opt.key?(:clean) || opt.delete(:clean)\n fields.flat_map { |field| find_record_items(field, **opt) }.tap do |result|\n result.compact_blank!\n result.uniq!\n result.map! { |item| clean_name(item, **opt) } if clean\n end\n end", "def by_label\n labelled = Hash.new\n @tasks.each { |t|\n t.label.each { |t_label|\n unless labelled.include? t_label\n labelled[t_label] = []\n end\n unless t_label.nil?\n labelled[t_label] << t\n end\n }\n }\n labelled\n end", "def fetch_fields\n @fields\n end", "def labeled_measurements(label)\n # Need *all* for the tests to pass (to work for both saved and unsaved)\n Rails.env.test? ? self.measurements.all.select { |m| label == m.label } : self.measurements.select { |m| label == m.label }\n end", "def label\n @params['label']\n end", "def subset_fields\n self.class.subset_fields(subset.to_sym) if valid_subset?\n end", "def label_with_wildcard_to_list(label,parts)\n if !problems_csv_has_been_read then fatal_error(\"in label_with_wildcard_to_list, problems csv has not been read\") end\n list = []\n l = label.clone\n l.gsub!(/\\.\\.\\./,\"__WILD__\")\n l = Regexp::quote(l) # escape - characters\n l.gsub!(/__WILD__/,\".*\")\n re = Regexp::new(\"\\\\A#{l}\\\\Z\")\n $label_to_num.each { |ll,value|\n if ll=~re then list.push(value + [parts]) end\n }\n if list.length==0 then fatal_error(\"pattern #{label}, containing wildcard ..., doesn't match any labels\") end\n return list\nend", "def consolidate_under_labels(fields)\n results = {}\n fields.each do |mdv| # ModsDisplay::Values\n results[mdv.label] ||= []\n results[mdv.label] << mdv.values\n results[mdv.label].flatten!\n end\n results\n end", "def fields\n @fields ||= []\n end", "def show_field_label label\n t(:'blacklight.search.show.label', label: label)\n end", "def get_label_from_filters(filters)\n props = filters.properties\n return nil if props.empty?\n\n # filters.properties = [['label','Person'],['name','ilya']]\n idx = props.index{|p| p[0] == 'label'}\n props[idx][1] if idx\n end", "def fields_from_model model\n workers_from_model(model).map{ |worker| Array(worker[:fields]) }.flatten\n end", "def label\n attributes.fetch(:label)\n end", "def label\n attributes.fetch(:label)\n end", "def label\n attributes.fetch(:label)\n end", "def label\n attributes.fetch(:label)\n end", "def label\n attributes.fetch(:label)\n end", "def label\n attributes.fetch(:label)\n end", "def labels; end" ]
[ "0.75214005", "0.7258704", "0.6793908", "0.67801625", "0.6606448", "0.6520151", "0.63650584", "0.6353497", "0.6348224", "0.6230569", "0.5949403", "0.58672667", "0.58672667", "0.58545065", "0.58101046", "0.5802713", "0.57898027", "0.5760543", "0.57258147", "0.5722296", "0.57191586", "0.5710856", "0.5698418", "0.5672988", "0.5654147", "0.5643924", "0.5643924", "0.55905974", "0.55879927", "0.55852675", "0.556856", "0.5565414", "0.5564616", "0.5562014", "0.5559407", "0.5535819", "0.5534332", "0.5530588", "0.5524393", "0.5515237", "0.5514712", "0.5508641", "0.55084854", "0.5498085", "0.54936117", "0.5486739", "0.5486739", "0.54745466", "0.5470655", "0.5457743", "0.54570246", "0.5441595", "0.54374707", "0.5426284", "0.54152757", "0.54005265", "0.53899705", "0.5382957", "0.5375259", "0.5371406", "0.53667104", "0.5365366", "0.5363142", "0.53608483", "0.53546953", "0.5353226", "0.5352254", "0.5341613", "0.53401136", "0.53276616", "0.532577", "0.53242093", "0.5321878", "0.53092873", "0.53022313", "0.5288335", "0.52819675", "0.5278004", "0.5268274", "0.5261097", "0.5241126", "0.52368283", "0.52293783", "0.5225309", "0.5225062", "0.5213046", "0.52111715", "0.51975346", "0.5196926", "0.51967865", "0.5195091", "0.5193494", "0.51897585", "0.5189026", "0.5189026", "0.5189026", "0.5189026", "0.5189026", "0.5189026", "0.5187497" ]
0.7786056
0
Get an array of all fields defined on this FieldDefs
def all_fields @fields.values end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fields\n return @fields if defined?(@fields)\n\n @fields = array_of_items_for(Fields, :fields)\n end", "def fields\n @fields ||= []\n end", "def all_fields\n fields.values\n end", "def fields\n @fields ||= []\n end", "def all_fields\n found_fields = Array.new\n self.fields.each do |field|\n found_fields << field\n found_fields = found_fields + field.all_fields if field.type == 'ObjectField'\n end\n found_fields\n end", "def fields\n []\n end", "def get_fields\n _fields = @config['form']['fields']\n _fields.map{|k,v| Field.new(k=>v)}\n end", "def fields\n self.find('ns:field', :ns => self.class.registered_ns).map do |field|\n Field.new(field)\n end\n end", "def fields\n if frozen?\n Array(@gapi.fields).map { |f| Field.from_gapi(f).freeze }.freeze\n else\n Array(@gapi.fields).map { |f| Field.from_gapi f }\n end\n end", "def fields()\n if !@custom_fields || @fields.length == 0 then\n @elements.each { |field|\n if field.respond_to?(:is_form_field) then\n @fields << field.name\n @element_map[field.name.to_s] = field\n elsif field.is_a?(Fieldset) then\n @fields << { field.name => field.fields }\n @element_map.update(field.element_map)\n end\n }\n end\n @fields.uniq!\n return @fields\n end", "def fields\n all_fields\n end", "def fields\n FIELDS\n end", "def fields\n FIELDS\n end", "def fields\n @fields ||= FieldList.new\n end", "def fields\n FIELDS\n end", "def fields\n @fields\n end", "def fields\n @fields\n end", "def fields\n @fields\n end", "def fields\n @fields.keys\n end", "def fields\n @fields.keys\n end", "def fields\n self.class.fields(true)\n end", "def fields\n schema.fields\n end", "def fields\n schema.fields\n end", "def fields\n schema.fields\n end", "def fields\n schema.fields\n end", "def fields\n @fields ||= begin\n default_fields\n end\n end", "def get_field_list\n return make_request(\"#{self.endpoint}/list/fields\")\n end", "def fields\n @fields ||= self.class.fields.collect { |f| f.clone_for(self) }\n end", "def get_fields\n FIELD_DESCS\n end", "def fields!\n @schema.fields!\n end", "def get_fields\n return (\n _get_specific_action_config(:action_fields, :fields)&.map(&:to_s) ||\n self.get_model&.column_names ||\n []\n )\n end", "def fields\n @fields ||= {}\n end", "def fields\n @fields ||= {}\n end", "def fields\n @fields ||= {}\n end", "def fields\n @fields ||= {}\n end", "def fields\n @fields ||= {}\n end", "def field_names\r\n return @field_names\r\n end", "def fields\n java_import org.dspace.content.MetadataField\n MetadataField.findAllInSchema(DSpace.context, @obj.getSchemaID)\n end", "def fields\n self.class.fields\n end", "def fields\n return @fields if fields_registered?\n all_fields = SugarCRM.connection.get_fields(@name)\n @fields = all_fields[\"module_fields\"].with_indifferent_access\n @link_fields= all_fields[\"link_fields\"]\n handle_empty_arrays\n @fields_registered = true\n @fields\n end", "def all_field_names\n field_set.all_field_names\n end", "def fetch_fields\n @fields\n end", "def field_names\n fields.keys\n end", "def fields\n self.class.fields\n end", "def fields\n self.class.fields\n end", "def fields\n self.class.fields\n end", "def fields\n self.class.fields\n end", "def fields(filter = nil)\n unless filter\n # Since we're returning the FieldMap object, which the caller\n # may mutate, we precautionarily mark dirty -- unless it's frozen\n # immutable.\n @fields.clean = false unless @fields.frozen?\n return @fields\n end\n @fields.reindex unless @fields.clean\n flds = []\n if filter.is_a?(String) && @fields.tags[filter]\n @fields.tags[filter].each do |idx|\n flds << @fields[idx]\n end\n elsif filter.is_a?(Array) || filter.is_a?(Range)\n @fields.each_by_tag(filter) do |tag|\n flds << tag\n end\n end\n flds\n end", "def fields()\n @@defined_subclass_field_lists[self.class]\n end", "def fields\n defined = @fields.select {|f| f.defined }\n defined.sort! {|a, b| a.order <=> b.order }\n defined = @fields if defined.empty?\n defined\n end", "def fields\n @node.css('controlfield, datafield').map{|f| objectify f}\n end", "def field_types\r\n return @field_types\r\n end", "def fields\n @fields ||= form.fields\n end", "def fields\n call(\"Webs\", \"get_columns\").xpath(\"//sp:Field\", NS).map do |field|\n attributes = clean_attributes(field.attributes)\n supersite && supersite.field(attributes[\"ID\"].downcase) || Field.new(self, attributes[\"ID\"].downcase, attributes[\"StaticName\"], attributes[\"Type\"], nil, attributes) if attributes[\"ID\"] && attributes[\"StaticName\"]\n end.compact\n end", "def fields\n self.class::FIELDS\n end", "def fields\n self.class::FIELDS\n end", "def fields\n self.class::FIELDS\n end", "def field_ids\n @fields.keys\n end", "def fields\n class_name.constantize.fields\n end", "def fields\n raw['fields']\n end", "def fields\n @fields = headers.map.with_index do |header, index|\n Field.new(header, row_data[index])\n end\n end", "def dynamic_fields\n fields = []\n variant_combinations.each do |field_variants|\n FIELD_TYPES.each do |type|\n fields << DynamicField.new(type, field_variants)\n end\n end\n fields\n end", "def fields\n klass.members.map(&:to_sym)\n end", "def field_requireds\r\n return @field_requireds\r\n end", "def field_options\n self.class.fields.values\n end", "def get_fields()\n return @api.do_request(\"GET\", get_base_api_path() + \"/fields\")\n end", "def fields\n @_fields ||= {}\n end", "def get_config_fields\n []\n end", "def get_config_fields\n []\n end", "def field_ids\n @conditions['field_ids'] || cbobject.basis_fields\n end", "def dynamic_fields\n self.dynamic_attributes.keys.map do |name|\n self.content_type.find_field(name)\n end\n end", "def all_fields\n return @all_fields if defined? @all_fields\n\n @all_fields ||= fields.includes(field_set: [:catalog]).each_with_object([]) do |field, all|\n all << field\n next unless field.is_a?(Field::ChoiceSet)\n\n field.choices.includes(:category).each do |choice|\n category = choice.category\n next unless category&.not_deleted?\n\n additional_fields = category.fields.includes(field_set: [:catalog]).map do |f|\n f.category_choice = choice\n f.category_choice_set = field.choice_set\n f\n end\n all.concat(additional_fields)\n end\n end\n end", "def fields; end", "def fields; end", "def fields; end", "def field_indexes\r\n return @field_indexes\r\n end", "def fields_on_form() #:nodoc:\r\n fields = []\r\n if @form['form']['fields']\r\n# read only field elements (key is Fixnum)\r\n @form['form']['fields'].each {|key,options| fields << options if key.class == Fixnum }\r\n else\r\n @form['form']['tabs'].keys.each do |tab|\r\n @form['form']['tabs'][tab].each {|key,options| fields << options if key.class == Fixnum }\r\n end \r\n end\r\n fields\r\nend", "def to_a; @fields end", "def fields\n fc = FFI::MemoryPointer.new(:uint)\n rc = NWRFCLib.get_field_count(@desc, fc, @error)\n NWRFC.check_error(@error) if rc > 0\n fc = fc.read_uint\n fd = NWRFCLib::RFCFieldDesc.new\n # Make a list of field names\n fc.times.inject([]) {|array, index|\n rc = NWRFCLib.get_field_desc_by_index(@desc, index, fd.to_ptr, @error.to_ptr)\n NWRFC.check_error(@error) if rc > 0\n #@todo WARNING! our get_str method did not handle getting the name of the RESPTEXT parameter in STFC_DEEP_TABLE correctly\n # As a workaround, we use our read_string_dn method; do we need to use this elsewhere?\n #array << fd[:name].get_str.to_sym #<-The code with good intentions\n array << fd[:name].to_ptr.read_string_dn.uC.to_sym #<- Workaround; the way of the future?\n }\n end", "def association_fields\n fields.select{|f| f.is_a?(AssociationField)}\n end", "def fields\n field_map_class.new do |field_map|\n index_config.each { |name, index_field_config| field_map.insert(name, index_field_config, object) }\n end\n end", "def fields #:nodoc:\n f = @properties.to_a\n last = f.pop\n f.push @elements\n f.push last\n end", "def get_fields(template)\n read(template).fields\n end", "def fetch_fields\n fields = @result.fields\n field_types = @result.field_types\n tables = @result.respond_to?(:tables) ? @result.tables : [] # My addition to mysql2 results.c\n fields_arr = []\n (0...@result.fields.length).each do |i|\n fields_arr[i] = MySQL_FIELD.new(\n name: fields[i],\n table: tables[i],\n db: databases[i],\n type: field_types[i]\n )\n end\n return fields_arr\n end", "def fields\n [*lookup]\n end", "def all_fields\n interface_fields.merge(self.fields).values\n end", "def types\n FIELD_TYPES\n end", "def fields\n return @fields if fields_registered?\n all_fields = @session.connection.get_fields(@name)\n @fields = all_fields[\"module_fields\"].with_indifferent_access\n @link_fields= all_fields[\"link_fields\"]\n handle_empty_arrays\n @fields_registered = true\n @fields\n end", "def field_names\n @_field_path.map{ |field_| field_.name }\n end", "def field_values\n fieldset.get_values_using_fsa(self)\n end", "def fields(field_hash = {})\n @fields.merge!(field_hash) unless field_hash.empty?\n @fields\n end", "def get_field_names(template)\n read(template).fields.map{|f| f.name}\n end", "def fields\n self.class.fields\n end", "def fields\n missing_method :fields\n end", "def fields\r\n @hash.keys\r\n end", "def values\n fields.map { |f| f.value }\n end", "def get_fields(template); end", "def fields_on_form #:nodoc:\r\n form_fields = []\r\n if @form['form']['fields']\r\n # read only field elements (key is Integer)\r\n @form['form']['fields'].each { |key, options| form_fields << options if key.class == Integer }\r\n else\r\n @form['form']['tabs'].keys.each do |tab|\r\n @form['form']['tabs'][tab].each { |key, options| form_fields << options if key.class == Integer }\r\n end \r\n end\r\n form_fields\r\nend", "def fields\n form = @stamper.getAcroFields\n form.getFields.each_with_object({}) do |(name, value), fields|\n fields[name.to_sym] = form.getField(name)\n end\n end", "def fields\n @locations.map(&:field).uniq\n end" ]
[ "0.789651", "0.7806454", "0.77410626", "0.7733278", "0.76102364", "0.74666685", "0.74292547", "0.7425123", "0.7404021", "0.7376528", "0.7363096", "0.7313151", "0.7303127", "0.72987014", "0.727751", "0.7196521", "0.7173657", "0.7173657", "0.71626455", "0.71626455", "0.7089634", "0.70142514", "0.6958255", "0.6958255", "0.6958255", "0.69153917", "0.69098014", "0.688021", "0.68530536", "0.68301564", "0.6819657", "0.6814535", "0.6814535", "0.6814535", "0.6814535", "0.6814535", "0.6813144", "0.68109536", "0.6809395", "0.6798755", "0.67757547", "0.67650956", "0.67589486", "0.6754336", "0.6754336", "0.6754336", "0.6754336", "0.6744137", "0.6742564", "0.67391956", "0.67127705", "0.67061555", "0.6690206", "0.66760355", "0.6664849", "0.6664849", "0.6664849", "0.66584265", "0.6655309", "0.665341", "0.664568", "0.6577128", "0.65717", "0.6565676", "0.6532186", "0.6482742", "0.64794016", "0.6471222", "0.6471222", "0.64424425", "0.6437395", "0.6409231", "0.64085454", "0.64085454", "0.64085454", "0.6406259", "0.6391338", "0.63890547", "0.63847816", "0.63740116", "0.6365406", "0.6363843", "0.63507384", "0.6313085", "0.6308997", "0.63047427", "0.6295925", "0.62833333", "0.6277825", "0.62747127", "0.6271428", "0.62700343", "0.62683725", "0.6266753", "0.6260752", "0.623029", "0.622506", "0.6216166", "0.6213877", "0.62010473" ]
0.7534352
5
find a field by it's name
def field_called(field_name) return nil if field_name.to_s.empty? # return nil if field_name.to_s.empty? @fields[field_name.to_sym] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def field_by_name(name = nil)\n @fields.find { |h| h[:name].to_snym == name.to_snym }\n end", "def get_field_by_name(name)\n name = name.to_sym\n fields.values.find {|field| field.name == name}\n end", "def field_by_name(name)\n @fields.detect{|f|f.name==name}\n end", "def field_by_name(name)\n @fields.detect{|f|f.name==name}\n end", "def find_field(name_or_id)\n self.fields.detect { |field| field.matches?(name_or_id) }\n end", "def get_field_by_name(name)\n self.class.get_field_by_name(name)\n end", "def get_field_by_name(name)\n self.class.get_field_by_name(name)\n end", "def get_field(field_name)\n fields = @data_source['fields']\n \n fields.each do | f |\n if f['name'] == filed_name\n return f\n end\n end \n return nil\n end", "def get_field(name)\n self[name]\n end", "def field name\n @fields[name]\n end", "def field(l_name)\n fields.find{|fld| fld.l_name == l_name}\n end", "def field name\n f = fields.find { |fld| fld.name == name.to_s }\n return nil if f.nil?\n yield f if block_given?\n f\n end", "def find_field_by_name(field_name)\n product_field_id = self.product_fields.find_by(name: field_name).id\n stock_field = self.stock_fields.select do |stock_field|\n stock_field.product_field_id == product_field_id\n end.first\n end", "def get_field(field_name)\n\t\tend", "def field(p,field_name)\n f = p.fields.find {|f| f.name == field_name}\n if f.nil? then\n return nil\n else\n return f.value\n end\nend", "def fields_by_name(name)\n @fields.select{|f|f.name==name}\n end", "def field_locator(name)\n locator_by_type(:field, name)\n end", "def field(name); end", "def get_ext_field_by_name(name)\n name = name.to_sym\n extension_fields.values.find {|field| field.name == name}\n end", "def fields_by_name(name)\n @fields.select{|f|f.name==name}\n end", "def field_named(name)\n ensure_setup!\n field_set.field_named(name)\n end", "def get_field(tag_or_name)\n case tag_or_name\n when Integer, String, Symbol\n field_dictionary[tag_or_name]\n else\n raise TypeError, tag_or_name.class\n end\n end", "def get_field(tag_or_name)\n case tag_or_name\n when Integer then get_field_by_tag(tag_or_name)\n when String, Symbol then get_field_by_name(tag_or_name)\n else raise TypeError, tag_or_name.class\n end\n end", "def get_field(tag_or_name)\n self.class.get_field(tag_or_name)\n end", "def get_field(tag_or_name)\n self.class.get_field(tag_or_name)\n end", "def get_ext_field_by_name(name)\n extension_fields.values.find {|field| field.name == name.to_sym}\n end", "def find_screen_field(field_name)\n @screen.fields.find {|field| field.name == field_name }\n end", "def get_field_by_name(fields_list, name)\n fields_array = arrayize(fields_list)\n index = fields_array.find_index {|field| field[:name].eql?(name)}\n return (index.nil?) ? nil : fields_array.at(index)\n end", "def field(identifier)\n ensure_loaded do\n fields.each do |f|\n return f if f.identifier == identifier\n end\n end\n \n nil\n end", "def field key\n @fields.get key\n end", "def field (key)\n\n return self.yattributes[key.to_s] if self.yattributes\n\n fields.find_by_fkey(key.to_s)\n end", "def find_field(field_id)\n fields.find_by(field_id.starts_with?('_') ? :uuid : :slug => field_id)\n end", "def field_name\r\n @field_name ||= begin\r\n %r/(\\w+)Field$/.match(name)[1]\r\n rescue\r\n %r/(\\w+)$/.match(name)[1]\r\n end\r\n end", "def general_field(name)\n self.general_fields.where(fieldable_id: self.id).where(\"payload->>'key' = ?\", name).first\n end", "def [](field_name)\n find_field_by_name(field_name) || raise(FieldNotFoundError, \"Field named '#{field_name}' not found in form.\")\n end", "def get_for_field(name)\n @locations.select { |location| location.field == name }\n end", "def parse_field(field_name)\n element_spec = @@spec.values.\n select {|v| (v['name']) =~ /^#{field_name}$/i}.\n first\n self.send(element_spec['node'])\n end", "def get(name)\n if @fields.has_key?(name.lexeme)\n @fields[name.lexeme]\n else\n method = @klass.find_method name.lexeme\n unless method.nil?\n method.bind self\n else\n message = \"Undefined property '#{name.lexeme}'.\"\n raise LoxRuntimeError.new(name, message)\n end\n end\n end", "def fetch name\n raise \"ERROR: Field with name #{name} does not exist!\" if !@format[name]\n @format[name]\n end", "def find_obj_for_name(name)\n idx = @field_names.index(name)\n if idx\n instantiate_obj(idx)\n @field_objs[idx].obj\n else\n nil\n end\n end", "def field_by_id(id = nil)\n @fields.find { |h| h[:id] == id.to_s }\n end", "def get_field(field_name)\n fields[field_name] || interface_fields[field_name]\n end", "def method_field(name)\n self.method_fields.where(fieldable_id: self.id).where(\"payload->>'key' = ?\", name).first\n end", "def fetch_field(expected_key = nil, &block)\n find_field(expected_key, &block) ||\n (raise FieldNotFound,\n \"no such field `#{expected_key}` for #{self}.\")\n end", "def [](name_or_index)\n if name_or_index.kind_of? Integer\n temp = @fields[name_or_index]\n temp = temp.value unless temp.nil?\n else\n name = Field.name_canonicalize(name_or_index)\n result = detect { |n, v|\n if n.downcase == name then true else false end\n }\n if result.nil? then nil else result[1] end\n end\n end", "def field_find(**args)\n # if looking for a specific field, use built-in hash for initial filter,\n # otherwise get all fields.\n fields_in_scope =\n if args[:tag].is_a?(String)\n fields(args[:tag]).dup\n else\n @fields.dup\n end\n fields_in_scope.each { |f| return f if f.meets_criteria?(args) }\n nil\n end", "def find_name_by_reflection(field, id)\n return nil if id.blank?\n @detail_value_name_by_reflection ||= Hash.new do |hash, key|\n association = Issue.reflect_on_association(key.first.to_sym)\n name = nil\n if association\n record = association.klass.find_by_id(key.last)\n if record\n name = record.name.force_encoding('UTF-8')\n end\n end\n hash[key] = name\n end\n @detail_value_name_by_reflection[[field, id]]\n end", "def field(var)\n fields.detect { |f| f.var == var }\n end", "def has_field?(name)\n fields.key?(name.to_sym)\n end", "def field(name)\n _unique(name)\n value = _field(name)\n fields[name] = field_class.new(self, name, value)\n end", "def find_field(expected_key = nil, &block)\n if block_given?\n each_field do |key, field|\n return field if block.call(key, field)\n end\n else\n each_field do |key, field|\n return field if expected_key == key\n end\n end\n nil\n end", "def provide(name)\n return nil unless name.respond_to?(:to_sym)\n name = name.to_sym\n fields[name] || fields[aliases[name]]\n end", "def stack_load_field(name)\n\n Lib.lua_getfield(@pointer, -1, name)\n end", "def [](field_name)\n get(field_name)\n end", "def field_get(key)\n self.class.fetch_field(key.to_sym) # ensure that the field exists\n send key\n end", "def by_field(field_name)\n begin\n @arr[@column_map[field_name.to_s]]\n rescue TypeError\n nil\n end\n end", "def name\n self.general_fields.where(fieldable_id: self.id).where(\"payload->>'key' = 'name'\").first.value\n end", "def find_entries_custom_field(id_or_name)\n return nil if id_or_name.nil? # bypass the memoization\n\n _field = self.entries_custom_fields.find(id_or_name) rescue nil\n _field || self.entries_custom_fields.where(name: id_or_name).first\n end", "def field_name\n @field.name\n end", "def get_field(key)\n @form_fields.getField key.to_s\n end", "def field(name)\n attr_accessor name\n end", "def field_def(name)\n @@known_fields_lookup[name] || # the fast way\n @@known_fields.find{|hfd| hfd === name} || # the slow way\n FieldDesc.new(name.to_s.downcase.gsub(/^.|[-_\\s]./) { |x| x.upcase }.gsub('_', '-'), :repeatable => true) # make up as we go\n end", "def field(name, locator)\n self.finders[name] = ElementFinder.new(:find_field, locator)\n end", "def field?(name)\n @attributes.key?(name)\n end", "def field\n @field ||= @options.fetch(:field, repository.adapter.field_naming_convention.call(name))\n end", "def [](name_or_sym_or_field)\n return field_reference[:attr_syms ][name_or_sym_or_field] if @field_map[:attr_syms ].has_key?(name_or_sym_or_field)\n return field_reference[:ui_labels ][name_or_sym_or_field] if @field_map[:ui_labels ].has_key?(name_or_sym_or_field)\n return field_reference[:json_fields][name_or_sym_or_field] if @field_map[:json_fields].has_key?(name_or_sym_or_field)\n end", "def cached_dynamo_field_by_name(field_name)\n cached_dynamo_fields.detect{|df| df.field_name == field_name}\n end", "def getUserField(userName, fieldName)\n\n if userName == nil\n return \"User not Found!\"\n end\n if fieldName == \"password\"\n return \"Access denied!\"\n else\n user = loadUser(userName)\n if(user.key?(fieldName))\n return user[fieldName]\n else\n return \"Field not found!\"\n end\n end\n end", "def field\n @field ||= quoted_field(field_name)\n end", "def find_attribute_named(name)\n @attributes.find { |m| m.name == name }\n end", "def field_exists?(name)\n @fields.key?(name.to_s) || @fields.key?(name.to_sym)\n end", "def field_index(name)\n @results.fields.index(name)\n end", "def field(lookup = nil)\n if !(lookup.to_s =~ INTEGER_REGEXP).nil?\n field_by_id(lookup)\n else\n field_by_name(lookup)\n end\n end", "def field_name\n self.class.name.split(\"::\").last.downcase.sub(\"of\", \"_of_\"). \\\n sub(\"field\", \"\").downcase\n end", "def field_detect(label)\n @field = fields.detect { |item| item.text.include? label }\n\n raise \"Field '#{label}' was not found on form.\" unless @field\n end", "def parse_field_method(method_name)\n method_name = method_name.to_s\n return nil unless method_name.end_with? '_field'\n\n field_type_name = method_name.delete_suffix('_field').to_sym\n config.field_types.find(field_type_name)\n end", "def get_ext_field(tag_or_name)\n case tag_or_name\n when Integer; get_ext_field_by_tag tag_or_name\n when String, Symbol; get_ext_field_by_name tag_or_name\n else; raise TypeError.new(tag_or_name.class)\n end\n end", "def find_by_name(name)\n binding.pry\n self.name\n end", "def get_string_field(field_name)\n\t\tend", "def get_ext_field(tag_or_name)\n case tag_or_name\n when Integer then get_ext_field_by_tag(tag_or_name)\n when String, Symbol then get_ext_field_by_name(tag_or_name)\n else raise TypeError, tag_or_name.class\n end\n end", "def [](field_name)\n f = field(field_name)\n f && f.value\n end", "def [](field)\n @fields.has_key?(field.to_s) ? @fields[field.to_s] : nil\n end", "def [](field)\n @fields.has_key?(field.to_s) ? @fields[field.to_s] : nil\n end", "def find_name name\n find_element :name, name\n end", "def get_field_by_tag(tag)\n fields[tag]\n end", "def fetch_field\n return nil if @field_index >= @fields.length\n ret = @fields[@field_index]\n @field_index += 1\n ret\n end", "def lookup_field_type(name)\n result = config.field_types.find(name)\n raise UnregisteredFieldTypeError, name if result.nil?\n\n result\n end", "def [](field_name)\n send(field_name)\n end", "def get_char_field(field_name)\n\t\tend", "def get_field(parent_type, field_name)\n with_definition_error_check do\n parent_type_name = case parent_type\n when GraphQL::BaseType, Class, Module\n parent_type.graphql_name\n when String\n parent_type\n else\n raise \"Unexpected parent_type: #{parent_type}\"\n end\n\n defined_field = @instrumented_field_map[parent_type_name][field_name]\n if defined_field\n defined_field\n elsif parent_type == query && (entry_point_field = introspection_system.entry_point(name: field_name))\n entry_point_field\n elsif (dynamic_field = introspection_system.dynamic_field(name: field_name))\n dynamic_field\n else\n nil\n end\n end\n end", "def get_field(field_name)\n field_name = field_name.to_sym\n field = @field_references[field_name]\n if field.nil?\n unless @@is_a_java_class\n field = method(field_name).call\n else\n field_object = nil\n [field_name.to_s, field_name.camelize, field_name.camelize(false)].uniq.each do |name|\n begin\n field_object = self.class.send(:class_variable_get, :@@java_class).java_class.declared_field(name)\n rescue NameError, NoMethodError => e\n end\n break unless field_object.nil?\n end\n raise UndefinedControlError, \"There is no control named #{field_name} on view #{@main_view_component.class}\" if field_object.nil?\n \n field_object.accessible = true\n field = Java.java_to_ruby(field_object.value(Java.ruby_to_java(@main_view_component)))\n end\n @field_references[field_name] = field\n end\n field\n end", "def find_by(field, value)\n @base.send('find_by_' + field, value)\n end", "def get_field_by_id(id, params = {})\n get(\"/fields/#{id}\", params)\n end", "def has_field?(field_name); end", "def named(name)\n super || load_field(owner.field_prototypes[name.to_sym])\n end", "def field(tag)\n return @fields.select{|f| f.tag == tag}\n end", "def field(name)\n unless @fields.include? name\n @fields.push name.to_s\n end\n end", "def get_field_by_tag(tag)\n self.class.get_field_by_tag(tag)\n end", "def get_field_by_tag(tag)\n self.class.get_field_by_tag(tag)\n end", "def get_field_name\n\t\tend" ]
[ "0.8724193", "0.8718288", "0.85044116", "0.85040236", "0.8058694", "0.80316186", "0.80316186", "0.80280936", "0.7966784", "0.7962705", "0.7798971", "0.7612169", "0.7519848", "0.74554265", "0.7349322", "0.7343995", "0.73297334", "0.7327927", "0.7315643", "0.7264195", "0.726013", "0.72557545", "0.7254924", "0.72213405", "0.72213405", "0.7209116", "0.72078913", "0.7155651", "0.7008441", "0.6981814", "0.69234896", "0.6921343", "0.6898529", "0.68424433", "0.68386996", "0.6828927", "0.6813865", "0.67749345", "0.6771739", "0.6766903", "0.6755182", "0.67298883", "0.671286", "0.6704896", "0.668559", "0.66854024", "0.6672999", "0.6669619", "0.6654615", "0.6643916", "0.66190714", "0.6605746", "0.66005266", "0.656406", "0.6560086", "0.65581036", "0.65511185", "0.6542231", "0.65415037", "0.65294355", "0.6529271", "0.65258044", "0.6521637", "0.65189445", "0.6478558", "0.6462668", "0.64612615", "0.643293", "0.64221156", "0.6418122", "0.63973236", "0.63770545", "0.63630563", "0.6360371", "0.6359511", "0.6344963", "0.6344307", "0.6320218", "0.6311371", "0.6307493", "0.63060725", "0.6303777", "0.6303777", "0.6266924", "0.6243709", "0.6242379", "0.6228368", "0.6227813", "0.6226159", "0.62114453", "0.62101126", "0.62073225", "0.6205169", "0.61980104", "0.61884534", "0.6170832", "0.61695266", "0.61509943", "0.61509943", "0.6145981" ]
0.64886045
64
Get an array of fields based on the given array of field names
def fields_called(field_names) field_names.collect{ |name| field_called(name) || (raise ArgumentError, "field called #{name} not found") } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fields(*fields)\n result = []\n keys.sort.each do |name|\n result << self[name].pick(*fields)\n end\n result\n end", "def fields_by_name(name)\n @fields.select{|f|f.name==name}\n end", "def fields(*args)\n return @fields if args.empty?\n @fields = args.flatten.compact.map{|i| i.to_sym}\n end", "def fields_by_name(name)\n @fields.select{|f|f.name==name}\n end", "def pick_array_field(data, field)\n data.map { |x| x[field] }\n end", "def select(*names)\n result = []\n names.each { |name|\n name = Field.name_canonicalize(name)\n result.concat(find_all { |n, v|\n n.downcase == name\n })\n }\n result\n end", "def name_list(*fields, **opt)\n clean = !opt.key?(:clean) || opt.delete(:clean)\n fields.flat_map { |field| find_record_items(field, **opt) }.tap do |result|\n result.compact_blank!\n result.uniq!\n result.map! { |item| clean_name(item, **opt) } if clean\n end\n end", "def get_field_by_name(fields_list, name)\n fields_array = arrayize(fields_list)\n index = fields_array.find_index {|field| field[:name].eql?(name)}\n return (index.nil?) ? nil : fields_array.at(index)\n end", "def bits_for(*field_names)\n bits = []\n \n field_names.flatten.each do |i|\n if i.is_a?(Integer)\n bits << i\n next\n end\n \n if i.respond_to?(:to_sym) and @field_list[i.to_sym]\n bits << @field_list[i.to_sym]\n end\n end\n \n bits.flatten\n end", "def find_field_indexes(key_fields, field_names)\n key_fields.map do |field|\n if field.is_a?(Integer)\n field\n else\n field_names.index{ |field_name| field.to_s.downcase == field_name.to_s.downcase } or\n raise ArgumentError, \"Could not locate field '#{field}' in source field names: #{\n field_names.join(', ')}\"\n end\n end\n end", "def find_field_indexes(key_fields, field_names)\n key_fields.map do |field|\n if field.is_a?(Integer)\n field\n else\n field_names.index{ |field_name| field.to_s.downcase == field_name.downcase } or\n raise ArgumentError, \"Could not locate field '#{field}' in source field names: #{\n field_names.join(', ')}\"\n end\n end\n end", "def dedup_field_names(*names)\n names.inject([]) do |acc, arr|\n acc + arr.map{ |e| search_field_name(acc, e) }\n end\n end", "def transform_fields(desc,arr)\n if(arr.is_a?(Array))\n arr.each do |field| \n unless(field.is_a?(String) || field.is_a?(Symbol)) \n raise JiakSchemaException, \"#{desc} must be strings or symbols\"\n end\n end\n arr.map{|f| f.to_sym}.uniq\n elsif(arr.eql?(WILDCARD))\n arr\n else\n raise JiakSchemaException, \"#{desc} must be an array or WILDCARD\"\n end\n end", "def fields\n [*lookup]\n end", "def pluck(*fields)\n fields = fields.flatten(1).reject(&:blank?).map(&:to_s)\n\n source_fields = fields - EVERFIELDS\n scope = except(FIELD_STORAGES, EXTRA_STORAGES)\n .source(source_fields.presence || false)\n\n hits = raw_limit_value ? scope.hits : scope.scroll_hits(batch_size: DEFAULT_PLUCK_BATCH_SIZE)\n hits.map do |hit|\n if fields.one?\n fetch_field(hit, fields.first)\n else\n fields.map do |field|\n fetch_field(hit, field)\n end\n end\n end\n end", "def field(field)\n field = field.to_s\n result = []\n keys.sort.each do |name|\n result << self[name].get(field)\n end\n result\n end", "def fields(filter = nil)\n unless filter\n # Since we're returning the FieldMap object, which the caller\n # may mutate, we precautionarily mark dirty -- unless it's frozen\n # immutable.\n @fields.clean = false unless @fields.frozen?\n return @fields\n end\n @fields.reindex unless @fields.clean\n flds = []\n if filter.is_a?(String) && @fields.tags[filter]\n @fields.tags[filter].each do |idx|\n flds << @fields[idx]\n end\n elsif filter.is_a?(Array) || filter.is_a?(Range)\n @fields.each_by_tag(filter) do |tag|\n flds << tag\n end\n end\n flds\n end", "def translate_fields(names)\n names.each do |name|\n translate_field(name)\n end\n end", "def get_fields elements\n elements.each do |expr|\n if expr.is_a? Array\n field_match = match_with_syntax_error expr[0], FIELD_IS_REGEX, 'A field name must be given', 'Add a vaidated field with \"<field_name> is\"'\n field_name = field_match[1]\n @blueprint.field_names << field_name\n field_properties = get_field_properties( expr, field_name)\n @blueprint.add_attribute( field_name, *field_properties)\n \n # puts \"added field #{field_name} with value #{field_properties.inspect}\"\n end\n end\n end", "def search_fields(*args)\n @@search_fields = args.map { |a| a.to_sym }\n end", "def pluck( field_name )\n\n end", "def fields(fields)\n if fields.nil?\n return nil\n elsif fields.is_a? Java::CascadingTuple::Fields\n return fields\n elsif fields.is_a? ::Array\n if fields.size == 1\n return fields(fields[0])\n end\n raise \"Fields cannot be nil: #{fields.inspect}\" if fields.include?(nil)\n end\n return Java::CascadingTuple::Fields.new([fields].flatten.map{ |f| f.kind_of?(Fixnum) ? java.lang.Integer.new(f) : f }.to_java(java.lang.Comparable))\n end", "def json_fields_of(decorated_collection, fields_from_params = params[:fields])\n return [] if decorated_collection.blank?\n\n decorated = decorated_collection.first\n index_field_names = decorated.index_field_names.map(&:to_s)\n fields = (fields_from_params.presence || index_field_names).split(/\\s*,\\s*/).flatten\n fields & index_field_names\n end", "def field(*fields)\n options = fields.extract_options!\n\n fields.each do |f|\n _field(f, options)\n end\n end", "def build_fields(params_list)\n params_list = params_list.first.to_a if Hash === params_list.first\n \n params_list.map do |params|\n if Array === params\n params.flatten! if Array === params.second\n options = params.extract_options!\n name = params.first\n format = params.second\n else\n name = params\n options = {}\n end\n\n attributes = {format: format, collection: @current_collection}.merge(options)\n Field.new(name, attributes)\n end\n end", "def field_names(filter = [], include_inherited = true)\n names = fields.keys\n\n if include_inherited && has_parent?\n names.concat(inherited_fields)\n end\n\n unless filter.empty?\n names = names & filter.map(&:to_sym)\n end\n\n names.sort!\n names\n end", "def field_names\n @_field_path.map{ |field_| field_.name }\n end", "def formula_fields_for(record_or_name_or_array, *args, &block)\n options = args.extract_options!\n options[:builder] ||= self.class\n fields_for(record_or_name_or_array, *(args << options), &block)\n end", "def formula_fields_for(record_or_name_or_array, *args, &block)\n options = args.extract_options!\n options[:builder] ||= @@builder\n fields_for(record_or_name_or_array, *(args << options), &block)\n end", "def any_of(*field_names)\n [].tap do |list|\n any_num = any_of_number(*field_names)\n self.each_value { |num| list << num if (num & any_num) > 0 }\n end\n end", "def process_fields(fields)\n fields.map { |field| field.to_s.include?('.') ? field.to_s : \"#{self.table_name}.#{field}\" }\n end", "def field_names\n fields.keys\n end", "def find_fields(params)\n if params.respond_to?(:keys)\n BpCustomFields::Field.joins(:field_template, :group => [:group_template => :appearances]).\n where(bp_custom_fields_group_templates: {name: params[:group]}, bp_custom_fields_field_templates: {name: params[:field]}, bp_custom_fields_appearances: {resource: self.class.name, resource_id: self.id_or_name.to_s})\n else\n BpCustomFields::Field.joins(:field_template, :group => [:group_template => :appearances]).\n where(bp_custom_fields_field_templates: {name: params}, bp_custom_fields_appearances: {resource: self.class.name, resource_id: self.id_or_name.to_s}) | (BpCustomFields::Field.joins(:field_template, :group => [:group_template => :appearances]).\n where(bp_custom_fields_field_templates: {name: params}, bp_custom_fields_appearances: {resource: self.class.name}))\n end\n end", "def fields(names)\r\n names.each { |name| @template.concat(field(name)) }\r\n ''\r\n end", "def field_names\r\n return @field_names\r\n end", "def names\n NAME_FIELDS.map { |k| has_field?(k) ? @fields[k].tokens : nil }.flatten.compact\n end", "def field_names\n attribute_names.map(&:to_sym)\n end", "def fetch_records_field(record_class:, record_ids:, field:)\n output = []\n record_ids.each do |record_id|\n key = get_key_for_record_id(record_id: record_id, record_class: record_class)\n data = REDIS_APP_JOIN.hget(key, field)\n output << data if data # checks if nil\n end\n return output.uniq\n end", "def from_array(array)\n array.map { |key| LicenseField.find(key) }\n end", "def fields\n return @fields if defined?(@fields)\n\n @fields = array_of_items_for(Fields, :fields)\n end", "def field_names\n @field_names ||= (columns_hash.keys.map(&:to_sym) rescue [])\n end", "def field_by_name(name)\n @fields.detect{|f|f.name==name}\n end", "def fields(input_fields)\n output = input_fields.gsub(/[\\s,]/ , \" \")\n output_array = output.split\n return output_array\nend", "def fields(*field_names)\n @fields_added = true\n boosted_fields = field_names.pop if field_names.last.is_a?(Hash)\n field_names.each do |field_name|\n @setup.text_fields(field_name).each do |field|\n @query.add_fulltext_field(field, field.default_boost)\n end\n end\n if boosted_fields\n boosted_fields.each_pair do |field_name, boost|\n @setup.text_fields(field_name).each do |field|\n @query.add_fulltext_field(field, boost)\n end\n end\n end\n end", "def field_ids\n @fields.keys\n end", "def get_field_names(template); end", "def get_fandoms_from_params(params, fieldname)\n hash = params\n nexthash = nil\n\n while hash.is_a? Hash\n hash.keys.each do |key|\n if key == fieldname\n # we've found the fandoms\n fandom_names = hash[key]\n if fandom_names.is_a? String\n return [] if fandom_names.blank?\n return fandom_names.split(',').delete_if {|fname| fname.blank?}.collect {|fname| Fandom.find_by_name(fname.strip)}.compact\n elsif fandom_names.is_a? Array\n return fandom_names.collect {|fname| Fandom.find_by_name(fname.strip)}.compact\n end\n elsif hash[key].is_a? Hash\n nexthash = hash[key]\n end\n end\n hash = nexthash\n end\n \n return []\n end", "def by_field(field_name)\n begin\n @arr[@column_map[field_name.to_s]]\n rescue TypeError\n nil\n end\n end", "def pulp_deferred_fields(*fields)\n [*fields].each {|field| pulp_deferred_field(field) }\n end", "def field_names\n @field_names ||= attribute_names.map(&:to_sym)\n end", "def pulp_fields(*fields)\n fields.to_a.each {|field| pulp_field(field) }\n end", "def add_fields(arr,descr,fields)\n fields = fields[0] if(fields.size == 1 && fields[0].is_a?(Array))\n scrubbed = transform_fields(descr,fields)\n if(arr.eql?(WILDCARD))\n arr = scrubbed\n else\n (scrubbed - arr).each {|f| arr << f}\n end\n end", "def model_fields(model_name)\n fields = self.class.model_field_cache[model_name]\n inputs.slice(*fields)\n end", "def fields(lookup = nil)\n lookup ? field(lookup) : @fields\n end", "def map_by_name(arr)\n names_only = arr.map() { |hash| hash[\"name\"] }\n return names_only\nend", "def selected_fields\n return @selected_fields unless @selected_fields.nil?\n\n fields = [*options[:select]].map { |f| f.split(',') }.flatten\n fields.concat(required_fields) if @fasta && !fields.empty?\n @selected_fields = fields.map { |f| glob_to_regex(f) }\n end", "def format_field_names_as_string(array)\n array.map{ |k| \"'#{k}'\" }.join(',')\n end", "def get_field_names(template)\n read(template).fields.map{|f| f.name}\n end", "def register_search_fields(*names)\n names.each do |name|\n search_fields << name.to_s\n end\n end", "def all_tag_names(fields)\n fields.flat_map do |field|\n next if options[field].blank?\n options[field].split(\",\").map(&:squish)\n end.reject(&:blank?).uniq\n end", "def field_names(include_hidden = false)\n # collect field names\n names = []\n hidden = no_eval_param(:hide)\n @field_names.each do |name|\n if include_hidden or not hidden.include?(name)\n names << name\n end\n end\n names\n end", "def instead_of(*field_names)\n [].tap do |list|\n none_num = any_of_number(*field_names)\n self.each_value { |num| list << num if (num & none_num) != none_num }\n end\n end", "def field_by_name(name)\n @fields.detect{|f|f.name==name}\n end", "def define_field_methods\n if fields.is_a?(Array)\n fields.each do |field_label|\n field = field_label.downcase.gsub(' ', '_').gsub(/\\W/, '').to_sym\n field_method_name = define_field_name(field)\n define_field_method(field_method_name, field_label)\n end\n elsif fields.is_a?(Hash)\n fields.each do |field, field_string|\n field_method_name = define_field_name(field)\n define_field_method(field_method_name, field_string)\n end\n end\n end", "def field_find_all(**args)\n # if looking for a specific field, use built-in hash for initial filter,\n # otherwise get all fields.\n fields_in_scope =\n if args[:tag].is_a?(String)\n fields(args[:tag]).dup\n else\n @fields.dup\n end\n fields_in_scope.select { |f| f.meets_criteria?(args) }\n end", "def string_field_names\n # database_field_names.join(', ')\n database_field_names.to_s[1...-1]\n end", "def semantic_fields_for(record_or_name_or_array, *args, &block)\n fields_for(record_or_name_or_array, *args, &block)\n end", "def dynamic_fields\n fields = []\n variant_combinations.each do |field_variants|\n FIELD_TYPES.each do |type|\n fields << DynamicField.new(type, field_variants)\n end\n end\n fields\n end", "def names\n iterator = @form_fields.keySet.iterator\n set = []\n set << iterator.next.toString.to_sym while iterator.hasNext\n set\n end", "def format_fields(fields)\n if fields.instance_of?(Array)\n return fields.join(\",\")\n elsif fields.instance_of?(String)\n return fields\n end\n end", "def form_inputs(array_of_field_names)\n array_of_field_names.each do |field|\n symbol_name = field.downcase.tr(\" \", \"_\")\n\n define_singleton_method :\"#{symbol_name}\" do\n find(\"input[formcontrolname='#{symbol_name}']\").value\n end\n\n define_singleton_method :\"#{symbol_name}=\" do |value|\n fill_in \"#{field}\", with: value\n end\n end\n end", "def to_fields(fields, mapping_method)\n fields.each { |field| to_field field, mapping_method }\n end", "def field_names\n drawings.pluck(:field_name)\n end", "def keys\n fields.map { |f| f.name }\n end", "def search_fields(options)\n search_fields = options.delete(:use_key)\n if search_fields\n search_fields = [search_fields] unless search_fields.is_a?(Array)\n search_fields = search_fields.sort_by{|f| f.to_s}\n else\n search_fields = options[:conditions].to_a.sort_by{|f| f.first.to_s}.map(&:first)\n end\n\n # If no seach field fall back on :created_at or :id\n if search_fields.empty?\n if property_names.include?(:created_at)\n search_fields << :created_at\n else\n search_fields << :_id\n end\n end\n\n # Deal with missing underscore automatically\n search_fields << :_id if search_fields.delete(:id)\n search_fields << :_rev if search_fields.delete(:rev)\n search_fields\n end", "def field_param(array)\n array.inject([]) do |result, field|\n result << \"#{field[:field]}: #{set_value(field[:value])}\"\n result\n end.join(\", \")\n end", "def values_for_fields(fields)\n result = {}\n for f in fields\n result[f] = @times.map{|r| r[f] or raise \"Missing field: #{r}\"}\n end\n return result\n end", "def fields\n if frozen?\n Array(@gapi.fields).map { |f| Field.from_gapi(f).freeze }.freeze\n else\n Array(@gapi.fields).map { |f| Field.from_gapi f }\n end\n end", "def pulp_special_fields(*fields)\n [*fields].each{|f| pulp_special_field(f) }\n end", "def fetch_fields\n fields = @result.fields\n field_types = @result.field_types\n tables = @result.respond_to?(:tables) ? @result.tables : [] # My addition to mysql2 results.c\n fields_arr = []\n (0...@result.fields.length).each do |i|\n fields_arr[i] = MySQL_FIELD.new(\n name: fields[i],\n table: tables[i],\n db: databases[i],\n type: field_types[i]\n )\n end\n return fields_arr\n end", "def build(field_keys, row_map)\n values = []\n\n field_keys.each do |field_key|\n raise MissingFieldError, \"No field for key #{field_key}\" if !row_map.has_key? field_key\n values << DriveTime.underscore_from_text(row_map[field_key]) unless row_map[field_key].empty?\n end\n\n raise NoFieldsError, 'No fields matched' if values.empty?\n\n values.each_with_index do |value, index|\n\n result = self.process_value value\n if result\n values[index] = result\n end\n end\n values.join('_').downcase\n end", "def values\n iterator = @form_fields.keySet.iterator\n set = []\n set << field(iterator.next.toString) while iterator.hasNext\n set\n end", "def fields=(field_maps)\n @fields = []\n field_maps.each { |fld| @fields << Field.new(fld) }\n @fields\n end", "def the_fields_grouped(field_keys)\n res = []\n object.get_fields_grouped(field_keys).each do |_group|\n group = {}.with_indifferent_access\n _group.keys.each do |k|\n group[k] = _group[k].map{|v| h.do_shortcode(v.to_s.translate(@_deco_locale), object) }\n end\n res << group\n end\n res\n end", "def field_by_name(name = nil)\n @fields.find { |h| h[:name].to_snym == name.to_snym }\n end", "def [] field\n f = self.get(field)\n return nil if (f == nil)\n return f.values.to_a\n end", "def all_fields\n found_fields = Array.new\n self.fields.each do |field|\n found_fields << field\n found_fields = found_fields + field.all_fields if field.type == 'ObjectField'\n end\n found_fields\n end", "def search_field_list(lens = nil)\n blacklight_config(lens).search_fields.values\n end", "def extract_values(records, field)\n summarize_field(records, field).keys\nend", "def values_array\n @_field_path.map{ |field_| @_values[field_.name] }\n end", "def for_field(field)\n @all.select { |f| f.field == field.to_sym }\n end", "def get_field_list\n return make_request(\"#{self.endpoint}/list/fields\")\n end", "def get_field_by_name(name)\n name = name.to_sym\n fields.values.find {|field| field.name == name}\n end", "def field_records_by_field_name(name)\n records = self.field_records.select { |record| record.fieldset_child.child.name == name }\n return records\n \n # this version uses less queries but feels less elegant\n # field = DynamicFieldsets::Field.find_by_name(name)\n # child = DynamicFieldsets::FieldsetChild.where(:child => field, :fieldset => self.fieldset).first\n # records = DynamicFieldsets::FieldRecord.where(:child => child, :associator => self)\n # return records\n end", "def field_array(lines)\n entries = []\n text = lines.join\n text.scan(/^>.+<(.+)>\\n(.+\\n)+\\n/) do |name, data| \n entries << [name, data.chomp]\n end\n Hash[entries]\n end", "def values(fields, default)\n values = Hash[fields.product([default])]\n\n # Cache the fields for performance.\n @fields ||= self.fields\n\n @fields.each do |field|\n fields.each do |f|\n values[f] = field.to_s if field.field_name =~ /^#{Regexp.escape(f)}/\n end\n end\n values\n end", "def form_elements(model_name, *field_names)\n options = field_names.extract_options!\n\n patterned_elements \"\\##{model_name}_%{element_name}\", *field_names, options.slice(:element_array)\n end", "def chosen_array_field_name\n \"#{name}_chosen_array\".to_sym\n end", "def fields_from_model model\n workers_from_model(model).map{ |worker| Array(worker[:fields]) }.flatten\n end", "def pick_fields(*fields)\n self.values.inject({}) do |hsh, node|\n value = self[node.name].pick(*fields)\n if fields.size == 1\n value = value.values.first\n end\n hsh[node.name] = value\n hsh\n end\n end" ]
[ "0.74406946", "0.67190284", "0.6709556", "0.66769433", "0.66562265", "0.65829986", "0.64617735", "0.626644", "0.6203308", "0.61324567", "0.6127118", "0.611645", "0.61118937", "0.6102141", "0.60826594", "0.60580987", "0.602145", "0.5988478", "0.5935649", "0.5935228", "0.5927668", "0.58841926", "0.5855132", "0.58345324", "0.5810716", "0.58075655", "0.57825255", "0.577626", "0.57748455", "0.5752534", "0.5747451", "0.5728595", "0.57229775", "0.57152367", "0.5709059", "0.5704852", "0.56862044", "0.5677707", "0.56677836", "0.5666928", "0.5639516", "0.56252325", "0.56225914", "0.56193244", "0.5614303", "0.5595722", "0.55800873", "0.55695456", "0.5561266", "0.55458313", "0.5545155", "0.5535019", "0.5525948", "0.5522465", "0.5522142", "0.55158496", "0.5515811", "0.54992294", "0.5494068", "0.5486536", "0.5469452", "0.5446874", "0.54380053", "0.5386575", "0.5379338", "0.5375406", "0.53738064", "0.53708917", "0.5353475", "0.5353078", "0.53427166", "0.5334247", "0.53331184", "0.53176886", "0.53094333", "0.53083354", "0.5304775", "0.53021073", "0.52893543", "0.5286773", "0.5279361", "0.52759546", "0.5273975", "0.5272798", "0.5266303", "0.52652586", "0.5254241", "0.52378815", "0.523635", "0.5232766", "0.52301365", "0.52236193", "0.52232635", "0.5223246", "0.52183837", "0.521701", "0.5210326", "0.5206561", "0.5201555", "0.5200582" ]
0.5813433
24
Puts the file into cache with the URI.
def put(src, uri) raise NotImplementedError end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cache(uri, obj)\n filename=cacheFileName(uri)\n print(\"Creating #{filename}\\n\")\n File.open(filename, 'w') {|f| f.write(obj) }\nend", "def put(src, uri)\n # prepare cache path\n path = prepare_cache_path\n\n # move the file from the working directory to cache\n FileUtils.mv(src, path)\n\n # make a symbolic link from original location to the cache\n FileUtils.symlink(path, src)\n\n # copy from cache to the resource file\n @table[uri.to_s] = path\n Resource[uri].link_from(path)\n end", "def cache_file(file)\n FileUtils.cp(file, path)\n end", "def cache_content(uri, content)\n clear_cache(uri)\n\n time = Time.now.to_i\n\n cache_store.write(cache_key(uri), time)\n cache_store.write(cache_key([uri, time]), content)\n \n content\n end", "def update (uri, data)\n return nil unless @enabled\n\n cache_name = translate_uri(uri)\n mkdir # FIXME include cache_name to build all necessary directories \n\n File.open(File.join(@directory, cache_name), 'w') do |f|\n f << data\n end\n end", "def update_cache\n Rails.logger.debug \"Updating cache for... #{@@cache_file}\"\n fp = File.new(@@cache_file, 'w')\n if fp\n # acquire an exclusive lock (writer)\n if fp.flock(File::LOCK_EX)\n content = open(@@file_path).read\n \n if content\n #logger.debug \"Generate cache file: #{@@cache_file}\"\n fp.write(content) # writes to the file\n end\n \n fp.flock(File::LOCK_UN) # release a lock\n end\n fp.close\n end\n end", "def cache(gist, file, data)\n cache_file = get_cache_file_for gist, file\n File.open(cache_file, \"w\") do |io|\n io.write data\n end\n end", "def cache_path(uri:, path:)\n return if File.exist?(path)\n\n WebMock.disable!\n development_config = Figgy.all_environment_config[\"development\"]\n client = ArchivesSpace::Client.new(\n ArchivesSpace::Configuration.new(\n base_uri: development_config[\"archivespace_url\"],\n username: development_config[\"archivespace_user\"],\n password: development_config[\"archivespace_password\"]\n )\n )\n client.login\n result = client.get(uri)\n FileUtils.mkdir_p(Pathname.new(path).dirname)\n File.open(path, \"w\") do |f|\n f.write(result.body)\n end\n WebMock.enable!\n end", "def cache_filename_for_uri( path )\n uid = Digest::MD5.hexdigest( \"#{@uid}:#{path}\" )\n # NOTE: this path needs to exist with r/w permissions for webserver\n @cache_dir.join( uid )\n end", "def download_file(url, destination)\n raw_file = server_api.streaming_request(url)\n\n Chef::Log.info(\"Storing updated #{destination} in the cache.\")\n cache.move_to(raw_file.path, destination)\n end", "def download_file(url, destination)\n raw_file = server_api.get_rest(url, true)\n\n Chef::Log.info(\"Storing updated #{destination} in the cache.\")\n cache.move_to(raw_file.path, destination)\n end", "def cache!(file)\n stored = CarrierWave::Storage::GridFS::File.new(uploader, uploader.cache_path)\n stored.write(file)\n stored\n end", "def fetch_cache(file, url)\n @path = \"tmp/\" + file + \".html\";\n @temp = @path + \".fetch\"\n @doFetch = !(FileTest.exists?(@path) && (Time.new - File.mtime(@path) < (5 * 60)))\n\n if @doFetch and download_page(@temp,url) then\n File.delete(@path) if File.exists?(@path)\n File.rename(@temp, @path)\n end\n\n if File.exists?(@path) then\n return @path\n else\n @useOnce = @path + \".\" + rand(100000).to_s + \".once\"\n download_page(@useOnce, url)\n return @useOnce\n end\n end", "def cache_open(url)\n Cachy.cache(url, hash_key: true) { open(url).read }\nend", "def cache(file_obj, data_result, url, username, password)\n data_result[:uuid] = UUID.generate\n key = generate_key url, username, password\n\n begin\n data_result[:data_tmp_path] = store_data_to_tmp file_obj, data_result[:uuid]\n data_result[:time_stored] = Time.now\n @@file_cache[key] = data_result\n rescue Exception => e\n @@file_cache[key] = nil\n end\n end", "def file(path, *args)\n return file_via_connection(path, *args) unless cache_enabled?(:file)\n\n @cache[:file][path] ||= file_via_connection(path, *args)\n end", "def save\n Chef::FileCache.store(\"remote_file/#{sanitized_cache_file_basename}\", json_data)\n end", "def cache_resource( path )\n resource_hash = compute_hash(path)\n return true if find_resource(resource_hash)\n\n copy_resource(resource_hash, path)\n end", "def update_cache(source=@url, destination=@local_path, options={})\n unless destination\n raise ArgumentError, \"Must specify destination directory when updatng resource\", caller\n end\n file_exists = File.exists?(destination)\n if file_exists && @signature_verified == nil\n verify_signature\n end\n unless file_exists && @signature_verified\n FileUtils.mkdir_p(File.dirname(destination))\n puts \"reading: #{source}\" if options[:verbose]\n tried_to_read = 0\n begin\n jarfile = open(source)\n rescue OpenURI::HTTPError => e\n puts e\n if tried_to_read < 1\n tried_to_read += 1\n retry\n end\n end\n if jarfile.class == Tempfile\n FileUtils.cp(jarfile.path, destination)\n puts \"copying to: #{destination}\" if options[:verbose]\n else\n File.open(destination, 'w') {|f| f.write jarfile.read }\n puts \"writing to: #{destination}\" if options[:verbose]\n end\n puts \"#{jarfile.size} bytes written\" if options[:verbose]\n verify_signature ? jarfile.size : false\n else\n File.size(destination)\n end\n end", "def assign_cached(value)\n uploaded_file = uploaded_file(value)\n set(uploaded_file) if cache.uploaded?(uploaded_file)\n end", "def cache!( new_file )\n super\n @old_tmp_file = new_file\n end", "def download!(uri)\n processed_uri = process_uri(uri)\n file = RemoteFile.new(processed_uri)\n raise CarrierWave::DownloadError, \"trying to download a file which is not served over HTTP\" unless file.http?\n cache!(file)\n end", "def cache!(new_file)\n super\n @old_tmp_file = new_file\n end", "def cache!(new_file)\n super\n @old_tmp_file = new_file\n end", "def page_cache_file(url)\n ActionController::Base.send :page_cache_file, url.gsub(/^https?:\\/\\//, '')\n end", "def store(from, path = nil)\n return unless @cache_base\n\n path ||= from\n clear path\n copy from, (@cache_base + path)\n end", "def put(key = '', data = '')\n if key != '' && data != ''\n puts \"Writing into cache with key: #{key}\" if ENV['DEBUG']\n return ::File.write(@cache_dir+key, data)\n end\n\n return false\n end", "def file_cache(token, caching_time_in_minutes=30, &payload)\n file = file_name token\n if FileHelper.not_cached_or_to_old? file, caching_time_in_minutes\n load_from_file_cache file\n else\n write_to_file_cache file, (yield payload)\n end\n end", "def filename(uri)\n \"#{URI.escape(uri, '/')}.cached\"\n end", "def write_cache_file key, content\n f = File.open( cache_file(key), \"w+\" )\n f.flock(File::LOCK_EX)\n f.write( content )\n f.close\n return content\n end", "def update_file(file_data)\n sha = file_data['sha256']\n file_dir = create_cache_dir(file_data['sha256'])\n file_path = File.join(file_dir, File.basename(file_data['filename']))\n if check_file(file_path, sha)\n @logger.debug(\"Using prexisting file: #{file_path}\")\n return file_path\n end\n\n @logger.debug(\"Queueing download for: #{file_path}\")\n serial_execute { download_file(file_path, sha, file_data['uri']) }\n end", "def cached_file(source, checksum = nil)\n if source =~ %r{^(file|ftp|http|https):\\/\\/}\n uri = as_uri(source)\n cache_file_path = \"#{Chef::Config[:file_cache_path]}/#{::File.basename(::CGI.unescape(uri.path))}\"\n Chef::Log.debug(\"Caching a copy of file #{source} at #{cache_file_path}\")\n\n remote_file cache_file_path do\n source source\n backup false\n checksum checksum unless checksum.nil?\n end\n else\n cache_file_path = source\n end\n\n Chef::Util::PathHelper.cleanpath(cache_file_path)\n end", "def cache_file_path\n raise IOError.new 'Write permission is required for cache directory' unless File.writable?(@args[:cache_directory])\n \"#{@args[:cache_directory]}/#{Digest::SHA1.hexdigest((@args[:cache_ref] || @path).to_s + size.to_s + last_modified.to_s)}.cache\"\n end", "def download!(uri)\n unless uri.blank?\n processed_uri = process_uri(uri)\n file = RemoteFile.new(processed_uri, self)\n raise CarrierWave::DownloadError, \"trying to download a file which is not served over HTTP\" unless file.http?\n cache!(file)\n end\n end", "def cache!(io, phase:)\n cache.upload(io, context.merge(phase: phase))\n end", "def download!(uri)\n unless uri.blank?\n processed_uri = process_uri(uri)\n file = RemoteFile.new(processed_uri)\n raise CarrierWave::DownloadError, \"trying to download a file which is not served over HTTP\" unless file.http?\n cache!(file)\n end\n end", "def write_cache(url, data, json: true)\n filename = cache_filename(url, json)\n logger.debug(\"Writing cache #{filename}\")\n FileUtils.mkdir_p(File.dirname(filename))\n if json\n IO.write(filename, JSON.dump(data))\n else\n IO.binwrite(filename, data)\n end\n end", "def put_file(url, filename, headers = {})\n request(:put, url, headers, :file => filename)\n end", "def put_file(url, filename, headers = {})\n request(:put, url, headers, :file => filename)\n end", "def write_cache(cache, path)\n if @use_cache then\n File.open path, \"wb\" do |cache_file|\n Marshal.dump cache, cache_file\n end\n end\n\n cache\n rescue Errno::EISDIR # HACK toplevel, replace with main\n cache\n end", "def update\n download_page if cache_expired?\n read_cache\n end", "def cached_wget(url, override_cache=false)\n\tputs \" Fetching #{url}\"\n\tcache_file_name = File.join CACHE_DIR, Digest::MD5.hexdigest(url)\n\tif override_cache or not File.exists? cache_file_name\n\t\tFile.open(cache_file_name, 'w') do |cache_file| \n\t\t\topen(url) do |remote_file|\n\t\t\t\tremote_file.each_line do |remote_line| \n\t\t\t\t\tcache_file.puts remote_line\n\t\t\t\tend\n\t\t\tend\n\t\tend \n\t\tputs \" (downloaded fresh copy to #{cache_file_name})\"\n\telse\n\t\tputs \" (loaded from cache #{cache_file_name})\"\n\tend\n\tcache_file_name\nend", "def add(value)\n ensure_cache_path_created\n FileUtils.touch(File.join(cache_path, value))\n end", "def fetch_file_by_url\n if (self.url)\n self.file = self.url\n end\n end", "def add_file_to_distributed_cache(file)\n add_to_distributed_cache(file, \"mapred.cache.files\")\n end", "def save_file(file_id, source)\n synchronize do\n unless cached?(file_id)\n destination = File.join(@cache_root, Utils.fileid2name(file_id))\n FileUtils.cp(source, destination)\n \n if File.exist?(destination)\n cached_file = CachedFile.new\n cached_file.filename = File.basename(source)\n cached_file.last_copy = DateTime::now\n \n @cached_files[file_id] = cached_file\n else\n message = \"Cache: Unable to copy file with id #{file_id}.\"\n @logger.error(message) if @logger\n raise message\n end\n end\n end\n end", "def cache_at_client(filename,s)\n s.puts(\"CACHE:\\n\")\n s.puts(filename)\n s.puts(\"\\n\")\n data = s.read\n\tdest_file = File.open(filename, 'wb')\n\tdest_file.print(data)\n\tdest_file.close\nend", "def filename(uri)\n \"#{URI.encode_www_form_component(uri)}.cached\"\n end", "def cache(content, revision_number)\n File.open(self.cache_file_name(revision_number), \"wb\") { |f| f.write(content) }\n print(\"[MODEL_FILE] Wrote #{self.cache_file_name(revision_number)} to cache\")\n end", "def cache_file key\n File.join( store, key+\".cache\" )\n end", "def write\n return unless Dir.exist?(File.dirname(cache_file))\n @cache[\"version\"] = VERSION\n File.open(cache_file, \"w\") do |fh|\n fh.puts(JSON.dump(@cache))\n end\n end", "def put(cache_method, value)\n cache.send(\"#{cache_method}=\", value)\n end", "def []=(key, content)\n temp_file = File.join(root, ['tmp', $$, Thread.current.object_id].join('-'))\n File.open(temp_file, 'wb') do |dest|\n if content.respond_to? :to_str\n dest.write(content.to_str)\n else\n content.each {|s| dest.write(s) }\n end\n end\n\n path = cache_path(key)\n File.unlink path if File.exist?(path)\n FileUtils.mkdir_p File.dirname(path), :mode => 0755\n FileUtils.mv temp_file, path\n rescue\n File.unlink temp_file rescue nil\n ensure\n content\n end", "def store_cachefile(cache_filename, template)\n s = template.script\n s = \"\\#@ARGS #{template.args.join(',')}\\n#{s}\" if template.args\n tmp_filename = \"#{cache_filename}.#{rand()}\"\n File.open(tmp_filename, 'w') {|f| f.write(s) }\n File.rename(tmp_filename, cache_filename)\n end", "def set_file_for_remote_storage\n set_resource_mounter_file open(original_resource_mounter.url)\n end", "def update (url, response, timestamp)\n \n @semaphor.synchronize(){||\n if @cache.has_key?(url)\n # then this url is already in the cache and we simply update the timestamp\n new_entry = CacheEntry.new(url, response, timestamp)\n @cache[url] = new_entry\n else\n new_entry = CacheEntry.new(url, response, timestamp)\n # ensure that this object is not too large\n return if new_entry.response.bytesize() > max_object_size \n # remove items from the cache until this new entry fits.\n while @current_load + new_entry.response.bytesize() > max_load do\n evict()\n end\n @current_load = @current_load + new_entry.response.bytesize()\n @cache[url] = new_entry\n end\n }\n end", "def cache!(path)\n puts \"Caching library\"\n redis.flushall\n it = ITunes::Library.load path\n playlist = it.find_playlist('Echotunes')\n raise 'Create a \"Echotunes\" playlist in iTunes' unless playlist\n\n playlist.tracks.each do |track|\n redis.set redis.track_id(track.id), Marshal.dump(track.to_hash)\n end\n\n # TODO Don't leave this binary...recache every so often\n redis.set 'cached', Time.now\nend", "def _set_file(name, contents)\n File.open(\"%s/%s\" % [uri, name], \"w\") { |io| io.write contents }\n end", "def cache\n store = Moneta.new :File, dir: 'moneta'\n Cachy.cache_store = store\n Cachy\n end", "def store!(file)\n file_path = file.is_a?(String) ? file : file.path\n basename = file.is_a?(String) ? File.basename(file) : file.original_filename\n\n # Upload the file\n o = s3_bucket.objects[\"#{asset_path}#{basename}\"]\n o.write(Pathname.new(file_path), {\n acl: :public_read,\n content_type: MIME::Types.type_for(file_path).first.to_s\n })\n\n # Set the public_url attribute\n remote_url = o.public_url.to_s\n self.set(public_url: remote_url)\n self.this.update(public_url: remote_url)\n end", "def set(key, value)\n path = File.join(@root, \"#{key}.cache\")\n\n # Ensure directory exists\n FileUtils.mkdir_p File.dirname(path)\n\n # Check if cache exists before writing\n exists = File.exist?(path)\n\n # Serialize value\n marshaled = Marshal.dump(value)\n\n # Compress if larger than 4KB\n if marshaled.bytesize > 4 * 1024\n deflater = Zlib::Deflate.new(\n Zlib::BEST_COMPRESSION,\n Zlib::MAX_WBITS,\n Zlib::MAX_MEM_LEVEL,\n Zlib::DEFAULT_STRATEGY\n )\n deflater << marshaled\n raw = deflater.finish\n else\n raw = marshaled\n end\n\n # Write data\n PathUtils.atomic_write(path) do |f|\n f.write(raw)\n @size = size + f.size unless exists\n end\n\n # GC if necessary\n gc! if size > @max_size\n\n value\n end", "def cache\n if self.cache_store\n self.cache_store\n else\n self.cache_store = :file_store, root.join(\"tmp\").to_s\n self.cache_store\n end\n end", "def download(uri)\n target = File.join(@cache_dir, filename(uri))\n @logger.debug \"Downloading file to #{target}\"\n rich_uri = URI(uri)\n Net::HTTP.start(rich_uri.host, rich_uri.port, use_ssl: rich_uri.scheme == 'https') do |http|\n request = Net::HTTP::Get.new(rich_uri.request_uri)\n http.request request do |response|\n File.open(target, File::CREAT | File::WRONLY) do |file|\n response.read_body do |chunk|\n file.write(chunk)\n end\n end\n end\n end\n rescue => e\n @logger.error \"Unable to download from #{uri}\"\n puts e.backtrace\n end", "def invalidate(uri)\n @memcache.delete(uri_hash(uri))\n end", "def sync_file(file)\n cache_filename = File.join(\"cookbooks\", file.cookbook.name, file.manifest_record[\"path\"])\n mark_cached_file_valid(cache_filename)\n\n # If the checksums are different between on-disk (current) and on-server\n # (remote, per manifest), do the update. This will also execute if there\n # is no current checksum.\n if !cached_copy_up_to_date?(cache_filename, file.manifest_record[\"checksum\"])\n download_file(file.manifest_record[\"url\"], cache_filename)\n @events.updated_cookbook_file(file.cookbook.name, cache_filename)\n else\n Chef::Log.trace(\"Not storing #{cache_filename}, as the cache is up to date.\")\n end\n\n # Load the file in the cache and return the full file path to the loaded file\n cache.load(cache_filename, false)\n end", "def cache_file\n @cache_file ||= File.join cache_dir, \"#{full_name}.gem\"\n end", "def sync_to_cache_for_archiving\n result = sync_to_cache(false)\n self.erase_cache_symlinks rescue nil\n result\n end", "def cache_set(key, data, from_now = nil)\n cache_file = @config[:cache_directory] / \"#{key}.cache\"\n cache_directory = File.dirname(cache_file)\n FileUtils.mkdir_p(cache_directory)\n _expire = from_now ? from_now.minutes.from_now : nil\n cache_write(cache_file, Marshal.dump([data, _expire]))\n Merb.logger.info(\"cache: set (#{key})\")\n true\n end", "def write_cache\n File.write(CACHE_PATH, @data.to_json)\n end", "def cache(*uris)\n uris.each { |uri| @filter.insert(uri) }\n end", "def save\n cache_json = JSON.generate @_cache\n File.open(@file_path, 'w') { |file| file.write(cache_json) }\n end", "def store!\n # Upload the file\n prefix = \"#{Time.now.strftime(\"%Y%m%d%H%M%S\")}\"\n fname = prefix+(@file.respond_to?(:original_filename) ? @file.original_filename : File.basename(@file))\n o = s3_bucket.objects[\"#{asset_path}#{fname}\"]\n o.write(Pathname.new(@file.path), {\n acl: :public_read,\n content_type: MIME::Types.type_for(@file.path).first.to_s\n })\n\n # Set the public_url attribute\n remote_url = o.public_url.to_s\n self.set(public_url: remote_url)\n self.this.update(public_url: remote_url)\n end", "def cache_write(cache_file, data)\n File.open(cache_file, \"w+\") do |cache_data|\n cache_data.flock(File::LOCK_EX)\n cache_data.write(data)\n cache_data.flock(File::LOCK_UN)\n end\n true\n end", "def cache_file_for(klassname)\n File.join cache_file_path, klassname.gsub(/:+/, \"-\")\n end", "def uncache file \n refresh = nil\n begin\n is_a_file = F === file\n path = (is_a_file ? file.path : file.to_s) \n stat = (is_a_file ? file.stat : F.stat(file.to_s)) \n refresh = tmpnam(F.dirname(path))\n ignoring_errors do\n F.link(path, refresh) rescue F.symlink(path, refresh)\n end\n ignoring_errors do\n F.chmod(stat.mode, path)\n end\n ignoring_errors do\n F.utime(stat.atime, stat.mtime, path)\n end\n ignoring_errors do\n open(F.dirname(path)){|d| d.fsync}\n end\n ensure \n ignoring_errors do\n F.unlink(refresh) if refresh\n end\n end\n end", "def cache_write(value, key: cache_key, **)\n Rails.cache.write(key, value, namespace: namespace) if validate_key(key)\n end", "def downloaded_file\n filename = source[:cached_name] if source[:cached_name]\n filename ||= File.basename(source[:url], \"?*\")\n File.join(Config.cache_dir, filename)\n end", "def cache_path\n File.join @path, 'cache.ri'\n end", "def store(new_file, headers = {})\n # Copy from cache_path\n if new_file.is_a?(self.class)\n new_file.copy_to(escaped_path)\n return true\n end\n\n res = conn.put(escaped_path, new_file.read) do |req|\n req.headers = { \"Expect\" => \"\", \"Mkdir\" => \"true\" }.merge(headers)\n end\n\n check_put_response!(res)\n\n true\n rescue ConcurrentUploadError\n retry\n end", "def create_cache(dir, hostname, cache)\n # Let's create the cache directory if it does exists.\n Dir.mkdir(dir) unless File.exist?(dir)\n\n # Create the file and fill it with the cache\n cachefilename = File.join(dir, \"#{hostname}.yml\")\n cachefile = File.new(cachefilename, 'w+')\n cachefile.write(cache)\n cachefile.close\nend", "def download(url, cache_dir, filename)\n run_script \"curl -L --create-dirs -o #{cache_dir[:guest_path]}/#{filename} #{url}\" unless File.exist?(\"#{cache_dir[:host_path]}/#{filename}\")\n end", "def save_cached_data\n # open file for writing\n @file_handle = File.open(file_path, 'w')\n \n # write data string into file\n @file_handle << (@file_data_to_write.respond_to?(:read) ? @file_data_to_write.read : @file_data_to_write)\n \n # close file\n close_file\n \n end", "def save_cached_data\n # open file for writing\n @file_handle = File.open(file_path, 'w')\n \n # write data string into file\n @file_handle << (@file_data_to_write.respond_to?(:read) ? @file_data_to_write.read : @file_data_to_write)\n \n # close file\n close_file\n \n end", "def get_cache_file_for(gist, file)\n bad_chars = /[^a-zA-Z0-9\\-_.]/\n gist = gist.gsub bad_chars, ''\n file = file.gsub bad_chars, ''\n md5 = Digest::MD5.hexdigest \"#{gist}-#{file}\"\n File.join @cache_folder, \"#{gist}-#{file}-#{md5}.cache\"\n end", "def set_cache\n cache_key = self.class.cache_key(self.key)\n Rails.cache.write(cache_key, self.actual_value)\n end", "def cache_response!(response)\n cache.write(escape_path_for_cache_key(request_options[:path]), response)\n end", "def cache(filename, max_age, options=nil)\r\n\t\tdata = self.from_cache(filename, max_age, options)\r\n\t\t\r\n\t\tif(data != nil)\r\n\t\t\treturn data\r\n\t\telse\r\n\t\t\tdata = yield\r\n\t\t\tself.to_cache filename, data, options\r\n\t\t\treturn data\r\n\t\tend\r\n\r\n\tend", "def cache_dir(uri)\n File.join @dir, \"#{uri.host}%#{uri.port}\", File.dirname(uri.path)\n end", "def download_file(url, dest_dir)\n @log.info(\"== Ensuring file is cached: #{url} to #{dest_dir}\")\n require 'down'\n filename = File.basename(url)\n downloaded_file = File.join(dest_dir,filename)\n remote_file = Down.open(url)\n unless File.exist?(downloaded_file) && File.size(downloaded_file) == remote_file.size\n @log.verbose(\"Downloading #{url} to #{downloaded_file}\")\n Down.download(url, destination: downloaded_file)\n else\n @log.verbose(\"Skipping download, already in cache: #{downloaded_file}\")\n end\n remote_file.close\n downloaded_file\n end", "def download_file!\n retries = 3\n\n begin\n options = {\n :read_timeout => 300,\n }\n\n open(from_url, options) do |f|\n save_to_cache(f)\n end\n rescue SocketError,\n Errno::ECONNREFUSED,\n Errno::ECONNRESET,\n Errno::ENETUNREACH,\n Timeout::Error,\n OpenURI::HTTPError => e\n if retries != 0\n retries -= 1\n retry\n else\n raise Exceptions::NetworkError.new(from_url, e)\n end\n end\n end", "def serve_from_cache!\n puts \"\\nServed from cache '#{request.uri}'\\n\\n\" if ::SETTINGS['debug']\n TinyProxy::Cache.get(request.uri)\n end", "def set(key, value, mtime)\n @cache[key] = {\n value: value,\n mtime: mtime\n }\n end", "def writable_file\n @cache_file\n end", "def set_cache(value); end", "def set_cache(value); end", "def save_cache\n store_in_cache(@json_response) if valid_rates?(@json_response)\n rescue Errno::ENOENT\n raise InvalidCache\n end", "def cache(key)\n @lock.synchronize do\n @contents[key] ||= yield\n end\n end", "def save(key, maybe_param, blob, etag)\n $logger.debug(\"Cache write: #{key},#{maybe_param}\")\n filename = args_to_filename(key, maybe_param)\n FileUtils.mkdir_p(File.dirname(filename))\n IO::write(filename, blob)\n IO::write(\"#{filename}.etag\", etag)\n end", "def force(path)\n cache[path] = true\n end", "def cache_entry(url)\n CacheEntry.new(ld_api.canonical_url(url), self)\n end" ]
[ "0.73098624", "0.72068524", "0.7068385", "0.68803614", "0.67575413", "0.6749286", "0.66958", "0.65673214", "0.65020853", "0.6475204", "0.6446909", "0.6437824", "0.63880116", "0.6351356", "0.6343938", "0.6270706", "0.6266897", "0.625671", "0.6226085", "0.6215723", "0.6190821", "0.6130325", "0.6096783", "0.6096783", "0.60930264", "0.6093001", "0.60500693", "0.60416937", "0.6038595", "0.6023722", "0.60182065", "0.6016281", "0.60077333", "0.60038716", "0.59821886", "0.5978189", "0.5930665", "0.5916897", "0.5916897", "0.5907568", "0.58953434", "0.5883618", "0.5853995", "0.5845323", "0.5840318", "0.5835342", "0.5834206", "0.5833892", "0.5822442", "0.5816295", "0.5804664", "0.57976514", "0.579658", "0.57867366", "0.57638377", "0.5759504", "0.5753466", "0.57261074", "0.57210666", "0.5714716", "0.5700362", "0.5688034", "0.567507", "0.5672971", "0.56642437", "0.56592613", "0.56468415", "0.5636616", "0.56364834", "0.5625164", "0.5615752", "0.5615598", "0.5614517", "0.56055504", "0.56034464", "0.5603204", "0.55861026", "0.55837864", "0.5579269", "0.5578434", "0.55751896", "0.55620205", "0.55620205", "0.5556227", "0.55542964", "0.55488116", "0.55395544", "0.55370903", "0.5534528", "0.553431", "0.5534033", "0.5533418", "0.5532968", "0.55322427", "0.55322427", "0.55308723", "0.5516145", "0.55124557", "0.55064046", "0.5506257" ]
0.60632104
26
Gets cached data path from the uri resource.
def get(uri) # check cached or not unless @table.has_key?(uri) # prepare cache path path = prepare_cache_path # link the resource file to cache path Resource[uri].link_to(path) @table[uri.to_s] = path end return @table[uri.to_s] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def path\n data.path\n end", "def path\n data.path\n end", "def fetch_path(path=\"\")\n read_data(@uri + path)\n end", "def cache_filename_for_uri( path )\n uid = Digest::MD5.hexdigest( \"#{@uid}:#{path}\" )\n # NOTE: this path needs to exist with r/w permissions for webserver\n @cache_dir.join( uid )\n end", "def path\n @uri.path\n end", "def cache_path_for(resource)\n return false unless @cache_dir\n return false unless Dir.exist?(@cache_dir)\n # sanity check the resource\n return false unless resource && !resource.empty?\n # don't use URL params\n resource = resource.split('?', 2)[0]\n # join and expand the path\n expanded_path = File.expand_path(File.join(@cache_dir, resource))\n # don't allow requests to read outside the given cache directory\n # (eg: resource = '../../../../tmp/foo.txt')\n return false unless expanded_path.start_with?(@cache_dir)\n expanded_path\n end", "def uri_path\n __getobj__.uri.path\n end", "def cache_path\n File.join @path, 'cache.ri'\n end", "def getPath()\n return @uri.path\n end", "def data_uri\n @data_uri\n end", "def data_uri\n @data_uri\n end", "def data_uri\n @data_uri\n end", "def cached_location\n dlt = (download_type) ? download_type : 'default'\n Drupid.cache_path + self.class.to_s.split(/::/).last + extended_name + dlt + name\n end", "def path\n # TODO: is this trip really necessary?!\n data.fetch(\"path\") { relative_path }\n end", "def filename(uri)\n \"#{URI.escape(uri, '/')}.cached\"\n end", "def get_cached_data(uri)\n Rails.cache.fetch(uri, {expires_in: 24.hours, raw: true}) { JSON.parse(RestClient::Resource.new(uri).get) }\n end", "def cache_path\n Pathname.new(File.expand_path(File.join(ChefCLI::Helpers.package_home, \"cache\")))\n .join(\".cache\", \"git\", Digest::SHA1.hexdigest(uri))\n end", "def path\n data.fetch(\"path\") { relative_path }\n end", "def path\n @data[\"path\"].to_s\n end", "def path\n name = @resource.value(:name)\n if (attrs = self.class.all[name])\n attrs[:path]\n end\n end", "def path\n @uri.request_uri\n end", "def cache_path\n @cache_path ||= File.join(\"\", \"gko\", \"cache\", \"#{self.host}\")\n end", "def path\n URI.parse(@url).path\n end", "def cache_path\n Pathname.new(Berkshelf.berkshelf_path)\n .join('.cache', 'hg', Digest::SHA1.hexdigest(uri))\n end", "def path(uri)\n path, _ = path_and_name(uri)\n path\n end", "def cache_file_path\n File.join @homepath, 'cache'\n end", "def absolute_path\n if is_url?\n # Use the last path component without the query string plus the name\n # of the resource in Base64. This should be both mildly readable and\n # also unique per invocation.\n url_part = URI(path).path.split(/\\//).last\n base64_name = Base64.strict_encode64(name).gsub(/\\=/, '')\n ::File.join(Chef::Config[:file_cache_path], \"#{base64_name}_#{url_part}\")\n else\n ::File.expand_path(path, Chef::Config[:file_cache_path])\n end\n end", "def cache_dir(uri)\n File.join @dir, \"#{uri.host}%#{uri.port}\", File.dirname(uri.path)\n end", "def path\n name = @resource.value(:name)\n # rubocop:disable Style/GuardClause\n if (attrs = self.class.all[name])\n # rubocop:enable Style/GuardClause\n attrs[:path]\n end\n end", "def download_path\n ::File.join(Chef::Config[:file_cache_path], ::File.basename(URL))\n end", "def cache_file_path\n raise IOError.new 'Write permission is required for cache directory' unless File.writable?(@args[:cache_directory])\n \"#{@args[:cache_directory]}/#{Digest::SHA1.hexdigest((@args[:cache_ref] || @path).to_s + size.to_s + last_modified.to_s)}.cache\"\n end", "def filename(uri)\n \"#{URI.encode_www_form_component(uri)}.cached\"\n end", "def get_resource_file_path(resource_uri, type)\n type = type.split('/').last\n resource_name = resource_uri.split('/').last\n\n dir_path = \"#{@results_dir_path}/#{type}\"\n Dir.mkdir(dir_path) unless Dir.exist?(dir_path)\n\n \"#{dir_path}/#{StringHelper.get_clear_file_path(resource_name)}.json\"\n end", "def path\n File.join(STORAGE_PATH, @resource.subject_uri.path)\n end", "def cache_dir(uri)\n # Correct for windows paths\n escaped_path = uri.path.sub(/^\\/([a-z]):\\//i, '/\\\\1-/')\n escaped_path.tap(&Gem::UNTAINT)\n\n File.join Gem.spec_cache_dir, \"#{uri.host}%#{uri.port}\", File.dirname(escaped_path)\n end", "def path\n @reader.path\n end", "def caching\n @caching = \"data_update[#{data_path}]\"\n end", "def caching\n @caching = \"data_update[#{data_path}]\"\n end", "def caching\n @caching = \"data_update[#{data_path}]\"\n end", "def caching\n @caching = \"data_update[#{data_path}]\"\n end", "def path\n return @path\n end", "def path\n return @path\n end", "def path\n return @path\n end", "def file_url\n resource.send(mount_point).url\n end", "def cache_path( options, subdirectory = nil )\n path = ''\n path = \"/#{subdirectory}\" if subdirectory\n path << case options\n when Hash\n url_for(\n options.merge(\n :only_path => true,\n :skip_relative_url_root => true,\n :format => params[:format]\n )\n )\n when String\n options\n else\n #request.path\n if request.path.empty? || request.path == '/'\n '/index'\n else\n request.path\n end\n end\n return path\n end", "def get path\n uri = BASE_URI.dup.tap do |uri|\n uri.path = path\n end\n\n @http.get uri, headers: REQUEST_HEADERS\n end", "def _data_path id\n raise \"illegal data id #{id.inspect}\" unless id =~ /\\A\\w+(\\.\\w+)*\\z/\n path = path()\n \"#{path}/data/#{id}\"\n end", "def file_path\n Dir.glob(config.cache).first || File.join(File.dirname(config.cache),\n File.basename(config.cache).gsub(/_.+\\.txt/, '_0.txt'))\n end", "def path_url\n \"http://thegamesdb.net/banners/_gameviewcache/\"\n end", "def path\n metadata.fetch(:path) do\n return if request_response_pairs.empty?\n request_response_pairs.first.first.path\n end\n end", "def path\n return @path\n end", "def path\n file.url\n end", "def cache_dir\n return pretty_path(File.join(Dir::COMMON_APPDATA, 'RightScale', 'cache'))\n end", "def get(path)\n # build full URL\n url = API_URL % [path]\n\n # log full URL\n @ctx.log.debug('BaseObject#get') { '%s' % [url] }\n\n # get URL from cache\n @ctx.cache.get(url)\n end", "def path\n File.join(RH_CONFIG[\"location\"], self.parent.pid.gsub(/:/,\"_\"), \"data\", self.name.first) unless self.parent.nil? or self.name.empty?\n end", "def cache_path\n return @cache_resources unless @cache_resources.nil?\n\n @cache_resources = Chef::Resource::Directory.new(::File.join(new_resource.cache_path), run_context)\n @cache_resources.recursive(true)\n\n return @cache_resources\n end", "def get_uri(path)\n file = scope.get(path)\n InvalidPath.raise! {!file}\n file.uri\n end", "def downloaded_file\n filename = source[:cached_name] if source[:cached_name]\n filename ||= File.basename(source[:url], \"?*\")\n File.join(Config.cache_dir, filename)\n end", "def find_data_path(path)\n each_data_path(path).first\n end", "def get_cache_file(key)\n _find_file_key(key)\n end", "def path\n @path\n end", "def path\n @path\n end", "def path\n @path\n end", "def path\n @path\n end", "def path\n @path\n end", "def path\n @path\n end", "def path\n @path\n end", "def path\n @path\n end", "def cache_path(uri:, path:)\n return if File.exist?(path)\n\n WebMock.disable!\n development_config = Figgy.all_environment_config[\"development\"]\n client = ArchivesSpace::Client.new(\n ArchivesSpace::Configuration.new(\n base_uri: development_config[\"archivespace_url\"],\n username: development_config[\"archivespace_user\"],\n password: development_config[\"archivespace_password\"]\n )\n )\n client.login\n result = client.get(uri)\n FileUtils.mkdir_p(Pathname.new(path).dirname)\n File.open(path, \"w\") do |f|\n f.write(result.body)\n end\n WebMock.enable!\n end", "def data_cache(fpath)\n (@data_caches ||= []) << fpath\n return fpath\n end", "def file_path\n storage.file_path(self.class, @id)\n end", "def cache_repository_path\n File.absolute_path(File.join(Rails.root, 'cache', cached_directory))\n end", "def file_cache_path\n Chef::Config[:file_cache_path]\n end", "def cache_path\n @cache_path ||= Pathname.new(Berkshelf.berkshelf_path).join('.cache', 'halite', dependency.name)\n end", "def path\n @attributes[:path]\n end", "def path\n @attributes[:path]\n end", "def path\n @attributes[:path]\n end", "def path\n @attributes[:path]\n end", "def path\n @attributes[:path]\n end", "def path\n @attributes[:path]\n end", "def path\n @attributes[:path]\n end", "def path\n @attributes[:path]\n end", "def path\n @attributes[:path]\n end", "def path\n @attributes[:path]\n end", "def path\n @attributes[:path]\n end", "def path\n @attributes[:path]\n end", "def local_path\n src = if %i(direct repo).include?(new_resource.source)\n package_metadata[:url]\n else\n new_resource.source.to_s\n end\n ::File.join(Chef::Config[:file_cache_path], ::File.basename(src))\n end", "def download_path\n ::File.join(Chef::Config[:file_cache_path],\n ::File.basename(source_path))\n end", "def _uri_path\n \"#{@dir}.#{CGI.escape @reg}/#{CGI.escape @dss}\"\n end", "def path(key, parent_path = nil)\n if key.nil? || key[self.key_name].nil?\n raise ArgumentError.new(\"Missing required key '#{self.key_name}' for cache '#{self.name}'\")\n end\n\n key_value = key[self.key_name]\n parent_path ||= self.parent_path(key)\n version = self.version(parent_path)\n path_string(parent_path, version, key_value)\n end", "def path\n return get_path self\n end", "def resource_uri\r\n\t\tpath = random_uri\r\n\t\tpath << random_uri\r\n\t\treturn path\r\n\tend", "def cache_resource( path )\n resource_hash = compute_hash(path)\n return true if find_resource(resource_hash)\n\n copy_resource(resource_hash, path)\n end", "def path!\n model.dataset.select(:path).get_unfiltered_raw(id).try(:[], :path)\n end", "def path\n @path ||= filters.uri_escape(absolute_url) if absolute_url\n end", "def path\n @path ||= filters.uri_escape(absolute_url) if absolute_url\n end", "def fetch_path(path=\"\")\n @fetcher.fetch_path(path)\n end", "def endpoint_for(path)\n File.join(MemoTomato::ROOT_URL, \"#{path}.json\")\n end", "def data_path(path)\n return File.expand_path(File.join(@@config['dataPath'], path))\n end", "def data_d\n Pathname.new \"#{exp_crit_d}/data\"\n \n end" ]
[ "0.6887563", "0.6887563", "0.6859787", "0.6830755", "0.6811168", "0.6765802", "0.66990376", "0.6682875", "0.6589293", "0.6566418", "0.6566418", "0.6566418", "0.64847183", "0.64646184", "0.6450746", "0.64396197", "0.6437117", "0.64262676", "0.64156437", "0.6374739", "0.6324969", "0.6277399", "0.62378854", "0.6194385", "0.6180214", "0.6178835", "0.6176411", "0.61647683", "0.61587113", "0.6135161", "0.61031586", "0.6096386", "0.60839695", "0.6021427", "0.5996547", "0.59792745", "0.5937859", "0.5937859", "0.5937859", "0.5937859", "0.5924434", "0.5924434", "0.5924434", "0.592238", "0.59086215", "0.5906639", "0.5869688", "0.58637756", "0.58523613", "0.5848425", "0.5847337", "0.58398646", "0.5829534", "0.58284557", "0.5822121", "0.58092594", "0.58061045", "0.5805147", "0.57988036", "0.57983905", "0.57981753", "0.57981753", "0.57981753", "0.57981753", "0.579443", "0.579443", "0.579443", "0.579443", "0.5789733", "0.57759655", "0.57672626", "0.5726144", "0.5725443", "0.57112086", "0.5708909", "0.5708909", "0.5708909", "0.5708909", "0.5708909", "0.5708909", "0.5708909", "0.5708909", "0.5708909", "0.5708909", "0.5708909", "0.5708909", "0.5702333", "0.5694276", "0.56892914", "0.56892425", "0.5680449", "0.5674178", "0.5670302", "0.56699497", "0.5667782", "0.5667782", "0.56639683", "0.56591314", "0.5657664", "0.56493163" ]
0.68610585
2
Puts the data to uri resource and caches it in local.
def put(src, uri) # prepare cache path path = prepare_cache_path # move the file from the working directory to cache FileUtils.mv(src, path) # make a symbolic link from original location to the cache FileUtils.symlink(path, src) # copy from cache to the resource file @table[uri.to_s] = path Resource[uri].link_from(path) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update (uri, data)\n return nil unless @enabled\n\n cache_name = translate_uri(uri)\n mkdir # FIXME include cache_name to build all necessary directories \n\n File.open(File.join(@directory, cache_name), 'w') do |f|\n f << data\n end\n end", "def cache(uri, obj)\n filename=cacheFileName(uri)\n print(\"Creating #{filename}\\n\")\n File.open(filename, 'w') {|f| f.write(obj) }\nend", "def cache(data); end", "def set(data)\n data = data.to_json\n cache_key = Digest::SHA1.hexdigest(data)\n\n log(\"insert :Cache, #{cache_key} -> {'blob' => #{data.inspect}}\")\n connection.insert(:Cache, cache_key, { \"blob\" => data })\n cache_key\n end", "def save\n Chef::FileCache.store(\"remote_file/#{sanitized_cache_file_basename}\", json_data)\n end", "def cache(file_obj, data_result, url, username, password)\n data_result[:uuid] = UUID.generate\n key = generate_key url, username, password\n\n begin\n data_result[:data_tmp_path] = store_data_to_tmp file_obj, data_result[:uuid]\n data_result[:time_stored] = Time.now\n @@file_cache[key] = data_result\n rescue Exception => e\n @@file_cache[key] = nil\n end\n end", "def put(data)\n end", "def put(src, uri)\n raise NotImplementedError\n end", "def cache_content(uri, content)\n clear_cache(uri)\n\n time = Time.now.to_i\n\n cache_store.write(cache_key(uri), time)\n cache_store.write(cache_key([uri, time]), content)\n \n content\n end", "def caching\n @caching = \"data_update[#{data_path}]\"\n end", "def caching\n @caching = \"data_update[#{data_path}]\"\n end", "def caching\n @caching = \"data_update[#{data_path}]\"\n end", "def caching\n @caching = \"data_update[#{data_path}]\"\n end", "def cache_resource( path )\n resource_hash = compute_hash(path)\n return true if find_resource(resource_hash)\n\n copy_resource(resource_hash, path)\n end", "def put(key = '', data = '')\n if key != '' && data != ''\n puts \"Writing into cache with key: #{key}\" if ENV['DEBUG']\n return ::File.write(@cache_dir+key, data)\n end\n\n return false\n end", "def cache(gist, file, data)\n cache_file = get_cache_file_for gist, file\n File.open(cache_file, \"w\") do |io|\n io.write data\n end\n end", "def put(path, *data, &block)\n map(path, R3::PUT, *data, &block)\n end", "def cache_write(key, data)\n @mutex.synchronize do\n @cache[key] = data\n end\n end", "def cache_content(type, data)\n return nil unless type.present?\n\n Rails.cache.write(type, data, expires_in: 60.minutes)\n rescue StandardError => e\n logger.error(\"Unable to add #{type} to the Rails cache: #{e}.\")\n end", "def save_cached_data\n # open file for writing\n @file_handle = File.open(file_path, 'w')\n \n # write data string into file\n @file_handle << (@file_data_to_write.respond_to?(:read) ? @file_data_to_write.read : @file_data_to_write)\n \n # close file\n close_file\n \n end", "def save_cached_data\n # open file for writing\n @file_handle = File.open(file_path, 'w')\n \n # write data string into file\n @file_handle << (@file_data_to_write.respond_to?(:read) ? @file_data_to_write.read : @file_data_to_write)\n \n # close file\n close_file\n \n end", "def edit_data(&block)\n lock do\n @cached_data = load_data_from_file\n block.call(self)\n File.safe_write(path, JSON.pretty_generate(@cached_data))\n @cached_data\n end\n end", "def write_cache(url, data, json: true)\n filename = cache_filename(url, json)\n logger.debug(\"Writing cache #{filename}\")\n FileUtils.mkdir_p(File.dirname(filename))\n if json\n IO.write(filename, JSON.dump(data))\n else\n IO.binwrite(filename, data)\n end\n end", "def put(uri, options = T.unsafe(nil)); end", "def data_uri=(uri)\n assign_data_uri(uri)\n @data_uri = uri\n end", "def cache_resource(dest_dir=@local_cache_dir, options={})\n unless dest_dir\n raise ArgumentError, \"Must specify destination directory when creating resource\", caller\n end\n self.local_cache_dir=dest_dir\n @size = update_cache(@url, @local_path, options)\n if options[:include_pack_gz]\n @relative_local_path_pack_gz = \"#{@relative_local_path}.pack.gz\"\n @local_path_pack_gz = \"#{dest_dir}/#{@relative_local_path_pack_gz}\"\n @size_pack_gz = update_cache(@url_pack_gz, @local_path_pack_gz, options)\n end\n @signature_verified ? @size : @signature_verified\n end", "def _http_put resource, path\n uri = ::URI.parse(resource.auth_uri)\n path = _path uri, path\n request = Net::HTTP::Put.new(path)\n _build_request resource, request\nend", "def _http_put resource, path\n uri = ::URI.parse(resource.auth_uri)\n path = _path uri, path\n request = Net::HTTP::Put.new(path)\n _build_request resource, request\nend", "def update_cache(type, id, data)\n end", "def update_cache(type, id, data)\n end", "def retrieve_and_store\n @resource = @resource_storage.create_or_update_from_manifest(manifest)\n nil\n end", "def clear_data_uri_cache\n @_uri_cache = {}\n end", "def store(from, path = nil)\n return unless @cache_base\n\n path ||= from\n clear path\n copy from, (@cache_base + path)\n end", "def send_put(resource, data)\n\n url = URI.parse(primavera_path(resource))\n req = Net::HTTP::Put.new(url.to_s, initheader = {'Content-Type' => 'application/json'})\n req.body = data\n\n puts 'Sending PUT request to ' + url.to_s\n\n send_request(url, req)\n end", "def refresh\n @write_lock.synchronize do\n @data = storage.retrieve(self.class, @id)\n @saved = true\n end\n end", "def put(data)\n enter(canonical(data))\n nil\n end", "def refresh!\n self.data = client.get(path).data\n end", "def update_cache(type, id, data)\n end", "def store(id, data)\n storage[id] = data\n end", "def store(path ,data)\n @sync.synchronize(Sync::EX){\n if data.kind_of? Hash\n data.each do |key, value|\n if key.kind_of? Array\n store( path + key, value)\n next\n end\n key = key.to_sym\n if key == VALUE_KEY\n store( path, value )\n else\n store( path + [key], value)\n end\n end\n else\n @source[path] = data\n end\n }\n end", "def save\n @id ||= '%064d' % CloudKit.storage_adapter.generate_unique_id\n @etag = UUID.generate unless @deleted\n @last_modified = Time.now.httpdate\n\n CloudKit.storage_adapter[@id] = {\n 'uri' => @uri.cannonical_uri_string,\n 'etag' => escape(@etag),\n 'last_modified' => @last_modified,\n 'json' => @json,\n 'deleted' => escape(@deleted),\n 'archived' => escape(@archived),\n 'remote_user' => escape(@remote_user),\n 'collection_reference' => @collection_reference ||= @uri.collection_uri_fragment,\n 'resource_reference' => @resource_reference ||= @uri.cannonical_uri_string\n }.merge(escape_values(parsed_json))\n reload\n end", "def write_cache\n File.write(CACHE_PATH, @data.to_json)\n end", "def put\n conn = @client.authorized_connection(url: @client.object_api_url)\n res = conn.put do |req|\n req.headers['Content-Type'] = \"application/json\"\n req.url resource_uri\n req.body = raw.to_json\n end\n if res.success?\n data = JSON.parse(res.body)\n self.class.new(data, @client)\n else\n nil\n end\n end", "def store(key, data, bucket = nil, options = {})\n validate_key!(key)\n # Must build path before infering content type in case bucket is being used for options\n path = path!(bucket, key, options)\n infer_content_type!(key, options)\n \n put(path, options, data) # Don't call .success? on response. We want to get the etag.\n end", "def put(data, options={})\n @hal_client.put(href, data, options).tap do\n reset\n end\n end", "def on_put(resource_uri, opts)\n debug \"on_put: #{resource_uri}\"\n resource = update_resource(resource_uri, true, opts)\n show_resource(resource, opts)\n end", "def cache_set(key, data, from_now = nil)\n cache_file = @config[:cache_directory] / \"#{key}.cache\"\n cache_directory = File.dirname(cache_file)\n FileUtils.mkdir_p(cache_directory)\n _expire = from_now ? from_now.minutes.from_now : nil\n cache_write(cache_file, Marshal.dump([data, _expire]))\n Merb.logger.info(\"cache: set (#{key})\")\n true\n end", "def store(data, headers = {})\n r = conn.put(escaped_path, data) do |req|\n req.headers = headers\n token = CarrierWave::UCloud::Digest.authorization(@uploader, req)\n req.headers['Authorization'] = token\n end\n r\n end", "def update_(uri, rdf_data=nil, content_type=nil)\n reset(uri)\n\n if rdf_data\n res = sparql_push(uri, rdf_data.strip, content_type)\n else\n res = sparql_pull(%{LOAD \"#{uri}\" INTO GRAPH <#{uri}>})\n end\n\n return res\n end", "def put(data, path, options={})\n self.config.put(data, path, options)\n end", "def cache!(io, phase:)\n cache.upload(io, context.merge(phase: phase))\n end", "def update_cache(source=@url, destination=@local_path, options={})\n unless destination\n raise ArgumentError, \"Must specify destination directory when updatng resource\", caller\n end\n file_exists = File.exists?(destination)\n if file_exists && @signature_verified == nil\n verify_signature\n end\n unless file_exists && @signature_verified\n FileUtils.mkdir_p(File.dirname(destination))\n puts \"reading: #{source}\" if options[:verbose]\n tried_to_read = 0\n begin\n jarfile = open(source)\n rescue OpenURI::HTTPError => e\n puts e\n if tried_to_read < 1\n tried_to_read += 1\n retry\n end\n end\n if jarfile.class == Tempfile\n FileUtils.cp(jarfile.path, destination)\n puts \"copying to: #{destination}\" if options[:verbose]\n else\n File.open(destination, 'w') {|f| f.write jarfile.read }\n puts \"writing to: #{destination}\" if options[:verbose]\n end\n puts \"#{jarfile.size} bytes written\" if options[:verbose]\n verify_signature ? jarfile.size : false\n else\n File.size(destination)\n end\n end", "def save(host, uri, content)\n end", "def fetch(storage_path, local_path)\n super\n FileUtils.cp absolute_path(storage_path), local_path\n end", "def store\n result = QcloudCos.upload(path, file.to_file)\n\n if result != nil\n self.url = result\n end\n end", "def set_file_for_remote_storage\n set_resource_mounter_file open(original_resource_mounter.url)\n end", "def set_resource(resource_key, id, object)\n resource_cache(resource_key)[id] = object\n end", "def put endpoint, data\n do_request :put, endpoint, data\n end", "def publishResourceUpdate(app_id, run_id, resource)\n # Cache\n cache = RoomPlacesCachePublish.get_cache(app_id, run_id)\n\n cache.resources_update([resource])\n\t#nutella.net.publish('location/resources/updated', {:resources => [resource]})\nend", "def PUT(uri, data, type, credentials)\n put = Net::HTTP::Put.new(uri.path)\n put.content_type = type\n\n set_upload_body(put, data)\n\n response = submit(put, uri, credentials)\n\n case response\n when Net::HTTPOK, Net::HTTPAccepted\n # We've either set a parameter or started a run so we get 200 or 202\n # back from the server, respectively. Return true to indicate success.\n true\n when Net::HTTPCreated\n # We've uploaded data so we get 201 back from the server. Return the\n # uri of the created resource.\n URI.parse(response['location'])\n when Net::HTTPNoContent\n # We've modified data so we get 204 back from the server. Return the\n # uri of the modified resource.\n uri\n when Net::HTTPServiceUnavailable\n raise ServerAtCapacityError.new\n else\n report_error(\"PUT\", uri.path, response, credentials)\n end\n end", "def load!\n update(get_json(url))\n rescue\n @exists = false\n else\n @exists = true\n ensure\n @loaded = true\n end", "def direct_put(uri,data, wait = true, opts = {})\n id = @utils.id_generate\n options = {\"Identifier\" => id, \"URI\" => uri ,\"UploadFrom\" => \"direct\", \"DataLength\" => data.bytesize }.merge(opts)\n send_packet @utils.packet_mangler(options,\"ClientPut\").sub! \"EndMessage\\n\", \"Data\\n#{data}\"\n if wait\n wait_for id,/PutFailed|PutSuccessful/\n else\n id\n end\n end", "def get_cached_data(uri)\n Rails.cache.fetch(uri, {expires_in: 24.hours, raw: true}) { JSON.parse(RestClient::Resource.new(uri).get) }\n end", "def store!\n # Upload the file\n prefix = \"#{Time.now.strftime(\"%Y%m%d%H%M%S\")}\"\n fname = prefix+(@file.respond_to?(:original_filename) ? @file.original_filename : File.basename(@file))\n o = s3_bucket.objects[\"#{asset_path}#{fname}\"]\n o.write(Pathname.new(@file.path), {\n acl: :public_read,\n content_type: MIME::Types.type_for(@file.path).first.to_s\n })\n\n # Set the public_url attribute\n remote_url = o.public_url.to_s\n self.set(public_url: remote_url)\n self.this.update(public_url: remote_url)\n end", "def cache(resource, identifier, reload = false, &block)\n if CostAgent.cache_provider.nil?\n block.call\n else\n if (!reload && CostAgent.cache_provider.exists?(self.subdomain, resource, identifier))\n CostAgent.cache_provider.get(self.subdomain, resource, identifier)\n else\n CostAgent.cache_provider.set(self.subdomain, resource, identifier, block.call)\n end\n end\n end", "def save\n if self.configurations[:feed_cache].nil?\n # The cache is disabled for this feed, do nothing.\n return\n end\n if self.feed_data.blank? && self.http_headers.blank?\n # There's no data, nothing to save.\n return\n end\n if self.http_headers['content-type'] =~ /text\\/html/ ||\n self.http_headers['content-type'] =~ /application\\/xhtml\\+xml/\n if self.title.nil? && self.link.nil? && self.entries.blank?\n # Don't save html pages to the cache, it messes with\n # autodiscovery.\n return\n end\n end\n unless self.href =~ /^file:\\/\\//\n if FeedTools.feed_cache.nil?\n raise \"Caching is currently disabled. Cannot save to cache.\"\n elsif self.href.nil?\n raise \"The url field must be set to save to the cache.\"\n elsif self.cache_object.nil?\n raise \"The cache_object is currently nil. Cannot save to cache.\"\n else\n self.cache_object.href = self.href\n unless self.feed_data.nil?\n self.cache_object.title = self.title\n self.cache_object.link = self.link\n self.cache_object.feed_data = self.feed_data\n self.cache_object.feed_data_type = self.feed_data_type.to_s\n end\n self.cache_object.http_headers = self.http_headers.to_yaml\n self.cache_object.last_retrieved = self.last_retrieved\n Thread.pass\n self.cache_object.save\n end\n end\n end", "def put(name,&block)\n build_resource(name, :put, &block)\n end", "def set_uri\n self.uri ||= \"#{DEFAULT_BUCKET_NAME}/#{DEFAULT_PREFIX_BASE}/#{storable.key_prefix}/#{key}\"\n end", "def reload\n self.replace( CouchDB.get( uri ) )\n end", "def set(data_path)\n data = dup\n data.data_path = data_path\n data\n end", "def run\n\t\treq = Net::HTTP::Put.new(uri.path)\n\t\treq.body = query_string\n\t\tres = Net::HTTP.start(url.host, url.port) { |http|\n\t\t http.request(req)\n\t\t}\n\t\tres.body\n\tend", "def cache_set(key, data, from_now = nil)\n _expire = from_now ? from_now.minutes.from_now : nil\n cache_write(key, [data, _expire])\n Merb.logger.info(\"cache: set (#{key})\")\n true\n end", "def save(data=cached_data)\n lock do\n File.safe_write(path, JSON.pretty_generate(data))\n end\n end", "def put(url, data, headers = {})\n request(:put, url, headers, :data => data)\n end", "def put(url, data, headers = {})\n request(:put, url, headers, :data => data)\n end", "def set_cache\n cache_key = self.class.cache_key(self.key)\n Rails.cache.write(cache_key, self.actual_value)\n end", "def save(data)\n\t\t\tredis.sadd(key, data)\n\t\tend", "def put(data = nil, options = nil)\n options ||= {}\n options[:method] = :put\n call data, options\n end", "def put(request_uri, data = nil)\n url = base_uri + request_uri\n logger.debug(\"PUT #{url}\")\n\n uri = URI.parse(url)\n\n response = http_request(:put, uri, data)\n\n parse_body(response)\n end", "def fire_put(url_or_path, entity, options = {}, &block)\n url = absolute_url(url_or_path)\n headers = {:Accept => MEDIA_TYPE_JSON, :'Content-type' => ENCODED_MEDIA_TYPE_JSON}.\n merge(options.fetch(:headers, {}))\n headers = merge_log_weasel_header(headers)\n timeout = options.fetch(:timeout, Ladon.default_request_timeout)\n body = encode_entity(entity)\n response = Typhoeus::Request.put(url, headers: headers, timeout: timeout, body: body)\n handle_response(response, method: :put, url: url, default_data: options[:default_data],\n raise_on_error: options[:raise_on_error], &block)\n end", "def sync\n #debug 'content sync'\n # We're safe not testing for the 'source' if there's no 'should'\n # because we wouldn't have gotten this far if there weren't at least\n # one valid value somewhere.\n @resource.write(:content)\n end", "def update_file(uri, data, etag = Box.new)\n node = @tree.node_for_path(uri)\n\n # It is possible for an event handler to modify the content of the\n # body, before it gets written. If this is the case, modified\n # should be set to true.\n #\n # If modified is true, we must not send back an ETag.\n modified = Box.new(false)\n data = Box.new(data)\n\n return false unless emit('beforeWriteContent', [uri, node, data, modified])\n\n etag.value = node.put(data.value)\n etag.value = nil if modified.value\n\n emit('afterWriteContent', [uri, node])\n\n true\n end", "def setup_remote\n if(@cache_file)\n begin\n @cf = File.open(@cache_file, 'w+')\n rescue\n @cf = nil\n end\n end\n @uri = URI.parse(@path)\n @con = Net::HTTP.new(@uri.host, @uri.port)\n @call_path = @uri.path + (@uri.query ? \"?#{@uri.query}\" : '')\n res = @con.request_get(@call_path)\n @heads = res.to_hash\n res.value\n @store = nil\n @redefine_prefix = 'remote'\n end", "def cache(named_key, object)\n @mutex.synchronize {\n self[named_key] = object\n } \n end", "def put(data, opts={})\n self.fd.put(data, opts={})\n end", "def update!(**args)\n @resource_name = args[:resource_name] if args.key?(:resource_name)\n @uri = args[:uri] if args.key?(:uri)\n end", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def cache_set(ck, obj)\n @cache_store.set(ck, obj, @cache_ttl)\n end", "def handle_put_request\n @request.records.each do |record|\n file = DataFile.storing(@request.uuid, record.time)\n file << record\n file.close\n end\n\n send_data [@request.record_count].pack('L')\n end", "def publishResourceAdd(app_id, run_id, resource)\n # Cache\n cache = RoomPlacesCachePublish.get_cache(app_id, run_id)\n\n cache.resources_add([resource])\n\t#nutella.net.publish('location/resources/added', {:resources => [resource]})\nend", "def cache_store; end", "def cache_store; end", "def put\n RestClient.put(url, @body, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end", "def sync_file_resource(resource, version)\n fetch_resource(resource, version) do |download_file|\n # move downloaded file to its place in data dir\n # ex: data/tenant1/automatortype/chef-solo/roles/cluster.json/1/cluster.json\n data_file = %W(#{@datadir} #{resource} #{version} #{resource.split('/')[-1]}).join('/')\n log.debug \"storing fetched file #{download_file} into data dir: #{data_file}\"\n # set file permissions if specified\n if @resourcespec.resource_permissions.key?(resource) && !@resourcespec.resource_permissions[resource].nil?\n log.debug \"setting file permissions #{@resourcespec.resource_permissions[resource]}\"\n octal_mode = @resourcespec.resource_permissions[resource].to_i(8)\n FileUtils.chmod octal_mode, download_file\n end\n FileUtils.mkdir_p(File.dirname(data_file))\n FileUtils.mv(download_file, data_file)\n end\n end", "def store_resource(resource)\n @@resources[resource.name.to_sym] = resource\n resource\n end", "def put(path, data, headers = { })\n path = \"/#{path}\" unless path.start_with?('/')\n request = Net::HTTP::Put.new(path, headers)\n process_put_and_post_requests(request, data)\n end", "def data_cache(fpath)\n (@data_caches ||= []) << fpath\n return fpath\n end", "def cache\n if self.cache_store\n self.cache_store\n else\n self.cache_store = :file_store, root.join(\"tmp\").to_s\n self.cache_store\n end\n end", "def set(key, value)\n path = File.join(@root, \"#{key}.cache\")\n\n # Ensure directory exists\n FileUtils.mkdir_p File.dirname(path)\n\n # Check if cache exists before writing\n exists = File.exist?(path)\n\n # Serialize value\n marshaled = Marshal.dump(value)\n\n # Compress if larger than 4KB\n if marshaled.bytesize > 4 * 1024\n deflater = Zlib::Deflate.new(\n Zlib::BEST_COMPRESSION,\n Zlib::MAX_WBITS,\n Zlib::MAX_MEM_LEVEL,\n Zlib::DEFAULT_STRATEGY\n )\n deflater << marshaled\n raw = deflater.finish\n else\n raw = marshaled\n end\n\n # Write data\n PathUtils.atomic_write(path) do |f|\n f.write(raw)\n @size = size + f.size unless exists\n end\n\n # GC if necessary\n gc! if size > @max_size\n\n value\n end", "def resource\n @resource ||= resource_set.createResource(uri)\n end" ]
[ "0.73367345", "0.6583097", "0.6364916", "0.6362433", "0.6337253", "0.6242172", "0.62378186", "0.62011737", "0.6126663", "0.6065884", "0.6065884", "0.6065884", "0.6065884", "0.59127784", "0.59109694", "0.59077907", "0.5884891", "0.5883963", "0.5842657", "0.5835551", "0.5835551", "0.5833977", "0.5814533", "0.58021176", "0.5796111", "0.5784224", "0.5762393", "0.57615465", "0.5759737", "0.5759737", "0.5744546", "0.5736807", "0.5711606", "0.57114744", "0.5709816", "0.5695941", "0.5691695", "0.5685587", "0.566338", "0.5655656", "0.563803", "0.5633098", "0.56322795", "0.5625953", "0.56238467", "0.5619337", "0.56092227", "0.5603558", "0.5603059", "0.55994326", "0.5597394", "0.5541522", "0.5533174", "0.5519459", "0.5517296", "0.5508068", "0.5489155", "0.54852074", "0.5479222", "0.5476537", "0.54651535", "0.54507846", "0.5450157", "0.54492176", "0.54464954", "0.54424006", "0.54340184", "0.54273105", "0.54269296", "0.54084814", "0.5402715", "0.5392417", "0.53767955", "0.53654826", "0.53654826", "0.5359181", "0.5344117", "0.53382087", "0.5334919", "0.5319975", "0.5314375", "0.53141266", "0.5311104", "0.5308977", "0.5305761", "0.53052694", "0.52978414", "0.529632", "0.52923197", "0.5288172", "0.5286323", "0.5286323", "0.5272653", "0.5270747", "0.52690953", "0.5244455", "0.5243971", "0.5241961", "0.5236324", "0.52341354" ]
0.6736703
1
Makes new cache path.
def prepare_cache_path cache = Tempfile.new("", Global.file_cache_directory) path = cache.path cache.close(true) return path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_cache_dir\n ::FileUtils.mkdir_p(@cache_dir) unless ::File.directory?(@cache_dir)\n end", "def populate_cache_path(container)\n cache_path.run_action(:create)\n\n r = Chef::Resource::File.new(::File.join(new_resource.cache_path, 'cid'), run_context)\n r.content(container.id)\n r.run_action(:create)\n end", "def cache_dir=(_arg0); end", "def generate_cache_directory\n @cache_cid = generate_cid\n FileUtils.mkdir_p(cache_path)\n FileUtils.chmod dir_permissions.to_i, cache_path\n end", "def create_cache_files\n @cache_path_names = {}\n each_file_set(:create_cache_file)\n write_cache_path_file\n end", "def cache_dir; end", "def cache_dir; end", "def makePath\n\t\t\tbuildMgr.effective(filename).dirname.mkpath\n\t\tend", "def cache_root\n dataroot.join('cache').tap { |p| p.mkpath unless p.exist? }\n end", "def cache_path\n File.join @path, 'cache.ri'\n end", "def ensure_cache_path(path)\n FileUtils.makedirs(path) unless ::File.exist?(path)\n end", "def cache_path(uri:, path:)\n return if File.exist?(path)\n\n WebMock.disable!\n development_config = Figgy.all_environment_config[\"development\"]\n client = ArchivesSpace::Client.new(\n ArchivesSpace::Configuration.new(\n base_uri: development_config[\"archivespace_url\"],\n username: development_config[\"archivespace_user\"],\n password: development_config[\"archivespace_password\"]\n )\n )\n client.login\n result = client.get(uri)\n FileUtils.mkdir_p(Pathname.new(path).dirname)\n File.open(path, \"w\") do |f|\n f.write(result.body)\n end\n WebMock.enable!\n end", "def ensure_cache_path(path)\n FileUtils.makedirs(path) unless File.exist?(path)\n end", "def cache_path\n @cache_path ||= File.join(\"\", \"gko\", \"cache\", \"#{self.host}\")\n end", "def write_cache(cache, path)\n if @use_cache then\n File.open path, \"wb\" do |cache_file|\n Marshal.dump cache, cache_file\n end\n end\n\n cache\n rescue Errno::EISDIR # HACK toplevel, replace with main\n cache\n end", "def cache_file_path\n File.join @homepath, 'cache'\n end", "def workdir\n result = base.join('cache')\n result.mkpath\n result\n end", "def store(from, path = nil)\n return unless @cache_base\n\n path ||= from\n clear path\n copy from, (@cache_base + path)\n end", "def create_cache_dir(sha)\n file_dir = File.join(@cache_dir, sha)\n @cache_dir_mutex.with_read_lock do\n # mkdir_p doesn't error if the file exists\n FileUtils.mkdir_p(file_dir, mode: 0o750)\n FileUtils.touch(file_dir)\n end\n file_dir\n end", "def cache_file_path\n raise IOError.new 'Write permission is required for cache directory' unless File.writable?(@args[:cache_directory])\n \"#{@args[:cache_directory]}/#{Digest::SHA1.hexdigest((@args[:cache_ref] || @path).to_s + size.to_s + last_modified.to_s)}.cache\"\n end", "def prepare_cache\n FileUtils.mkdir_p(File.join(sandbox_path, \"cache\"))\n end", "def create_cache(dir, hostname, cache)\n # Let's create the cache directory if it does exists.\n Dir.mkdir(dir) unless File.exist?(dir)\n\n # Create the file and fill it with the cache\n cachefilename = File.join(dir, \"#{hostname}.yml\")\n cachefile = File.new(cachefilename, 'w+')\n cachefile.write(cache)\n cachefile.close\nend", "def cache!( new_file )\n super\n @old_tmp_file = new_file\n end", "def cache_path\n Pathname.new(File.expand_path(File.join(ChefCLI::Helpers.package_home, \"cache\")))\n .join(\".cache\", \"git\", Digest::SHA1.hexdigest(uri))\n end", "def cache_path\n return @cache_resources unless @cache_resources.nil?\n\n @cache_resources = Chef::Resource::Directory.new(::File.join(new_resource.cache_path), run_context)\n @cache_resources.recursive(true)\n\n return @cache_resources\n end", "def cache!(new_file)\n super\n @old_tmp_file = new_file\n end", "def cache!(new_file)\n super\n @old_tmp_file = new_file\n end", "def mkpath\n @path.mkpath\n end", "def http_cache_path\n Dir.mktmpdir(\"bbs_exporter_http_cache\")\n end", "def newpath\n return path(newname)\n end", "def add(from, path = nil)\n return unless @cache_base\n\n path ||= from\n copy from, (@cache_base + path)\n end", "def cache(uri, obj)\n filename=cacheFileName(uri)\n print(\"Creating #{filename}\\n\")\n File.open(filename, 'w') {|f| f.write(obj) }\nend", "def redo_path\n self.path = @temp_path\n end", "def cache_path\n @cache_path ||= Pathname.new(Berkshelf.berkshelf_path).join('.cache', 'halite', dependency.name)\n end", "def cache_path\n Pathname.new(Berkshelf.berkshelf_path)\n .join('.cache', 'hg', Digest::SHA1.hexdigest(uri))\n end", "def cache\n if self.cache_store\n self.cache_store\n else\n self.cache_store = :file_store, root.join(\"tmp\").to_s\n self.cache_store\n end\n end", "def symlink(guest_path, bucket_path = \"/tmp/vagrant-cache/#{@name}\")\n return if @env[:cache_dirs].include?(guest_path)\n\n @env[:cache_dirs] << guest_path\n comm.execute(\"mkdir -p #{bucket_path}\")\n unless symlink?(guest_path)\n comm.sudo(\"mkdir -p `dirname #{guest_path}`\")\n if empty_dir?(bucket_path) && !empty_dir?(guest_path)\n # Warm up cache with guest machine data\n comm.sudo(\"shopt -s dotglob && mv #{guest_path}/* #{bucket_path}\")\n end\n comm.sudo(\"rm -rf #{guest_path}\")\n comm.sudo(\"ln -s #{bucket_path} #{guest_path}\")\n end\n end", "def cacheFileName(ni)\n @directory_name + \"/\" + ni.path\nend", "def _path_new\n @_path_new ||= \"#{_name}/#{Time.now.strftime('%FT%T')}\"\n end", "def force(path)\n cache[path] = true\n end", "def reserve\n FileUtils.touch(self.cache_dir + self.local_filename)\n end", "def regenerate_path!\n regenerate_path\n save\n end", "def acl_cache_path\n @acl_cache_path ||= if Smith.config.agency._has_key?(:acl_cache_path)\n Pathname.new(Smith.config.agency.acl_cache_path).tap { |path| check_path(path) }\n else\n cache_dir = Pathname.new(ENV['HOME']).join('.smith').join('acl')\n if cache_dir.exist?\n cache_dir\n else\n FileUtils.mkdir_p(cache_dir)\n cache_dir\n end\n end\n end", "def cache(input_path, output_path, data=nil)\n path = input_path\n @new_hashes[input_path] = hash(@input_directory, input_path)\n\n if data\n @data[path] = data if data\n @wildcard_dependencies[path] = data[:wildcard_dependencies] if data[:wildcard_dependencies]\n @dependencies[path] = data[:dependencies] if data[:dependencies]\n end\n\n FileUtils.mkdir_p(File.dirname(cached_path_for(path)))\n\n if File.exist? File.join(@output_directory, output_path)\n FileUtils.cp(File.join(@output_directory, output_path), cached_path_for(path))\n else\n FileUtils.cp(File.join(@input_directory, input_path), cached_path_for(input_path))\n end\n end", "def put(src, uri)\n # prepare cache path\n path = prepare_cache_path\n\n # move the file from the working directory to cache\n FileUtils.mv(src, path)\n\n # make a symbolic link from original location to the cache\n FileUtils.symlink(path, src)\n\n # copy from cache to the resource file\n @table[uri.to_s] = path\n Resource[uri].link_from(path)\n end", "def cache_dir\n @cache_dir ||= File.join base_dir, \"cache\"\n end", "def caching\n @caching = \"data_update[#{data_path}]\"\n end", "def caching\n @caching = \"data_update[#{data_path}]\"\n end", "def caching\n @caching = \"data_update[#{data_path}]\"\n end", "def caching\n @caching = \"data_update[#{data_path}]\"\n end", "def mkpath path\n end", "def cache_directory\n File.join(CacheFolder, make_md5(@source))\n end", "def cache_resource( path )\n resource_hash = compute_hash(path)\n return true if find_resource(resource_hash)\n\n copy_resource(resource_hash, path)\n end", "def cache_skeleton(name)\n repo = config.skeletons[name] or return\n\n path = cache_path(name)\n return path if directory_with_files?(path)\n\n mkdir_p fx(path, '..')\n\n git_clone repo, path\n\n if $?.to_i != 0\n rm_rf path\n return nil\n end\n\n rm_rf File.join(path, '.git')\n\n path\n end", "def cache config, name, path\n require 'fileutils'\n require 'pathname'\n name = name.to_s\n local = File.join(File.expand_path('~/.vagrant.d/cache'), config.vm.box, name)\n FileUtils.mkdir_p local\n config.vm.synced_folder local, path\nend", "def cache config, name, path\n require 'fileutils'\n require 'pathname'\n name = name.to_s\n local = File.join(File.expand_path('~/.vagrant.d/cache'), config.vm.box, name)\n FileUtils.mkdir_p local\n config.vm.synced_folder local, path\nend", "def cache_dir\n \"/tmp/cache/#{model.class.to_s.underscore}\"\n end", "def set_cache(value); end", "def set_cache(value); end", "def cache_file(file)\n FileUtils.cp(file, path)\n end", "def regenerate_path\n self.current_path = self.path\n page.reload #forcing that do not take cached page object\n slug = nil if slug.blank?\n new_path = prepare_new_path\n \n self.previous_path = self.current_path\n write_attribute(:path, new_path)\n end", "def cache_set(key, data, from_now = nil)\n cache_file = @config[:cache_directory] / \"#{key}.cache\"\n cache_directory = File.dirname(cache_file)\n FileUtils.mkdir_p(cache_directory)\n _expire = from_now ? from_now.minutes.from_now : nil\n cache_write(cache_file, Marshal.dump([data, _expire]))\n Merb.logger.info(\"cache: set (#{key})\")\n true\n end", "def move_to_cache\n true\n end", "def move_to_cache\n true\n end", "def move_to_cache\n true\n end", "def cache_dir(arg=nil)\n set_or_return(\n :cache_dir,\n arg,\n :kind_of => [ String ]\n )\n end", "def build_path\n \"#{Chef::Config['file_cache_path']}/nginx-#{new_resource.version}\"\n end", "def local_cache_dir=(dir_path)\n @local_cache_dir = File.expand_path(dir_path)\n @relative_local_path = \"#{@href_path}#{@filename}\"\n @local_path = \"#{@local_cache_dir}/#{@relative_local_path}\"\n end", "def initialize_root\n Utils.create_directory(@cache_root)\n Utils.clear_directory(@cache_root)\n end", "def local_cache(basebox_name)\n cache_dir = Vagrant::Environment.new.home_path.join('cache', 'apt', basebox_name)\n # Vagrant::Environment.new.home_path\n print cache_dir\n cache_dir.mkpath unless cache_dir.exist?\n partial_dir = cache_dir.join('partial')\n partial_dir.mkdir unless partial_dir.exist?\n cache_dir\nend", "def move_to_cache\r\n true\r\n end", "def cache; end", "def cache; end", "def cache; end", "def cache; end", "def cache; end", "def cache; end", "def cache; end", "def base\n result = sphere.cache_path.join('chef')\n result.mkpath\n result\n end", "def set_path\n self.path = File.join(self.store_dir, self.filename)\n end", "def cache\n store = Moneta.new :File, dir: 'moneta'\n Cachy.cache_store = store\n Cachy\n end", "def create_cache_file(controller=:_all,action=:_all)\n files = paths_for(controller,action).uniq\n path_name = cache_path_name(controller,action)\n \n # if we already have the file, we can just skip this step\n if File.exists?(path_name)\n puts \"Skipped creating/updating #{controller}::#{action} (Nothing changed)\" if RAILS_ENV == \"development\"\n return path_name\n end\n \n cache_content = \"\"\n # otherwise, we create the file\n files.each do |f|\n if File.exists?(f)\n cache_content += File.new(f).read\n else\n # TODO: add some debug info for when an included file doesn't exist\n end\n end\n # write out the content\n File.open(path_name,\"w\") do |f|\n f.write(cache_content)\n end\n \n # if we have a minifier, use it\n @minifier.minify!(path_name) if @minifier\n \n puts \"\\nCreated #{path_name} \"\n puts \"with \\n\\t #{files.join(\"\\n\\t\")}\\n\" if RAILS_ENV == \"development\"\n path_name\n end", "def configure_cache; end", "def mkpath(path)\n FileUtils.mkpath\n end", "def set_realpath\n return super if Node.source.eql?(:node) || persisted?\n\n # binding.pry\n path_n = Pathname.new(path)\n path_n.mkdir unless path_n.exist?\n super\n end", "def cache_dir\n '/var/cache'\n end", "def cache_dir\n '/var/cache'\n end", "def path_to(key)\n key = key.gsub(/[<>:\\\\|?*%]/) {|c| \"%%%03d\" % c.ord}\n File.join(cache_location, key)\n end", "def store_cachefile(cache_filename, template)\n s = template.script\n s = \"\\#@ARGS #{template.args.join(',')}\\n#{s}\" if template.args\n tmp_filename = \"#{cache_filename}.#{rand()}\"\n File.open(tmp_filename, 'w') {|f| f.write(s) }\n File.rename(tmp_filename, cache_filename)\n end", "def cache_filename_for_uri( path )\n uid = Digest::MD5.hexdigest( \"#{@uid}:#{path}\" )\n # NOTE: this path needs to exist with r/w permissions for webserver\n @cache_dir.join( uid )\n end", "def validate_and_make_cache(dir)\n dir = Pathutil.new(dir)\n raise RelativeCacheDir unless dir.absolute?\n dir.tap(&:mkdir_p)\n end", "def cache(new_cache = nil)\n @cache = new_cache if new_cache\n @cache\n end", "def add(value)\n ensure_cache_path_created\n FileUtils.touch(File.join(cache_path, value))\n end", "def update_cache\n Rails.logger.debug \"Updating cache for... #{@@cache_file}\"\n fp = File.new(@@cache_file, 'w')\n if fp\n # acquire an exclusive lock (writer)\n if fp.flock(File::LOCK_EX)\n content = open(@@file_path).read\n \n if content\n #logger.debug \"Generate cache file: #{@@cache_file}\"\n fp.write(content) # writes to the file\n end\n \n fp.flock(File::LOCK_UN) # release a lock\n end\n fp.close\n end\n end", "def move_to_cache\n true\n end", "def initialize_file_based_cache\n Dir.mkdir(\"cache\")\n @document_cache = ActiveSupport::Cache::FileStore.new(\"cache\")\n @file_based_cache = true\n end", "def writable_file\n @cache_file\n end", "def copy_over_cache_files\n FileUtils.cp_r \"#{@cache}/.\", @path\n end", "def cache_dir\n Padrino.root(\"tmp\")\n end", "def cache_dir\n Padrino.root(\"tmp\")\n end" ]
[ "0.69791275", "0.6952284", "0.67630917", "0.67209595", "0.67001855", "0.66851884", "0.66851884", "0.6662241", "0.6647477", "0.6638841", "0.6602987", "0.6594684", "0.6590354", "0.6540276", "0.6479168", "0.64747745", "0.64726007", "0.64538646", "0.6434149", "0.6384997", "0.63540906", "0.63362056", "0.63074327", "0.6305486", "0.62748176", "0.62568104", "0.62568104", "0.62539804", "0.6253456", "0.62492365", "0.6229986", "0.62207276", "0.62145805", "0.620353", "0.6180675", "0.61673194", "0.6159352", "0.6146905", "0.6134064", "0.6128216", "0.61015654", "0.6098261", "0.6054238", "0.602187", "0.60214585", "0.59976226", "0.5955204", "0.5955204", "0.5955204", "0.5955204", "0.5935573", "0.5932408", "0.59317386", "0.59075665", "0.5904408", "0.5904408", "0.59012216", "0.5888203", "0.5888203", "0.58697784", "0.5861477", "0.5854979", "0.584702", "0.584702", "0.584702", "0.58388853", "0.5825913", "0.5825107", "0.5824205", "0.58216953", "0.58141404", "0.5810058", "0.5810058", "0.5810058", "0.5810058", "0.5810058", "0.5810058", "0.5810058", "0.5791292", "0.5791266", "0.5777248", "0.57740486", "0.5768398", "0.57651085", "0.5765087", "0.5755883", "0.5755883", "0.57506704", "0.5742005", "0.5722433", "0.57221884", "0.5720539", "0.5706634", "0.57029724", "0.56986934", "0.5696325", "0.56894135", "0.56788456", "0.56731164", "0.56731164" ]
0.63383937
21
If two numbers in the argument array have the same number of digits, return the first one in the array. MY SOLUTION
def find_longest(arr) arr.max_by { |x| x.to_s.length } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def double_to_single_method(multiplied_integer_array)\n single_digit_array = []\n multiplied_integer_array.each do |value|\n if value > 9\n value = value - 9\n single_digit_array << value\n else\n value = value\n single_digit_array << value\n end\n end\n return single_digit_array\nend", "def selection(array)\n # If array is empty, just return 01\n return 1 if array.empty?\n\n # Array to store the numbers already taken\n taken = Array.new\n\n # Filter the incoming array, find the numbers and store them in the taken Array\n array.each { |string| taken << string.scan(/\\d./).join('').sub(/^0+/, '').to_i }\n\n # We have two digits, define our range of numbers\n limits = (1..99).to_a\n\n # Return the first value once we find what isn't taken in our range of numbers\n (limits - taken)[0]\n end", "def double_to_single_method\n #single_digit_array = []\n @multiplied_integer_array.each do |value|\n if value > 9\n value = value - 9\n @single_digit_array << value\n else\n value = value\n @single_digit_array << value\n end\n end\n return @single_digit_array\n end", "def single_number2(nums)\n nums.sort!\n \n i = 0\n length = nums.length\n \n while i < length\n if nums[i] != nums[i+1]\n return nums[i]\n end\n i += 2\n end \nend", "def up_array(arr)\n return nil if arr.length < 1\n condition = true\n arr.each { |i| condition = false if ( (i < 0) || (i > 9) || (i.class == Float) ) }\n return (arr.join.to_i + 1).to_s.chars.map {|i| i.to_i} if condition == true\nend", "def single_number(nums)\n\tnums.sort!\n\tn = nums.size - 1\n\ti = 0\n\twhile (i <= n)\n\t\tif nums[i] == nums[i+1]\n\t\t\ti+= 3\n\t\telse\n\t\t\treturn nums[i]\n\t\tend\n\tend\n\treturn 0\nend", "def first_two(arr, target)\n cache = []\n arr.each_with_index do |x, idx|\n cache[idx] = x\n other_number = (target / x)\n if other_number.is_a?(Integer)\n if cache.detect { |y| y == other_number }\n return [other_number, x]\n end\n end\n end\n print \"There are no two numbers that multiply to ##{target}\"\nend", "def repeated_digit number\n raise \"Wrong type of argument\" if !number.is_a? Numeric\n # array = number.to_s.split(\"\").map(&:to_i)\n # array.count{ |item| item != array.first} == 0\n\n # number.to_s.squeeze.length == 1\n\n number.to_s.chars.uniq.length == 1\nend", "def double_it(number)\n array = number.to_s.split('')\n if array.size.odd?\n number * 2\n else\n half_index = array.size / 2\n if array[0...half_index] == array[half_index..-1]\n number\n else\n number * 2\n end\n end\nend", "def find_dup(arr)\n dup = nil\n single_num = []\n arr.each do |num|\n if single_num.include?(num)\n dup = num\n else\n single_num << num\n end\n end\n dup\nend", "def single_number(nums)\n\nend", "def find_lonely_num(array_of_numbers)\n a = Hash.new(0)\n array_of_numbers.each do |elem|\n a[elem]+=1\n end\n a.key(1)\nend", "def same_digits?(a, b)\n return a != b &&\n a.to_s.split(/(?=.)/).sort == b.to_s.split(/(?=.)/).sort\nend", "def double_num?(number)\n num_arr = number.digits.reverse\n midpoint = (num_arr.size / 2.0).ceil\n num_arr[0, midpoint] == num_arr[midpoint, num_arr.size - midpoint]\nend", "def first(numbers, int)\n numbers.first(int)\nend", "def unused_digits *integer_array\n remaining_nums = Array(0..9) - integer_array.flatten.join.scan(/\\d/).sort.map(&:to_i)\n remaining_nums.join.to_s\nend", "def single_number(nums)\n 2 * nums.uniq.reduce(:+) - nums.reduce(:+)\nend", "def triple_double(num1,num2)\n n = num1.digits.each_cons(3).select { |i| p i[0] == i[1] && i[0] == i[2] }\n n.any? && num2.to_s.include?(n[0][1..-1].join) ? 1 : 0\nend", "def unused_digits(*a)\n numbers = [*a].join.split(\"\")\n digits_left = (0..9).to_a\n\n digits_left.length.times do |num|\n if numbers.include?(num.to_s) == true\n digits_left.delete(num)\n end\n end\n\n return digits_left.join\n\nend", "def double?(int)\n array = int.to_s.chars\n first = []\n last = []\n if array.size.odd?\n false\n else\n loop do\n break if array.empty?\n first << array.shift\n last << array.pop\n end\n first == last.reverse ? true : false\n end\n \nend", "def get_nums_built_in(array2)\n array2.select { |el| el.is_a? Numeric }\nend", "def up_array(arr)\n\n\treturn nil if arr.empty? == true\n\tarr.each do |number|\n\t\treturn nil if number < 0 == true || number > 9 == true\n\tend\n\tnum = arr.join.to_i + 1\n\tnum.to_s.split(//).map(&:to_i)\nend", "def solution(a)\n number = a.to_s.chars\n first_arrays = []\n (number.length/2).times do\n first_arrays << number.shift\n first_arrays << number.rotate(number.length-1).shift\n number.pop\n end\n ( first_arrays + number ).join(\"\").to_i\nend", "def num(x,y)\n if x > 0 && y > 0\n return x.digits.first == y.digits.first\n else\n puts \"invalid\"\n end\nend", "def plus_one(digits)\n\n #recognize the last digit of the array\n if digits.last != 9\n digits[-1] = digits[-1] + 1 # increment the last number\n return digits\n else\n # check if the number is a 9, carry the 1 accordingly\n puts \"before iterating: #{digits}\"\n i = digits.size-1\n\n #iterate through the array in reverse\n while i >= 0\n puts \"value: #{digits[i]} (at index[#{i}])\"\n # increment last digit (and relevant digits) in reverse\n puts\"#{digits[i] = is_it_nine(digits[i])}\"\n if digits[i] != 0 # recognize when to stop updating digits\n return digits\n end\n if digits[0] == 0 # if the 1st value = 9, add a new digit\n digits.insert(0,1)\n end \n i -= 1\n end\n return digits\n # for i in 0..digits.size-1 do\n # puts \"value: #{digits[i]} (at index [#{i}])\"\n # digits[-i] = is_it_nine(digits[-i]) \n # puts \"after function: value: #{digits[i]} (at index [#{i}])\" \n # # if the first value is a 9, add a new element to the array \n # # if digits[0] == 0\n # # digits.insert(0,1)\n # # end \n \n # end\n\n # puts \"before iterating: #{digits}\"\n # digits.reverse.each_with_index{|val, index|\n # puts \"#{digits.reverse}\"\n # puts \"value: #{val} at index[#{index}]\"\n # puts\"#{digits[index] = is_it_nine(val)}\"\n\n # if digits[index] != 0 # recognize \n # return digits\n # end\n # }\n # return digits\n\n end\n\n \n\nend", "def find_single(arr)\n upper = arr.length\n m = upper / 2\n ol = arr.length\n lower = 0\n\n while true\n return m if m + 1 == ol || m == 0\n\n left_same = arr[m] == arr[m - 1]\n right_same = arr[m] == arr[m + 1]\n\n return m unless left_same || right_same\n\n if (m.even? && left_same) || (m.odd? && right_same)\n upper = m\n m = (m - lower) / 2 + lower\n else\n lower = m\n m = m + (upper - m) / 2\n end\n end\nend", "def PairSearching(num)\n digits = num.to_s.split(//).map(&:to_i)\n number_of_mult, cpy_num = 0, num\n loop do\n cpy_num = (cpy_num * cpy_num.to_s.split(//).map(&:to_i).sample)\n digits << cpy_num.to_s.split(//).map(&:to_i)\n digits.flatten!\n number_of_mult += 1\n break if adjecent_digits?(digits)\n end\n digits\n number_of_mult\nend", "def triple_double(num1,num2)\n numbers = num1.to_s.scan(/(\\d)\\1\\1/)\n return 0 if numbers.empty?\n numbers.flatten!.map! { |i| num2.to_s.scan(/#{i}{2}/) }\n numbers.flatten.empty? ? 0 : 1\nend", "def find_numbers(nums)\n return nums.select{ |x| x.digits.length.even? }.length\nend", "def double_every_other\r\n @number_array = @number.split(//)\r\n @double_array = @number_array.collect.with_index { |digit, index| index.even? ? digit.to_i * 2 : digit }\r\n @double_array.map! { |term| term.to_s.split(//)}.flatten!\r\n end", "def twice(number)\n stringed_num = number.to_s\n twice = number * 2\n middle = stringed_num.size / 2\n return twice if stringed_num.size.odd?\n return number if stringed_num[0, middle] == stringed_num[middle, middle]\n twice\nend", "def first_in_array(number)\n high = @size - 1\n low = 0\n result = -1\n\n while low <= high\n mid = (low + high) / 2\n # puts \"low #{low}, high #{high}, mid#{mid}\"\n if number == @array[mid]\n result = mid\n high = mid - 1\n elsif number < @array[mid]\n high = mid - 1\n else\n low = mid + 1\n end\n end\n\n result\n end", "def all_digits_are_the_same?(digits)\n digits.uniq.length == 1\nend", "def plus_one(a)\n return nil if a.empty?\n i = a.length - 1\n while i >= 0\n if a[i] < 9 \n a[i] = a[i] + 1 \n return a\n else\n # case 199, 49\n a[i] = 0\n i -= 1\n end\n end\n # for case 999\n result = Array.new(a.length, 0)\n result.unshift(1)\nend", "def duplicate_number(array)\n raise ArgumentError, 'Parameter must be an array' unless array.is_a? Array\n raise ArgumentError, 'Parameter must be an array of integers' unless array.all? {|i| i.is_a?(Integer) }\n\n array.detect{ |number| array.count(number) > 1 }\nend", "def first_even(array_of_numbers)\n even_number_array = []\n array_of_numbers.each do |num| \n if num % 2 == 0\n even_number_array << num\n end\n end\n even_number_array[0]\nend", "def substract_9_if_necessary(array)\n return array.map do |digit|\n if digit > 9\n digit - 9\n else\n digit\n end\n end\n end", "def plus_one(digits)\n cur = digits.count - 1\n while cur >= 0\n digits = add_one(digits, cur)\n break if digits[cur] != 0\n cur -= 1\n end\n digits.first == 0 ? [1] + digits : digits\nend", "def remove_common_digit( a, b )\n\txa = a.divmod( 10 )\n\txb = b.divmod( 10 )\n\n\treturn -1,-1 if xa[ 1 ] == xb[ 1 ] && xa[ 1 ] == 0\n\n\treturn xa[ 1 ],xb[ 1 ] if xa[ 0 ] == xb[ 0 ]\n\treturn xa[ 1 ],xb[ 0 ] if xa[ 0 ] == xb[ 1 ]\n\treturn xa[ 0 ],xb[ 1 ] if xa[ 1 ] == xb[ 0 ]\n\treturn xa[ 0 ],xb[ 0 ] if xa[ 1 ] == xb[ 1 ]\n\treturn -1,-1\nend", "def double_number?(num)\narr = num.to_s.split('')\n\tif arr.size.even?\n\t\tavg = arr.size / 2\n\t\tarr[0, avg] == arr[avg, avg]\n\telse\n\t\tfalse\nend\nend", "def all_same_digits?(number)\n ary_of_chars = number.to_s.chars\n ary_of_chars.all? { |digit| digit == ary_of_chars[0] }\n end", "def offbyonenumber(my_number, bash_numbers)\n\tcounter = 0\n\tx = 0\n\tarr1 = []\n\tmy_number.each do |num|\n\t\tbash_numbers.each do |bash|\n\t\t\tnum.length.times do\n\t\t\t\tif bash[x] == num[x]\n\t\t\t\t\t\tcounter += 1\n\t\t\t\t\tif counter == num.length - 1\n\t\t\t\t\t\tarr1<< num\n\t\t\t\t\t\tcounter = 0\n\t\t\t\t\tend\t\n\t\t\t\tend\n\t\t\t\tx += 1\n\t\t\tend\n\t\tend\n\tend\n\tarr1.uniq!\n\tp arr1\n\treturn arr1\nend", "def up_array(arr)\n return nil if arr.length < 0 || arr.any? { |i| i > 9 || i < 0 }\n (arr.join.to_i + 1).to_s.split('').map(&:to_i)\nend", "def twice(num)\n middle_idx = num.to_s.length / 2\n if num.to_s[0, middle_idx] == num.to_s[middle_idx..-1]\n num\n else\n num * 2\n end\nend", "def solve(arr)\n answer = \"Every num has a match.\"\n arr.each do |num|\n if !arr.include?(num * -1)\n answer = num\n end\n end\n answer\nend", "def twice num\n num_size = num.to_s.size\n return num * 2 if num_size.odd?\n center = num_size / 2\n left = num.to_s[0, center]\n right = num.to_s[center, num_size]\n left == right ? num : num * 2\nend", "def all_else_equal(arr)\n \ttot = 0\n \tarr.each do |num|\n tot +=num\n end\n \tmid = tot / 2\n \tarr.each do |num|\n if mid == num\n return num\n end\n end\n return nil\n end", "def check_array(nums)\n if(nums.length >= 2)\n\t\treturn (nums[0] + nums[1])\n\tend\n\tif(nums.length == 1)\n\t\treturn nums[0];\n\tend\n\treturn 0;\n\nend", "def match_array(array)\n matching_array = []\n\n array.each_with_index do |num, i|\n if num == array[i + 1]\n matching_array << num\n end\n end\n\n matching_array\nend", "def find_missing_number(array_one, array_two)\nend", "def TripleDouble(num1,num2)\n arr_num1 = num1.to_s.split(//).map(&:to_i)\n arr_num2 = num2.to_s.split(//).map(&:to_i)\n first_number_valid?(arr_num1) && second_number_valid?(arr_num2) ? 1 : 0\nend", "def compare_num\r\n subtracted = []\r\n\r\n double_digits.each_with_index do |val, index|\r\n if val >= 10\r\n subtracted << val - 9\r\n else\r\n subtracted << val\r\n end\r\n end\r\n subtracted\r\n end", "def twice(number)\n check_number = number.to_s\n mid_point = (check_number.size / 2)\n if check_number.size.odd?\n number * 2\n else\n first_half = check_number[0..(mid_point - 1)]\n second_half = check_number[mid_point..-1]\n if first_half == second_half\n number\n else\n number * 2\n end\n end\nend", "def find_missing_number(array_one, array_two)\n\nend", "def featured(i) # found digits method but only works > v2.4 so...\n i = i - i % 7\n loop do\n i += 7\n list = []\n x = i\n while x > 0 do\n list.unshift(x % 10)\n x /= 10\n end\n if list.length > 9; return \"There is no possible number that fulfills those requirements\" end\n if list == list.uniq; break end\n end \n i\nend", "def single_number(nums)\n uniques = []\n nums.each do |num|\n uniques.include?(num) ? uniques.delete(num) : uniques << num\n end\n uniques\nend", "def double_number?(num)\n str_num = num.to_s\n middle_index = (str_num.size - 1) / 2\n str_num.size.even? && str_num[0..middle_index] == str_num[(middle_index + 1)..-1]\nend", "def off_one(ticket,winners)\r\n\toff_by_one = []\r\n\tstrings = []\r\n\tour_num = ticket.split(\"\")\r\n\t#taking each element in winning numbers, splitting them individually\r\n\t#pushing them into array called strings to create multidimensional array\r\n\twinners.each do |n|\r\n\t\tstrings << n.split(\"\")\r\n\tend\r\n\t#iterates through each subarray using 2 loops\r\n\t#uses 2 counters, count to iterate through the subarray indices\r\n\t#matches to keep track of digits that match between our number and the winning\r\n\t#number that we are currently iterating through\r\n\tstrings.each do |num|\r\n\t\tmatches = 0\r\n\t\tcount = 0\r\n\r\n\t\tnum.each do |n|\r\n\t\t\t\r\n\t\t\tif n == our_num[count]\r\n\t\t\t\tmatches += 1\r\n\t\t\tend\r\n\t\t\tcount += 1\r\n\t\tend\r\n\t\t#if our num length minus matches = 1, we know its off by one\r\n\t\t#so we rejoin it and push it into the array\r\n\t\tif num.length - matches == 1\r\n\t\t\toff_by_one.push(num.join)\r\n\t\tend\r\n\tend\r\n\tif off_by_one.length > 0\r\n\t\toff_by_one\r\n\telse\r\n\t\t'Nothing off by one'\r\n\tend\r\nend", "def check_renban num\n arr = num.abs\n .to_s\n .chars\n .map{|x| x.to_i}\n .sort\n arr == (arr[0]..arr[0] + arr.length - 1).to_a\nend", "def interesting_number(number)\n return false if number.to_s.split(\"\").length < 3 \n number.to_s.split(\"\").sort[0] == \"0\" ? number.to_s.split(\"\").delete_at(0) && number.to_s.split(\"\").push(\"0\") : x = x\n return number.to_s.split(\"\")[0] < number.to_s.split(\"\")[-1] ? number.to_s.split(\"\").sort == number.to_s.split(\"\") || false : number.to_s.split(\"\").sort.reverse == number.to_s.split(\"\") || false\nend", "def strip_common_digits(num, den)\n # Rejct the trivial examples\n return nil, nil if num % 10 == 0 || den % 10 == 0\n\n a = num.to_s.split('').sort\n b = den.to_s.split('').sort\n\n # Case of 49/94 is a no go\n return nil, nil if a == b\n\n common = a & b\n unless common.length == 0\n a.reject!{|x| x == common.first}\n b.reject!{|x| x == common.first}\n\n # Case that one of the numbers is like 99 and both values were rejected\n return nil, nil if a.length == 0 || b.length == 0\n\n return a.first.to_f, b.first.to_f\n end\nend", "def twice(num)\n num_string = num.to_s\n str_length = num_string.size\n middle = str_length / 2\n if str_length.even? && num_string[0..middle-1] == num_string[middle..-1]\n return num\n end\n \n 2*num\nend", "def find_min2(array)\n min = array[0]\n \n array.each do |num|\n if num < min\n min = num\n end\n end\n \n return min\nend", "def add_numbers(nums_array)\n #if array has >1 element, then take first element and then ...\n return nums_array.first if nums_array.length <= 1\n nums_array.first + add_numbers(nums_array[1..-1])\nend", "def triple_double(num1, num2)\n num1, num2 = num1.to_s, num2.to_s\n num1.each_char.with_index do |digit, idx|\n next if idx >= num1.size - 2\n if num1[idx + 1] == digit && num1[idx + 2] == digit\n num2.each_char.with_index do |digit2, idx2|\n next if idx >= num1.size - 1 || digit2 != digit\n return 1 if num2[idx2 + 1] == digit\n end\n end\n end\n 0\nend", "def plus_one(digits)\n arr = digits.join.to_i + 1\n arr.to_s.split(\"\").map(&:to_i)\nend", "def single_number(nums)\n (3 * nums.uniq.sum - nums.sum) / 2\nend", "def find(array)\n # sorts an array\n array.sort! {|x, y| y <=> x}\n return array.first.to_s\nend", "def lowest_number(number_list)\n number_list.map(&:to_s)\n .permutation\n .map(&:join)\n .map(&:to_i)\n .min\nend", "def find_self_dividing(number_strings)\n output = []\n number_strings.each do |num_string|\n number = num_string.join(\"\").to_i\n divisibles_in_array = find_divisibles(number, num_string)\n\n if divisibles_in_array.join(\"\").to_i == number\n output << number\n end\n end\n output\nend", "def first_of(array)\n output = array[0]\n return output\nend", "def make_smaller(num)\n #declare variable for adding number\n small_num = 0\n \n # convert the number to a string so it can be used like an array\n num = num.to_s\n # find out how many digits on in the number so the for loop knows how many time to go though\n digits = num.length - 1\n\n # add each number to each other\n #for i in 0..digits do\n # small_num += num[i].to_i\n\n #end\n num.each do |digit|\n small_num += digit.to_i\n end\n\n #make sure number is only one digits\n if small_num.to_s.length > 1 then small_num = make_smaller small_num end\n \n small_num\nend", "def twice(num)\n num_str = num.to_s\n if num_str.length.even?\n midpoint = num_str.length / 2\n return num if num_str[0, midpoint] == num_str[midpoint, midpoint]\n end\n num * 2\nend", "def add_numbers(num_array)\n num_array.count > 1 ? num_array.first + add_numbers(num_array.drop(1)) : num_array.first\n end", "def custom_first(arr,num=0)\n l = arr.length\n if num==0\n arr[0]\n else\n (num<l)? arr[0...num] : arr[0...l]\n end\nend", "def my_min_2(array)\n array.sort!\n array.first\nend", "def SecondGreatLow(arr)\n return arr.join(' ') if arr.length == 2\n arr.sort!.uniq!\n \"#{arr[1]} #{arr[-2]}\"\nend", "def find_first_dup(num_arr)\r\n set = []\r\n num_arr.each do |value|\r\n return value if set[value] #return value if it exists already in the set 'Array'\r\n set[value] = true \r\n end\r\n return -1 \r\nend", "def check_array(array, num)\n if array.length > 2\n if num < array[0] or num > array[array.length-1]\n return false\n elsif num == array[0] \\\n or num == array[array.length-1] \\\n or num == array[((array.length-1)/2).floor]\n return true\n elsif num < array[((array.length-1)/2).floor]\n return check_array(array[0..((array.length-1)/2).floor-1], num)\n elsif num >= array[((array.length-1)/2).floor]\n return check_array(array[((array.length-1)/2).floor..array.length-1], num)\n end\n else\n return true if num == array[0] or num == array[1]\n return false\n end\nend", "def printFirstRepeating( arr)\n\tsize = arr.length\n\ths = []\n\tfirstRepeating = 99999\n\ti = size - 1\n\twhile (i >= 0)\n\t\tif (hs.include?(arr[i]))\n\t\t\tfirstRepeating = arr[i]\n\t\tend\n\t\ths.push(arr[i])\n\t\ti -= 1\n\tend\n\tprint(\"First Repeating number is : \" + firstRepeating.to_s,\"\\n\")\nend", "def search(array, number)\n answer = nil\n array.length.times do |x|\n if array[x] == number \n answer = x\n return answer\n end\n end \n if answer == nil || answer >= array.length\n return \"nil\"\n end \nend", "def single_number(nums)\n nums.sort.uniq.each do |i|\n if appears_three?(nums.sort, i)\n return i\n end\nend\nreturn -1\nend", "def break_number(num,short_scale)\n first_slice = (num.to_s.size - short_scale.to_s.size ) if num == short_scale\n first_slice = (num.to_s.size - (short_scale.to_s.size - 3) ) if num < short_scale\n first = num.to_s.slice(0..first_slice)\n second = num.to_s.slice(first.size..num.to_s.size)[0]\n return first,second\n end", "def double_digits\n times_by_2.map do |number|\n if number > 9\n number - 9\n else\n number\n end\n end\nend", "def find_dup(array_of_integers)\n array_of_integers.each do |integer|\n return integer if array_of_integers.count(integer) == 2\n end\nend", "def find_smallest(array, length)\n smallest_number = array[0]\n length.times do |i|\n if smallest_number > array[i]\n smallest_number = array[i]\n end\n end\n return smallest_number\nend", "def SecondGreatLow(arr)\n\n arr.size > 2 ? puts(\"#{arr.sort.uniq[1]} #{arr.sort.uniq[-2]}\") : puts(\"#{arr[1]} #{arr[0]}\")\nend", "def digit_match(n, m)\n \n if (n % 10) == (m % 10)\n if n == 0 && m == 0\n return 1\n elsif n == 0 || m == 0\n return 0\n end \n return 1 + digit_match(n/10, m/10)\n else\n if(n / 10 == 0) || (m / 10 == 0) # Used to determine if either number is a single digit\n return 0\n end\n return digit_match(n/10, m/10)\n end\n \n \nend", "def double_num?(int)\n # digits is even && left half = right half\n len = int.to_s.length\n arr = int.digits.reverse\n len.even? && arr.take(len / 2) == arr.drop(len / 2)\nend", "def super_digit(n)\n n_array = n.to_s.split('').map {|i| i.to_i}\n return n if n_array.length == 1\n return super_digit(n_array.sum)\nend", "def sequential(number)\r\n # number.digits.reverse.each_with_index do |num, idx|\r\n # if idx + 1 == num\r\n # return true\r\n # end\r\n # end\r\n \r\n number.digits.reverse.all? {|num| num.index + 1 == num }\r\nend", "def smallest_integer(array)\n\tsmallint = array.sort\n\tputs smallint.first\nend", "def twice(num)\n num_str = num.to_s\n middle = num_str.length / 2 - 1\n \n if num_str.length.even?\n if num_str[0..middle] == num_str[middle + 1..-1]\n return num\n end\n end\n \n num * 2\nend", "def unused_digits(*num)\n digits = (0..9)\n arr = *num.join.split('')\n \n unused_digits = digits.select do |num|\n !arr.include?(num.to_s)\n end\n unused_digits.sort.join\nend", "def find_min_value(array)\n min_value = array[0]\n array.length.times do |count|\n if array[count] < min_value\n min_value = array[count]\n end\n end\n min_value\nend", "def find_smallest(array, length)\n smallest_number = array[0]\n length.times do |index|\n if array[index] < smallest_number\n smallest_number = array[index]\n end\n end\n return smallest_number\nend", "def find_dup_number(array)\n n = array.length - 1\n expected_sum = n*(n+1)/2\n actual_sum = array.reduce(:+)\n actual_sum - expected_sum\nend", "def double?(num)\n num_str = num.to_s\n midpoint = num_str.length / 2\n num_str[0...midpoint] == num_str[midpoint..-1]\nend", "def comb n\n #if integer has more than 1 digit \n if n >= 10\n #if the first digit is less than the second digit of the integer\n if get_first_digit(n) < get_first_digit(drop1(n))\n #switch first and second digits, continue combing\n (round_1_sig_fig(drop1(n)) * 10) + comb( (round_1_sig_fig(n) / 10) + drop1(drop1(n)) )\n else\n #digits are in correct positions, contiune combing\n round_1_sig_fig(n) + comb(drop1(n))\n end\n else\n #last digit reached, comb finshed.\n n\n end\n\nend", "def array_42(argument)\n\n\tresultat = false\n\ti=0\n\twhile i<=argument.length\n\t\tif argument[i]==42 then\n\t\t\tresultat= true\n\t\telse \n\t\t\t\tend\n\t\ti+=1\n\tend\n\t\n#\tputs resultat\n\t\treturn resultat\n\t\t\nend", "def find_smallest_num(arr)\n\treturn arr.min()\nend" ]
[ "0.6912624", "0.68084055", "0.6710376", "0.660626", "0.6387354", "0.63461185", "0.63276875", "0.6226721", "0.62236136", "0.6220724", "0.6220524", "0.62170947", "0.6210346", "0.62044764", "0.61951774", "0.61946523", "0.618273", "0.61289483", "0.608719", "0.6074364", "0.60699147", "0.60601074", "0.6027572", "0.6023837", "0.601019", "0.5995206", "0.59939283", "0.59928423", "0.59852743", "0.5982566", "0.59684086", "0.596663", "0.5938364", "0.5928457", "0.59088975", "0.5894248", "0.58923525", "0.58864534", "0.588553", "0.5876325", "0.58680165", "0.5867836", "0.58672595", "0.5863359", "0.5861183", "0.5858301", "0.58456606", "0.5844985", "0.58438534", "0.58401394", "0.58397084", "0.5828846", "0.58288", "0.5816536", "0.58125365", "0.5807477", "0.58063686", "0.5805546", "0.57987285", "0.5796323", "0.5784613", "0.5783868", "0.57803524", "0.5779579", "0.5779424", "0.5772424", "0.57693744", "0.5763048", "0.5761542", "0.57588905", "0.5753269", "0.5752817", "0.5747795", "0.5736597", "0.5736057", "0.5734487", "0.5734", "0.5733047", "0.57299864", "0.57295823", "0.57261866", "0.57182395", "0.571263", "0.5710958", "0.57022333", "0.56903774", "0.5688506", "0.56787914", "0.5676866", "0.56732434", "0.56700915", "0.5668607", "0.565608", "0.56540096", "0.5651609", "0.564927", "0.5645195", "0.5641179", "0.56266993", "0.5624048", "0.56226647" ]
0.0
-1
DELETE /event DELETE /event.xml
def destroy self.resource = destroy_resource respond_to do |format| format.html do flash[:notice] = "#{resource_name.humanize} was successfully destroyed." redirect_to enclosing_resource_url if enclosing_resource end format.js format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_event(event)\n @connection.send(Addressable::URI.parse(events_url + \"/#{event.id}\"), :delete)\n end", "def delete_event(event)\n notifications = \"sendNotifications=#{event.send_notifications?}\"\n send_events_request(\"/#{event.id}?#{notifications}\", :delete)\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to(admin_events_url) }\n format.xml { head :ok }\n end\n website.add_log(user: current_user, action: \"Deleted event: #{@event.name}\")\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_events_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_events_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @event = IndrelEvent.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(indrel_events_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @event.destroy\n respond_to do | format |\n format.html { redirect_to events_path }\n format.xml { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.xml { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(tasks_path) }\n format.xml { head :ok }\n end\n end", "def destroy\n @custom_event = CustomEvent.find(params[:id])\n @custom_event.destroy\n\n respond_to do |format|\n format.html { redirect_to(custom_events_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @event.delay.call_notification(I18n.t('Notification.event_deleted'), I18n.t('Email.event_deleted'))\n @event.destroy\n head :no_content\n end", "def destroy\n @client_event = ClientEvent.find(params[:id])\n @client_event.destroy\n\n respond_to do |format|\n format.html { redirect_to(client_events_url) }\n format.xml { head :ok }\n end\n end", "def delete_event\r\n event = Event.find_by(id: params[:eventid].to_i)\r\n if event.present?\r\n event.update(status: 3)\r\n lt_update_event_status event, 'archived'\r\n render json: SuccessResponse.new(\r\n code: 200,\r\n message: 'Event Deleted.'\r\n ), adapter: :json, status: :ok\r\n else\r\n render json: ErrorResponse.new(\r\n code: 404,\r\n message: 'Event not found!'\r\n ), adapter: :json, status: :not_found\r\n end\r\n\r\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_canada_events_path) }\n format.xml { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\t\tics_for_all #########\n respond_to do |format|\n\t\t\tformat.html { redirect_to(:back) }\n format.xml { head :ok }\n end\n end", "def destroy\n @event.destroy\n \n head :no_content\n end", "def destroy\n @event.destroy\n\n head :no_content\n end", "def destroy\n @event.destroy\n\n head :no_content\n end", "def destroy\n @event.destroy\n\n head :no_content\n end", "def destroy\n @event = @current_user.events.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end", "def delete(id)\n wf_event_id?(id)\n api.delete(id)\n end", "def destroy\n @evento = Evento.find(params[:id])\n @evento.destroy\n\n respond_to do |format|\n format.html { redirect_to(eventos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @evento = Evento.find(params[:id])\n @evento.destroy\n\n respond_to do |format|\n format.html { redirect_to(eventos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n render :nothing => true, :status => 200, :content_type => 'text/plain'\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.xml { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n head :no_content\n end", "def destroy\n @event = Event.find(params[:id])\n #@event.update_attribute(:deleted, true)\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @event = Event.find(params[:id])\r\n #@event.destroy\r\n @event.update_attribute(\"is_deleted\", true)\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(events_url) }\r\n format.xml { head :ok }\r\n end\r\n end", "def destroy\n event = Event.find(params[:id])\n event.destroy!\n end", "def delete_event\n if params[:id]\n @e = Evento.find(params[:id]).destroy\n end\n render :json => msj = { :status => true, :message => 'ok'}\n end", "def destroy\n @event = Event.using(:shard_one).find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n redirect_to root_path, :notice => \"Successfully deleted event\"\n end", "def deleteForEvent\n deleteEventNotifications(current_user.id, params[:eid])\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(my_races_path) }\n format.xml { head :ok }\n end\n end", "def destroy\r\n @event.destroy\r\n end", "def delete_event(id)\n @event_svc.delete(id)\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.fbml { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n flash[:notice] = \"Evento apagado.\"\n redirect_to events_path\n end", "def destroy\n @event = @rsvp.event\n @rsvp.destroy\n\n respond_to do |format|\n format.html { redirect_to(@event) }\n format.xml { head :ok }\n end\n end", "def destroy\n @event_event = Event::Event.find(params[:id])\n @event_event.destroy\n\n respond_to do |format|\n format.html { redirect_to event_events_url }\n format.json { head :ok }\n end\n end", "def destroy\n\t @event = Event.find(params[:id])\n\t @event.destroy\n\t redirect_to '/events'\n\tend", "def destroy\n @eventtime = Eventtime.find(params[:id])\n @eventtime.destroy\n\n respond_to do |format|\n format.html { redirect_to(eventtimes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url, notice: t(:event_deleted) }\n format.json { head :no_content }\n end\n end", "def delete_event(event_url, if_match = '*')\r\n # create required deletion headers\r\n delete_headers = @headers.merge({'If-Match' => if_match})\r\n\r\n # now delete it\r\n http = Net::HTTP.new(@google_url, 80)\r\n response, data = http.delete(event_url, delete_headers)\r\n case response\r\n when Net::HTTPSuccess, Net::HTTPRedirection\r\n redirect_response, redirect_data = http.delete(response['location'], delete_headers)\r\n case redirect_response\r\n when Net::HTTPSuccess, Net::HTTPRedirection\r\n return redirect_data\r\n else\r\n return redirect_response.error!\r\n end\r\n else\r\n return response.error!\r\n end\r\n return data\r\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n redirect_to events_path\n end", "def destroy\n\t\t@event = Event.find(params[:id])\n\t\t@event.destroy\n\t\tredirect_to root_path\n\tend", "def delete_org_unit_calendar_event(org_unit_id, event_id)\n path = \"/d2l/api/le/#{$le_ver}/#{org_unit_id}/calendar/event/#{event_id}\"\n _delete(path)\nend", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(lesson_url(@lesson)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @hike_event = HikeEvent.find(params[:id])\n @hike_event.destroy\n\n respond_to do |format|\n format.html { redirect_to(hike_events_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @event = @current_account.events.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event_meta = EventMeta.find(params[:id])\n @event_meta.destroy\n\n respond_to do |format|\n format.html { redirect_to(event_metas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def delete\n # @group_event.destroy\n @group_event = GroupEvent.find params[:id]\n\n @group_event.deleted = true\n @group_event.save!\n\n respond_to do |format|\n format.html { redirect_to group_events_url, notice: 'Group event was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @velocity_event = VelocityEvent.find(params[:id])\n @velocity_event.destroy\n\n respond_to do |format|\n format.html { redirect_to(velocity_events_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n redirect_to events_url\n end", "def destroy\n @event.destroy\n end", "def destroy\n @event.destroy\n end", "def destroy\n @event.destroy\n end", "def destroy\n @calevent = Calevent.find(params[:id])\n @calevent.destroy\n\n respond_to do |format|\n format.html { redirect_to calevents_url }\n format.json { head :no_content }\n end\n end", "def destroy\n load_data\n @event.destroy\n clear_zend_cache\n\n respond_to do |format|\n format.html { redirect_to(category_events_url(category)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @event=Event.find_by(params[:id])\n @event.delete\n redirect_to \"/\"\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url, notice: 'データが削除されました。' }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_events_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n \n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n#\t\t@event = Event.find(params[:id])\n\t\t@event.destroy\n\t\tflash[:alert] = \"event was successfully deleted\"\t\t\n#\t\tredirect_to :action => :index\n\t\tredirect_to events_path #RESTful\t\n\tend", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end" ]
[ "0.772324", "0.7523603", "0.7488018", "0.73347944", "0.73237276", "0.73237276", "0.73204166", "0.731671", "0.72896975", "0.72896975", "0.72896975", "0.72896975", "0.72896975", "0.72896975", "0.72896975", "0.72896975", "0.72896975", "0.72896975", "0.72896975", "0.72896975", "0.72896975", "0.72896975", "0.72896975", "0.72896975", "0.72896975", "0.72896975", "0.72896975", "0.72896975", "0.72896975", "0.72896975", "0.72896975", "0.72896975", "0.72896975", "0.7231405", "0.7193533", "0.7177996", "0.71672994", "0.7163888", "0.71532595", "0.7149677", "0.71490854", "0.711242", "0.7098755", "0.7098755", "0.7098755", "0.70882446", "0.7076255", "0.7075104", "0.7075104", "0.7068655", "0.70653653", "0.70653653", "0.7058216", "0.7026305", "0.7013496", "0.6998561", "0.6988985", "0.69605863", "0.69392973", "0.69386345", "0.69375414", "0.6894003", "0.68701243", "0.6869546", "0.68662065", "0.6853192", "0.68484557", "0.6847332", "0.6842946", "0.682738", "0.68252647", "0.6814376", "0.681276", "0.6812321", "0.68055266", "0.6803461", "0.68031365", "0.6799697", "0.679562", "0.6787796", "0.67867184", "0.6778749", "0.6775193", "0.67732954", "0.67732954", "0.67732954", "0.67715603", "0.67714566", "0.67710763", "0.67694116", "0.67650026", "0.6764691", "0.676077", "0.6751825", "0.6751825", "0.6751825", "0.6751825", "0.6751825", "0.6751825", "0.6751825", "0.6751825" ]
0.0
-1
common cache : load_notetags_bubs_dismantle
def load_notetags_bubs_dismantle @dismantle_items = [] @dismantle_gold_fee = Bubs::Dismantle::DEFAULT_DISMANTLE_FEE @dismantle_reagents = {} @dismantle_counter = 0 dismantle_tag = false self.note.split(/[\r\n]+/).each { |line| case line when /<dismantle>/i dismantle_tag = true when /<\/dismantle>/i dismantle_tag = false when /(\w+):\s*(\d+)\s*[,:]?\s*(\d+\.?\d*)?/i next unless dismantle_tag new_obj = DismantleObj.new case $1.upcase when "I", "ITEM" new_obj.item = $data_items[$2.to_i] new_obj.chance = $3.to_f unless $3.nil? @dismantle_items.push( new_obj ) when "W", "WEAPON", "WEP" new_obj.item = $data_weapons[$2.to_i] new_obj.chance = $3.to_f unless $3.nil? @dismantle_items.push( new_obj ) when "A", "ARMOR", "ARMOUR", "ARM" new_obj.item = $data_armors[$2.to_i] new_obj.chance = $3.to_f unless $3.nil? @dismantle_items.push( new_obj ) when "F", "FEE" @dismantle_gold_fee = $2.to_i end # case end # case } # self.note.split end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_notetags_bubs_tocrafting\n @recipe_list = []\n @ingredient_list = []\n @tocrafting_tools = []\n @tocrafting_actors = []\n @tocrafting_skills = []\n @tocrafting_gold_fee = self.price\n @tocrafting_bookcover = \"\"\n @tocrafting_se = []\n @tocrafting_category = :none\n @tocrafting_amount = 1\n @tocrafting_cev = 0\n \n load_notetags_default_fee_bubs_tocrafting\n \n recipe_tag = false\n ingredient_tag = false\n result_tag = false\n \n self.note.split(/[\\r\\n]+/).each { |line|\n case line\n when Bubs::Regexp::RECIPEBOOK_START_TAG\n recipe_tag = true\n when Bubs::Regexp::RECIPEBOOK_END_TAG\n recipe_tag = false\n \n when Bubs::Regexp::INGREDIENT_START_TAG\n ingredient_tag = true\n when Bubs::Regexp::INGREDIENT_END_TAG\n ingredient_tag = false\n \n when Bubs::Regexp::CRAFT_RESULT_START_TAG\n result_tag = true\n when Bubs::Regexp::CRAFT_RESULT_END_TAG\n result_tag = false\n \n when Bubs::Regexp::RECIPEBOOK_COVER_TAG\n next unless recipe_tag\n @tocrafting_bookcover = $1\n \n when Bubs::Regexp::RECIPEBOOK_CATEGORY_TAG\n next unless recipe_tag\n @tocrafting_category = $1.to_sym\n \n when Bubs::Regexp::REQUIRED_TOOLS_TAG # tools\n next unless ingredient_tag\n load_notetags_tools_bubs_tocrafting(line)\n \n when Bubs::Regexp::CRAFTING_CUSTOM_SE_TAG\n next unless ingredient_tag || result_tag\n @tocrafting_se = [$1, $2.to_i, $3.to_i]\n\n else\n load_notetags_recipelist_bubs_tocrafting(line) if recipe_tag\n load_notetags_ingredients_bubs_tocrafting(line) if ingredient_tag\n load_notetags_craft_result_bubs_tocrafting(line) if result_tag\n end # case\n } # self.note.split\n @recipe_list.compact!\n @ingredient_list.compact!\n @tocrafting_tools.compact!\n @tocrafting_actors.compact!\n @tocrafting_skills.compact!\n end", "def load_notetags_bubs_mix\n @mix = false\n @mix_type = :none\n @unmixable = false\n @mix_max_select = 2\n \n if self.is_a?(RPG::Item)\n @unmixable = Bubs::Mix::UNMIXABLE_ITEMS.include?(self.id)\n end\n \n self.note.split(/[\\r\\n]+/).each { |line|\n case line\n when Bubs::Regexp::MIX_TAG\n @mix = true\n @mix_max_select = $1.to_i unless $1.nil?\n \n when Bubs::Regexp::MIX_TYPE_TAG\n next unless self.is_a?(RPG::Item)\n @mix_type = $1.to_sym\n $data_mix.test_item_type_symbol(self)\n \n when Bubs::Regexp::UNMIXABLE_TAG\n @unmixable = true\n \n end # case\n } # self.note.split\n end", "def load_notetags_bubs_bluemagic\n @blue_magic = false if self.is_a?(RPG::UsableItem)\n @blue_magic_learning = false unless self.is_a?(RPG::UsableItem)\n\n self.note.split(/[\\r\\n]+/).each { |line|\n case line\n when Bubs::Regexp::BLUE_MAGIC_SKILL_TAG\n next unless self.is_a?(RPG::Skill)\n @blue_magic = true\n \n when Bubs::Regexp::BLUE_MAGIC_LEARNING_TAG\n next if self.is_a?(RPG::UsableItem)\n @blue_magic_learning = true\n \n end # case\n } # self.note.split\n end", "def load_notetags_bubs_guts\n @guts_param = 0.0\n \n self.note.split(/[\\r\\n]+/).each { |line|\n case line\n \n when Bubs::Regexp::BaseItem::GUTS_PLUS\n @guts_param = $1.to_f\n \n end # case\n } # self\n \n load_battler_notetags_bubs_guts if self.is_a?(RPG::Actor) || self.is_a?(RPG::Enemy)\n end", "def get_from_data_bags_cache(data_bag)\n encrypted_data_bags[data_bag]\n end", "def update_cached_tag_lists\n cache_tag_list if tag_list != cached_tag_list\n cache_topic_list if topic_list != cached_topic_list\n cache_user_tag_list if user_tag_list != cached_user_tag_list\n cache_owned_tag_list if owned_tag_list != cached_owned_tag_list\n end", "def load_tags\n return if request.fullpath.match(/^\\/(\\S+)preview/)\n \n load = Rails.cache.read('tags')\n if load.nil?\n load = blog_models.map { |resource|\n resource.tag_counts_on(:tags).all\n }.flatten.uniq.sort { |a,b| \n a.name.upcase <=> b.name.upcase\n }\n Rails.cache.write('tags', load)\n end\n @tags = load\n end", "def get_from_data_bags_cache(data_bag)\n encrypted_data_bags[data_bag]\n end", "def get_from_data_bags_cache(data_bag)\n encrypted_data_bags[data_bag]\n end", "def load_notetags_blood_magic\n @blood_magic_required = false\n @blood_magic_ignore_cost = false\n @blood_magic_ignore_penalty = false\n \n self.note.split(/[\\r\\n]+/).each { |line|\n case line\n\n when Bubs::Regexp::UsableItem::BLOOD_MAGIC_REQUIRED\n @blood_magic_required = true\n when Bubs::Regexp::UsableItem::BLOOD_MAGIC_IGNORE_COST\n @blood_magic_ignore_cost = true\n when Bubs::Regexp::UsableItem::BLOOD_MAGIC_IGNORE_PENALTY\n @blood_magic_ignore_penalty = true\n end\n } # self.note.split\n \n end", "def load_love_recipes(user = nil)\n # memcache code begin\n begin\n @love_recipes_set_count = CACHE.get('overview_love_recipes_set_count')\n rescue Memcached::NotFound\n @love_recipes_set = love_recipes(user, '21')\n @love_recipes_set_count = @love_recipes_set.size\n CACHE.set('overview_love_recipes_set_count',@love_recipes_set_count)\n end\n # memcache code end\n # no memcache code begin\n #@love_recipes_set = love_recipes(user, '21')\n #@love_recipes_set_count = @love_recipes_set.size\n # no memcahce code end\n end", "def load_notetags\n super\n init_custom_fields\n end", "def load_notetags_specdef\r\r\n @unblockable = false\r\r\n @block_adjust = 0 \r\r\n @thac0 = 0\r\r\n @armor_class = 0\r\r\n @is_normal_attack = false\r\r\n notetagged_items = false\r\r\n \r\r\n self.note.split(/[\\r\\n]+/).each { |line|\r\r\n case line\r\r\n when MOTO::REGEXP::BASEITEM::UNBLOCKABLE\r\r\n @unblockable = true\r\r\n when MOTO::REGEXP::BASEITEM::BLOCK_ADJUST_SET\r\r\n $data_notetagged_items.push(self)\r\r\n @block_adjust_set = $1.to_i\r\r\n p sprintf(\"[Attack Block]:%s's normal block attack: %d\",self.name,self.block_adjust_set)\r\r\n when MOTO::REGEXP::BASEITEM::IS_NORMAL_ATTACK\r\r\n @is_normal_attack = true\r\r\n when MOTO::REGEXP::BASEITEM::IS_MISSILE\r\r\n @is_missile = true\r\r\n p sprintf(\"[Attack Block]:%s is missile attack\",self.name)\r\r\n when MOTO::REGEXP::BASEITEM::MISSILE_BLOCK_RATE\r\r\n $data_notetagged_items.push(self)\r\r\n @missile_block_rate = $1.to_i\r\r\n p sprintf(\"[Attack Block]:%s missile block rate: %d\",self.name,self.missile_block_rate)\r\r\n when MOTO::REGEXP::BASEITEM::THAC0\r\r\n $data_notetagged_items.push(self)\r\r\n @thac0 = $1.to_i\r\r\n p sprintf(\"[Attack Block]:%s THAC adjust: %d\",self.name,self.thac0)\r\r\n when MOTO::REGEXP::BASEITEM::ARMOR_CLASS\r\r\n $data_notetagged_items.push(self)\r\r\n @armor_class = $1.to_i\r\r\n p sprintf(\"[Attack Block]:%s AC adjust: %d\",self.name,self.armor_class)\r\r\n \r\r\n end\r\r\n } # self.note.split\r\r\n end", "def cache_tag_list\n set_cached_tag_list\n save\n end", "def load_battler_notetags_bubs_guts\n @guts_text = \"\"\n @guts_reduce = Bubs::Guts::GUTS_DEFAULTS[:guts_reduce]\n @guts_animation = Bubs::Guts::GUTS_DEFAULTS[:guts_ani]\n @guts_hp_recovery_rate = Bubs::Guts::GUTS_DEFAULTS[:hp_rate]\n \n guts_tag = false\n \n if self.is_a?(RPG::Actor)\n @guts_param = Bubs::Guts::GUTS_DEFAULTS[:actor_guts_base] \n @guts_text = Bubs::Guts::GUTS_DEFAULTS[:actor_guts_text]\n elsif self.is_a?(RPG::Enemy)\n @guts_param = Bubs::Guts::GUTS_DEFAULTS[:enemy_guts_base] \n @guts_text = Bubs::Guts::GUTS_DEFAULTS[:enemy_guts_text]\n end\n \n self.note.split(/[\\r\\n]+/).each { |line|\n case line\n\n when Bubs::Regexp::BaseItem::GUTS_START\n guts_tag = true\n \n when Bubs::Regexp::BaseItem::GUTS_END\n guts_tag = false\n \n else\n next unless guts_tag\n case line\n \n when /BASE:\\s*[+]?(\\d+)/i\n @guts_param = $1.to_f\n \n when /TEXT:\\s*(.*)\\s*/i\n if Bubs::Guts::PRESET_GUTS_MESSAGES[$1.to_sym]\n @guts_text = Bubs::Guts::PRESET_GUTS_MESSAGES[$1.to_sym]\n else\n @guts_text = $1\n end\n when /REDUCE:\\s*([-+]?\\d+\\.?\\d*)/i\n @guts_reduce = $1.to_f\n \n when /(?:ANIMATION|ANI)\\s*id:\\s*(\\d+)/i\n @guts_animation = $1.to_i\n \n when /HP\\s*(?:RECOVERY)?:\\s*([+]?\\d+\\.?\\d*)[%%]?/i\n @guts_hp_recovery_rate = $1.to_f\n \n end # case\n end # case\n } # self.note.split\n end", "def load_trending_tags\n @trending_tags = Tag.for_network(@network).displayable.recently_active.limit(30)\n end", "def load_notetags_default_fee_bubs_tocrafting\n rate = Bubs::TOCrafting::CRAFTING_FEE_PRICE_RATE\n @tocrafting_gold_fee = (@tocrafting_gold_fee * (rate * 0.01)).to_i\n end", "def without_cache(&block); end", "def without_cache(&block); end", "def est_ts_load_notetags\n matches = Scope_Regex.match(self.note)\n if matches\n @scope = matches[1].to_i\n end\n end", "def download_tags\n\n end", "def filter_cache; end", "def fetch_from_db(cache_miss_ids)\n fail 'sub class to implement'\n end", "def cache_tags\n self[:tag_s] = self.tags.collect{|tag| tag.pattern}.reject{|p| p.starts_with?('wait') }.sort.join(' ')\n end", "def cache_tags\n self[:tag_s] = self.tags.collect{|tag| tag.pattern}.reject{|p| p.starts_with?('wait') }.sort.join(' ')\n end", "def load_cache\n @load_cache\n end", "def load_cache\n a = dataset.all\n h = {}\n a.each{|o| h[o.pk.freeze] = o.freeze}\n @all = a.freeze\n @cache = h.freeze\n end", "def subtract_cache\n tracker = Tracker.new\n tracker.read_articles\n @articles.delete_if { |x| tracker.articles.include?(x.link) }\n end", "def load_notetags_recipelist_bubs_tocrafting(line)\n return unless line =~ Bubs::Regexp::RECIPEBOOK_OBJ_TAG ? true : false\n match = $~.clone\n id_array = match[2].scan(/\\d+/)\n \n case match[1].upcase\n when \"I\", \"ITEM\", \"OGGETTO\"\n for id in id_array\n @recipe_list.push( $data_items[id.to_i] )\n end\n \n when \"W\", \"WEAPON\", \"WEP\", \"ARMA\"\n for id in id_array\n @recipe_list.push( $data_weapons[id.to_i] )\n end\n \n when \"A\", \"ARMOR\", \"ARMOUR\", \"ARM\", \"ARMATURA\"\n for id in id_array\n @recipe_list.push( $data_armors[id.to_i] )\n end # for\n \n end # case\n end", "def load_notetags_blood_magic\n @blood_magic_active = false\n @blood_magic_bonus = 0.0\n \n self.note.split(/[\\r\\n]+/).each { |line|\n case line\n\n when Bubs::Regexp::BaseItem::BLOOD_MAGIC_ACTIVE\n @blood_magic_active = true\n when Bubs::Regexp::BaseItem::BLOOD_MAGIC_BONUS\n @blood_magic_bonus = $1.to_f\n end\n } # self.note.split\n end", "def load_from_gist(url, version_id)\n\nend", "def unlearned_in_curr\n log \"Learning new, unmarked messages\"\n unlearned = @imap.search [\n 'NOT', 'KEYWORD', LEARN_KEYWORD\n ]\n\n tasty = []\n bland = []\n\n chunk unlearned do |messages|\n bodies = @imap.fetch messages, 'RFC822'\n bodies.each do |body|\n text = body.attr['RFC822']\n bucket = classify(text) ? tasty : bland\n bucket << body.seqno\n end\n end\n\n update_db tasty, :add_tasty\n update_db bland, :add_bland\n\n tasty.length + bland.length\n end", "def get_cached_forums\n #values = Dir.glob(\"*.yml\").map{|a| a.sub(\".yml\",\"\").gsub(\"__\",\"/\"); }\n cp = File.expand_path $cache_path\n values = Dir.entries(cp).grep(/\\.yml$/).map{|a| a.sub(\".yml\",\"\").gsub(\"__\",\"/\"); }\nend", "def cache; end", "def cache; end", "def cache; end", "def cache; end", "def cache; end", "def cache; end", "def cache; end", "def build_reverse_tag_lookup_cache\n @tags_for_node_cache = ArrayHash.new\n tags.inject(@tags_for_node_cache) do |hash, (tag, tag_node)|\n hash[tag_node] << tag\n hash\n end\n end", "def retrieve_tags\n # noop\n end", "def collect_broken_bikes_from station\n\t\tstation.bikes.each do |bike|\n\t\t\tload bike if bike.broken?\n\t\t\tstation.release bike if bike.broken?\n\t\tend\n\tend", "def load_blacklist(ws: Autoproj.workspace)\n blacklist_file = File.join(ws.config_dir, \"deb_blacklist.yml\")\n if File.exists?(blacklist_file)\n @blacklist = YAML.load_file(blacklist_file)\n end\n\n filter_osdeps(@blacklist)\n end", "def discovery_cache; end", "def fetch_words\n unless File.exists?(DEPRECATED_BLACKLIST_PATH)\n fetch_yaml(BLACKLIST_PATH, File.dirname(__FILE__) + \"/blacklist.yml\")\n else\n YAML.load(File.open(DEPRECATED_BLACKLIST_PATH)).freeze\n end\n end", "def load()\n raise 'Cannot load trackbacks without a site defined' if site.nil?\n \n # Paginate through search\n page = 1\n duplicate_count = 0\n \n begin\n begin\n results = Topsy.search(site, :window => :realtime, :page => page, :perpage => per_page)\n rescue Topsy::InformTopsy => e\n Grapevine.log_error(\"Topsy Search (#{name})\")\n rescue Topsy::Unavailable => e\n Grapevine.log_error(\"Topsy Unavailable (Limit: #{Topsy.rate_limit.remaining} of #{Topsy.rate_limit.limit})\")\n end\n \n # Exit load if Topsy does not return results\n if results.nil?\n return\n end\n \n # Loop over links and load trackbacks for each one\n results.list.each do |item|\n # Create and append message\n message = create_message(item)\n \n if !message.nil?\n # Attempt to create a topic\n topic = create_topic(message)\n if topic.nil?\n next\n end\n\n # Skip message from a user if it's a duplicate\n if Message.first(:author => message.author, :topic => topic)\n duplicate_count += 1\n \n # Exit if we've encountered too many duplicates\n if duplicate_count > duplicate_max_count\n return\n # Otherwise continue to next item\n else\n next;\n end\n # Reset the duplicate count if we see a new tweet\n else\n duplicate_count = 0\n end\n\n # Assign topic and save message\n message.topic = topic\n message.save\n\n Grapevine.log.debug \"MESSAGE: [#{message.author}] #{message.content}\"\n end\n end\n\n page += 1\n end while results.last_offset < results.total && page < 10\n end", "def load_cache\n @list = YAML::load_file Settings[:cache_file]\n end", "def refresh (num=@max_parallel,use_cache=true)\n\t\t puts \"Add entries to the local cache table from site tracker: \" if @verbose\n\t\t\tresults = Hash.new\n\t\t\ttags = @tag_store.keys\n\t\t\tif tags.size > 0\n\t\t\t\tParallel.map(tags, :in_processes => num) { |target|\n\t\t\t\t\tcheck_adware(target,use_cache)\n\t\t\t\t}.each do |process|\n\t\t\t\t\tif !process\n\t\t\t\t\t\tnext\n\t\t\t\t\telse\n\t\t\t\t\t\tresults.merge!(process)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\t@tag_store.merge!(results)\n\t\t\t\tputs \"Done loading adware entries.\"\n tags = nil\n\t\t\t\treturn results\n\t\t\telse\n\t\t\t\tputs \"Error: no entry is loaded. Please check your list and try again.\"\n\t\t\tend\n tags = nil\n\t\t\treturn results\n\t\trescue => ee\n\t\t\tputs \"Exception on method #{__method__}: #{ee}\" if @verbose\n \tend", "def store\n @by_cache.each{|cache, tags| cache[:tags] = tags }\n end", "def load_notetags_ingredients_bubs_tocrafting(line)\n return unless line =~ Bubs::Regexp::INGREDIENT_OBJ_TAG ? true : false\n amount = $3 ? $3.to_i : 1\n \n case $1.upcase\n when \"I\", \"ITEM\", \"OGGETTO\"\n amount.times do @ingredient_list.push( $data_items[$2.to_i] ) end\n \n when \"W\", \"WEAPON\", \"WEP\", \"ARMA\"\n amount.times do @ingredient_list.push( $data_weapons[$2.to_i] ) end\n \n when \"A\", \"ARMOR\", \"ARMOUR\", \"ARM\", \"ARMATURA\"\n amount.times do @ingredient_list.push( $data_armors[$2.to_i] ) end\n \n when \"FEE\", \"GOLD\", \"PREZZO\", \"ORO\"\n @tocrafting_gold_fee = $2.to_i\n \n when \"SKILL\"\n @tocrafting_skills.push( $2.to_i )\n \n when \"ACTOR\", \"EROE\"\n @tocrafting_actors.push( $2.to_i )\n \n end # case $1.upcase\n end", "def load_cache(language)\n\n\t\t\t\t\t\t# Initialize cache structures\n\t\t\t\t\t\tif @o2t.nil?\n\t\t\t\t\t\t\t@o2t = {}\n\t\t\t\t\t\tend\n\t\t\t\t\t\tif @t2o.nil?\n\t\t\t\t\t\t\t@t2o = {}\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\t# Fill cache if empty\n\t\t\t\t\t\tif @o2t[language.to_sym].nil? || @t2o[language.to_sym].nil?\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t@o2t[language.to_sym] = {}\n\t\t\t\t\t\t\t@t2o[language.to_sym] = {}\n\n\t\t\t\t\t\t\tdata = where(slug_language: language.to_s)\n\t\t\t\t\t\t\tdata.each do |item|\n\t\t\t\t\t\t\t\t@o2t[language.to_sym][item.original] = item.translation\n\t\t\t\t\t\t\t\t@t2o[language.to_sym][item.translation] = item.original\n\t\t\t\t\t\t\tend\n\n\t\t\t\t\t\tend\n\n\t\t\t\t\tend", "def delayed_atomic_pulls\n @delayed_atomic_pulls ||= {}\n end", "def cache(data); end", "def disable_caching; end", "def load_bparam_notetags\n @base_bparam = [6,6,5]\n @growth_bparam = [0.4,0.3,0.5]\n self.note.split(/[\\r\\n]+/).each do |line|\n if line =~ /<base[ _]bparams[:?]\\s*(\\d+),?[\\s?](\\d+),?[\\s?](\\d+)>/i\n @base_bparam[0] = $1.to_i\n @base_bparam[1] = $2.to_i\n @base_bparam[2] = $3.to_i\n end\n if line =~ /<growth[ _]bparams[:?]\\s*(\\d+),?[\\s?](\\d+),?[\\s?](\\d+)>/i\n @growth_bparam[0] = $1.to_i\n @growth_bparam[1] = $2.to_i\n @growth_bparam[2] = $3.to_i\n end\n end\n #puts(@base_bparam)\n #puts(@growth_bparam)\n end", "def disable_cache; end", "def load_all; end", "def load_all; end", "def load_all; end", "def demand_broken_bikes_from(container)\n while should_collect_broken_bikes?(container) do\n collected_bike = container.offload_broken_bike\n load(collected_bike)\n end\n end", "def disable_caching=(_arg0); end", "def load_notetags\n init_custom_fields\n self.note.split(/[\\r\\n]+/).each { |line|\n case line\n when /<image:\\s*\"(.*)\"\\s*>/i\n @image = $1\n when /<subtype_id:\\s*(\\d*)\\s*>/i\n @subtype_id = $1.to_i\n end\n }\n end", "def load_tsbs\n ($data_skills + $data_items + $data_states + $data_classes + \n $data_weapons + $data_actors + $data_enemies).compact.each do |item|\n item.load_tsbs\n end\n end", "def load_tsbs\n ($data_skills + $data_items + $data_states + $data_classes + \n $data_weapons + $data_actors + $data_enemies).compact.each do |item|\n item.load_tsbs\n end\n end", "def blacklist_add_remote\n if params[:item] and params[:item] != ''\n i = Blacklist.new(:item => params[:item], :created_at => Time.sl_local)\n i.save\n # add this to the cache if it exists\n Blacklist.add_to_cache(i) if Blacklist.cache.length > 0\n end\n render :nothing => true\n end", "def get_hash_tags(reload = false) \n @hash_tags = nil if reload\n @hash_tags ||= Dtag.find(:all, :conditions => [\"id IN (?)\", tag_ids]).inject({}) { |hash, tag| hash[tag.id] = tag; hash }\n end", "def cache_classes; end", "def cache_classes; end", "def fetch\n @github.fetch\n @stackoverflow.fetch\n @acuk.fetch\n @jobs = data.shuffle\n end", "def delete_fragments\n glob_cache_expire( 'C:/tmp/cache/views/user_type_id/*/browse/category_id/' + self.id.to_s )\n\n glob_cache_expire( 'C:/tmp/cache/views/user_type_id/*/shared_symbiont/symbiote_wrapper_container/symbiote_item_category_id/' + self.id.to_s )\n\n glob_cache_expire( 'C:/tmp/cache/views/user_type_id/*/shared_menu/menu_organized_category/category_id/' + self.id.to_s )\nend", "def load_all_subnets\n set_rack_ip_offsets\n set_subnets\n \n @subnet = {}\n @ip_subnet.keys.each do |net|\n @subnet[net] = net_by_suffix(suffix: net)\n end\nend", "def instance_cache; end", "def tasty_unflagged_in_curr\n log \"Finding messages re-marked bland\"\n\n @bland_flagged = @imap.search [\n 'NOT', 'FLAGGED',\n 'KEYWORD', TASTY_KEYWORD\n ]\n\n update_db @tasty_unflagged, :remove_tasty, :add_bland\n \n @bland_flagged.length\n end", "def cache_ids(use_pbar = @use_pbar)\n num_pep, num_db_seq, num_pep_ev = get_num_elements(nil)\n \n @pep_h = Hash.new\n @mod_h = Hash.new\n pbar1 = ProgressBar.new(\"peptides\", num_pep/2) if use_pbar\n reader = Nokogiri::XML::Reader(File.open(@mzid_file))\n reader.each do |node|\n # parse Peptide items\n if node.name == \"Peptide\" then\n # parse local peptide entry\n tmp_node = Nokogiri::XML.parse(node.outer_xml)\n tmp_node.remove_namespaces!\n root = tmp_node.root \n pep_id = root[\"id\"].to_sym\n # skip if already handled PepID\n next if @pep_h.has_key?(pep_id)\n # parse sequence/mods if haven't seen it yet\n pep_seq = get_peptide_sequence(root)\n mod_line = get_modifications(root)\n @pep_h[pep_id] = pep_seq\n @mod_h[pep_id] = mod_line\n pbar1.inc if use_pbar\n end\n end\n pbar1.finish if use_pbar\n # now parse DBSequence items\n dbseq_re = Regexp.new(/^\\s*<DBSequence\\s/)\n pbar2 = ProgressBar.new(\"db_seq\", num_db_seq) if use_pbar\n IO.foreach(@mzid_file) do |line|\n next if !dbseq_re.match(line)\n \n prot_id = line.match(/accession=\\\"([\\w|\\|]+)/)[1]\n db_id = line.match(/id=\\\"(\\w+)/)[1]\n \n @db_seq_h[db_id.to_sym] = prot_id.to_sym\n pbar2.inc if use_pbar\n end\n pbar2.finish if use_pbar\n # now parse PeptideEvidence items\n pepev_re = Regexp.new(/^\\s*<PeptideEvidence\\s/)\n pbar3 = ProgressBar.new(\"pep_ev\", num_pep_ev) if use_pbar\n IO.foreach(@mzid_file) do |line|\n next if !pepev_re.match(line)\n \n db_id = line.match(/dBSequence_ref=\\\"(\\w+)/)[1]\n start_pos = line.match(/start=\\\"(\\d+)/)[1].to_i\n end_pos = line.match(/end=\\\"(\\d+)/)[1].to_i\n pep_ev = line.match(/id=\\\"(\\w+)/)[1]\n is_decoy = line.match(/isDecoy=\\\"(\\w+)\\\"/)[1]\n # @pep_ev_h_dbseqRef[pep_ev.to_sym] = db_id.to_sym\n @pep_ev_h[pep_ev.to_sym] = PeptideEvidence.new(:db_seq_ref => db_id.to_sym,\n :start_pos => start_pos,\n :end_pos => end_pos,\n :is_decoy => is_decoy)\n pbar3.inc if use_pbar\n end\n pbar3.finish if use_pbar \n end", "def load_notetags\n super\n init_custom_fields\n self.note.split(/[\\r\\n]+/).each { |line|\n case line\n when /<default title:\\s*(\\d*)\\s*>/i\n @default_title_id = $1.to_i\n when /<titles:[ ](\\d+(?:\\s*,\\s*\\d+)*)>/i\n $1.scan(/\\d+/).each { |num| \n @titles.push(num.to_i) if num.to_i > 0 \n }\n when /<icon_index:\\s*(\\d*)\\s*>/i\n @icon_index = $1.to_i\n when /<max_level:\\s*(\\d*)\\s*>/i\n @max_level = $1.to_i\n end\n }\n end", "def load_notetags\n super\n init_custom_fields\n self.note.split(/[\\r\\n]+/).each { |line|\n case line\n when /<(.*) growth:\\s*(\\d+\\.?\\d*)>/i\n case $1.upcase\n when \"HP\"\n @growth_rate[0] = $2.to_f\n when \"MP\", \"TP\"\n @growth_rate[1] = $2.to_f\n when \"P.ATK\"\n @growth_rate[2] = $2.to_f\n when \"P.DEF\"\n @growth_rate[3] = $2.to_f\n when \"M.ATK\"\n @growth_rate[4] = $2.to_f\n when \"M.DEF\"\n @growth_rate[5] = $2.to_f\n when \"AGI\"\n @growth_rate[6] = $2.to_f\n when \"LCK\", \"LUCK\"\n @growth_rate[7] = $2.to_f\n end\n when /<max sp:\\s*(\\d+\\.?\\d*)>/i\n @msp = $1.to_i\n when /<capacities:[ ](\\d+(?:\\s*,\\s*\\d+)*)>/i\n $1.scan(/\\d+/).each { |num| \n @capacities.push(num.to_i) if num.to_i > 0 \n }\n end\n }\n end", "def singleton_cache; end", "def unload_extra\n log \"Unloading extra baggage\" , Logger::Ultimate\n @mutex.synchronize do\n @ghash.delete_if do |goid, obj|\n if obj.busy?\n log \"#{obj} busy\" , Logger::Ultimate\n false\n elsif obj.is_a? Player or obj.is_a? Mobile\n false\n elsif obj.container.nil? or not self.loaded? obj.container\n puts \"Checking #{obj}\" , Logger::Ultimate\n if obj.can? :inventory\n if obj.inventory.has_any? Player or obj.inventory.has_any? Mobile\n log \"It contains a player or mobile:\" , Logger::Ultimate\n log obj.inventory.find_all('class', Player) , Logger::Ultimate\n log obj.inventory.find_all('class', Mobile) , Logger::Ultimate\n false\n else\n @storage.store_object(obj)\n true\n end\n else\n log \"Saving #{obj}\" , Logger::Ultimate\n @storage.store_object(obj)\n log \"Dropping #{obj}\\nContainer is #{obj.container}\\nNo Inventory\" , Logger::Ultimate\n log \"Saving #{obj}\" , Logger::Ultimate\n true\n end\n else\n puts \"#{obj} isn't a player or a mobile or busy and it has a container\" , Logger::Ultimate\n false\n end\n end\n end\n log \"Baggage unloaded\", Logger::Ultimate\n end", "def load_bills()\n params = {'history.active' => true}\n params['order'] = 'last_action_at'\n @bills = process('bills', 'bills', params)\n end", "def load_blog_list_from_local\n input = YAML.load(File.read('blogs.yaml'))['blogs']\n\n blogs = []\n input.each do |blog|\n blog_id = calculate_id_for(blog)\n item = {\n '__typename': 'Blog',\n '_version': 1,\n '_lastChangedAt': Time.now.to_i,\n id: blog_id,\n title: blog['title'],\n url: blog['url']\n }\n\n $ddb_client.put_item({\n table_name: BLOGS_TABLE,\n item: item\n })\n\n blogs.push(item)\n end\n\n p \"Added #{blogs.length} blogs\"\n { items: blogs, count: blogs.length }\nend", "def check_cache(key)\n checksum = Digest::MD5.hexdigest(key)\n node['data-bag-cache'][node['data-bag-cache']['__checksums__'][checksum]]\n end", "def eager_load_keys(keys)\n # Speed up pulls by priming the page's placeholder keys\n end", "def demand_functioning_bikes_from(container)\n while should_collect_functioning_bikes?(container) do\n collected_bike = container.offload_functioning_bike\n load(collected_bike)\n end\n end", "def load_notetags_tools_bubs_tocrafting(line)\n line =~ Bubs::Regexp::REQUIRED_TOOLS_TAG\n \n case $1.upcase\n when \"I\", \"ITEM\", \"OGGETTO\"\n @tocrafting_tools.push( $data_items[$2.to_i] )\n \n when \"W\", \"WEAPON\", \"WEP\", \"ARMA\"\n @tocrafting_tools.push( $data_weapons[$2.to_i] )\n \n when \"A\", \"ARMOR\", \"ARMOUR\", \"ARM\", \"ARMATURA\"\n @tocrafting_tools.push( $data_armors[$2.to_i] )\n \n end # case\n end", "def fetch(name)\n load_cache(name)\n end", "def one_singleton_ancestors_cache; end", "def load_notetags_bubs_gender_requirements\n @gender_requirements = []\n @ignore_gender_requirements = false\n \n self.note.split(/[\\r\\n]+/).each { |line|\n case line\n when Bubs::Regexp::BaseItem::GENDER_REQUIREMENTS\n case $1.upcase\n when \"IGNORE\"\n next unless self.is_a?(RPG::Actor) || \n self.is_a?(RPG::Class) || \n self.is_a?(RPG::Enemy)\n @ignore_gender_requirements = true\n \n when \"GENDERLESS\", \"NONE\"\n next if self.is_a?(RPG::Actor) || self.is_a?(RPG::Enemy)\n @gender_requirements.push(0) unless @gender_requirements.include?(0)\n \n when \"MALE\", \"M\"\n next if self.is_a?(RPG::Actor) || self.is_a?(RPG::Enemy)\n @gender_requirements.push(1) unless @gender_requirements.include?(1)\n \n when \"FEMALE\", \"F\"\n next if self.is_a?(RPG::Actor) || self.is_a?(RPG::Enemy)\n @gender_requirements.push(2) unless @gender_requirements.include?(2)\n\n end # case \n end # case\n } # self.note.split\n \n end", "def cache_fetch(*args)\n super { |key| @store[key] }\n end", "def movies_disliked\n REDIS.smembers movies_disliked_key\n end", "def borra_redis(loader)\n # Borra el del nombre cientifico\n nombre_cient_data = {id: id}.stringify_keys\n loader.remove(nombre_cient_data)\n\n # Borra los nombre comunes\n 50.times do |i|\n id_referencia = nombre_comun_a_id_referencia(i+1)\n nombre_com_data = {id: id_referencia}.stringify_keys\n loader.remove(nombre_com_data)\n end\n end", "def load_chefzero_databag(databag)\n databag_hash = Hash.new\n databag_dir = Dir.glob(\"#{data_bag_load_path}/#{databag}/\" + '*.json')\n\n databag_dir.each do |item|\n File.open(item, \"r\") do |f|\n data_bag_item = MultiJson.load(f)\n id = data_bag_item.delete(\"id\")\n\n databag_hash[id] = data_bag_item\n end\n end\n\n databag_hash\n end", "def load_used_phrases\n\t@used_phrases = load_collection_from_file(@phrase_file_name, {});\nend", "def clean_cache\n node.normal['cloudflare']['threat_control']['status_cache'].reject! { |ip, data| is_stale? data['datetime'] }\nend", "def cache_instances\n [*Pages.all_instances, *([BlogArticle, Industry, Team].map{|p| p.all })]\n end", "def load(key)\n\t\treturn nil unless has_key?(key)\n\t\t@used.delete(key)\n\t\t@used.unshift(key)\n\t\t@pens[key]\n\tend", "def cache(count)\n @cached_elements = active_elements.pop(count)\n return\n end", "def cache_store; end", "def cache_store; end", "def replace_taggings_from_atom(atom)\n Tagging.transaction do\n self.delete_classifier_taggings!\n taggings_from_atom(atom) \n end\n end" ]
[ "0.6404823", "0.6006554", "0.58851457", "0.56934065", "0.5693365", "0.56367594", "0.5615738", "0.5562807", "0.5562807", "0.55256224", "0.55125296", "0.5498459", "0.54863095", "0.5467426", "0.5456634", "0.5355182", "0.5286759", "0.52649176", "0.52649176", "0.52496904", "0.5218664", "0.51935685", "0.5152697", "0.5134323", "0.5134323", "0.51257163", "0.51214373", "0.5118835", "0.51123583", "0.5076814", "0.5073625", "0.5054367", "0.50486135", "0.50364476", "0.50364476", "0.50364476", "0.50364476", "0.50364476", "0.50364476", "0.50364476", "0.50111705", "0.4993571", "0.4987348", "0.4985469", "0.49721053", "0.4949234", "0.49346703", "0.49014786", "0.48836398", "0.48695296", "0.4869107", "0.485508", "0.48490882", "0.48489225", "0.48396438", "0.4836478", "0.48339498", "0.48033613", "0.48033613", "0.48033613", "0.4794662", "0.47945777", "0.47893977", "0.4784738", "0.4784738", "0.47846448", "0.4783851", "0.47789538", "0.47789538", "0.47706944", "0.47514385", "0.47488588", "0.47337922", "0.4731564", "0.472669", "0.47264197", "0.47187275", "0.46903494", "0.46901518", "0.46834424", "0.4676656", "0.46646088", "0.46487498", "0.46476647", "0.4647321", "0.46447784", "0.46424377", "0.4640546", "0.4636175", "0.4633743", "0.46316302", "0.46315822", "0.4624777", "0.4621344", "0.46205774", "0.46147", "0.46111584", "0.46010527", "0.46010527", "0.45908707" ]
0.69911176
0
new method : dismantlable?
def dismantlable? return false unless self.is_a?(RPG::Item) || self.is_a?(RPG::EquipItem) return true unless @dismantle_items.empty? return false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def original; end", "def extended(*) end", "def custom; end", "def custom; end", "def original_method; end", "def overload; end", "def specie; end", "def specie; end", "def specie; end", "def specie; 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 internal; end", "def same; end", "def suivre; end", "def extra; end", "def refutal()\n end", "def probers; end", "def silly_adjective; end", "def wrapper; end", "def private_method\n end", "def specialty; end", "def anchored; end", "def schubert; end", "def self_new\n end", "def method_731(base); end", "def implementation; end", "def implementation; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def self_new\n raise \"Not implemented.\"\n end", "def verdi; end", "def isolated; end", "def isolated; end", "def returns; end", "def special\n override\n end", "def extra=(_arg0); end", "def methods() end", "def overrides; end", "def escaper=(_); end", "def original_result; end", "def class() end", "def methods; end", "def methods; end", "def methods; end", "def methods; end", "def under_construction\n end", "def missing; end", "def cop=(_); end", "def cop=(_); end", "def ignores; end", "def mathtex(*)\n super\n end", "def who_we_are\r\n end", "def -@; end", "def reserved; end", "def clone; end", "def clone; end", "def clone; end", "def abstract!; end", "def probers=(_arg0); end", "def formation; end", "def villian; end", "def operation; end", "def celebration; end", "def -@()\n #This is a stub, used for indexing\n end", "def new\n super\n end", "def r; end", "def r; end", "def base=(_arg0); end", "def dup\n super().extend IndifferentAccess\n end", "def old_method\n \"old improved method\"\nend", "def clone(*) end", "def clone(*) end", "def virtual; end", "def private_method; end", "def weber; end", "def new #:nodoc:\n end", "def new \n super\n end", "def herald; end", "def methods=(_arg0); end", "def new \n super\n end", "def call; end", "def call; end" ]
[ "0.7215089", "0.71076375", "0.690512", "0.6877685", "0.6877685", "0.6736623", "0.6650486", "0.6626182", "0.6626182", "0.6626182", "0.6626182", "0.6622015", "0.6622015", "0.6622015", "0.6622015", "0.6622015", "0.6622015", "0.6622015", "0.6622015", "0.6622015", "0.6622015", "0.6622015", "0.6622015", "0.6589429", "0.6578113", "0.64957964", "0.6480235", "0.6429017", "0.64139485", "0.637577", "0.63675", "0.63591397", "0.6348064", "0.634556", "0.63354725", "0.63178074", "0.6312029", "0.6288871", "0.6288871", "0.62271976", "0.62271976", "0.62271976", "0.62271976", "0.62271976", "0.62271976", "0.62271976", "0.62271976", "0.62271976", "0.62230456", "0.6212071", "0.6184212", "0.6184212", "0.61772835", "0.6174293", "0.6157682", "0.61423475", "0.61395335", "0.6136577", "0.61357784", "0.61314476", "0.61226404", "0.61226404", "0.61226404", "0.61226404", "0.60909826", "0.60908526", "0.60860556", "0.60860556", "0.6085341", "0.6061969", "0.6053937", "0.6037382", "0.60356206", "0.60320526", "0.60320526", "0.60320526", "0.6025963", "0.60254645", "0.6017424", "0.60130775", "0.60046285", "0.5992022", "0.5989444", "0.5986437", "0.5983714", "0.5983714", "0.59835774", "0.59776855", "0.5976928", "0.5975822", "0.5975822", "0.5962246", "0.59575707", "0.5952132", "0.5950134", "0.5946575", "0.5946063", "0.5933898", "0.5933815", "0.5932309", "0.5932309" ]
0.0
-1
new method : set_dismantle_mask_flags
def set_dismantle_mask_flags(flag = true) return unless self.is_a?(RPG::Item) || self.is_a?(RPG::EquipItem) @dismantle_items.each do |obj| obj.mask = flag end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_dismantle_mask(key, id)\n case key\n when :item\n $data_items[id].set_dismantle_mask_flags(true)\n when :armor\n $data_armors[id].set_dismantle_mask_flags(true)\n when :weapon\n $data_weapons[id].set_dismantle_mask_flags(true)\n end\n end", "def set_mask(opts)\n opts = check_params(opts,[:masks])\n super(opts)\n end", "def mask\n super\n end", "def masking?; true; end", "def masking?; false; end", "def remove_all_dismantle_masks\n groups = [$data_items, $data_armors, $data_weapons]\n for group in groups\n for obj in group\n next if obj.nil?\n obj.set_dismantle_mask_flags(true)\n end # for\n end # for\n end", "def mask(*args)\n flags = self.flags\n \n args.inject(0) do |n, name|\n n += flags[name.to_s]\n end\n end", "def mask_with_a_care!(mask)\n original_addr = @addr\n mask_without_a_care!(mask)\n @addr = original_addr unless self.class.mask_by_default\n return self\n end", "def dilate mask\n morph mask, :dilate\n end", "def unset_mask\n @masking_key = nil\n end", "def unset_mask\n @masking_key = nil\n end", "def set_wildmask(opts)\n opts = check_params(opts,[:wildmasks])\n super(opts)\n end", "def set_mask\n raise WebSocket::Error::Frame::MaskTooShort if bytesize < 4\n @masking_key = self[0..3].bytes.to_a\n end", "def flags=(val)\n self.offset_flags = (offset_flags & 0xffffffffffff0000) | val\n end", "def set_mask\n @mask = Mask.find(params[:id])\n end", "def ndp_set_flags=(bits)\n case bits\n when \"000\"\n self.ndp_reserved = 0x00000000\n when \"001\"\n self.ndp_reserved = 0x20000000\n when \"010\"\n self.ndp_reserved = 0x40000000\n when \"011\"\n self.ndp_reserved = 0x60000000\n when \"100\"\n self.ndp_reserved = 0x80000000\n when \"101\"\n self.ndp_reserved = 0xa0000000\n when \"110\"\n self.ndp_reserved = 0xc0000000\n when \"111\"\n self.ndp_reserved = 0xe0000000\n end\n end", "def reset_flags\n @flags = { :zero => false , :plus => false ,\n :minus => false , :overflow => false }\n end", "def write_mask=(arr) # :nodoc:\n @write_mask = transform_fields('write_mask',arr)\n end", "def write_mask\n @write_mask.dup\n end", "def set_flags(flags)\n @modifiers = flags & (MK_SHIFT | MK_CONTROL | MK_ALT | MK_COMMAND)\n self.show_prompt\nend", "def test_that_masking_works\n end", "def is_mask?(); @type == GRT_MASK; end", "def attr_masker_options\n @attr_masker_options ||= superclass.attr_masker_options.dup\n end", "def flags_clear!()\n @flags = 0\n end", "def no_scale_mask=(scale_mask)\n end", "def generate_mask(code, params, password)\n raise InvalidParametersError, 'Invalid flags' unless params.existing_mode?\n impl(params).generate(code, params, password)\n end", "def mask\n raw_value\n end", "def add_mask(mod)\n\n unless const_defined? \"MASKS\"\n const_set(\"MASKS\",Hash.new)\n end\n\n unless const_defined? \"MASK_INFO\"\n const_set(\"MASK_INFO\",Hash.new)\n end\n\n unless const_defined? \"Masked\"\n const_set(\"Masked\",Module.new)\n end\n\n tmod = mod.name.gsub(\"::\",\"_\")\n\n cln = mod.clone\n\n self::Masked.const_set(tmod,cln)\n\n trans = []\n\n cln.instance_methods(false).each do |m|\n meth = m.to_sym\n masked_name = \"__#{tmod}_#{(mod.object_id + cln.object_id).abs}_#{m}\".to_sym\n\n self::MASK_INFO[masked_name] = mod\n\n trans << [meth, masked_name]\n\n cln.module_eval <<-CODE\n alias #{masked_name} #{meth}\n remove_method(:#{meth})\n CODE\n end\n\n module_eval { include cln }\n\n trans.each do |t|\n name, meth = t[0], t[1]\n\n cln_method = cln.instance_method(meth)\n self::MASK_INFO[cln_method] = self::MASK_INFO[meth]\n self::MASK_INFO.delete meth\n\n cln.module_eval \"remove_method :#{meth}\"\n\n if self::MASKS.key? name\n self::MASKS[name].unshift cln_method\n else\n original_method = instance_method(name)\n self::MASKS[name] = [cln_method, original_method]\n self::MASK_INFO[original_method] = self\n\n module_eval(<<-CODE,\"maskable.rb\",70)\n if instance_methods.include? \"#{name}\"\n remove_method :#{name}\n end\n\n def #{name}(*a,&b)\n mk = Method::Mask.new(:#{name}, self, \n self.class::MASKS[:#{name}], a, b)\n if Thread.current['__running_mask']\n Thread.current['__running_mask'] << mk\n else\n Thread.current['__running_mask'] = [mk]\n end\n \n return Method.rest\n ensure\n if Thread.current['__running_mask'].size == 1\n Thread.current['__running_mask'] = []\n else\n Thread.current['__running_mask'].pop\n end\n end\n\n CODE\n end\n end\n end", "def flags=(lst); dirty!; super; end", "def mask\n (@bound_fields + @unbound_fields + @operands).map do |(field,_)|\n WordField[field].mask\n end.inject do |memo,field_mask|\n memo | field_mask\n end\n end", "def set_netmask(opts)\n opts = check_params(opts,[:admin_ips,:netmasks])\n super(opts)\n end", "def read_mask=(arr) # :nodoc:\n @read_mask = transform_fields('read_mask',arr)\n end", "def masked_val(value, mask)\n \nend", "def general_purpose_flags\n 0b0000000000000000\n end", "def wildmask\n super\n end", "def mask(number)\n number.to_s.chars.map(&:to_i).each do |digit|\n @data[digit] = true\n end\n self\n end", "def reset_mask_for column_name, *fields\n fields = bitfields if fields.empty?\n max = bitfield_max(column_name)\n (0..max).sum{|i| 2 ** i} - only_mask_for(column_name, *fields)\n end", "def mask\n @mask ||= self.class.masks[depth]\n end", "def update!(**args)\n @masking_character = args[:masking_character] if args.key?(:masking_character)\n end", "def flags=(flags)\n if FFI::Libmagic.magic_setflags(_cookie, flags) < 0\n raise(FlagError, lasterror())\n end\n end", "def read_mask\n @read_mask.dup\n end", "def flags_resync\n if @flags\n self.class.flag_def.each do |f|\n sym = (f.flag_type=='Symbol' ? f.flag_name.to_sym : f.flag_name)\n i,p,v = self.class.index_position_value(f.position)\n sn=self.send(\"flags_#{i}\")||0\n b = sn & v > 0\n logger.warn \"#{@flags[sym].class} value '#{@flags[sym]}' for flag #{self.class}->#{sym} will be stored as true, not '#{@flags[sym]}'\" unless FlaggableTypes.include?(@flags[sym].class)\n if @flags[sym] && !b\n self.send(\"flags_#{i}=\",sn+v)\n elsif b && !@flags[sym]\n self.send(\"flags_#{i}=\",sn-v)\n end\n end\n end\n @flags\n end", "def preserve_flags\n orig = []\n each do |bit|\n orig << [bit.overlay_str, bit.is_to_be_read?, bit.is_to_be_stored?]\n end\n yield\n each do |bit|\n bit.clear_flags\n flags = orig.shift\n bit.overlay(flags[0])\n bit.read if flags[1]\n bit.store if flags[2]\n end\n self\n end", "def notifyflags=(notify_flags)\r\n\t\t\t`#{BITS::BITSADMIN} /setnotifyflags {#{@id}} #{notify_flags}`\r\n\t\tend", "def whitelisted_flags\n flags.select &:allowed\n end", "def clear_flags\n @regs.each(&:clear_flags)\n end", "def reset_flags\n @flags[:chat?] = false\n @flags[:graphic?] = false\n @flags[:animation?] = false\n #@flags[:state?] = false\n @flags[:region?] = false\n @flags[:forced_chat?] = false\n @flags[:teleport?] = false\n @flags[:moved?] = false\n end", "def mask\n # + - - - - - - - - - - - - - - - +-------------------------------+\n # | |Masking-key, if MASK set to 1 |\n # +-------------------------------+-------------------------------+\n # | Masking-key (continued) | Payload Data |\n # +-------------------------------- - - - - - - - - - - - - - - - +\n @mask = get(@need)\n transition(:payload, @payload_length)\n return nil\n end", "def general_purpose_flags\n 0b0000000000000001\n end", "def set_wildcard_mask(mask, bit_flipped=false)\n netmask_int = nil\n if (mask.kind_of?(Integer))\n NetAddr.validate_ip_int(mask,@version)\n netmask_int = mask\n else\n begin\n NetAddr.validate_ip_str(mask,@version)\n netmask_int = NetAddr.ip_str_to_int(mask, @version)\n rescue NetAddr::ValidationError\n raise NetAddr::ValidationError, \"Wildcard Mask must be a valid IPv#{@version} address.\"\n end\n end\n netmask_int = ~netmask_int if (bit_flipped)\n @wildcard_mask = netmask_int\n\n return(nil)\n end", "def netmask(opts)\n opts = check_params(opts,[:admin_ips])\n super(opts)\n end", "def flags=(value)\n if value == @defaults['flags']\n @values.delete 'flags' if @values.key? 'flags'\n else\n @values['flags'] = value\n end\n end", "def clear_flags\n each(&:clear_flags)\n self\n end", "def initialize mask:\n\t\t\t@mask = mask\n\t\t\tsuper dims: mask.dims\n\t\tend", "def set_logical_flags_from(actual_value, size)\n\t\t@flags.set_bit_at(OVERFLOW_FLAG, 0)\n\t\t@flags.set_bit_at(CARRY_FLAG, 0)\n\t\tset_zero_flag_from actual_value\n\t\tset_sign_flag_from actual_value, size - 1\n\t\tset_parity_flag_from actual_value, size\n\tend", "def option_to_mask(options, all_options)\n mask = 0\n options.each do |key|\n if all_options.keys.include?(key)\n mask = mask | all_options[key]\n else\n raise \"option not supported: #{key}. must be one of: #{all_options.keys}\"\n end\n end\n mask\n end", "def flags=(val)\n @val = val\n end", "def mask(a, b)\n a ^ b\n end", "def mask(payload, mask)\n return mask_native(payload, mask) if respond_to?(:mask_native)\n result = []\n payload.each_with_index do |byte, i|\n result[i] = byte ^ mask[i % 4]\n end\n result\n end", "def bitmask\n @_bitmask = Socket.net2bitmask(self.netmask) if (@_bitmask == nil)\n @_bitmask\n end", "def test_that_unmasking_works\n end", "def erode mask\n morph mask, :erode\n end", "def bits_to_mask(nm)\n\t\treturn(0) if (nm == 0)\n\t\tm = 2**32-1\n\t\treturn( m ^ (m >> nm) )\n\tend", "def bits_to_mask(nm)\n\t\treturn(0) if (nm == 0)\n\t\tm = 2**32-1\n\t\treturn( m ^ (m >> nm) )\n\tend", "def mask_bits\n mask_bits = 0\n shifted_mask = @mask_addr\n (1..32).each do |_i|\n mask_bits += 1 if (shifted_mask & 0x1) == 1\n shifted_mask = shifted_mask >> 1\n end\n return mask_bits\n end", "def flags=(flag)\n @captured_in = zone_id | (flag & 0xFFFF_0000)\n end", "def set(attr, value)\n raise ArgumentError, \"unknown attribute: #{attr}\" unless @masks[attr]\n case value\n when true\n @data |= @masks[attr]\n when false\n @data &= ~@masks[attr]\n end\n self\n end", "def mask_array\n @mask.split('')\n end", "def disable_flag(*flags)\n check_definition_state(is_arg: true)\n flags = flags.uniq\n intersection = @used_flags & flags\n unless intersection.empty?\n raise ToolDefinitionError, \"Cannot disable flags already used: #{intersection.inspect}\"\n end\n @used_flags.concat(flags)\n self\n end", "def flags\n @values.fetch('flags') { \n @values['flags'] = nil\n }\n end", "def reset_bitfields column_name, *fields\n mask = reset_mask_for column_name, *fields\n update_all \"#{column_name} = #{column_name} & #{mask}\"\n end", "def disable_flag(flag, colmn = nil)\n colmn = determine_flag_colmn_for(flag) if colmn.nil?\n self.class.check_flag(flag, colmn)\n\n set_flags(flags(colmn) & ~self.class.flag_mapping[colmn][flag], colmn)\n end", "def clear_flags\n @flags = 0\n write\n end", "def update!(**args)\n @result_mask = args[:result_mask] if args.key?(:result_mask)\n end", "def flags=(flags)\n self.flag_attr = flags.map{|flag| flag.to_s}.join(\", \");\n end", "def true_offset=(val)\n self.offset_flags = (offset_flags & 0xffff) | (val << 16)\n end", "def wildcard_mask\n if self.ipv4?\n (@mask_addr ^ IPAddr::IN4MASK).to_ip\n else\n (@mask_addr ^ IPAddr::IN6MASK).to_ip\n end\n end", "def flags; end", "def off_tags res, item\n @mask ^= item.turn_off\n\n super\n end", "def mask=(on)\n raise ArgumentError(\"not a boolean\") unless [true, false].include?(on)\n command(\"ISMA\", on ? \"1\" : \"2\")\n request(\"IS\", \"MA\")\n end", "def mask_params\n params.require(:mask).permit(:phone_number, :number_id)\n end", "def extended()\n\t\t\tUtil.int_to_IPv4(@mask)\n\t\tend", "def decode_mask(data)\n # Mask\n byte_tmp = data.getbyte\n is_masked = byte_tmp & 0b10000000\n raise Midori::Error::NotMasked unless is_masked == 128\n # Payload\n payload = byte_tmp & 0b01111111\n mask = Array.new(4) { data.getbyte }\n # Message\n masked_msg = Array.new(payload) { data.getbyte }\n @msg = masked_msg.each_with_index.map { |byte, i| byte ^ mask[i % 4] }\n @msg = @msg.pack('C*').force_encoding('utf-8') if [0x1, 0x9, 0xA].include?opcode\n # For debug\n # data.rewind\n # data.bytes {|byte| puts byte.to_s(16)}\n end", "def flags=(values)\n val = 0\n FRAME_FLAGS_MAP.values_at(*values).each { |c|\n val |= c if c\n }\n @flags_value = val\n end", "def set_flags( *flag_symbols )\n\t\t\tflag_symbols.flatten!\n\t\t\tflag_symbols.compact!\n\n\t\t\tself.log.debug \"Setting flags for symbols: %p\" % [ flag_symbols ]\n\n\t\t\tflag_symbols.each do |flag|\n\t\t\t\tcase flag\n\t\t\t\twhen :fin, :rsv1, :rsv2, :rsv3\n\t\t\t\t\tself.__send__( \"#{flag}=\", true )\n\t\t\t\twhen :continuation, :text, :binary, :close, :ping, :pong\n\t\t\t\t\tself.opcode = flag\n\t\t\t\twhen Integer\n\t\t\t\t\tself.log.debug \" setting Integer flags directly: %#08b\" % [ flag ]\n\t\t\t\t\tself.flags |= flag\n\t\t\t\twhen /\\A0x\\h{2}\\z/\n\t\t\t\t\tval = Integer( flag )\n\t\t\t\t\tself.log.debug \" setting (stringified) Integer flags directly: %#08b\" % [ val ]\n\t\t\t\t\tself.flags = val\n\t\t\t\telse\n\t\t\t\t\traise ArgumentError, \"Don't know what the %p flag is.\" % [ flag ]\n\t\t\t\tend\n\t\t\tend\n\t\tend", "def set?(num, mask)\n (num & mask) != 0\nend", "def mask=(theMask)\n if theMask.respond_to? \"maskhash\"\n theMask = theMask.maskhash\n end\n @elementHash[:applyimagemask] = theMask\n end", "def set_network_mask_len(v)\n Saklient::Util::validate_type(v, 'Fixnum')\n raise Saklient::Errors::SaklientException.new('immutable_field', 'Immutable fields cannot be modified after the resource creation: ' + 'Saklient::Cloud::Resources::Router#network_mask_len') if !@is_new\n @m_network_mask_len = v\n @n_network_mask_len = true\n return @m_network_mask_len\n end", "def unflag\n @flagged != @flagged = false\n end", "def maskhash\n return @maskhash\n end", "def pack_flags(flags)\n FLAGS.each_with_index.inject(0) do |memo,(key,i)|\n memo |= i if flags[key]\n memo\n end\n end", "def unmask_protected_sequences\n @str.gsub!(/(.)#{PROTECT_ATTR}/, \"\\\\1\\000\")\n end", "def ~()\n newval = (~ @value) & self.mask\n bounded? ? self.class.new(newval, @length) : self.class.new(newval)\n end", "def remove_flag(pos)\n tile = get_tile(pos)\n unless tile.revealed && !tile.flagged\n tile.flagged = false\n true \n else \n false \n end \n end", "def flags(*args)\n Boxen::Flags.new *args\n end", "def setCFlags(flags) @CFLAGS = ensureArray(flags) end", "def flags #:nodoc:\n @flags ||= {}\n end", "def server_flags; end", "def reset_sync_flags\n PiLib .dlp_ResetSyncFlags(@sd, @db)\n return self\n end", "def flags\n @flags ||= Set.new([])\n end" ]
[ "0.7003532", "0.6814202", "0.66662574", "0.6605281", "0.6500882", "0.64192605", "0.64068455", "0.6384925", "0.6317895", "0.6238115", "0.6238115", "0.62272185", "0.62259436", "0.6225939", "0.6206085", "0.6175929", "0.6127259", "0.6078628", "0.6033596", "0.59747803", "0.59680444", "0.59488606", "0.59333956", "0.5925027", "0.5906528", "0.59019196", "0.58683205", "0.5850348", "0.5814293", "0.5801071", "0.57921886", "0.5788899", "0.57466334", "0.56798273", "0.566057", "0.56441987", "0.5631885", "0.5583527", "0.5578327", "0.55738264", "0.5561911", "0.5561688", "0.55579764", "0.5557482", "0.5556892", "0.5547915", "0.55351365", "0.55199075", "0.55000347", "0.5481461", "0.5471868", "0.5450372", "0.54485744", "0.5434209", "0.5428187", "0.5426667", "0.5424664", "0.5421552", "0.5419428", "0.5411838", "0.5398663", "0.53863615", "0.5353186", "0.5353186", "0.53470093", "0.5340505", "0.5339665", "0.53389543", "0.53351617", "0.53164697", "0.5295657", "0.52699304", "0.5261458", "0.5255409", "0.52538687", "0.52448076", "0.52443725", "0.5232303", "0.52291304", "0.5227739", "0.52024657", "0.5181032", "0.51786745", "0.51672786", "0.5157803", "0.51555055", "0.5142294", "0.513655", "0.51102203", "0.5107071", "0.5085376", "0.5051398", "0.50434816", "0.5041429", "0.5039553", "0.5027357", "0.5022517", "0.50169736", "0.50152206", "0.49879044" ]
0.8143703
0
current_item_enabled? Get Activation State of Selection Item
def current_item_enabled? enable?(@data[index]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_item_enabled?\n true\n end", "def current_item_enabled?\r\n current_data ? current_data[:enabled] : false\r\n end", "def current_item_enabled?\n current_data ? current_data[:enabled] : false\n end", "def current_item_enabled?\n return true\n end", "def current_item_enabled?() target end", "def current_item_enabled?\n enabled?(index)\n end", "def current_item_enabled?\r\n enable?(index)\r\n end", "def current_item_enabled?\n enable?(@data[@index])\n end", "def current_item_enabled?\n enable?(@index)\n end", "def can_activate?(item)\r\n item.activatable_by?(self)\r\n end", "def current_item_enabled?\n true#enable?(@data[index])\n end", "def can_activate?(item)\n item.activatable_by?(self)\n end", "def current_item_enabled?\n return !@data[index].nil?\n end", "def selected\n @selected\n end", "def selected?\n return @selected\n end", "def status\n super || ListItem.active_status\n end", "def selected?\n @selected\n end", "def selected\r\n #TODO: find a way to not need to expand and collapse before getting the selected item\r\n expand_combo\r\n collapse_combo\r\n #get_selection.first\r\n get_selection.first\r\n end", "def active?\n activated == true\n end", "def has_selected?\n selected?\n end", "def active\n active?\n end", "def active?\n active\n end", "def pending?\r\n @activated\r\n end", "def get_active_items\r\n self.items.select { |i| i.active? } #TODO only fixed or only auction\r\n end", "def active?\n @active.value\n end", "def active?; @active; end", "def active?; @active; end", "def active?\n return @active\n end", "def get_active_items\n self.items.select { |i| i.active? } #TODO only fixed or only auction\n end", "def enable?(item)\n item.enabled?\n end", "def enable?(item)\n item.enabled?\n end", "def selected\n find(&:selected?)\n end", "def state_has_items\n\t\t\t@form.listStack.setCurrentIndex(0)\n\t\tend", "def pending?\n @activated\n end", "def active?\n active\n end", "def active?\n active\n end", "def active?\n active\n end", "def active?\n active\n end", "def enable?(item); true; end", "def active_item_type\n sorted_item_types.find(&method(:active?))\n end", "def active?\n self.active\n end", "def active?\n self.active\n end", "def pending?\n @activated\n end", "def pending?\n @activated\n end", "def pending?\n @activated\n end", "def pending?\n @activated\n end", "def pending?\n @activated\n end", "def pending?\n @activated\n end", "def pending?\n @activated\n end", "def pending?\n @activated\n end", "def active?\n @active\n end", "def active?\n active\n end", "def pending?\n @activated\n end", "def active_item\n return @active_item if @active_item\n # Simple configuration means that name is returned immediately\n @active_item = get_value(controller_active_item_config)\n\n # If the configuration is a Hash then we need to find the first\n # menu item that has a passing condition\n if @active_item.is_a? Hash\n @active_item.each do |condition, key|\n @active_item = key and break if @template.instance_eval(condition)\n end\n end\n @active_item\n end", "def select_item\n @selected = @current\n\n items\n end", "def active?\n @active\n end", "def active?\n @active\n end", "def active?\n @active\n end", "def enable?(item)\n true\n end", "def enable?(item)\n true\n end", "def selected?; end", "def selected?; end", "def selected?\n element(true).isSelected()\n end", "def item_selected=(value)\n @item_selected = value\n end", "def selected; end", "def active_items\n @items.values.select { |value| value.state == :active || value.state == :auction}\n end", "def selected?; false; end", "def selected?; false; end", "def active?\n @state.active?\n end", "def active?\n @active\n end", "def active?\n @active\n end", "def active?\n @active\n end", "def enable?(item)\n end", "def active?\n enabled\n end", "def active?\n @data[:active]\n end", "def active?\n\t\t\tstate == 'active'\n\t\tend", "def became_active?\n active_changed? && active\n end", "def active?; status == :active; end", "def enable?(item)\n return true\n end", "def enable?(item)\n return true\n end", "def editable?\r\n self.is_active?\r\n end", "def get_item_from_sellable_state(inventory_item_params)\n initial_condition = inventory_item_params[:inventory_item_condition_id]\n inventory_item_in_sellable_state = get_item_in_this_state(inventory_item_params, \"Available\")\n if inventory_item_in_sellable_state.nil?\n inventory_item_in_sellable_state = get_item_in_this_state(inventory_item_params, \"Critical_Level\")\n end\n if inventory_item_in_sellable_state.nil?\n inventory_item_params[:inventory_item_condition_id] = InventoryItemCondition.find_by(name: \"Not_Sellable\" ).id\n inventory_item_in_sellable_state = get_item_in_this_state(inventory_item_params, \"Out_of_Stock\")\n inventory_item_params[:inventory_item_condition_id] = initial_condition\n end\n return inventory_item_in_sellable_state\n end", "def selected?\n native.has_attribute?('selected')\n end", "def is_active\n return @is_active\n end", "def is_active\n return @is_active\n end", "def item_choice?\r\n @item_choice_variable_id > 0\r\n end", "def active?\n\t\tactive\n\tend", "def active?\n if is_active\n return true\n else\n return false\n end\n end", "def get_selected_item\n @items[@selected_slot]\n end", "def selected_item\n get_content()[focussed_index()]\n end", "def active?\n\t\tstatus == STATUSES[2]\n\tend", "def selected\r\n assert_exists\r\n #@option.selected\r\n option_selected\r\n end", "def active?\n true\n end", "def currently_active\n # check if tag is active\n if self.active == false\n return false\n end\n \n # check if time based activation is active\n if self.active_time\n unless current_time_active\n return false\n end\n end\n \n # check if date based activation is action\n if self.active_date\n unless current_date_active\n return false\n end\n end\n \n return true\n end", "def active?\n if is_active\n return true\n else\n return false\n end\n end" ]
[ "0.74860334", "0.7435893", "0.7426056", "0.7353028", "0.7345886", "0.71996814", "0.71095306", "0.69557726", "0.6944723", "0.6813259", "0.676741", "0.6703807", "0.6647579", "0.6625739", "0.660995", "0.6595868", "0.6475963", "0.6472574", "0.6424648", "0.63654745", "0.63617396", "0.6348807", "0.63390493", "0.6328583", "0.6324583", "0.63228786", "0.63228786", "0.63049144", "0.6301066", "0.6298472", "0.6298472", "0.6282103", "0.6264116", "0.625938", "0.6250477", "0.6250477", "0.6250477", "0.6250477", "0.6249589", "0.62327516", "0.622891", "0.622891", "0.62261486", "0.6211896", "0.6211896", "0.6211896", "0.6211896", "0.6211896", "0.6211896", "0.6211896", "0.62110496", "0.619097", "0.618175", "0.6173871", "0.6166699", "0.6163941", "0.6163941", "0.6163941", "0.616262", "0.616262", "0.61602914", "0.61602914", "0.61395085", "0.6132697", "0.61243683", "0.6124066", "0.61021", "0.61021", "0.6099272", "0.6087151", "0.6087151", "0.6087151", "0.60744536", "0.60592484", "0.60590327", "0.6054572", "0.605044", "0.60295826", "0.59916735", "0.59916735", "0.59824795", "0.59811497", "0.597401", "0.5968607", "0.5968607", "0.5961897", "0.59585875", "0.5956475", "0.59556884", "0.5940636", "0.59374994", "0.59278286", "0.5914341", "0.59074193", "0.5903815" ]
0.69458383
12
enable? Display in Enabled State?
def enable?(item) return false if item.nil? return false if $game_party.gold < item.dismantle_gold_fee return item.dismantlable? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enabled; end", "def enabled; end", "def enabled; end", "def enabled; end", "def enabled\n\t\ttrue\n\tend", "def enable=(value); self.is_enable = value end", "def enabled_state\n super\n end", "def enabled_state\n super\n end", "def enabled_state\n super\n end", "def enabled_state\n super\n end", "def enabled_state\n super\n end", "def enabled_state\n super\n end", "def set_enabled\n\t\t\tself.enabled = true\n\t\tend", "def enabled?; end", "def enabled?; end", "def enable\n @enabled = true\n end", "def enabled?\n true\n end", "def enable\n end", "def enable!\n self.enabled = true\n end", "def enable\n end", "def enabled?\n true\n end", "def enabled?\n true\n end", "def enabled; self.settings[:enabled]; end", "def enabled!\n self\n end", "def enabled(value)\n @ole.Enabled = value\n nil\n end", "def active?\n enabled\n end", "def enabled!\n self\n end", "def set_Enable(value)\n set_input(\"Enable\", value)\n end", "def enabled\n @ole.Enabled\n end", "def enabled?\n false\n end", "def enabled?\n false\n end", "def visuals_enabled(value)\n @ole.VisualsEnabled = value\n nil\n end", "def enable(thing)\n toggle.enable(thing)\n end", "def enabled=(_arg0); end", "def enabled=(_arg0); end", "def enabled=(_arg0); end", "def enabled=(_arg0); end", "def enabled=(_arg0); end", "def enabled?\n !disabled?\n end", "def enabled?\n !disabled?\n end", "def enabled\n @mutex.synchronize { !!@enabled }\n end", "def enabled\n @mutex.synchronize { !!@enabled }\n end", "def enabled\n @mutex.synchronize { !!@enabled }\n end", "def enabled?\n return enabled\n end", "def enable!\n @active = true\n change_status(:wait)\n end", "def enable_rendering\n\t\t@rendering_enabled = true\n\tend", "def enabled?\n @enabled\n end", "def enabled?\n @enabled\n end", "def enabled?\n @enabled\n end", "def enabled?\n @enabled\n end", "def enabled?\n state.nonzero?\n end", "def enabled=(value)\n @enabled = value\n end", "def enabled=(value)\n @enabled = value\n end", "def enabled=(value)\n @enabled = value\n end", "def enable\n exclusively do\n @enabled = true\n @manual_toggle = true\n end\n\n save_state\n\n sync_control do\n start_upkeep unless upkeep_running?\n end\n end", "def enable_current\n @disabled = false\n end", "def enabled?(*)\n true\n end", "def enable!; end", "def enabled?\n @enabled != false\n end", "def disabled; end", "def enabled?()\n #This is a stub, used for indexing\n end", "def enabled?\n @enabled || false\n end", "def is_enabled=(value)\n @is_enabled = value\n end", "def is_enabled=(value)\n @is_enabled = value\n end", "def is_enabled=(value)\n @is_enabled = value\n end", "def is_enabled=(value)\n @is_enabled = value\n end", "def is_enabled=(value)\n @is_enabled = value\n end", "def is_enabled=(value)\n @is_enabled = value\n end", "def is_enabled=(value)\n @is_enabled = value\n end", "def smart_enable\n set_player_follower_particles(true)\n $game_switches[Sw::FM_Enabled] = $game_switches[Sw::FM_WasEnabled]\n end", "def disabled?; end", "def disabled?; end", "def manual_enabled?\n return true\n end", "def enable_disable_str\n if helper_enabled?\n 'Disable'\n else\n 'Enable'\n end\n end", "def enabled?\n \n return @enabled\n \n end", "def enabled?\n \n return @enabled\n \n end", "def enabled\n return @enabled\n end", "def enabled\n return @enabled\n end", "def enabled\n return @enabled\n end", "def enabled\n @attributes[:enabled]\n end", "def enabled?\n !!@enabled\n end", "def enabled?\n !!@enabled\n end", "def enabled?\n !!@enabled\n end", "def show\n self.visible = true\n end", "def enabled=(value)\n # Coerce to boolean\n @enabled = (value == true)\n end", "def enabled=(value)\n # Coerce to boolean\n @enabled = (value == true)\n end", "def enabled?\n state.eql? 'active'\n end", "def toggle_rendering\n\t\t@rendering_enabled = !@rendering_enabled\n\tend", "def stp_enabled_state\n super\n end", "def enable?(item)\n item.enabled?\n end", "def enable?(item)\n item.enabled?\n end", "def enabled=(value)\n store[:enabled] = value\n end", "def enabled?\n $game_switches[Yuki::Sw::Nuzlocke_ENA]\n end", "def enable\n\n @enabled = true\n\n return self\n\n end", "def enabled\n !false?(configuration[:enabled])\n end", "def disabled?\n false\n end", "def enable!\n events.compliance_input_enabled(self)\n @enabled = true\n end", "def enabled?\n enabled.nil? || enabled\n end", "def enabled?\n\n return @enabled\n\n end", "def enabled\n select(&:enabled?)\n end", "def displayed?; end" ]
[ "0.7351811", "0.7351811", "0.7351811", "0.7351811", "0.7288546", "0.7189319", "0.71890163", "0.71890163", "0.71890163", "0.71890163", "0.71890163", "0.71890163", "0.71865124", "0.7181389", "0.7181389", "0.7163995", "0.7088384", "0.69797695", "0.6968339", "0.6928011", "0.68663853", "0.68663853", "0.68610716", "0.6835398", "0.673105", "0.6698944", "0.6693775", "0.6680133", "0.66642064", "0.6615489", "0.66093844", "0.6506436", "0.65002126", "0.6493601", "0.6493601", "0.6493601", "0.6493601", "0.6493601", "0.64698046", "0.64698046", "0.64334494", "0.64334494", "0.64334494", "0.64004976", "0.63707024", "0.63666904", "0.6361438", "0.6361438", "0.6361438", "0.6361438", "0.6358235", "0.6347761", "0.6347761", "0.6347761", "0.63308495", "0.63094777", "0.629344", "0.6285859", "0.6280159", "0.6251723", "0.62463635", "0.6241463", "0.6230515", "0.6230515", "0.6230515", "0.6230515", "0.6230515", "0.6230515", "0.6230515", "0.62253803", "0.6222125", "0.6222125", "0.6204586", "0.6199127", "0.6185937", "0.6185937", "0.6176633", "0.6176633", "0.6176633", "0.61424965", "0.6141671", "0.6141671", "0.6136698", "0.6119899", "0.6111584", "0.6111584", "0.6101322", "0.60752404", "0.6074577", "0.60705495", "0.60705495", "0.60662335", "0.6057884", "0.6050588", "0.6041394", "0.60298586", "0.60281944", "0.6023234", "0.6013423", "0.60093415", "0.60017693" ]
0.0
-1
include? Include in Item List?
def include?(item) case @category when :item item.is_a?(RPG::Item) && !item.key_item? && item.dismantlable? when :weapon item.is_a?(RPG::Weapon) && item.dismantlable? when :armor item.is_a?(RPG::Armor) && item.dismantlable? when :key_item item.is_a?(RPG::Item) && item.key_item? && item.dismantlable? else false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def include item\n\tend", "def include?(item)\n end", "def include?(item)\n return true\n end", "def includes item\n msg = \"#{self} did not include #{item}\"\n check_if self.include?(item), msg\n end", "def include?(item)\n self.__contains__(item).rubify\n end", "def includes\n end", "def includes\n end", "def include?(item)\n ! get(item).nil?\n end", "def includes() return @includes end", "def include?(item)\n return false if item.nil?\n return true\n end", "def include_item(identifier)\n if item = lookup_item(identifier)\n item.compiled_content\n end\nend", "def include?(name)\n items.include?(coerce_name(name))\n end", "def include?(item)\n return false if item.nil?\n return include_recipebook?(item) if item.recipebook?\n return false\n end", "def include?(key)\n @item.key?(key)\n end", "def include?(key)\n @item.key?(key)\n end", "def include?(item)\n return item != nil\n end", "def include inc\n @includes << inc\n end", "def add_include include\n add_to @includes, include\n\n include\n end", "def add_include(include)\n add_to @includes, include\n end", "def include?(item)\r\r\n item[:discovered]\r\r\n end", "def include? item\n @succ.include? item\n end", "def include(*args)\n include_or_extend(:include, *args)\n end", "def include; end", "def include; end", "def include_line_items?\n scope && scope[:include_line_items]\n end", "def model_includes\n if @include_param.nil?\n @include_param = []\n else\n if check_two_level\n model_includes_single_or_multiple_two_level_resources\n #duplicate_item\n else\n model_includes_single_or_multiple_three_level_resources\n end\n end\n end", "def include?(item)\n ret = false\n @resources.each{ |rsc| ret = true if rsc == item }\n @authors.each{ |auth| ret = true if auth == item } unless ret \n ret\n end", "def includes?(data)\n list.includes?(data)\n end", "def include?(item)\r\n $game_party.usable?(item)\r\n end", "def assert_included(collection, item)\n assert_block \"#{collection} was expected to include #{item} but does not.\" do\n collection.include?(item)\n end\n end", "def include?(arr, include_item)\n arr.each { |item| return true if item == include_item }\n false\nend", "def included(*args)\n quando_incluso *args\n end", "def show\n @include_order_items = true\n end", "def include(mod,*more) end", "def included_in\n @included_in ||= []\n end", "def test_0210_includeq\n @@log.debug \"test_0210_includeq starts\" if @@log.debug?\n assert_respond_to(@list, :include?, \"test_0210_includeq_respond\")\n # Test does include\n assert(@list.include?(@bsb),\"test_0210_includeq_basic\")\n # Test does not include\n ta = Person.new(\"A\", \"B\", \"C\", 456)\n assert(@list.include?(ta) == false,\"test_0210_includeq_backwards\")\n\n @@log.debug \"test_0210_includeq ends\" if @@log.debug?\n end", "def add_include(include)\n @includes << include\n end", "def add_includes(inc)\r\n return if inc.nil?\r\n \r\n inc = [inc] if (!inc.respond_to?(:each) || inc.kind_of?(String))\r\n \r\n if inc.include?(:all)\r\n ole_methods.each do |m|\r\n m = m.to_s\r\n if m =~ /\\AInclude/ && m != 'IncludeRetElementList'\r\n @request.__send__(\"#{m.underscore}=\", true)\r\n end\r\n end\r\n return\r\n end\r\n \r\n inc.each do |item|\r\n cam_item = item.to_s.camelize.gsub(/Id/, \"ID\")\r\n if @request.respond_to_ole?(\"Include#{cam_item}\")\r\n @request.__send__(\"include_#{item}=\", true)\r\n else\r\n @request.IncludeRetElementList.Add(cam_item)\r\n end\r\n end\r\n end", "def include?(name)\n includes?(name)\n end", "def fetch_produce_items\r\n all_items = read_table('SRCFILE')\r\n included_ids = File.readlines(File.join('data', 'included.txt')).map(&:chomp)\r\n\r\n @items = all_items.select do |i|\r\n included_ids.include?(i.id)\r\n end\r\nend", "def include_ids?(item_ids)\n all_item_ids == item_ids\n end", "def include?(el)\n list.include?(el)\n end", "def includes(*args)\n @options[:include] ||= []\n @options[:include] |= args\n end", "def include?(key)\n # Ensure a Ruby true is returned\n item_exists(key) == true\n end", "def include? item\n return index_of(item) != nil\n end", "def include_related_content(val)\n add_actions \"includerelatedcontent(#{val})\"\n end", "def included; end", "def include?(name); end", "def includes\n []\n end", "def includes\n @includes ||= params[:include].to_s.split(',')\n end", "def test_include\n list = []\n list << 'xyz'\n assert_includes list, 'xyz'\n end", "def included(descendant); end", "def included(descendant); end", "def include?(element)\n @element_list.include? element\n end", "def include(*i)\n @includes |= i.flatten\n end", "def include?(something); end", "def include?(object)\n each {|item| return true if item == object }\n false\n end", "def test_include?\n assert_includes list, 'xyz'\nend", "def include?(entry)\n entries.include?(entry)\n end", "def include?(item)\n @queue.include?(item)\n end", "def include_strategy\n :includes\n end", "def include?(item_id_type, item_id)\n active?( item_id_type, item_id ) ||\n saved_for_later?( item_id_type, item_id )\n end", "def includes(options)\n @includes = options\n end", "def include? entity, user_or_id, with_pullins=true\n # Trivial accept if the entity is physically in among the list items\n return true if @list.stores? entity\n user_id = user_or_id.is_a?(Integer) ? user_or_id : user_or_id.id\n ts = TaggingServices.new entity\n # It's included if the owner or this user has tagged it with the name tag\n return true if ts.exists? @list.name_tag_id, (user_id == @list.owner_id ? user_id : [user_id, @list.owner_id])\n # If not directly tagged, it's included if it's tagged with any of the list's tags, BY ANYONE (?)\n return false unless with_pullins && @list.pullin\n ts.exists? pulled_tag_ids\n end", "def include?\n @options[:include]\n end", "def link_include_object(obj); end", "def link_include_object(obj); end", "def includes\n @include_ids.collect { |idx| BInclude.store[idx] }\n end", "def idl_includes(*incs)\n @recipe.idl_includes << incs.flatten.compact\n end", "def includes(*args)\n config.includes.push *args\n end", "def set_Include(value)\n set_input(\"Include\", value)\n end", "def set_Include(value)\n set_input(\"Include\", value)\n end", "def set_Include(value)\n set_input(\"Include\", value)\n end", "def containments\n item.containments\n end", "def include? array, item\n array.include?(item)\nend", "def add_to_list(item, grocery_list)#add item and grocery_list to method\n if grocery_list.include?(item)#check if item is on list\n puts \"#{item} is already on your list\"#if item on list\n else\n grocery_list.push(item)#push new items to grocery list\n end\nend", "def include(*args)\n include_private(*args)\n end", "def included(othermod) end", "def each_include # :yields: include\n @includes.each do |i| yield i end\n end", "def each_include # :yields: include\n @includes.each do |i| yield i end\n end", "def include?(list,tst)\n list.each {|itm| return true if itm == tst}\n false\nend", "def include?(key)\n\t\t\t\tsuper || @l2.include?(key)\n\t\t\tend", "def includes\n @spec['includes'].dup.concat(@type.includes)\n end", "def included(mod); end", "def include?(key); end", "def include?(key); end", "def test_not_included\n refute_includes(list, 'xyz')\nend", "def include?(p_item)\n target = Regexp.new(p_item,'i') # create regular expression for case-insensitive comparison\n for itm in self.prescription_items\n return itm if target =~ itm.drug\n end\n return nil\n end", "def include?(value)\n element.include? value\n end", "def add(item)\n @items << item unless include?(item)\n end", "def add_include(path)\n @includes << path\n end", "def add_include(path)\n @includes << path\n end", "def include?(el)\n store.include?(el)\n end", "def include?(item, *args, &block)\n if @category == :all\n return true\n elsif ![:item, :weapon, :armor, :none].include?(@category) && item.is_a?(RPG::BaseItem)\n return item.masai_special_categories.include?(@category)\n else\n super(item, *args, &block)\n end\n end", "def item_included?(str, arr)\n arr.each do |item|\n return true if item == str\n end\n false\nend", "def set_item_not_included\n @item_not_included = ItemNotIncluded.find(params[:id])\n end", "def add_includes out, includes\n return if includes.empty?\n out << RDoc::Markup::Rule.new(1)\n out << RDoc::Markup::Heading.new(1, \"Includes:\")\n includes.each do |modules, store|\n if modules.length == 1 then\n include = modules.first\n name = include.name\n path = store.friendly_path\n out << RDoc::Markup::Paragraph.new(\"#{name} (from #{path})\")\n if include.comment then\n out << RDoc::Markup::BlankLine.new\n out << include.comment\n end\n else\n out << RDoc::Markup::Paragraph.new(\"(from #{store.friendly_path})\")\n wout, with = modules.partition { |incl| incl.comment.empty? }\n out << RDoc::Markup::BlankLine.new unless with.empty?\n with.each do |incl|\n out << RDoc::Markup::Paragraph.new(incl.name)\n out << RDoc::Markup::BlankLine.new\n out << incl.comment\n end\n unless wout.empty? then\n verb = RDoc::Markup::Verbatim.new\n wout.each do |incl|\n verb.push incl.name, \"\\n\"\n end\n out << verb\n end\n end\n end\n end", "def include?(p0) end", "def include?(p0) end", "def include?(p0) end", "def include?(p0) end" ]
[ "0.8237255", "0.7737315", "0.76933944", "0.7598491", "0.70257956", "0.7013284", "0.7013284", "0.69817686", "0.69424975", "0.6874573", "0.6754231", "0.675245", "0.6732813", "0.66679555", "0.66679555", "0.6592755", "0.6574391", "0.6525474", "0.6447482", "0.64163613", "0.6403947", "0.6372963", "0.6322768", "0.6322768", "0.6286984", "0.62860495", "0.6283053", "0.6270534", "0.6256671", "0.6251902", "0.62505186", "0.62367415", "0.6236186", "0.62002844", "0.61981374", "0.6188668", "0.61812896", "0.6178385", "0.6170052", "0.61687934", "0.61643106", "0.6143985", "0.6133272", "0.6133177", "0.6131288", "0.6114344", "0.61123043", "0.61095977", "0.609777", "0.60956633", "0.6085968", "0.60739064", "0.60739064", "0.60725486", "0.6058628", "0.6056569", "0.60291827", "0.6017001", "0.6001232", "0.6000883", "0.60003144", "0.5974098", "0.597202", "0.5968528", "0.5958556", "0.5958366", "0.5958366", "0.59504914", "0.5944157", "0.59344065", "0.59302545", "0.59302545", "0.59302545", "0.5924868", "0.59192485", "0.5917254", "0.59121054", "0.58909905", "0.587671", "0.587671", "0.58744055", "0.58681226", "0.58591396", "0.58529097", "0.5848953", "0.5848953", "0.58475786", "0.5838999", "0.58382994", "0.582915", "0.5821569", "0.5821569", "0.5808751", "0.5802555", "0.5791706", "0.5790864", "0.5787835", "0.5782315", "0.5782226", "0.5782226", "0.5782226" ]
0.0
-1
enable? Display in Enabled State?
def enable?(item) true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enabled; end", "def enabled; end", "def enabled; end", "def enabled; end", "def enabled\n\t\ttrue\n\tend", "def enable=(value); self.is_enable = value end", "def enabled_state\n super\n end", "def enabled_state\n super\n end", "def enabled_state\n super\n end", "def enabled_state\n super\n end", "def enabled_state\n super\n end", "def enabled_state\n super\n end", "def set_enabled\n\t\t\tself.enabled = true\n\t\tend", "def enabled?; end", "def enabled?; end", "def enable\n @enabled = true\n end", "def enabled?\n true\n end", "def enable\n end", "def enable!\n self.enabled = true\n end", "def enable\n end", "def enabled?\n true\n end", "def enabled?\n true\n end", "def enabled; self.settings[:enabled]; end", "def enabled!\n self\n end", "def enabled(value)\n @ole.Enabled = value\n nil\n end", "def active?\n enabled\n end", "def enabled!\n self\n end", "def set_Enable(value)\n set_input(\"Enable\", value)\n end", "def enabled\n @ole.Enabled\n end", "def enabled?\n false\n end", "def enabled?\n false\n end", "def visuals_enabled(value)\n @ole.VisualsEnabled = value\n nil\n end", "def enable(thing)\n toggle.enable(thing)\n end", "def enabled=(_arg0); end", "def enabled=(_arg0); end", "def enabled=(_arg0); end", "def enabled=(_arg0); end", "def enabled=(_arg0); end", "def enabled?\n !disabled?\n end", "def enabled?\n !disabled?\n end", "def enabled\n @mutex.synchronize { !!@enabled }\n end", "def enabled\n @mutex.synchronize { !!@enabled }\n end", "def enabled\n @mutex.synchronize { !!@enabled }\n end", "def enabled?\n return enabled\n end", "def enable!\n @active = true\n change_status(:wait)\n end", "def enable_rendering\n\t\t@rendering_enabled = true\n\tend", "def enabled?\n @enabled\n end", "def enabled?\n @enabled\n end", "def enabled?\n @enabled\n end", "def enabled?\n @enabled\n end", "def enabled?\n state.nonzero?\n end", "def enabled=(value)\n @enabled = value\n end", "def enabled=(value)\n @enabled = value\n end", "def enabled=(value)\n @enabled = value\n end", "def enable\n exclusively do\n @enabled = true\n @manual_toggle = true\n end\n\n save_state\n\n sync_control do\n start_upkeep unless upkeep_running?\n end\n end", "def enable_current\n @disabled = false\n end", "def enabled?(*)\n true\n end", "def enable!; end", "def enabled?\n @enabled != false\n end", "def disabled; end", "def enabled?()\n #This is a stub, used for indexing\n end", "def enabled?\n @enabled || false\n end", "def is_enabled=(value)\n @is_enabled = value\n end", "def is_enabled=(value)\n @is_enabled = value\n end", "def is_enabled=(value)\n @is_enabled = value\n end", "def is_enabled=(value)\n @is_enabled = value\n end", "def is_enabled=(value)\n @is_enabled = value\n end", "def is_enabled=(value)\n @is_enabled = value\n end", "def is_enabled=(value)\n @is_enabled = value\n end", "def smart_enable\n set_player_follower_particles(true)\n $game_switches[Sw::FM_Enabled] = $game_switches[Sw::FM_WasEnabled]\n end", "def disabled?; end", "def disabled?; end", "def manual_enabled?\n return true\n end", "def enable_disable_str\n if helper_enabled?\n 'Disable'\n else\n 'Enable'\n end\n end", "def enabled?\n \n return @enabled\n \n end", "def enabled?\n \n return @enabled\n \n end", "def enabled\n return @enabled\n end", "def enabled\n return @enabled\n end", "def enabled\n return @enabled\n end", "def enabled\n @attributes[:enabled]\n end", "def enabled?\n !!@enabled\n end", "def enabled?\n !!@enabled\n end", "def enabled?\n !!@enabled\n end", "def show\n self.visible = true\n end", "def enabled=(value)\n # Coerce to boolean\n @enabled = (value == true)\n end", "def enabled=(value)\n # Coerce to boolean\n @enabled = (value == true)\n end", "def enabled?\n state.eql? 'active'\n end", "def toggle_rendering\n\t\t@rendering_enabled = !@rendering_enabled\n\tend", "def stp_enabled_state\n super\n end", "def enable?(item)\n item.enabled?\n end", "def enable?(item)\n item.enabled?\n end", "def enabled=(value)\n store[:enabled] = value\n end", "def enabled?\n $game_switches[Yuki::Sw::Nuzlocke_ENA]\n end", "def enable\n\n @enabled = true\n\n return self\n\n end", "def enabled\n !false?(configuration[:enabled])\n end", "def disabled?\n false\n end", "def enable!\n events.compliance_input_enabled(self)\n @enabled = true\n end", "def enabled?\n enabled.nil? || enabled\n end", "def enabled?\n\n return @enabled\n\n end", "def enabled\n select(&:enabled?)\n end", "def displayed?; end" ]
[ "0.7351811", "0.7351811", "0.7351811", "0.7351811", "0.7288546", "0.7189319", "0.71890163", "0.71890163", "0.71890163", "0.71890163", "0.71890163", "0.71890163", "0.71865124", "0.7181389", "0.7181389", "0.7163995", "0.7088384", "0.69797695", "0.6968339", "0.6928011", "0.68663853", "0.68663853", "0.68610716", "0.6835398", "0.673105", "0.6698944", "0.6693775", "0.6680133", "0.66642064", "0.6615489", "0.66093844", "0.6506436", "0.65002126", "0.6493601", "0.6493601", "0.6493601", "0.6493601", "0.6493601", "0.64698046", "0.64698046", "0.64334494", "0.64334494", "0.64334494", "0.64004976", "0.63707024", "0.63666904", "0.6361438", "0.6361438", "0.6361438", "0.6361438", "0.6358235", "0.6347761", "0.6347761", "0.6347761", "0.63308495", "0.63094777", "0.629344", "0.6285859", "0.6280159", "0.6251723", "0.62463635", "0.6241463", "0.6230515", "0.6230515", "0.6230515", "0.6230515", "0.6230515", "0.6230515", "0.6230515", "0.62253803", "0.6222125", "0.6222125", "0.6204586", "0.6199127", "0.6185937", "0.6185937", "0.6176633", "0.6176633", "0.6176633", "0.61424965", "0.6141671", "0.6141671", "0.6136698", "0.6119899", "0.6111584", "0.6111584", "0.6101322", "0.60752404", "0.6074577", "0.60705495", "0.60705495", "0.60662335", "0.6057884", "0.6050588", "0.6041394", "0.60298586", "0.60281944", "0.6023234", "0.6013423", "0.60093415", "0.60017693" ]
0.0
-1
status_window= Set Status Window
def status_window=(status_window) @status_window = status_window call_update_help end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main_window\r\n super\r\n # Make status window\r\n @status_window = Window_Status.new(@actor)\r\n end", "def status_window aconfig={}, &block\n sw = StatusWindow.new aconfig\n sw.win.name = \"WINDOW::status_window\"\n return sw unless block_given?\n begin\n yield sw\n ensure\n sw.destroy if sw\n end\nend", "def create_status_window\n @status_window = Window_ActorStatus.new(STATUS_WINDOW_X, STATUS_WINDOW_Y)\n @status_window.actor = @actor\n @status_window.set_handler(:ok, method(:on_status_ok))\n @status_window.set_handler(:cancel, method(:return_scene))\n @status_window.set_handler(:y, method(:command_optimize))\n @status_window.set_handler(:pagedown, method(:next_actor))\n @status_window.set_handler(:pageup, method(:prev_actor))\n end", "def create_status_window\n @status_window = Window_Status.new(STATUS_WINDOW_X, STATUS_WINDOW_Y, @actor)\n @status_window.set_handler(:name, method(:input_name))\n @status_window.set_handler(:title, method(:change_title))\n @status_window.set_handler(:cancel, method(:return_scene))\n @status_window.set_handler(:pagedown, method(:next_actor))\n @status_window.set_handler(:pageup, method(:prev_actor))\n end", "def title_to_status\n @title_window.hide.deactivate.unselect\n @help_window.hide\n @status_window.activate\n set_controls_help\n end", "def status=(newstatus)\n @log.debug(\"New status: '#{newstatus}'.\")\n puts \"Status: '#{newstatus}'.\"\n win_main = Knj::Gtk2::Window.get(\"main\")\n \n if win_main\n win_main.gui[\"statusbar\"].push(0, newstatus)\n end\n end", "def open_status_window(battler)\n Sound.play_decision\n @windows[Win_Detail].refresh(battler)\n @windows[Win_Detail].activate\n @windows[Win_Detail].show\n @windows[Menu_Actor].hide\n @windows[Win_Help].hide\n @windows[Win_Status].hide\n end", "def show_window\n end", "def status=(status)\n @statusbar.configure(:text => status)\n end", "def command_personal\r\n @status_window.select_last\r\n @status_window.activate\r\n @status_window.set_handler(:ok, method(:on_personal_ok))\r\n @status_window.set_handler(:cancel, method(:on_personal_cancel))\r\n end", "def change_title\n @status_window.deactivate\n @title_window.select_last\n @title_window.show.activate\n @title_window.refresh\n @help_window.show\n end", "def command_personal\n @status_window.select_last\n @status_window.activate\n @status_window.set_handler(:ok, method(:on_personal_ok))\n @status_window.set_handler(:cancel, method(:on_personal_cancel))\n end", "def create_location_window\n x = @status_window.x\n width = @status_window.width\n @location_window = Window_Location.new(x, 0, width)\n @location_window.y = Graphics.height - @location_window.height\n @status_window.height = Graphics.height - @location_window.height\n @status_window.refresh\n end", "def show_windows\n end", "def get_status_window\n return @status_window if @status_window.is_a?(Window_BattleStatus)\n return nil\n end", "def main_window\r\n super\r\n # Make main command window\r\n main_command_window\r\n # Make play time window\r\n @playtime_window = Window_PlayTime.new\r\n @playtime_window.x = 0\r\n @playtime_window.y = 224\r\n # Make steps window\r\n @steps_window = Window_Steps.new\r\n @steps_window.x = 0\r\n @steps_window.y = 320\r\n # Make gold window\r\n @gold_window = Window_Gold.new\r\n @gold_window.x = 0\r\n @gold_window.y = 416\r\n # Make status window\r\n @status_window = Window_MenuStatus.new\r\n @status_window.x = 160\r\n @status_window.y = 0\r\n end", "def info_window=(window); @info_window = window; end", "def setwindow(*)\n super\n end", "def status_return\n @slot_window.unselect\n @status_window.activate\n @help_window.clear\n set_controls_help\n end", "def on_status_ok\n @slot_window.activate.select(0)\n set_controls_help\n end", "def createWindow\r\n \r\n end", "def main_window\r\n super\r\n # Make command window\r\n s1 = \"To Title\"\r\n s2 = \"Shutdown\"\r\n s3 = \"Cancel\"\r\n @command_window = Window_Command.new(192, [s1, s2, s3])\r\n @command_window.x = 320 - @command_window.width / 2\r\n @command_window.y = 240 - @command_window.height / 2\r\n end", "def close_status_window\n instance_variables.each do |varname|\n ivar = instance_variable_get(varname)\n ivar.openness = 0 if ivar.is_a?(Window)\n end\n end", "def new_window(type); end", "def set_status_controls\n @control_help_window.add_control(Vocab::MODIFY, Input::Keys::A) \n @control_help_window.add_control(Vocab::BACK, Input::Keys::B)\n @control_help_window.add_control(Vocab::CHANGE_ACTOR, Input::Keys::L, Input::Keys::R)\n end", "def get_window; @window; end", "def update_status\r\n # If B button was pressed\r\n if Input.trigger?(Input::B)\r\n # Play cancel SE\r\n $game_system.se_play($data_system.cancel_se)\r\n # Make command window active\r\n @command_window.active = true\r\n @status_window.active = false\r\n @status_window.index = -1\r\n return\r\n end\r\n # If C button was pressed\r\n if Input.trigger?(Input::C)\r\n # Branch by command window cursor position\r\n case @command_window.index\r\n when 1 # skill\r\n # If this actor's action limit is 2 or more\r\n if $game_party.actors[@status_window.index].restriction >= 2\r\n # Play buzzer SE\r\n $game_system.se_play($data_system.buzzer_se)\r\n return\r\n end\r\n # Play decision SE\r\n $game_system.se_play($data_system.decision_se)\r\n # Switch to skill screen\r\n $scene = Scene_Skill.new(@status_window.index)\r\n when 2 # equipment\r\n # Play decision SE\r\n $game_system.se_play($data_system.decision_se)\r\n # Switch to equipment screen\r\n $scene = Scene_Equip.new(@status_window.index)\r\n when 3 # status\r\n # Play decision SE\r\n $game_system.se_play($data_system.decision_se)\r\n # Switch to status screen\r\n $scene = Scene_Status.new(@status_window.index)\r\n end\r\n return\r\n end\r\n end", "def status_return\n @capacities_list_window.unselect\n @status_window.activate\n @help_window.clear\n set_controls_help\n end", "def window_style\n case @link.WindowStyle\n when SHOWNORMAL\n 'normal'\n when SHOWMAXIMIZED\n 'maximized'\n when SHOWMINNOACTIVE\n 'minimized'\n else\n 'unknown' # Should never reach here\n end\n end", "def update_status_bar\n VIM::evaluate(\"genutils#MoveCursorToWindow(1)\")\n @status_buffer[1] = \" \"*@width\n print_to_buffer(@status_buffer, 1, 0, \"Money: #{@city.coins.round}\")\n print_to_buffer(@status_buffer, 1, 18, \"Population: #{@city.population.round} / #{@city.population_cap}\")\n print_to_buffer(@status_buffer, 1, 40, \"Free people: #{@city.free_workers.round}\")\n print_to_buffer(@status_buffer, 1, 60, \"Oxygen: #{@city.oxygen.round}\")\n print_to_buffer(@status_buffer, 2, 90, \"- Press '?' for commands -\")\n VIM::evaluate(\"genutils#MoveCursorToWindow(2)\")\n end", "def create_status_bar\n status_bar.show_message(tr(\"Ready\"))\n end", "def info_window; @info_window; end", "def main_window\r\n super\r\n # Make command window\r\n s1 = \"New Game\"\r\n s2 = \"Continue\"\r\n s3 = \"Shutdown\"\r\n @command_window = Window_Command.new(192, [s1, s2, s3])\r\n @command_window.back_opacity = 160\r\n @command_window.x = 320 - @command_window.width / 2\r\n @command_window.y = 288\r\n # If continue is enabled, move cursor to \"Continue\"\r\n # If disabled, display \"Continue\" text in gray\r\n if @continue_enabled\r\n @command_window.index = 1\r\n else\r\n @command_window.disable_item(1)\r\n end\r\n end", "def window_handle; end", "def main_window\r\n super\r\n # Make actor command window\r\n s1 = $data_system.words.attack\r\n s2 = $data_system.words.skill\r\n s3 = $data_system.words.guard\r\n s4 = $data_system.words.item\r\n @actor_command_window = Window_Command.new(160, [s1, s2, s3, s4])\r\n @actor_command_window.y = 160\r\n @actor_command_window.back_opacity = 160\r\n @actor_command_window.active = false\r\n @actor_command_window.visible = false\r\n # Make other windows\r\n @party_command_window = Window_PartyCommand.new\r\n @help_window = Window_Help.new\r\n @help_window.back_opacity = 160\r\n @help_window.visible = false\r\n @status_window = Window_BattleStatus.new\r\n @message_window = Window_Message.new\r\n end", "def set_status_controls\n @control_help_window.add_control(Vocab::EQUIP, Input::Keys::A) \n @control_help_window.add_control(Vocab::BACK, Input::Keys::B)\n @control_help_window.add_control(Vocab::OPTIMIZE, Input::Keys::X)\n @control_help_window.add_control(Vocab::CHANGE_ACTOR, Input::Keys::L, Input::Keys::R)\n end", "def window_style=(style)\n valid = [SHOWNORMAL, SHOWMAXIMIZED, SHOWMINNOACTIVE]\n valid.concat(['normal', 'maximized', 'minimized'])\n\n unless valid.include?(style)\n raise ArgumentError, 'invalid style'\n end\n\n if style.is_a?(String)\n case style.downcase\n when 'normal'\n style = SHOWNORMAL\n when 'maximized'\n style = SHOWMAXIMIZED\n when 'minimized'\n style = SHOWMINNOACTIVE\n end\n end\n\n @link.WindowStyle = style\n end", "def main_window\r\n super\r\n # Make command window\r\n s1 = SDK::Scene_Commands::Scene_End::To_Title\r\n s2 = SDK::Scene_Commands::Scene_End::Shutdown\r\n s3 = SDK::Scene_Commands::Scene_End::Cancel\r\n @command_window = Window_Command.new(192, [s1, s2, s3])\r\n @command_window.x = 320 - @command_window.width / 2\r\n @command_window.y = 240 - @command_window.height / 2\r\n end", "def main_window\r\n super\r\n # Make actor command window\r\n s1 = SDK::Scene_Commands::Scene_Battle::Attack\r\n s2 = SDK::Scene_Commands::Scene_Battle::Skill\r\n s3 = SDK::Scene_Commands::Scene_Battle::Guard\r\n s4 = SDK::Scene_Commands::Scene_Battle::Item\r\n @actor_command_window = Window_Command.new(160, [s1, s2, s3, s4])\r\n @actor_command_window.y = 160\r\n @actor_command_window.back_opacity = 160\r\n @actor_command_window.active = false\r\n @actor_command_window.visible = false\r\n # Make other windows\r\n @party_command_window = Window_PartyCommand.new\r\n @help_window = Window_Help.new\r\n @help_window.back_opacity = 160\r\n @help_window.visible = false\r\n @status_window = Window_BattleStatus.new\r\n @message_window = Window_Message.new\r\n end", "def status(status_id)\n attrset Curses::A_REVERSE\n setpos 0, 0\n addstr ' ' * maxx\n text = Status.text(status_id)\n setpos 0, (maxx - text.length) / 2\n addstr text\n attrset(Curses::A_NORMAL)\n refresh\n end", "def window\r\n return $window\r\n end", "def window(windowTitle, timeout = 0)\n $marathon.window(windowTitle, timeout)\n return true\nend", "def main_window\r\n super\r\n # Make help window, status window, and skill window\r\n @help_window = Window_Help.new\r\n @status_window = Window_SkillStatus.new(@actor)\r\n @skill_window = Window_Skill.new(@actor)\r\n # Associate help window\r\n @skill_window.help_window = @help_window\r\n # Make target window (set to invisible / inactive)\r\n @target_window = Window_Target.new\r\n @target_window.visible = false\r\n @target_window.active = false\r\n end", "def create_stat_window\n @stat_window = Window_EquipStat.new(STAT_WINDOW_X, STAT_WINDOW_Y)\n @stat_window.actor = @actor\n @stat_window.hide\n end", "def create_command_window\n end", "def window=(window)\n @session.request(:vim_set_current_window, window)\n end", "def set_info_window(window)\n @info_window = window\n end", "def window_maximize window_name\r\n command 'windowMaximize', window_name\r\n end", "def update_status\n # If B button was pressed\n if Input.trigger?(Input::B)\n # Play cancel SE\n $game_system.se_play($data_system.cancel_se)\n # Make command window active\n @command_window.active = true\n @status_window.active = false\n @status_window.index = -1\n return\n end\n # If C button was pressed\n if Input.trigger?(Input::C)\n # Branch by command window cursor position\n case @command_window.index\n when 1 # skill\n # If this actor's action limit is 2 or more\n if $game_party.actors[@status_window.index].restriction >= 2\n # Play buzzer SE\n $game_system.se_play($data_system.buzzer_se)\n return\n end\n # Play decision SE\n $game_system.se_play($data_system.decision_se)\n # Switch to skill screen\n $scene = Scene_Skill.new(@status_window.index)\n when 2 # equipment\n # Play decision SE\n $game_system.se_play($data_system.decision_se)\n # Switch to equipment screen\n $scene = Scene_Equip.new(@status_window.index)\n when 3 # piercings\n # Play decision SE\n $game_system.se_play($data_system.decision_se)\n # Switch to piercings screen\n $scene = Scene_Piercings.new(@status_window.index)\n when 5 # status\n # Play decision SE\n $game_system.se_play($data_system.decision_se)\n # Switch to status screen\n $scene = Scene_Status.new(@status_window.index)\n end\n return\n end\n end", "def command_main_buy \r\n # Change windows to buy mode\r\n @command_window.active = false\r\n @dummy_window.visible = false\r\n @buy_window.active = true\r\n @buy_window.visible = true\r\n @buy_window.refresh\r\n @status_window.visible = true\r\n end", "def window\n Window\n end", "def progress_dialog aconfig={}, &block\n aconfig[:layout] = [10,60,10,20]\n # since we are printing a border\n aconfig[:row_offset] ||= 4\n aconfig[:col_offset] ||= 5\n window = status_window aconfig\n window.win.name = \"WINDOW::progress_dialog\"\n height = 10; width = 60\n window.win.print_border_mb 1,2, height, width, $normalcolor, FFI::NCurses::A_REVERSE\n return window unless block_given?\n begin\n yield window\n ensure\n window.destroy if window\n end\nend", "def select_window window_id\r\n command 'selectWindow', window_id||'null'\r\n end", "def select_window window_id\r\n command 'selectWindow', window_id||'null'\r\n end", "def window\n @win\n end", "def windows?; end", "def update_status\n # If B button was pressed\n if Input.trigger?(Input::B)\n # Play cancel SE\n $game_system.se_play($data_system.cancel_se)\n # Make command sprite active\n @command_window.active = true\n @status_window.active = false\n @status_window.index = -1\n return\n end\n # If C button was pressed\n if Input.trigger?(Input::C)\n # Branch by command sprite cursor position\n case @command_window.index\n when 1 # skill\n # If this actor's action limit is 2 or more\n if $game_party.actors[@status_window.index].restriction >= 2\n # Play buzzer SE\n $game_system.se_play($data_system.buzzer_se)\n return\n end\n # Play decision SE\n $game_system.se_play($data_system.decision_se)\n # Switch to skill screen\n $scene = Scene_Skill.new(@status_window.index)\n when 2 # equipment\n # Play decision SE\n $game_system.se_play($data_system.decision_se)\n # Switch to equipment screen\n $scene = Scene_Equip.new(@status_window.index)\n when 3 # status\n # Play decision SE\n $game_system.se_play($data_system.decision_se)\n # Switch to status screen\n $scene = Scene_Status.new(@status_window.index)\n end\n return\n end\n end", "def set_windows\n set_title \"R-Bloggyn::#{@usuario.alias}\" #nombre de la ventana\n set_default_size 640, 480 #tamaño de la ventana\n set_skip_taskbar_hint true\n set_window_position Gtk::Window::POS_CENTER #posicion de la ventana\n self.set_attributes\n add @hbox\n show_all #muestra todo\n end", "def main_window\r\n super\r\n # Make command window\r\n s1 = SDK::Scene_Commands::Scene_Title::New_Game\r\n s2 = SDK::Scene_Commands::Scene_Title::Continue\r\n s3 = SDK::Scene_Commands::Scene_Title::Shutdown\r\n @command_window = Window_Command.new(192, [s1, s2, s3])\r\n @command_window.back_opacity = 160\r\n @command_window.x = 320 - @command_window.width / 2\r\n @command_window.y = 288\r\n # If continue is enabled, move cursor to \"Continue\"\r\n # If disabled, display \"Continue\" text in gray\r\n if @continue_enabled\r\n @command_window.index = 1\r\n else\r\n @command_window.disable_item(1)\r\n end\r\n end", "def reset_window\n end", "def window(name)\n Tk.execute_only(:tkwait, :window, name)\n end", "def pbShowWindow(windowType)\r\n # NOTE: If you are not using fancy graphics for the command/fight menus, you\r\n # will need to make \"messageBox\" also visible if the windowtype if\r\n # COMMAND_BOX/FIGHT_BOX respectively.\r\n @sprites[\"messageBox\"].visible = (windowType==MESSAGE_BOX)\r\n @sprites[\"messageWindow\"].visible = (windowType==MESSAGE_BOX)\r\n @sprites[\"commandWindow\"].visible = (windowType==COMMAND_BOX)\r\n @sprites[\"fightWindow\"].visible = (windowType==FIGHT_BOX)\r\n @sprites[\"targetWindow\"].visible = (windowType==TARGET_BOX)\r\n end", "def create_title_window\n @title_window = Window_TitleList.new(TITLE_WINDOW_X, TITLE_WINDOW_Y)\n @title_window.actor = @actor\n @title_window.set_handler(:ok, method(:on_title_ok))\n @title_window.set_handler(:cancel, method(:on_title_cancel))\n @title_window.set_handler(:start, method(:toggle_help))\n @title_window.help_window = @help_window\n @title_window.hide\n end", "def gold_window=(window); @gold_window = window; end", "def window\n Window_Base.new(0, 0, 0, 0)\n end", "def set_status_controls\n @control_help_window.add_control(Vocab::CAPACITIES, Input::Keys::A) \n @control_help_window.add_control(Vocab::BACK, Input::Keys::B)\n @control_help_window.add_control(Vocab::REMOVE_ALL, Input::Keys::X)\n @control_help_window.add_control(Vocab::CHANGE_ACTOR, Input::Keys::L, Input::Keys::R)\n end", "def window_focus window_name\r\n command 'windowFocus', window_name\r\n end", "def main_window ; end", "def set_window\n @window = Window.find(params[:id])\n end", "def set_window\n @window = Window.find(params[:id])\n end", "def minimize_window(win)\n # noop\n end", "def create_selection_window\r\r\n @command_window = CSCA_Window_AchievementSelect.new(0,@head_window.height,\r\r\n Graphics.width/2,Graphics.height-@head_window.height-48)\r\r\n @command_window.viewport = @viewport\r\r\n @command_window.help_window = @achievement_window\r\r\n @command_window.set_handler(:cancel, method(:return_scene))\r\r\n @command_window.activate\r\r\n end", "def window\n @window || create_window\n end", "def activate_window(title)\n append_to_script \"activate_window \\\"#{title}\\\"\"\n end", "def ShowStatus(arg0 = nil)\n ret = _invoke(1610743954, [arg0], [VT_BSTR])\n @lastargs = WIN32OLE::ARGV\n ret\n end", "def create_info_window\n x = @command_window.right_corner\n y = @help_window.bottom_corner\n width = Graphics.width - x\n @info_window = Window_RegistrationInfo.new(x, y, width)\n @info_window.openness = 0 if $game_temp.registration_step == 0\n end", "def window(title, timeout = 0)\n timeout = 30 if timeout == 0\n $webdriver.switch_to.default_content \n if not $marathon.windowMatchingTitle(title)\n bmark = MyBenchMark.new\n bmark.report(\"Waiting for window '\" + title + \"'\") {\n wait = Wait.new(:timeout => timeout, :message => \"Waiting for window '\" + title + \"'\")\n begin\n wait.until {\n waitSucceeded = false\n $webdriver.window_handles.each { |h|\n $webdriver.switch_to.window(h) unless waitSucceeded\n waitSucceeded = true if $marathon.windowMatchingTitle(title)\n }\n waitSucceeded\n }\n ensure\n bmark.close\n end\n }\n end\n $marathon.current_search_context = $webdriver\n $marathon.namingStrategy.setTopLevelComponent($marathon.getDriverAsAccessor())\n $marathon.context_handles.clear\n $marathon.context_handles.push( Proc.new { \n $marathon.current_search_context = $webdriver\n $marathon.namingStrategy.setTopLevelComponent($marathon.getDriverAsAccessor())\n } )\nend", "def open_window(options = nil)\n window = terminal.make( :new => :terminal )\n window.launch_ :session => 'New session'\n end", "def on_title_ok\n @actor.equip_title(@title_window.title)\n @status_window.refresh\n title_to_status\n end", "def window name, cwd, cmd\n tab name, cwd, cmd\n end", "def setup_main_window\n main_window = Curses::Window.new(48, 60, 0, 0)\n main_window.attron(Curses.color_pair(8))\n main_window.box('|', '-')\n main_window.noutrefresh\n main_window\nend", "def main_window\r\n super\r\n # Make help window\r\n @help_window = Window_Help.new\r\n # Make command window\r\n @command_window = Window_ShopCommand.new\r\n # Make gold window\r\n @gold_window = Window_Gold.new\r\n @gold_window.x = 480\r\n @gold_window.y = 64\r\n # Make dummy window\r\n @dummy_window = Window_Base.new(0, 128, 640, 352)\r\n # Make buy window\r\n @buy_window = Window_ShopBuy.new($game_temp.shop_goods)\r\n @buy_window.active = false\r\n @buy_window.visible = false\r\n @buy_window.help_window = @help_window\r\n # Make sell window\r\n @sell_window = Window_ShopSell.new\r\n @sell_window.active = false\r\n @sell_window.visible = false\r\n @sell_window.help_window = @help_window\r\n # Make quantity input window\r\n @number_window = Window_ShopNumber.new\r\n @number_window.active = false\r\n @number_window.visible = false\r\n # Make status window\r\n @status_window = Window_ShopStatus.new\r\n @status_window.visible = false\r\n end", "def window\n self\n end", "def status_line(switch_on = true)\n if switch_on\n set_vars :_display_busy => 1, :_display_status => 1\n else # switch off\n set_vars :_display_busy => 0, :_display_status => 0\n end\n sleep 1\n exec 'redisplay;'\n end", "def main_command_window\r\n # Make command window\r\n s1 = $data_system.words.item\r\n s2 = $data_system.words.skill\r\n s3 = $data_system.words.equip\r\n s4 = \"Status\"\r\n s5 = \"Save\"\r\n s6 = \"End Game\"\r\n @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6])\r\n @command_window.index = @menu_index\r\n # If number of party members is 0\r\n if $game_party.actors.size == 0\r\n # Disable items, skills, equipment, and status\r\n @command_window.disable_item(0)\r\n @command_window.disable_item(1)\r\n @command_window.disable_item(2)\r\n @command_window.disable_item(3)\r\n end\r\n # If save is forbidden\r\n if $game_system.save_disabled\r\n # Disable save\r\n @command_window.disable_item(4)\r\n end\r\n end", "def customWindowsToEnterFullScreenForWindow(window)\n\t\t[window]\n\tend", "def command_main_sell\r\n # Change windows to sell mode\r\n @command_window.active = false\r\n @dummy_window.visible = false\r\n @sell_window.active = true\r\n @sell_window.visible = true\r\n @sell_window.refresh\r\n end", "def init_status_bar(menu)\n\t status_bar = NSStatusBar.systemStatusBar\n\t status_item = status_bar.statusItemWithLength(NSVariableStatusItemLength)\n\t status_item.setMenu menu \n\t status_item.setTitle \"虾米同步状态\"\n\n\t @status_item = status_item\n\tend", "def window\n WIN[:find].call 'ConsoleWindowClass', title\n end", "def window\n WIN[:find].call 'ConsoleWindowClass', title\n end", "def update_help\n @help_window.set_item(item) if @help_window\n @status_window.item = item if @status_window\n end", "def fill_window(value = true, options = {})\n value ? add_style(FILL_WINDOW_CSS, options[:screen]) : remove_style(FILL_WINDOW_CSS, options[:screen])\n end", "def initStatusBar(menu)\n status_bar = NSStatusBar.systemStatusBar\n status_item = status_bar.statusItemWithLength(NSVariableStatusItemLength)\n status_item.setMenu menu\n status_item.setToolTip 'Having a problem?'\n status_item.setHighlightMode true\n # status_item.title = \"Help!\"\n img = NSImage.new.initWithContentsOfFile NSBundle.mainBundle.pathForResource('help.png', ofType:nil)\n status_item.setImage(img)\nend", "def main_window\r\n super\r\n # Make help window, item window\r\n @help_window = Window_Help.new\r\n @item_window = Window_Item.new\r\n # Associate help window\r\n @item_window.help_window = @help_window\r\n # Make target window (set to invisible / inactive)\r\n @target_window = Window_Target.new\r\n @target_window.visible = false\r\n @target_window.active = false\r\n end", "def active_window\n if File.exists?(wmii_namespace)\n 'wmiir cat /client/sel/ctl | sed 1q'\n else\n %q[xprop -root _NET_ACTIVE_WINDOW | awk '/#/ { print $(NF) ; exit } END { exit 1 }' || xdotool getwindowfocus]\n end\nend", "def show_window\r\n if visible?\r\n bring_to_front()\r\n else\r\n show_modal()\r\n end\r\n end", "def window name, cwd, cmd\n raise NotImplementedError.new(\n \"window should be implemented to open new window\")\n end", "def manual_custom_window(symbol)\n case symbol\n when :gold then set_custom_window_y(@gold_window)\n else\n p \"Error: MA_MenuBase - No window setup for #{symbol}\"\n end\n end", "def show_target_window(right)\n @skill_window.active = false\n width_remain = (640 - @target_window.width)/2\n @target_window.x = width_remain.floor\n height_remain = (480 - @target_window.height)/2\n @target_window.y = height_remain.floor\n @target_window.visible = true\n @target_window.active = true\n end", "def show_target_window(right)\n @skill_window.active = false\n width_remain = (640 - @target_window.width)/2\n @target_window.x = width_remain.floor\n height_remain = (480 - @target_window.height)/2\n @target_window.y = height_remain.floor\n @target_window.visible = true\n @target_window.active = true\n end" ]
[ "0.75381744", "0.7533768", "0.7349331", "0.7293328", "0.7165387", "0.70072675", "0.68058324", "0.67529106", "0.67412716", "0.6699734", "0.66870475", "0.66507846", "0.6604116", "0.65468305", "0.65257317", "0.6495793", "0.6488882", "0.64444166", "0.6436358", "0.64126533", "0.64026767", "0.63446224", "0.6339365", "0.63293326", "0.6224823", "0.6210877", "0.6206812", "0.6198396", "0.61955726", "0.6177773", "0.61614454", "0.6145893", "0.61435276", "0.6139879", "0.61312747", "0.61016536", "0.6088939", "0.6081206", "0.6068833", "0.60633147", "0.6059397", "0.60549474", "0.60372084", "0.60367805", "0.6034782", "0.6030924", "0.6030159", "0.6006317", "0.6006136", "0.6005757", "0.60013753", "0.5998333", "0.59946233", "0.59946233", "0.59859926", "0.5985061", "0.59800535", "0.5979764", "0.59600747", "0.59587777", "0.5946592", "0.59229594", "0.591484", "0.5901779", "0.5894494", "0.5890244", "0.58901346", "0.5881311", "0.5869119", "0.5869119", "0.58674264", "0.5859232", "0.5851609", "0.58493495", "0.58474743", "0.58388495", "0.5831346", "0.57848233", "0.5779788", "0.577959", "0.57725495", "0.57672834", "0.5762326", "0.5759165", "0.57432616", "0.573788", "0.5730038", "0.57287496", "0.57273436", "0.57273436", "0.5727245", "0.5719995", "0.571671", "0.5709748", "0.56906307", "0.56826615", "0.5681369", "0.5680339", "0.56778234", "0.56778234" ]
0.8316029
0
update_help Update Help Text
def update_help @help_window.set_item(item) if @help_window @status_window.item = item if @status_window end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_help\n case current_symbol\n when :name\n text = Vocab.registration_help_name\n when :avatar\n text = Vocab.registration_help_avatar\n when :register\n text = Vocab.registration_help_submit\n when :title\n text = Vocab.registration_help_title\n else\n text = ''\n end\n @help_window.set_text(text)\n end", "def update\n update_q(@help, help_params)\n end", "def help(help_text)\n @help_text = help_text\n end", "def help(text)\n Runner.instance.last_help = text\n end", "def update_help\n @help_window.set_item(title)\n end", "def update_help\n if @ucEnemyGraphic.enemy != nil\n if @scan_mode.include?(BESTIARY_CONFIG::SHOW_NOTE)\n @help_window.window_update(@ucEnemyGraphic.enemy.note)\n else\n @help_window.window_update(BESTIARY_CONFIG::DEFAULT_HIDE_PATTERN)\n end\n else\n @help_window.window_update(\"\")\n end\n end", "def update_help\n return unless item\n name = item.name\n if item.price == 0 || item.key_item?\n @help_window.set_text(ESTRIOLE::TEXT_GOLDEN_TOUCH_CANNOT_CONVERT)\n else\n text = sprintf(ESTRIOLE::TEXT_GOLDEN_TOUCH_VALUE_SHOW,name,item.price) \n @help_window.set_text(text)\n end\n end", "def help_text\n t = <<-P1\n<p>\n\n This is a table of \"swinfo\" entries for a particular item. The help\n on the welcome page describes various items that can be searched\n for such as defect, APAR, PTF, etc.\n\n</p><p>\n\n The column names in the header can be clicked to sort the table.\n There are three columns that are sorted. The first column has the\n darkest up or down arrow while the third column has the lightest up\n or down arrow. For example, the default is to sort by the defect\n first, then by the APAR, and finally by the PTF.\n\n</p><p>\n\n The page implements an \"endless page\" user interface where only the\n first 1000 rows are rendered. When the bottom of the page is\n scrolled to, then the next 1000 rows are fetched and appended to the\n original. Remember this if you ever search using the in browser, in\n page search because you may not be searching on the complete list of\n items that matched.\n\n</p><p>\n\n The entries under the Defect, APAR, PTF, VRMF, and Service Pack\n columns are links to do a \"swinfo\" search for that particular item.\n\n</p><p>\n\n The little triangles on the right edge of many items presents a menu\n of available actions when clicked. For example, if one of the\n triangles by a defect is clicked, the user is presented with the\n ability to retrieve the CMVC defect, the changes the defect resulted\n in, the APAR draft (if any) associated with the defect. Each of\n these menus also has a \"Select text\" option to select the text. The\n text is <b>not</b> copied to the clipboard. To do that requires\n flash which I did not want to depend upon. Part of the goal is to\n make the UI tablet friendly and flash is definitely not tablet\n friendly.\n\n</p>\nP1\n return t.html_safe\n end", "def help_text\n build_html do\n p <<-P1\n Not much needed here.\n P1\n end\n end", "def update_help\n enc = $game_party.bestiary_known_data[:ene].keys.size\n text = \"Encountered: #{enc}/#{SES::Bestiary.get_enemy_list.size}\"\n @help_window.set_text(text)\n end", "def help_text\n build_html do\n p <<-P1\n This is the list of changes that a particular defect or\n feature introduced. The changes are grouped by release. Each\n change provides a link to the file or files involved along with a\n link to a diff of the changes for that file. The link to the diff\n is the '->' between the two SCCS ids.\n P1\n end\n end", "def help\n puts 'add help'\n end", "def display_text_result_help result\n help_link(\"Help?\", result.help_id) \n end", "def help\n [['reload', \"update and reload Wes\"]]\n end", "def do_help(text=nil)\n # NB: If command summary is changed, be sure to make corresponding changes in the\n # I18n translation tables\n command_summary = [ ['d <group>', 'deliver msg to grp'], \n ['groups', 'list main grps'],\n ['info <name>', 'get contact info'],\n ['report', 'post update'],\n ['updates', 'get updates'],\n# ['location <place>', 'set current loc'],\n ['!21 <reply>', 'reply to msg 21']\n ]\n command_summary.map {|c| I18n.t(\"sms.help.#{c[0]} = #{c[1]}\")}.join(\"\\n\")\n end", "def help_tip(text); \"\" end", "def help(info, message = nil)\n return if info.nil?\n @alert.showsHelp = true\n @help = [info, message]\n end", "def help\n str = \"====[ #{@name} ]====\\nUsage: #{@name} \"\n @doc_args.each do |key, _value|\n str += \"[#{key.upcase}] \"\n end\n @doc_options.each do |key, _value|\n str += \"(--#{key.name}) \"\n end\n str = \"#{str.rstrip}\\nDescription: #{description}\\n#{help_options_args}\"\n str.rstrip\n end", "def update_help\n @help_window.quest = item\n end", "def help_help\t# :nodoc:\n\t\t\"#{@program_name} -cmd help\\n\\tShow this message\\n\"\n\tend", "def help\r\n end", "def help\r\n end", "def help_text\n format_block = proc {|key, flag, doc, required, kind|\n sprintf(\" %-3s %-14s %-10s %s %s\", flag, key, kind, doc, required ? '(REQUIRED)' : '')\n }\n required, options = help_attributes.partition{ |a| a[3]}\n [\n self.doc,\n \"\\n\",\n self.usage ? [\"Usage: \" + self.usage, \"\\n\"] : [],\n required.size > 0 ? [\"Required args:\", required.map(&format_block), \"\\n\"] : [],\n options.size > 0 ? [\"Options:\", options.map(&format_block), \"\\n\"] : [],\n (self.examples && self.examples.size > 0) ? \"Examples:\\n\" + \" \" + [self.examples].flatten.join(\"\\n \") : [],\n ]\n end", "def help\n end", "def help\n \n end", "def help\n prettify(description)\n end", "def help_text\n build_html do\n p <<P1\nThis page is a simple presentation of the paths that match the file\nthat was searched for an the fileset that the file was shipped in.\nP1\n end\n end", "def help\n end", "def help\n end", "def help\n end", "def help\n end", "def help\n end", "def help\n end", "def help\n end", "def help_info\n \"\"\n end", "def help\n\nend", "def show_help\n puts HELP_MESSAGE\n end", "def show_help\n puts HELP_MESSAGE\n end", "def help(title, text)\n @__help_topics ||= {}\n @__help_topics[title] = text.strip\n end", "def help\n command 'HELP' do\n response 113\n text\n end\n end", "def help_message\n make_response %(*Usage:*\n\n To get stats about all players:\n `foosey stats`\n\n To do anything else:\n http://foosey.futbol)\nend", "def useHelp\r\n\t\t@usedHelp += 1\r\n\t\treturn self\r\n\tend", "def help; end", "def help; end", "def help; end", "def help_text\n @attributes[:help_text]\n end", "def help\n\t\tself.usage(false)\n\t\texit EX_OK\n\tend", "def on_toggle_help\n @help_window.toggle_text\n end", "def on_toggle_help\n @help_window.toggle_text\n end", "def update_help\n @help_window.set_item(recipe)\n @ingredient_window.recipe = recipe\n end", "def render_help_text(text, options={})\n options.stringify_keys!\n mapping = {:notice => \"helpInfo\", :info => \"helpInfo\", :warning => \"helpWarning\", :error => \"helpError\"}\n\n id = options.delete('id')\n display = options.delete('display') || false\n onclick = options.delete('onclick') || visual_effect(:blind_up, id, :duration => 0.3)\n type = mapping[(options.delete('type') || 'info').to_sym]\n<<-HTML\n<div id=\"#{id}\" class=\"helpInfoBox\" onclick='#{onclick}' style=\"#{display ? '' : 'display:none;'}\">\n <table cellpadding=0 cellspacing=0>\n \t<tr>\n \t\t<td class=\"helpInfoLeft\">\n \t\t\t<div class=\"#{type}\"></div>\n \t\t</td>\n \t\t<td class=\"helpInfoContent\">\n \t\t #{text}\n \t\t</td>\n \t</tr>\n </table>\n</div>\nHTML\n end", "def set_help( help )\n if Option.help_ok?( help )\n @help = help\n else\n raise 'invalid help'\n end\n end", "def help_message()\n\t\treturn 'If you say (for example) \"help dance\", I\\'ll tell you what the dance command does.'\n\tend", "def toggle_help\n @help_window.toggle_text\n end", "def extended_help\n\t\t\t{\n\t\t\t\t\"fun_fake_cmd\" => \"This is a fake command. It's got its own special docs.\" +\n\t\t\t\t\t (\" \" * longest_cmd_size) + \"It might be long so so deal with formatting somehow.\"\n\t\t\t}\n\t\tend", "def update!(**args)\n @clean_text = args[:clean_text] if args.key?(:clean_text)\n @info_string = args[:info_string] if args.key?(:info_string)\n @snippet = args[:snippet] if args.key?(:snippet)\n @text = args[:text] if args.key?(:text)\n end", "def help\n self.helplink.click\n end", "def command_help(m)\n m.user.send \"Usage: !suggest Sweet Show Title\"\n end", "def show_help\n display banner\n display \"\"\n display short_help\n display \"\"\n end", "def update\n respond_to do |format|\n if @help.update(help_params)\n format.html { redirect_to helps_path, notice: 'Help was successfully updated.' }\n format.json { render :show, status: :ok, location: @help }\n else\n format.html { render :edit }\n format.json { render json: @help.errors, status: :unprocessable_entity }\n end\n end\n end", "def help\n help = <<HEREDOC \nreset - creates a new game\nrock - throws rock\npaper - throws paper\nscissors - throws scissors\nhelp - shows this screen\ngame - shows the results from this game\nuser - shows your results from all your games\nglobal - shows the global results from all users\nexit - quit the game\nHEREDOC\n end", "def help\n [['help', \"this message\"]]\n end", "def command_help(m)\n m.user.send [\n \"!next - When's the next live show?\",\n \"!schedule - What shows are being recorded live in the next seven days?\",\n \"!suggest - Be heard. Suggest a title for the live show.\",\n \"!link - Know the link for that? Suggest it and make the show better.\",\n \"!current - What's playing on #{shared[:Live_Url]}? I've got you covered.\",\n \"!last_status - The last tweet by @#{shared[:Twitter_User].join(\", @\")} delievered to you in IRC. Sweet.\",\n \"!about - Was #{shared[:Bot_Nick]} coded or did it spontaniously come into existence?\",\n \"!help - Uh, this.\",\n ].join(\"\\n\")\n end", "def help\n base = [\"Usage: houst [action] [optional parameter]\"]\n\n @commands.each do |command|\n base << \"\\t#{command[:name]}: \\t#{command[:description]}\"\n end\n\n base << \"\\nAdditional help can be obtained by using\\n\\thoust help [command]\\n\"\n\n base.join \"\\n\"\n end", "def help_load\n if @api_info.key?('help')\n help_hash = @api_info['help']\n elsif @container_hash[:Labels]\n @config['description'] = @container_hash[:Labels]['description'] if @container_hash.dig(:Labels, 'description')\n help_hash = @container_hash[:Labels]\n help_hash.delete('description')\n else\n help_hash = ''\n end\n\n @logger.info(\"Plugin: #{@name}: #{help_hash ? 'Help list being built' : 'No help or labels found'}\")\n\n help_array = []\n help_hash.each { |label, desc| help_array.push(\" #{label} : #{desc}\\n\") } unless help_hash.blank?\n @help = help_array.join\n end", "def need_help \n end", "def update\n respond_to do |format|\n if @help.update(help_params)\n format.html { redirect_to @help, notice: 'Help was successfully updated.' }\n format.json { render :index, status: :ok, location: @help }\n else\n format.html { render :edit }\n format.json { render json: @help.errors, status: :unprocessable_entity }\n end\n end\n end", "def short_help\n execute_string(\"-help\")\n end", "def help(additional_info=nil)\n \n set_colors\n set_screen_clear\n \n cmd_length = \"Command\".length\n parm_length = \"Parameters\".length\n max_command = [(@@commands.keys.max_by{|key| key.to_s.length }).to_s.length, cmd_length].max\n max_parameter = @@commands[@@commands.keys.max_by{|key| @@commands[key][:argument_list].length }][:argument_list].length\n max_parameter = [parm_length, max_parameter].max if max_parameter > 0\n\n usage_text = \" #{@c_usage}Usage:#{@c_reset} \"\n\n if Commandable.app_exe \n cmd_text = \"<#{@c_command + @c_bold}command#{@c_reset}>\"\n parm_text = \" [#{@c_parameter + @c_bold}parameters#{@c_reset}]\" if max_parameter > 0\n usage_text += \"#{@c_app_exe + app_exe + @c_reset} #{cmd_text}#{parm_text} [#{cmd_text}#{parm_text}...]\"\n end\n\n array = [usage_text, \"\"]\n \n array.unshift additional_info if additional_info\n array.unshift (@c_app_info + Commandable.app_info + @c_reset) if Commandable.app_info\n array.unshift @s_clear_screen_code\n \n header_text = \" #{\" \"*(max_command-cmd_length)}#{@c_command + @c_bold}Command#{@c_reset} \"\n header_text += \"#{@c_parameter + @c_bold}Parameters #{@c_reset}#{\" \"*(max_parameter-parm_length)}\" if max_parameter > 0\n header_text += \"#{@c_description + @c_bold}Description#{@c_reset}\"\n \n array << header_text\n\n array += @@commands.keys.collect do |key|\n is_default = (@@default_method and key == @@default_method.keys[0])\n default_color = is_default ? @c_bold : \"\"\n\n help_line = \" #{\" \"*(max_command-key.length)}#{@c_command + default_color + key.to_s + @c_reset}\"+\n \" #{default_color + @c_parameter + @@commands[key][:argument_list] + @c_reset}\"\n help_line += \"#{\" \"*(max_parameter-@@commands[key][:argument_list].length)} \" if max_parameter > 0\n \n # indent new lines\n description = @@commands[key][:description].gsub(\"\\n\", \"\\n\" + (\" \"*(max_command + max_parameter + (max_parameter > 0 ? 1 : 0) + 4)))\n \n help_line += \": #{default_color + @c_description}#{\"<#{@@commands[key][:xor]}> \" if @@commands[key][:xor]}\" +\n \"#{description}\" +\n \"#{\" (default)\" if is_default}#{@c_reset}\" \n end\n array << nil\n end", "def help(additional_info=nil)\n \n set_colors\n \n cmd_length = \"Command\".length\n parm_length = \"Parameters\".length\n max_command = [(@@commands.keys.max_by{|key| key.to_s.length }).to_s.length, cmd_length].max\n max_parameter = @@commands[@@commands.keys.max_by{|key| @@commands[key][:argument_list].length }][:argument_list].length\n max_parameter = [parm_length, max_parameter].max if max_parameter > 0\n\n usage_text = \" #{@c_usage}Usage:#{@c_reset} \"\n\n if Commandable.app_exe \n cmd_text = \"<#{@c_command + @c_bold}command#{@c_reset}>\"\n parm_text = \" [#{@c_parameter + @c_bold}parameters#{@c_reset}]\" if max_parameter > 0\n usage_text += \"#{@c_app_exe + app_exe + @c_reset} #{cmd_text}#{parm_text} [#{cmd_text}#{parm_text}...]\"\n end\n\n array = [usage_text, \"\"]\n \n array.unshift additional_info if additional_info\n array.unshift (\"\\e[2A\" + @c_app_info + Commandable.app_info + @c_reset) if Commandable.app_info\n array.unshift \"\\e[H\\e[2J\"\n \n header_text = \" #{\" \"*(max_command-cmd_length)}#{@c_command + @c_bold}Command#{@c_reset} \"\n header_text += \"#{@c_parameter + @c_bold}Parameters #{@c_reset}#{\" \"*(max_parameter-parm_length)}\" if max_parameter > 0\n header_text += \"#{@c_description + @c_bold}Description#{@c_reset}\"\n \n array << header_text\n \n array += @@commands.keys.collect do |key|\n default = (@@default_method and key == @@default_method.keys[0]) ? @color_bold : \"\"\n \n help_line = \" #{\" \"*(max_command-key.length)}#{@c_command + default + key.to_s + @c_reset}\"+\n \" #{default + @c_parameter + @@commands[key][:argument_list] + @c_reset}\"\n help_line += \"#{\" \"*(max_parameter-@@commands[key][:argument_list].length)} \" if max_parameter > 0\n \n # indent new lines\n description = @@commands[key][:description].gsub(\"\\n\", \"\\n\" + (\" \"*(max_command + max_parameter + (max_parameter > 0 ? 1 : 0) + 4)))\n \n help_line += \": #{default + @c_description}#{\"<#{@@commands[key][:xor]}> \" if @@commands[key][:xor]}\" +\n \"#{description}\" +\n \"#{\" (default)\" unless default == \"\"}#{@c_reset}\" \n end\n array << nil\n end", "def displayUpdateInstr\n puts \"Type a letter to execute the corresponding command:\"\n puts \"a - update name\"\n puts \"b - update number\"\n puts \"c - update e-mail address\"\n puts \"d - update relation to you\"\n puts \"e - update city\"\nend", "def help\n J2R.open_file_command(HELP_FILE)\n end", "def help\n J2R.open_file_command(HELP_FILE)\n end", "def get_help\n @help\n end", "def help; @form.help_manager.display_help; end", "def set_help_text\n @text_window.set_text(SES::ExternalText.get_text(\"Language Select\") ||\n \"Select a language from the list.\")\n end", "def help\n @t.say(\"The available commands are: BUY, SELL, RECENT, BALANCE\")\nend", "def help #:nodoc:\n Writer.help( { :banner => @@banner, :header => @@header,\n :options => @@options, :footer => @@footer },\n output_to, exit_on_help? )\n end", "def help\n send_command \"--help\"\n end", "def field_help_text\n f = @form.get_current_field\n if f.respond_to?('help_text')\n h = f.help_text\n h = \"No help text defined for this field.\\nTry F1, or press '?' for key-bindings.\" unless h\n textdialog \"#{h}\", :title => \"Widget Help Text\"\n else\n alert \"Could not get field #{f} or does not respond to helptext. Try F1 or '?'\"\n end\n end", "def process_help\n send_data \"250 Ok, but unimplemented\\r\\n\"\n end", "def update!(**args)\n @num_chars = args[:num_chars] if args.key?(:num_chars)\n @snippet_text = args[:snippet_text] if args.key?(:snippet_text)\n end", "def update\n @help = Help.find(params[:id])\n\n respond_to do |format|\n if @help.update_attributes(params[:help])\n format.html { redirect_to @help, notice: 'Help was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @help.errors, status: :unprocessable_entity }\n end\n end\n end", "def long_help\n execute_string(\"-longhelp\")\n end", "def display_help\n text = <<END_OF_STRING\n F1: This help screen\n ESC: Return to Edit\n\n 1-5: create object 1..5 shown in toolbar at mouse cursor\n CTRL+A: select all objects (not in-code-created ones though)\n CTRL+S: Save\n E: Save and Quit\n Q: Quit (without saving)\n ESC: Deselect all objects\n Right Mouse Button Click: Copy object below cursor for fast duplication\n Arrow-keys (with selected objects): Move objects 1 pixel at the time\n Arrow-keys (with no selected objects): Scroll within a viewport\n\n\n Below keys operate on all currently selected game objects\n -----------------------------------------------------------------------------------\n DEL: delete selected objects\n BACKSPACE: reset angle and scale to default values\n Page Up: Increase zorder\n Page Down: Decrease zorder\n\n R: scale up\n F: scale down\n T: tilt left\n G: tilt right\n Y: inc zorder\n H: dec zorder\n U: less transparency\n J: more transparency\n\n Mouse Wheel (with no selected objects): Scroll viewport up/down\n Mouse Wheel: Scale up/down\n SHIFT + Mouse Wheel: Tilt left/right\n CTRL + Mouse Wheel: Zorder up/down\n ALT + Mouse Wheel: Transparency less/more\nEND_OF_STRING\n\n push_game_state(GameStates::Popup.new(:text => text), :finalize => false)\n end", "def help(m)\n m.reply \"See: !help learning\"\n end", "def respond_with_help\n reply = <<help\nType `#{ENV[\"BOT_USERNAME\"]} jeopardy me` to start a new round of Slack Jeopardy. I will pick the category and price. Anyone in the channel can respond.\nType `#{ENV[\"BOT_USERNAME\"]} let's play` or `#{ENV[\"BOT_USERNAME\"]} show the categories` to see a list of the remaining categories or create a new set of categories.\nType `#{ENV[\"BOT_USERNAME\"]} [what|where|who|when] [is|are] [answer]?` to respond to the active round. You have #{ENV[\"SECONDS_TO_ANSWER\"]} seconds to answer. Remember, responses must be in the form of a question, e.g. `#{ENV[\"BOT_USERNAME\"]} what is dirt?`.\nType `#{ENV[\"BOT_USERNAME\"]} I'll take [category] for [value]` start a new round with one of the existing categories.\nType `#{ENV[\"BOT_USERNAME\"]} what is my score` to see your current score.\nType `#{ENV[\"BOT_USERNAME\"]} show the leaderboard` to see the top scores.\nType `#{ENV[\"BOT_USERNAME\"]} show the loserboard` to see the bottom scores.\nhelp\n reply\nend", "def update_text( hash )\r\n call_function( 'UI.update_text', hash )\r\n end", "def help\n\t puts \"\"\n\t puts Rainbow(\":doc\").color(\"#D65200\")+\" Open documentation online\"\n\t puts Rainbow(\":open\").color(\"#D65200\")+\" Open file or folder\"\n\t puts Rainbow(\":new\").color(\"#D65200\")+\" Create file or directory\"\n\t puts Rainbow(\":destroy\").color(\"#D65200\")+\" Destroy Params file or current directory\"\n\t puts Rainbow(\":clean\").color(\"#D65200\")+\" Clean the trash\"\n\t puts Rainbow(\":calendar\").color(\"#D65200\")+\" Show current month\"\n\t puts Rainbow(\":today\").color(\"#D65200\")+\" Show date of day\"\n\t puts \"\"\n\t end", "def update_help\n @help_window.set_item(item)\n @cost_window.set_item(item) if @cost_window\n @image_window.set_item(item) if @image_window\n end", "def help\n \n \"Here is a list of available commands:\n new - Create a new contact\n list - List all contacts\n show - Show a contact\n find - Find a contact\"\n\nend", "def help\n # url = Qt::Url.new(\"file:///#{Coll::HELP_FILE}\")\n # Qt::DesktopServices.openUrl(url)\n end", "def help(s=nil)\n puts send_cmd \"help #{s}\\n\\n\"\n end", "def output_help\n RDoc::usage()\n end", "def help(*args)\n if args.count == 0\n puts <<-HEREDOC\n\nThis script (#{File.basename($0)}) converts back and forth between GNU gettext\nPO files preferred by localizers and Tidy's language header H files which\nensure that Tidy stays small and cross-platform.\n\nAll output files are placed into the current working directory using a file name\nappropriate to the operation being performed.\n\nComplete Help:\n--------------\n HEREDOC\n end\n\n super\n end", "def help str=nil\n buf = []\n buf << usage\n buf << \"\\n\"+@description if @description\n buf << param_lines\n buf << commands_help if respond_to?(:commands_help)\n buf << \"\\n\\n\"+str if str\n buf.flatten.compact.join(\"\\n\")+\"\\n\"\n end", "def set_help\n @help = Help.find(params[:id])\n end", "def set_help\n @help = Help.find(params[:id])\n end", "def set_help\n @help = Help.find(params[:id])\n end", "def set_help\n @help = Help.find(params[:id])\n end" ]
[ "0.792534", "0.77582747", "0.7638981", "0.75335985", "0.74417496", "0.7366081", "0.7205921", "0.7136657", "0.7136157", "0.71318996", "0.7095824", "0.7073853", "0.6964069", "0.6928521", "0.69220406", "0.69138676", "0.69111353", "0.6906115", "0.6896226", "0.6880755", "0.6855143", "0.6855143", "0.6771014", "0.6769501", "0.6755348", "0.6737735", "0.6730073", "0.67031974", "0.67031974", "0.67031974", "0.67031974", "0.67031974", "0.67031974", "0.67031974", "0.66940206", "0.66362923", "0.66166085", "0.66166085", "0.6616195", "0.660231", "0.65935344", "0.65453273", "0.653988", "0.653988", "0.653988", "0.65279114", "0.65228707", "0.65125346", "0.65125346", "0.65028405", "0.64895797", "0.64879656", "0.6467496", "0.6429456", "0.6423817", "0.6422064", "0.64052385", "0.639601", "0.63640547", "0.63544655", "0.63380224", "0.63253117", "0.632367", "0.63230217", "0.6322113", "0.63211095", "0.63069797", "0.63061374", "0.6291616", "0.6279154", "0.6263915", "0.62633276", "0.62633276", "0.6262833", "0.62586707", "0.62534595", "0.62526786", "0.6242136", "0.6239235", "0.62349653", "0.62345284", "0.6221991", "0.6219734", "0.62196684", "0.621417", "0.62103355", "0.6210016", "0.62067336", "0.6200613", "0.6200503", "0.6189842", "0.6186747", "0.6180772", "0.6178271", "0.6163122", "0.61513245", "0.61459965", "0.61459965", "0.61459965", "0.61459965" ]
0.6556861
41
new method : remove_dismantle_mask
def remove_dismantle_mask(key, id) case key when :item $data_items[id].set_dismantle_mask_flags(true) when :armor $data_armors[id].set_dismantle_mask_flags(true) when :weapon $data_weapons[id].set_dismantle_mask_flags(true) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unset_mask\n @masking_key = nil\n end", "def unset_mask\n @masking_key = nil\n end", "def remove_all_dismantle_masks\n groups = [$data_items, $data_armors, $data_weapons]\n for group in groups\n for obj in group\n next if obj.nil?\n obj.set_dismantle_mask_flags(true)\n end # for\n end # for\n end", "def masking?; false; end", "def masking?; true; end", "def mask\n super\n end", "def dilate mask\n morph mask, :dilate\n end", "def set_dismantle_mask_flags(flag = true)\n return unless self.is_a?(RPG::Item) || self.is_a?(RPG::EquipItem)\n @dismantle_items.each do |obj| obj.mask = flag end\n end", "def mask_with_a_care!(mask)\n original_addr = @addr\n mask_without_a_care!(mask)\n @addr = original_addr unless self.class.mask_by_default\n return self\n end", "def add_mask(mod)\n\n unless const_defined? \"MASKS\"\n const_set(\"MASKS\",Hash.new)\n end\n\n unless const_defined? \"MASK_INFO\"\n const_set(\"MASK_INFO\",Hash.new)\n end\n\n unless const_defined? \"Masked\"\n const_set(\"Masked\",Module.new)\n end\n\n tmod = mod.name.gsub(\"::\",\"_\")\n\n cln = mod.clone\n\n self::Masked.const_set(tmod,cln)\n\n trans = []\n\n cln.instance_methods(false).each do |m|\n meth = m.to_sym\n masked_name = \"__#{tmod}_#{(mod.object_id + cln.object_id).abs}_#{m}\".to_sym\n\n self::MASK_INFO[masked_name] = mod\n\n trans << [meth, masked_name]\n\n cln.module_eval <<-CODE\n alias #{masked_name} #{meth}\n remove_method(:#{meth})\n CODE\n end\n\n module_eval { include cln }\n\n trans.each do |t|\n name, meth = t[0], t[1]\n\n cln_method = cln.instance_method(meth)\n self::MASK_INFO[cln_method] = self::MASK_INFO[meth]\n self::MASK_INFO.delete meth\n\n cln.module_eval \"remove_method :#{meth}\"\n\n if self::MASKS.key? name\n self::MASKS[name].unshift cln_method\n else\n original_method = instance_method(name)\n self::MASKS[name] = [cln_method, original_method]\n self::MASK_INFO[original_method] = self\n\n module_eval(<<-CODE,\"maskable.rb\",70)\n if instance_methods.include? \"#{name}\"\n remove_method :#{name}\n end\n\n def #{name}(*a,&b)\n mk = Method::Mask.new(:#{name}, self, \n self.class::MASKS[:#{name}], a, b)\n if Thread.current['__running_mask']\n Thread.current['__running_mask'] << mk\n else\n Thread.current['__running_mask'] = [mk]\n end\n \n return Method.rest\n ensure\n if Thread.current['__running_mask'].size == 1\n Thread.current['__running_mask'] = []\n else\n Thread.current['__running_mask'].pop\n end\n end\n\n CODE\n end\n end\n end", "def unmask(message, key)\n masked = []\n mask_bytes = key.unpack(\"C4\")\n i = 0\n message.each_byte do |byte|\n masked << (byte ^ mask_bytes[i % 4])\n i += 1\n end\n #p :unmasked => masked.pack(\"C*\"), :original => message\n return masked.pack(\"C*\")\n end", "def test_that_masking_works\n end", "def reset_mask_for column_name, *fields\n fields = bitfields if fields.empty?\n max = bitfield_max(column_name)\n (0..max).sum{|i| 2 ** i} - only_mask_for(column_name, *fields)\n end", "def test_that_unmasking_works\n end", "def unmask_protected_sequences\n @str.gsub!(/(.)#{PROTECT_ATTR}/, \"\\\\1\\000\")\n end", "def erode mask\n morph mask, :erode\n end", "def mask_array\n @mask.split('')\n end", "def mask\n raw_value\n end", "def unflag(cell)\n announce_unflag(cell)\n @minefield.unflag(cell)\n end", "def masked_val(value, mask)\n \nend", "def no_scale_mask=(scale_mask)\n end", "def wildmask\n super\n end", "def mask(payload, mask)\n return mask_native(payload, mask) if respond_to?(:mask_native)\n result = []\n payload.each_with_index do |byte, i|\n result[i] = byte ^ mask[i % 4]\n end\n result\n end", "def off_tags res, item\n @mask ^= item.turn_off\n\n super\n end", "def remove_disallow_flag!\n @__phi_access_stack.pop\n end", "def decode_mask(data)\n # Mask\n byte_tmp = data.getbyte\n is_masked = byte_tmp & 0b10000000\n raise Midori::Error::NotMasked unless is_masked == 128\n # Payload\n payload = byte_tmp & 0b01111111\n mask = Array.new(4) { data.getbyte }\n # Message\n masked_msg = Array.new(payload) { data.getbyte }\n @msg = masked_msg.each_with_index.map { |byte, i| byte ^ mask[i % 4] }\n @msg = @msg.pack('C*').force_encoding('utf-8') if [0x1, 0x9, 0xA].include?opcode\n # For debug\n # data.rewind\n # data.bytes {|byte| puts byte.to_s(16)}\n end", "def maskify(cc)\n puts cc.gsub(/.(?=....)/, '#')\nend", "def ~()\n newval = (~ @value) & self.mask\n bounded? ? self.class.new(newval, @length) : self.class.new(newval)\n end", "def mask(*args)\n flags = self.flags\n \n args.inject(0) do |n, name|\n n += flags[name.to_s]\n end\n end", "def set_mask\n @mask = Mask.find(params[:id])\n end", "def unmask_cpf\n unless cpf.blank? then cpf.gsub!(/[.-]/,'') end\n end", "def unmask_cpf\n unless cpf.blank? then cpf.gsub!(/[.-]/,'') end\n end", "def send_unban(channel, *masks)\n send_multiple_mode(channel, '-', 'b', masks)\n end", "def mask\n (@bound_fields + @unbound_fields + @operands).map do |(field,_)|\n WordField[field].mask\n end.inject do |memo,field_mask|\n memo | field_mask\n end\n end", "def html_mask_stuff!(html)\n self.mask_special_emails!(html)\n self.remove_privacy_sensitive_things!(html)\n end", "def remove_flag(pos)\n tile = get_tile(pos)\n unless tile.revealed && !tile.flagged\n tile.flagged = false\n true \n else \n false \n end \n end", "def nfs_prune(valid_ids)\n end", "def bits_to_mask(nm)\n\t\treturn(0) if (nm == 0)\n\t\tm = 2**32-1\n\t\treturn( m ^ (m >> nm) )\n\tend", "def bits_to_mask(nm)\n\t\treturn(0) if (nm == 0)\n\t\tm = 2**32-1\n\t\treturn( m ^ (m >> nm) )\n\tend", "def set_mask(opts)\n opts = check_params(opts,[:masks])\n super(opts)\n end", "def delete\n @reg.delete_bits(self)\n self\n end", "def apply_deponent_masking\n deponent_swap\n deponent_imperative_mutations\n deponent_participle_mutations\n deponent_infinitive_mutations\n end", "def is_mask?(); @type == GRT_MASK; end", "def clear_flags\n @regs.each(&:clear_flags)\n end", "def -(blacklist); end", "def _binary_mask_stuff_internal!(text)\n # Keep original size, so can check haven't resized it\n orig_size = text.size\n\n # Replace ASCII email addresses...\n text.gsub!(MySociety::Validate.email_find_regexp) do |email| \n email.gsub(/[^@.]/, 'x')\n end\n\n # And replace UCS-2 ones (for Microsoft Office documents)...\n # Find emails, by finding them in parts of text that have ASCII\n # equivalents to the UCS-2\n ascii_chars = text.gsub(/\\0/, \"\")\n emails = ascii_chars.scan(MySociety::Validate.email_find_regexp)\n # Convert back to UCS-2, making a mask at the same time\n emails.map! {|email| [\n Iconv.conv('ucs-2', 'ascii', email[0]), \n Iconv.conv('ucs-2', 'ascii', email[0].gsub(/[^@.]/, 'x'))\n ] }\n # Now search and replace the UCS-2 email with the UCS-2 mask\n for email, mask in emails\n text.gsub!(email, mask)\n end\n\n # Replace censor items\n self.info_request.apply_censor_rules_to_binary!(text)\n\n raise \"internal error in binary_mask_stuff\" if text.size != orig_size\n end", "def remove_flag(query)\n flag 'neutral', query\n end", "def off!(indexes)\n Array(indexes).each do |index|\n validate_index(index)\n @bits &= ~(1 << index)\n end\n end", "def remove!; end", "def write_mask\n @write_mask.dup\n end", "def sweep!\n Array(flagged).each { |key| values.delete(key) }\n flagged.clear\n end", "def maskhash\n return @maskhash\n end", "def not\n ~@bits\n end", "def remove(el)\n n = word_number(el)\n if (n >= @bits.attr_length)\n grow_to_include(el)\n end\n @bits[n] &= ~bit_mask(el)\n end", "def mask\n @mask ||= self.class.masks[depth]\n end", "def set_mask\n raise WebSocket::Error::Frame::MaskTooShort if bytesize < 4\n @masking_key = self[0..3].bytes.to_a\n end", "def destroy\n @mask.destroy\n respond_to do |format|\n format.html { redirect_to masks_url, notice: 'Mask was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def remove_user_ban(data); end", "def remove_user_ban(data); end", "def mask\n # + - - - - - - - - - - - - - - - +-------------------------------+\n # | |Masking-key, if MASK set to 1 |\n # +-------------------------------+-------------------------------+\n # | Masking-key (continued) | Payload Data |\n # +-------------------------------- - - - - - - - - - - - - - - - +\n @mask = get(@need)\n transition(:payload, @payload_length)\n return nil\n end", "def mask(series, key, mod)\r\n locations = series_mask[key]\r\n \r\n unless mod == nil\r\n mod_locations = series_mask[\"#{key}#{mod}\"] \r\n if mod_locations\r\n locations += mod_locations \r\n locations.uniq!\r\n end\r\n end\r\n \r\n locations.each {|i| series[i] *= -1} unless locations == nil\r\n series\r\n end", "def flags_clear!()\n @flags = 0\n end", "def generate_mask(code, params, password)\n raise InvalidParametersError, 'Invalid flags' unless params.existing_mode?\n impl(params).generate(code, params, password)\n end", "def remove_marked\n for i in (0..@width-1)\n for j in (0..@height-1)\n if @board[i][j] and @board[i][j].marked\n @board[i][j] = nil\n @pieces_removed += 1\n end\n end\n end\n end", "def unban!\n self.update_attribute(:banned, false)\n end", "def remove\n __flag__ :remove\n end", "def remove_from_blacklist *list\n @blacklist = @blacklist - TinyPng::Path.get_all(list)\n end", "def maskify(cc)\n # your beautiful code goes here\n cc.length <= 4 ? cc : \"#\" * (cc.length-4) + cc[-4..-1]\nend", "def read_mask\n @read_mask.dup\n end", "def delete_gossip\n\n end", "def mask(number)\n number.to_s.chars.map(&:to_i).each do |digit|\n @data[digit] = true\n end\n self\n end", "def remove_negations\n\n logger(\"Removing negations in #{@prefix.compact.join(\" \").to_s}\")\n\n prefix_array_reduced = @prefix.compact.join(\" \").to_s.gsub(/[\\/\\*]\\s0\\s[A-Za-z1-9]+|-\\s((([1-9][0-9]*\\.?[0-9]*)|(\\.[0-9]+)|[A-Za-z]+))\\s\\1|[\\+-\\/\\*]\\s0\\s0|[\\/\\*]\\s[A-Za-z0-9]+\\s0/,\"0\").gsub(/\\/\\s([A-Za-z1-9])\\s\\1/,\"1\")\n\n logger(\"Reduced to #{prefix_array_reduced}\")\n\n @prefix = prefix_array_reduced.split\n prefix_array_reduced = prefix_array_reduced.split.join(\" \")\n\n if !/\\/\\s([A-Za-z1-9])\\s\\1|[\\/\\*]\\s0\\s[A-Za-z1-9]+|-\\s((([1-9][0-9]*\\.?[0-9]*)|(\\.[0-9]+)|[A-Za-z]+))\\s\\2|[\\+-\\/\\*]\\s0\\s0|[\\/\\*]\\s[A-Za-z0-9]+\\s0/.match(prefix_array_reduced).nil?\n remove_negations\n else\n if !/^-\\s[\\/\\*\\+-].*0$/.match(prefix_array_reduced).nil?\n prefix_array_reduced.slice!(0..1)\n prefix_array_reduced.slice!((prefix_array_reduced.length-2)..(prefix_array_reduced.length-1))\n end\n return prefix_array_reduced\n end\n\n end", "def clear_flags\n each(&:clear_flags)\n self\n end", "def clearBitsIthrough0(num, i)\n mask = -1 << i\n mask & num\n end", "def unset(position)\n # duplicated code to avoid a method call\n @field[position / ELEMENT_WIDTH] &= ~(1 << (position % ELEMENT_WIDTH))\n end", "def wildcard_mask\n if self.ipv4?\n (@mask_addr ^ IPAddr::IN4MASK).to_ip\n else\n (@mask_addr ^ IPAddr::IN6MASK).to_ip\n end\n end", "def netmask\n TestLab::Utility.netmask(self.address)\n end", "def discard!\n update!(adjustment: 0)\n end", "def rm_patch(c, blr=0, dlt=0)\n b = blr==0 ? '' : \" -blur #{blr*3}x#{blr}\"\n d = dlt==0 ? '' : \" -morphology Dilate Octagon:#{dlt}\"\n read_bytes \"-crop #{c.cropper}#{b}#{d}\"\n end", "def set_wildcard_mask(mask, bit_flipped=false)\n netmask_int = nil\n if (mask.kind_of?(Integer))\n NetAddr.validate_ip_int(mask,@version)\n netmask_int = mask\n else\n begin\n NetAddr.validate_ip_str(mask,@version)\n netmask_int = NetAddr.ip_str_to_int(mask, @version)\n rescue NetAddr::ValidationError\n raise NetAddr::ValidationError, \"Wildcard Mask must be a valid IPv#{@version} address.\"\n end\n end\n netmask_int = ~netmask_int if (bit_flipped)\n @wildcard_mask = netmask_int\n\n return(nil)\n end", "def netmask(opts)\n opts = check_params(opts,[:admin_ips])\n super(opts)\n end", "def unban\n self.enabled = true\n save\n end", "def optimize\n operand.drop(offset)\n end", "def convert_netmask(mask)\n first_octet = mask[0..1].to_i(16)\n second_octet = mask[2..3].to_i(16)\n third_octet = mask[4..5].to_i(16)\n fourth_octet = mask[6..7].to_i(16)\n mask = \"#{first_octet}.#{second_octet}.#{third_octet}.#{fourth_octet}\"\n return mask\nend", "def mask_protected_sequences\n # protect __send__, __FILE__, etc.\n @str.gsub!(/__([a-z]+)__/i,\n \"_#{PROTECT_ATTR}_#{PROTECT_ATTR}\\\\1_#{PROTECT_ATTR}_#{PROTECT_ATTR}\")\n @str.gsub!(/(\\A|[^\\\\])\\\\([#{Regexp.escape @protectable.join}])/m,\n \"\\\\1\\\\2#{PROTECT_ATTR}\")\n @str.gsub!(/\\\\(\\\\[#{Regexp.escape @protectable.join}])/m, \"\\\\1\")\n end", "def set_wildmask(opts)\n opts = check_params(opts,[:wildmasks])\n super(opts)\n end", "def undo_bypass(frame)\n # !! always return a boolean\n if !!frame.match(/1{5}0/)\n frame.gsub(/1{5}0/, \"11111\")\n end\n end", "def uncan_all()\n self.brk_excluded = :all\n end", "def clear_flag(symbol)\n @flags.delete(symbol)\n end", "def pin_clear\n @pinmap.each { |pin_name, pin| pin.destroy }\n @pinmap.clear\n @patternpinindex.clear\n @patternorder.delete_if { true }\n @cycletiming.clear\n 'P:'\n end", "def unflag_map(row,col)\n row = row.to_i\n col = col.to_i\n row -= 1\n col -= 1\n if @flag_pair.include? (row.to_s + col.to_s)\n @flag_pair.delete((row.to_s + col.to_s))\n else\n puts 'There is no flag there!'\n end\n end", "def masked(mask_image)\n mask_image = mask_image.CGImage\n\n width = CGImageGetWidth(mask_image)\n height = CGImageGetHeight(mask_image)\n component_bits = CGImageGetBitsPerComponent(mask_image)\n pixel_bits = CGImageGetBitsPerPixel(mask_image)\n row_bytes = CGImageGetBytesPerRow(mask_image)\n data_provider = CGImageGetDataProvider(mask_image)\n\n mask = CGImageMaskCreate(width, height, component_bits,\n pixel_bits, row_bytes, data_provider,nil, false)\n\n masked = CGImageCreateWithMask(self.CGImage, mask)\n UIImage.imageWithCGImage(masked, scale:self.scale, orientation:self.imageOrientation)\n end", "def tile_removal(array_of_tiles)\n array_of_tiles.each do |letter|\n if @default_tiles.keys.include?(letter)\n @default_tiles[letter] -= 1\n end\n @default_tiles.delete_if {|key, value| value == 0 }\n end\n end", "def mask(a, b)\n a ^ b\n end", "def unflag\n @flagged != @flagged = false\n end", "def update!(**args)\n @masking_character = args[:masking_character] if args.key?(:masking_character)\n end", "def remove_protection(pyro_word)\n pyro_word.gsub(/!/,'')\n end", "def wildcard_mask(bit_flipped=false)\n ret_val = nil\n if (!bit_flipped)\n ret_val = NetAddr.ip_int_to_str(@wildcard_mask, @version)\n else\n ret_val = NetAddr.ip_int_to_str(~@wildcard_mask, @version)\n end\n\n return(ret_val)\n end", "def clr_only(value)\n shift_out_with_index { |bit, i| bit.clr_only = (value[i] == 0b1) }\n self\n end", "def delete_bit(collection)\n [collection.name].flatten.each do |name|\n @lookup.delete(name)\n end\n collection.each do |bit|\n @bits.delete_at(bit.position) # Remove the bit\n @bits.insert(bit.position, Bit.new(self, bit.position, writable: @init_as_writable))\n end\n self\n end" ]
[ "0.72729516", "0.72729516", "0.6729544", "0.6561492", "0.65048856", "0.6470863", "0.63681674", "0.6323612", "0.6202933", "0.6117511", "0.6115914", "0.610217", "0.60555184", "0.5968678", "0.58524173", "0.5797469", "0.5691447", "0.5676621", "0.5667922", "0.5658228", "0.56496507", "0.5642305", "0.5591622", "0.55821943", "0.5564136", "0.5557086", "0.5531436", "0.55093265", "0.5491575", "0.54823756", "0.5415946", "0.5397263", "0.53946066", "0.5391581", "0.53773254", "0.5373686", "0.5363688", "0.53565776", "0.53565776", "0.535338", "0.5352089", "0.53490376", "0.53447866", "0.53355855", "0.53271866", "0.53173083", "0.5292885", "0.5289185", "0.5275912", "0.52663815", "0.5233521", "0.52257776", "0.52225804", "0.5214952", "0.52074313", "0.5200272", "0.51932853", "0.5191827", "0.5191827", "0.5188406", "0.5187182", "0.51808715", "0.5160956", "0.5142458", "0.51421845", "0.5139688", "0.513923", "0.512959", "0.5125106", "0.5123077", "0.5117939", "0.5112221", "0.5098584", "0.50971884", "0.50872076", "0.5063072", "0.50606346", "0.50574225", "0.50527424", "0.50521636", "0.50505936", "0.5037877", "0.5034631", "0.5030663", "0.50214916", "0.5010135", "0.5008518", "0.50076574", "0.49970886", "0.4995526", "0.4986824", "0.49861705", "0.49797142", "0.4970618", "0.49689353", "0.4954665", "0.4950252", "0.49464065", "0.49395335", "0.49378708" ]
0.73759496
0
new method : remove_all_dismantle_masks
def remove_all_dismantle_masks groups = [$data_items, $data_armors, $data_weapons] for group in groups for obj in group next if obj.nil? obj.set_dismantle_mask_flags(true) end # for end # for end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unset_mask\n @masking_key = nil\n end", "def unset_mask\n @masking_key = nil\n end", "def remove_dismantle_mask(key, id)\n case key\n when :item\n $data_items[id].set_dismantle_mask_flags(true)\n when :armor\n $data_armors[id].set_dismantle_mask_flags(true)\n when :weapon\n $data_weapons[id].set_dismantle_mask_flags(true)\n end\n end", "def uncan_all()\n self.brk_excluded = :all\n end", "def clear_flags\n @regs.each(&:clear_flags)\n end", "def reset_mask_for column_name, *fields\n fields = bitfields if fields.empty?\n max = bitfield_max(column_name)\n (0..max).sum{|i| 2 ** i} - only_mask_for(column_name, *fields)\n end", "def clear_flags\n each(&:clear_flags)\n self\n end", "def remove_all\n @registry = []\n sync\n end", "def _remove_all_method\n :\"_remove_all_#{self[:name]}\"\n end", "def disown_all!\n self.groups.each do |group|\n self.disown!(group)\n end\n end", "def _remove_all_method\n :\"_remove_all_#{self[:name]}\"\n end", "def delete_all_administrative_ips\n super\n end", "def set_dismantle_mask_flags(flag = true)\n return unless self.is_a?(RPG::Item) || self.is_a?(RPG::EquipItem)\n @dismantle_items.each do |obj| obj.mask = flag end\n end", "def remove_all_rules\n super\n end", "def add_mask(mod)\n\n unless const_defined? \"MASKS\"\n const_set(\"MASKS\",Hash.new)\n end\n\n unless const_defined? \"MASK_INFO\"\n const_set(\"MASK_INFO\",Hash.new)\n end\n\n unless const_defined? \"Masked\"\n const_set(\"Masked\",Module.new)\n end\n\n tmod = mod.name.gsub(\"::\",\"_\")\n\n cln = mod.clone\n\n self::Masked.const_set(tmod,cln)\n\n trans = []\n\n cln.instance_methods(false).each do |m|\n meth = m.to_sym\n masked_name = \"__#{tmod}_#{(mod.object_id + cln.object_id).abs}_#{m}\".to_sym\n\n self::MASK_INFO[masked_name] = mod\n\n trans << [meth, masked_name]\n\n cln.module_eval <<-CODE\n alias #{masked_name} #{meth}\n remove_method(:#{meth})\n CODE\n end\n\n module_eval { include cln }\n\n trans.each do |t|\n name, meth = t[0], t[1]\n\n cln_method = cln.instance_method(meth)\n self::MASK_INFO[cln_method] = self::MASK_INFO[meth]\n self::MASK_INFO.delete meth\n\n cln.module_eval \"remove_method :#{meth}\"\n\n if self::MASKS.key? name\n self::MASKS[name].unshift cln_method\n else\n original_method = instance_method(name)\n self::MASKS[name] = [cln_method, original_method]\n self::MASK_INFO[original_method] = self\n\n module_eval(<<-CODE,\"maskable.rb\",70)\n if instance_methods.include? \"#{name}\"\n remove_method :#{name}\n end\n\n def #{name}(*a,&b)\n mk = Method::Mask.new(:#{name}, self, \n self.class::MASKS[:#{name}], a, b)\n if Thread.current['__running_mask']\n Thread.current['__running_mask'] << mk\n else\n Thread.current['__running_mask'] = [mk]\n end\n \n return Method.rest\n ensure\n if Thread.current['__running_mask'].size == 1\n Thread.current['__running_mask'] = []\n else\n Thread.current['__running_mask'].pop\n end\n end\n\n CODE\n end\n end\n end", "def nfs_prune(valid_ids)\n end", "def off!(indexes)\n Array(indexes).each do |index|\n validate_index(index)\n @bits &= ~(1 << index)\n end\n end", "def remove_all_method\n :\"remove_all_#{self[:name]}\"\n end", "def send_unban(channel, *masks)\n send_multiple_mode(channel, '-', 'b', masks)\n end", "def clear_all_gutsable_flags\n all_battle_members.each do |member|\n member.gutsable = false\n end\n end", "def remove_all_method\n :\"remove_all_#{self[:name]}\"\n end", "def wildmask\n super\n end", "def remove_all_original_addresses\n super\n end", "def index\n @masks = Mask.all\n end", "def clean!\n FAKEABLE.map(&:constantize).map(&:destroy_all)\n end", "def delete_all_cluster_ips\n super\n end", "def mask\n super\n end", "def remove_banned\n Zold::Id::BANNED.each do |id|\n @pgsql.exec('DELETE FROM payable WHERE id = $1', [id])\n end\n end", "def wanted_netmasks\n netmasks = [new_resource.netmask, nic.IPSubnet].flatten.compact\n\n # Return only IPv4 netmasks\n netmasks.select { |ip| ip =~ /\\./ }\n end", "def delete_all_packet_filters\n super\n end", "def unregister_all\n registry.clear.default = nil\n end", "def remove_all_spies\n @registry.remove_all.each(&:stop)\n end", "def masking?; false; end", "def delete_all_modes\n @_modes = nil\n end", "def CleanUp\n\tallGroups.exec(\"killall ITGRecv >/dev/null 2>&1;\")\n\tallGroups.exec(\"killall ITGManager >/dev/null 2>&1; killall ITGSend >/dev/null 2>&1;\") \n\t#set the interfaces down\n @nodes.each do |node|\n\t\tif node.GetType()==\"R\"\n\t\t node.GetInterfaces().each do |ifn|\n\t\t # self.GetGroupInterface(node, ifn).down\n\t\t end\n\t\tend\n\t\t\n\t\tnode.GetInterfaces().each do |ifn| \n\t\t ifn.GetAddresses().each do |add|\n\t\t #info(\"Deleting address #{add.ip} from interface #{add.interface} on node #{node.id}\")\n\t\t Node(node.id).exec(\"ip addr del #{add.ip}/#{add.netmask} dev #{ifn.GetName()}\")\n\t\t end\n\t\tend\n\tend\n end", "def flags_clear!()\n @flags = 0\n end", "def masking?; true; end", "def remove_all_clone_pools\n super\n end", "def set_mask(opts)\n opts = check_params(opts,[:masks])\n super(opts)\n end", "def sweep!\n Array(flagged).each { |key| values.delete(key) }\n flagged.clear\n end", "def set_wildmask(opts)\n opts = check_params(opts,[:wildmasks])\n super(opts)\n end", "def pin_clear\n @pinmap.each { |pin_name, pin| pin.destroy }\n @pinmap.clear\n @patternpinindex.clear\n @patternorder.delete_if { true }\n @cycletiming.clear\n 'P:'\n end", "def mask_array\n @mask.split('')\n end", "def networks_del( *networks )\n\t\t\t@networks = @networks.difference( networks.flatten )\n\t\tend", "def delete_unused_host_only_networks\n end", "def mask_with_a_care!(mask)\n original_addr = @addr\n mask_without_a_care!(mask)\n @addr = original_addr unless self.class.mask_by_default\n return self\n end", "def remove_all()\n @field_weights = Array.new\n end", "def clear_switchable()\n end", "def remove_from_blacklist *list\n @blacklist = @blacklist - TinyPng::Path.get_all(list)\n end", "def delete_all_vlan_groups\n super\n end", "def clear\n 1.upto(@gsize) do |j|\n 1.upto(@gsize) do |i|\n stone = @ban[j][i]\n stone.group.clear if stone.group\n end\n end\n # Collect all the groups and put them into @garbage_groups\n @killed_groups.shift # removes @@sentinel\n @merged_groups.shift # removes @@sentinel\n @garbage_groups.concat(@killed_groups)\n @garbage_groups.concat(@merged_groups)\n @killed_groups.clear\n @killed_groups.push(@@sentinel)\n @merged_groups.clear\n @merged_groups.push(@@sentinel)\n @num_groups = 0\n @history.clear\n end", "def remove_from_all_groups\n self.group_memberships.each {|m| m.destroy}\n end", "def delete_all_targets\n\t\tWmapTarget.delete_all\n\tend", "def mask\n (@bound_fields + @unbound_fields + @operands).map do |(field,_)|\n WordField[field].mask\n end.inject do |memo,field_mask|\n memo | field_mask\n end\n end", "def tile_removal(array_of_tiles)\n array_of_tiles.each do |letter|\n if @default_tiles.keys.include?(letter)\n @default_tiles[letter] -= 1\n end\n @default_tiles.delete_if {|key, value| value == 0 }\n end\n end", "def mask(*args)\n flags = self.flags\n \n args.inject(0) do |n, name|\n n += flags[name.to_s]\n end\n end", "def restore_banned!\n remove_role :banned\n shares.restore_hidden!\n contents.restore_hidden!\n Setting.remove_blacklist_ips([current_sign_in_ip, last_sign_in_ip])\n reset_cache('banned-user-ids')\n end", "def clear_instructions\n instructions.clear\n end", "def apply_deponent_masking\n deponent_swap\n deponent_imperative_mutations\n deponent_participle_mutations\n deponent_infinitive_mutations\n end", "def revoke_all_permissions\n update_column(:admin, nil)\n UserPermission.where(user_id: id).each(&:destroy)\n end", "def delete_bit(collection)\n [collection.name].flatten.each do |name|\n @lookup.delete(name)\n end\n collection.each do |bit|\n @bits.delete_at(bit.position) # Remove the bit\n @bits.insert(bit.position, Bit.new(self, bit.position, writable: @init_as_writable))\n end\n self\n end", "def clear_rules!\n @rules = []\n end", "def prune\n @set.clear\n end", "def delete_all\n target.clear\n end", "def reset_tables\n %w[filter nat mangle raw security].each do |table|\n iptables *%W[-t #{table} --flush]\n iptables *%W[-t #{table} --delete-chain]\n end\nend", "def set_mask\n @mask = Mask.find(params[:id])\n end", "def remove_all\n @sequence.remove_all\n end", "def deselect_all\n map(&:deselect).all?\n end", "def test_that_masking_works\n end", "def remove_all_servers\n super\n end", "def disconnect_all\n @cache.values.map(&:clear_all_connections!)\n end", "def test_that_unmasking_works\n end", "def sets\n rows = @board.each_slice(9).to_a # rows\n cols = rows.transpose\n (rows + cols + boxes).each do |set|\n set.delete(\"0\")\n end\n end", "def unmask_protected_sequences\n @str.gsub!(/(.)#{PROTECT_ATTR}/, \"\\\\1\\000\")\n end", "def remove_ranges\n $spriteset.show_ranges(false)\n end", "def dilate mask\n morph mask, :dilate\n end", "def clear_all\n NotImplementedError\n end", "def netmask(opts)\n opts = check_params(opts,[:admin_ips])\n super(opts)\n end", "def clear_exclude\n @exclude_patterns = []\n calculate_exclude_regexp if ! @pending\n end", "def wildcard_mask\n if self.ipv4?\n (@mask_addr ^ IPAddr::IN4MASK).to_ip\n else\n (@mask_addr ^ IPAddr::IN6MASK).to_ip\n end\n end", "def no_scale_mask=(scale_mask)\n end", "def unassign_all(type:, rsuser:)\n\t\t\t\t\tconnection.post(build_path('deleteSid'), nil, type: type, sid: rsuser).code == '200'\n\t\t\t\tend", "def remove( *ruleses )\n self.dup.remove!( *ruleses )\n end", "def set_netmask(opts)\n opts = check_params(opts,[:admin_ips,:netmasks])\n super(opts)\n end", "def solutions(wanted_pieces_masks, available_piece_masks)\n solutions = []\n Decoder.all_possible_combinations(4).each do |combination_bitmask|\n wanted_pieces_masks.delete_if do |wanted_piece_mask|\n if combination_xors_to?(combination_bitmask, wanted_piece_mask, available_piece_masks)\n solutions << combination_bitmask\n true\n end\n end\n end\n solutions\n end", "def remove_all_plant_loops(model)\n model.getPlantLoops.each(&:remove)\n return model\n end", "def remove_disallow_flag!\n @__phi_access_stack.pop\n end", "def destroy\n self.class.where(:id => self.id).update_all(:is_mirrored => false) if self.is_mirrored?\n super\n end", "def suitable_for_none\n \tself.disciplines.delete_all\n end", "def drop_all!(securable_type)\n db = AccessControl.db\n nodes = db[:ac_nodes].filter(securable_type: securable_type)\n nodes_subquery = nodes.select(:id)\n\n # Relying on the fact that assignments are cascade-deleteable.\n db[:ac_assignments].filter(node_id: nodes_subquery).delete\n\n db[:ac_parents].filter(parent_id: nodes_subquery).delete\n db[:ac_parents].filter(child_id: nodes_subquery).delete\n\n nodes.delete\n end", "def clearBitsIthrough0(num, i)\n mask = -1 << i\n mask & num\n end", "def remove_all_vlans\n remove_all_bridge_domains\n remove_all_svis\n Vlan.vlans.each do |vlan, obj|\n # skip reserved vlan\n next if vlan == '1'\n next if node.product_id[/N5K|N6K|N7K/] && (1002..1005).include?(vlan.to_i)\n obj.destroy\n end\n end", "def delete\n @reg.delete_bits(self)\n self\n end", "def remove_all_bgps\n require_relative '../lib/cisco_node_utils/bgp'\n RouterBgp.routers.each do |_asn, vrfs|\n vrfs.each do |vrf, obj|\n if vrf == 'default'\n obj.destroy\n break\n end\n end\n end\n end", "def clearAll\n for y in 0...10\n for x in 0...8\n if( @gridBoard[[x,y]] != nil )\n @gridBoard[[x,y]].clear_icon()\n end\n end\n end\n end", "def clear_targets\n @builder_sets.clear\n end", "def unban!\n self.update_attribute(:banned, false)\n end", "def write_mask\n @write_mask.dup\n end", "def clear_towers\n Node.destroy_all\n OutConnector.destroy_all\n InConnector.destroy_all\n end", "def destroy\n @mask.destroy\n respond_to do |format|\n format.html { redirect_to masks_url, notice: 'Mask was successfully destroyed.' }\n format.json { head :no_content }\n end\n end" ]
[ "0.6793357", "0.6793357", "0.6572579", "0.6498804", "0.6329656", "0.6117755", "0.60109484", "0.600906", "0.5995232", "0.59944004", "0.5984359", "0.5957172", "0.5935121", "0.5907152", "0.5898249", "0.5873984", "0.58672345", "0.57989764", "0.5792419", "0.5790591", "0.5766319", "0.57625234", "0.5687692", "0.5675283", "0.5654183", "0.5647515", "0.56474125", "0.5621563", "0.5593819", "0.5577181", "0.5563414", "0.55548346", "0.55528826", "0.55168134", "0.55161023", "0.5499153", "0.5492885", "0.5489141", "0.547486", "0.54584813", "0.5425158", "0.5422799", "0.5418515", "0.54171586", "0.5412606", "0.5387859", "0.5375566", "0.5374869", "0.53657967", "0.53652424", "0.5363999", "0.5351067", "0.53422534", "0.5310713", "0.5310588", "0.5309956", "0.53036416", "0.52930254", "0.5277421", "0.52672267", "0.52590597", "0.5249998", "0.5249989", "0.52402014", "0.5238954", "0.5233473", "0.5227491", "0.52249277", "0.5220563", "0.52191657", "0.52179575", "0.5216923", "0.52136683", "0.52087784", "0.51967376", "0.51919925", "0.51915306", "0.51856554", "0.51850164", "0.5179282", "0.51755744", "0.51699996", "0.51682395", "0.51544994", "0.5141764", "0.5138513", "0.51354307", "0.51350045", "0.5129068", "0.51240855", "0.5116924", "0.5111389", "0.511011", "0.5109559", "0.51023", "0.51007444", "0.5089006", "0.5087192", "0.50758415", "0.5071391" ]
0.81315804
0
def new method : get_dismantle_count
def get_dismantle_count(key, id) case key when :item $data_items[id].dismantle_counter when :armor $data_armors[id].dismantle_counter when :weapon $data_weapons[id].dismantle_counter end # case end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count\n @count\n end", "def count\n @count\n end", "def count\n @count\n end", "def count\n end", "def count\n end", "def count\n @count\n end", "def count\n @count\n end", "def count\n @count\n end", "def count\n @count\n end", "def count\n dps.count\nend", "def get_all_dismantle_count\n count = 0\n groups = [$data_items, $data_armors, $data_weapons]\n for group in groups\n for obj in group\n next if obj.nil?\n count += obj.dismantle_counter\n end # for\n end # for\n return count\n end", "def offense_counts; end", "def offense_counts; end", "def count\n @collector.count\n end", "def count_drinks_customer()\n @drinks.count\n end", "def count; end", "def count; end", "def count; end", "def count\n call_client(:count)\n end", "def count\n @count ||= get_count\n end", "def count\n self.CountAmt\n end", "def disgemd_count_for(klass)\n Recommendable.redis.scard(Recommendable::Helpers::RedisKeyMapper.disgemd_set_for(klass, id))\n end", "def disgems_count\n Recommendable.config.ratable_classes.inject(0) do |sum, klass|\n sum + disgemd_count_for(klass)\n end\n end", "def count\n # implement in subclasses\n end", "def count\n 1\n end", "def totalcount\n @totalcount\n end", "def doGetMaxCountPerRequest()\n end", "def counts\r\n @counts\r\n end", "def item_count\n @item_count\n end", "def food_count()\nreturn @stomach.count()\nend", "def count\n self[:count].to_i\n end", "def count\n transactions.count\n end", "def record_count\n\t\t# TODO\n\tend", "def count\n @data['count']\n end", "def count\n load\n @result_count\n end", "def cool_view_count\n view_count\n end", "def gemd_count_for(klass)\n Recommendable.redis.scard(Recommendable::Helpers::RedisKeyMapper.gemd_set_for(klass, id))\n end", "def getNbRecompense\n return 0\n end", "def count\n cards.count\n end", "def count\n @params[:rettype] = 'count'\n self\n end", "def getcount\n\t\tRails.logger.info 'Called VotesController#getcount'\n\t\tupcount = VoteStore.get_up_count(params[:id])\n\t\tdowncount = VoteStore.get_down_count(params[:id])\n\t\tRails.logger.info \"Up: #{upcount}\"\n\t\tRails.logger.info \"Down: #{downcount}\"\n\t\trender json: {count: (upcount-downcount)}\n\tend", "def disc_count\n @ole.DiscCount\n end", "def count_items\n detalles.count\n end", "def borrowed_books_count\n @borrowed_books_count\n end", "def customer_count()\n customers().count()\nend", "def downloads_count; AddonDownload.sum(:download_count, :addon_id => self.id).to_i rescue 0; end", "def get_vote_count\n\t\treturn calculate_vote_count\n\tend", "def count_no\n rsvp.no.count\n end", "def count\n @count ||= 0\n end", "def count\n @deck.count\n end", "def sellings_count\n sellings.count\n end", "def get_deals_count\r\n # the base uri for api requests\r\n query_builder = Configuration::BASE_URI.dup % [@version]\r\n\r\n # prepare query string for API call\r\n query_builder << \"/deals/count\"\r\n\r\n # validate and preprocess url\r\n query_url = APIHelper.clean_url query_builder\r\n\r\n # prepare headers\r\n headers = {\r\n \"user-agent\" => \"APIMATIC 2.0\",\r\n \"accept\" => \"application/json\",\r\n \"X-Api-Key\" => @x_api_key\r\n }\r\n\r\n # invoke the API call request to fetch the response\r\n response = Unirest.get query_url, headers:headers\r\n\r\n #Error handling using HTTP status codes\r\n if !(response.code.between?(200,206)) # [200,206] = HTTP OK\r\n raise APIException.new \"HTTP Response Not OK\", response.code, response.raw_body\r\n end\r\n\r\n response.body\r\n end", "def get_count\n @count <= 0 ? DEFAULT_COUNT : @count;\n end", "def member_count\n attach_info\n @member_count\n end", "def count(products) #este nome pode ser o que nós quisermos porque só está dentro do método\n products.count\nend", "def count\n @target.count.to_i\n end", "def count\n raise NotImplementedError\n end", "def count\n @cards.count\n end", "def count\n @cards.count\n end", "def count\n @cards.count\n end", "def count!\n count(nil)\n end", "def num_of_customers()\n customers.size\nend", "def number_of_donations(campaign)\n\t campaign.donations.count\n\tend", "def downloads_count; AddonDownload.sum(:download_count, :addon_id => self.addon_id, :addon_version_id => self.id).to_i rescue 0; end", "def count\n if @count\n if @count.respond_to?(:call)\n @count = @count.call\n else\n @count\n end\n else\n super\n end\n end", "def request_count; end", "def count\n merchants.count\n end", "def get_affiliations_count\r\n @summary.affiliations_count\r\n end", "def count\n @store.count\n end", "def coupon_count\n count = Order.sum(:quantity, :conditions => [\"deal_id = ?\", self.id])\n end", "def count\n self.class.count(self)\n end", "def count_return_rentals\n self.rentals.where( current: false ).count\n end", "def set_dislike_count\n @dislike_count = DislikeCount.find(params[:id])\n end", "def ratings_count\n ratings.count\n end", "def num_ratings\n ratings.count\nend", "def increment_doer_reminder_count\n increment_reminder_count\n end", "def count()\n if @count == -1\n params = @params.clone\n params['count'] = 1\n\n res = @api.do_request(\"GET\", @path, params)\n @count = res['count'].to_i\n end\n @count\n end", "def user_count; end", "def get_pulls_count\n pulls_count\n end", "def counting\n puts \"hard to do right\"\n end", "def review_count\n reviews.count\n end", "def stats\n\t\t@counts\n\tend", "def count\n @count ||= 1\n end", "def count\n @count ||= 1\n end", "def number_of_sales\n sales.count\n end", "def number_of_sales\n sales.count\n end", "def update_dislike_count\n Recommendable.redis.set \"#{redis_key}:dislike_count\", disliked_by.count\n end", "def count\n if @count\n @count - @deleted_entries.cardinality\n else\n determine_count\n end\n end", "def unread_notification_count\n unread_notifications.count\n end", "def count\n\t\t\t\tlist.count\n\t\t\tend", "def wishlisted_count\n self.wishlisted.count\n end", "def getconnectioncount\n request :getconnectioncount\n end", "def count \n puts \"Tu as scrappé #{@result_scrap.count} élémént(s)\"\n return @result_scrap.count\n end", "def count\n @count ||= 0\n @count += 1\n end", "def todos_count\n todos.count\n end", "def count\n @item_list.size\n end", "def total_count\n fetch.json.[](:total_count)\n end", "def notification_number\n @notifications = Notification.get_number_of_notifications current_user\n end", "def operation_count\n \toperations.count\n end", "def outdated_count\n outdated.count\n end" ]
[ "0.7293059", "0.7293059", "0.7293059", "0.7204344", "0.7204344", "0.70775926", "0.70653343", "0.70653343", "0.70653343", "0.7001986", "0.698729", "0.6959307", "0.6959307", "0.6935823", "0.69139975", "0.6845829", "0.6845829", "0.6845829", "0.6833355", "0.6786442", "0.6763345", "0.6739466", "0.6736801", "0.6717951", "0.67079246", "0.6667034", "0.6661877", "0.6627385", "0.66051364", "0.65630895", "0.6560193", "0.6552733", "0.65486693", "0.6542011", "0.6533376", "0.65307397", "0.64935726", "0.6467602", "0.64438057", "0.6438435", "0.6433449", "0.6427742", "0.6422363", "0.64201796", "0.6413948", "0.63885623", "0.6381484", "0.63698417", "0.63622487", "0.63619596", "0.63576245", "0.6355326", "0.6342649", "0.63069826", "0.6304024", "0.6302763", "0.6296518", "0.62892616", "0.62892616", "0.62892616", "0.62774825", "0.6277125", "0.6276188", "0.6268059", "0.626637", "0.62579465", "0.6252817", "0.6242865", "0.62380517", "0.62294203", "0.62265825", "0.6225582", "0.621654", "0.6214402", "0.6212243", "0.6195526", "0.61923337", "0.61884654", "0.6180428", "0.61653566", "0.6163512", "0.6161344", "0.6156655", "0.6156655", "0.6150179", "0.6150179", "0.61430633", "0.6127206", "0.6124519", "0.6118501", "0.61127603", "0.6105149", "0.6104944", "0.6102588", "0.60973656", "0.6092026", "0.6092008", "0.6085126", "0.60717636", "0.6070078" ]
0.74452114
0
def new method : get_all_dismantle_count
def get_all_dismantle_count count = 0 groups = [$data_items, $data_armors, $data_weapons] for group in groups for obj in group next if obj.nil? count += obj.dismantle_counter end # for end # for return count end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count\n end", "def count\n end", "def counts\r\n @counts\r\n end", "def count\n return @@all\n end", "def count\n @count\n end", "def count\n @count\n end", "def count\n @count\n end", "def count\n @count\n end", "def count\n @count\n end", "def count\n @count\n end", "def count\n @collector.count\n end", "def count\n all.count\n end", "def offense_counts; end", "def offense_counts; end", "def count\n dps.count\nend", "def count\n @count\n end", "def count\n call_client(:count)\n end", "def get_dismantle_count(key, id)\n case key\n when :item\n $data_items[id].dismantle_counter\n when :armor\n $data_armors[id].dismantle_counter\n when :weapon\n $data_weapons[id].dismantle_counter\n end # case\n end", "def count; end", "def count; end", "def count; end", "def count\n @all.size\n end", "def count_items\n detalles.count\n end", "def get_counts_for_all_entities\n @tracker.counts\n end", "def count_drinks_customer()\n @drinks.count\n end", "def doGetMaxCountPerRequest()\n end", "def total_count\n @all.size\n end", "def count\n self.all.count\n end", "def disgems_count\n Recommendable.config.ratable_classes.inject(0) do |sum, klass|\n sum + disgemd_count_for(klass)\n end\n end", "def count\n # implement in subclasses\n end", "def count\n transactions.count\n end", "def count\n @params[:rettype] = 'count'\n self\n end", "def count\n all.size\n end", "def index\n @count_wants = CountWant.all\n end", "def count\n load\n @result_count\n end", "def count\n\t\t\t\tlist.count\n\t\t\tend", "def food_count()\nreturn @stomach.count()\nend", "def totalcount\n @totalcount\n end", "def index\n @dislike_counts = DislikeCount.all\n end", "def customer_count()\n customers().count()\nend", "def count(products) #este nome pode ser o que nós quisermos porque só está dentro do método\n products.count\nend", "def how_many(klass)\n JSON.parse(@client.raw_read(resource: klass, summary: \"count\").response[:body])[\"total\"].to_i\n end", "def count\n @data['count']\n end", "def total_count\n fetch.json.[](:total_count)\n end", "def count\n merchants.count\n end", "def get_deals_count\r\n # the base uri for api requests\r\n query_builder = Configuration::BASE_URI.dup % [@version]\r\n\r\n # prepare query string for API call\r\n query_builder << \"/deals/count\"\r\n\r\n # validate and preprocess url\r\n query_url = APIHelper.clean_url query_builder\r\n\r\n # prepare headers\r\n headers = {\r\n \"user-agent\" => \"APIMATIC 2.0\",\r\n \"accept\" => \"application/json\",\r\n \"X-Api-Key\" => @x_api_key\r\n }\r\n\r\n # invoke the API call request to fetch the response\r\n response = Unirest.get query_url, headers:headers\r\n\r\n #Error handling using HTTP status codes\r\n if !(response.code.between?(200,206)) # [200,206] = HTTP OK\r\n raise APIException.new \"HTTP Response Not OK\", response.code, response.raw_body\r\n end\r\n\r\n response.body\r\n end", "def sellings_count\n sellings.count\n end", "def stats\n\t\t@counts\n\tend", "def size\n\n fetch_all(:count => true)\n end", "def getcount\n\t\tRails.logger.info 'Called VotesController#getcount'\n\t\tupcount = VoteStore.get_up_count(params[:id])\n\t\tdowncount = VoteStore.get_down_count(params[:id])\n\t\tRails.logger.info \"Up: #{upcount}\"\n\t\tRails.logger.info \"Down: #{downcount}\"\n\t\trender json: {count: (upcount-downcount)}\n\tend", "def count\n self.CountAmt\n end", "def count\n cards.count\n end", "def disgemd_count_for(klass)\n Recommendable.redis.scard(Recommendable::Helpers::RedisKeyMapper.disgemd_set_for(klass, id))\n end", "def count\n @store.count\n end", "def get_all_documents_count\n get_all_documents_ids.count\n end", "def count\n query.count\n end", "def count\n query.count\n end", "def count\n self.class.count(self)\n end", "def records_total_count\n Rails.cache.fetch('raw_count') { get_raw_records.count(:all) }\n end", "def todos_count\n todos.count\n end", "def num_of_customers()\n customers.size\nend", "def count_return_rentals\n self.rentals.where( current: false ).count\n end", "def all_customers_alt() # Read film1.all_customers_alt\n sql = \"SELECT COUNT(id) FROM tickets WHERE film_id = $1\"\n values = [@id]\n result = SqlRunner.run(sql, values)\n count_hash = result[0]\n return count_hash['count']\n end", "def record_count\n\t\t# TODO\n\tend", "def count\n @item_list.size\n end", "def count\n @count ||= get_count\n end", "def item_count\n @item_count\n end", "def gemd_count_for(klass)\n Recommendable.redis.scard(Recommendable::Helpers::RedisKeyMapper.gemd_set_for(klass, id))\n end", "def count\n 1\n end", "def all_items_count\n all_items.count\n end", "def get_counter\n conversations = (Conversation.where(buyer_id: @current_user.id).all + Conversation.where(seller_id: @current_user.id).all)\n total = 0\n conversations.each do |conversation|\n count = conversation.messages.count - conversation.buyer_marker if conversation.buyer_id == @current_user.id\n count = conversation.messages.count - conversation.seller_marker if conversation.seller_id == @current_user.id\n total = total + count\n end\n render status: 200, json: {unread_count: total}\n end", "def counters\n @client.fetch(:counters)\n end", "def get_affiliations_count\r\n @summary.affiliations_count\r\n end", "def count\n @cards.count\n end", "def count\n @cards.count\n end", "def count\n @cards.count\n end", "def unread_notification_count\n unread_notifications.count\n end", "def total_susus_global\n susus = Susu.all.count\n end", "def count\n raise NotImplementedError\n end", "def retrieved_records\n results.count\n end", "def total\n count\n end", "def Count()\n _getproperty(1, [], [])\n end", "def count\n dataset.count\n end", "def downloads_count; AddonDownload.sum(:download_count, :addon_id => self.id).to_i rescue 0; end", "def getconnectioncount\n request :getconnectioncount\n end", "def count\n @ole.Count\n end", "def count\n @ole.Count\n end", "def count\n @ole.Count\n end", "def count\n @ole.Count\n end", "def count\n @ole.Count\n end", "def count\n @ole.Count\n end", "def count\n @ole.Count\n end", "def count\n @ole.Count\n end", "def count\n collection.count\n end", "def borrowed_books_count\n @borrowed_books_count\n end", "def count \n puts \"Tu as scrappé #{@result_scrap.count} élémént(s)\"\n return @result_scrap.count\n end", "def get_domain_count\n query_push 'Command' => 'GetDomainCount'\n get_response\n end", "def count\n items.compact.count.to_d\n end", "def total_count\n @total_count ||= self.query.count\n end", "def find_res_count\n res_count = 0\n self.listings.each do |listing|\n res_count += listing.reservations.where(:status => \"accepted\").count\n end\n return res_count\n end" ]
[ "0.72181416", "0.72181416", "0.71026546", "0.7082664", "0.7011825", "0.7011825", "0.7011825", "0.70047706", "0.70047706", "0.70047706", "0.7000065", "0.6999205", "0.6957815", "0.6957815", "0.6934482", "0.6910248", "0.6892735", "0.6853122", "0.68384576", "0.68384576", "0.68384576", "0.6786173", "0.66887236", "0.6684882", "0.66738164", "0.66688865", "0.6637351", "0.66336834", "0.6620321", "0.6596022", "0.65906024", "0.65871817", "0.6581461", "0.6564374", "0.65107083", "0.6507374", "0.6502599", "0.64768803", "0.64756656", "0.6458538", "0.6452793", "0.64403325", "0.6431973", "0.64218384", "0.64061826", "0.6393508", "0.638693", "0.6385254", "0.63829756", "0.6375554", "0.63675374", "0.63561827", "0.63558656", "0.6354555", "0.6348805", "0.6337266", "0.6337266", "0.63360107", "0.6332962", "0.63003856", "0.6296359", "0.6294341", "0.62935996", "0.62895507", "0.62646925", "0.6258657", "0.6251078", "0.6227722", "0.62115675", "0.62108517", "0.62007976", "0.62000173", "0.61992323", "0.61913437", "0.61913437", "0.61913437", "0.6179166", "0.61664057", "0.61656964", "0.616566", "0.61634576", "0.61534846", "0.61477995", "0.6144588", "0.61404115", "0.6131921", "0.6131921", "0.6131921", "0.6131921", "0.6131921", "0.6131921", "0.6131921", "0.6131921", "0.6127615", "0.6125563", "0.61185074", "0.6113948", "0.6113586", "0.6100244", "0.6097339" ]
0.7478532
0
depends_on 'cmake' => :build
def install ENV.deparallelize ENV['OCAMLFIND_DESTDIR'] = "#{lib}/ocaml/site-lib/" (lib + "ocaml/site-lib/").mkpath system "make" system "make install" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def package_depends_on\n depends_on\n end", "def install\n# Dependency tracking only, uncomment this section only if you know what you\n# are doing!\n#\n# mkdir 'build'\n# cd 'build' do\n# system \"cmake .. #{std_cmake_parameters}\"\n# system \"make package\"\n# end\nend", "def cmake_package(options, &block)\n package_common(:cmake, options) do |pkg|\n pkg.depends_on 'cmake'\n common_make_based_package_setup(pkg)\n yield(pkg) if block_given?\n end\nend", "def depends_on(pkg)\n autobuild.depends_on(pkg.autobuild)\n end", "def build_gem; end", "def build_dependency\n npm_install\nend", "def common_build\n copy_gems # in make/gems.rb\n end", "def common_build\n copy_gems\n end", "def common_build\n copy_gems\n end", "def depends_on(mod)\n @log.info \"Loading module '#{mod}' as a dependency\"\n loaded = require \"#{File.dirname(__FILE__)}/modules/#{mod.to_s}.rb\"\n @log.info \"Module '#{mod}' already loaded, not re-loading\" if !loaded\nend", "def dependencies; end", "def dependencies; end", "def dependencies; end", "def depends_on( other_dependency )\n namespace name do\n task :build => \"#{other_dependency}:done\"\n end\n end", "def build_gems; end", "def depends_on\n return @depends_on\n end", "def build_release\n build_dependency\n puts '### release build ###'\n `gulp release`\n puts '### release build done ###'\n post_build\nend", "def direct_dependencies; end", "def fetch_development_dependencies # :nodoc:\n end", "def dependency_target\n self.name == \"hoe\" ? extra_deps : extra_dev_deps\n end", "def build\n cd_and_sh( pkg_dir, build_commands )\n end", "def dependencies\n self.config.depends || []\n end", "def rebuild\n build addl_cmake_bld_args: '--clean-first'\n end", "def depends_on(package, *version)\n dependencies << [ package, *version ]\n end", "def prebuild(build, listener)\n end", "def prebuild(build, listener)\n end", "def prebuild(build, listener)\n end", "def depends_on=(value)\n @depends_on = value\n end", "def run_in_build(*args)\n in_build do |source_dir|\n run_command(\"cmake\", \"-G\", select_generator, source_dir) unless File.exist?(\"CMakeCache.txt\")\n args.push(\"cmake\", \"--build\", \".\") if args.empty?\n args.push(\"--target\", $target) if $target\n args.push(\"--config\", $config) if $config\n run_command(*args)\n end\nend", "def build_snapshot\n build_dependency\n puts '### dev build ###'\n puts `gulp 2>&1`\n puts '### dev build done ###'\n post_build\nend", "def install_ruby_dependencies(rubie)\n pkgs = []\n case rubie\n when /^ruby-/, /^ree-/, /^rbx-/, /^kiji/\n case node['platform']\n when \"debian\",\"ubuntu\"\n pkgs = %w{ build-essential openssl libreadline6 libreadline6-dev\n zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev\n sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev\n ncurses-dev automake libtool bison ssl-cert }\n pkgs += %w{ subversion } if rubie =~ /^ruby-head$/\n when \"suse\"\n pkgs = %w{ gcc-c++ patch zlib zlib-devel libffi-devel\n sqlite3-devel libxml2-devel libxslt-devel }\n if node['platform_version'].to_f >= 11.0\n pkgs += %w{ libreadline5 readline-devel libopenssl-devel }\n else\n pkgs += %w{ readline readline-devel openssl-devel }\n end\n pkgs += %w{ git subversion autoconf } if rubie =~ /^ruby-head$/\n when \"centos\",\"redhat\",\"fedora\",\"scientific\",\"amazon\"\n pkgs = %w{ gcc-c++ patch readline readline-devel zlib zlib-devel\n libyaml-devel libffi-devel openssl-devel }\n pkgs += %w{ git subversion autoconf } if rubie =~ /^ruby-head$/\n end\n when /^jruby-/\n # TODO: need to figure out how to pull in java recipe only when needed. For\n # now, users of jruby will have to add the \"java\" recipe to their run_list.\n #include_recipe \"java\"\n case node['platform']\n when \"debian\",\"ubuntu\"\n pkgs += %w{ g++ ant }\n end\n end\n\n pkgs.each do |pkg|\n package pkg do\n action :nothing\n end.run_action(:install)\n end\nend", "def build\n if phase.has_key?('build')\n execute(\"build\", phase['build'])\n end\n end", "def test_bad_chicken_deps\n check_deps_fail \"notapackage\" => :chicken if which('csc')\n end", "def test_bad_chicken_deps\n check_deps_fail \"notapackage\" => :chicken if which('csc')\n end", "def setup\n default_repository.update_submodules(:recursive => true)\n true\n end", "def setup_maven_build_targets(cmp, build_vars)\n cmp_src_path = component_src_path cmp\n cmp_build_bin = component_build_bin cmp\n\n if cmp_build_bin != 'mvn'\n STDERR.puts \"[#{cmp}]: the builder is configured (in the YAML file) as '#{cmp_build_bin}', however it seems to be 'mvn'. Look in the source directory ('#{cmp_src_path}') for more details\"\n end\n\n mvn_versions = lookup_maven_pom(cmp_src_path)\n mvn_versions.each do |mvn_version|\n mvn_filename = 'pom.xml'\n if mvn_version != ''\n mvn_filename = 'pom.hadoop' + mvn_version + '.xml'\n end\n mvn_file = File.join cmp_src_path, mvn_filename\n\n # Store the Maven POM file\n build_vars['BUILDER_FILES'] << mvn_file\n\n # Extract the elements of version from the Maven POM XML file\n (mvn_version, has_hadoop, has_spark) = lookup_version_from_mvn_pom(mvn_filename)\n\n # Store the elements of version\n build_vars['PACKAGE_VERSIONS'][mvn_version] = true\n build_vars['HAS_HADOOP'] = has_hadoop\n build_vars['HAS_SPARK'] = has_spark\n\n # Set up the Maven build command line\n cmp_builder_cmds = \"#{cmp_build_bin} -f #{mvn_file} #{CONF_MVN_ARGS}\"\n build_vars['BUILDER_CMDS'] << \"#{cmp_builder_cmds}\"\n \n # Maven tasks/targets for building, packaing and installing (in the local\n # Maven repository, eg, ~/.m2/repository)\n cmp_builder_tasks = \"compile package install\"\n build_vars['BUILDER_FULL_CMDS'] << \"#{cmp_builder_cmds} #{cmp_builder_tasks}\"\n\n # Set up the Maven test command line\n cmp_test_tasks = \"test\"\n build_vars['TEST_FULL_CMDS'] << \"#{cmp_builder_cmds} #{cmp_test_tasks}\"\n end\nend", "def build_files_command\n \"middleman build\"\n end", "def prebuild(build, listener)\n # do any setup that needs to be done before this build runs.\n end", "def build\n safesystem \"autoreconf -vfi\"\n configure :prefix => prefix\n make\n end", "def dependencies=(_arg0); end", "def common_build\n puts \"common_build dir=#{pwd} #{SHOES_TGT_ARCH}\"\n #mkdir_p \"#{TGT_DIR}/ruby\"\n #cp_r \"#{EXT_RUBY}/lib/ruby/#{RUBY_V}\", \"#{TGT_DIR}/ruby/lib\"\n %w[req/ftsearch/lib/* req/rake/lib/*].each do |rdir|\n FileList[rdir].each { |rlib| cp_r rlib, \"#{TGT_DIR}/lib/ruby/#{TGT_RUBY_V}\" }\n end\n %w[req/ftsearch/ext/ftsearchrt req/chipmunk/ext/chipmunk].\n #%w[req/binject/ext/binject_c req/ftsearch/ext/ftsearchrt req/bloopsaphone/ext/bloops req/chipmunk/ext/chipmunk].\n each { |xdir| copy_ext xdir, \"#{TGT_DIR}/lib/ruby/#{TGT_RUBY_V}/#{SHOES_TGT_ARCH}\" }\n\n gdir = \"#{TGT_DIR}/lib/ruby/gems/#{RUBY_V}\"\n {'hpricot' => 'lib', 'sqlite3' => 'lib'}.each do |gemn, xdir|\n #{'hpricot' => 'lib', 'json' => 'lib/json/ext', 'sqlite3' => 'lib'}.each do |gemn, xdir|\n spec = eval(File.read(\"req/#{gemn}/gemspec\"))\n mkdir_p \"#{gdir}/specifications\"\n mkdir_p \"#{gdir}/gems/#{spec.full_name}/lib\"\n FileList[\"req/#{gemn}/lib/*\"].each { |rlib| cp_r rlib, \"#{gdir}/gems/#{spec.full_name}/lib\" }\n mkdir_p \"#{gdir}/gems/#{spec.full_name}/#{xdir}\"\n FileList[\"req/#{gemn}/ext/*\"].each { |elib| copy_ext elib, \"#{gdir}/gems/#{spec.full_name}/#{xdir}\" }\n cp \"req/#{gemn}/gemspec\", \"#{gdir}/specifications/#{spec.full_name}.gemspec\"\n end\n end", "def autotools_package(options, &block)\n package_common(:autotools, options) do |pkg|\n pkg.depends_on 'autotools'\n common_make_based_package_setup(pkg)\n yield(pkg) if block_given?\n end\nend", "def define_packaging_tasks\n\n\t\t### Task: prerelease\n\t\tunless Rake::Task.task_defined?( :pre )\n\t\t\tdesc \"Append the package build number to package versions\"\n\t\t\ttask :pre do\n\t\t\t\trev = get_numeric_rev()\n\t\t\t\ttrace \"Current rev is: %p\" % [ rev ]\n\t\t\t\t$hoespec.spec.version.version << \"pre#{rev}\"\n\t\t\t\tRake::Task[:gem].clear\n\n\t\t\t\tGem::PackageTask.new( $hoespec.spec ) do |pkg|\n\t\t\t\t\tpkg.need_zip = true\n\t\t\t\t\tpkg.need_tar = true\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\tnamespace :deps do\n\n\t\t\tif RVM_GEMSET.exist?\n\t\t\t\tdesc \"Update the project's RVM gemset\"\n\t\t\t\ttask :gemset do\n\t\t\t\t\tdeps = make_gemset_recommendations( $hoespec.spec )\n\t\t\t\t\tupdates = deps.values.compact\n\n\t\t\t\t\tif !updates.empty?\n\t\t\t\t\t\t$stderr.puts \"%d gems in the current gemset have newer matching versions:\" %\n\t\t\t\t\t\t\t [ updates.length ]\n\t\t\t\t\t\tdeps.each do |old, newer|\n\t\t\t\t\t\t\tnext unless newer\n\t\t\t\t\t\t\t$stderr.puts \" #{old} -> #{newer}\"\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\tif ask( \"Update? \" )\n\t\t\t\t\t\t\tupdate_rvm_gemset( deps )\n\t\t\t\t\t\t\trun 'rvm', 'gemset', 'import', RVM_GEMSET.to_s\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\n\t\tend\n\n\t\t### Make the ChangeLog update if the repo has changed since it was last built\n\t\tfile '.hg/branch'\n\t\tfile 'ChangeLog' => '.hg/branch' do |task|\n\t\t\t$stderr.puts \"Updating the changelog...\"\n\t\t\tcontent = make_changelog()\n\t\t\tFile.open( task.name, 'w', 0644 ) do |fh|\n\t\t\t\tfh.print( content )\n\t\t\tend\n\t\tend\n\n\tend", "def install_dependencies\n raise 'Not implemented'\n end", "def make_deps t\n sh \"gcc -MM -MF #{t.name} #{$C_FLAGS.join ' '} -c #{t.source}\"\nend", "def test_no_build_deps\n c = Control.new(__method__)\n c.parse!\n assert_equal(nil, c.source.fetch('build-depends', nil),\n \"Found a build dep #{c.source.fetch('build-depends', nil)}\")\n end", "def pre_install; end", "def copy_project_dependencies_for_awestruct_image\n\n puts \"- Copying project dependencies into '_docker/awestruct' for build...\"\n\n parent_gemfile = File.open '../Gemfile'\n parent_gemlock = File.open '../Gemfile.lock'\n\n target_gemfile = FileHelpers.open_or_new('awestruct/Gemfile')\n target_gemlock = FileHelpers.open_or_new('awestruct/Gemfile.lock')\n #Only copy if the file has changed. Otherwise docker won't cache optimally\n FileHelpers.copy_if_changed(parent_gemfile, target_gemfile)\n FileHelpers.copy_if_changed(parent_gemlock, target_gemlock)\n\n puts \"- Successfully copied project dependencies into '_docker/awestruct' for build.\"\n\nend", "def build\n\t@built_gem_path ||= @helper.build_gem\nend", "def install_dependencies\n recipe_eval do\n run_context.include_recipe 'chef-sugar::default'\n run_context.include_recipe 'build-essential::default'\n\n case node.platform_family\n when 'debian'\n package 'curl'\n package 'git-core'\n package 'libxml2-dev'\n package 'libxslt-dev'\n package 'zlib1g-dev'\n package 'ncurses-dev'\n package 'libssl-dev'\n when 'freebsd'\n package 'textproc/libxml2'\n package 'textproc/libxslt'\n package 'devel/ncurses'\n when 'mac_os_x'\n run_context.include_recipe 'homebrew::default'\n package 'libxml2'\n package 'libxslt'\n package 'openssl'\n when 'rhel'\n package 'curl'\n package 'bzip2'\n package 'file'\n package 'git'\n package 'libxml2-devel'\n package 'libxslt-devel'\n package 'ncurses-devel'\n package 'zlib-devel'\n package 'openssl-devel'\n end\n end\n end", "def cmake_has_parallel_flag?\n (CMAKE_VERSION <=> [3, 12]) >= 0\nend", "def my_post_build_step\n puts 'post-build step!'\nend", "def enable_dependency_loading; end", "def enable_dependency_loading; end", "def pre_build\n puts \"pre_build dir=#{`pwd`}\"\n rbvt = RUBY_V\n rbvm = RUBY_V[/^\\d+\\.\\d+/]\n # remove leftovers from previous rake.\n rm_rf \"#{TGT_DIR}/lib\"\n rm_rf \"#{TGT_DIR}/etc\"\n rm_rf \"#{TGT_DIR}/share\"\n rm_rf \"#{TGT_DIR}/conf.d\"\n mkdir_p \"#{TGT_DIR}/lib\"\n cp_r \"#{EXT_RUBY}/lib/ruby\", \"#{TGT_DIR}/lib\"\n # copy include files\n mkdir_p \"#{TGT_DIR}/lib/ruby/include/ruby-#{rbvt}\"\n cp_r \"#{EXT_RUBY}/include/ruby-#{rbvt}/\", \"#{TGT_DIR}/lib/ruby/include\"\n SOLOCS.each_value do |path|\n cp \"#{path}\", \"#{TGT_DIR}\"\n end\n # do some windows things\n mkdir_p \"#{TGT_DIR}/share/glib-2.0/schemas\"\n if APP['GTK'] == \"gtk+-2.0\" \n cp_r\"#{TGT_SYS_DIR}/share/glib-2.0/schemas/gschema.dtd\",\n \"#{TGT_DIR}/share/glib-2.0/schemas\"\n cp_r \"#{ShoesDeps}/share/fontconfig\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/themes\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/xml\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/icons\", \"#{TGT_DIR}/share\"\n elsif APP['GTK'] == \"gtk+-3.0\"\n cp \"#{TGT_SYS_DIR}share/glib-2.0/schemas/gschemas.compiled\" ,\n \"#{TGT_DIR}/share/glib-2.0/schemas\"\n cp_r \"#{ShoesDeps}/share/fontconfig\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/themes\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/xml\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/icons\", \"#{TGT_DIR}/share\"\n else\n cp \"#{TGT_SYS_DIR}share/glib-2.0/schemas/gschemas.compiled\" ,\n \"#{TGT_DIR}/share/glib-2.0/schemas\"\n end\n sh \"#{WINDRES} -I. shoes/appwin32.rc shoes/appwin32.o\"\n cp_r \"#{ShoesDeps}/etc\", TGT_DIR\n mkdir_p \"#{ShoesDeps}/lib\"\n if APP['GTK'] == \"gtk+-3.0\"\n cp_r \"#{ShoesDeps}/lib/gtk-3.0\", \"#{TGT_DIR}/lib\" # shoes, exerb, ruby here\n else\n cp_r \"#{ShoesDeps}/lib/gtk-2.0\", \"#{TGT_DIR}/lib\" # shoes, exerb, ruby here\n end\n bindir = \"#{ShoesDeps}/bin\"\n #cp_r \"#{bindir}/fc-cache.exe\", TGT_DIR\n cp_r \"#{bindir}/gtk-update-icon-cache.exe\", TGT_DIR\n # below for debugging purposes\n if ENV['GDB'] \n cp \"#{bindir}/fc-cat.exe\", TGT_DIR\n cp \"#{bindir}/fc-list.exe\", TGT_DIR\n cp \"#{bindir}/fc-match.exe\", TGT_DIR\n cp \"#{bindir}/fc-pattern.exe\", TGT_DIR\n cp \"#{bindir}/fc-query.exe\", TGT_DIR\n cp \"#{bindir}/fc-scan.exe\", TGT_DIR\n cp \"#{bindir}/fc-validate.exe\", TGT_DIR\n end\n # disable MS Theme\n if !ENABLE_MS_THEME \n Dir.chdir(\"#{TGT_DIR}/share/themes/MS-Windows/gtk-2.0/\") do\n mv 'gtkrc', 'disabled-gtkrc'\n end\n else\n # add our overrides to the MS-Windows theme\n cp \"platform/msw/gtkrc\", \"#{TGT_DIR}/etc/gtk-2.0/\"\n end\n end", "def dependent; end", "def dependent; end", "def build; end", "def install_build_dependencies(build_dependencies) # rubocop:disable Metrics/AbcSize\n http = []\n pkgutil = []\n noasks = [\"instance=overwrite\", \"partial=nocheck\", \"runlevel=nocheck\", \"idepend=nocheck\", \"rdepend=nocheck\", \"space=nocheck\", \"setuid=nocheck\", \"conflict=nocheck\", \"action=nocheck\", \"basedir=default\"]\n noask_command = noasks.map { |noask| \"echo '#{noask}' >> /var/tmp/noask\" }.join('; ')\n\n build_dependencies.each do |build_dependency|\n if build_dependency =~ /^http.*\\.gz/\n # Fetch, unpack, install...this assumes curl is present.\n package = build_dependency.sub(/^http.*\\//, '')\n http << \"tmpdir=$(#{mktemp}); (cd ${tmpdir} && curl --silent --show-error --fail -O #{build_dependency} && gunzip -c #{package} | pkgadd -d /dev/stdin -a /var/tmp/noask all)\"\n else\n # Opencsw dependencies. At this point we assume that pkgutil is installed.\n pkgutil << build_dependency\n end\n end\n\n command = ''\n unless pkgutil.empty?\n command << \"/opt/csw/bin/pkgutil -y -i #{pkgutil.join(\"\\s\")}; \"\n end\n\n unless http.empty?\n command << \"echo -n > /var/tmp/noask; #{noask_command}; \"\n command << http.join('; ')\n end\n\n command\n end", "def depend_on( name, version = nil )\n spec = Gem.source_index.find_name(name).last\n version = spec.version.to_s if version.nil? and !spec.nil?\n\n PROJ.gem.dependencies << case version\n when nil; [name]\n when %r/^\\d/; [name, \">= #{version}\"]\n else [name, version] end\nend", "def cask(name); dep name, :template => \"icelab:cask\"; end", "def setup_build_deps!\n ENV['PATH'] = \"#{File.expand_path('../../../vendor/depot_tools', __FILE__)}:#{ENV['PATH']}\"\n Dir.chdir(File.expand_path('../../../vendor', __FILE__)) do\n system \"fetch v8\" or fail \"unable to fetch v8 source\"\n Dir.chdir('v8') do\n unless system \"git checkout #{source_version}\"\n fail \"unable to checkout source for v8 #{source_version}\"\n end\n system \"gclient sync\" or fail \"could not sync v8 build dependencies\"\n end\n end\n end", "def activate_compiler_deps\n dependency \"rake-compiler\", \"~> 1.0\", :development\n\n gem \"rake-compiler\", \"~> 1.0\"\n rescue LoadError\n warn \"Couldn't load rake-compiler. Skipping. Run `rake newb` to fix.\"\n end", "def test_harness_dependencies(*)\n return unless platform[/n(5|6)k/]\n skip_if_nv_overlay_rejected(agent)\n\n # Vxlan has a hard requirement to disable feature fabricpath on n5/6k\n cmd = 'no feature-set fabricpath'\n command_config(agent, cmd, cmd)\nend", "def build\n sh './configure -u couchdb -c'\n make :release\n end", "def build_me\n # Download all softwares in parallel\n download\n build\n end", "def build_gem\n Juwelier::Commands::BuildGem.build_for(self).run\n end", "def depend_on( name, version = nil )\n spec = Gem::Specification.find_by_name(name)\n version = spec.version.to_s if version.nil? and !spec.nil?\n\n PROJ.gem.dependencies << case version\n when nil; [name]\n when %r/^\\d/; [name, \">= #{version}\"]\n else [name, version] end\nend", "def build_depfile(name, perform_installation=false)\n repo_hash = {}\n # set environment variable to determine what version of modules to install\n # this assumes that the environment variable repos_to_use has been coded in\n # your Depfile to allow installation of different versions of modules\n ENV['repos_to_use'] = name\n # parse Depfile and install modules in our tmp directory.\n eval(File.read(File.expand_path(options[:depfile])))\n # install modules if desired\n install! if perform_installation\n\n # iterate through all git modules\n each_module_of_type(:git) do |git_repo|\n abort(\"Module git_repo[:name] was defined multiple times in same Depfile\") if repo_hash[git_repo[:name]]\n repo_hash[git_repo[:name]] = git_repo\n end\n # clear out the modules once finished\n clear_modules\n repo_hash\n end", "def build_environment_resources(environment, system_exec)\n puts \"Building all required resources for environment '#{environment.environment_name}'\"\n\n if environment.is_drupal_environment?\n build_css_and_js_for_drupal\n environment.create_template_resources\n end\n\n copy_project_dependencies_for_awestruct_image\n build_base_docker_images(environment, system_exec)\n build_environment_docker_images(environment, system_exec)\n\nend", "def test_dependencies\n []\n end", "def test_dependencies\n []\n end", "def build_package\n # Force timestamp to be initialized before anything else. This gives us a\n # stable timestamp for the process.\n timestamp\n # Prepare the work area: copy files from root_path to work_path based on\n # the resolved Manifest.txt.\n prepare_work_area\n # Anything that has been modified locally needs to be reset.\n restore_modified_files\n # Save both the final release metadata and the in-package release metadata.\n save_release_metadata\n # Vendor the dependencies for the package.\n vendor_dependencies\n # Request that supporting plug-ins build the package.\n request_build_package\n end", "def activate_publish_deps\n dependency \"rdoc\", [\">= 4.0\", \"< 7\"], :developer if need_rdoc\n end", "def activate_inline_deps\n dependency \"RubyInline\", \"~> 3.9\"\n end", "def install\n # ENV.deparallelize # if your formula fails when building in parallel\n args = std_cmake_args\n if build.with? \"static\"\n args << \"-DBUILD_SHARED_LIBS:BOOL=OFF\"\n end\n inreplace \"cmake/External_zlib.cmake\", \"1.2.8\", \"1.2.11\"\n inreplace \"cmake/External_zlib.cmake\", \"44d667c142d7cda120332623eab69f40\", \"1c9f62f0778697a09d36121ead88e08e\"\n\n system \"cmake\", \".\", *args\n system \"make\"\n system \"make\", \"install\"\n end", "def require_gems; end", "def build_remote_dependencies\n modules_json_path = \"#{@mod.cache_dir}/.terraform/modules/modules.json\"\n return unless File.exist?(modules_json_path)\n\n initialized_modules = JSON.load(IO.read(modules_json_path))\n # For example of structure see spec/fixtures/initialized/modules.json\n initialized_modules[\"Modules\"].each do |meta|\n build_remote_mod(meta)\n end\n end", "def setup_sbt_build_targets(cmp, build_vars)\n cmp_src_path = component_src_path cmp\n cmp_build_bin = component_build_bin cmp\n cmp_hadoop_versions = component_hadoop_versions cmp\n cmp_spark_versions = component_spark_versions cmp\n\n # SBT build (for Scala code)\n sbt_file = lookup_sbt_file(cmp_src_path)\n if sbt_file != ''\n if cmp_build_bin != 'sbt'\n STDERR.puts \"[#{cmp}]: the builder is configured (in the YAML file) as '#{cmp_build_bin}', however it seems to be 'sbt'. Look in the source directory ('#{cmp_src_path}') for more details\"\n end\n\n # Store the SBT build file\n build_vars['BUILDER_FILES'] << sbt_file\n\n # Extract the elements of version from the SBT build file\n (sbt_version, has_hadoop, has_spark) = lookup_version_from_sbt_build(sbt_file)\n\n # Store the elements of version\n build_vars['PACKAGE_VERSIONS'][sbt_version] = true\n build_vars['HAS_HADOOP'] = has_hadoop\n build_vars['HAS_SPARK'] = has_spark\n\n # Set up the SBT build command line\n sbt_args_hadoop_list = Array.new\n sbt_args_list = Array.new\n sbt_args_base = \"\\'; #{CONF_SBT_ARGS} ; set version := \\\"#{sbt_version}\"\n if has_hadoop\n # There should be a target for every version of Hadoop\n cmp_hadoop_versions.each do |hadoop_version|\n sbt_args = \"#{sbt_args_base}-hadoop#{hadoop_version}\"\n sbt_args_hadoop_list << sbt_args\n end\n end\n\n if has_spark\n # When building for Spark, Hadoop is necessarily part of the target\n cmp_spark_versions.each do |spark_version|\n sbt_args_hadoop_list.each do |sbt_args|\n sbt_args += \"-spark#{spark_version}\"\n sbt_args_list << sbt_args\n end\n end\n\n else\n # Target for Hadoop, but not Spark\n sbt_args_hadoop_list.each do |sbt_args|\n sbt_args_list << sbt_args\n end\n end\n\n if sbt_args_list.empty?\n # Target with Hadoop, and potentially Spark\n sbt_args = sbt_args_base + \"\\\"\\'\"\n\n cmp_builder_cmds = \"#{cmp_build_bin} #{sbt_args}\"\n build_vars['BUILDER_CMDS'] = \"#{cmp_builder_cmds}\"\n\n cmp_builder_tasks = \"+compile +package +publishM2 +publishLocal\"\n build_vars['BUILDER_FULL_CMDS'] << \"#{cmp_builder_cmds} #{cmp_builder_tasks}\"\n # Set up the SBT test command line\n cmp_test_tasks = \"+test\"\n build_vars['TEST_FULL_CMDS'] << \"#{cmp_builder_cmds} #{cmp_test_tasks}\"\n\n else\n # Target with neither Hadoop nor Spark\n sbt_args_list.each do |sbt_args|\n sbt_args += \"\\\"\\'\"\n\n cmp_builder_cmds = \"#{cmp_build_bin} #{sbt_args}\"\n build_vars['BUILDER_CMDS'] = \"#{cmp_builder_cmds}\"\n \n cmp_builder_tasks = \"+compile +package +publishM2 +publishLocal\"\n build_vars['BUILDER_FULL_CMDS'] << \"#{cmp_builder_cmds} #{cmp_builder_tasks}\"\n \n # Set up the SBT test command line\n cmp_test_tasks = \"+test\"\n build_vars['TEST_FULL_CMDS'] << \"#{cmp_builder_cmds} #{cmp_test_tasks}\"\n end\n end\n\n else\n STDERR.puts \"[#{cmp}]: cannot determine the builder in '#{cmp_src_path}'\"\n end\nend", "def build_pkg(dist, arch, deps)\n start_dir = Dir.pwd\n build_dir = \"/tmp/rhobuild\"\n version = Rhoconnect::VERSION\n description = '\"Rhoconnect production environment\"'\n prefix = \"/opt/rhoconnect/installer\"\n gem_name = \"rhoconnect-#{version}.gem\"\n\n before_install_script = \"#{build_dir}/unix-like/pre_install.sh\"\n after_install_script = \"#{build_dir}/unix-like/post_install.sh\"\n before_remove_script = \"#{build_dir}/unix-like/pre_uninstall.sh\"\n after_remove_script = \"#{build_dir}/unix-like/post_uninstall.sh\"\n\n `rm -rf #{build_dir}` if File.exist?(\"#{build_dir}\")\n Dir.mkdir(\"#{build_dir}\")\n Dir.mkdir(\"#{build_dir}/unix-like\")\n\n # Copy all necessary Files into the build_dir\n system(\"cp install.sh Gemfile Gemfile.lock #{build_dir}\")\n system(\"cp -r installer/unix-like/*.sh #{build_dir}/unix-like\")\n system(\"cp -r installer/unix-like/*.rb #{build_dir}/unix-like\")\n system(\"cp pkg/#{gem_name} #{build_dir}\")\n\n # cd into the pkg dir so that fpm will create the package into the pkg dir.\n Dir.chdir(\"./pkg\") # it created by build task and should already exist\n\n # Construct fpm command\n fpm_cmd = \"fpm -s dir -t #{dist} -n rhoconnect -v #{version} -a #{arch} -C #{build_dir} --epoch 1 \" +\n \"--before-install #{before_install_script} --after-install #{after_install_script} \" +\n \"--before-remove #{before_remove_script} --after-remove #{after_remove_script} \" +\n \"--prefix #{prefix} --description #{description}\"\n # Add the list of dependencies to the fpm call\n deps.each { |dep| fpm_cmd << \" -d '#{dep}'\" }\n fpm_cmd << \" './'\"\n # Create the package\n system(fpm_cmd)\n # Leave no trace...\n system(\"rm -rf #{build_dir}\")\n Dir.chdir(start_dir)\nend", "def gemspec_building_block; end", "def update_dependencies()\n\t\"berks vendor cookbooks #{(@debug ? '-d' : '-q')}\"\n end", "def install_modules_dependencies(spec, new_arch_enabled: ENV['RCT_NEW_ARCH_ENABLED'] == \"1\")\n NewArchitectureHelper.install_modules_dependencies(spec, new_arch_enabled, $FOLLY_VERSION)\nend", "def build_cardio()\n CommandProcessor.command(\"VERSION=#{@current_release.version} ./releasinator.sh\", live_output=true)\nend", "def install\n system \"cmake\", \".\", *std_cmake_args\n system \"make\", \"install\"\n end", "def enable_dependency_loading=(_arg0); end", "def enable_dependency_loading=(_arg0); end", "def pre_build\n puts \"pre_build dir=#{`pwd`}\"\n rbvt = RUBY_V\n rbvm = RUBY_V[/^\\d+\\.\\d+/]\n mkdir_p \"#{TGT_DIR}/lib\"\n # clean out leftovers from last build\n rm_f \"#{TGT_DIR}/libruby.so\" if File.exist? \"#{TGT_DIR}/libruby.so\"\n rm_f \"#{TGT_DIR}/libruby.so.#{rbvm}\" if File.exist? \"#{TGT_DIR}/libruby.so.#{rbvm}\"\n rm_f \"#{TGT_DIR}/libruby.so.#{rbvt}\" if File.exist? \"#{TGT_DIR}/libruby.so.#{rbvt}\"\n cp_r \"#{EXT_RUBY}/lib/ruby\", \"#{TGT_DIR}/lib\"\n # copy and link libruby.so - pick the right one to \n # cp \"#{EXT_RUBY}/lib/libruby.so.#{RUBY_V}\", \"#{TGT_DIR}\"\n cp \"#{EXT_RUBY}/lib/libruby.so.#{rbvm}\", \"#{TGT_DIR}\"\n # copy include files - it might help build gems\n mkdir_p \"#{TGT_DIR}/lib/ruby/include/ruby-#{rbvt}\"\n cp_r \"#{EXT_RUBY}/include/ruby-#{rbvt}/\", \"#{TGT_DIR}/lib/ruby/include\"\n # can't figure out ln -s? push pwd, cd, ln, pop\n #cdir = pwd\n #cd TGT_DIR\n chdir TGT_DIR do\n ln_s \"libruby.so.#{rbvm}\", \"libruby.so\"\n #ln_s \"libruby.so.#{RUBY_V}\", \"libruby.so.#{::RUBY_V[/^\\d+\\.\\d+/]}\"\n end\n SOLOCS.each_value do |path|\n cp \"#{path}\", \"#{TGT_DIR}\"\n end\n end", "def dependency_met?\n true\n end", "def gemspec( * )\n\t\traise \"Circular dependency: can't depend on the gemspec to build itself\"\n\tend", "def development?\n @dependency.type == :development\n end", "def build(chroot,dirs,task,add_to_autoreq=true,snapshot_release=false)\n validate_in_mock_group?\n _verbose = ENV.fetch('SIMP_PKG_verbose','no') == 'yes'\n\n # Default package metadata for reference\n default_metadata = YAML.load(File.read(\"#{@src_dir}/build/package_metadata_defaults.yaml\"))\n\n metadata = Parallel.map(\n # Allow for shell globs\n Array(dirs),\n :in_processes => get_cpu_limit,\n :progress => task.name\n ) do |dir|\n result = []\n\n fail(\"Could not find directory #{dir}\") unless Dir.exist?(dir)\n\n Dir.chdir(dir) do\n built_rpm = false\n unique_build = (get_cpu_limit != 1).to_s\n\n if _verbose\n $stderr.puts(\"Running 'rake pkg:rpm' on #{File.basename(dir)}\")\n end\n\n # We're building a module, override anything down there\n if File.exist?('metadata.json')\n unique_namespace = (0...24).map{ (65 + rand(26)).chr }.join.downcase\n\n Simp::Rake::Pkg.new(Dir.pwd, nil, unique_namespace, @simp_version)\n\n Rake::Task[\"#{unique_namespace}:pkg:rpm\"].invoke(chroot, unique_build, snapshot_release)\n\n built_rpm = true\n\n # We're building one of the extra assets and should honor its Rakefile\n elsif File.exist?('Rakefile')\n\n rake_flags = Rake.application.options.trace ? '--trace' : ''\n\n cmd = %{SIMP_BUILD_version=#{@simp_version} rake pkg:rpm[#{chroot},#{unique_build},#{snapshot_release}] #{rake_flags} 2>&1}\n\n build_success = true\n begin\n ::Bundler.with_clean_env do\n %x{#{cmd}}\n build_success = $?.success?\n end\n\n built_rpm = true\n rescue\n build_success = false\n end\n\n unless build_success\n if _verbose\n $stderr.puts(\"First 'rake pkg:rpm' attempt failed, running bundle and trying again.\")\n end\n\n ::Bundler.with_clean_env do\n %x{bundle install --with development}\n %x{#{cmd}}\n end\n end\n else\n puts \"Warning: '#{dir}' could not be built via Rake\"\n end\n\n if built_rpm\n tarballs = Dir.glob('dist/*.tar.gz')\n srpms = Dir.glob('dist/*.src.rpm')\n rpms = (Dir.glob('dist/*.rpm') - srpms)\n\n # Not all items generate tarballs\n tarballs.each do |pkg|\n if (File.stat(pkg).size == 0)\n raise(\"Empty Tarball '#{pkg}' generated for #{dir}\")\n end\n end\n raise(\"No SRPMs generated for #{dir}\") if srpms.empty?\n raise(\"No RPMs generated for #{dir}\") if rpms.empty?\n\n last_build = {\n 'git_hash' => %x{git show-ref --head HEAD}.chomp,\n 'rpms' => {}\n }\n\n # Glob all generated rpms, and add their metadata to a result array.\n rpms.each do |rpm|\n # get_info from each generated rpm, not the spec file, so macros in the\n # metadata have already been resolved in the mock chroot.\n metadata = Simp::RPM.get_info(rpm)\n\n if File.exist?('build/package_metadata.yaml')\n metadata.merge!(YAML.load_file('build/package_metadata.yaml'))\n end\n\n rpm_stat = File.stat(rpm)\n\n last_build['rpms'][rpm] = {\n 'metadata' => metadata,\n 'size' => rpm_stat.size\n }\n\n result << metadata\n end\n\n File.open('dist/.last_build_metadata', 'w') do |fh|\n fh.puts(last_build.to_yaml)\n end\n end\n\n if _verbose\n $stderr.puts(\"Finshed 'rake pkg:rpm' on #{File.basename(dir)}\")\n end\n end\n\n result\n end\n\n metadata.each do |mod|\n # Each module could generate multiple rpms, each with its own metadata.\n # Iterate over them to add all built rpms to autorequires.\n mod.each do |module_pkginfo|\n next unless (module_pkginfo && module_pkginfo.is_a?(Hash))\n\n # Set up the autorequires\n if add_to_autoreq\n # Register the package with the autorequires\n mode = 'r+'\n mode = 'w+' unless File.exist?(\"#{@src_dir}/build/autorequires\")\n autoreq_fh = File.open(\"#{@src_dir}/build/autorequires\",mode)\n\n begin\n # Reads the autorequires file, then empties it\n autorequires = []\n autorequires += autoreq_fh.read.split(\"\\n\")\n autoreq_fh.rewind\n autoreq_fh.truncate(0)\n\n # The SIMP Rakefile expects the autorequires to be in this format.\n autorequires << \"#{module_pkginfo[:name]} #{module_pkginfo[:version]} #{module_pkginfo[:release]}\"\n autoreq_fh.puts(autorequires.sort.uniq.join(\"\\n\"))\n ensure\n autoreq_fh.flush\n autoreq_fh.close\n end\n end\n end\n end\n end", "def install_git_packages\n at_compile_time do\n package 'git'\n end\n end", "def dependencies\n\t\t0\n\tend", "def fetch_dependencies()\n\t\"berks vendor cookbooks #{(@debug ? '-v' : '-q')}\"\n end", "def vendor_dependencies\n fetch_bundler\n bundle_install\n end", "def pre_build\n puts \"pre_build dir=#{`pwd`}\"\n rbvt = RUBY_V\n rbvm = RUBY_V[/^\\d+\\.\\d+/]\n mkdir_p \"#{TGT_DIR}/lib\"\n # clean out leftovers from last build\n rm_f \"#{TGT_DIR}/libruby.so\" if File.exist? \"#{TGT_DIR}/libruby.so\"\n rm_f \"#{TGT_DIR}/libruby.so.#{rbvm}\" if File.exist? \"#{TGT_DIR}/libruby.so.#{rbvm}\"\n rm_f \"#{TGT_DIR}/libruby.so.#{rbvt}\" if File.exist? \"#{TGT_DIR}/libruby.so.#{rbvt}\"\n cp_r \"#{EXT_RUBY}/lib/ruby\", \"#{TGT_DIR}/lib\"\n # copy and link libruby.so - pick the right one to \n cp \"#{EXT_RUBY}/lib/libruby.so.#{rbvm}\", \"#{TGT_DIR}\"\n # copy include files - it might help build gems\n mkdir_p \"#{TGT_DIR}/lib/ruby/include/ruby-#{rbvt}\"\n cp_r \"#{EXT_RUBY}/include/ruby-#{rbvt}/\", \"#{TGT_DIR}/lib/ruby/include\"\n chdir TGT_DIR do\n ln_s \"libruby.so.#{rbvm}\", \"libruby.so\"\n end\n SOLOCS.each_value do |path|\n cp \"#{path}\", \"#{TGT_DIR}\"\n end\n end", "def gem_build_task(gem,namespace_name=:gems)\n namespace(namespace_name) do\n gem_dir = CapyBrowser::Rake::RelativePath.new('tmp/gems').path\n directory gem_dir\n\n desc gem.build_description\n task :build => [:directories,gem.name.to_sym ] do |t|\n t.reenable\n end\n\n desc \"Build all gems\"\n task :rebuild do |t|\n rm_rf(gem_dir)\n Rake::Task[\"gems:build\"].reenable\n Rake::Task[\"gems:build\"].invoke\n end\n\n desc gem.build_gemfile_description\n task gem.name.to_sym => [gem.gemfile] do |t|\n t.reenable\n end\n\n file \"tmp/vendor/cache/#{gem.gemfile}\" => [gem.gemfile_path.relative_path]\n file gem.gemfile_path.relative_path => gem.gemfile\n file gem.gemfile => gem_dir do |t|\n puts gem.invoke!\n rm_rf(gem_dir)\n end\n end\nend", "def depend(location, type, *args)\n if type == :gemfile\n registry = GemInstaller::Registry.new\n config_builder = registry.config_builder\n path = args.pop\n config_builder.config_file_paths = path\n config = config_builder.build_config\n gems = config.gems\n \n gems.each do |agem|\n # gem() function defined in Capistrano's RemoteDependency class\n options = pluck_accessor_hash(agem, [:platform, :install_options, :check_for_upgrade, :no_autogem, :fix_dependencies])\n depend_without_gemfile(location, :gem, agem.name, agem.version, options)\n end\n else\n depend_without_gemfile(location, type, *args)\n end\n end", "def maven_auto_artifact (module_name)\n builder = artifacts_builder\n builder.collect(File.join(build_repository, module_name, \"target\"), /classes/, /test-classes/, /maven-archiver/)\n builder.to_set\nend", "def build(rakeTask)\n\t\tfilePrereqs = filePrereqs() #remove internal build-system stuff\n\t\tunless FileUtils.uptodate?(target(), filePrereqs) #the check rake does always fails because it includes a non-file prereq task\n\t\t\tstaticLibMaintainer().addOrUpdate(:lib => target(), :objs => filePrereqs)\n\t\t\tstaticLibMaintainer().index(target())\n\t\tend\n\tend" ]
[ "0.69059354", "0.675044", "0.6558107", "0.64560115", "0.6422537", "0.6393465", "0.62657166", "0.6190308", "0.6190308", "0.6135606", "0.60239774", "0.60239774", "0.60239774", "0.602081", "0.59494925", "0.59151554", "0.5829265", "0.58019245", "0.5750149", "0.57219386", "0.569626", "0.5680574", "0.56299996", "0.5605356", "0.5586222", "0.5586222", "0.5586222", "0.55617094", "0.55563277", "0.5541025", "0.5540343", "0.5470047", "0.54374534", "0.54374534", "0.54203945", "0.5419113", "0.5402463", "0.5387709", "0.5368283", "0.5368263", "0.53662384", "0.53632635", "0.5361974", "0.53559244", "0.53538543", "0.53534997", "0.5344923", "0.53439784", "0.53301996", "0.53147185", "0.5304832", "0.53031415", "0.53020984", "0.53020984", "0.5297328", "0.52951086", "0.52951086", "0.5289423", "0.5286542", "0.52792835", "0.5259623", "0.5252923", "0.5248771", "0.5247337", "0.5239168", "0.5235303", "0.52328837", "0.52321494", "0.5221433", "0.52201", "0.5219205", "0.5219205", "0.52180994", "0.52175206", "0.5209822", "0.5197367", "0.5188044", "0.5180564", "0.5139647", "0.5135552", "0.5128098", "0.51115155", "0.5110006", "0.510715", "0.5099911", "0.5088064", "0.5088064", "0.5083699", "0.5083293", "0.5076277", "0.50623", "0.5047772", "0.5044501", "0.504447", "0.504434", "0.5032717", "0.5031779", "0.5029387", "0.50243205", "0.50229543", "0.5020513" ]
0.0
-1
GET /accession_location_entries/1 GET /accession_location_entries/1.json
def show @accession_location_entry = AccessionLocationEntry.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @accession_location_entry } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def locations\n get('locations')\n end", "def get_location\n as_json(get_results('/locations.json'))\n end", "def new\n @accession_location_entry = AccessionLocationEntry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @accession_location_entry }\n end\n end", "def index\n locations = Location.all\n render json: locations\n end", "def client_locations\n @entries = @locations\n end", "def index\r\n @locations = Location.all\r\n @mv = MapsVersion.first\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @locations }\r\n end\r\n end", "def index\n @map = Map.find(params[:map_id])\n if @map.kind == \"activity\"\n @locations = @map.locations.activity\n elsif @map.kind == \"news\"\n @locations = @map.locations.news\n else\n @locations = @map.locations\n end\n respond_to do |format|\n format.json { render :json => @locations.as_json(:include => :location_pin)}\n end\n end", "def event_get_location_details\n @loc = Apis::HereApi.new(\"\").get_location_details(params[:locationid])\n render json: @loc\n end", "def test_can_get_entry\n gable_entry = SEED_ENTRIES.first\n insert_entry(DB.get, gable_entry)\n\n get '/api/entries/Gable'\n assert last_response.ok?\n\n location = \"/api/entries/#{gable_entry[:slug]}\"\n\n parsed_resp = parse_json_resp(last_response)\n assert_instance_of Hash, parsed_resp\n assert_equal gable_entry[:word], parsed_resp['word']\n assert_equal gable_entry[:definition], parsed_resp['definition']\n assert_equal location, parsed_resp['location']\n end", "def show\n @location_url_map = LocationUrlMap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location_url_map }\n end\n end", "def index\n @locations = Location.order(\"id desc\").page(params[:page]).per(50)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @locations }\n end\n end", "def index\n @clinic_locations = ClinicLocation.all\n\n # respond_to do |f|\n # f.json { render :index, location: @clinic_locations }\n # end\n end", "def locations(place)\n get :loc => place\n end", "def index\n locations = @project.locations.all\n render json: { locations: locations }\n end", "def index\n @api_v1_locations = Api::V1::Location.all\n respond_to do |format|\n format.html { @api_v1_locations }\n format.json { render json: {results: @api_v1_locations, message: 'Locations have loaded successfully.'} }\n end\n end", "def index\r\n @locations = Location.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @locations }\r\n end\r\n end", "def index\n @locations = Location.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @locations }\n end\n end", "def index\n @recipe_locations = RecipeLocation.all\n end", "def show\n @curpg = :admintools\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n end\n end", "def location_primer\n render(json: location_list)\n end", "def show\n @taxonomy_term = TaxonomyTerm.find(params[:id])\n \n @locations = apply_scopes(@taxonomy_term.locations).uniq().page(params[:page]).per(params[:per_page])\n \n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @taxonomy_term }\n end\n end", "def index\n @locations = Location.roots.order(:location_name) \n render :json => @locations #Using Location serializer by default\n end", "def location_list\n @business_events = BusinessEvent.select(:id, :name, :image, :business_event_category_id)\n render json: @business_events.to_json(\n :methods => [:activity_types, :marker],\n include: {\n business_addresses: {only: [:id, :name, :address, :latitude, :longitude]},\n event_activities: {except: []}\n }),\n status: 200\n end", "def show\n @campus_food = CampusFood.find(params[:id])\n\t@loc = params[:loc]\n\t\n\t@locations = Location.all(:conditions =>[ \"loc like ? \", \"%#{params[:loc]}%\"])\n\tif !@locations.empty?\n @lat = @locations[0].lat\n @lng = @locations[0].lng\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @locations }\n end\n end", "def index\n @locs = Loc.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @locs }\n end\n end", "def locations id, date = Date.today.to_s\n uri = \"#{BASE_URL}/gauges/#{id}/locations?date=#{date}\"\n fetch uri\n end", "def get_entries(json: nil, ld: nil)\n entries = []\n data = ld ? ld[self.uri] : nil\n if data\n data.each do |key, value|\n prefix, index = key.split('_')\n entries[index.to_i - 1] = self.factory.get(value[0]['value'], self, ld: ld) if prefix == KEY_PREFIX\n end\n end\n entries\n end", "def show\n @event = Event.find_by_url(params[:id])\n @json = Location.where(id: @event.location_id).to_gmaps4rails\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @locations }\n end\n end", "def show\n @corp_location = CorpLocation.get(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @corp_location }\n end\n end", "def get_json\n response = conn.get(@current_location)\n parsed = JSON.parse(response.body, symbolize_names: true)\n\n end", "def index\n @service_locations = ServiceLocation.all\n render json: @service_locations\n end", "def show\n render json: Location.find(params[\"id\"])\n end", "def index\n @event_locations = EventLocation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @event_locations }\n end\n end", "def query\n { :locations => [] }\n end", "def index\n @user_locations = ::Users::UserLocation.where(user_id: auth_user.id).order('is_primary desc')\n @page_title = 'Your Addresses'\n\n respond_to do|format|\n format.html\n format.json { render json: @user_locations }\n end\n end", "def show\n respond_to do |format|\n format.html { @api_v1_location }\n format.json { render json: {results: @api_v1_location, message: 'Locations have loaded successfully.'} }\n end\n end", "def locations\n farm = Farm.find(params[:id])\n\n @locations = []\n # Find which locations this user is authorized to access\n if (current_user.is_hog_owner? || current_user.is_farm_owner? || current_user.is_admin?)\n @locations = farm.locations\n elsif current_user.is_barn_manager?\n @locations << current_user.owner.barn.location\n elsif current_user.is_site_manager?\n @locations << current_user.owner.location\n end\n\n @page_title = \"Sites\"\n @header_icon_class = \"icon-road\"\n @page_subtitle = \"\"\n \n respond_to do |format|\n format.html { render '/locations/index' }\n format.json { render json: @locations }\n end\n end", "def show\n render :json => Location.find(params[:id])\n end", "def index\n @specific_locations = SpecificLocation.all\n end", "def get_json\n response = @api.request(:get, @location)\n response.body if response.status == 200\n end", "def show\n\t\t@all_locations = Location.where(:faculty => params[:id])\n\t\trender :json => @all_locations\n\tend", "def create\n @accession_location_entry = AccessionLocationEntry.new(params[:accession_location_entry])\n\n respond_to do |format|\n if @accession_location_entry.save\n format.html { redirect_to @accession_location_entry, notice: 'Accession location entry was successfully created.' }\n format.json { render json: @accession_location_entry, status: :created, location: @accession_location_entry }\n else\n format.html { render action: \"new\" }\n format.json { render json: @accession_location_entry.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @accession_location_entry = AccessionLocationEntry.find(params[:id])\n @accession_location_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to accession_location_entries_url }\n format.json { head :no_content }\n end\n end", "def get(params = {})\n client.get(\"/v1/reference-data/locations/#{@location_id}\", params)\n end", "def index\n @items_locations = ItemsLocation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items_locations }\n end\n end", "def index\n @crash_locations = CrashLocation.all\n gon.locations = retrieve_locations\n end", "def index\n @locations = @organization.locations.all\n\n @map = Cartographer::Gmap.new( 'map' )\n @map.zoom = :bound\n @map.icons << Cartographer::Gicon.new\n \n @organization.locations.each do |location|\n @map.markers << \n Cartographer::Gmarker.new(\n :name => 'location_'+Digest::MD5.hexdigest(location.name),\n :marker_type => \"Building\",\n :position => [location.lat, location.lng],\n :info_window_url => \"fixme.org\"\n )\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @locations }\n end\n end", "def index\n @processed_locations = ProcessedLocation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @processed_locations }\n end\n end", "def show\n @event_location = EventLocation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event_location }\n end\n end", "def index\n @locations = current_user.locations\n respond_with @locations\n end", "def index\n @maplocations = Maplocation.all\n end", "def show\n render json: @service_location\n end", "def locations\n locations_params = Hashie::Mash.new( {f: params.f} )\n response = make_request(LOCATIONS_BASE, locations_params)\n return not_available (response) unless response.status == 200\n response_body = Hashie::Mash.new(JSON.parse(response.body))\n response_body.data\n end", "def client_outlets\n @entries = Outlet.where(location_id: params[:location]) if request.xhr? \n end", "def show\n @records_location = RecordsLocation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @records_location }\n end\n end", "def index\n @locations = Location.all\n end", "def index\n @locations = Location.all\n end", "def index\n @locations = Location.all\n end", "def index\n @locations = Location.all\n end", "def index\n @locations = Location.all\n end", "def index\n @locations = Location.all\n end", "def index\n @locations = Location.all\n end", "def index\n @locations = Location.all\n end", "def index\n @locations = Location.all\n end", "def index\n @locations = Location.all\n end", "def index\n @locations = Location.all\n end", "def show\n if can?(:>=, \"5\")\n @location = Kitting::Location.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n end\n else\n redirect_to main_app.unauthorized_url\n end\n end", "def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n end\n end", "def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n end\n end", "def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n end\n end", "def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n end\n end", "def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n end\n end", "def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n end\n end", "def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n end\n end", "def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n end\n end", "def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n end\n end", "def show\n @location = Location.find(params[:id])\n render json: @locationProut\n end", "def index\n @maps = current_user.owned_maps\n respond_with @maps, :include => :waypoints\n end", "def show\n @processed_location = ProcessedLocation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @processed_location }\n end\n end", "def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @location }\n end\n end", "def show\n @items_location = ItemsLocation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @items_location }\n end\n end", "def index\n if can?(:>=, \"5\")\n @locations = Kitting::Location.where(\"customer_number = ? OR customer_number IS NULL\",session[:customer_number])\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @locations }\n end\n else\n redirect_to main_app.unauthorized_url\n end\n end", "def show\n @loc = Loc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @loc }\n end\n end", "def index\n @location_details = LocationDetail.all\n end", "def show\n @location_have_location = LocationHaveLocation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location_have_location }\n end\n end", "def index\n @location_points = LocationPoint.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @location_points }\n end\n end", "def list_locations # :nologin:\n query = create_query(:Location, :all, :by => :name)\n show_selected_locations(query, :link_all_sorts => true)\n end", "def index\n @locations = Location.all\n\n respond_with(@locations)\n end", "def show\r\n @location = Location.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @location }\r\n end\r\n end", "def show\n @entry = Entry.find(params[:id])\n\n render json: @entry\n end", "def get_related_locations(location_ids, output_directory)\n specific_locations = LOCATIONS.find_all { |loc| location_ids.include?(loc[:id]) }\n generate_ndjson(\"Location\", specific_locations, output_directory)\nend", "def location(location,types=nil)\n handle_response(get(\"/content/location.json\", :query => {:location => location,:types=>types}))\n end", "def get_json(location)\n response = RestClient::Request.new(\n :method => :get,\n :url => location,\n :user => $username,\n :password => $password,\n :headers => { :accept => :json,\n :content_type => :json,\n :params => { \"page\" => 1, \"per_page\" => 1000 }\n }\n ).execute\n results = JSON.parse(response.to_str)\n end", "def get_json(location)\n response = RestClient::Request.new(\n :method => :get,\n :url => location,\n :user => $username,\n :password => $password,\n :headers => { :accept => :json,\n :content_type => :json,\n :params => { \"page\" => 1, \"per_page\" => 1000 }\n }\n ).execute\n results = JSON.parse(response.to_str)\n end", "def get_json(location)\n response = RestClient::Request.new(\n :method => :get,\n :url => location,\n :user => $username2,\n :password => $password2,\n :headers => { :accept => :json,\n :content_type => :json,\n :params => { \"page\" => 1, \"per_page\" => 1000 }\n }\n ).execute\n results = JSON.parse(response.to_str)\n end", "def from_search\n name = params[:id]\n lat = params[:lat]\n lon = params[:lon]\n @locations = Location.locations_from_candy_ids(Candy.ids_by_name(name))\n if(lat and lon)\n @locations = Location.nearest_five(lat.to_f, lon.to_f, @locations)\n end\n\n respond_to do |format|\n format.html\n format.json { render :json => @locations }\n end\n end", "def event_location_suggestions\n @here = Apis::HereApi.new(params[:address]).get_suggestions\n render json: @here\n end", "def get_json(location)\n response = RestClient::Request.new(\n :method => :get,\n :url => location,\n :user => $username,\n :password => $password,\n :timeout => -1,\n :headers => { :accept => :json,\n :content_type => :json ,\n :params => { \"page\" => 1, \"per_page\" => 25000 }}\n ).execute\n results = JSON.parse(response.to_str)\n end", "def entries\n uri = URI(BASE_URL + ENTRIES_ENDPOINT + days_query)\n\n make_request(uri)\n end" ]
[ "0.65202993", "0.64902353", "0.64635515", "0.6282157", "0.6237028", "0.6159012", "0.61464167", "0.6120498", "0.6094246", "0.6031871", "0.60231113", "0.6014338", "0.5984254", "0.59740543", "0.5971812", "0.59533226", "0.5952472", "0.5937841", "0.59320223", "0.59299326", "0.5925733", "0.5919244", "0.5918863", "0.59095806", "0.59094393", "0.59036124", "0.5900908", "0.58964324", "0.5891162", "0.5889307", "0.588195", "0.5880209", "0.58725137", "0.5869007", "0.5865835", "0.5849118", "0.5842401", "0.5831683", "0.5829796", "0.580447", "0.5802862", "0.57836854", "0.57827985", "0.57775736", "0.5768106", "0.5757528", "0.5750479", "0.5749819", "0.5687866", "0.567721", "0.56767744", "0.56761265", "0.5671271", "0.5670531", "0.5664138", "0.56640506", "0.5661184", "0.5661184", "0.5661184", "0.5661184", "0.5661184", "0.5661184", "0.5661184", "0.5661184", "0.5661184", "0.5661184", "0.5661184", "0.5651861", "0.56500894", "0.56500894", "0.56500894", "0.56500894", "0.56500894", "0.56500894", "0.56500894", "0.56500894", "0.56500894", "0.5637233", "0.56330097", "0.5630738", "0.56299156", "0.5622127", "0.562076", "0.56082165", "0.5604789", "0.560298", "0.5602701", "0.5598178", "0.5594154", "0.5587659", "0.5580809", "0.5580433", "0.5580323", "0.55726546", "0.55726546", "0.55706966", "0.55683404", "0.5557137", "0.5556036", "0.5553136" ]
0.7180944
0
GET /accession_location_entries/new GET /accession_location_entries/new.json
def new @accession_location_entry = AccessionLocationEntry.new respond_to do |format| format.html # new.html.erb format.json { render json: @accession_location_entry } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @accession_location_entry = AccessionLocationEntry.new(params[:accession_location_entry])\n\n respond_to do |format|\n if @accession_location_entry.save\n format.html { redirect_to @accession_location_entry, notice: 'Accession location entry was successfully created.' }\n format.json { render json: @accession_location_entry, status: :created, location: @accession_location_entry }\n else\n format.html { render action: \"new\" }\n format.json { render json: @accession_location_entry.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @curpg = :admintools\n @location = Location.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @location }\n end\n end", "def new\n @loc = current_user.locs.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @loc }\n end\n end", "def new\n @locationmap = Locationmap.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @locationmap }\n end\n end", "def new\n @location_url_map = LocationUrlMap.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @location_url_map }\n end\n end", "def new\n @location = Location.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @location }\n end\n end", "def new\n @location = Location.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @location }\n end\n end", "def new\n @location = Location.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @location }\n end\n end", "def new\n @location = Location.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @location }\n end\n end", "def new\n @location = Location.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @location }\n end\n end", "def new\n @lookup = Lookup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lookup }\n end\n end", "def new\n @entry = Entry.new\n\n render json: @entry\n end", "def new\n @location = Location.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @location }\n end\n end", "def new\r\n @location = Location.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @location }\r\n end\r\n end", "def new\r\n @location = Location.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @location }\r\n end\r\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @location }\n end\n end", "def new\n @location = Location.new \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @location }\n end\n end", "def new\n @processed_location = ProcessedLocation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @processed_location }\n end\n end", "def new\n @corp_location = CorpLocation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @corp_location }\n end\n end", "def new\n if current_user.is_not_member?\n flash[:error] = \"You do not have permissions to access that feature.\"\n redirect_to root_path and return\n end\n \n @location_history = LocationHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @location_history }\n end\n end", "def new\n @records_location = RecordsLocation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @records_location }\n end\n end", "def new\n @items_location = ItemsLocation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @items_location }\n end\n end", "def new\n @event_location = EventLocation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @event_location }\n end\n end", "def new\n @entry = Entry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entry }\n end\n end", "def new\n @entry = Entry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entry }\n end\n end", "def new\n @entry = Entry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entry }\n end\n end", "def new\n @entry = Entry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entry }\n end\n end", "def new\n @entry = Entry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entry }\n end\n end", "def new\n @entry = Entry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entry }\n end\n end", "def new\n @entry = Entry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entry }\n end\n end", "def new\n @entry = Entry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entry }\n end\n end", "def create\n @curpg = :admintools\n @location = Location.new(params[:location])\n\n respond_to do |format|\n if @location.save\n format.html { redirect_to :controller => \"locations\", :action => \"index\" }\n format.json { render json: @location, status: :created, location: @location }\n else\n format.html { render action: \"new\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @location_have_location = LocationHaveLocation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @location_have_location }\n end\n end", "def new\n @admin_route = Admin::Route.new\n\t\t@admin_route.route_markers.build\n\t\t\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_route }\n end\n end", "def new\n\t @location = Location.new\n\t @months = Month.all\n\t @countries = Location.all.map(&:country).uniq\n\n\t respond_to do |format|\n\t format.html # new.html.erb\n\t format.json { render json: @location }\n\t end\n\t end", "def new\n @work_entry = WorkEntry.new\n @locations = Location.order(:name)\n @initial_codes = Code.where(location_id: @locations.first.id).all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @work_entry }\n end\n end", "def new\n @location = @organization.locations.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @location }\n end\n end", "def new\n @gl_entry = GlEntry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gl_entry }\n end\n end", "def new\n @location = Location.new\n respond_to do |format|\n format.html\n format.xml { render :xml => @location }\n format.json { render :text => @location.to_json }\n end\n end", "def new\n @location = Location.new\n @json = @location.to_gmaps4rails\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @location }\n end\n end", "def new\n @checklocation = Checklocation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @checklocation }\n end\n end", "def new\n if can?(:>=, \"5\")\n @location = Kitting::Location.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @location }\n end\n else\n redirect_to main_app.unauthorized_url\n end\n end", "def new\n @location = Location.new\n @location.build_series\n @city = @location.build_city\n \n set_site_entities @location\n \n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @location }\n end\n end", "def new\n do_new_resource\n get_project_if_exists\n do_set_attributes\n do_authorize_instance\n\n # initialize lat/lng to Brisbane-ish\n @site.longitude = 152\n @site.latitude = -27\n respond_to do |format|\n format.html\n format.json { respond_new }\n end\n end", "def new\n @entry_type = EntryType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entry_type }\n end\n end", "def new\n @map = Map.new\n\n puts @saved_locations\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @map }\n end\n end", "def new\n @record = Location.new\n @networks = current_user.entity.networks\n @location_types = Location.location_types\n\n respond_to do |format|\n format.html {render :layout => 'popup'} \n format.json { \n response = {}\n render json: response \n }\n end\n end", "def new\n @chef_mapping = ChefMapping.new\n @source = []\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @chef_mapping }\n end\n end", "def new\n @locacao = Locacao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @locacao }\n end\n end", "def new\n @poblamiento_import_location = PoblamientoImportLocation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @poblamiento_import_location }\n end\n end", "def new\n @entry_view = EntryView.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entry_view }\n end\n end", "def new\n @factors_location = FactorsLocation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @factors_location }\n end\n end", "def new\n @location_point = LocationPoint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @location_point }\n end\n end", "def new\n @map = Map.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @map }\n end\n end", "def new\n @locations = Location.all\n @itemname = Itemname.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @itemname }\n end\n end", "def new\n @timeentry = Timeentry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @timeentry }\n end\n end", "def new\n @shiftmap = Shiftmap.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shiftmap }\n end\n end", "def new\n @ldap_entry = LdapEntry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ldap_entry }\n end\n end", "def new\n @location = Location.new\n @pages = {}\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @location }\n end\n end", "def new\n @zone_updater = ZoneUpdater.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @zone_updater }\n end\n end", "def new\n @provider = Provider.new\n @provider.locations.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @provider }\n end\n end", "def new\n @time_entry = TimeEntry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @time_entry }\n end\n end", "def new\n @time_entry = TimeEntry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @time_entry }\n end\n end", "def new\n @time_entry = TimeEntry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @time_entry }\n end\n end", "def new\n @entity_mapping = EntityMapping.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entity_mapping }\n end\n end", "def new\n @map = current_user.maps.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @map }\n end\n end", "def new\r\n @discounts_on_location = DiscountsOnLocation.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @discounts_on_location }\r\n end\r\n end", "def new\n @entry = @resource_finder.new\n initialize_new_resource\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entry }\n end\n end", "def new\n @breadcrumb = 'create'\n @street_directory = StreetDirectory.new\n @towns = towns_dropdown\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @street_directory }\n end\n end", "def soccer_new\n entry = Entry.new\n entry.reference = \"\"\n entry.user = current_user\n entry.set_property(\"entrydate\", params[:data][:StartTime])\n entry.set_property(\"entrylocation\", params[:data][:location])\n entry.set_property(\"comment\", params[:data][:comment])\n entry.set_property(\"publicvisible\", 2)\n entry.public_visible = 2\n\n base_new(params, \"Soccer\", entry)\n end", "def new\n @location = Location.new(:status=>1)\n init_new_form\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @location }\n end\n end", "def new\n @map_marker = MapMarker.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @map_marker }\n end\n end", "def new\n @entry = Entry.new(project_id: @project.id, recorded_for: Date.today)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entry }\n end\n end", "def new\n @map_node = Map::Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @map_node }\n end\n end", "def new\n @location = Location.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @location }\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 @origin = OriginAddr.new\n \n drop_breadcrumb('新增')\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @origin }\n end\n end", "def new\n @private_location = PrivateLocation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @private_location }\n end\n end", "def new\n\t@desktop_override = true\n\tstartkey = @locality.path.dup.push(0)\n\tendkey = @locality.path.dup.push({})\n\t@places = Place.view(\"by_path_without_neighborhood_alpha\", :reduce => false, :startkey => startkey, :endkey => endkey)\n\t@event = Event.new\n\n\trespond_to do |format|\n\t format.html do\n\t\trender :layout => \"restlessnapkin\" # new.html.erb\n\t end\n\tend\n end", "def new\n @tutor_location = TutorLocation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tutor_location }\n end\n end", "def new\n if (current_user.role == \"customer\" || current_user.role == \"supervisor\")\n add_breadcrumb \"Location\", 'locations_path'\n add_breadcrumb \"Add new\", '#'\n @location = Location.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @location }\n end\n else\n redirect_to error_users_path and return\n end \n end", "def new\n @location = Location.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @location }\n end\n end", "def new\n @location = Location.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @location }\n end\n end", "def new\n @location = Location.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @location }\n end\n end", "def new\n @location = Location.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @location }\n end\n end", "def new\n @location = Location.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @location }\n end\n end", "def new\n @location = Location.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @location }\n end\n end", "def new\n @location = Location.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @location }\n end\n end", "def new\n\n return unless representsCompany?\n\n @location = Location.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @location }\n end\n end", "def new\n\t\t@location = Location.new \n\tend", "def new\n @entry = Entry.new(dob: Date.new(Date.today.year - 18, 1, 1))\n get_events\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entry }\n end\n end", "def new\n @entry = Entry.new(:entry_type => params[:entry_type].presence || 'post', :comment_status => 'open', :user_id => current_user.id)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entry }\n end\n end", "def new\n @location_property = LocationProperty.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @location_property }\n end\n end", "def new\n @subcellular_location = SubcellularLocation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @subcellular_location }\n end\n end", "def create\n @location = Location.new(params[:location])\n\t\n\t\n\t\n respond_to do |format|\n if @location.save\n format.html { redirect_to admin_locations_url(:site => current_site.id), notice: 'Location was successfully created.' }\n format.json { render json: @location, status: :created, location: admin_locations_url(:site => current_site.id) }\n else\n \n \tset_site_entities @location\n \t\n format.html { render action: \"new\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n #@location_hash = params[:location]\n @name = params[:name]\n @longitude = params[:longitude]\n @latitude = params[:latitude]\n end", "def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @location_region }\n end\n end", "def new\n @federal1870_census_entry = Federal1870CensusEntry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @federal1870_census_entry }\n end\n end", "def new\n @inventory_entry = InventoryEntry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inventory_entry }\n end\n end", "def new\n @meeting_location = MeetingLocation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @meeting_location }\n end\n end" ]
[ "0.7206542", "0.7106107", "0.71039516", "0.7068216", "0.7063189", "0.6962698", "0.6962698", "0.6962698", "0.6962698", "0.6962698", "0.69202393", "0.6903823", "0.69018424", "0.6899007", "0.6899007", "0.68906575", "0.68439025", "0.6823207", "0.678212", "0.67619354", "0.6758749", "0.67050797", "0.6703953", "0.667498", "0.667498", "0.667498", "0.667498", "0.667498", "0.667498", "0.667498", "0.667498", "0.6641068", "0.66290075", "0.66012365", "0.6574517", "0.6571554", "0.6568058", "0.65635425", "0.65560204", "0.6536802", "0.653586", "0.65235156", "0.65020734", "0.64941865", "0.6492835", "0.6490248", "0.6480772", "0.64728385", "0.6470349", "0.64592904", "0.6457889", "0.64439446", "0.64278233", "0.64218146", "0.6400049", "0.63915724", "0.63840574", "0.6376218", "0.6370902", "0.63681126", "0.636157", "0.6357361", "0.6357361", "0.6357361", "0.6351506", "0.6348499", "0.63469625", "0.63411146", "0.6338692", "0.63375914", "0.633154", "0.63259614", "0.6314298", "0.6312923", "0.6303319", "0.6301288", "0.63007504", "0.6300441", "0.6296066", "0.62934405", "0.62796557", "0.62752587", "0.62737536", "0.62737536", "0.62737536", "0.62737536", "0.62737536", "0.62737536", "0.62736344", "0.6264946", "0.62530786", "0.62522966", "0.6251735", "0.6241626", "0.6235839", "0.6228321", "0.6226349", "0.6208383", "0.6206609", "0.61976916" ]
0.78341454
0
POST /accession_location_entries POST /accession_location_entries.json
def create @accession_location_entry = AccessionLocationEntry.new(params[:accession_location_entry]) respond_to do |format| if @accession_location_entry.save format.html { redirect_to @accession_location_entry, notice: 'Accession location entry was successfully created.' } format.json { render json: @accession_location_entry, status: :created, location: @accession_location_entry } else format.html { render action: "new" } format.json { render json: @accession_location_entry.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def postLocation( location_id, type, country, language, name, formal_name, resolution, population, description, timezone, latitude, longitude, parent_town, parent_county, parent_province, parent_region, parent_neighbourhood, parent_district, postalcode, searchable_id, searchable_ids)\n params = Hash.new\n params['location_id'] = location_id\n params['type'] = type\n params['country'] = country\n params['language'] = language\n params['name'] = name\n params['formal_name'] = formal_name\n params['resolution'] = resolution\n params['population'] = population\n params['description'] = description\n params['timezone'] = timezone\n params['latitude'] = latitude\n params['longitude'] = longitude\n params['parent_town'] = parent_town\n params['parent_county'] = parent_county\n params['parent_province'] = parent_province\n params['parent_region'] = parent_region\n params['parent_neighbourhood'] = parent_neighbourhood\n params['parent_district'] = parent_district\n params['postalcode'] = postalcode\n params['searchable_id'] = searchable_id\n params['searchable_ids'] = searchable_ids\n return doCurl(\"post\",\"/location\",params)\n end", "def new\n @accession_location_entry = AccessionLocationEntry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @accession_location_entry }\n end\n end", "def create\n @locations = Location.paginate(:page => params[:page], :per_page => 30).order('updated_at DESC')\n @location = Location.create(params[:location])\n end", "def data_entry_params\n\t\t\tparams.require(:location).permit(:name, :description, :address1, :address2, :city_village, :state_province, :postal_code, :country, :latitude, :longitude, :creator, :date_created, :country_district, :neighborhood_cell, :region, :subregion, :township_division, :retired, :retired_by, :date_retired, :retire_reason, :parent_location, :uuid)\n \n end", "def test_can_post_valid_entry\n valid_entry = SEED_ENTRIES.first\n post_json '/api/entries', valid_entry.except(:slug)\n\n assert last_response.created?\n\n location = \"/api/entries/#{valid_entry[:slug]}\"\n assert last_response.headers['Location'] = location\n assert last_response.headers['Content-Location'] = location\n\n parsed_resp = parse_json_resp(last_response)\n assert_instance_of Hash, parsed_resp\n assert_equal valid_entry[:word], parsed_resp['word']\n assert_equal valid_entry[:definition], parsed_resp['definition']\n assert_equal location, parsed_resp['location']\n end", "def map_entry\n entry = {\n city: location['locality'],\n state: location['region'],\n address: address,\n zip_code: zip_code,\n event_source: 'mobilize',\n event_type: data['event_type'],\n event_title: data['title'],\n campaign: campaign_slug,\n include_on_carousel: show_on_carousel?,\n description: data['description'],\n location_name: location_name,\n featured_image_url: data['featured_image_url'],\n registration_link: data['browser_url'],\n timeslots: timeslots.map(&:as_json),\n latitude: latitude,\n longitude: longitude,\n hub_id: hub_id # this method comes from event.rb\n }\n entry[:end_date] = entry[:timeslots].last[:end_date]\n entry[:start_date] = entry[:timeslots].first[:start_date]\n entry[:end_date_string] = entry[:timeslots].last[:end_date_string]\n entry[:start_date_string] = entry[:timeslots].first[:start_date_string]\n entry\n end", "def save_locations(locations)\n File.open('location_data.json', 'w') do |file|\n file.puts locations\n end\n end", "def create\n @curpg = :admintools\n @location = Location.new(params[:location])\n\n respond_to do |format|\n if @location.save\n format.html { redirect_to :controller => \"locations\", :action => \"index\" }\n format.json { render json: @location, status: :created, location: @location }\n else\n format.html { render action: \"new\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "def client_locations\n @entries = @locations\n end", "def create\n @location = Location.new(params[:location])\n\t\n\t\n\t\n respond_to do |format|\n if @location.save\n format.html { redirect_to admin_locations_url(:site => current_site.id), notice: 'Location was successfully created.' }\n format.json { render json: @location, status: :created, location: admin_locations_url(:site => current_site.id) }\n else\n \n \tset_site_entities @location\n \t\n format.html { render action: \"new\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "def location_primer\n render(json: location_list)\n end", "def create\n @location = Location.new(\n name: location_params[:name],\n address_line_1: location_params[:lineOne],\n address_line_2: location_params[:lineTwo],\n lat: location_params[:lat],\n lng: location_params[:lng]\n )\n if @location.save\n render json: @location\n else\n render json: {message: 'creation failed'}\n end\n end", "def set_data_entry\n @location = Location.find(params[:id])\n end", "def create\n @regions = Region.all\n @location = Location.new(location_params)\n\n if params[:regions]\n @location_regions = Region.find(params[:regions])\n else\n @location_regions = []\n end\n\n @location.regions = @location_regions\n\n respond_to do |format|\n if @location.save\n @location.create_stat\n format.html { redirect_to @location, notice: 'Location was successfully created.' }\n format.json { render :show, status: :created, location: @location }\n else\n format.html { render :new }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @recipe_location = RecipeLocation.new(recipe_location_params)\n\n respond_to do |format|\n if @recipe_location.save\n format.html { redirect_to @recipe_location, notice: 'Recipe location was successfully created.' }\n format.json { render :show, status: :created, location: @recipe_location }\n else\n format.html { render :new }\n format.json { render json: @recipe_location.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @entry = Entry.new(params[:entry])\n respond_to do |format|\n if @entry.save\n format.html { redirect_to @entry, :notice => 'Entry was successfully created.' }\n format.json { render :json => @entry, :status => :created, :location => @entry }\n else\n @clients = Client.all.collect{ |c| [c.name, c.id] }\n @aircraft_types = AircraftType.all(:order => :name).collect{|c| [c.name, c.id]}\n \n format.html { render :action => \"new\" }\n format.json { render :json => @entry.errors, :status => :unprocessable_entity }\n end\n end\n end", "def destroy\n @accession_location_entry = AccessionLocationEntry.find(params[:id])\n @accession_location_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to accession_location_entries_url }\n format.json { head :no_content }\n end\n end", "def create\n @itinerary = Itinerary.new(itinerary_params)\n @start_loc = Location.create(address: params[:start_loc], is_origin: true, itinerary_id: @itinerary.id)\n @end_loc = Location.create(address: params[:end_loc], is_origin: false, itinerary_id: @itinerary.id)\n @itinerary.locations.push(@start_loc)\n @itinerary.locations.push(@end_loc)\n\n respond_to do |format|\n if @itinerary.save\n format.html { redirect_to @itinerary, notice: 'Itinerary was successfully created.' }\n format.json { render :show, status: :created, location: @itinerary }\n\n # origin = @itinerary.locations.new( address: params[:origin], is_origin: true )\n # origin.get_coords\n\n # destination = @itinerary.locations.new( address: params[:destination], is_origin: false )\n # destination.get_coords\n\n else\n format.html { render :new }\n format.json { render json: @itinerary.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @location = Location.new(params[:location])\n @location.save \n @hide_map = true\n if params[:subcategories] \n params[:subcategories].uniq.each do |subcategory| \n s = Subcategory.where(id: subcategory[:id]).first\n @location.subcategories << s if s\n end\n end\n respond_to do |format|\n if @location.valid?\n format.html { redirect_to @location, :notice => 'Location was successfully created.' }\n format.json { render :json => @location, :status => :created, :location => @location }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @location.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\r\n @location = Location.new(params[:location])\r\n\r\n respond_to do |format|\r\n if @location.save\r\n format.json { render json: @location, status: :created, location: @location }\r\n else\r\n format.json { render json: @location.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create_entries\n existing_mappings = site.mappings.where(path: canonical_paths)\n\n records = canonical_paths.map do |canonical_path|\n entry = BulkAddBatchEntry.new(path: canonical_path)\n entry.mappings_batch = self\n entry.mapping = existing_mappings.detect { |mapping| mapping.path == canonical_path }\n entry\n end\n\n BulkAddBatchEntry.import(records, validate: false)\n end", "def create\n @entry = Entry.new(entry_params)\n if @entry.valid?\n @entry.save\n render json: @entry, status: :created\n # , location: @entry\n else\n render json: @entry.errors, status: :unprocessable_entity\n end\n end", "def enter_locations(test_data)\n locations = test_data[CoreUseOfCollectionsData::LOCATION_LIST.name] || [{CoreUseOfCollectionsData::LOCATION.name => ''}]\n hide_notifications_bar\n prep_fieldsets_for_test_data([fieldset(CoreUseOfCollectionsData::LOCATION_LIST.name)], locations)\n locations.each_with_index do |location, index|\n logger.info \"Entering location data set at index #{index}: #{location}\"\n enter_auto_complete(location_input(index), location_options(index), location[CoreUseOfCollectionsData::LOCATION.name], 'Local Places')\n end\n end", "def enter_locations(test_data)\n locations = test_data[UseOfCollections::LOCATION_LIST.name] || [{ UseOfCollections::LOCATION.name => ''}]\n prep_fieldsets_for_test_data([fieldset(UseOfCollections::LOCATION_LIST.name)], locations)\n locations.each_with_index do |location, index|\n enter_auto_complete(location_input(index), location_options(index), location[UseOfCollections::LOCATION.name], 'Local Places')\n end\n end", "def create\n @location_url_map = LocationUrlMap.new(params[:location_url_map])\n\n respond_to do |format|\n if @location_url_map.save\n format.html { redirect_to @location_url_map, notice: 'Location url map was successfully created.' }\n format.json { render json: @location_url_map, status: :created, location: @location_url_map }\n else\n format.html { render action: \"new\" }\n format.json { render json: @location_url_map.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @location = Location.new(params[:location])\n\n respond_to do |format|\n if @location.save\n\tlogger.info \"location saved successfully\"\n\tlogger.info @location.to_json\n format.html { redirect_to @location, :notice => 'Location was successfully created.' }\n format.json { render :json => @location }\n else\n\tlogger.info \"error saving location\"\n format.html { render :action => \"new\" }\n format.json { render :json => @location.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @location = Location.new(location_params)\n\n if @location.save \n render :json => { status: :created, location: @location }\n else\n render :json => { errors: @location.errors, status: :unprocessable_entity }\n end\n end", "def show\n @accession_location_entry = AccessionLocationEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @accession_location_entry }\n end\n end", "def entries\n uri = URI(BASE_URL + ENTRIES_ENDPOINT + days_query)\n\n make_request(uri)\n end", "def entry_params\n params.require(:entry).permit(:event, :date, :location, :type)\n end", "def create\n return unless verify_locale_access(create_params[:rfc5646_locale])\n\n @locale_entry = @source_entry.locale_glossary_entries.create(create_params)\n respond_with @source_entry, @locale_entry, location: edit_glossary_source_locale_url(@source_entry, @locale_entry)\n end", "def index\n @recipe_locations = RecipeLocation.all\n end", "def location_map(search_results)\n \n @latlongs = {}\n @latlong = []\n used_districts = [] \n \n search_results.each do |result|\n unless result.district_id.nil? or result.country_id.nil? or result.district.latlong.nil? or result.district.latlong == \"\"\n \n if used_districts.include?(result.district_id) # just increase the count\n @latlongs[\"#{result.district_id}\"][:count] += 1\n \n else # add it to the latlongs\n \n used_districts << result.district_id\n district = District.find(result.district_id)\n district.province_id.nil? ? province = nil : province = Province.find(district.province_id)\n district.country_id.nil? ? country = nil : country = Country.find(district.country_id)\n \n @latlongs[\"#{result.district_id}\"] = {:country => country.name,\n :province => province.name,\n :district => district.name,\n :count => 1,\n :lat => district.latlong.split(\",\")[0],\n :lng => district.latlong.split(\",\")[1]}\n \n end \n \n end\n end # end search_results.each loop\n \n my_file = File.open(\"#{RAILS_ROOT}/public/data/map.json\", File::WRONLY|File::TRUNC|File::CREAT)\n my_file.puts \"{\\\"markers\\\": #{@latlongs.to_json.to_s} }\"\n my_file.close\n\n # render :text => @latlong.to_json\n end", "def create\n @mlog_entry = MlogEntry.new(mlog_entry_params)\n @collection = Collection.find(@mlog_entry[:collection_id])\n @accession = Accession.find(@mlog_entry[:accession_id])\n respond_to do |format|\n if @mlog_entry.save\n format.html { redirect_to @mlog_entry, notice: 'Entry was successfully created.' }\n format.json { render action: 'show', status: :created, location: @mlog_entry }\n else\n format.html { render action: 'new' }\n format.json { render json: @mlog_entry.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_entries(opts = {})\n data, _status_code, _headers = create_entries_with_http_info(opts)\n data\n end", "def update\n @accession_location_entry = AccessionLocationEntry.find(params[:id])\n\n respond_to do |format|\n if @accession_location_entry.update_attributes(params[:accession_location_entry])\n format.html { redirect_to @accession_location_entry, notice: 'Accession location entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @accession_location_entry.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @location = Location.new(location_params)\n\n respond_to do |format|\n if @location.save\n format.json { render :show, status: :created }\n else\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n respond_to do |format|\n if @location.save\n format.html { redirect_to @location, notice: 'Location was successfully created.' }\n format.json { render json: @location, status: :created, location: @location }\n else\n format.html { render action: \"new\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @locationmap = Locationmap.new(params[:locationmap])\n\n respond_to do |format|\n if @locationmap.save\n format.html { redirect_to @locationmap, notice: 'Locationmap was successfully created.' }\n format.json { render json: @locationmap, status: :created, location: @locationmap }\n else\n format.html { render action: \"new\" }\n format.json { render json: @locationmap.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @location = Location.new(params[:location])\n \n @location.location = current_location\n @location.location_type = \"shelf\"\n \n respond_to do |format|\n if @location.save\n format.html { redirect_to current_location, notice: 'Location was successfully created.' }\n format.json { render json: @location, status: :created, location: @location }\n else\n format.html { render action: \"new\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n name = params[:event][:location] || \"Unknown\"\n location = Location.name_search(Location.sanitize(name)).first\n location = Location.create!(:name => name, :gmaps => true) unless location\n\n @event = Event.new(params[:event].except(:location, :category_ids))\n @event.location = location\n # I know we do this for some particular reason but I forgot why...\n @event.start_at = params[:event][:start_at]\n @event.end_at = params[:event][:end_at]\n @event.set_categories params[:event][:category_ids]\n if @event.save\n render json: @event\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end", "def save_dictionary_entries(dictionary, dictionary_entries, opts = {})\n response = @transporter.write(\n :POST,\n path_encode('/1/dictionaries/%s/batch', dictionary),\n { clearExistingDictionaryEntries: false, requests: chunk('addEntry', dictionary_entries) },\n opts\n )\n\n DictionaryResponse.new(self, response)\n end", "def locations\n get('locations')\n end", "def create\n @location_mapping = LocationMapping.new(location_mapping_params)\n\n respond_to do |format|\n if @location_mapping.save\n format.html { redirect_to @location_mapping, notice: 'Location mapping was successfully created.' }\n format.json { render :show, status: :created, location: @location_mapping }\n else\n format.html { render :new }\n format.json { render json: @location_mapping.errors, status: :unprocessable_entity }\n end\n end\n end", "def entry\n authorize! :show, PointsEntryType\n authorize! :show, Client\n authorize! :create, PointsEntry\n\n load_points_entry_type\n build_client\n build_points_entry\n end", "def upload_locations\n puts 'Uploading Locations'\n\n cities_file = 'lib/textfiles/locations.txt'\n locations = []\n text = File.open(cities_file).read\n text.each_line do |line|\n tokens = line.split(\"\\t\").map(&:chomp)\n locations << Location.new(state: tokens[1], city: tokens[0])\n end\n Location.import(locations)\n end", "def create\n @records_location = RecordsLocation.new(params[:records_location])\n\n respond_to do |format|\n if @records_location.save\n format.html { redirect_to @records_location, notice: 'Records location was successfully created.' }\n format.json { render json: @records_location, status: :created, location: @records_location }\n else\n format.html { render action: \"new\" }\n format.json { render json: @records_location.errors, status: :unprocessable_entity }\n end\n end\n end", "def json_entry_params\n params.require(:json_entry).permit(:area_id, :data, :name, :verb, :post_body)\n end", "def location_submissions\n\t\t\n\tend", "def create\n @record = Location.new(params[:location]) \n @record.entity_id = current_user.entity._id\n\n @record.save!\n respond_to do |format|\n format.html { head :no_content }\n format.json { render json: {} }\n end\n end", "def new\n @location = Location.new\n @location.build_series\n @city = @location.build_city\n \n set_site_entities @location\n \n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @location }\n end\n end", "def entries\n params[:return_entries] = true\n self\n end", "def locations\n # blank\n end", "def index\n @clinic_locations = ClinicLocation.all\n\n # respond_to do |f|\n # f.json { render :index, location: @clinic_locations }\n # end\n end", "def test_can_get_entry\n gable_entry = SEED_ENTRIES.first\n insert_entry(DB.get, gable_entry)\n\n get '/api/entries/Gable'\n assert last_response.ok?\n\n location = \"/api/entries/#{gable_entry[:slug]}\"\n\n parsed_resp = parse_json_resp(last_response)\n assert_instance_of Hash, parsed_resp\n assert_equal gable_entry[:word], parsed_resp['word']\n assert_equal gable_entry[:definition], parsed_resp['definition']\n assert_equal location, parsed_resp['location']\n end", "def create\n @location = Spree::Location.new(location_params)\n\n respond_to do |format|\n if @location.save\n format.html { redirect_to '/admin/locations', notice: 'Location was successfully created.' }\n format.json { render :show, status: :created, location: @location }\n else\n format.html { render :new }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "def coordinates\n location = Location.new(location_params)\n if location.save\n render json: location\n else\n render json: \"ERROR\"\n end\n end", "def create\n @location = Location.new(params[:location]) \n # transale address into lat/long\n lat, long = Geocoder.coordinates(@location.full_address) \n \n response = get_place_report(params[:location], long, lat)\n @location.reference = response[\"reference\"]\n @location.general_type = get_general_type(params[:location][:types])\n respond_to do |format|\n if @location.save \n format.html { redirect_to(@location, :notice => 'Location was successfully created.') }\n format.xml { render :xml => @location, :status => :created, :location => @location } \n else\n @pages = {}\n format.html { render :action => \"new\" }\n format.xml { render :xml => @location.errors, :status => :unprocessable_entity }\n end\n end\n end", "def translate_response(start_locations, end_locations, response)\n final_output = {}\n o_addresses = response[\"origin_addresses\"]\n d_addresses = response[\"destination_addresses\"]\n rows = response[\"rows\"]\n\n start_locations.each_with_index do |location, o_index|\n\n dest_hash = {\"origin_address\" => o_addresses[o_index], \"destinations\" => {} }\n\n rows[o_index][\"elements\"].each_with_index do |destination_details, d_index|\n d = {}\n d[\"distance\"] = destination_details[\"distance\"][\"value\"]\n d[\"distance_text\"] = destination_details[\"distance\"][\"text\"]\n d[\"duration\"] = destination_details[\"duration\"][\"value\"]\n d[\"duration_text\"] = destination_details[\"duration\"][\"text\"]\n d[\"address\"] = d_addresses[d_index]\n\n dest_hash[\"destinations\"][end_locations[d_index]] = d\n end\n\n final_output[location] = dest_hash\n end\n\n final_output\nend", "def create_entries_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: EntriesApi.create_entries ...'\n end\n # resource path\n local_var_path = '/api/v1/entries'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'create_entries_input'] || opts[:body])\n\n # return_type\n return_type = opts[:debug_return_type] || 'Entry'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['authToken']\n\n new_options = opts.merge(\n :operation => :\"EntriesApi.create_entries\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: EntriesApi#create_entries\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update\n @locations = []\n @errors = []\n @hide_map = true\n if params.has_key? :id\n location = Location.find(params[:id])\n @locations = [ location ]\n location_params = params.clone\n [:created_at, :id, :updated_at, :category, :subcategories, :markerVisible, :action, :controller, :location].each do |param|\n location_params.delete param\n end\n location.update_attributes location_params\n @errors = location.errors\n elsif params.has_key? :locations\n params[:locations][:location].each do |data|\n l = Location.find data[0]\n if not l.update_attributes data[1]\n pp l.errors\n @errors.push l.errors\n end\n @locations.push l\n end\n end\n\n respond_to do |format|\n if @errors.empty?\n format.html { redirect_to :locations, :notice => 'Locations successfully updated.'}\n format.json { head :no_content }\n else\n format.html { render :action =>\"edit\" }\n format.json { render :json => @errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n locations = Location.all\n render json: locations\n end", "def create\n @trail = Trail.new(params[:trail])\n respond_to do |format|\n if @trail.save\n\t@trail.lat_map = elevation(@trail.longitude_start, @trail.latitude_start, @trail.longitude_end, @trail.latitude_end)\n\t@trail.gmap = staticmap_uri(@trail.longitude_start + \",\" + @trail.latitude_start + \"|\"+ @trail.longitude_end + \",\" + @trail.latitude_end)\n\t@trail.save\n format.html { redirect_to @trail, notice: 'Trail was successfully created.' }\n format.json { render json: @trail, status: :created, location: @trail }\n else\n format.html { render action: \"new\" }\n format.json { render json: @trail.errors, status: :unprocessable_entity }\n end\n end\n end", "def location_list\n @business_events = BusinessEvent.select(:id, :name, :image, :business_event_category_id)\n render json: @business_events.to_json(\n :methods => [:activity_types, :marker],\n include: {\n business_addresses: {only: [:id, :name, :address, :latitude, :longitude]},\n event_activities: {except: []}\n }),\n status: 200\n end", "def create\n @location = Location.new(params[:location])\n\n respond_to do |format|\n if @location.save\n format.html { redirect_to @location, notice: 'Location was successfully created.' }\n format.json { render json: @location, status: :created, location: @location }\n else\n format.html { render action: \"new\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @location = Location.new(params[:location])\n\n respond_to do |format|\n if @location.save\n format.html { redirect_to @location, notice: 'Location was successfully created.' }\n format.json { render json: @location, status: :created, location: @location }\n else\n format.html { render action: \"new\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @location = Location.new(params[:location])\n\n respond_to do |format|\n if @location.save\n format.html { redirect_to @location, notice: 'Location was successfully created.' }\n format.json { render json: @location, status: :created, location: @location }\n else\n format.html { render action: \"new\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @location = Location.new(params[:location])\n\n respond_to do |format|\n if @location.save\n format.html { redirect_to @location, notice: 'Location was successfully created.' }\n format.json { render json: @location, status: :created, location: @location }\n else\n format.html { render action: \"new\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if can?(:>=, \"5\")\n @location = Kitting::Location.new(params[:location])\n @location.customer_number = session[:customer_number]\n respond_to do |format|\n if @location.save\n format.html { redirect_to @location, notice: 'Location is created successfully.' }\n format.json { render json: @location, status: :created, location: @location }\n else\n format.html { render action: \"new\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n else\n redirect_to main_app.unauthorized_url\n end\n end", "def create\n @location = Location.new(params[:location].merge!(:user => current_user))\n\n respond_to do |format|\n if @location.save\n format.html { redirect_to @location, notice: 'La habitación se ha guardado exitosamente.' }\n format.json { render json: @location, status: :created, location: @location }\n else\n format.html { render action: \"new\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @located_at = LocatedAt.new(located_at_params)\n\n respond_to do |format|\n if @located_at.save\n format.html { redirect_to @located_at, notice: 'Located at was successfully created.' }\n format.json { render :show, status: :created, location: @located_at }\n else\n format.html { render :new }\n format.json { render json: @located_at.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n data = []\n trace_params.each do |p|\n hash = {\n latitude: p[\"latitude\"],\n longitude: p[\"longitude\"]\n }\n data << hash\n end\n\n if Trace.upload_data(data)\n render json: {status: 'OK'}\n else\n render json: @trace.errors, status: :unprocessable_entity\n end\n end", "def enter_pahma_locations(test_data)\n locations = test_data[UseOfCollections::LOCATION_LIST.name] || [{ UseOfCollections::LOCATION.name => ''}]\n prep_fieldsets_for_test_data([fieldset(UseOfCollections::LOCATION_LIST.name)], locations)\n locations.each_with_index do |location, index|\n enter_auto_complete(location_input(index), location_options(index), location[UseOfCollections::LOCATION.name], 'PAHMA Places')\n end\n end", "def create\n @service_location = ServiceLocation.new(service_location_params)\n if @service_location.save\n render json: @service_location, status: :created, location: @service_location\n else\n render json: @service_location.errors, status: :unprocessable_entity\n end \n end", "def create\n @entry = Entry.new(params[:entry])\n\n respond_to do |format|\n if @current_user.entries << @entry\n format.html { redirect_to user_entries_path, notice: 'Entry was successfully created.' }\n format.json { render json: @entry, status: :created, location: @entry }\n else\n format.html { render action: \"new\" }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event_location = EventLocation.new(event_location_params)\n\n respond_to do |format|\n if @event_location.save\n format.html { redirect_to @event_location, notice: 'Event location was successfully created.' }\n format.json { render json: @event_location, status: :created, location: @event_location }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event_location.errors, status: :unprocessable_entity }\n end\n end\n end", "def entries\n trace 'entries'\n $data['entries']\n end", "def index\n @maplocations = Maplocation.all\n end", "def location_params\n params.require(:location).permit(:address,:name,:autocomplete,:output,:info_panel, :count)\n end", "def create\n @loc = current_user.locs.new(params[:loc])\n\n respond_to do |format|\n if @loc.save\n format.html { redirect_to @loc, notice: 'Loc was successfully created.' }\n format.json { render json: @loc, status: :created, location: @loc }\n else\n format.html { render action: \"new\" }\n format.json { render json: @loc.errors, status: :unprocessable_entity }\n end\n end\n end", "def entry_params\n params.require(:entry).permit(\n :name,\n :description,\n :start_date,\n :end_date,\n :created_at,\n :updated_at,\n :imp_quantity,\n :advertiser_rate,\n :states,\n :zip_codes,\n :address,\n :agency_name,\n :advertiser_name,\n :advertiser_url,\n :geofence_poi,\n :audiences_prem => [],\n :platforms => [],\n :audiences => [],\n :metros => [],\n :carriers => [],\n :content_cats => [],\n :operating_sys => [],\n :creative_types => [],\n )\n end", "def read_locations_from file\n data_hash = []\n File.readlines(file).each do |line|\n data_hash << JSON.parse(line)\n end\n self.location_hash = data_hash\n self\n end", "def create\n @location = @organization.locations.build(params[:location])\n\n respond_to do |format|\n if @location.save\n format.html { redirect_to [@organization, @location], notice: 'Location was successfully created.' }\n format.json { render json: @location, status: :created, location: @location }\n else\n format.html { render action: \"new\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "def location_params\n params.require(:location).permit(:nr, :name, :description, :parent_id)\n end", "def create\n @entry = @time_sheet.entries.new(params[:entry])\n\n respond_to do |format|\n if @entry.save\n # [@user, @time_sheet, @entry]\n # user_time_sheet_entries_path(@user, @time_sheet)\n format.html { redirect_to user_time_sheet_entries_path(@user, @time_sheet), notice: 'Hours were successfully added.' }\n format.json { render json: [@user, @time_sheet, @entry], status: :created, location: [@user, @time_sheet, @entry] }\n else\n format.html { render action: \"new\" }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @processed_location = ProcessedLocation.new(params[:processed_location])\n\n respond_to do |format|\n if @processed_location.save\n format.html { redirect_to @processed_location, notice: 'Processed location was successfully created.' }\n format.json { render json: @processed_location, status: :created, location: @processed_location }\n else\n format.html { render action: \"new\" }\n format.json { render json: @processed_location.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @specific_location = SpecificLocation.new(specific_location_params)\n\n respond_to do |format|\n if @specific_location.save\n format.html { redirect_to @specific_location, notice: 'Specific location was successfully created.' }\n format.json { render :show, status: :created, location: @specific_location }\n else\n format.html { render :new }\n format.json { render json: @specific_location.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n delete_keys = params.keys.select{|k| k =~ /^delete-/}\n direction = 'created'\n if delete_keys.empty?\n locations = Location.find_near(params[:x], params[:y])\n @location = locations.empty? ?\n Location.create(:x => params[:x], :y => params[:y]) :\n locations.first\n @ministry.locations << @location\n else\n logger.info delete_keys.first\n delete, x, y = delete_keys.first.split('-')\n logger.info \"X: #{x}, Y: #{y}\"\n locations = Location.find_near(x, y)\n locations.each{|l| @ministry.locations.delete(l)}\n direction = 'deleted'\n end\n\n respond_to do |format|\n if @ministry.save\n flash[:notice] = \"Ministry location was successfully #{direction}.\"\n format.html { redirect_to(edit_ministry_path(@ministry)) }\n format.xml { render :xml => @ministry, :status => :created, :location => @ministry }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ministry.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n @location_mappings = LocationMapping.all\n end", "def create\n if current_user.is_not_member?\n flash[:error] = \"You do not have permissions to access that feature.\"\n redirect_to root_path and return\n end\n \n @location_history = LocationHistory.new(params[:location_history])\n\n respond_to do |format|\n if @location_history.save\n format.html { redirect_to @location_history, notice: 'Location history was successfully created.' }\n format.json { render json: @location_history, status: :created, location: @location_history }\n else\n format.html { render action: \"new\" }\n format.json { render json: @location_history.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @crash_locations = CrashLocation.all\n gon.locations = retrieve_locations\n end", "def set_Locations(value)\n set_input(\"Locations\", value)\n end", "def create\n @location = Location.new(params[:location])\n\n respond_to do |format|\n if @location.save\n @locations = Location.index_locations\n format.html { redirect_to(@location, :notice => 'Location was successfully created.') }\n format.xml { render :xml => @location, :status => :created, :location => @location }\n format.js\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @location.errors, :status => :unprocessable_entity }\n format.js\n end\n end\n end", "def test_map_nonexistent_location\n assert_raise(ActiveRecord::RecordNotFound) {\n get :map,\n :post_location_ids => [].push(999999999999)\n }\n end", "def query\n { :locations => [] }\n end", "def create\n @resource = Catalogs::Location.new(catalogs_location_params)\n\n respond_to do |format|\n if @resource.save\n index\n\n flash[:success] = t('notices.saved_successfully')\n format.html { redirect_to @resource, notice: 'Location was successfully created.' }\n format.json { render :show, status: :created, location: @resource }\n else\n format.html { render :new }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n format.js\n end\n end", "def map_locations # :nologin: :norobots:\n @query = find_or_create_query(:Location)\n if @query.flavor == :all\n @title = :map_locations_global_map.t\n else\n @title = :map_locations_title.t(:locations => @query.title)\n end\n @query = restrict_query_to_box(@query)\n @timer_start = Time.now\n columns = %w(name north south east west).map {|x| \"locations.#{x}\"}\n args = { :select => \"DISTINCT(locations.id), #{columns.join(', ')}\" }\n @locations = @query.select_rows(args).map do |id, name, n,s,e,w|\n MinimalMapLocation.new(id, name, n,s,e,w)\n end\n @num_results = @locations.count\n @timer_end = Time.now\n end", "def create\n @location = Location.new(location_params)\n\n respond_to do |format|\n if @location.save\n format.html { redirect_to locations_path, notice: 'Location was successfully created.' }\n format.json { render :show, status: :created, location: @location }\n else\n format.html { render :new }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @map = Map.find(params[:map_id])\n if @map.kind == \"activity\"\n @locations = @map.locations.activity\n elsif @map.kind == \"news\"\n @locations = @map.locations.news\n else\n @locations = @map.locations\n end\n respond_to do |format|\n format.json { render :json => @locations.as_json(:include => :location_pin)}\n end\n end", "def add_azr_location_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: RoomsLocationApi.add_azr_location ...'\n end\n # resource path\n local_var_path = '/rooms/locations'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'multipart/form-data'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'body'])\n auth_names = ['OAuth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse20077')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RoomsLocationApi#add_azr_location\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end" ]
[ "0.6242699", "0.5955907", "0.58618236", "0.57917845", "0.5767019", "0.5755245", "0.5726805", "0.5684456", "0.56395006", "0.5524876", "0.54961795", "0.54804873", "0.54216635", "0.54098195", "0.53835875", "0.53774047", "0.53772527", "0.53649586", "0.53627306", "0.53198624", "0.5319056", "0.53022146", "0.52873105", "0.5278113", "0.52705806", "0.52617353", "0.52543795", "0.52525204", "0.524097", "0.5231683", "0.5230031", "0.5224235", "0.52233917", "0.5211431", "0.5209229", "0.5207065", "0.5184272", "0.51801604", "0.5178363", "0.51759595", "0.51746774", "0.51695275", "0.5165045", "0.5163628", "0.51544267", "0.515351", "0.51493037", "0.5148337", "0.5146748", "0.5143605", "0.5140135", "0.51333666", "0.51243645", "0.511659", "0.51156956", "0.51137614", "0.51070404", "0.5105305", "0.5097572", "0.50912946", "0.50897324", "0.5085763", "0.50831646", "0.50757056", "0.50738734", "0.50738734", "0.50738734", "0.50738734", "0.5066228", "0.50631875", "0.5061704", "0.50586617", "0.5056743", "0.5051604", "0.50485206", "0.5047238", "0.50442344", "0.5039715", "0.50387144", "0.5038218", "0.5037731", "0.50369066", "0.5036528", "0.50261337", "0.50222313", "0.5017834", "0.50141996", "0.5012923", "0.5011655", "0.50065315", "0.4995855", "0.49870294", "0.4986843", "0.49838817", "0.49803862", "0.49773255", "0.49762863", "0.49758893", "0.4974204", "0.49698013" ]
0.6858917
0
PUT /accession_location_entries/1 PUT /accession_location_entries/1.json
def update @accession_location_entry = AccessionLocationEntry.find(params[:id]) respond_to do |format| if @accession_location_entry.update_attributes(params[:accession_location_entry]) format.html { redirect_to @accession_location_entry, notice: 'Accession location entry was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @accession_location_entry.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_location(params)\n @client.put(\"#{path}/location\", nil, params, \"Content-Type\" => \"application/json\")\n end", "def update\n render json: Location.update(params[\"id\"], params[\"location\"])\n end", "def create\n @accession_location_entry = AccessionLocationEntry.new(params[:accession_location_entry])\n\n respond_to do |format|\n if @accession_location_entry.save\n format.html { redirect_to @accession_location_entry, notice: 'Accession location entry was successfully created.' }\n format.json { render json: @accession_location_entry, status: :created, location: @accession_location_entry }\n else\n format.html { render action: \"new\" }\n format.json { render json: @accession_location_entry.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @curpg = :admintools\n @location = Location.find(params[:id])\n\n respond_to do |format|\n if @location.update_attributes(params[:location])\n format.html { redirect_to :controller => \"locations\", :action => \"index\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n @location = Location.find(params[:id])\r\n \r\n respond_to do |format|\r\n if @location.update_attributes(params[:location])\r\n format.json { head :no_content }\r\n else\r\n format.json { render json: @location.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n @locations = []\n @errors = []\n @hide_map = true\n if params.has_key? :id\n location = Location.find(params[:id])\n @locations = [ location ]\n location_params = params.clone\n [:created_at, :id, :updated_at, :category, :subcategories, :markerVisible, :action, :controller, :location].each do |param|\n location_params.delete param\n end\n location.update_attributes location_params\n @errors = location.errors\n elsif params.has_key? :locations\n params[:locations][:location].each do |data|\n l = Location.find data[0]\n if not l.update_attributes data[1]\n pp l.errors\n @errors.push l.errors\n end\n @locations.push l\n end\n end\n\n respond_to do |format|\n if @errors.empty?\n format.html { redirect_to :locations, :notice => 'Locations successfully updated.'}\n format.json { head :no_content }\n else\n format.html { render :action =>\"edit\" }\n format.json { render :json => @errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @location = Location.find(params[:id])\n \n #abort\n respond_to do |format|\n if @location.update_attributes(params[:location])\n format.html { redirect_to :back, notice: 'Location was successfully updated.' }\n format.json { head :no_content }\n else\n set_site_entities @location\n format.html { render action: \"edit\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @location = Location.find(params[:id])\n logger.info params[:location].to_json\n\n respond_to do |format|\n if @location.update_attributes(params[:location])\n format.html { redirect_to @location, :notice => 'Location was successfully updated.' }\n format.json { render :json => @location, :status => :updated, :location => @location }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @location.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_data_entry\n @location = Location.find(params[:id])\n end", "def update\n organization_timeline_entry.update_attributes(organization_timeline_entry_params)\n respond_with(@organization_timeline_entry, location: params[:url])\n end", "def destroy\n @accession_location_entry = AccessionLocationEntry.find(params[:id])\n @accession_location_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to accession_location_entries_url }\n format.json { head :no_content }\n end\n end", "def update\n @record = Location.find(params[:id])\n @record.update_attributes(params[:location]) \n respond_to do |format|\n# format.html\n format.json {\n render json: {}\n }\n end\n end", "def update\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n if @entry.update_attributes(params[:entry])\n format.json { render json: @entry, status: :created, location: @entry }\n else\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @location = Location.find(params[:id])\n @location.update_attributes(params[:location])\n @locations = Location.paginate(:page => params[:page], :per_page => 30).order('updated_at DESC')\n end", "def update\n @location = Location.friendly.find(params[:id])\n respond_to do |format|\n if @location.update_attributes!(location_params)\n format.html { redirect_to @location, notice: 'location was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @location.update_attributes(params[:location])\n format.html { redirect_to @location, notice: 'Location was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @location = Location.find(params[:id])\n \n @previousMap = Location.WhereAmI(@location.region_id)\n\n #binding.pry\n respond_to do |format|\n if @location.update_attributes(params[:location])\n format.html { redirect_to @previousMap, notice: 'Location was successfully updated.' }\n format.json { respond_with_bip(@location) }\n else\n format.html { render action: \"edit\" }\n format.json { respond_with_bip(@location) }\n end\n end\n end", "def update\n respond_to do |format|\n if @recipe_location.update(recipe_location_params)\n format.html { redirect_to @recipe_location, notice: 'Recipe location was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe_location }\n else\n format.html { render :edit }\n format.json { render json: @recipe_location.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \n @collection = Collection.find(@mlog_entry[:collection_id])\n @accession = Accession.find(@mlog_entry[:accession_id])\n\n respond_to do |format|\n if @mlog_entry.update(mlog_entry_params)\n format.html { redirect_to @mlog_entry, notice: 'Entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @mlog_entry.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @location = Location.find(params[:id])\n @location.update_attributes(params[:location])\n end", "def update!(**args)\n @access = args[:access] if args.key?(:access)\n @location_name = args[:location_name] if args.key?(:location_name)\n @place_id = args[:place_id] if args.key?(:place_id)\n end", "def update!(**args)\n @access = args[:access] if args.key?(:access)\n @location_name = args[:location_name] if args.key?(:location_name)\n @place_id = args[:place_id] if args.key?(:place_id)\n end", "def update\n @location = Location.find(params[:id])\n\n respond_to do |format|\n if @location.update_attributes(params[:location])\n format.html { redirect_to @location}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @location = Location.find(params[:id])\n\n respond_to do |format|\n if @location.update_attributes(params[:location])\n format.html { redirect_to [@organization, @location], notice: 'Location was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @location = Location.find(params[:id])\n \n full_address = \"#{params[:location][:address]} #{params[:location][:city]}, #{params[:location][:state]}\"\n # transale address into lat/long\n lat, long = Geocoder.coordinates(full_address) \n response = get_place_report(params[:location], long, lat) \n @location.reference = response[\"reference\"] unless response[\"reference\"].blank?\n @location.general_type = get_general_type(params[:location][:types]) unless params[:location][:types].blank?\n respond_to do |format|\n if @location.update_attributes(params[:location])\n format.html { redirect_to(@location, :notice => 'Location was successfully updated.') }\n format.xml { head :ok }\n else\n @pages = [{id: @location.id, name: @location.name}]\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @location.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @location.update(location_params)\n puts \"\\nUPDATE: #{@location.inspect}\"\n format.html { redirect_to @location, notice: \"Location was successfully updated.\" }\n format.json { render :show, status: :ok, location: @location }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @location_url_map = LocationUrlMap.find(params[:id])\n\n respond_to do |format|\n if @location_url_map.update_attributes(params[:location_url_map])\n format.html { redirect_to @location_url_map, notice: 'Location url map was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @location_url_map.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @location = Location.find(params[:id])\n\n respond_to do |format|\n if @location.update_attributes(params[:location])\n format.html { redirect_to @location, notice: 'La habitación se ha guardado exitosamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_location(location={})\n\t\tclient.update(location)\n\tend", "def update\n respond_to do |format|\n if @location_mapping.update(location_mapping_params)\n format.html { redirect_to @location_mapping, notice: 'Location mapping was successfully updated.' }\n format.json { render :show, status: :ok, location: @location_mapping }\n else\n format.html { render :edit }\n format.json { render json: @location_mapping.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event_location = EventLocation.find(params[:id])\n\n respond_to do |format|\n if @event_location.update_attributes(event_location_params)\n format.html { redirect_to @event_location, notice: 'Event location was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event_location.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n set_location\n\n respond_to do |format|\n if @location.update_attributes(location_params)\n format.html { redirect_to @location, flash: {success: \"Successfully updated #{@location.name} location!\" }}\n format.json { render :show, status: :ok, location: @location }\n else\n format.html { render :edit }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @location = Location.find(params[:id])\n\n respond_to do |format|\n if @location.update_attributes(params[:location])\n format.html { redirect_to locations_path, notice: 'Adres pomyślnie zaktualizowany.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n flash[:notice] = t('scaffold.notice.updated', :item => SicossLocation.model_name.human) if @sicoss_location.update_attributes(params[:sicoss_location])\n respond_with(@sicoss_location, :location => sicoss_locations_path)\n end", "def update\n respond_to do |format|\n if @location.update(location_params)\n format.html { redirect_to @location, notice: 'Ubicacion actualizada correctamente!' }\n format.json { head :no_content }\n else\n format.html { redirect_to '/locations/'+@location.id.to_s+'/edit',notice: 'Ingrese una direccion y un numero de casa!' }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n puts \"Location::update (params): \" + location_params.inspect\n \n if @location.update(location_params)\n render :json => {status: :ok, location: @location }\n else\n render :json => {errors: @location.errors, status: :unprocessable_entity }\n end\n end", "def update\n @location = Location.find(params[:id])\n\n respond_to do |format|\n if @location.update_attributes(params[:location])\n format.html { redirect_to @location, notice: 'Location was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @location = Location.find(params[:id])\n\n respond_to do |format|\n if @location.update_attributes(params[:location])\n format.html { redirect_to @location, notice: 'Location was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @location = Location.find(params[:id])\n\n respond_to do |format|\n if @location.update_attributes(params[:location])\n format.html { redirect_to @location, notice: 'Location was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @location = Location.find(params[:id])\n\n respond_to do |format|\n if @location.update_attributes(params[:location])\n format.html { redirect_to @location, notice: 'Location was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @location = Location.find(params[:id])\n\n respond_to do |format|\n if @location.update_attributes(params[:location])\n format.html { redirect_to @location, notice: 'Location was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @processed_location = ProcessedLocation.find(params[:id])\n\n respond_to do |format|\n if @processed_location.update_attributes(params[:processed_location])\n format.html { redirect_to @processed_location, notice: 'Processed location was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @processed_location.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @storage_location = StorageLocation.find(params[:id])\n\n respond_to do |format|\n if @storage_location.update_attributes(params[:storage_location])\n format.html { redirect_to @storage_location, notice: 'Storage location was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @storage_location.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @locationmap = Locationmap.find(params[:id])\n\n respond_to do |format|\n if @locationmap.update_attributes(params[:locationmap])\n format.html { redirect_to @locationmap, notice: 'Locationmap was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @locationmap.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @slocation.update(slocation_params)\n format.html { redirect_to @slocation, notice: 'Story location was successfully updated.' }\n format.json { render :show, status: :ok, slocation: @slocation }\n else\n format.html { render :edit }\n format.json { render json: @slocation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @locations = args[:locations] if args.key?(:locations)\n end", "def update!(**args)\n @locations = args[:locations] if args.key?(:locations)\n end", "def update!(**args)\n @locations = args[:locations] if args.key?(:locations)\n end", "def update\n dns_entry_response = RestClient.put('https://api.cloudflare.com/client/v4/zones/:zone_identifier/dns_records/:identifier',:content_type => :json, :accept => :json, :'x-auth-key' => session[:key] :'x-auth-email' => session[:email])\n respond_to do |format|\n if @dns_entry.update(dns_entry_params)\n format.html { redirect_to @dns_entry, notice: \"Dns entry was successfully updated.\" }\n format.json { render :show, status: :ok, location: @dns_entry }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @dns_entry.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @location_have_location = LocationHaveLocation.find(params[:id])\n\n respond_to do |format|\n if @location_have_location.update_attributes(params[:location_have_location])\n format.html { redirect_to @location_have_location, notice: 'Location have location was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @location_have_location.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n return unless admin?\n @location = Location.find(params[:id])\n\n respond_to do |format|\n if @location.update_attributes(params[:location])\n format.html { redirect_to @location, notice: 'Location was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @location_address = args[:location_address] if args.key?(:location_address)\n @location_name = args[:location_name] if args.key?(:location_name)\n end", "def update\n respond_to do |format|\n if @specific_location.update(specific_location_params)\n format.html { redirect_to @specific_location, notice: 'Specific location was successfully updated.' }\n format.json { render :show, status: :ok, location: @specific_location }\n else\n format.html { render :edit }\n format.json { render json: @specific_location.errors, status: :unprocessable_entity }\n end\n end\n end", "def postLocation( location_id, type, country, language, name, formal_name, resolution, population, description, timezone, latitude, longitude, parent_town, parent_county, parent_province, parent_region, parent_neighbourhood, parent_district, postalcode, searchable_id, searchable_ids)\n params = Hash.new\n params['location_id'] = location_id\n params['type'] = type\n params['country'] = country\n params['language'] = language\n params['name'] = name\n params['formal_name'] = formal_name\n params['resolution'] = resolution\n params['population'] = population\n params['description'] = description\n params['timezone'] = timezone\n params['latitude'] = latitude\n params['longitude'] = longitude\n params['parent_town'] = parent_town\n params['parent_county'] = parent_county\n params['parent_province'] = parent_province\n params['parent_region'] = parent_region\n params['parent_neighbourhood'] = parent_neighbourhood\n params['parent_district'] = parent_district\n params['postalcode'] = postalcode\n params['searchable_id'] = searchable_id\n params['searchable_ids'] = searchable_ids\n return doCurl(\"post\",\"/location\",params)\n end", "def update\n if @service_location.update(service_location_params)\n render json: @service_location, status: :ok, location: @service_location\n else\n render json: @service_location.errors, status: :unprocessable_entity\n end \n end", "def update\n @file = @map.meta_data\n # binding.pry\n\n @meta_data = []\n @kind = @map.kind\n fips_to_hc_key\n @map.meta_data = @meta_data\n\n respond_to do |format|\n if @map.update(map_params)\n format.html { redirect_to @map, notice: 'Map was successfully updated.' }\n format.json { render :show, status: :ok, location: @map }\n else\n format.html { render :edit }\n format.json { render json: @map.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @location.update(location_params)\n format.html { redirect_to @location, notice: 'Location was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @location.update(location_params)\n format.html { redirect_to @location, notice: 'Location was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @location = Location.find(params[:id])\n\n respond_to do |format|\n if @location.update_attributes(params[:location])\n format.html { redirect_to user_locations_path, notice: 'Location was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @sign = Sign.find(params[:id])\n @location = Location.find(@sign.location_id)\n\n respond_to do |format|\n if @sign.update_attributes(params[:sign])\n format.html { redirect_to location_index_path(@location.name.downcase), notice: 'Sign was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sign.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @location.update(location_params)\n format.html { redirect_to @location, notice: \"Location was successfully updated.\" }\n format.json { render :show, status: :ok, location: @location }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_location\n suggestion = Suggestion.find(params[:id])\n if admin or suggestion.user == @current_user\n suggestion.lat = params[:lat]\n suggestion.lon = params[:lon]\n suggestion.save\n end\n render :text => suggestion.to_json\n end", "def update\n @loc = current_user.locs.find(params[:id])\n\n respond_to do |format|\n if @loc.update_attributes(params[:loc])\n format.html { redirect_to @loc, notice: 'Loc was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @loc.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @accession_location_entry = AccessionLocationEntry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @accession_location_entry }\n end\n end", "def update\n @location = Location.find(params[:id])\n\n respond_to do |format|\n if @location.update_attributes(params[:location])\n @locations = Location.index_locations\n format.html { redirect_to(@location, :notice => 'Location was successfully updated.') }\n format.xml { head :ok }\n format.js\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @location.errors, :status => :unprocessable_entity }\n format.js\n end\n end\n end", "def show\n @accession_location_entry = AccessionLocationEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @accession_location_entry }\n end\n end", "def update!(**args)\n @category_info = args[:category_info] if args.key?(:category_info)\n @chain_info = args[:chain_info] if args.key?(:chain_info)\n @custom_location_type = args[:custom_location_type] if args.key?(:custom_location_type)\n @display_address = args[:display_address] if args.key?(:display_address)\n @geo_feature_id = args[:geo_feature_id] if args.key?(:geo_feature_id)\n @lat = args[:lat] if args.key?(:lat)\n @lng = args[:lng] if args.key?(:lng)\n @location_type = args[:location_type] if args.key?(:location_type)\n @name = args[:name] if args.key?(:name)\n @personal_location_metadata = args[:personal_location_metadata] if args.key?(:personal_location_metadata)\n @tts_address = args[:tts_address] if args.key?(:tts_address)\n end", "def update\n if can?(:>=, \"5\")\n @location = Kitting::Location.find(params[:id])\n @location_attributes = params[:location].merge(:customer_number => session[:customer_number])\n respond_to do |format|\n if @location.update_attributes(@location_attributes)\n format.html { redirect_to @location, notice: 'Location is updated successfully.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n else\n redirect_to main_app.unauthorized_url\n end\n end", "def update\n location = Location.find_or_create_by({\n postcode_address: params[:location][:postcode_address],\n street_address: params[:location][:street_address]\n })\n @gig.location = location\n respond_to do |format|\n if @gig.update(gig_params)\n format.html { redirect_to @gig, notice: 'Gig was successfully updated.' }\n format.json { render :show, status: :ok, location: @gig }\n else\n format.html { render :edit }\n format.json { render json: @gig.errors, status: :unprocessable_entity }\n end\n\n end\n end", "def update\n respond_to do |format|\n if @service_location.update(service_location_params)\n format.html { redirect_to @service_location, notice: \"Updated Information for location: '#{@service_location.location.name}'\" }\n format.json { render :show, status: :ok, location: @service_location }\n else\n format.html { render :edit }\n format.json { render json: @service_location.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @pagetitle = \"Edit location\"\n @location = Location.find(params[:id])\n\n respond_to do |format|\n if @location.update_attributes(locations_params)\n format.html { redirect_to(@location, :notice => 'Location was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @location.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @location = Location.new\n @location.address = gym_params[:location]\n location = Location.limit(1).find_by_address(gym_params[:location])\n @location.save! if location.eql? nil\n location = Location.limit(1).find_by_address(gym_params[:location])\n\n respond_to do |format|\n if @gym.update(gym_params.reject!{ |k| k == \"location\"})\n @gym.location_id = location.id\n @gym.save!\n format.html { redirect_to @gym, notice: 'Gym was successfully updated.' }\n format.json { render :show, status: :ok, location: @gym }\n `echo \"Nome:#{@gym.name}\\n Gerente: #{@gym.manager.name}\\n Address:#{@gym.location.address}\" | mutt -s \"Gym was successfully updated.\" #{@gym.manager.email}`\n else\n format.html { render :edit }\n format.json { render json: @gym.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @location.update(location_params)\n format.html { redirect_to '/admin/locations', notice: 'Location was successfully updated.' }\n format.json { render :show, status: :ok, location: @location }\n else\n format.html { render :edit }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n @regions = Region.all\n if params[:regions]\n @location_regions = Region.find(params[:regions])\n else\n @location_regions = []\n end\n @location.regions = @location_regions\n\n respond_to do |format|\n if @location.update(location_params)\n format.html { redirect_to @location, notice: 'Location was successfully updated.' }\n format.json { render :show, status: :ok, location: @location }\n else\n format.html { render :edit }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @crash_location.update(crash_location_params)\n format.html { redirect_to [:admin, @crash_location], notice: 'Crash location was successfully updated.' }\n format.json { render :show, status: :ok, location: @crash_location }\n else\n format.html { render :edit }\n format.json { render json: @crash_location.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @location_list = args[:location_list] if args.key?(:location_list)\n end", "def update\n #@items_location = ItemsLocation.find(params[:id])\n\n respond_to do |format|\n #if @items_location.update_attributes(params[:items_location])\n # format.html { redirect_to @items_location, notice: 'Items location was successfully updated.' }\n # format.json { head :no_content }\n #else\n # format.html { render action: \"edit\" }\n # format.json { render json: @items_location.errors, status: :unprocessable_entity }\n #end\n end\n end", "def update\n\t\tlocation = Location.find_by(id: params[:id])\n\t\tlocation.address = params[:location][:address]\n\t\tlocation.description = params[:location][:description]\n\t\tlocation.save!\n\t\tredirect_to \"/update_location/#{location.id}\"\n\tend", "def create\n @location = Location.new(params[:location])\n \n @location.location = current_location\n @location.location_type = \"shelf\"\n \n respond_to do |format|\n if @location.save\n format.html { redirect_to current_location, notice: 'Location was successfully created.' }\n format.json { render json: @location, status: :created, location: @location }\n else\n format.html { render action: \"new\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @location.update(location_params)\n format.html { redirect_to @location, notice: 'Location was successfully updated.' }\n format.json { render :show, status: :ok, location: @location }\n else\n format.html { render :edit }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @location.update(location_params)\n format.html { redirect_to @location, notice: 'Location was successfully updated.' }\n format.json { render :show, status: :ok, location: @location }\n else\n format.html { render :edit }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @location.update(location_params)\n format.html { redirect_to @location, notice: 'Location was successfully updated.' }\n format.json { render :show, status: :ok, location: @location }\n else\n format.html { render :edit }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @location.update(location_params)\n format.html { redirect_to @location, notice: 'Location was successfully updated.' }\n format.json { render :show, status: :ok, location: @location }\n else\n format.html { render :edit }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @location.update(location_params)\n format.html { redirect_to @location, notice: 'Location was successfully updated.' }\n format.json { render :show, status: :ok, location: @location }\n else\n format.html { render :edit }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @location.update(location_params)\n format.html { redirect_to @location, notice: 'Location was successfully updated.' }\n format.json { render :show, status: :ok, location: @location }\n else\n format.html { render :edit }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @location.update(location_params)\n format.html { redirect_to @location, notice: 'Location was successfully updated.' }\n format.json { render :show, status: :ok, location: @location }\n else\n format.html { render :edit }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @location.update(location_params)\n format.html { redirect_to @location, notice: 'Location was successfully updated.' }\n format.json { render :show, status: :ok, location: @location }\n else\n format.html { render :edit }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @location.update(location_params)\n format.html { redirect_to @location, notice: 'Location was successfully updated.' }\n format.json { render :show, status: :ok, location: @location }\n else\n format.html { render :edit }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @location.update(location_params)\n format.html { redirect_to @location, notice: 'Location was successfully updated.' }\n format.json { render :show, status: :ok, location: @location }\n else\n format.html { render :edit }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @location.update(location_params)\n format.html { redirect_to @location, notice: 'Location was successfully updated.' }\n format.json { render :show, status: :ok, location: @location }\n else\n format.html { render :edit }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @location.update(location_params)\n format.html { redirect_to @location, notice: 'Location was successfully updated.' }\n format.json { render :show, status: :ok, location: @location }\n else\n format.html { render :edit }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @location.update(location_params)\n format.html { redirect_to @location, notice: 'Location was successfully updated.' }\n format.json { render :show, status: :ok, location: @location }\n else\n format.html { render :edit }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @location_names = args[:location_names] if args.key?(:location_names)\n end", "def update!(**args)\n @location_names = args[:location_names] if args.key?(:location_names)\n end", "def update!(**args)\n @location_names = args[:location_names] if args.key?(:location_names)\n end", "def update\n respond_to do |format|\n if @location.update(location_params)\n format.html { redirect_to locations_path, notice: 'Location was successfully updated.' }\n format.json { render :show, status: :ok, location: @location }\n else\n format.html { render :edit }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @location = Location.find(params[:id])\n \n respond_to do |format|\n if @location.update(location_params)\n format.html { redirect_to @location, notice: 'Location was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item_location.update(item_location_params)\n format.html { redirect_to @item_location, notice: 'Item location was successfully updated.' }\n format.json { render :show, status: :ok, location: @item_location }\n else\n format.html { render :edit }\n format.json { render json: @item_location.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @totem_location.update(totem_location_params)\n format.html { redirect_to @totem_location, notice: 'Totem location was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @totem_location.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n location = current_account.location.find(params[:id])\n location.update!(location_params)\n redirect_to location\n end" ]
[ "0.64269066", "0.64180183", "0.6282211", "0.6180619", "0.60750437", "0.60668075", "0.601699", "0.6009725", "0.59824437", "0.5979467", "0.59150267", "0.5914181", "0.5907044", "0.58921933", "0.58792233", "0.5851517", "0.5848158", "0.5799227", "0.57919824", "0.57903355", "0.5788921", "0.5788921", "0.57760704", "0.57686484", "0.57629204", "0.5753319", "0.57515705", "0.57420367", "0.57415044", "0.5705874", "0.5704161", "0.56907254", "0.56851697", "0.5684706", "0.5675663", "0.5670046", "0.56587", "0.56587", "0.56587", "0.56587", "0.5658079", "0.5651311", "0.56486076", "0.56474996", "0.5635089", "0.56310064", "0.56310064", "0.56308943", "0.5621165", "0.5617587", "0.56122065", "0.560818", "0.56003624", "0.55961186", "0.5591482", "0.55848914", "0.55726904", "0.55726904", "0.55690277", "0.55611455", "0.5557865", "0.55536693", "0.55535036", "0.5549737", "0.5548984", "0.5547483", "0.5547325", "0.55437243", "0.55434334", "0.5542192", "0.55370164", "0.55347365", "0.55255044", "0.55229", "0.5522269", "0.55207574", "0.5516538", "0.5511187", "0.54887885", "0.5488396", "0.5488396", "0.5488396", "0.5488396", "0.5488396", "0.5488396", "0.5488396", "0.5488396", "0.5488396", "0.5488396", "0.5488396", "0.5488396", "0.5487345", "0.5468867", "0.5468867", "0.5468867", "0.54633075", "0.54615766", "0.5453312", "0.54529166", "0.54452515" ]
0.70068336
0
DELETE /accession_location_entries/1 DELETE /accession_location_entries/1.json
def destroy @accession_location_entry = AccessionLocationEntry.find(params[:id]) @accession_location_entry.destroy respond_to do |format| format.html { redirect_to accession_location_entries_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n render json: Location.delete(params[\"id\"])\n end", "def destroy\n @record = Location.find(params[:id])\n @record.trash\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\r\n @location = Location.find(params[:id])\r\n @location.destroy\r\n\r\n respond_to do |format|\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\r\n @location = Location.find(params[:id])\r\n RemovedLocation.create(server_id: Integer(params[:id]))\r\n directory = Rails.root.join('app','assets','locations');\r\n\r\n path = File.join(directory, @location.image)\r\n File.delete(path)\r\n @location.destroy\r\n mv = MapsVersion.first\r\n mv.version = mv.version+1\r\n mv.save\r\n respond_to do |format|\r\n format.html { redirect_to locations_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @storage_location = StorageLocation.find(params[:id])\n @storage_location.destroy\n\n respond_to do |format|\n format.html { redirect_to storage_locations_url }\n format.json { head :ok }\n end\n end", "def destroy\n dns_entry_response = RestClient.delete('https://api.cloudflare.com/client/v4/zones/:zone_identifier/dns_records/:identifier',:content_type => :json, :accept => :json, :'x-auth-key' => session[:key] :'x-auth-email' => session[:email])\n @dns_entry.destroy\n respond_to do |format|\n format.html { redirect_to dns_entries_url, notice: \"Dns entry was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @corp_location = CorpLocation.get(params[:id])\n @corp_location.destroy\n\n respond_to do |format|\n format.html { redirect_to corp_locations_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 delete_entry(aliaz)\n\n end", "def destroy\n @location = Location.find(params[:id])\n #@client = Client.find(@location.client_ids)\n #@contact = Contact.find(@location.contact_ids)\n \n @location.destroy\n\n respond_to do |format|\n \n format.html { redirect_to request.referer }\n format.json { head :no_content }\n end\n end", "def destroy\n @totem_location.destroy\n respond_to do |format|\n format.html { redirect_to totem_locations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @locationmap = Locationmap.find(params[:id])\n @locationmap.destroy\n\n respond_to do |format|\n format.html { redirect_to locationmaps_url }\n format.json { head :no_content }\n end\n end", "def delete\n CONNECTION.execute(\"DELETE FROM locations WHERE id = #{self.id};\")\n end", "def destroy\n #@items_location = ItemsLocation.find(params[:id])\n #@items_location.destroy\n\n respond_to do |format|\n format.html { redirect_to items_locations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @locations = Location.paginate(:page => params[:page], :per_page => 30).order('updated_at DESC')\n @location = Location.find(params[:id])\n begin\n @location.destroy\n rescue ActiveRecord::DeleteRestrictionError => e\n @error = e.message\n end\n end", "def destroy\n @location_url_map = LocationUrlMap.find(params[:id])\n @location_url_map.destroy\n\n respond_to do |format|\n format.html { redirect_to location_url_maps_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ms_location.destroy\n respond_to do |format|\n format.html { redirect_to ms_locations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @location = apply_scopes(Location).find(params[:id])\n @location.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_locations_url(:site => current_site.id) }\n format.json { head :no_content }\n end\n end", "def destroy\n @location_granularity.destroy\n respond_to do |format|\n format.html { redirect_to location_granularities_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @location.destroy\n\n respond_to do |format|\n format.html { redirect_to locations_url }\n format.json { head :no_content }\n end\n end", "def delete\n @location = Location.find(params[:location_id])\n end", "def destroy\r\n @discounts_on_location = DiscountsOnLocation.find(params[:id])\r\n @discounts_on_location.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to discounts_on_locations_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @location_mapping.destroy\n respond_to do |format|\n format.html { redirect_to location_mappings_url, notice: 'Location mapping was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @federal1870_census_entry = Federal1870CensusEntry.find(params[:id])\n @federal1870_census_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to federal1870_census_entries_url }\n format.json { head :no_content }\n end\n end", "def destroy\n return unless admin?\n @location = Location.find(params[:id])\n @location.destroy\n\n respond_to do |format|\n format.html { redirect_to locations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @location.destroy\n respond_to do |format|\n format.html { redirect_to locations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @location.destroy\n respond_to do |format|\n format.html { redirect_to locations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @location.destroy\n respond_to do |format|\n format.html { redirect_to locations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @location.destroy\n respond_to do |format|\n format.html { redirect_to locations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @specific_location.destroy\n respond_to do |format|\n format.html { redirect_to specific_locations_url, notice: 'Specific location was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n debug('Removing location')\n crm('configure', 'delete', @resource[:name])\n @property_hash.clear\n end", "def destroy\n @location.destroy\n render :json => { status: :deleted, head: :no_content }\n end", "def destroy\n @subcellular_location = SubcellularLocation.find(params[:id])\n @subcellular_location.destroy\n\n respond_to do |format|\n format.html { redirect_to subcellular_locations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_v1_location.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_locations_url, notice: 'Location was successfully destroyed.' }\n format.json { render json: { results: @api_v1_location, message: 'Location was successfully destroyed.' } }\n end\n end", "def destroy\n @loc = current_user.locs.find(params[:id])\n @loc.destroy\n\n respond_to do |format|\n format.html { redirect_to locs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @storage_location = StorageLocation.find(params[:id])\n @storage_location.destroy\n\n respond_to do |format|\n format.html { redirect_to(storage_locations_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @location = Location.find(params[:id])\n @location.destroy\n\n respond_to do |format|\n format.html { redirect_to locations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @location = Location.find(params[:id])\n @location.destroy\n\n respond_to do |format|\n format.html { redirect_to locations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @location = Location.find(params[:id])\n @location.destroy\n\n respond_to do |format|\n format.html { redirect_to locations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @location = Location.find(params[:id])\n @location.destroy\n\n respond_to do |format|\n format.html { redirect_to locations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @location = Location.find(params[:id])\n @location.destroy\n\n respond_to do |format|\n format.html { redirect_to locations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @location = Location.find(params[:id])\n @location.destroy\n\n respond_to do |format|\n format.html { redirect_to locations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @location = Location.find(params[:id])\n @location.destroy\n\n respond_to do |format|\n format.html { redirect_to locations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @location = Location.find(params[:id])\n @location.destroy\n\n respond_to do |format|\n format.html { redirect_to locations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sign = Sign.find(params[:id])\n @location = Location.find(@sign.location_id)\n @sign.destroy\n\n respond_to do |format|\n format.html { redirect_to location_index_path(@location.name.downcase) }\n format.json { head :no_content }\n end\n end", "def destroy\n @processed_location = ProcessedLocation.find(params[:id])\n @processed_location.destroy\n\n respond_to do |format|\n format.html { redirect_to processed_locations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @records_location = RecordsLocation.find(params[:id])\n @records_location.destroy\n\n respond_to do |format|\n format.html { redirect_to records_locations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event_location = EventLocation.find(params[:id])\n @event_location.destroy\n\n respond_to do |format|\n format.html { redirect_to event_locations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @access.destroy\n respond_to do |format|\n format.html { redirect_to accesses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @location = Location.find(params[:id])\n @location.destroy\n\n respond_to do |format|\n format.html { redirect_to locations_url }\n format.json { head :ok }\n end\n end", "def destroy\n @location = Location.find(params[:id])\n @location.destroy\n\n respond_to do |format|\n format.html { redirect_to locations_url }\n format.json { head :ok }\n end\n end", "def destroy\n @early_access_request.destroy\n respond_to do |format|\n format.html { redirect_to early_access_requests_url, notice: 'Anfrage wurde gelöscht.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @location.destroy\n\n respond_to do |format|\n format.html { redirect_to geolocation_url }\n format.json { head :no_content }\n end\n end", "def destroy\n set_location.destroy\n respond_to do |format|\n format.html { redirect_to locations_url, flash: {success: \"Successfully deleted #{@location.name} location!\" }}\n format.json { head :no_content }\n end\n end", "def deleteLocation _args\n \"deleteLocation _args;\" \n end", "def delete\n NamedMap.stats_aggregator.timing('named-map.delete') do\n response = self.class.http_client.delete( url + '?api_key=' + @parent.api_key,\n {\n headers: @parent.headers,\n ssl_verifypeer: @parent.verify_cert,\n ssl_verifyhost: @parent.verify_host,\n followlocation: true,\n connecttimeout: HTTP_CONNECT_TIMEOUT,\n timeout: HTTP_REQUEST_TIMEOUT\n } )\n raise HTTPResponseError, \"DELETE:#{response.code} #{response.request.url} #{response.body}\" unless response.code == 204\n end\n end", "def destroy\n @location_have_location = LocationHaveLocation.find(params[:id])\n @location_have_location.destroy\n\n respond_to do |format|\n format.html { redirect_to location_have_locations_url }\n format.json { head :ok }\n end\n end", "def destroy\n @location = Location.find(params[:id])\n @location.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_locations_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @accesspoint.destroy\n respond_to do |format|\n format.html { redirect_to accesspoints_url, notice: 'Accesspoint was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @recipe_location.destroy\n respond_to do |format|\n format.html { redirect_to recipe_locations_url, notice: 'Recipe location was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @map.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @location.destroy\n respond_to do |format|\n format.html { redirect_to '/admin/locations', notice: 'Location was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @clinic_location.destroy\n respond_to do |format|\n format.html { redirect_to clinic_locations_url, notice: 'Clinic location 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 @location = $User.get_location(params[:id])\n @location.kill\n GlobalData.reload(:locations)\n respond_to do |format|\n format.html { redirect_to('/locations') }\n format.xml { head :ok }\n end\n end", "def destroy\n debugger\n @entry = Entry.find(params[:id])\n @entry.destroy\n\n respond_to do |format|\n format.html { redirect_to entries_url }\n format.json { head :ok }\n end\n end", "def destroy\n @access_point = AccessPoint.find(params[:id])\n @access_point.destroy\n\n respond_to do |format|\n format.html { redirect_to access_points_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @location_detail.destroy\n respond_to do |format|\n format.html { redirect_to location_details_url, notice: 'Location detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @location_time.destroy\n respond_to do |format|\n format.html { redirect_to location_times_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @locations = nil\n\n if params.has_key? :id\n location = Location.find params[:id]\n @locations = [ location ]\n elsif params.has_key? :ids\n @locations = Location.find params[:ids].split(\",\")\n end\n\n if not @locations.empty?\n @locations.each do |l|\n l.destroy\n end\n end\n\n respond_to do |format|\n format.html { redirect_to locations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @checklocation = Checklocation.find(params[:id])\n @checklocation.destroy\n\n respond_to do |format|\n format.html { redirect_to checklocations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_location.destroy\n respond_to do |format|\n format.html { redirect_to admin_locations_url, notice: 'Location was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @resto.destroy\n respond_to do |format|\n format.html { redirect_to restos_url, notice: 'Entry was deleted.' }\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 @maplocation.destroy\n respond_to do |format|\n format.html { redirect_to maplocations_url, notice: 'Maplocation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @location.destroy\n respond_to do |format|\n format.html { redirect_to trip_locations_path, notice: 'Location was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @locacao = Locacao.find(params[:id])\n @locacao.destroy\n\n respond_to do |format|\n format.html { redirect_to locacaos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @location = Location.find(params[:id])\n @location.destroy\n\n respond_to do |format|\n format.html { redirect_to( admin_locations_path) }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n collection = Collection.find(@mlog_entry[:collection_id])\n @mlog_entry.destroy\n respond_to do |format|\n format.html { redirect_to collection}\n format.json { head :no_content }\n end\n end", "def destroy\n @locid = params[:id]\n Location.destroy(@locid)\n end", "def destroy\n# @location = Location.find(params[:id])\n# @location.update_attributes(:ishidden => true)\n#\n# respond_to do |format|\n# format.html { redirect_to locations_url }\n# format.json { head :no_content }\n# end\n \n end", "def destroy\n\t @location = Location.find(params[:id])\n\t @location.destroy\n\n\t respond_to do |format|\n\t format.html { redirect_to locations_url }\n\t format.json { head :no_content }\n\t end\n\t end", "def destroy\n @location.destroy\n respond_to do |format|\n format.html { redirect_to locations_url, notice: 'location was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @factors_location = FactorsLocation.find(params[:id])\n @factors_location.destroy\n\n respond_to do |format|\n format.html { redirect_to factors_locations_url }\n format.json { head :no_content }\n end\n end", "def delete(type, id)\n http_delete @target, \"#{type_info(type, :path)}/#{Addressable::URI.encode(id)}\", @auth_header, @zone\n end", "def destroy\n @crash_location.destroy\n respond_to do |format|\n format.html { redirect_to crash_locations_url, notice: 'Crash location was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @located_at.destroy\n respond_to do |format|\n format.html { redirect_to located_ats_url, notice: 'Located at was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @roadmap_step.destroy\n respond_to do |format|\n format.html { redirect_to roadmap_steps_url, notice: 'Roadmap step was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def test_valid_delete_returns_204\n db = DB.get\n\n valid_entry = SEED_ENTRIES.first\n insert_entry(db, valid_entry)\n\n assert_equal 1, db.execute('select * from entries').count\n\n delete \"/api/entries/#{valid_entry[:slug]}\"\n assert last_response.no_content?\n\n assert_equal 0, db.execute('select * from entries').count\n end", "def destroy\n puts \"\\nDESTROY: #{@location.inspect}\"\n @location.destroy\n respond_to do |format|\n format.html { redirect_to locations_url, notice: \"Location was successfully destroyed.\" }\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 @slocation.destroy\n respond_to do |format|\n format.html { redirect_to slocations_url, notice: 'Story Location was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ldap_entry = LdapEntry.find(params[:id])\n @ldap_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to ldap_entries_url }\n format.json { head :no_content }\n end\n end", "def delete_locations!(start, stop)\n params = { from: start, end: stop }\n\n @client.delete(\"#{path}/location/waypoints\", nil, params, \"Content-Type\" => \"application/json\")\n end", "def destroy\n @item_location.destroy\n respond_to do |format|\n format.html { redirect_to item_locations_url, notice: 'Item location was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @location = Location.find(params[:id])\n @location.destroy\n\n respond_to do |format|\n format.html { redirect_to(locations_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @location = Location.find(params[:id])\n @location.destroy\n\n respond_to do |format|\n format.html { redirect_to(locations_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @location = Location.find(params[:id])\n @location.destroy\n\n respond_to do |format|\n format.html { redirect_to(locations_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @location = Location.find(params[:id])\n @location.destroy\n\n respond_to do |format|\n format.html { redirect_to(locations_url) }\n format.xml { head :ok }\n end\n end" ]
[ "0.69462156", "0.68298554", "0.6684562", "0.6682947", "0.6636414", "0.66307396", "0.66076356", "0.6575782", "0.655458", "0.65400356", "0.65395075", "0.6538113", "0.65314806", "0.6516871", "0.6516409", "0.65123856", "0.6507473", "0.6503454", "0.65003955", "0.6485329", "0.64798665", "0.64700633", "0.6469", "0.64679265", "0.6466402", "0.6461878", "0.6461878", "0.6461878", "0.6461878", "0.6460258", "0.6454872", "0.6444725", "0.6443403", "0.64428866", "0.64359", "0.6430545", "0.64296967", "0.64296967", "0.64296967", "0.64296967", "0.64296967", "0.64296967", "0.64296967", "0.64296967", "0.64284515", "0.6426485", "0.64163566", "0.6416157", "0.6407869", "0.64014584", "0.64014584", "0.63945216", "0.6393469", "0.63748693", "0.6366657", "0.63664263", "0.6365545", "0.63646305", "0.6359134", "0.63540137", "0.6353681", "0.63514847", "0.63403696", "0.63399315", "0.63319623", "0.63174033", "0.63172615", "0.63043255", "0.63027173", "0.62998086", "0.6289895", "0.6289194", "0.6284591", "0.62751216", "0.6271629", "0.6265226", "0.62505454", "0.6243617", "0.6243279", "0.62370056", "0.6232783", "0.62311435", "0.62292665", "0.6226071", "0.6223527", "0.6220829", "0.6218876", "0.6216014", "0.6213015", "0.6212605", "0.6209939", "0.62085694", "0.6205457", "0.6204277", "0.6200662", "0.61984444", "0.61908627", "0.61908627", "0.61908627", "0.61908627" ]
0.7760664
0
Specify an attribute for the Immutable Object. This enables the object to be instantiated with the attribute, as well as creates an attribute reader for it.
def attribute(name) @attribute_names << name attr_reader(name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attr(attribute, name: attribute.to_s.camelize(:lower), nullable: nil, description: nil, deprecation_reason: nil, &block)\n name = name.to_sym unless name.is_a?(Symbol)\n\n # Get the description from the column, if it's not provided. Doesn't work in Rails 4 :(\n unless description\n column = @model_type.columns_hash[attribute.to_s]\n description = column.comment if column&.respond_to?(:comment)\n end\n\n options = {\n name: name,\n nullable: nullable,\n description: description,\n deprecation_reason: deprecation_reason,\n }\n\n DefinitionHelpers.define_attribute(@graph_type, @base_model_type, @model_type, @path, attribute, @object_to_model, options, @detect_nulls, &block)\n end", "def attribute name, *attr\n\n # Add the attribute\n _attr = AttributeDefinition.new( name, *attr )\n attribute_definitions << _attr\n\n # Inject object with getter and setter for attribute\n define_setter_and_getter(name, _attr)\n end", "def set attribute, value\n attributes[attribute] = value\n end", "def define_attr_accessor(attr)\n attr_accessor(attr)\n end", "def <<(attribute)\n self[attribute.name] = attribute\n attribute.define_accessor_methods(self)\n self\n end", "def []=(attr, value)\n @attrs[attr] = value\n end", "def []=(attribute, value)\n attributes[attribute] = to_field(value)\n end", "def initialize(attribute)\n @attribute = attribute\n end", "def attribute(*args)\n define_expressions(Attribute, args)\n end", "def attribute=(name, value)\n @attributes ||= {}\n @attributes[name] = value\n end", "def attribute(attribute_name, options = T.unsafe(nil), &block); end", "def set_attribute(name, value); end", "def attr(symbol, writable=false) end", "def initialize(attribute = nil)\n @attribute = attribute\n end", "def attribute(name)\n attributes << name\n\n if !method_defined?(name) || name == :id\n attr_accessor name\n end\n end", "def add_attribute attribute\n return attribute unless @document_self\n\n # mainly to check for redefinition of an attribute as a method\n # TODO find a policy for 'attr_reader :foo' + 'def foo=()'\n register = false\n\n key = nil\n\n if attribute.rw.index 'R' then\n key = attribute.pretty_name\n known = @methods_hash[key]\n\n if known then\n known.comment = attribute.comment if known.comment.empty?\n elsif registered = @methods_hash[attribute.pretty_name + '='] and\n RDoc::Attr === registered then\n registered.rw = 'RW'\n else\n @methods_hash[key] = attribute\n register = true\n end\n end\n\n if attribute.rw.index 'W' then\n key = attribute.pretty_name + '='\n known = @methods_hash[key]\n\n if known then\n known.comment = attribute.comment if known.comment.empty?\n elsif registered = @methods_hash[attribute.pretty_name] and\n RDoc::Attr === registered then\n registered.rw = 'RW'\n else\n @methods_hash[key] = attribute\n register = true\n end\n end\n\n if register then\n attribute.visibility = @visibility\n add_to @attributes, attribute\n resolve_aliases attribute\n end\n\n attribute\n end", "def attr(name, value)\n self[name] = value\n return self\n end", "def []=(attr, value)\n if Roomorama::Property::ATTRIBUTES.include?(attr)\n setter = [attr, \"=\"].join\n public_send(setter, value)\n end\n end", "def []=(attribute, value)\n attribute = attribute.to_s.gsub(/[^a-zA-Z0-9_\\-]/, '').gsub('_', '-')\n # FIXME => Attributes per class\n unless POSSIBLE_ATTRIBUTES.include? attribute\n # FIXME: Log, don't print\n puts \"Warning! Attribute #{attribute} not recognized\"\n @canvas << js_method('attr', {attribute => value})\n return nil\n end\n @canvas << js_method('attr', {attribute => value})\n return self\n end", "def attribute(key, type = nil)\n reader = :\"#{key}\"\n writer = :\"#{key}=\"\n\n define_method(reader) do\n self.attributes[reader]\n end\n\n define_method(writer) do |value|\n self.attributes[reader] = value\n end\n end", "def attr(attribute = nil)\n case attribute\n when Hash\n attribute.each { |key, value| Element.attr self, key, value }\n self\n when String, Symbol\n Element.attr self, attribute\n when nil\n @attr ||= AttributeAccessor.new self\n end\n end", "def initialize( attribute=DEFAULT_ATTRIBUTE )\n\t\t\t@attribute = attribute\n\t\tend", "def object(name, option={})\n unless option.has_key?(:is_a)\n option[:is_a] = :hash\n end\n register_attribute_member(name, option)\n define_attribute_accessor(name, option)\n define_validations(name, option)\n end", "def attribute(*args, **opt)\n add_single_property(*args, **opt)\n end", "def attribute(name); end", "def attribute=(_arg0); end", "def attribute=(_arg0); end", "def immutable\n obj = self.class.const_get(:Immutable).send(:new)\n self.class.attribute_descriptors.each do |name, attr|\n if attr.is_attribute?\n value = self.instance_variable_get(:\"@#{name}\")\n obj.instance_variable_set(:\"@#{name}\", value)\n end\n end\n\n obj\n end", "def attr(name, default_value=:undefined)\n other_attrs[name] = Attr.new(name, default_value, @_current_desc)\n @_current_desc = nil\n _define_attr(name)\n end", "def set attr, to: value\n unless writable_attr? attr\n raise NoMethodError, \"#{attr} is read-only for #{inspect}\"\n end\n real_attr = attribute_for attr\n value = value.to_axvalue\n set real_attr, to: value, for: @ref\n value\n end", "def attribute(opts)\n raise ArgumentError unless opts.is_a?(Hash)\n @attributes << Attribute.new(opts)\n end", "def attribute(name, *args, **opt)\n add_single_property(name, *args, **opt)\n end", "def initialize_attribute(attr, access_level)\n attr_name = attr[0].to_sym\n attr_type = (attr[1] || :unknown).to_sym\n\n # Look for the typecaster, raise an error if one is not found\n typecaster = self.typecasters[attr_type]\n if typecaster.nil?\n raise TypecasterNotFound, \"#{attr_type} is an unknown type\"\n end\n # Map the attribute name to the typecaster\n self.attribute_types[attr_name] = typecaster\n # Add the attribute to the proper list\n if access_level == :public\n if self.protected_attribute?(attr_name)\n raise ArgumentError, \"Illegal change of attribute access level for #{attr_name}\"\n end\n\n self.public_attribute_names << attr_name\n else\n if self.public_attribute?(attr_name)\n raise ArgumentError, \"Illegal change of attribute access level for #{attr_name}\"\n end\n\n self.protected_attribute_names << attr_name\n end\n self.attribute_names << attr_name\n true\n end", "def set_attribute(name, value)\n @attributes[name] = value\n end", "def new_attribute(name, type)\n attributes[name] = type\n define_attr_reader(name)\n define_attr_writer(name, type)\n name\n end", "def attribute=(attribute_name, value)\n write_attribute(attribute_name, value)\n end", "def attribute=(attribute_name, value)\n write_attribute(attribute_name, value)\n end", "def []=(attribute, value)\n self.send(\"#{attribute}=\", value)\n end", "def attr(name); end", "def define_attribute(name, reference = false)\n self.class_eval(\"def #{name};@#{name};end\")\n if reference\n self.class_eval(\"def #{name}=(val);@#{name}=Lobbyist::V2::#{name.camelize}.new(val);end\")\n else\n self.class_eval(\"def #{name}=(val);@#{name}=val;end\")\n end\n end", "def define_attribute(name, reference = false)\n self.class_eval(\"def #{name};@#{name};end\")\n if reference\n self.class_eval(\"def #{name}=(val);@#{name}=Lobbyist::#{name.camelize}.new(val);end\")\n else\n self.class_eval(\"def #{name}=(val);@#{name}=val;end\")\n end\n end", "def set_attr(key, value)\n value = format_value(value)\n key = format_key(key)\n send(\"#{key}=\", value)\n rescue\n unless defined?(Rails).nil?\n $lxca_log.info(\n 'XClarityClient::Endpoints::BuildableResourceMixin',\n \"UNEXISTING ATTRIBUTES FOR #{self.class}: #{key}\"\n )\n end\n end", "def set_attribute(id, attribute, value)\n\t\to = getObject(id)\n\t\tif (o != nil && o.respond_to?(:[]))\n\t\t\to[attribute] = value\n\t\telse\n\t\t\tputs \"Could not find object with id = #{id}\"\n\t\tend\n\tend", "def createAttribute(name)\n ret = Attr.new(name)\n ret.ownerDocument = self\n ret\n end", "def define_attribute( name, type, options )\n class_eval <<-RUBY, __FILE__, __LINE__ + 1\n def #{name}\n unless #{type} === ( v = read_local(:#{name}) )\n _write_local(:#{name}, v = parse( :#{name}, v ) || v ) if v\n end\n v\n end\n \n def #{name}=( v )\n write_local(:#{name}, v)\n end\n RUBY\n end", "def attribute=(name, val)\n write_attribute(name, val)\n end", "def install_attr(attr)\n #Add reader/writer\n inner = code_attr(attr)\n estr = \"class Qml::#{@class}\\n #{inner}\\n end\"\n eval(estr, nil, attr.file, attr.line)\n @cache_load << [:accessor, @class, inner]\n\n name = attr[2]\n\n if(!Special.include? name)\n @init += \"Qml::prop_add(self, #{name.inspect})\\n\"\n end\n end", "def build_attribute(attribute, handler)\n obj = handler.proxy.new({}, attribute, handler)\n populate_attribute(obj, attribute)\n end", "def []= field, value\n @attributes[field] = value\n end", "def assign(attribute, value)\n @attributes[attribute.to_sym] = value\n end", "def set_attribute\n @attribute = Attribute.find(params[:id])\n end", "def set_attribute\n @attribute = Attribute.find(params[:id])\n end", "def create_attribute options\n attributes = options[ :attributes ]\n attr_value = options[ :value ]\n attributes.each do | attr_name |\n self.class.class_eval do\n define_method attr_name do\n instance_variable_get \"@#{ attr_name }\"\n end\n define_method \"#{ attr_name }=\" do | value |\n instance_variable_set( \"@#{ attr_name }\", value )\n end\n end\n self.public_send( \"#{ attr_name }=\", attr_value )\n end\n end", "def attribute(field, options = {})\n # set defaults \n options[:deserialize] = true unless options.has_key?(:deserialize)\n options[:serialize] = true unless options.has_key?(:serialize)\n options[:squash_nil] = true unless options.has_key?(:squash_nil)\n options[:name] ||= field\n options[:name] = options[:name].to_sym unless Symbol === options[:name]\n options[:field] = field\n # make sure we're not breaking the serialization rule\n if serialized_attributes.any? { |o| o[:serialize] && options[:serialize] && o[:name] == options[:name] }\n raise CerealEyes::AttributeError.new \"Unable to set duplicate attribute for serialization with name: #{options[:name]}\"\n end\n if serialized_attributes.any? { |o| o[:deserialize] && options[:deserialize] && o[:field] == options[:field] }\n raise CerealEyes::AttributeError.new \"Unable to set duplicate attribute for deserialization on field: #{options[:field]}\"\n end\n # add to hash\n key = options[:name].is_a?(Symbol) ? options[:name] : options[:name].to_sym\n serialized_attributes << options\n # create the reader if deserializable\n attr_reader(field) if options[:deserialize]\n attr_writer(field) if options[:serialize]\n nil\n end", "def <<(attribute)\n @allowed_attributes[attribute.name.downcase] = attribute\n end", "def simple_attr(attribute)\n define_method :\"#{attribute}\" do |value = nil|\n return instance_variable_get(:\"@#{attribute}\") if value.nil?\n instance_variable_set(:\"@#{attribute}\", value)\n end\n define_method :\"#{attribute}=\" do |value|\n instance_variable_set(:\"@#{attribute}\", value)\n end\n define_method :\"#{attribute}?\" do\n return true if instance_variable_get(:\"@#{attribute}\")\n false\n end\n end", "def attr(column, attr)\n @attrs[column] = attr\n end", "def []=(attribute, value)\n raise ArgumentError unless self.class.keys.include? attribute\n # coerce value according to its attribute's type before being set.\n self.instance_variable_set(\"@#{attribute}\", coerce(value, attribute))\n end", "def define_redis_attribute_method(attribute_name, klass)\n define_method(attribute_name) do\n klass.new(parent: self).to_value\n end\n\n define_method(\"#{attribute_name}=\") do |value|\n klass.new(parent: self).set(value)\n end\n end", "def []=(attr_name, value)\n @attributes[attr_name.to_s] = value\n end", "def []= attribute, value\n `#@native.setAttribute(#{attribute}, #{value})`\n end", "def store(attr_name, attr_options = {})\n attr_name = attr_name.to_sym\n if attributes.has_key? attr_name\n raise \"You should only call store or key once for #{model.name}##{attr_name}\"\n end\n attributes[attr_name] = DataMiner::Attribute.new self, attr_name, attr_options\n end", "def store(attr_name, attr_options = {})\n attr_name = attr_name.to_sym\n if attributes.has_key? attr_name\n raise \"You should only call store or key once for #{model.name}##{attr_name}\"\n end\n attributes[attr_name] = DataMiner::Attribute.new self, attr_name, attr_options\n end", "def write_attribute(attribute, value)\n @object.send(:write_attribute, attribute, value)\n end", "def set(attribute, value)\n @attributes[attribute.to_s] = value\n nil\n end", "def setAttrib(name,value)\n\t\t@attributes[name] = value\n\tend", "def has_attribute(attribute, attr_def)\n @_attributes ||= superclass.instance_variable_get(:@_attributes).dup\n @_attributes[attribute] = attr_def\n end", "def initialize attr={}\n super\n self.attributes = attr\n end", "def initialize\n @attribute = 'truite'\n @accessor = 'pouet'\n end", "def attribute_accessor(attribute, options = {})\n options = { as: attribute, default: nil, coerce: nil }.merge!(options)\n\n define_method options[:as] do\n value = self[attribute] || options[:default]\n next value unless options[:coerce]\n value.send(options[:coerce])\n end\n\n define_method \"#{options[:as]}=\" do |value|\n self[attribute] = value\n send('_attribute_changed', attribute, value) if respond_to?(:_attribute_changed)\n end\n end", "def []= (attr_name, value) \n write_attribute(attr_name, value)\n end", "def attribute\n @attribute ||= Pod::Specification::DSL.attributes.find { |attr| attr.reader_name.to_s == name }\n end", "def on_attribute(attribute)\n @attribute = attribute\n self\n end", "def add_attribute(name, &block); end", "def attribute_factory\n V01::Attributes\n end", "def add_attribute(attribute)\n @attributes << attribute\n end", "def attribute(name)\n @attributes ||= {}\n @attributes[name]\n end", "def []=(attr_name, value)\n writer_method = \"#{attr_name}=\"\n send(writer_method, value) if respond_to?(writer_method)\n end", "def attribute; end", "def attribute; end", "def attribute; end", "def attribute; end", "def attribute; end", "def attribute; end", "def attribute; end", "def [](attr)\n @attr = attr.to_s\n self\n end", "def []=(name, value)\n @attr[name] = value\n end", "def initialize(attrib_name)\n raise \"attrib_name #{attrib_name} not found when creating AttribField object\" unless @@ATTRIBS[attrib_name.to_sym]\n @@ATTRIBS[attrib_name.to_sym].each{|k,v| self.send(\"#{k}=\", v)}\n end", "def create_setter\n @model.class_eval <<-EOS, __FILE__, __LINE__\n #{writer_visibility}\n def #{name}=(value)\n attribute_set(#{name.inspect}, value)\n end\n EOS\n end", "def instance_write(attr, value)\n setter = :\"#{@name_string}_#{attr}=\"\n instance.send(setter, value) if instance.respond_to?(setter)\n end", "def read_only_attribute(name, options={}, &block)\n name = name.to_s\n\n attr_accessors.send :define_method, name do\n value = read_attribute(name)\n value.nil? ? options[:default] : value\n end unless attr_accessors.instance_methods.include?(name)\n self.send :define_method, name, &block if block_given?\n\n enforce_type(name, options[:type]) if options[:type]\n\n define_attribute_method name\n self._read_only_attributes |= [name]\n\n nil\n end", "def set_attr\n @attr = Attr.find(params[:id])\n end", "def set_attr\n @attr = Attr.find(params[:id])\n end", "def []=(attribute, value)\n # shall I raise an exception?\n return if self.class.schema[attribute].nil?\n # shall I convert the value if it's not in the right format?\n self.instance_variable_set(\"@#{attribute}\", value)\n end", "def set_attribute(a,b)\n write_attribute(a,b)\n end", "def attribute(*args)\n if args.first.is_a?(Hash)\n args.first.each_pair { |k,v| self.attribute(k, :as => v) }\n else # array of attributes\n options = args.extract_options!\n @_options[:attributes] ||= {}\n args.each { |name| @_options[:attributes][name] = options[:as] || name }\n end\n end", "def []=(attr_name, value)\n write_attribute(attr_name, value)\n end", "def []=(attr_name, value)\n write_attribute(attr_name, value)\n end", "def []=(attr_name, value)\n write_attribute(attr_name, value)\n end", "def []=(attr_name, value)\n write_attribute(attr_name, value)\n end" ]
[ "0.6707965", "0.6687016", "0.6643935", "0.66366524", "0.6611993", "0.6593258", "0.6507238", "0.64900976", "0.6482233", "0.64706546", "0.64467925", "0.6446142", "0.64392996", "0.6423832", "0.63996214", "0.6319561", "0.6319216", "0.6319179", "0.6315432", "0.627164", "0.6270606", "0.6269356", "0.62027913", "0.61884505", "0.61810356", "0.6177259", "0.6177259", "0.6168736", "0.6141089", "0.61332124", "0.61142236", "0.6084767", "0.60728717", "0.6066495", "0.6053891", "0.6044714", "0.6044714", "0.60336924", "0.60281557", "0.6026866", "0.6025483", "0.6009951", "0.59917957", "0.59672666", "0.59381604", "0.5926163", "0.5922893", "0.59143585", "0.5913451", "0.59098244", "0.59077626", "0.59077626", "0.59036595", "0.5901447", "0.5891499", "0.5888457", "0.58702105", "0.5859098", "0.58570683", "0.5854617", "0.58332306", "0.58286035", "0.58286035", "0.58282065", "0.5824685", "0.5822789", "0.5815034", "0.5812457", "0.5812006", "0.5811485", "0.5806557", "0.5801299", "0.57866853", "0.5772781", "0.5764734", "0.5762487", "0.5755231", "0.5748935", "0.5745021", "0.5745021", "0.5745021", "0.5745021", "0.5745021", "0.5745021", "0.5745021", "0.5729476", "0.57177806", "0.57072794", "0.57050645", "0.570069", "0.56995267", "0.5692134", "0.5692134", "0.569112", "0.5690906", "0.56908303", "0.5688945", "0.56871694", "0.56871694", "0.56871694" ]
0.63355976
15
DELETE /statements/1 DELETE /statements/1.json
def destroy @statement.destroy respond_to do |format| format.html { redirect_to admin_statements_url, notice: 'Statement was successfully destroyed.' } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @statement = Statement.find(params[:id])\n @statement.destroy\n\n respond_to do |format|\n format.html { redirect_to statements_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @statement.destroy\n respond_to do |format|\n format.html { redirect_to store_statements_url(@store) }\n format.json { head :no_content }\n end\n end", "def destroy\n @statement.destroy\n respond_to do |format|\n format.html { redirect_to statements_url, notice: 'Statement was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @statement.destroy\n respond_to do |format|\n format.html { redirect_to edit_event_path(@event), notice: t('actions.destroy.success') }\n format.json { head :no_content }\n end\n end", "def delete_statements!(options={}, safety=true)\n\n unless !safety || options.keys.select {|x| [:subj, :pred, :obj].include?(x) }.size > 0\n raise Exception.new(\"You asked to delete all statements in the repository. Either give a subj/pred/obj qualifier, or set safety=false\")\n end\n\n # We have to use net/http, because curb has not yet implemented DELETE as of this writing.\n\n uri = URI.parse(self.uri + \"/statements?\" + self.class.get_parameterize(options.reject{|k,v|\n ![:subj, :pred, :obj, :context, :infer].include?(k)\n }))\n http = Net::HTTP.start(uri.host, uri.port)\n http.delete(uri.path)\n raise(SesameException.new(easy.body_str)) unless easy.response_code == 204\n end", "def delete()\n sql = \"DELETE FROM transactions\n WHERE id = $1\"\n values = [@id]\n SqlRunner.run(sql, values)\nend", "def delete\n client.delete(\"/#{id}\")\n end", "def delete\n if body.empty? && params[:id]\n client.delete(params)\n elsif body.empty?\n client.delete_by_query(params.merge(body: body.merge(ALL)))\n else\n client.delete_by_query(params.merge(body: body))\n end\n end", "def destroy\n @opening_statement.destroy\n respond_to do |format|\n format.html { redirect_to opening_statements_url, notice: 'Opening statement was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_one()\n #connect to db\n db = PG.connect({ dbname: \"bounty_hunters\", host: \"localhost\" })\n #write SQL statement string\n sql = \"DELETE FROM bounties WHERE id = $1\"\n #make values array - in this case it only needs one value\n values = [@id]\n #prepare statemnt\n db.prepare(\"delete_one\", sql)\n #run prepared statement\n db.exec_prepared(\"delete_one\", values)\n #close db link\n db.close()\n end", "def delete *args, &block\n res = @conn.delete *args, &block\n handle res, parse: false\n end", "def delete\n binding.pry\n DATABASE.execute(\"DELETE FROM contents WHERE id = #{id}\")\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def delete\n start { |connection| connection.request http :Delete }\n end", "def delete\n @delete ||= Verb.new do |verb|\n verb.entity :trip, :air, :lodging, :car, :profile, :rail, \\\n :transport, :cruise, :restaurant, :activity, :note, :map, \\\n :directions \\\n do |entity, id|\n do_request('delete', entity, {:id=>id}, nil)\n end\n end\n end", "def destroy\n @series_statement.destroy\n\n respond_to do |format|\n format.html { redirect_to series_statements_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @closing_statement.destroy\n respond_to do |format|\n format.html { redirect_to closing_statements_url, notice: 'Closing statement was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(id)\n @conn.exec(\"DELETE FROM students WHERE id = '#{id}';\");\nend", "def delete\n request(:delete)\n end", "def delete\n sql = \"DELETE FROM albums WHERE id = $1\"\n values = [@id]\n SqlRunner.run(sql, values)\nend", "def destroy\n @expense = Expense.find(params[:id])\n @expense.destroy\n\n respond_to do |format|\n format.html { redirect_to account_statement_url(params[:account_id],params[:statement_id]) }\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 @bank_statement.destroy\n respond_to do |format|\n format.html { redirect_to bank_statements_url, notice: 'Bank statement was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @financial_statement = FinancialStatement.find(params[:id])\n @financial_statement.destroy\n\n respond_to do |format|\n format.html { redirect_to financial_statements_url }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Post.delete(params[\"id\"])\n end", "def delete(id)\n @conn.exec(\"DELETE FROM students WHERE id = '#{id}';\")\nend", "def destroy\n @statement_type.destroy\n respond_to do |format|\n format.html { redirect_to statement_types_url, notice: 'Statement type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Alien.delete(params[\"id\"])\n end", "def delete()\n db = PG connect( {dbname: 'bounty_hunter',\n host: 'localhost'\n })\n sql = 'DELETE from bounty_hunter'\n db.prepare('delete_one', sql)\n db.exec_prepared('delete_one', value)\n db.close()\nend", "def delete(id)\n @conn.exec(\"DELETE FROM students WHERE id = '#{id}'\")\nend", "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 delete\n DATABASE.execute(\"DELETE FROM students WHERE id = #{@id}\")\n end", "def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end", "def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end", "def delete\n DATABASE.execute(\"DELETE from students WHERE id = #{id}\")\n end", "def delete\n sql = 'DELETE FROM members WHERE id = $1'\n values = [@id]\n SqlRunner.run(sql, values)\nend", "def destroy\n @my_sql.destroy\n respond_to do |format|\n format.html { redirect_to my_sqls_url, notice: 'My sql was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(*rest) end", "def incident_delete(statuspage_id, incident_id)\n data = {}\n data['statuspage_id'] = statuspage_id\n data['incident_id'] = incident_id\n\n request :method => :post,\n :url => @url + 'incident/delete',\n :payload => data\n end", "def delete(url, headers = {})\n http :delete, \"#{url}.json\", headers\n end", "def delete_statement(statement)\n self.deletes << statement\n end", "def delete_statement(statement)\n self.deletes << statement\n end", "def delete(path)\n make_call(mk_conn(path), :delete)\n end", "def destroy\n @verb.destroy\n\n head :no_content\n end", "def destroy\n Audit.find(params[:id]).destroy\n head :no_content\n end", "def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\n end", "def destroy\n @sql_query.destroy\n respond_to do |format|\n format.html { redirect_to sql_queries_url, notice: 'Sql query was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def destroy\n @annex = Annex.find(params[:id])\n @annex.destroy\n\n respond_to do |format|\n format.html { redirect_to annexes_url }\n format.json { head :no_content }\n end\n end", "def delete\n \n end", "def delete!\n request! :delete\n end", "def destroy\n @server_ins_transaction = ServerInsTransaction.find(params[:id])\n @server_ins_transaction.destroy\n\n respond_to do |format|\n format.html { redirect_to server_ins_transactions_url }\n format.json { head :no_content }\n end\n end", "def delete\n execute_request('DELETE') do |uri, headers|\n HTTP.http_client.delete(uri, header: headers)\n end\n end", "def delete(sql, name = nil) end", "def delete(id)\n @conn.exec(\"DELETE FROM students WHERE id = '#{id}';\")\n puts \"Your record has been deleted\"\nend", "def delete\n \n end", "def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end", "def delete\n sql = \"DELETE FROM tickets WHERE id = $1\"\n values = [id]\n SqlRunner.run(sql, values)\n end", "def delete\n render json: Item.delete(params[\"id\"])\n end", "def destroy\n @verb.destroy\n respond_to do |format|\n format.html { redirect_to verbs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @clause.destroy\n respond_to do |format|\n format.html { redirect_to clauses_url, notice: 'Clause was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(options={})\n connection.delete(\"/\", @name)\n end", "def delete()\n sql = \"DELETE from customers WHERE id = $1\"\n values = [@id]\n SqlRunner.run(sql, values)\n# => Deleting customer record, nothing to return\n end", "def delete() # EXTENSION\n sql = \"DELETE FROM films WHERE id = $1\"\n values = [@id]\n SqlRunner.run(sql, values)\nend", "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_from_entzumena\n headline = Headline.where({:source_item_type => params[:source_item_type], :source_item_id => params[:source_item_id]}).first\n if headline.destroy\n render :json => true, :status => 200\n else\n render :json => false, :status => :error\n end\n end", "def delete() #DELETE film1.delete (removes 1 film)\n sql = \"DELETE FROM films WHERE id = $1;\"\n values = [@id]\n SqlRunner.run(sql, values)\n end", "def delete(*args)\n execute(:delete, *args)\n end", "def destroy\n @<%= singular_table_name %>.destroy\n respond_to do |format|\n format.html { redirect_to <%= table_name %>_url }\n format.json { head :no_content }\n end", "def destroy\n @cc_statement = CcStatement.find(params[:id])\n @cc_statement.destroy\n\n respond_to do |format|\n format.html { redirect_to(cc_statements_url) }\n format.xml { head :ok }\n end\n end", "def delete\n render json: Company.delete(params[\"id\"])\n end", "def delete(path)\n request 'DELETE', path\n end", "def destroy\n @mode = params[:deleteMode]\n type = params[:type] || \"\"\n concept = params[:concept] || \"\"\n type.strip!\n concept.strip!\n\n Document.transaction do \n if @mode == \"batch\"\n @ids = params[:ids]\n if @document.has_reference_relation?(@ids)\n return render json: 'Cannot delete annotation because there is a relation that refers to this node' , status: 422 \n end\n ret = Annotation.execute_sql(\"DELETE FROM annotations WHERE id in (?)\", @ids)\n elsif @mode == \"concept\"\n if @assign.present?\n targets = Annotation.execute_sql(\"\n SELECT id FROM annotations \n WHERE assign_id = ? AND version = ? AND concept = ? AND a_type = ?\n \", @assign.id, @annotation.version, @annotation.concept, @annotation.a_type)\n elsif @project.manager?(current_user) || @project.collaborate_round\n targets = Annotation.execute_sql(\"\n SELECT id FROM annotations \n WHERE document_id = ? AND version = ? AND concept = ? AND a_type = ?\n \", @document.id, @annotation.version, @annotation.concept, @annotation.a_type)\n end\n @ids = targets.map{|e| e[0]}\n if @document.has_reference_relation?(@ids)\n return render json: 'Cannot delete annotation because there is a relation that refers to this node' , status: 422 \n end\n ret = Annotation.execute_sql(\"DELETE FROM annotations WHERE id in (?)\", @ids)\n elsif @mode == \"mention\"\n if @document.has_reference_relation?([@annotation.id])\n return render json: 'Cannot delete annotation because there is a relation that refers to this node' , status: 422 \n end\n @ids = [@annotation.id]\n @annotation.destroy\n end\n @document.touch\n end\n @document.create_audit(current_user, \"Delete annotation\", params.to_json, @ids.join(\",\"))\n\n # @annotation.destroy\n respond_to do |format|\n format.html { redirect_to @document, notice: 'The annotation was successfully deleted.' }\n format.json { render json: @ids, status: :ok }\n end\n end", "def delete!( opts = {} )\n http_action :delete, nil, opts\n end", "def destroy\n @financial_statement.destroy\n respond_to do |format|\n format.html { redirect_to financial_statements_url, notice: 'Financial statement was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(*args)\n commit(\"delete\", *args)\n end", "def destroy\n @anything.destroy\n respond_to do |format|\n format.html { redirect_to anythings_url }\n format.json { head :no_content }\n end\n end", "def delete(path, params = {})\n debug_log \"DELETE #{@host}#{path} params:#{params}\"\n res = connection.delete path, params\n debug_log \"Response status:#{res.status}, body:#{res.body}\"\n res\n end", "def delete(query)\n\n connect if @persevere.nil?\n\n deleted = 0\n\n if ! query.is_a?(DataMapper::Query)\n resources = [query].flatten\n else\n resources = read_many(query)\n end\n\n resources.each do |resource|\n tblname = resource.model.storage_name\n id = resource.attributes(:field)['id']\n \n # Retrieve the ID from persever if the resource doesn't have an ID field\n if id.nil?\n query = Persevere.enhance(resource.query)\n path = \"/#{tblname}/#{query.to_json_query_filter}[={'id':id}]\"\n response = @persevere.retrieve(path, {})\n id = JSON.parse(response.body)[0]['id'].match(/(\\w+\\/)*(\\d+)/)[2]\n end\n \n path = \"/#{tblname}/#{id}\"\n # path = \"/#{tblname}/#{resource.key.first}\"\n \n DataMapper.logger.debug(\"(Delete) PATH/QUERY: #{path}\")\n\n result = @persevere.delete(path)\n\n if result.code == \"204\" # ok\n deleted += 1\n end\n end\n return deleted\n end", "def delete\n\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete(*args)\n commit(\"delete\", *args)\n end", "def delete(path, **options)\n execute :delete, path, options\n end", "def destroy\n @client_transaction = ClientTransaction.find(params[:id])\n @client_transaction.destroy\n\n respond_to do |format|\n format.html { redirect_to client_transactions_url }\n format.json { head :ok }\n end\n end", "def delete()\n sql = \"DELETE FROM albums\n WHERE id = $1;\"\n values = [@id]\n SqlRunner.run( sql, values )\n end", "def delete(path)\n request(:delete, path)\n end", "def delete(*args)\n prepare_request(:delete, args)\n @@client.add(:delete, @path, *args)\n end", "def destroy\n @stable = Stable.find(params[:id])\n @stable.destroy\n\n respond_to do |format|\n format.html { redirect_to stables_url }\n format.json { head :no_content }\n end\n end", "def delete\n Iterable.request(conf, base_path).delete\n end", "def delete\n\n DB.execute(\"DELETE FROM #{table_name} WHERE id = #{@id};\")\n end", "def deleteRequest\n\n end", "def delete\n api(\"Delete\")\n end", "def delete endpoint\n do_request :delete, endpoint\n end", "def delete\n super \"/templates/#{template_id}.json\", {}\n end" ]
[ "0.74896455", "0.71904516", "0.7111607", "0.6917781", "0.6737038", "0.66258734", "0.6539619", "0.6518448", "0.6485976", "0.6457105", "0.6446704", "0.6444823", "0.64389604", "0.6409114", "0.6389034", "0.6373529", "0.6337345", "0.63357604", "0.6325747", "0.63200015", "0.63145936", "0.6314593", "0.63017195", "0.6299199", "0.62930137", "0.6291615", "0.6289924", "0.62670314", "0.62659246", "0.62613696", "0.6253207", "0.6240686", "0.6237346", "0.623025", "0.6226699", "0.6221734", "0.62125", "0.6199563", "0.6195233", "0.6171007", "0.6166629", "0.6166629", "0.61555517", "0.6149251", "0.61415416", "0.61352366", "0.6131773", "0.61308277", "0.61292386", "0.6125642", "0.6125642", "0.6125642", "0.6125642", "0.6117231", "0.6112194", "0.61107594", "0.6103617", "0.6095101", "0.6094131", "0.60914767", "0.6091375", "0.6090158", "0.60828", "0.6082468", "0.60803086", "0.6075437", "0.60650265", "0.6054643", "0.6054219", "0.6050441", "0.6049222", "0.6045955", "0.60439545", "0.6042639", "0.6035897", "0.60323286", "0.602869", "0.6023251", "0.60212594", "0.601983", "0.60189116", "0.60150796", "0.60141706", "0.6013046", "0.6011517", "0.6001683", "0.6001683", "0.6000191", "0.5998143", "0.5991736", "0.5979444", "0.5979356", "0.5977371", "0.5975546", "0.59702784", "0.5970069", "0.5968399", "0.5967365", "0.5965758", "0.59642184" ]
0.65855336
6
Use callbacks to share common setup or constraints between actions.
def set_statement @statement = Statement.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Only allow a list of trusted parameters through.
def statement_params params.require(:statement).permit(:email, :name, :soname, :father_name, :position, :place, :test_id, :notified, :paid, :certificate, {search: [:paid, :email, :fio, :ticket_id,{date: [:start, :end]}]}) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def param_whitelist\n [:role, :title]\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 strong_params\n params.require(:user).permit(param_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 allow_params_authentication!; end", "def whitelisted_args\n args.select &:allowed\n end", "def safe_list_sanitizer; end", "def safe_list_sanitizer; end", "def safe_list_sanitizer; end", "def filtered_parameters; end", "def sanitize_params_for user, params, allowed_params\n params.each do |key, val|\n #if allowed_params.include?(key)\n #sanitize!(user, params, key) if key =~ /_attributes|_ids$/\n #else\n #params.delete(key)\n #end\n params.delete(key) unless allowed_params.include?(key.to_sym)\n end\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def expected_permitted_parameter_names; end", "def sanitize_parameters!(sanitizer, params)\n # replace :readwrite with :onlyif\n if params.has_key?(:readwrite)\n warn \":readwrite is deprecated. Replacing with :onlyif\"\n params[:onlyif] = params.delete(:readwrite)\n end\n\n # add default parameters\n bindata_default_parameters.each do |k,v|\n params[k] = v unless params.has_key?(k)\n end\n\n # ensure mandatory parameters exist\n bindata_mandatory_parameters.each do |prm|\n if not params.has_key?(prm)\n raise ArgumentError, \"parameter ':#{prm}' must be specified \" +\n \"in #{self}\"\n end\n end\n\n # ensure mutual exclusion\n bindata_mutually_exclusive_parameters.each do |param1, param2|\n if params.has_key?(param1) and params.has_key?(param2)\n raise ArgumentError, \"params #{param1} and #{param2} \" +\n \"are mutually exclusive\"\n end\n end\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def safe_list_sanitizer=(_arg0); end", "def safe_list_sanitizer=(_arg0); end", "def safe_list_sanitizer=(_arg0); 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 param_whitelist\n [:rating, :review]\n end", "def check_params; true; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\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 allowed?(*_)\n true\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 allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end", "def secure_params\n return @secure_params if @secure_params\n\n defn = implementation_class.definition\n field_list = [:master_id] + defn.field_list_array\n\n res = params.require(controller_name.singularize.to_sym).permit(field_list)\n res[implementation_class.external_id_attribute.to_sym] = nil if implementation_class.allow_to_generate_ids?\n @secure_params = res\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 permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permit( params, whitelist, name = nil )\n raise 'Parametrization not yet configured' unless @configured\n whitelist ||= []\n px = params.respond_to?( :permit ) ? params : ActionController::Parameters.new( params )\n px = dig(px, name)\n px.permit( *whitelist )\n end", "def valid_params?; 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 url_allowlist=(_arg0); 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 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 list_params\n params.permit(:list_name)\n end", "def valid_params_request?; end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def param_list(param_type, name, type, required, description = nil, allowed_values = [], hash = {})\n hash.merge!({allowable_values: {value_type: \"LIST\", values: allowed_values}})\n param(param_type, name, type, required, description, hash)\n end", "def safelists; end", "def authorize_own_lists\n authorize_lists current_user.lists\n end", "def listed_params\n params.permit(:listed, :list_id, :listable_id, :listable_type, :campsite_id)\n end", "def lists_params\n params.require(:list).permit(:name)\n\n end", "def list_params\n params.require(:list).permit(:name, :user_id)\n end", "def list_params\n params.require(:list).permit(:name, :description, :type, :privacy, :allow_edit, :rating, :votes_count, :user_id)\n end", "def check_params\n true\n end", "def authorize_own_or_shared_lists\n authorize_lists current_user.all_lists\n end", "def user_pref_list_params\n\t\tparams.require(:user).permit(:preference_list)\n\tend", "def may_contain!(*keys)\n self.allow_only_permitted = true\n self.permitted_keys = [*permitted_keys, *keys].uniq\n end", "def filter_parameters; end", "def filter_parameters; end", "def whitelist; end", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def list_params\n params.require(:list).permit(:name)\n end", "def list_params\n params.permit(:name)\n end", "def recipient_list_params\n params.require(:recipient_list).permit(:name, :list, :references)\n end", "def cancan_parameter_sanitizer\n resource = controller_name.singularize.to_sym\n method = \"#{resource}_params\"\n params[resource] &&= send(method) if respond_to?(method, true)\n end", "def list_params\n params.require(:list).permit(:name).merge(user_id: current_user.id)\n end", "def whitelist_place_params\n params.require(:place).permit(:place_name, :unlock, :auth, :is_deep_checked, :parent_ADM4, :parent_ADM3, :parent_ADM2, :parent_ADM1, :parent_country, feature_code: [], same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end", "def list_params\n params.fetch(:list, {}).permit(:user_id, :name, :active)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def secure_params(require_param, permit_keys)\n params.require(require_param).permit(*permit_keys)\n end", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def permitted_params\n []\n end", "def price_list_params\n params.fetch(:price_list, {}).permit(:name, :valid_from, :valid_to, :active,\n :all_warehouses, :all_users, :all_contact_groups,\n warehouse_ids: [], price_lists_user_ids: [], contact_group_ids: [])\n end", "def params(list)\n @declared_params = list\n end", "def admin_review_params\n params.fetch(:review, {}).permit(whitelisted_params)\n end", "def saved_list_params\n params.require(:saved_list).permit(:user_id)\n end", "def allow(ids); end", "def list_params\n params.require(:list).permit(:name)\n end", "def list_params\n params.require(:list).permit(:name)\n end", "def list_params\n params.require(:list).permit(:name)\n end", "def filter_params(param_set, **kwargs)\r\n begin\r\n key = kwargs[:key]\r\n params.require(key).permit(*param_set)\r\n rescue Exception\r\n params.permit(*param_set)\r\n end\r\n end", "def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end", "def validate_paramified_params\n self.class.paramify_methods.each do |method|\n params = send(method)\n transfer_errors_from(params, TermMapper.scope(params.group)) if !params.valid?\n end\n end", "def list_params\n params.require(:list).permit(:name)\n end", "def secure_params\n return @secure_params if @secure_params\n\n @implementation_class = implementation_class\n resname = @implementation_class.name.ns_underscore.gsub('__', '_').singularize.to_sym\n @secure_params = params.require(resname).permit(*permitted_params)\n end", "def refine_permitted_params(param_list)\n res = param_list.dup\n\n ms_keys = res.select { |a| columns_hash[a.to_s]&.array }\n ms_keys.each do |k|\n res.delete(k)\n res << { k => [] }\n end\n\n res\n end", "def recipient_list_params\n params.require(:recipient_list).permit(:name, :description, recipient_id_array: [])\n end", "def safelist; end", "def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end", "def valid_for_params_auth?; end", "def default_param_whitelist\n [\"mode\"]\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 shopping_list_params\n params.require(:shopping_list).permit!\n end", "def permitted_params\n declared(params, include_missing: false)\n end", "def permitted_params\n declared(params, include_missing: false)\n end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def permitters\n @_parametrizr_permitters || {}\n end", "def allow_params(action, keys: nil, except: nil, &blk)\n keys &&= Array.wrap(keys)\n keys ||= User.field_names\n except &&= Array.wrap(except)\n except ||= %i[id email]\n devise_parameter_sanitizer.permit(action, keys: keys, except: except, &blk)\n end", "def list_params\n if current_user && current_user.role == 'admin'\n params.require(:list).permit(:name, :url, :description, :user_id,\n ideas_attributes: [:id, :list_id, :body, :due_date, :completion_status, :_destroy])\n else\n params.require(:list).permit(:name, :description,\n ideas_attributes: [:body, :due_date, :completion_status]) \n end\n end", "def whitelist(params)\n send_request_of_type(GlobalConstant::PrivateOpsApi.private_ops_api_type, 'post', '/token-sale/whitelist', params)\n end", "def valid_access_params\n params.require(:valid_access).permit(:wish_list_id, :user_id)\n end", "def url_allowlist; end", "def ensure_redirected_params_are_safe!(passed_params)\n unless passed_params.is_a?(ActionController::Parameters) && passed_params.permitted?\n error_message = if passed_params.is_a?(ActionController::Parameters)\n unsafe_parameters = passed_params.send(:unpermitted_keys, params)\n \"[Rails::Prg] Error - Must use permitted strong parameters. Unsafe: #{unsafe_parameters.join(', ')}\"\n else\n \"[Rails::Prg] Error - Must pass strong parameters.\"\n end\n raise error_message\n end\n end", "def data_collection_params\n allow = [:name,:description,:institution,:collection_name,:country_id,:province_id,:city_id]\n params.require(:data_collection).permit(allow)\n end", "def quote_params\n params.permit!\n end" ]
[ "0.69497335", "0.6812623", "0.6803639", "0.6795365", "0.67448795", "0.67399913", "0.6526815", "0.6518771", "0.64931697", "0.6430388", "0.6430388", "0.6430388", "0.63983387", "0.6356042", "0.63535863", "0.63464934", "0.63444513", "0.6337208", "0.6326454", "0.6326454", "0.6326454", "0.63140553", "0.6299814", "0.62642586", "0.626006", "0.62578833", "0.6236823", "0.6227561", "0.6221758", "0.62200165", "0.620879", "0.61983657", "0.6195055", "0.6172993", "0.6156856", "0.61558664", "0.61521494", "0.6135789", "0.6121145", "0.61118174", "0.60736513", "0.6071645", "0.60632104", "0.60549796", "0.6043906", "0.6034662", "0.60207325", "0.6018568", "0.6016575", "0.60103434", "0.60084206", "0.600763", "0.6007443", "0.6003619", "0.6003619", "0.5995791", "0.5993301", "0.5993231", "0.5984926", "0.597122", "0.5968121", "0.5965808", "0.59640145", "0.59632224", "0.59602356", "0.59332967", "0.5927556", "0.5922805", "0.5909745", "0.5905083", "0.5904304", "0.5893434", "0.58888215", "0.58823985", "0.58823985", "0.58823985", "0.5873434", "0.58619875", "0.58533794", "0.5845531", "0.58426666", "0.58360124", "0.583218", "0.5828041", "0.5827927", "0.5816121", "0.5814705", "0.5812719", "0.581121", "0.5803423", "0.5803423", "0.57995003", "0.5794207", "0.5784923", "0.5781365", "0.5776385", "0.5774859", "0.57671493", "0.5766998", "0.57618684", "0.5758038" ]
0.0
-1
updates details of given ticket on CCCinema database
def update # EXTENSION sql = "UPDATE tickets SET customer_id = $1, film_id = $2, screening_id = $3 WHERE id = $4" values = [@customer_id, @film_id, @screening_id, @id] SqlRunner.run(sql, values) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @ticket.update(ticket_params)\n\n end", "def update\n logger.info { \"PARAMS: #{params.inspect}\" }\n project_id, id = params[:id].split('-')\n ticket = Lighthouse::Ticket.find(id, :params => {:project_id => project_id})\n \n # insanely hacky. can't nest json, so don't want to do a willy-nilly merge.\n # move mergeable params to the [:ticket] hash to follow usual rails conventions\n # before merging\n params[:ticket] = {}\n %w(assigned_user_id state milestone_id).each do |field|\n params[:ticket].merge!( field => params.delete(field) ) if params[field]\n end\n logger.info { \"TICKET ATTRS TO UPDATE: #{params[:ticket].inspect}\"}\n \n ticket.attributes.merge!( params[:ticket] )\n ticket.save\n\n respond_to do |format|\n # if @ticket.update_attributes(params[:ticket])\n # flash[:notice] = 'Ticket was successfully updated.'\n # format.html { redirect_to(@ticket) }\n # format.xml { head :ok }\n # else\n # format.html { render :action => \"edit\" }\n # format.xml { render :xml => @ticket.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 sql = \"UPDATE tickets SET (customer_id,film_id,cinema,type) = (#{@customer_id},#{@film_id},'#{@cinema}','#{@type}') WHERE id=#{@id};\"\n SqlRunner.run(sql)\n end", "def update\n @ticket.update_attributes(params[:ticket])\n\n respond_with(@story, @ticket)\n end", "def update\n @ticket = Ticket.find(params[:id])\n @ticket.previous_assignee_id = @ticket.assignee_id\n @ticket.updater_id = session[:user]\n\n respond_to do |format|\n if @ticket.update_attributes(params[:ticket])\n flash[:notice] = 'Ticket was successfully updated.'\n format.html { redirect_to @coll_url }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ticket.errors.to_xml }\n end\n end\n end", "def update\n if @ticket.update(ticket_params)\n redirect_to @ticket, notice: 'Ticket was successfully updated.'\n else\n render :edit\n end\n end", "def update\n @ticket = Helpdesk::Ticket.find(params[:id])\n\n respond_to do |format|\n if @ticket.update_attributes(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.'}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end", "def save_ticket(ticket)\n stmt = \"INSERT INTO #{@@tickets_table} values(#{ticket.id}, '#{ticket.requester.to_json}', '#{ticket.status}', '#{ticket.subject}', '#{ticket.content}', '#{ticket.created_at}', '#{ticket.updated_at}', '#{ticket.comment}')\"\n execute_statement(stmt)\n end", "def set_ticket\n @ticket = Ticket.find(params[:ticket_id])\n end", "def update\n @ticket = Ticket.find(params[:id])\n\n\t\t@ticket.attributes = params[:ticket]\n\n respond_to do |format|\n if @ticket.valid?\n\t\t\t\tif TicketLog.make_log(params[:log], @ticket, current_user)\n\t\t\t\t\t@ticket.save\n\t\t\t\t\tflash[:notice] = 'Ticket was successfully updated.'\n\t\t\t\t\tformat.html { redirect_to(@ticket) }\n\t\t\t\t\tformat.xml { head :ok }\n\t\t\t\telse\n\t\t\t\t\t@ticket.errors.add :log, \"entry cannot be blank\"\n\t\t\t\t\tformat.html { render :action => \"edit\" }\n\t\t\t\t\tformat.xml { render :xml => @ticket.errors, :status => :unprocessable_entity }\n\t\t\t\tend\n else\n\t\t\t\t@ticket.save\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ticket.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n if @ticket.update_attributes(params[:ticket])\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render json: {status: :ok}, status: :ok }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n if @ticket.update_attributes(params[:ticket])\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n if @ticket.update_attributes(params[:ticket])\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n if @ticket.update_attributes(params[:ticket])\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n if @ticket.update_attributes(params[:ticket])\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n if @ticket.update_attributes(params[:ticket])\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n find_changes\n \n # Prevent assigned dev from being empty string on update\n if params[:ticket][:assigned_dev_id].blank?\n params[:ticket][:assigned_dev_id] = nil\n end\n \n if ok_to_edit? and save_histories and @ticket.update(ticket_params) \n redirect_to ticket_dashboard_path(@ticket.id), notice: \"Ticket was successfully updated.\"\n else\n flash[:alert] = \"Could not update ticket.\"\n redirect_to ticket_dashboard_path(@ticket.id)\n end\n end", "def update\n if @ticket.update(@ticket_params)\n render_success_format('client created correctly', @ticket)\n end\n rescue StandardError => e\n Airbrake.notify(e)\n raise e\n end", "def update\n @ticket = Ticket.find(params[:id])\n\n # if open \n if params[:ticket][:ticket_status_id] == \"1\"\n \t@ticket.solver_id = nil\n # if solved\n elsif params[:ticket][:ticket_status_id] == \"2\"\n \t@ticket.solver_id = current_user.id\n \t@ticket.solved_at = Time.now\n end\n \n respond_to do |format|\n if @ticket.update_attributes(params[:ticket])\n \t\n format.html { redirect_to(@ticket, :notice => 'Ticket was successfully updated.') }\n # format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n # format.xml { render :xml => @ticket.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: \"Ticket was successfully updated.\" }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: \"Ticket was successfully updated.\" }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n @ticket.payment.credit.terminado\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end", "def save_edited_ticket_entry\n @raw_date = params[:delivery_date]\n \n @day = @raw_date[3..4]\n @month = @raw_date[0..1]\n @year = @raw_date[6..9]\n \n @delivery_date = \"#{@year}-#{@month}-#{@day}\"\n \n @ticket = Ticket.find(params[:id])\n @ticket.number = params[:ticket_number]\n @ticket.delivery_date = @delivery_date\n @ticket.job_id = params[:job_id]\n @ticket.destination_id = params[:destination_id]\n @ticket.wood_type = params[:wood_type_id]\n \n #Because the tickets value (load pay) comes in as string in currency format\n # some parts have to be stripped off to be able to turn it into float correctly\n @value = params[:load_pay].to_s\n 3.times do\n @value.sub!(\",\", \"\")\n end\n @value = @value.to_f\n \n @ticket.value = @value\n \n @ticket.load_details.each_with_index do |i, x|\n i.species_id = params[:specieses][x]\n i.tonnage = params[:tonnages][x]\n i.mbfs = params[:mbfs][x]\n \n unless i.save\n render :status => 306, :nothing => true\n return\n end\n end\n \n unless @ticket.save\n render :status => 306, :nothing => true\n else\n render :status => 200, :nothing => true\n end\n end", "def update\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n if @ticket.update_attributes(params[:ticket])\n format.html { redirect_to tickets_path, notice: 'Ticket was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n if @ticket.update_attributes(params[:ticket])\n format.html { redirect_to(@ticket, :notice => 'Bilet został pomyślnie zaktualizowany.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ticket.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_ticket\n @ticket = Ticket.includes(:comments).find(params[:id])\n end", "def update\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n if @ticket.update_attributes(params[:ticket])\n flash[:notice] = 'Ticket was successfully updated.'\n format.html { redirect_to(@ticket) }\n format.xml { head :ok }\n else\n format.html { render :edit }\n format.xml { render :xml => @ticket.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @admin_ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n if @admin_ticket.update_attributes(params[:ticket])\n format.html { redirect_to admin_ticket_path(@admin_ticket), notice: 'Ticket was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_ticket.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { \n flash[:notice] = 'La boleta se actualizó satisfactoriamente.'\n redirect_to tickets_path\n }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_ticket\n @ticket = Ticket.find(params[:id]) if params[:id]\n end", "def ticket_status_updated(ticket)\n\t@ticket = ticket\n\n mail to: @ticket.customer_email, subject: \"You ticket updated\"\n end", "def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to edit_ticket_path(@ticket), notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n if @ticket.update_attributes(params[:ticket])\n flash[:notice] = 'Ticket was successfully updated.'\n format.html { redirect_to(@ticket) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ticket.errors, :status => :unprocessable_entity }\n end\n end\n end" ]
[ "0.7801914", "0.74517876", "0.7255612", "0.7127886", "0.70913583", "0.69678116", "0.69181865", "0.69103605", "0.68866813", "0.6841769", "0.68368363", "0.68330294", "0.6822439", "0.68152404", "0.68152404", "0.68152404", "0.68152404", "0.68152404", "0.6801375", "0.6801108", "0.6801108", "0.6801108", "0.6801108", "0.6801108", "0.6801108", "0.6801108", "0.6801108", "0.6801108", "0.6801108", "0.6801108", "0.6801108", "0.6801108", "0.6801108", "0.6801108", "0.6801108", "0.6801108", "0.68009925", "0.67983687", "0.6793992", "0.6787264", "0.67871565", "0.67871565", "0.67871565", "0.67871565", "0.67871565", "0.67871565", "0.67871565", "0.67871565", "0.67871565", "0.67871565", "0.67871565", "0.67871565", "0.67871565", "0.67871565", "0.67871565", "0.67871565", "0.67871565", "0.67871565", "0.67871565", "0.67871565", "0.67871565", "0.67871565", "0.67871565", "0.67871565", "0.67871565", "0.67871565", "0.67871565", "0.67871565", "0.67871565", "0.67871565", "0.67871565", "0.67871565", "0.67871565", "0.67871565", "0.67871565", "0.67871565", "0.67871565", "0.67871565", "0.67871565", "0.678511", "0.678511", "0.678511", "0.678511", "0.678511", "0.678511", "0.678511", "0.678511", "0.67809385", "0.67809385", "0.67743653", "0.6766326", "0.6759436", "0.6748659", "0.6741416", "0.6741383", "0.6734861", "0.6731088", "0.67301595", "0.6722061", "0.6720724", "0.6715004" ]
0.0
-1
deletes a given ticket from CCCinema database
def delete() # EXTENSION sql = "DELETE FROM films WHERE id = $1" values = [@id] SqlRunner.run(sql, values) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete()\n sql = \"DELETE FROM tickets WHERE id=#{@id};\"\n SqlRunner.run(sql)\n end", "def delete\n sql = \"DELETE FROM tickets WHERE id = $1\"\n values = [id]\n SqlRunner.run(sql, values)\n end", "def destroy\n @ticket.destroy\n end", "def delete_ticket\n @ticket = Ticket.find(params[:id])\n @ticket.delete\n \n render :nothing => true\n end", "def delete id\n\t\t@tickets.delete ['id', id]\n\tend", "def destroy\n @ticket.destroy\n render_destroy_format(\"ticket removed\")\n end", "def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n flash[:notice] = 'Ticket was successfully deleted.'\n format.html { redirect_to @coll_url }\n format.xml { head :ok }\n end\n end", "def DeleteTicket id\n \n APICall(path: \"tickets/#{id}.json\",method: 'DELETE')\n \n end", "def update\n a = Ticket.find(params[:id])\n a.destroy()\n render json: \"success\"\n end", "def cancel_ticket(ticket)\n\n sql = \"SELECT film_id FROM tickets WHERE id = $1\"\n values = [ticket.id]\n film_id = SqlRunner.run(sql, values)[0]['film_id']\n\n sql = \"SELECT price FROM films WHERE id = $1\"\n values = [film_id]\n price = SqlRunner.run(sql, values)[0]['price'].to_i\n @funds += price\n update()\n\n\n sql = \"SELECT screen_id FROM tickets WHERE id = $1\"\n values = [ticket.id]\n screen_id = SqlRunner.run(sql, values)[0]['screen_id']\n\n sql = \"SELECT tickets_sold FROM screenings WHERE id = $1\"\n values = [screen_id]\n tickets_sold = SqlRunner.run(sql, values)[0]['tickets_sold'].to_i\n tickets_sold -= 1\n sql = \"UPDATE screenings SET tickets_sold = $1 WHERE id = $2\"\n values = [tickets_sold, screen_id]\n SqlRunner.run(sql, values)\n\n\n sql = \"Delete FROM tickets WHERE id = $1\"\n values = [ticket.id]\n SqlRunner.run(sql, values)\n\n end", "def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to tickets_url,\n notice: (crud_notice('destroyed', @ticket) + \"#{undo_link(@ticket)}\").html_safe }\n format.json { head :no_content }\n end\n end", "def destroy\n @ticket.destroy\n redirect_to tickets_url, notice: 'Ticket was successfully destroyed.'\n end", "def destroy\n @ticket.destroy\n\n respond_with(@story, @ticket)\n end", "def destroy\n ticket.destroy!\n render status: :ok, nothing: true\n end", "def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to tickets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to tickets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to tickets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to tickets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to tickets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to tickets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ticket = @project.tickets.find_by_scoped_id!(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to(project_tickets_url(@project)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_tickets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ticket = @event.tickets.find(params[:id])\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to event_tickets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to @ticket.project, notice: 'Ticket deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { \n flash[:notice] = 'La boleta se eliminó satisfactoriamente.'\n redirect_to tickets_path\n }\n format.json { head :no_content }\n end\n end", "def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to(tickets_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to(tickets_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to(tickets_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to(tickets_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to(tickets_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to(tickets_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to(tickets_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @admin_ticket = Ticket.find(params[:id])\n @admin_ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_tickets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ticket_time = TicketTime.find(params[:id])\n @ticket_time.destroy\n\n respond_to do |format|\n format.html { redirect_to(ticket_times_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to admin_tickets_url, notice: 'Ticket delete successfully.' }\n format.json { head :no_content }\n end\n end", "def destroy\n #@ticket = Ticket.find(params[:id])\n #@ticket.destroy\n\n #respond_to do |format|\n # format.html { redirect_to(tickets_url) }\n # format.xml { head :ok }\n #end\n\t\t\n\t\tredirect_to(tickets_url)\n end", "def destroy\n @ticket = Ticket.find(params[:id])\n authorize @ticket\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to tickets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ticket_item.destroy\n respond_to do |format|\n format.html { redirect_to ticket_items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: \"Ticket was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: \"Ticket was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to @ticket.user, notice: \"Permanentka na #{get_ticket_therapies_string @ticket} úspěšně odstraněna\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @ticket = Ticket.find_by(seat: @seat)\n @ticket.destroy\n @seat.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_seats_url, notice: 'Seat was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def ticket_delete(tickets)\n\tsystem(\"clear\")\n prompt = TTY::Prompt.new\n # If the tickets array not empty, proceed with ability to edit the ticket by selecting the index + 1\n if tickets.empty? == false\n delete_selection = prompt.select(\"Choose a ticket to delete:\") do |menu| \n for ticket in tickets\n menu.choice (tickets.index(ticket) + 1)\n end\n end\n else\n # No tickets in array, catch error, and return to loop.\n puts \"No tickets in dashboard. Press 'Enter' to return to menu.\"\n gets\n return\n end\n\ttickets.delete_at(delete_selection.to_i - 1)\nend", "def destroy\n @ticket.update_attribute(:status, 'deleted')\n respond_to do |format|\n format.html do\n flash[:notice] = \"Ticket was destroyed\"\n redirect_to tickets_url\n end\n format.json { head :no_content }\n end\n end", "def destroy\n @ticket_action = TicketAction.find(params[:id])\n @ticket_action.destroy\n\n respond_to do |format|\n format.html { redirect_to(ticket_actions_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n redirect_to @comment.ticket, notice: 'Ticket was successfully created.'\n end", "def remove_ticket(ticket)\n @lockers.unassign(ticket) \n @reservations.delete(ticket.confirmation_number)\n end", "def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: \"The tickey has been closed\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @ticket_detalle.destroy\n respond_to do |format|\n format.html { redirect_to ticket_detalles_url, notice: 'Ticket detalle was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ticket_owner = TicketOwner.find(params[:id])\n @ticket_owner.destroy\n\n respond_to do |format|\n format.html { redirect_to ticket_owners_url }\n format.json { head :no_content }\n end\n end", "def destroy\n url = URI.parse('http://hes.zendesk.com/api/v2/tickets/' + self.id)\n http = Net::HTTP.new(url.host, url.port)\n auth = Base64.encode64(\"#{HesZendesk::AuthUser}:#{HesZendesk::AuthPwd}\")\n req = Net::HTTP::Delete.new(url.path, {\n 'Accept' => 'application/xml',\n 'Authorization' => \"Basic #{auth}\",\n 'Content-Type' => 'application/xml'\n })\n res = http.start { |h| h.request(req) }\n raise res.inspect\n case res\n when Net::HTTPSuccess\n location = res['location'].to_s\n puts location\n return t\n else\n return nil\n end\n end", "def destroy\n begin\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n rescue Exception => e\n #flash[:notice] = e.message\n flash[:notice] = msg_can_not_delete\n end \n respond_to do |format|\n format.html { redirect_to(tickets_url) }\n format.xml { head :ok }\n end \n end", "def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to customer_tickets_url(@ticket.customer), notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = Comment.find_by(id: params[:comment_id])\n @ticket = @comment.ticket\n @comment.destroy\n flash[:success] = \"Comment deleted\"\n\n if ( employee_logged_in? )\n redirect_to @ticket\n else\n redirect_to current_customer\n end\n \n end", "def delete(atom)\n form_data = { atom_id: atom.id }\n @hive_party.post \"/atoms/#{atom.id}/deletions\", form_data\n end", "def delete_todo(db, act_id)\n\tdb.execute(\"DELETE FROM todo WHERE activity_id=?\", [act_id])\nend", "def destroy\n if !check_session #Validate if the user session is active\n return #If not force return to trigger the redirect of the check_session function\n end\n resp = Ticket.find(params[:id],session[:user]) #Retrieve the original ticket object to update\n if resp[0] #Validate if the response was successfull\n @ticket = resp[1] #Set the ticket object to be deleted\n elsif validate_authorized_access(resp[1]) #If the response was unsucessful, validate if it was caused by unauthorized access to the app or expired session\n flash[:danger] = t(:ticket_get_error_flash) #Set the error message for the user\n redirect_to tickets_path(:election_id =>@ticket.election_id) #Redirect the user to the tickets list page\n else\n return #If not force return to trigger the redirect of the check_session function\n end\n resp2 = @ticket.delete(session[:user]) #Delete the ticket object\n if resp2[0] #Validate if the response was successfull\n flash[:success] = t(:ticket_deletion_success_flash, ticket: @ticket.name) #Set the success message for the user\n elsif validate_authorized_access(resp[1]) #If the response was unsucessful, validate if it was caused by unauthorized access to the app or expired session\n flash[:danger] = t(:ticket_deletion_error_flash) #Set the error message for the user\n else\n return #If not force return to trigger the redirect of the check_session function\n end\n redirect_to tickets_path(:election_id =>@ticket.election_id) #Redirect the user to the tickets list page\n rescue #Error Handilng code\n general_error_redirection('Controller: '+params[:controller]+'.'+action_name,$!)\n end", "def destroy\n\t @tickettype = Define.find(params[:id])\n\t @tickettype.destroy\n\t\n\t respond_to do |format|\n\t format.html { redirect_to admin_ticket_types_url }\n\t end\n\tend", "def destroy\n if current_user.id == @ticket.user_id || ProjectUser.verify_role(current_user.id, @project, 'admin')\n @ticket.destroy\n else\n render json: { error: 'You are not authorised' }, status: :unauthorized\n end\n end", "def destroy\n @labticket.destroy\n respond_to do |format|\n format.html { redirect_to labtickets_url, notice: 'Labticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n CONNECTION.execute(\"DELETE FROM truck_parts WHERE id = #{@id};\")\n end", "def destroy\n @ticket_code = TicketCode.find(params[:id])\n @ticket_code.destroy\n\n respond_to do |format|\n format.html { redirect_to ticket_codes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ticket_type = TicketType.find(params[:id])\n @ticket_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(ticket_types_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n set_cancel_status\n @ticket.save\n Account::Tickets::TicketLogs.cancel(@ticket)\n respond_to do |format|\n format.html { redirect_to @last_page, notice: 'Ticket was successfully canceled.' }\n format.json { head :no_content }\n end\n end", "def delete\n CONNECTION.execute(\"DELETE FROM '#{tablename}' WHERE id = ?;\", @id)\n \"Deleted.\"\n end", "def destroy\n @support_ticket = SupportTicket.find(params[:id])\n @support_ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to support_tickets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ticket_item.destroy\n respond_to do |format|\n format.html { redirect_to admin_ticket_items_url, notice: 'Ticket item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n if params[:delete].present?\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n @ticket.payment.destroy\n render :json => { success: \"deleted no ajax\" }\n else\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n @ticket.payment.destroy\n render :json => { success: \"deleted\" }\n end\n end", "def destroy\n @bug_ticket.destroy\n respond_to do |format|\n format.html { redirect_to bug_tickets_url, notice: 'Bug ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n van = @ticket.van\n van.seats_available += 1\n van.save\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to edit_passenger_registration_path, alert: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete field\n\t\tbegin\n\t\t\tticket = read ['id'], field\n\t\t\tif ticket.count > 0\n\t\t\t\t@dbh.query \"DELETE FROM #{@table} WHERE #{field[0]}='#{field[1]}'\"\n\t\t\t\ttrue\n\t\t\telse\n\t\t\t\tfalse\n\t\t\tend\n\t\trescue Mysql::Error => e\n\t\t\tputs \"Error: #{e.error}\"\n\t\t\tnil\n\t\tend\n\tend", "def destroy\n authorize! :destroy, Rezlineitem\n @show = @ticketrez.show\n @ticketrez.destroy\n\n respond_to do |format|\n format.html { redirect_to(@show) }\n format.xml { head :ok }\n end\n end", "def destroy\n @troubleticket.destroy\n respond_to do |format|\n format.html do\n redirect_to troubletickets_url,\n notice: 'Trouble ticket was successfully destroyed.'\n end\n format.json { head :no_content }\n end\n end", "def destroy\n @ticketstate.destroy\n respond_to do |format|\n format.html { redirect_to ticketstates_url, notice: '删除成功' }\n format.json { head :no_content }\n end\n end" ]
[ "0.8144336", "0.77924424", "0.77821", "0.7665984", "0.75117606", "0.7400323", "0.73921573", "0.7350771", "0.72729844", "0.7236232", "0.7213921", "0.72084", "0.70836437", "0.70750093", "0.7021717", "0.7021717", "0.7021717", "0.7021717", "0.7021717", "0.7021717", "0.7016013", "0.69945985", "0.69710743", "0.69538367", "0.6949201", "0.6949201", "0.6949201", "0.6949201", "0.6949201", "0.694905", "0.6944049", "0.69382733", "0.69382733", "0.69382733", "0.69382733", "0.69382733", "0.69382733", "0.69382733", "0.6923247", "0.69220495", "0.6889886", "0.68431884", "0.6760271", "0.6735548", "0.6735548", "0.6735548", "0.6735548", "0.6735548", "0.6735548", "0.6735548", "0.6735548", "0.6735548", "0.6735548", "0.6735548", "0.6735548", "0.6735548", "0.6735548", "0.6735548", "0.6735548", "0.6735548", "0.6735548", "0.6735548", "0.6735548", "0.673274", "0.6718818", "0.6716307", "0.6716307", "0.6712952", "0.67009914", "0.6693109", "0.6692992", "0.6684924", "0.667813", "0.6673934", "0.66639", "0.6661589", "0.6655667", "0.6644032", "0.664309", "0.66334647", "0.6628167", "0.66171426", "0.6609495", "0.6602755", "0.6597006", "0.65966487", "0.65877974", "0.65769863", "0.6572477", "0.65511477", "0.65463823", "0.65397036", "0.6536932", "0.65302014", "0.6518036", "0.6509153", "0.64707017", "0.6468708", "0.64550966", "0.6378662", "0.63702995" ]
0.0
-1
return the film this ticket is for
def film() sql = "SELECT * FROM films WHERE id = $1" values = [@film_id] pg_result = SqlRunner.run(sql, values) film_hash = pg_result[0] film = Film.new(film_hash) return film end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def film()\n sql = \"SELECT * FROM films WHERE id = $1\"\n values = [@film_id]\n film = SqlRunner.run(sql, values).first\n return Film.new(film)\n end", "def film\n sql ='SELECT films.*\n FROM films\n WHERE f_id = $1'\n values = [@fk_film_id]\n film = SqlRunner.run(sql,values).first\n return Film.new(film)\n end", "def films()\n sql = \"SELECT films.* FROM films INNER JOIN tickets ON films.id = tickets.film_id WHERE tickets.cust_id = $1\"\n values = [@id]\n films = SqlRunner.run(sql, values)\n return films.map{|film| Film.new(film)}\n end", "def films\n self.screenings.map do |screening|\n screening.festival.title\n end\n end", "def get_filmId\n \t\tresponse = JSON.parse HTTParty.get(self.url).to_json\n \t\tfilmId = response[\"filmId\"]\n \t\treturn filmId\n \tend", "def find_film\n @film = Film.find(params[:id]) #find a film by id and put it in the instance variable\nend", "def films()\n sql = \"SELECT films.* FROM films INNER JOIN tickets ON tickets.film_id = films.id WHERE customer_id = $1\"\n values = [@id]\n film_data = SqlRunner.run(sql, values)\n return Film.map_items(film_data)\n end", "def films()\n sql = \"SELECT films.* FROM films INNER JOIN tickets ON films.id = tickets.film_id WHERE tickets.customer_id = $1;\"\n values = [@id]\n films = SqlRunner.run(sql, values)\n return films.map{|film| Film.new(film)}\n end", "def films()\n sql = \"SELECT films.* FROM films INNER JOIN tickets ON films.id = tickets.film_id WHERE tickets.customer_id = $1\"\n values = [@id]\n films = SqlRunner.run(sql, values)\n return films.map {|film| Film.new(film)}\n end", "def films()\n sql = \"SELECT films.* FROM films INNER JOIN tickets ON films.id = tickets.film_id WHERE tickets.customer_id = $1\"\n values = [@id]\n films_array = SqlRunner.run(sql, values)\n films = films_array.map { |film_hash| Film.new(film_hash)}\n return films\n end", "def films()\n sql = \"SELECT films.* FROM films\n INNER JOIN tickets ON tickets.film_id = films.id\n WHERE tickets.customer_id = $1\"\n values = [@id]\n film_array = SqlRunner.run(sql, values)\n result = film_array.map { |film| Film.new( film ) }\n return result\n end", "def set_film\n @film = Film.find(params[:id])\n end", "def set_film\n @film = Film.find(params[:id])\n end", "def set_film\n @film = Film.find(params[:id])\n end", "def set_film\n @film = Film.find(params[:id])\n end", "def set_film\n @film = Film.find(params[:id])\n end", "def show\n @person.film_id\n end", "def films()\n sql = \"\n SELECT films.* FROM films\n INNER JOIN tickets ON tickets.film_id =\n films.id WHERE customer_id = $1\n \"\n values = [@id]\n result = SqlRunner.run(sql, values)\n\n return nil if result.count == 0\n return result.map {|film| Film.new(film)}\n end", "def most_popular_screening_film\n most_popular = nil\n unsold_tickets = 2 #max capacity of the cinema\n screenings = return_film_screenings\n screenings.each do |screening|\n if screening.tickets_left.to_i < unsold_tickets\n most_popular = screening\n end\n end\n return most_popular\n end", "def films\n sql = \"SELECT films.*\n FROM films\n INNER JOIN tickets\n ON films.id = tickets.film_id\n WHERE tickets.customer_id = $1\"\n values = [@id]\n SqlRunner.run(sql, values).map { |film_hash| Film.new(film_hash) }\n end", "def movie\n @movie\n end", "def films()\n sql = \"SELECT films.* FROM films INNER JOIN tickets ON\n films.id = tickets.film_id WHERE tickets.customer_id = $1;\"\n values = [@id]\n films = SqlRunner.run(sql, values)\n result = Film.map_films(films)\n end", "def first_movie(films)\n \n return films[0]\nend", "def films()\n sql = \"SELECT DISTINCT films.* FROM films\n INNER JOIN screenings ON films.id = screenings.film_id\n INNER JOIN tickets ON screenings.id = tickets.screening_id\n WHERE tickets.customer_id = $1;\"\n values = [@id]\n films_array = SqlRunner.run(sql, values)\n return Film.map_to_objects(films_array)\n end", "def show\n @film = @festival.films.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @film }\n end\n end", "def set_film\n @film=Film.find(params[:id])\nend", "def retrieve_film_reviews(film_name)\n api_key = ENV['REVIEW_API_KEY']\n @latest_film_data = JSON.parse(self.class.get(\"/svc/movies/v2/reviews/search.json?query=#{film_name}&api-key=#{api_key}\").body)\n end", "def buy_film_ticket(film, screening)\n # Checks if seat available, if so creates ticket, reduces customer's wallet by\n # price of film and returns new ticket.\n\n # #screening = Screening.find_screening(film.id, date, time)\n\n available_seats = screening.check_available_seats()\n\n if available_seats == 0\n return nil\n end\n\n new_ticket = Ticket.new({'customer_id' => @id, 'film_id' => film.id,\n 'screening_id' => screening.id})\n\n new_ticket.save()\n\n #update tickets sold by 1\n\n screening.increase_tickets_sold()\n\n @funds -= film.price\n\n update()\n\n return new_ticket\n end", "def film_title(film)\n film[\"title\"]\nend", "def show_films\n sql = \"SELECT films.* FROM films INNER JOIN screenings ON screenings.film_id = films.id INNER JOIN tickets on screenings.id = tickets.screening_id INNER JOIN customers on customers.id = tickets.customer_id WHERE customers.id = $1\"\n values = [@id]\n result = SqlRunner.run(sql, values)\n return result.map {|film| Film.new(film)}\n end", "def tickets()\n sql = \"SELECT tickets.* FROM films INNER JOIN screenings ON films.id = screenings.film_id INNER JOIN tickets ON screenings.id = tickets.screening_id WHERE film_id = $1;\"\n values = [@id]\n films_hash = SqlRunner.run(sql, values)\n return Film.map_films(films_hash).count\n end", "def tickets()\n return films().count()\n end", "def get_movies_of_specific_character(specific_character_data)\n specific_character_films = specific_character_data.first[\"films\"]\nend", "def film_director(film)\n film[\"director\"]\nend", "def booked_films()\n # sql\n sql = \"SELECT films.* FROM films INNER JOIN tickets ON films.id = tickets.film_id WHERE customer_id = $1;\"\n # values\n values = [@id]\n # sql runner\n results = SqlRunner.run(sql, \"get_all_booked_films\", values)\n # return\n return results.map {|film| Film.new(film)}\n end", "def set_film\n @adminfilm = Film.find(params[:id])\n end", "def customers_for_film()\n sql = \"SELECT name FROM customers\n INNER JOIN tickets ON customers.id = tickets.customer_id\n WHERE film_id = $1 ORDER BY name\"\n values = [@id]\n customer_data = SqlRunner.run(sql, values)\n return Customer.map_items(customer_data)\n end", "def set_film_actor\n @film_actor = FilmActor.find(params[:id])\n end", "def tickets_purchased\n return film().count\n end", "def film_release_date(film)\n film[\"release_date\"]\nend", "def find_story\n @story = Story.friendly.find(params[:id])\n @film = @story.films.new\n @films = @story.films.all\n end", "def popular_time()\n sql = \"SELECT film_time FROM screenings WHERE tickets_sold = (SELECT MAX(tickets_sold) FROM screenings INNER JOIN tickets ON screenings.id = tickets.screen_id WHERE tickets.film_id = $1)\"\n values = [@id]\n popular_time = SqlRunner.run(sql, values)\n return popular_time[0]['film_time']\n end", "def film_time()\n sql =\"SELECT screenings.* FROM screenings WHERE film_id = $1;\"\n values = [@id]\n screening_times = SqlRunner.run(sql, values)\n time_object = Screening.map_items(screening_times)\n return time_object.map {|time| time.screening_time}\n end", "def films\n sql = \"SELECT films.* FROM films\n INNER JOIN tickets\n ON tickets.film_id = films.id\n WHERE tickets.customer_id = $1\"\n values = [@id]\n films = SqlRunner.run(sql, values)\n return films.map{|film| Film.new(film)}\nend", "def get_movie(actor=\"Brad Pitt\")\n movie_count = show_movies(actor).size\n show_movies(actor)[rand(movie_count)]\n end", "def show\n\t\t@adminfilm = Film.find(params[:id])\n \t@reviewAmount = Filmreview.where(film_id: @adminfilm).count\n\tend", "def showtimes(movie)\n self.showings.select do |showing|\n showing.movie == movie\n end\n end", "def show\n @screening = @film.screenings.find(params[:id], :include => [:venue, :film, :festival])\n\n show_press = (current_user && current_user\\\n .subscription_for(@festival)\\\n .try(:show_press)) || false\n @other_screenings = @film.screenings.reject do |s|\n (s == @screening) || (s.press && !show_press)\n end\n @earlier_screenings, @later_screenings = @other_screenings.partition {|s| s.starts < @screening.starts }\n \n @pick = (@film.picks.find_by_user_id(current_user.id) \\\n || current_user.picks.new(:film_id => @film.id)) \\\n if logged_in?\n respond_to do |format|\n format.html {\n # We tag screenings in exported iCal calendars with a URL that points\n # here; just redirect to the festival schedule for now.\n redirect_to festival_path(@festival) and return\n }\n format.js\n format.xml { render :xml => @screening }\n end\n end", "def tickets()\n sql = \"SELECT * FROM tickets WHERE film_id = $1;\"\n values = [@id]\n tickets = SqlRunner.run(sql, values)\n return Ticket.map_items(tickets).count\n end", "def booked_films()\n sql = \"SELECT films.* FROM films\n INNER JOIN screenings\n\t ON films.id = screenings.film_id\n INNER JOIN tickets\n ON screenings.id = tickets.screening_id\n WHERE tickets.customer_id = $1\n ORDER BY films.id;\"\n values = [@id]\n result = SqlRunner.run(sql, values) # array of hashes.\n booked_films = result.map { |film| Film.new(film) }\n return booked_films.uniq # no duplicates.\n end", "def movie\n Movie.find_by(:id => movie_id)\n end", "def show(time)\n parameter = SCHEDULE.find { |key, val| val if key.include?(time) }\n raise ArgumentError, 'There are no films to watch at this time. Sorry.' unless parameter\n films = filter(parameter[1])\n to_watch = get_rnd_film(films)\n puts \"Now showing: \\\"#{to_watch.title}\\\", #{to_watch.genre * ', '}, \\\nduration: #{to_watch.duration} min.\"\n to_watch\n end", "def best_movies\n doc.search('#BestFilmList a').map(&:text)\n end", "def movie_name\n self.movie.name\n \n end", "def first_movie\n doc.search(\"a[title='Первый фильм']\").text\n end", "def get_film_urls(character)\n character_hash = look_up('http://www.swapi.co/api/people/')\n film_urls = character_hash[\"results\"].find do |element|\n element[\"name\"].downcase == character\n end[\"films\"]\nend", "def buy_tickets(film)\n if @funds >= film.price\n @funds -= film.price\n return @funds\n else\n return \"Insufficient funds!\"\n end\n end", "def films_customer_sees()\n sql = \"SELECT * FROM films INNER JOIN tickets\n ON films.id = tickets.film_id WHERE customer_id = $1\"\n values = [@id]\n films = SqlRunner.run(sql, values)\n result = films.map {|film_hash| Film.new(film_hash)}\n return result\nend", "def parse_character_movies(character)\n get_character_movies_from_api(character).collect do |film_name|\n film_resp_string = RestClient.get(film_name)\n JSON.parse(film_resp_string)\n end \n response_hash[\"results\"].each do |hash|\n if character == hash[\"name\"]\n desired_films = hash[\"films\"]\n end\nend\n desired_films\nend", "def show\n @film = Film.published.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @film }\n end\n end", "def buy_ticket(film_to_see, screen)\n if (@funds >= film_to_see.price) && (screen.tickets_sold < screen.tickets_limit) # Limit the available tickets for screenings.\n new_ticket = Ticket.new({'cust_id' => @id, 'film_id' => film_to_see.id, 'screen_id' => screen.id})\n new_ticket.save()\n @funds -= film_to_see.price\n update()\n screen.tickets_sold += 1 #count of tickets sold of particular screen\n screen.update()\n return new_ticket\n end\n return nil\n end", "def find_by_action(id)\n user.film_actions.where(action: id)\n end", "def count_tickets()\n sql = \"SELECT films.* FROM films\n INNER JOIN tickets ON\n tickets.film_id = films.id\n WHERE customer_id = $1\"\n values = [@id]\n films = SqlRunner.run(sql, values)\n result = films.map{|film| Film.new(film)}\n return result.count\n end", "def film_episode(film)\n film[\"episode_id\"].to_s\nend", "def film_dev_info()\n return @film_dev_info unless @film_dev_info.nil?\n @film_dev_info = @images.first.machine_tags =~ /filmdev:recipe=([0-9]+)/ ? \"<span class='small'><a href='http://filmdev.org/recipe/show/#{$~[1]}'>development receipe #{$~[1]}</a></span>\" : \"\"\n end", "def title\n \tobject.movie_name\n end", "def set_filmmaker\n @filmmaker = Filmmaker.find(params[:id])\n end", "def film_params\n params.require(:film).permit(:title, :director, :year, :synopsis, :runtime, :image, :favorited, :default, :watched, :default, :notes)\n end", "def name_of_person_of_ticket\n self.viewer.name\n \n end", "def show\n @page_title = @recommendation.movie.title\n end", "def when?(movie_name)\n movie = all.find do |val|\n val.title == movie_name\n end\n raise ArgumentError, \"We could not find the \\\"#{movie}\\\" in our collection\" unless movie\n time = SCHEDULE.find do |key, val|\n key if movie.matches?(val.to_a.flatten[0], val.to_a.flatten[1])\n end\n raise ArgumentError, \"You cannot watch \\\"#{movie.title}\\\" in our theatre, \\\nit does not match our schedule filters.\" unless time\n puts \"#{movie_name}. You can watch it at #{time[0].first}:00 - #{time[0].last}:00\"\n time[0]\n end", "def index\n @film_actors = FilmActor.all\n end", "def find_films(character)\n target = find_character(character) #hash\n if target == nil\n return \"Please enter correct character name.\"\n else\n films_of_character = target[\"films\"]#an array of movies URLs\n end\nend", "def rented_movies\n end", "def set_theatre_movie\n @theatre_movie = TheatreMovie.find(params[:id])\n end", "def set_film_category\n @film_category = FilmCategory.find(params[:id])\n end", "def show_character_movies(character)\n urls_of_films = get_character_movies_from_api(character)\n films_hash = add_film_urls(urls_of_films)\n parse_character_movies(films_hash)\nend", "def edit\n\t\t@adminfilm = Film.find(params[:id])\n\tend", "def film_params\n params.require(:film).permit(:tittle, :synopsis, :image, :startDay, :endDate)\n end", "def on_the_big_screen\n Movie.all.select{ |movie| movie.title == self.title }\n end", "def ticket_count()\n return self.booked_films.count\n end", "def movies\n CharacterMovieActing.all.filter do |cma|\n cma.character == self\n end.map do |cm|\n cm.movie\n end\n end", "def index\n @filmmakers = Filmmaker.all\n end", "def rent(movie)\n end", "def print_movies(films)\n films.each do |film|\n puts film[\"title\"]\n end\nend", "def movies\n char_movies = Char_Movie.all.select{ |char_movie| char_movie.character.actor == self}\n char_movies.collect{ |char_movie| char_movie.movie }\n end", "def by_movie_quick(movie_id)\n\t \tby_movie(movie_id).first(7)\n\t end", "def find_films_for_each_customer()\n sql = \"SELECT films.*\n FROM films\n INNER JOIN tickets\n ON tickets.film_id = films.id\n WHERE customer_id = $1\"\n values = [@id]\n films = SqlRunner.run(sql, values)\n result = films.map {|film| Film.new(film)}\n return result\n end", "def recommended_movies\n details.css('.rec-title').reject do |node|\n # reject movies that don't have a release year yet\n node.at('span').nil?\n end.reject do |node|\n # reject everything other than featured film\n /\\d{4}-\\d{4}/.match(node.at('span').text) ||\n /Series|Episode|Video|Documentary|Movie|Special|Short|Game|Unknown/.match(node.at('span').text)\n end.map do |node|\n imdb_id = node.at(\"a[href^='/title/tt']\")['href'].parse_imdb_id\n title = node.at('a').text.strip\n year = node.at('span').text.parse_year\n\n [imdb_id, title, year]\n end.map do |values|\n Spotlite::Movie.new(*values)\n end\n end", "def actors\n Actor.where(:movie_id => id)\n end", "def film_params\n params.require(:film).permit(:title, :premiere, :duration, :description, :search, genre_ids: [], director_ids: [], screenwriter_ids: [], origin_ids: [])\n end", "def create\n # render text: params\n # render text: params[:film]\n @film = Film.new(film_params)\n # @film.cast_ids = params[:film][:cast_ids] # force to call\n # @film.writer_ids = params[:film][:writer_ids] # methods _ids\n # @film.director_ids = params[:film][:director_ids] # for new records\n # As tres atribuicoes acima sao para forcar a chamada aos respectivos meto-\n # dos que nao estavam sendo chamados quando da criacao de novos filmes.\n\n # render inline: \"<%= @film.production_team.inspect %>\"\n respond_to do |format|\n if @film.save\n format.html { redirect_to @film, notice: 'Filme criado com sucesso.' }\n format.json { render action: 'show', status: :created, location: @film }\n else\n format.html { render action: 'new' }\n format.json { render json: @film.errors, status: :unprocessable_entity }\n end\n end\n end", "def movie; end", "def index\n @films = current_user.films.order(\"seen DESC\")\n @new_film = current_user.films.new\n end", "def film_params\n params.require(:film).permit(:title, :brazilian_title, :release, :synopse, :poster, :genre,\n :cast_ids, :writer_ids, :director_ids, :poster_cache, :country_id, :length, :remove_poster)\n end", "def top_review_movie\n @top_movie = Movie.where(:kind => \"a\").order(\"plays desc\").page\n end", "def how_many_films()\n sql = \"SELECT films.* FROM films INNER JOIN tickets ON\n films.id = tickets.film_id WHERE tickets.customer_id = $1;\"\n values = [@id]\n films = SqlRunner.run(sql, values)\n result = Film.map_films(films).count\n end", "def last_movie\n doc.search(\"a[title='Последний фильм']\").text\n end", "def index\n @films = Film.all\n end", "def show\r\n @movie = session[:movies][params[:id].to_i]\r\n end" ]
[ "0.7123806", "0.672053", "0.66696143", "0.6593509", "0.65752465", "0.65594864", "0.653462", "0.64463824", "0.64386255", "0.64127856", "0.6391474", "0.63549435", "0.63549435", "0.63549435", "0.63549435", "0.63549435", "0.6325068", "0.63173324", "0.62750566", "0.6272012", "0.62484336", "0.623753", "0.62082654", "0.6163356", "0.61342", "0.60932624", "0.6047693", "0.6033481", "0.6016085", "0.5980065", "0.5942065", "0.58893234", "0.58659834", "0.5865261", "0.58585054", "0.5782203", "0.5773709", "0.5767316", "0.5760495", "0.5742393", "0.57379943", "0.57296044", "0.56956804", "0.56763166", "0.567076", "0.5658002", "0.56553227", "0.5636512", "0.5633185", "0.5628683", "0.56240875", "0.5586578", "0.5572744", "0.5562426", "0.5553509", "0.55423677", "0.5541455", "0.5518623", "0.5489511", "0.5475767", "0.54748946", "0.5455731", "0.5438863", "0.5438008", "0.54366225", "0.54162365", "0.54093546", "0.5378777", "0.536857", "0.534738", "0.53440577", "0.53427994", "0.53382826", "0.5336853", "0.53344935", "0.53308856", "0.5326365", "0.5294569", "0.5285915", "0.5283816", "0.52830946", "0.5279756", "0.52796525", "0.5276969", "0.5268922", "0.52597994", "0.52595246", "0.525473", "0.52516615", "0.5250529", "0.52471215", "0.52348083", "0.52334857", "0.5228531", "0.5223574", "0.5219632", "0.5217856", "0.521342", "0.5209969", "0.52005434" ]
0.61261255
25
return the screening a ticket is for
def screening() sql = "SELECT * FROM screenings WHERE id = $1" values = [@screening_id] pg_result = SqlRunner.run(sql, values) screening_hash = pg_result[0] screening = Screening.new(screening_hash) return screening end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def screen\n if $game_temp.in_battle\n return $game_troop.screen\n else\n return $game_map.screen\n end\n end", "def screening?\n self.tip == \"screening\"\n end", "def most_popular_screening_film\n most_popular = nil\n unsold_tickets = 2 #max capacity of the cinema\n screenings = return_film_screenings\n screenings.each do |screening|\n if screening.tickets_left.to_i < unsold_tickets\n most_popular = screening\n end\n end\n return most_popular\n end", "def name_of_person_of_ticket\n self.viewer.name\n \n end", "def screen\r\n $game_party.in_battle ? $game_troop.screen : $game_map.screen\r\n end", "def screenings()\n sql = \"SELECT DISTINCT screenings.* FROM screenings\n INNER JOIN tickets\n ON screenings.id = tickets.screening_id\n WHERE tickets.customer_id = $1;\"\n values = [@id]\n screenings_array = SqlRunner.run(sql, values)\n return Screening.map_to_objects(screenings_array)\n end", "def all_screenings\n @all_screenings ||= festival.screenings_visible_to(user)\n end", "def ticket_summary(ticket)\n summary = [ ticket.category.blank? ? t(:other) : t(ticket.category) ]\n if @view != \"completed\"\n if @view == \"pending\" && ticket.user != current_user\n summary << t(:ticket_from, ticket.user.full_name)\n elsif @view == \"assigned\"\n summary << t(:ticket_from, ticket.assignee.full_name)\n end\n summary << \"#{t(:related)} #{ticket.asset.name} (#{ticket.asset_type.downcase})\" if ticket.asset_id?\n summary << if ticket.bucket == \"due_asap\"\n t(:ticket_due_now)\n elsif ticket.bucket == \"due_later\"\n t(:ticket_due_later)\n else\n l(ticket.due_at.localtime, :format => :mmddhhss)\n end\n else # completed\n summary << \"#{t(:related)} #{ticket.asset.name} (#{ticket.asset_type.downcase})\" if ticket.asset_id?\n summary << t(:ticket_completed_by,\n :time_ago => distance_of_time_in_words(ticket.completed_at, Time.now),\n :date => l(ticket.completed_at.localtime, :format => :mmddhhss),\n :user => ticket.completor.full_name)\n end\n summary.join(', ')\n end", "def tickets_per_screening()\n sql = \"SELECT t.* FROM tickets t INNER JOIN films f ON t.film_id=f.id INNER JOIN screenings s ON s.film_id=f.id WHERE s.id = #{@id};\"\n shows_array = SqlRunner.run(sql)\n result = shows_array.map {|show| Screening.new(show)}\n fin_result = result.length()\n return fin_result\n end", "def display_resource(ticket_type)\n \"#{ticket_type.name}\"\n end", "def screenings()\n sql = \"SELECT screenings.*\n FROM screenings\n INNER JOIN tickets\n ON screenings.id = tickets.screening_id\n WHERE tickets.customer_id = $1\"\n values = [@id]\n results = SqlRunner.run(sql, values)\n return nil if results.count == 0\n found_screenings = results.map{|film| Screening.new(film)}\n return found_screenings\n\n end", "def to_s\n screen_name\n end", "def display_resource(ticket_sla)\n \"TicketSla ##{ticket_sla.id}\"\n end", "def ticket\n @ticket ||= @api.get_ticket['ticket']\n end", "def show\n @screening = @film.screenings.find(params[:id], :include => [:venue, :film, :festival])\n\n show_press = (current_user && current_user\\\n .subscription_for(@festival)\\\n .try(:show_press)) || false\n @other_screenings = @film.screenings.reject do |s|\n (s == @screening) || (s.press && !show_press)\n end\n @earlier_screenings, @later_screenings = @other_screenings.partition {|s| s.starts < @screening.starts }\n \n @pick = (@film.picks.find_by_user_id(current_user.id) \\\n || current_user.picks.new(:film_id => @film.id)) \\\n if logged_in?\n respond_to do |format|\n format.html {\n # We tag screenings in exported iCal calendars with a URL that points\n # here; just redirect to the festival schedule for now.\n redirect_to festival_path(@festival) and return\n }\n format.js\n format.xml { render :xml => @screening }\n end\n end", "def people_on_current_floor()\n floors = @building.floors\n curr_floor = floors[@current_floor]\n wanting_up = curr_floor.up_person_queue\n wanting_down = curr_floor.down_person_queue\n if wanting_up.size() == 0 && wanting_down.size() == 0\n return \"stationary\"\n elsif wanting_up.size() > wanting_down.size()\n return \"up\"\n else # there are more or as many ppl wanting to go down\n return \"down\"\n end\n end", "def screen_name\n TWITTER_CLIENT.user(uid.to_i).screen_name\n end", "def screen\n return $game_map.screen\n end", "def screen_y\n return $data_troops[@troop_id].members[@member_index].y\n end", "def tickets_bought()\n tickets_array = films()\n number_of_tickets = tickets_array.count\n return \"#{@name} has bought #{number_of_tickets} tickets.\"\n end", "def screen\n BubbleWrap::Device::Screen\n end", "def show_ticket\n end", "def show\n @diagnostic = @ticket.diagnostics.new\n @diagnostics = @ticket.diagnostics\n #@issues = @ticket.issues\n @client = @ticket.client.id\n @computers = @ticket.computers\n #@computer - @ticket.computers\n \n end", "def get_screen_name\n @screen_name ||= self.verify_credentials.screen_name\n end", "def screen_name(name)\n find :screen_name => name\n end", "def screen_x\n return $data_troops[@troop_id].members[@member_index].x\n end", "def get_TicketStatus()\n \t return @outputs[\"TicketStatus\"]\n \tend", "def ticket_css_class(ticket)\n return 'ticket-closed' if ticket.closed?\n return 'ticket-in-progress' if ticket.in_progress?\n return nil\n end", "def first_screen\n # print \"frst: \" + id.to_s + \" - \" + title + \"\\n\"\n return screens.first if !screens.empty?\n next_screen\n end", "def ticket_status(ticket)\n I18n.t(\"tickets.status.#{ticket.status_name}\")\n end", "def show_ticket(ticket)\n puts \"-\"*80\n puts \"Estamos muy felices de que hayas reservado con nosotros!!!\"\n puts \"-\"*80\n puts \n puts \"El costo total es de $ #{ticket[0]} pesos\"\n booking = ticket[1]\n puts \"Y tu ID de reservación es la siguiente: #{booking.id} \"\n puts \"-\"*80\n end", "def byline\n return \"ticket owner\" if self.show_generic?\n parens = self.support_response? ? \" (volunteer)\" : \"\"\n self.support_identity.name + parens\n end", "def show\n # Get the current user\n @user = User.find(current_user.id)\n # Define arrays to hold open and closed tickets\n @open_tickets = []\n @closed_tickets = []\n # For each request the person has made:\n @user.help_requests.each do |request|\n # If the request is open...\n if request.open?\n # ...add it to the array of open tickets\n @open_tickets << request\n # Else if the ticket is closed...\n elsif !request.open?\n # Add it to the list of closed tickets\n @closed_tickets << request\n end\n end\n end", "def acquired_by_printer\n return @acquired_by_printer\n end", "def ticket\n case eventable_class\n when \"Ticket\"\n Ticket.get(eventable_id)\n when \"TicketUpdate\"\n TicketUpdate.get(eventable_id).ticket\n when \"Milestone\"\n Milestone.get(eventable_id)\n end\n end", "def get_current_issue\r\n cover_page = @agent.get \"http://www.economist.com/printedition\"\r\n get_issue_from_cover_page(cover_page)\r\n end", "def screen_method\n \"\" # choose from all three methods (VTCPay, Credit, Bank)\n end", "def screen_location\n ((@cr[5] ^ 0x80) & 0x80) << 8 | (@cr[5] & 0x70) << 6 | (@cr[2] & 0x80) << 2\n end", "def board_ticket_type\n\t\t\t\t\tif RicBoard.board_ticket_types.include?(self.key.to_sym)\n\t\t\t\t\t\treturn RicBoard.board_ticket_types[self.key.to_sym]\n\t\t\t\t\telse\n\t\t\t\t\t\traise \"Key `#{key}` not found in RicBoard.board_ticket_types configuration.\"\n\t\t\t\t\tend\n\t\t\t\tend", "def get_ScreenName()\n \t return @outputs[\"ScreenName\"]\n \tend", "def ticket\n end", "def screens\n @screens.keys.each {|screen| @logger.unknown(screen)}\n end", "def ticket_type\n\t @ticket_type = EventTicketType.where(:event_id => id)\n end", "def get_screen_config\n screens = @form.get_form_config.select do |screen|\n screen['screen'] == @name\n end\n\n unless screens.size == 1\n raise \"Invalid results when looking for screen '#{ @name }'\"\n end\n\n screens[0]\n end", "def last_tickect_current_user\n Ticket.where(:user_id => current_user).last # retorna el objeto del ultimo ticket del current_user\n end", "def overall_tickets\n\n end", "def onboarding_type\n return :startup if entrepreneur?\n return :mentor if mentor?\n return :investor if investor?\n return nil\n end", "def closer\n\t\t# only look for closer if ticket was closed\n\t\tif self.status == 'Closed'\n\t\t\tself.user_closer.username rescue 'Ticket has no closer!'\n\t\telse\n\t\t\t'Ticket has not been closed!'\n\t\tend\n\tend", "def film_dev_info()\n return @film_dev_info unless @film_dev_info.nil?\n @film_dev_info = @images.first.machine_tags =~ /filmdev:recipe=([0-9]+)/ ? \"<span class='small'><a href='http://filmdev.org/recipe/show/#{$~[1]}'>development receipe #{$~[1]}</a></span>\" : \"\"\n end", "def tickets()\n sql = \"SELECT tickets.* FROM films INNER JOIN screenings ON films.id = screenings.film_id INNER JOIN tickets ON screenings.id = tickets.screening_id WHERE film_id = $1;\"\n values = [@id]\n films_hash = SqlRunner.run(sql, values)\n return Film.map_films(films_hash).count\n end", "def current_screen\n @sequence[@pointer]\n end", "def details\n\t\treturn @feature + \". \" + @real_shake.details\n\tend", "def welcome_screen\n @attributes[:welcome_screen]\n end", "def show\n @tickets_count = Helpdesk::Ticket.where(:requester_id => helpdesk_user.id).active.count\n @ticket = Helpdesk::Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket }\n end\n end", "def dname\n\t return screen_name\n\tend", "def getDetails id\n\t\tticket = @tickets.read ['id', 'pid', 'title', 'description', 'tracker', 'creator', 'created', 'status'], ['id', id]\n\t\tticket = ticket[0]\n\tend", "def capacity_check(film)\n if film.num_customers_in_film < @capacity\n return \"tickets available\"\n else\n return \"this showing is full\"\n end\n end", "def ticket_category\n ticket.category if ticket\n end", "def owner\n\t\tself.user.username rescue 'Ticket has no owner!'\n\tend", "def review_mode\n if chronos_capacity_volume == 0\n \"paused\"\n elsif review_mail_recurrency\n \"mail\"\n else\n \"no_mail\"\n end\n end", "def show\n @shelter = Shelter.find(params[:id])\n @user = @shelter.user\n @mailbox ||= current_user.mailbox\n end", "def report\n (@state.first || NO_ROBOT_PLACED).to_s\n end", "def screening_data_count\n\t\tscreening_data.count\n\tend", "def current_user_screen_name\n session[:user_info][\"nickname\"]\n end", "def show\n if !(current_user.id==params[:id] || current_user.admin)\n flash[:warning] = \"You don't have permission to see this.\"\n redirect_to \"/\"\n end\n @renter = Renter.find(params[:id])\n if session[:logged_in]\n if Ticket.exists?(renterID: session[:renter_id])\n @tickets = Ticket.where(renterID: session[:renter_id]).order(checkout: :desc).reorder(active: :desc)\n @tickets = Kaminari.paginate_array(@tickets).page(params[:ticket_page]).per(3)\n else\n @tickets = nil\n end\n end\n end", "def show\n Labtech.get_token\n @last_ticket = Labtech.last_labticket\n end", "def screen_name\n name || nickname\n end", "def login_ticket\n LoginTicket\n end", "def report_lister\n \"Name: #{@name}\\nGuest type: #{@type}\\nLinks: #{@link}\\nRooms booked: #{@rooms.size}\"\n # \"Report run on: \" + Time.now.to_s\n end", "def films\n self.screenings.map do |screening|\n screening.festival.title\n end\n end", "def collector_and_number\n return user.legal_name if collection_numbers.empty?\n\n collection_numbers.first.format_name\n end", "def retrieve_ticket\n resp = HTTParty.get('https://localhost/identity/restv1/api/v1/groups')\n\n resp.headers['www-authenticate']\n .split(', ')\n .find { |e| e =~ %r{^ticket} }\n .split('=')[1]\n end", "def show\n\t\t@tickets = @prospect.tickets.desc(:event_date)\n\t\t@prospect_member = @prospect.prospect_member\n\t\t@ticket = Ticket.new \n\tend", "def getAssigned uid\n\t\t@tickets.read ['id', 'pid', 'title', 'tracker', 'status'], ['assigned', uid], nil, nil, Hash[\"status\" => \"closed\"]\n\tend", "def show\n @ticket_details = @ticket.ticket_details\n end", "def scheduled_fight_details\n number_of_fights.each_with_index do|fight, index|\n puts \"----------------------------\".red + \"#{\"BOXING SCHEDULES\".blue}\" + \"------------------------------------------------\".red\n puts \"Fight ##{index+1}\".red\n puts \"Fight Channel & Location: #{fight.channel_location}\"\n puts \"Fight Time: #{fight.fight_time}\"\n puts \"Fighter Names: #{fight.fighter_names}\"\n puts \"All Fight Details: #{fight.fight_details.gsub(\"More Details\", \"\")}\"\n puts \"Fight Link:\" + \"#{fight.fight_url}\".yellow\n puts \"--------------------------------------------------------------------------------------------\".red\n end\n end", "def screens\n @screens ||= {\n :fatal => [],\n :error => [],\n :warn => []\n }\n end", "def user_tweets screen_name\n\t\tTwitter.user_timeline(screen_name.to_s)\n\tend", "def scoped_tickets\n return @sprint.assigned_tickets if @sprint\n return @project.tickets if @project\n end", "def get_screen_name(t = @access_token)\n return unless @screen_name.nil?\n return if t.nil?\n\n oauth_response = t.get('/1.1/account/verify_credentials.json')\n @screen_name = JSON.parse(oauth_response.body)[\"screen_name\"]\n end", "def take_ride\n if low_tickets && too_short\n \"Sorry. You do not have enough tickets to ride the #{self.attraction.name}. \" + \"You are not tall enough to ride the #{self.attraction.name}.\"\n elsif low_tickets\n \"Sorry. You do not have enough tickets to ride the #{self.attraction.name}.\"\n elsif too_short\n \"Sorry. You are not tall enough to ride the #{self.attraction.name}.\"\n else\n ride\n \"Thanks for riding the #{self.attraction.name}!\"\n end\n end", "def screen_is_on?\n dpms_screen_is_on?\n end", "def ticket_icons\n find_all(document, :future_ticket_icon) + find_all(document, :ticket_icon) + find_all(document, :soldout_ticket_icon)\n end", "def ticket_count\n self.user.tickets < self.attraction.tickets\n end", "def details\n \"This Oreo Cookie has #{filling_type} Filling Type and #{sugar}g of sugar and #{butter}g of butter\"\n end", "def css_classes\n s = \"meeting status-#{status}\"\n s << ' created-by-me' if User.current.logged? && author_id == User.current.id\n s\n end", "def get_ticket_details( session_key, ticket_id)\n response_xml = self.call( :get_ticket_details, message: {\n api_key: session_key,\n ticket: ticket_id\n })\n response = IssueCentre::Response.parse( response_xml)\n end", "def display_resource(team)\n team.name\n end", "def show\r\n # @ticket = Contact::Ticket.find_by_uuid(params[:id])\r\n raise UnknowsAction\r\n end", "def determine_winner\n \tif self.won?(@player_symbol) then\n \t\t@over = true\n \treturn \"Player\" \n \tend\n \tif self.won?(@computer_symbol) then\n \t\t@over = true\n \t return \"Computer\" \n \tend\n \tif self.open_spots.count == 0 then\n \t\t@over = true\n \t\treturn \"Draw\"\n \tend\n return \"\" \n end", "def diagnostics\n theater_location = MovieTickets::TheaterLocation.scour(5902, true)\n movie_id = theater_location.first_movie_id\n theater_sources = MovieTickets::MovieSource.scour(postal_code: 73142, date: Date.current, movie_id: movie_id)\n raise \"AMC not selling #{movie_id}\" unless theater_sources.map(&:external_id).include?('5902')\n end", "def self_auditor(section)\n \n auditor = self.audit_teammates.detect { |tmate| tmate.section_id == section.id && tmate.self? }\n\n if auditor\n auditor.user\n elsif self.design.designer_id > 0 \n self.design.designer\n else\n nil\n end\n \n end", "def show_ticket_details(ticket_id)\n url = \"https://alanli1.zendesk.com/api/v2/tickets/#{ticket_id}.json\"\n\n res = ApiHelper.make_req_to_api(url)\n @ticket = find_ticket_details(res)\n @ticket.requester_name = get_user_name(@ticket.requester_id)\n return @ticket\n end", "def ticket_dashboard\n @user = User.first \n @ticket = Ticket.find_by(id: params[:id])\n end", "def usr_disp\n case\n when current_user.present?\n {:acct_type => \"Permanent Account\", :name_or_email => current_user.email }\n when session[:usr].present?\n {:acct_type => \"2 Month Account\", :name_or_email => session[:usr] }\n else\n {:acct_type => \"2 Month Account\", :name_or_email => 'Guest' }\n end\n end", "def screen_name\n controller_name = t(\"controllers.#{params[:controller]}\").upcase\n action_name = t(\"actions.controllers.#{params[:action]}\").upcase\n \"#{controller_name} / #{action_name}\"\n end", "def index\n @supports = Foswipe::User.agents \n #@tickets = current_user.tickets if current_user.agent?\n end", "def screen_x\n unless Layy_Meta.active\n return screen_x_mgc_lm_gtbs\n else\n return @actor.lm_x\n end\n end", "def sprint?\n self.milestone_type == 'Sprint'\n end", "def tickets\n Ticket.all.select do |ticket|\n ticket.event == self\n end\n end" ]
[ "0.6145317", "0.6100488", "0.60194844", "0.5942157", "0.5908259", "0.58549714", "0.5834012", "0.579468", "0.5758781", "0.5714734", "0.5695654", "0.5628547", "0.55884475", "0.55547065", "0.5541342", "0.5538755", "0.55246496", "0.5488587", "0.5460648", "0.54376644", "0.5408142", "0.5391781", "0.539074", "0.53856903", "0.5385598", "0.53649676", "0.5363122", "0.53435034", "0.5338688", "0.5293278", "0.5282558", "0.5281084", "0.5270486", "0.5248876", "0.5242459", "0.52197975", "0.5213482", "0.5208659", "0.5206049", "0.5200054", "0.5195608", "0.51897883", "0.5177231", "0.5162014", "0.5144739", "0.5142449", "0.5122257", "0.5121229", "0.5081088", "0.5078059", "0.5070118", "0.50586617", "0.5048439", "0.50460166", "0.50392324", "0.50382555", "0.5036593", "0.5032203", "0.50261664", "0.50044", "0.49970585", "0.49956807", "0.49905485", "0.4987758", "0.49852318", "0.49828228", "0.49824157", "0.49818462", "0.49801552", "0.49761635", "0.49750975", "0.4969171", "0.49672085", "0.49614722", "0.49579406", "0.49462003", "0.4943198", "0.49411646", "0.49401134", "0.4937199", "0.4935984", "0.49294385", "0.49209848", "0.48961344", "0.4895831", "0.48889565", "0.48759264", "0.48751613", "0.48637676", "0.48581153", "0.48538873", "0.48528203", "0.48518872", "0.4851343", "0.48473617", "0.48423696", "0.484236", "0.48416343", "0.48387167", "0.4830836" ]
0.48398176
98
return the customer who bought this ticket
def customer() sql = "SELECT * FROM customers WHERE id = $1" values = [@customer_id] pg_result = SqlRunner.run(sql, values) customer_hash = pg_result[0] customer = Customer.new(customer_hash) return customer end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def customer\n self.user\n end", "def current_customer(unit)\n customers.at(unit).first\n end", "def customer_info(customer)\n return customer\n end", "def current_customer\n Customer.find_by({ id: session[:customer_id] })\n end", "def current_user\n current_customer\n end", "def customer\n @customer ||= fetcher.get(Customer, customer_id)\n end", "def customer() #in the tickets (join) table so we can grab customer_id easily, the _id's are already bundled in this table\n sql = \"SELECT * FROM customers WHERE id = $1\"\n values = [@customer_id]\n customer = SqlRunner.run(sql, values).first\n return Customer.new(customer)\n end", "def customer_id\n return @customer_id\n end", "def customer_order\n @customer_order\n end", "def customer\n self.customer\n end", "def get_customer_id\n return @customer_id\n end", "def buyer\n user\n end", "def customer(customer)\n self.all.select {|rev| rev.customer == customer}\n end", "def find_customer\n @customer = OrderUser.find_by_id(session[:customer])\n end", "def customer_name\n customer.name\n end", "def customer_id\n @booking_profile.try(:external_user_id)\n end", "def as_chargebee_customer\n ChargeBee::Customer.retrieve(chargebee_id).customer\n end", "def find_customer\n #TODO:how does stripe_token get assigned to user?\n if @user.stripe_token\n retrieve_customer \n else\n create_customer\n end\n end", "def current_customer\n \treturn unless session[:user_id]\n \t@current_customer ||= Customer.find_by_id(session[:user_id])\n end", "def show\n @created_user = User.find(@purchase.added_by)\n end", "def current_subscription(customer)\n customer.subscriptions.first\n end", "def current_customer\n Customer.find(session[:customer_id])\n rescue ActiveRecord::RecordNotFound\n customer = Customer.first\n session[:customer_id] = customer.id\n customer\n end", "def customer(customer_id)\n perform_get_request(\"/customer/#{customer_id}\")\n end", "def current_customer\n if session[:customer_id]\n @current_customer ||= Customer.find_by(id: session[:customer_id])\n end\n end", "def buyer\n # the user posting the request\n offer.posting.user\n end", "def customer_id\n @row[\"購入者 顧客ID\"].to_s\n end", "def customer_id\n customer.id\n end", "def customer\n @customer ||= Customer.new(value_for('customer'))\n end", "def payment_customer_email\n\t\t\t\t\treturn self.customer_email\n\t\t\t\tend", "def customer(id)\n response = get(\"customers/#{id}\")\n response.customer\n end", "def customer(q)\n Customer.find(self, q)\n end", "def customer(customer)\n id = epages_id(customer)\n perform_get_with_object(\"/customers/#{id}\", {}, Epages::Customer)\n end", "def id\n customer_id\n end", "def current_customer\n fail AuthRequired unless authed?\n @current_customer ||= get(Customer)\n end", "def customer(customer_id)\n client.get \"customers/#{inst_id}/#{customer_id}\"\n end", "def bought_by\n Tee.where(\"shirt_id = #{self.shirt_id}\").collect(&:who).uniq\n end", "def customer_id\n params['customer_id']\n end", "def customers\n self.customers\n end", "def current_customer\n\t\tif session[:customer_id]\n\t\t\t@current_customer ||= Customer.find_by(id: session[:customer_id])\n\t\telsif cookies.signed[:customer_id]\n\t\t\tcustomer = Customer.find_by(id: cookies.signed[:customer_id])\n\t\t\tif customer\n\t\t\t\tlog_in customer\n\t\t\t\t@current_customer = customer\n\t\t\tend\n\t\tend\n\tend", "def user_company\n if Client.find_by_id(current_user.client_id)\n Client.find_by_id(current_user.client_id).client_name\n end\n end", "def show\n @customer = current_customer\n end", "def owner\n\t\tself.user.username rescue 'Ticket has no owner!'\n\tend", "def customers\n self.reviews.collect do |review|\n review.customer\n end\n end", "def vault_customer\n return nil if customer_details.id.nil?\n @gateway.customer.find(customer_details.id)\n end", "def print_invited_customers\n\t\t@invited_customers.each do |customer|\n\t\t\tputs \"ID:#{customer[\"user_id\"]} Name:#{customer[\"name\"]}\"\n\t\tend\n\tend", "def current_customer\n\t\tif (customer_id = session[:customer_id])\n\t\t\t@current_customer ||= Customer.find_by(id: customer_id)\n\t\telsif (customer_id = cookies.signed[:customer_id])\n\t\t\tcustomer = Customer.find_by(id: customer_id)\n\t\t\tif customer && customer.authenticated?(:remember, cookies[:remember_token])\n\t\t\tsign_in customer\n\t\t\t@current_customer = customer_id\n\t\t\tend\t\n\t\tend \n\tend", "def user\n order.user\n end", "def trade_requester(trade)\n User.find(trade.user_a_id)\n end", "def get_customers()\n customers = Customer.where(company_id: self.id).order(:name)\n\n return customers\n end", "def get_customers()\n customers = Customer.where(company_id: self.id).order(:name)\n\n return customers\n end", "def get_customers()\n customers = Customer.where(company_id: self.id).order(:name)\n\n return customers\n end", "def get_client_customer_id\n adwords.credential_handler.credentials[:client_customer_id]\n end", "def customer(quote)\n link_to(quote.customer.name, quote.customer)\n end", "def current_customer?(customer)\n customer == current_customer\n end", "def current_customer?(customer)\n customer == current_customer\n end", "def customer(options = nil)\n request = Request.new(@client)\n path = \"/authorization-requests/\" + CGI.escape(@id) + \"/customers\"\n data = {\n\n }\n\n response = Response.new(request.get(path, data, options))\n return_values = Array.new\n \n body = response.body\n body = body[\"customer\"]\n customer = Customer(self._client)\n return_values.push(customer.fill_with_data(body))\n\n \n return_values[0]\n end", "def current_customer\n if (customer_id = session[:customer_id])\n @current_customer ||= Customer.find_by(id: customer_id)\n elsif (customer_id = cookies.signed[:customer_id])\n customer = Customer.find_by(id: customer_id)\n if customer && customer.authenticated?(:remember, cookies[:remember_token])\n customer_log_in customer\n @current_customer = customer\n end\n end\n end", "def donor_username\n d = object.donor \n d.username\n end", "def to\n if self.reservation.user_id == self.user_id\n # client send a message to the author\n return self.reservation.product.user\n end\n return self.reservation.user\n else\n end", "def bought_orders\n @orders = current_user.bought_orders\n\n end", "def bought_orders\n @orders = current_user.bought_orders\n\n end", "def name_of_person_of_ticket\n self.viewer.name\n \n end", "def customer_by_ref(customer_ref)\n client.get \"customers/#{inst_id}/byRef?merchantRef=#{customer_ref}\"\n end", "def buyer_comment\n Comment.find_by(id: self.buyer_comment_id)\n end", "def subscription_id\n customer.subscriptions.first.id\n end", "def customer()\n sql = \"SELECT * FROM customers INNER JOIN rentals ON rentals.customer_id\n = customers.id WHERE rentals.id = $1\"\n values = [@id]\n result = SqlRunner.run(sql, values)[0]\n return Customer.new(result)\n end", "def admin_for_customer_inquiries\n admin_user = User.where(\"receive_customer_inquiry = ?\", true)\n admin_user = User.where(\"((admin = ?) AND (active = ?))\", true, true) if admin_user.empty?\n return admin_user.first\n end", "def billing_contact\n get_user billing_contact_id\n end", "def current_customer?(customer)\n\t\tcustomer == current_customer\n\tend", "def related_customers\n ratings.customers\n end", "def get_stripe_customer(stripe_customer_id)\n ::Stripe::Customer.retrieve(stripe_customer_id)\n end", "def service\n softlayer_client[:User_Customer].object_with_id(self.id)\n end", "def set_customer\n @customer = current_customer_user\n end", "def account_info_edit\n result = ChargeBee::Customer.retrieve(@customer_id)\n @customer = result.customer\n end", "def stripe_customer_id\n subscription = current_subscription\n return nil unless subscription\n\n subscription.identifier\n end", "def seller\n # the user owning the inventory\n offer.inventory_item.user\n end", "def returned_by_customer?\n @returned_by_customer\n end", "def correct_customer\n @favorite = Favorite.find(params[:id])\n current_person.user == @favorite.customer\n end", "def created_by\n user\n end", "def get_customer_name\n first_name + ' ' + last_name\n end", "def show\n @customer = Customer.find(@order.customer_id)\n end", "def customers\n Easybill::Api::Customers\n end", "def donor\n user\n end", "def credit_customer\n #@customer = Customer.order(name: :asc)\n end", "def get_customer(email)\n MerchantPluginProvider.api_not_implemented(self)\n end", "def reviewed_by\n return @reviewed_by\n end", "def committer() \n\t\tAccount.first(:id => self[:committer_id])\n\tend", "def customer\n @@all.select {|review| self.restaurant.customers}\n end", "def customer_owned_ip\n data[:customer_owned_ip]\n end", "def retreive_customer_info(options)\n requires!(options, :subscription_id, :order_id)\n commit(build_retreive_customer_info(options), options)\n end", "def technical_contact\n get_user technical_contact_id\n end", "def correct_customer\n @customer = Ticket.find_by(id: params[:comment][:id]).customer\n redirect_to root_url if @customer.nil? || @customer != current_customer\n end", "def customer\n @orders = Spree::Order.where(user_id: current_spree_user.id, state: 'complete').where.not(shipment_state: 'shipped', state: 'returned').order(created_at: :desc)\n end", "def favorite_customer\n cust = Customer.joins(invoices: [:transactions])\n .where(\"transactions.result = ?\", \"success\")\n .select(\"customers.*, count(transactions.id) as sales\")\n .group(:id)\n .order(\"sales desc\")\n .limit(1)\n\n cust.to_a.shift\n end", "def customers()\n sql = \"SELECT DISTINCT customers.* FROM customers\n INNER JOIN tickets\n ON customers.id = tickets.customer_id\n WHERE tickets.screening_id = $1;\"\n values = [@id]\n customers_array = SqlRunner.run(sql, values)\n return Customer.map_to_objects(customers_array)\n end", "def name\n customer_name = (Customer.find_by id: customer_id).name\n \"#{customer_name}, #{updated_at}\"\n end", "def getUser\n current_company.user\n end", "def seller\n author\n end", "def author\n object.user\n end", "def customer_filter\n customers = current_user.company.resources.map { |r| r.customer }\n customers = customers.compact.uniq.sort_by { |c| c.name.downcase }\n\n return filter_for(:customer_id, objects_to_names_and_ids(customers),\n session[:resource_filters], _(\"Customer\"))\n end", "def to_s\n \"#{@customer}: #{@body}\"\n end" ]
[ "0.70813394", "0.69925123", "0.69325", "0.68071675", "0.67841923", "0.6756783", "0.6708404", "0.6697619", "0.6656346", "0.6649654", "0.6615263", "0.6587293", "0.65314305", "0.64587766", "0.6446382", "0.6412533", "0.63775736", "0.6358827", "0.635578", "0.6352925", "0.63286334", "0.6322249", "0.6302184", "0.6301286", "0.6289149", "0.62866664", "0.6238894", "0.62107426", "0.61891514", "0.6183968", "0.61829805", "0.61724865", "0.6162034", "0.61436826", "0.6138989", "0.61179614", "0.60622776", "0.60373557", "0.6036489", "0.5989036", "0.59881854", "0.5961926", "0.5948738", "0.59370196", "0.5935187", "0.5924372", "0.59140253", "0.58831596", "0.5877498", "0.5877498", "0.5877498", "0.58771145", "0.58698887", "0.5868894", "0.5868894", "0.58568585", "0.58545804", "0.58536875", "0.58506906", "0.58249587", "0.58249587", "0.5817165", "0.5807872", "0.5796558", "0.5790036", "0.57800823", "0.57776845", "0.5770867", "0.5756642", "0.57535744", "0.5742704", "0.5737444", "0.5735129", "0.57273984", "0.5723468", "0.5722255", "0.57203245", "0.5720086", "0.57161295", "0.57141113", "0.57129794", "0.5706538", "0.5702294", "0.56890714", "0.5682536", "0.5671592", "0.56605774", "0.5660557", "0.5657453", "0.56473064", "0.5643697", "0.56315935", "0.5624906", "0.5620704", "0.56185514", "0.5597296", "0.55606335", "0.555948", "0.55573994", "0.55533487", "0.55493605" ]
0.0
-1
Require attribute to be set. Return attribute value.
def require_attr(name) send(name).tap do |_| raise AttributeError, "Attribute must be set: #{name}" if _.nil? end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def require_attr(name)\n send(name).tap do |_|\n raise \"Attribute must be set: #{name}\" if _.nil?\n end\n end", "def is_attribute?; end", "def get_attribute(name); end", "def get_attribute(name); end", "def required(required)\n state_depth_must_be(States::ATTRIBUTE)\n raise 'required already defined' if @current_attribute.required\n required = required.strip.downcase\n raise 'must be boolean' unless %w[true false].include?(required)\n r = (required == 'true')\n @current_attribute.required = r\n end", "def accept_attribute attrname, value, force=false\n attrname = attrname.to_s\n return if attrib_ready?(attrname) && !(attrib_needed?(attrname) || force)\n if block_given?\n # For any side-effects as a result of changing the attribute, call the block\n previous = self.send attrname.to_sym\n self.send (attrname+'=').to_sym, value\n # NB: it's possible that the accepted value is NOT the same as the provided value, so we compare\n # changes on the attribute.\n yield value if self.send(attrname.to_sym) != previous\n else # No block? Just set the value\n self.send (attrname+'=').to_sym, value\n end\n if all_attr_trackers.include?((attrname+'_needed').to_sym)\n # This attribute is tracked => clear 'needed' bit and set the 'ready' bit\n self.send (attrname+'_needed=').to_sym, false\n self.send (attrname+'_ready=').to_sym, true\n end\n end", "def check_attribute!(attribute)\n raise \"Unexpected attribute #{attribute} used\" unless self.class.attributes && self.class.attributes.include?(attribute)\n end", "def check_attribute!(attribute)\n raise \"Unexpected attribute #{attribute} used\" unless self.class.attributes && self.class.attributes.include?(attribute)\n end", "def required_attribute(name, options={:level=>:error})\n\t\t\t\tvalidate(\"Macro '#{@name}' requires a '#{name}' attribute\", options) do\n\t\t\t\t\t!raw_attribute(name.to_sym).blank?\n\t\t\t\tend\n\t\t\tend", "def set_attribute(name, value); end", "def ensure_attribute(root_element, key, type = nil, prefix = nil)\n value = get_attribute(root_element, key, type, prefix)\n label = prefix ? \"#{prefix}.#{key}\" : key\n raise \"Attribute '#{label}' is missing\" if value.nil?\n value\n end", "def attribute(name)\n @allowed_attributes[name]\n end", "def has_attribute?(name)\n respond_to?(\"#{name}=\")\n end", "def attribute_required?(attribute)\n validates_presence?(attribute) || validates_inclusion?(attribute)\n end", "def read_attribute(attribute, value)\n nil\n end", "def caprese_is_attribute?(attribute_name)\n false\n end", "def attribute_present?(attribute)\n value = read_attribute(attribute)\n !value.blank? or value == 0\n end", "def read_attribute_for_validation(attr)\r\n send(attr)\r\n end", "def read_attribute_for_validation(attr)\n send(attr)\n end", "def read_attribute_for_validation(attr)\n send(attr)\n end", "def read_attribute_for_validation(attr)\n send(attr)\n end", "def attribute; end", "def attribute; end", "def attribute; end", "def attribute; end", "def attribute; end", "def attribute; end", "def attribute; end", "def set_attribute\n @attribute = Attribute.find(params[:id])\n end", "def set_attribute\n @attribute = Attribute.find(params[:id])\n end", "def set_attribute\n raise Error::CustomError.error(422, :ATT_01, \"attribute\") unless Number.is_integer?(params[:attribute_id])\n begin\n @attribute = Attribute.find(params[:attribute_id]) \n rescue ActiveRecord::RecordNotFound\n raise Error::CustomError.error(404, :ATT_02, \"attribute\")\n rescue\n raise Error::CustomError.error(500, :ISE, \"attribute\")\n end\n end", "def attribute\n @attribute ||= Pod::Specification::DSL.attributes.find { |attr| attr.reader_name.to_s == name }\n end", "def check_for_auto_attr\n auto_attr = @presenter.extract_nested_value(node.automatic, @attr_spec)\n if ! auto_attr.nil?\n @collected_warnings << \"Attribute is set at automatic level. This means it is likely set by Ohai.\"\n end\n end", "def attr; end", "def required=(value)\n @required = value\n end", "def attribute(name); end", "def guard_required!\n required.each do |key|\n raise ArgumentError, \"Missing required attribute #{key}\" if self[key].nil?\n end\n end", "def simple_attr(attribute)\n define_method :\"#{attribute}\" do |value = nil|\n return instance_variable_get(:\"@#{attribute}\") if value.nil?\n instance_variable_set(:\"@#{attribute}\", value)\n end\n define_method :\"#{attribute}=\" do |value|\n instance_variable_set(:\"@#{attribute}\", value)\n end\n define_method :\"#{attribute}?\" do\n return true if instance_variable_get(:\"@#{attribute}\")\n false\n end\n end", "def attr attribute_name,value = nil\n string=\"$('##{@id}').attr('#{attribute_name}','#{value}')\"\n @app.dom_on_sockets.execute string\n end", "def assert_attribute_is_validated(model, attribute)\n # This line sets the specified attribute to nil\n model.assign_attributes(attribute => nil)\n assert !model.valid?, \"#{attribute.to_s} is not being validated\"\n end", "def assert_attribute_is_validated(model, attribute)\n # This line sets the specified attribute to nil\n model.assign_attributes(attribute => nil)\n assert !model.valid?, \"#{attribute.to_s} is not being validated\"\n end", "def mandatory?\n @declarer.mandatory_attributes.include?(attribute)\n end", "def attribute_present?(attribute)\n value = read_attribute(attribute)\n !value.blank?\n end", "def assert_attribute_is_validated(model, attribute)\n # This line sets the specified attribute to nil \n model.assign_attributes(attribute => nil)\n assert !model.valid?, \"#{attribute.to_s} is not being validated\"\n end", "def allowed_attributes=(_arg0); end", "def allowed_attributes=(_arg0); end", "def val(document, attribute)\n document.public_send(attribute) ||\n raise(\"#{ document.inspect } has no #{ attribute.inspect } value\")\n end", "def super_attr(name, opts={})\n\t\t\t\t\n\t\t\t\t# Defines getter\n\t\t\t\tdefine_method(\"#{name}\") do\n\t\t\t\t\tinstance_variable_get(\"@#{name}\")\n\t\t\t\tend\n\n\t\t\t\t# Defines setter\n\t\t\t\tdefine_method(\"#{name}=\") do |arg|\n\t\t\t\t\t# If the arg is a kind of opts[:type]\n\t\t\t\t\t# it sets the value, otherwise, it will\n\t\t\t\t\t# raise a StandardError.\n\t\t\t\t\tif arg.is_a? opts[:type]\n\t\t\t\t\t\tinstance_variable_set(\"@#{name}\", arg)\n\t\t\t\t\telse\n\t\t\t\t\t\traise StandardError.new(\"The value for #{name} is not a type #{opts[:type]}\")\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\t# If the attribute is required, it will\n\t\t\t\t# push its name to the @@required_attrs array\n\t\t\t\t@@required_attrs << name if opts.has_key?(:required) && opts[:required]\n\n\t\t\tend", "def mark_required(object, attribute) \n \"*\" if object.class.validators_on(attribute).map(&:class).include? ActiveModel::Validations::PresenceValidator \n end", "def attribute?\n false\n end", "def dom_attribute(name); end", "def element\n \"Attribute\"\n end", "def attr(name); end", "def set?(attribute)\n `$T(c$Element.prototype.m$get_property.call(#{@element},attribute))`\n end", "def attribute_to_set; end", "def required_attribute?(name, user=nil)\n required_attribute_names(user).include?(name.to_s)\n end", "def initialize_value(attribute)\n subject.send(\"#{attribute}=\", attribute_values[attribute] || 'X')\n end", "def method_missing(method_name, *args, &block)\n if method_name.to_s.end_with?('=')\n set_attribute(method_name, *args)\n elsif has_attribute?(method_name)\n get_attribute(method_name)\n else\n super\n end\n end", "def set attribute, value\n attributes[attribute] = value\n end", "def attr_required?(klass, attribute)\n klass.validators_on(attribute).map(&:class).include?(\n ActiveModel::Validations::PresenceValidator)\n end", "def method_missing(method_name, *args)\n # Return the attribute value\n if @attributes.has_key?(method_name)\n read_attribute(method_name)\n \n # If we predefine an attribute, but we don't have it loaded, return nil\n elsif self.class.predefined_attributes.include?(method_name)\n nil\n \n # Check booleans, attribute_name?\n elsif method_name.to_s =~ /\\?$/\n simple_method_name = method_name.to_s.gsub(/\\?$/, '').to_sym\n @attributes[simple_method_name] == true || @attributes[simple_method_name] == 't' || \n @attributes[simple_method_name] == 'true'\n \n # Method to set attribute, attribute_name=\n elsif method_name.to_s =~ /=$/ && !args.empty?\n write_attribute(method_name.to_s.gsub(/=$/, '').to_sym, args.first)\n \n # Default to raising an error\n else\n default_method_missing(method_name, *args)\n end\n end", "def get attribute\n attributes[attribute]\n end", "def read_set_attribute(attribute_name)\n value = read_attribute(attribute_name)\n column_type = ((column_definition = self.class.columns_hash[attribute_name.to_s]) and column_definition.type)\n value = value.to_i(10) if column_type == :string\n value\n end", "def attribute=(_arg0); end", "def attribute=(_arg0); end", "def missing_required(attr = 'name')\n fail MissingRequired, \"Cannot store data without a #{attr} attribute.\"\n end", "def get_attrib(attrib)\n Attrib.get(attrib, self) rescue nil\n end", "def attribute(value, default_value=nil)\n str = value.to_s\n not(str.empty?) ? str : default_value\n end", "def has_attribute(attribute, attr_def)\n @_attributes ||= superclass.instance_variable_get(:@_attributes).dup\n @_attributes[attribute] = attr_def\n end", "def attribute attr\n real_attr = attribute_for attr\n raise LookupFailure.new(self, attr) unless real_attr\n self.class.attribute_for @ref, real_attr\n end", "def get_attribute_value(attribute)\n data[attribute]\n end", "def [](name)\n name = name.to_sym\n super(name)\n rescue MissingAttributeError\n raise unless self.class.attribute_names.include?(name)\n end", "def [](attribute_name)\n raise NoMethodError, \"The attribute #{attribute_name} is undefined\" unless self.class.attributes.has_key? attribute_name\n default = super(attribute_name)\n self.class.cast(attribute_name, default.is_a?(Proc) ? default.call : default)\n end", "def attribute!(name, options={})\n super(name, options)\n define_method(\"#{name}=\") do |value|\n typecast_value = typecast_attribute(typecaster_for(self.class._attribute_type(name)), value)\n send(\"#{name}_will_change!\") unless typecast_value == read_attribute(name)\n super(value)\n end\n end", "def has_attribute (attname)\n\n attname = OpenWFE::symbol_to_name(attname) if attname.is_a?(Symbol)\n\n (@attributes[attname] != nil)\n end", "def expected_value\n @expected_value ||= @expected_value_set ? @expected_value : get_attribute_from_rendered_object\n end", "def attribute(attribute_name, options = T.unsafe(nil), &block); end", "def set(attribute, value)\n @attributes[attribute.to_s] = value\n nil\n end", "def attribute?( attribute )\n send(attribute).present?\n end", "def attribute(option_key, default_value=:__UNDEFINED__, opts={}, &block)\n ret = _pair(option_key, default_value, opts, &block)\n return if ret[2] # ignore\n @attributes[ret[0]] = ret[1]\n end", "def valid_attribute?( attroid )\n\t\treturn !self.valid_attribute_type( attroid ).nil?\n\tend", "def attribute_present?(attribute)\n value = respond_to?(attribute) ? send(attribute) : nil\n !value.nil? || (value.respond_to?(:empty?) && !value.empty?)\n end", "def assert_attribute_is_validated(model, attribute, value, flag)\n model.assign_attributes(attribute => value)\n if flag == 1\n assert_not model.valid?\n else\n assert model.valid?\n end\n end", "def attributes=(val)\n set_attributes(val)\n val\n end", "def _check_required_attr_data(attr_name, attr_options, fname)\n default = attr_options.rh_get(:default_value)\n\n return unless attr_options[:required]\n\n if attr_options.key?(:extract_from)\n unless @object_data.exist?(attr_options[:extract_from])\n PrcLib.runtime_fail(\"key '%s' was not extracted from '%s'\"\\\n \". '%s' requirement failed.\",\n attr_name, attr_options[:extract_from], fname)\n end\n elsif @config.get(attr_name, default).nil?\n section = Lorj.defaults.get_meta_section(attr_name)\n section = 'runtime' unless section\n PrcLib.runtime_fail(\"key '%s/%s' is not set. '%s' requirement\"\\\n ' failed.', section, attr_name, fname)\n end\n end", "def set_attr\n @attr = Attr.find(params[:id])\n end", "def set_attr\n @attr = Attr.find(params[:id])\n end", "def attribute_present?(attr_name)\n attr_name = attr_name.to_s\n value = _read_attribute(attr_name)\n !value.nil? && !(value.respond_to?(:empty?) && value.empty?)\n end", "def add_checked_attribute(klass, attribute)\n klass.class_eval do\n define_method attribute do\n instance_variable_get(\"@#{attribute}\")\n end\n\n define_method \"#{attribute}=\" do |value|\n raise 'Invalid attribute' unless value\n \n instance_variable_set(\"@#{attribute}\", value)\n end\n end\nend", "def attribute?(attrib)\n attributes.attribute?(attrib)\n end", "def attr_need_validation? attr\n return false unless required_attributes\n required_attributes.include?(attr)\n end", "def validate_required(model, key)\n if model.get_attribute(key).nil?\n [ :error, \"A value is required for attribute: '#{key}'\" ]\n else\n [ :ok, \"\" ]\n end\n end", "def attribute attr\n real_attr = attribute_for attr\n raise Accessibility::LookupFailure.new(self, attr) unless real_attr\n self.class.attribute real_attr, for: @ref\n end", "def get_attribute(attr)\n instance_variable_get(\"@fixed_#{attr}\") ||\n instance_variable_get(\"@auto_#{attr}\") ||\n @parent.send(\"effective_#{attr}\") ||\n @window.send(attr) || DEFAULT_SIZE[attr]\n end", "def value\n attributes.fetch(:value)\n end", "def attribute_name=(_arg0); end", "def attribute_name=(_arg0); end", "def attribute_name=(_arg0); end", "def attr_required(*attr_names)\n @required_attrs ||= []\n @required_attrs += attr_names\n attr_accessor(*attr_names)\n end", "def validate(value)\n if required? && (value == nil || value == \"\") && (default == nil || default == \"\")\n return \"#{name} is a required attribute\"\n end\n # TODO: add type validation here\n nil\n end" ]
[ "0.7701382", "0.6624033", "0.6465094", "0.6465094", "0.64115876", "0.64109665", "0.6395014", "0.6395014", "0.63879555", "0.6332254", "0.62541634", "0.62414527", "0.62332577", "0.6221746", "0.6193909", "0.6183849", "0.6143699", "0.6128453", "0.6095054", "0.6095054", "0.6095054", "0.60580707", "0.60580707", "0.60580707", "0.60580707", "0.60580707", "0.60580707", "0.60580707", "0.60535336", "0.60535336", "0.6031298", "0.60241693", "0.60239464", "0.6017459", "0.601012", "0.5998483", "0.59850085", "0.59820664", "0.598059", "0.5965333", "0.5965333", "0.5960993", "0.59319645", "0.5930158", "0.5927606", "0.5927606", "0.59255576", "0.59091717", "0.5898797", "0.58790624", "0.5870193", "0.58606094", "0.5857036", "0.5847266", "0.5846056", "0.5845805", "0.5839844", "0.58376807", "0.58269125", "0.5823931", "0.5821182", "0.5811206", "0.5805804", "0.5805777", "0.5805777", "0.5804705", "0.5792374", "0.57863015", "0.5781515", "0.57755786", "0.5774271", "0.5763146", "0.57565176", "0.57306635", "0.5729264", "0.57208407", "0.5713382", "0.5708976", "0.5705835", "0.57000256", "0.5698066", "0.56963587", "0.56933135", "0.5692776", "0.56906474", "0.56891555", "0.56891555", "0.56799215", "0.5677203", "0.567404", "0.56706446", "0.5669417", "0.5665322", "0.5664106", "0.56567574", "0.5655392", "0.5655392", "0.5655392", "0.56483066", "0.56448936" ]
0.7460677
1
A bigram is a pair of consecutive words. Given a string, return the longest bigram in that string. Include the space between the words. Assume there will be no punctuation. In the case of a tie, return the earlier bigram.
def longest_bigram(str) bigram_hash = Hash.new bigram_str = str.split(" ") bigram_str.each_with_index do |word, i| if i == bigram_str.length - 1 next else bigram_hash[word + " " + bigram_str[i + 1]] = (word + " " + bigram_str[i + 1]).length end end temp_str = "" temp_str_length = 0 bigram_hash.keys.each do |compound| if compound.length > temp_str_length temp_str = compound temp_str_length = compound.length end end p temp_str end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def most_frequent_bigram(str)\n bigrams_hash = biagram_hash(str)\n bigrams_hash.key(bigrams_hash.values.max)\nend", "def most_frequent_bigram(str)\n sub_str_arr = []\n bigram_count = Hash.new(0)\n str.each_char.with_index do |char,idx|\n if idx+1 != nil && str[idx..idx+1].length ==2\n sub_str_arr << str[idx..idx+1]\n end\n end\n sub_str_arr.each {|bigram| bigram_count[bigram]+=1}\n \n sorted = bigram_count.sort_by {|key,value| value}\n sorted [-1][0]\n\n\nend", "def most_frequent_bigram(str)\n bigram_count = Hash.new(0)\n\n # count each bigram appearance\n (0...str.length - 1).each do |i|\n bigram = str[i] + str[i+1]\n bigram_count[bigram] += 1\n end\n\n # return most frequent bigram\n bigram_count.max_by { |k, v| v }.first\nend", "def most_frequent_bigram(str)\n hash = Hash.new(0)\n str.each_char.with_index do |char, idx|\n hash[str[idx..idx+1]] += 1\n end\n max = 0\n max_bigram = \"\"\n hash.each_pair do |key, value|\n if value > max\n max_bigram = key\n max = value\n end\n end\n return max_bigram\nend", "def most_frequent_bigram(str)\n pairs = Hash.new(0)\n str.each_char.with_index do |letter, indx|\n if indx != str.length-1\n pair = letter + str[indx+1]\n end\n pairs[pair] += 1\n end\n pairs.key(pairs.values.max)\nend", "def most_frequent_bigram(str)\n bigram_hash = Hash.new(0)\n\n (0...str.length - 1).each do |idx|\n bigram_hash[str[idx] + str[idx+1]] += 1\n end\n\n sorted = bigram_hash.sort_by { |k, v| v }\n sorted[-1][0]\nend", "def most_frequent_bigram(str)\n binaries = [] \n letters = str.split(\"\") #\"thrill\"\n (0...(letters.length-1)).each_with_index do |letter,idx|\n binaries << (letters[idx] + letters[(idx + 1)])\n end\n hash = Hash.new(0)\n binaries.each do |pairs|\n hash[pairs] += 1 \n end\n sorted = hash.sort_by { |k , v| v }\n return sorted[-1][0]\nend", "def most_frequent_bigram(str)\n bigram_hash = Hash.new(0)\n\n i = 0\n while i < str.length - 1\n bigram_hash[str[i..i+1]] += 1\n i += 1\n end\n\n bigram_hash.max_by {|k, v| v}[0]\nend", "def most_frequent_bigram(str)\n h = Hash.new(0)\n bigrams = (0..str.length-2).map{|i| str[i..i+1]}\n bigrams.each {|bi| h[bi] += 1}\n h.key(h.values.max)\nend", "def most_frequent_bigram(str)\n new_array =[]\n new_arr = []\n hash = {}\n hash = Hash.new {|k, v| hash[k] = 0}\n new_str = str.split(\"\")\n (0...new_str.length).each do |i0|\n (i0...new_str.length).each do |iz|\n pair = new_str[i0..iz]\n new_array << pair\n end\n end\n\n new_array.each do |combined|\n if combined.length == 2\n new_arr << combined \n end\n end\n \n new_arr.each do |pairs| \n hash[pairs] += 1\n end\n \n hash.each {|k, v| return k.join(\"\") if v == hash.values.max}\n\n \nend", "def get_the_longest_word(str)\n str.split(\" \").sort! {|s, l| l.length <=> s.length}[0]\nend", "def longest_word(str)\n longest_word = \"\"\n words = str.split(' ')\n\n words.each do |word|\n if word.length > longest_word.length\n longest_word = word\n end\n end\n return longest_word\nend", "def longest_pali(string)\n letters = string.gsub(/\\W+/,'').split('')\n combos = []\n idx = 2\n while idx <= letters.length\n combos << letters.combination(idx).to_a\n idx += 1\n end\n longest = nil\n combos.flatten(1).each do |x|\n if (palindrome?(x.join(''))) && (longest == nil || x.length > longest.length)\n longest = x\n end\n end\n \n return longest.join('')\nend", "def most_frequent_bigram(str)\n bigram = Hash.new(0)\n (0...str.length).each { |index| bigram[str[index..index+1]] += 1 }\n bigram.key(bigram.values.max)\nend", "def most_frequent_bigram(str)\n adjacent_letter={}\n letter=\"\"\n (0...str.length-1).each do |i|\n letter=str[i]+str[i+1]\n if adjacent_letter.has_key?(letter)\n adjacent_letter[letter]+=1\n else\n adjacent_letter[letter]=1\n end\n end\n\n max=0\n max_aj=\"\"\n adjacent_letter.each do |k,v|\n if v>max\n max=v\n max_aj=k\n end\n end\n max_aj\n\n\nend", "def most_frequent_bigram(str)\n counter = Hash.new(0)\n (0...str.length-1).each { |i| counter[str[i] + str[i+1]] += 1 }\n sorted = counter.sort_by { |k, v| v }\n sorted[-1][0]\nend", "def longest_word(string_of_words)\n # Give me back the longest word!\n longest = \"\"\n string_of_words.split(\" \").each do | word |\n if longest.length <= word.length\n longest = word\n end\n end\n return longest\nend", "def find_longest_word(input_string)\n array = input_string.split(\" \")\n array.max_by {|word| word.length}\nend", "def bigramate(word)\n (0..(word.length - 2)).map { |i| word.slice(i, 2) }\n end", "def find_longest_word(string)\n sentence = string.split\n longest_word = \"\"\n sentence.each do |word|\n word.gsub!(/\\W/, \"\") # filters out non alphanumeric\n longest_word = word if word.length >= longest_word.length\n end\n longest_word\nend", "def find_longest_word(input)\n array = input.split(\" \")\n array.sort! { |x, y| y.length <=> x.length }\n array[0]\nend", "def most_frequent_bigram(str)\n hash = Hash.new(0)\n str.each_char.with_index do |char, idx|\n key = char + str[idx + 1] if idx < str.length - 1\n hash[key] += 1\n end\n\n hash.key(hash.values.max)\nend", "def longest_word(string)\n\t\n\tsplitted_string = string.split(\" \")\n\tword_length = []\n\t\n\tsplitted_string.each { |word| word_length << word.length }\n\t\n\tmax = word_length.max\n\tidx = word_length.index(max)\n\tsplitted_string[idx]\n\t\nend", "def most_frequent_bigram(str)\n hash = Hash.new(0)\n str.each_char.with_index {|c, i| hash[c + str[i+1]] += 1 if str[i + 1]}\n hash.key(hash.values.max)\nend", "def LongestWord(str)\n words = str.split.map { |s| s.gsub(/\\W/, '') }\n longest = words [0]\n words.each { |word| longest = word if word.length > longest.length }\n longest\nend", "def most_frequent_bigram(str)\n bigrams = Hash.new(0)\n\n i = 0\n while i < str.length - 1\n bigrams[str[i..i+1]] += 1 \n i += 1\n end\n\n max_num = 0\n max = nil\n\n bigrams.each do |k,v|\n if v > max_num\n max_num = v\n max = k\n end\n end\n max\nend", "def most_frequent_bigram(str)\n counts = Hash.new(0)\n (0...str.length-1).each do |i|\n bigram = str[i..i + 1]\n counts[bigram] += 1\n end\n\n sorted = counts.sort_by { |h,v| v } # sorts by value \n sorted.last[0]\nend", "def most_frequent_bigram(str)\n most_frequent_bigram = Hash.new(0)\n\n str.each_char.with_index do |char, index|\n bigram = \"#{char}#{str[index + 1]}\"\n most_frequent_bigram[bigram] += 1\n end\n\n max_count = most_frequent_bigram.sort_by {|k, v| v}\n max_count[-1][0]\nend", "def most_frequent_bigram(str)\n bigrams = Hash.new(0)\n (0...str.length-1).each{|i| bigrams[ str[i..i+1] ] += 1}\n max = bigrams.first[0] # Hash#first returns first key value pair in an array\n bigrams.each {|key,val| max = key if val > bigrams[max]}\n # bigrams.sort_by{|b, v| v}.last[0]\n max\nend", "def old_longest_word(str)\n words = str.split\n longest_word = \"\"\n\n words.each do |word|\n if word.length > longest_word.length\n longest_word = word\n end\n end\n\n longest_word\nend", "def longest_two_words(string)\n string.gsub(/[[:punct:]]/, '').split.sort_by(&:length)[-2..-1]\nend", "def most_frequent_bigram(str)\n#grab substrings of length 2\n#hash that contains the substring\n#return key with max value \n\n bigrams = Hash.new(0)\n str.each_char.with_index do |char, i|\n bigrams[str[i..i+1]] += 1 if i + 1 < str.length\n end\n bigrams.max_by { |k,v| v }.first\nend", "def longest_word(str)\r\n\r\n # temporary variables created\r\n word_length = 0\r\n longest_word = \"\"\r\n\r\n # checks length of each word\r\n str.split(\" \").each {|word|\r\n\r\n if word.length >= word_length\r\n word_length = word.length\r\n longest_word = word\r\n end\r\n\r\n }\r\n\r\n longest_word\r\nend", "def most_frequent_bigram(str)\n most_freq = \"\"\n highest_freq = 0\n bigram_hash = Hash.new(0)\n len = str.length\n (0...len-1).each { |idx| bigram_hash[str[idx..idx+1]] += 1 }\n bigram_hash.each do |k, v| \n if v > highest_freq\n most_freq = k \n highest_freq = v\n end\n end\n most_freq\nend", "def most_frequent_bigram(str)\n count = Hash.new(0)\n\n (0...str.length - 1).each do |i|\n bigram = str[i..i + 1]\n\n count[bigram] += 1\n end\n\n count.sort_by { |k, v| v } [-1][0]\nend", "def longest_two_words(string)\n string.delete!(',.?:;\"!\"')\n word_arr = string.split(\" \").sort_by { |word| word.length }.reverse!\n word_arr[0..1]\nend", "def longest_word(sentence)\n result = \"\"\n sentence.split.each do |word|\n if word.length > result.length\n result = word\n end\n end\nresult\nend", "def longest_word(string_of_words)\n\tas_arr = string_of_words.split(\" \")\n\tlengths = as_arr.map {|string| string.length}\n\tmax_length = lengths.max\n return as_arr.reverse.detect {|string| string.length === max_length}\nend", "def most_frequent_bigram(str)\n n, hash, res, ct = str.length, Hash.new(0), \"\", 0\n (0...n).each do |i|\n break if i + 2 > n\n w = str[i..(i + 1)]\n hash[w] += 1\n if(ct < hash[w])\n ct = hash[w]\n res = w\n end\n end\n res\nend", "def longest_word (sen)\n i = 0\n while i < sen.length do\n # negated regex boolean\n if sen[i] !~ /[a-z]|\\s/\n sen.slice!(i)\n else\n sen[i]\n i += 1\n end\n end\n return sen.split(\" \").max_by(&:length).length\nend", "def most_frequent_bigram(str)\n hash = Hash.new(0)\n\n str.each_char.with_index do |char, i|\n if i != str.length - 1\n bigram = char + str[i + 1]\n end\n hash[bigram] += 1\n end\n most_frequent = hash.values.max\n hash.each { |k, v| return k if v == most_frequent}\n\nend", "def find_longest_word(sentence)\n words = sentence.downcase.tr(\"^a-z\", \" \").split\n longest = \"\"\n words.each do |word|\n if word.length > longest.length\n longest = word\n end\n end\n return longest\n\nend", "def longest_word(sen)\n words = sen.split\n words.map! { |word| word.delete('^A-Za-z1-9_\\'') }\n longest = words.first\n words.each_with_index do |word, idx|\n next if idx >= words.size - 1\n longest = longest.size < words[idx + 1].size ? words[idx + 1] : longest\n end\n longest\nend", "def english(str)\n result = []\n arr = str.split(' ')\n result << arr.uniq.group_by { |v| arr.count(v) }.max.last.join\n result << arr.max_by{ |x| x.length } \nend", "def longest_word(phrase)\n longestWord = \"\"\n longestWordLength = 0\n \n wordArray = phrase.split(\" \")\n wordArray.each do |word|\n if word.length > longestWordLength\n longestWord = word\n longestWordLength = word.length\n end\n end\n return longestWord\nend", "def longest_two_words(string)\n string.delete!(\",.:;?!\")\n string.split.sort_by {|x|x.length}[-2..-1]\n\nend", "def get_the_longest_word(str)\n words = str.split()\n longest = [0, \"\"]\n\n for word in words\n if word.length > longest[0]\n longest[0] = word.length\n longest[1] = word\n end\n end\n\n print(longest[1])\n return longest[1]\nend", "def longestWord(sen)\n\tarray = []\n\tsen.gsub!(/[^0-9a-zA-Z\\s]/i, '')\n\tsen = sen.split(' ')\n\tsen.each {|word| array.push(word)}\n\tarray.sort! { |x,y| y.length <=> x.length }\n\treturn array.first\nend", "def use_bigram(str,i)\n\t\tmax=@han[str[i]][0]\n\t\tif i==0\n\t\t\t@han[str[i]].each{|h|\n\t\t\t\tif ref(\"$\"+h)>ref(\"$\"+max)\n\t\t\t\t\tmax=h\n\t\t\t\tend\n\n\t\t\t}\n\t\telse\n\t\t\t\t@han[str[i]].each{|h|\n\t\t\t\tif ref(str[i-1]+h)>ref(str[i-1]+max)\n\t\t\t\t\tmax=h\n\t\t\t\tend\n\n\t\t\t}\n\t\tend\n\t\treturn max\n\n\tend", "def largest_palindrome?(sentence)\n array_of_words = sentence.split(\" \")\n ret = []\n array_of_words.each do |word|\n if palindrome?(word)\n if word.length > ret.length\n ret.pop\n ret << word\n end\n end\n end\nend", "def longest_two_words(string)\n string.split.sort_by { |word| word.length }[-2..-1]\nend", "def longest_two_words(string)\n string.split.sort_by { |word| word.length }[-2..-1]\nend", "def longest(string)\n if string.class == String\n words = string.split(' ').sort_by! {|word| word.length}\n words.last\n else\n nil\n end\nend", "def get_bigrams(string)\n s = string.downcase\n v = []\n (s.length-1).times{ |i|\n v[i] = s[i...i+2]\n }\n return v\n end", "def find_longest_word(sentence)\n # removes special characters | sorts by length | reverses to start with the longest\n longest = sentence.split(/\\W+/).sort_by { |word| word.length }.reverse!\n longest[0]\nend", "def get_the_shortest_word(str)\n words = str.split()\n return words.max\nend", "def longest_two_words(string)\n string.split(\" \").sort_by { |word| word.length }[-2..-1]\nend", "def longest_word(sentence)\n words = sentence.split(\"\\s\")\n \n max_word = nil\n for word in words do\n if max_word == nil \n max_word = word\n elsif word.length > max_word.length \n max_word = word\n end\n end\n \n return max_word\nend", "def longest (string)\n length_string = getlength(string)\n string.each do |word|\n if word.length == length_string.max\n puts word\n end\n end\nend", "def longest_word(sentence)\n words = sentence.split(\" \") # words = \"hello, you, motherfucker\"\n\n idx = 0\n while idx < words.length # 0 < 3\n current_word = words[idx] # current_word = words[0]\n\n longest_word = \"\" # set initial longest_word as empty string.\n if current_word.length > longest_word.length\n longest_word = current_word\n end\n\n idx += 1\n end\n return longest_word\nend", "def longest_two_words(string)\n words = string.split(\" \")\n words.sort_by! {|x| x.length }\n words[-2..-1]\nend", "def LongestWord(sen)\n str = sen.split(\" \")\n longest_word = str[0]\n str.each do |word|\n word.sub(/[\\w\\s]/, '')\n if longest_word.length < word.length\n longest_word = word\n end\n end\n longest_word\nend", "def longest_palindrome(string)\nend", "def longest_palindrome(string)\n \nend", "def mcw(search)\n\t\tif !$bigrams.has_key?(search) # if the search word doesn't exist in the bigram...\n\t\t\tmost_common = nil # we're going to return nil.\n\n\t\telse most_common = $bigrams[search].max_by{|word, number| number}[0] # search for max by # of maxes\n\t\tend\n\n\t\treturn most_common\nend", "def get_the_shortest_word(str)\n str.split(\" \").sort! {|s, l| s.length <=> l.length}[0]\nend", "def longest_word(sentence)\n\t\n\tarr = sentence.split(\" \")\n\tarr = []\n\tlongest = \"\"\n\t\n\tarr.each do |word|\n\tlongest = word if longest.length < word.length\t\n end\n return longest\nend", "def longest_palindrome(str)\n \nend", "def longest_word(sentence)\n word_arr = sentence.split\n longest = word_arr.shift\n \n word_arr.each do |word|\n longest = word if word.length >= longest.length\n end\n\n longest\nend", "def longest_palindrome(string)\n\nend", "def longest_palindrome(string)\n\nend", "def longest_palindrome(string)\n\nend", "def find_longest_word(string)\n array = string.split(\" \")\n p array\n array.max_by(&:length) \nend", "def longest_word(sentence)\n words = sentence.split\n words.sort_by!(&:length)\n words[-1]\nend", "def most_frequent_bigram(str)\n\n new_hash = Hash.new(0)\n str.each_char.with_index do |ele, i|\n if i < (str.length - 1)\n new_hash[ele + str[i +1]] += 1\n end\n end\n # p new_hash.values.max\n new_hash.each do |k, v|\n if new_hash.values.max == v\n return k\n end\n end\n\nend", "def most_probable_next_word(string)\n words = string.split(\" \")\n bigram_key = words.last\n trigram_key = words.last(2).join(\" \") if words.count >= 2\n most_probable_word = \"\"\n\n ## if we can find trigram and trigram exists\n if words.count >= 2 and @trigrams[trigram_key] != nil\n # get w3 from grams with highest P(w1,w2,w3) = P(w1)*P(w2|w1)*P(w3|w1,w2)\n highest_probability = 0.0\n\n @unigrams.each_key do |word|\n tempProb = probability_of_sequence(trigram_key + \" \" + word)\n # if P(w1)*P(w2|w1)*P(w3|w1,w2) > highest_probability\n if tempProb > highest_probability\n highest_probability = tempProb\n most_probable_word = word\n end\n end\n\n puts \"ERROR IN TRIGRAMS\" if highest_probability == 0.0\n puts \"Trigram, highest_probability: \" + highest_probability.to_s + \" Perplexity: \" + perplexity(highest_probability, 3).round(4).to_s\n return most_probable_word\n ## if we can find a bigram and bigram exists\n elsif words.count >= 1 and @bigrams[bigram_key] != nil\n # get w2 from grams with highest P(w2|w1)\n highest_probability = 0.0\n\n @unigrams.each_key do |word|\n tempProb = probability_of_sequence(bigram_key + \" \" + word)\n # if P(w1)*P(w2|w1) > highest_probability\n if tempProb > highest_probability\n highest_probability = tempProb\n most_probable_word = word\n end\n end\n puts \"ERROR IN BIGRAMS\" if highest_probability == 0.0\n puts \"Bigram, highest_probability: \" + highest_probability.to_s + \" Perplexity: \" + perplexity(highest_probability, 2).round(4).to_s\n return most_probable_word\n ## return random unigram?\n else\n highest_probability = 0.0\n @unigrams.each_key do |word|\n tempProb = probability_of_sequence(word)\n # if P(w1)*P(w2|w1) > highest_probability\n if tempProb > highest_probability\n highest_probability = tempProb\n most_probable_word = word\n end\n end\n puts \"Unigram, highest_probability: \" + highest_probability.to_s + \" Perplexity: \" + perplexity(highest_probability, 1).round(4).to_s\n return most_probable_word\n end\n end", "def longest_two_words(string)\n arr = string.split.sort_by(&:length)\n [arr[-1], arr[-2]]\nend", "def longest_palindrome(str)\n\nend", "def longest_palindrome(string)\n largest = ''\n (0...string.length).each do |i|\n (i + 1...string.length).each do |j|\n sub_str = string[i..j]\n if sub_str == sub_str.reverse\n if sub_str.length > largest.length\n largest = sub_str\n end\n end\n end\n end \n largest\nend", "def longest_word(sentence)\n words = sentence.split(\"\") #This automically creates a new array with the string split already right?\n idx = 0\n # initially the longest word is empty\n \n longest_w = ''\n \n # We will loop over the current word.\n \n while idx < words.length\n if (words[idx].length > longest_w.length)\n longest_w = words[idx]\n else \n longest_w = longest_w\n end\n \n idx = idx + 1\n end\n \n return longest_w\nend", "def LongestWord(sen)\n words = sen.split(' ').map do |i|\n /[a-zA-Z0-9]+/.match(i)\n end\n\n longest = words.max_by.each do |i|\n i.to_s.length\n end\n\n longest\n\nend", "def longest_words(text)\n greatest_length = unique_words(text).map { |word| word.length }.max\n unique_words(text).select do |word|\n word.length == greatest_length\n end\nend", "def longest_word(sentence)\n\tarr = sentence.split(\" \")\n\tp arr\n\titer = 0\n\twhile iter < arr.length\n\t\tlongest_word = nil\n\t\tcurrent_word = arr[iter]\n\t\tif longest_word == nil\n\t\t\tlongest_word = current_word\n\t\telsif longest_word.length < current_word.length\n\t\t\tlongest_word = current_word\n\t\tend\n\t\titer+=1\n\tend\n\treturn longest_word\nend", "def longest_two_words(string)\n sorted = string.split.sort_by {|word| word.length}\n [sorted[-2], sorted[-1]]\nend", "def LongestWord(sen)\n arr = sen.split(' ')\n longest = arr[0]\n arr.each do |word|\n if word.length > longest.length\n longest = word\n end\n end\n return longest\nend", "def longest_word(sentence)\n longestWord = \"\" #holds word\n words = sentence.split(' ') #split sentence into array of words.\n\n words.each do |word| #loop through array of words\n if word.length > longestWord.length #if the word the loop is on is greater than the longest word.. \n longestWord = word #set the longest word to that word.\n end\n end\n return longestWord #return longest word\nend", "def croon str\n ans = \"\"\n words = str.split(\" \")\n words.each_with_index {|word, i|\n if words[i] == words[-1]\n ans << word.split(\"\").join(\"-\")\n ans\n return ans\n else\n ans << word.split(\"\").join(\"-\") + \" \"\n ans\n end\n }\nend", "def longest_string(list_of_words)\n\tif list_of_words == []\n\t\treturn nil\n\telsif list_of_words == [\" \"]\n\t\treturn \" \"\n\telse\n\t\tstring_length = []\n\t\tlist_of_words.each do |string|\n\t\t\t string_length.push string.length\n\t\tend\n\t\tlist_of_words.each do |string|\n\t\t\tif string_length.max == string.length\n\t\t\t\treturn string\n\t\t\tend\n\t\tend\n\n\tend\n\nend", "def LongestWord(sen)\n longest = \"\"\n sen.scan(/\\w+/) do |word|\n if word.length > longest.length\n longest = word\n end\n end\n \n return longest\nend", "def longest_string(list_of_words)\n list_of_word = list_of_words.sort_by { |x| x.length }\n return list_of_word[-1]\nend", "def longest_non_sub_anagram\n testing_words = preener\n longest_word = 'queue'\n\n until testing_words.empty?\n testing_words.each do |word|\n if !subanagram_any?(word) && word.length >= longest_word.length\n longest_word = word\n testing_words.delete_if { |tester| tester.length < longest_word.length }\n else\n testing_words.delete_if { |tester| tester.include?(word) }\n end\n end\n end\n\n longest_word\nend", "def longest_two_words(string)\n str_arr = string.split.sort_by {|el| el.length}\n [str_arr[-2],str_arr[-1]]\nend", "def longest_two_words(string)\n arr = string.split(' ')\n sorted = arr.sort_by {|str| str.length}\n sorted[-2..-1]\nend", "def longest_substring_which_contains_two_unique_characters(string)\n longest = ''\n current = ''\n hash = Hash.new(0)\n\n string.split('').each do |s|\n current += s\n\n if hash[s] > 0\n hash[s] += 1\n else\n hash[s] += 1\n if hash.size > 2\n longest = longest.length > current.length ? longest : current\n # binding.pry\n pair = hash.min_by{|k,v| v}\n hash.delete(pair[0])\n\n current = current[1..-1]\n else\n current += s\n end\n end\n end\n\n longest\nend", "def longest_two_words(string)\n string = string.delete(\".,\")\n words = string.split(\" \")\n words.sort_by {|word| word.length}[-2..-1]\n\nend", "def longest_palindrome(string)\n string_arr = string.split(\"\")\n longest = 0\n substring = \"\"\n\n while string_arr.length > 0\n string_arr.each do |char|\n substring << char\n palindrome?(substring) && substring.length > longest ? longest = substring.length : next\n end\n\n string_arr.shift\n substring = \"\"\n end\n \n longest\nend", "def longest_string(arr)\n arr.max_by { |word| word.length }\nend", "def longest_palindrome(string)\n # Create a variable to store our results to be returned\n best_palindrome = nil\n \n # Loop through our string\n i = 0\n while i < string.length # to go through each letter in the string\n # create local variable\n length = 1 # assign first length to 1\n \n # Create second loop\n while (i + length) <= string.length # to slice out out the substring 0 + 1 <= 5\n # local variable\n substring = string.slice(i, length) # to define the substring string.slice(0, 1) => ab\n \n if palindrome?(substring) && (best_palindrome == nil || substring.length > best_palindrome.length)\n best_palindrome = substring\n end\n # substring becomes new best_palindrome if it meets 2 requirements:\n # 1. it is a palindrome\n # 2. it's (nil = to the first substring as best_palindrome) OR new substring is longer than current logest substring.\n \n length += 1 # increment length of substring at each starting index. (i.e. a, ab, abc, abcd, etc...)\n end\n \n i += 1 # then increment i to set each letter as startign index. (i.e. abcd, bcbd, cbd, etc...)\n end\n \n return best_palindrome\n end", "def longest_string(list_of_words)\n if list_of_words.length > 0\n longest_word = list_of_words[0]\n for word in list_of_words\n if word.length > longest_word.length\n longest_word = word\n end\n end\n return longest_word\n end\nend", "def most_frequent_letter(string)\nend" ]
[ "0.7207688", "0.7051371", "0.7041303", "0.702443", "0.70081127", "0.70071846", "0.698274", "0.6979883", "0.69363034", "0.6920343", "0.68968546", "0.68956643", "0.68891966", "0.6885634", "0.6866206", "0.6860503", "0.68334246", "0.68278694", "0.6824303", "0.68168306", "0.6815104", "0.6813759", "0.68059456", "0.6801984", "0.67832077", "0.6778249", "0.6772492", "0.6770554", "0.6770173", "0.6769233", "0.6767882", "0.6715045", "0.6711583", "0.67068374", "0.6705844", "0.67049986", "0.67040545", "0.6702091", "0.66971606", "0.669225", "0.66915953", "0.66782045", "0.66295695", "0.66083485", "0.6604672", "0.6595714", "0.6592624", "0.6586234", "0.65806526", "0.65641785", "0.6529129", "0.6529129", "0.6520963", "0.6519325", "0.6515925", "0.6508402", "0.65029126", "0.6490999", "0.6484048", "0.64645505", "0.64529836", "0.64526635", "0.64450216", "0.64394975", "0.6439263", "0.6425668", "0.6415808", "0.6410189", "0.63767713", "0.6375409", "0.6375409", "0.6375409", "0.63673663", "0.6360682", "0.6359931", "0.6347174", "0.63311464", "0.6328892", "0.6314049", "0.6298894", "0.6297738", "0.6296665", "0.6289351", "0.6288439", "0.62872505", "0.6257991", "0.6257805", "0.62497944", "0.6235119", "0.62312424", "0.6225534", "0.62227124", "0.6221794", "0.6220648", "0.6220318", "0.62201256", "0.6196357", "0.6189155", "0.61890304", "0.61737293" ]
0.78004354
0
Retrieve one API Secret.
def get(secret_id) request('/accounts/' + account_id + '/secrets/' + secret_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_secret(params)\n return @api_secret\n end", "def secret\n client.get(\"/user/secret\").fetch(\"result\")\n end", "def secretkey(apikey)\n get 'secretkey', {apikey: apikey} { |x| x['secretkey'] }\n end", "def get_secret(secret_name, secret_version = nil)\n url = @vault_url.get_url(clean(secret_name), secret_version, @api_version)\n headers = { 'Authorization' => @bearer_token }\n response = RestClient.get(url, headers)\n JSON.parse(response)['value']\n rescue RestClient::NotFound\n return nil\n end", "def get_secret(secret_id)\n @client.call(\n :get_secret,\n message: {\n token: @token,\n secretId: secret_id\n }\n ).to_hash.dig(:get_secret_response, :get_secret_result)\n end", "def get_secret(key)\n secret node['openstack']['secret']['secrets_data_bag'], key\n end", "def get_secret project_id:, secret_id:\n # Create a Secret Manager client.\n client = Google::Cloud::SecretManager.secret_manager_service\n\n # Build the resource name of the secret.\n name = client.secret_path project: project_id, secret: secret_id\n\n # Get the secret.\n secret = client.get_secret name: name\n\n # Get the replication policy.\n if !secret.replication.automatic.nil?\n replication = \"automatic\"\n elsif !secret.replication.user_managed.nil?\n replication = \"user managed\"\n else\n raise \"Unknown replication #{secret.replication}\"\n end\n\n # Print a success message.\n puts \"Got secret #{secret.name} with replication policy #{replication}\"\nend", "def secret\n @secret or raise MissingSecret\n end", "def get_value(secret_id)\n fail 'Not allowed env' unless config.is_allowed_env.call\n response = secrets_manager.get_secret_value(secret_id: secret_name(secret_id))\n response.secret_string\n rescue StandardError => err\n logger.warn(\"[Sekreto] Failed to get value!\\n#{err}\")\n config.fallback_lookup.call(secret_id)\n end", "def secret\n secret_value or raise 'secret is only available for new access keys'\n end", "def secret\n @secret ||= begin\n secret = load_secret\n unless secret\n ui.fatal('A secret or secret_file must be specified')\n show_usage\n exit 1\n end\n secret\n end\n end", "def secret_key\n credentials['secret_key']\n end", "def secret_key\n credentials['secret_key']\n end", "def get_secret(opts = {})\n data, _status_code, _headers = get_secret_with_http_info(opts)\n data\n end", "def set_secret\n @secret = Secret.find(params[:id])\n end", "def decrypt_api_secret\n @api_secret_d = @client_api_detail.decrypted_api_secret\n success\n end", "def set_secret\n @secret = Secret.find(params[:id])\n end", "def set_secret\n @secret = Secret.find(params[:id])\n end", "def set_secret\n @secret = Secret.find(params[:id])\n end", "def set_secret\n @secret = Secret.find(params[:id])\n end", "def secret\n query[\"client_secret\"]\n end", "def secret\n decrypt_secret\n end", "def secret\n decrypt_secret\n end", "def secret\n self\n end", "def secret\n @options[:credential2]\n end", "def read_secret\n if config[:secret]\n config[:secret]\n else\n Chef::EncryptedDataBagItem.load_secret(config[:secret_file])\n end\n end", "def fetch_current_secrets\n json_string = `kubectl get secret #{main_secret_name} --namespace #{app} -o json`\n json = JSON.parse(json_string)\n fail \"Unexpected Kind\" unless json['kind'] == 'Secret'\n json\n end", "def access_secret\n @attributes[:access_secret] || client.secret\n end", "def access_secret\n @attributes[:access_secret] || client.secret\n end", "def access_secret\n @attributes[:access_secret] || client.secret\n end", "def value\n if show_secret\n secret\n else\n Digest::SHA1.hexdigest secret\n end\n end", "def getsecretword\r\n\t\t return @secretword\r\n\t\t end", "def secret(client:)\n parsed_response(\n path: \"#{url_for(client)}/client-secret\"\n )['value']\n end", "def read_secret(path)\n path = update_path(path)\n secret = @cache[path] ||= @vault.logical.read(path)\n unless secret\n raise VaultSecretNotFound,\n \"Secret #{path} not found\"\n end\n secret\n end", "def secret_generate\n Secret.generate\n end", "def secret\n @secret || ''\n end", "def set_secret_key\n @secret_key = SecretKey.find(params[:id])\n end", "def api_secret_field(value = nil)\n rw_config(:api_secret_field, value, first_column_to_exist(nil, :api_secret, :application_secret))\n end", "def secret\n (@service.connector? and @service.secret == nil) ? @this.secret : @service.secret\n end", "def secret_key; end", "def fetch_admin_secret\n @admin_secret = AdminSecret.get_active_from_memcache(@admin.admin_secret_id)\n return incorrect_login_error('am_l_cp_4') unless @admin_secret.present?\n\n success\n end", "def fetch_admin_secret\n @admin_secret = AdminSecret.get_active_from_memcache(@admin.admin_secret_id)\n return incorrect_login_error('am_l_pa_2') unless @admin_secret.present?\n\n success\n end", "def secret_type\n return @secret_type\n end", "def secret\n @secret ||= (\n defined?(Rails) && Rails.application.credentials&.dig(:secret_key_base)\n ) || raise(StandardError, SECRET_MISSING_ERROR)\n end", "def oauth_token_secret\n @json['oauthTokenSecret']\n end", "def get_AccessTokenSecret()\n \t return @outputs[\"AccessTokenSecret\"]\n \tend", "def secret_id(role_name, secret_id)\n opts = { secret_id: secret_id }\n json = client.post(\"/v1/auth/approle/role/#{encode_path(role_name)}/secret-id/lookup\", JSON.fast_generate(opts), {})\n return nil unless json\n return Secret.decode(json)\n rescue HTTPError => e\n if e.code == 404 || e.code == 405\n begin\n json = client.get(\"/v1/auth/approle/role/#{encode_path(role_name)}/secret-id/#{encode_path(secret_id)}\")\n return Secret.decode(json)\n rescue HTTPError => e\n return nil if e.code == 404\n raise e\n end\n end\n\n raise\n end", "def fetch_webhook_secret\n\n webhook_secrets = KitSaasSharedCacheManagement::WebhookSecret.new([@client_id]).fetch[@client_id]\n if webhook_secrets.blank?\n return error_with_data(\n 's_cm_ws_r_1',\n 'something_went_wrong',\n GlobalConstant::ErrorAction.default,\n @client_id\n )\n end\n\n @webhook_secrets_data = webhook_secrets\n\n success\n end", "def get_OAuthTokenSecret()\n \t return @outputs[\"OAuthTokenSecret\"]\n \tend", "def secret\n # EDITOR='code --wait' rails credentials:edit\n # Rails.application.credentials.jwt_secret\n # Use environmental variables for Heroku\n ENV['jwt_secret']\n end", "def show\n @secret_word = SecretWord.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @secret_word }\n end\n end", "def get_decrypted_secret_key\n client = Client.get_from_memcache(self.client_id)\n r = Aws::Kms.new('saas', 'saas').decrypt(client.api_salt)\n return r unless r.success?\n\n api_salt_d = r.data[:plaintext]\n\n LocalCipher.new(api_salt_d).decrypt(self.secret_key)\n end", "def load_secret\n if config[:secret] then config[:secret]\n else ::SecureDataBag::Item.load_secret(secret_file)\n end\n end", "def access_token_secret\n credentials['secret']\n end", "def show\n render :json => @secret_key.to_json({})\n end", "def secret_key\n \"\"\n end", "def get_password(type, key, password = nil)\n if ['db', 'user', 'service'].include?(type)\n secret node['openstack']['secret'][\"#{type}_passwords_data_bag\"], key, password\n else\n ::Chef::Log.error(\"Unsupported type for get_password: #{type}\")\n end\n end", "def get_secret_word\n @active_list.fetch(0)\n end", "def get_secret_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SecretStoreItemApi.get_secret ...'\n end\n # unbox the parameters from the hash\n store_id = opts[:'store_id']\n secret_name = opts[:'secret_name']\n # verify the required parameter 'store_id' is set\n if @api_client.config.client_side_validation && store_id.nil?\n fail ArgumentError, \"Missing the required parameter 'store_id' when calling SecretStoreItemApi.get_secret\"\n end\n # verify the required parameter 'secret_name' is set\n if @api_client.config.client_side_validation && secret_name.nil?\n fail ArgumentError, \"Missing the required parameter 'secret_name' when calling SecretStoreItemApi.get_secret\"\n end\n # resource path\n local_var_path = '/resources/stores/secret/{store_id}/secrets/{secret_name}'.sub('{' + 'store_id' + '}', CGI.escape(store_id.to_s)).sub('{' + 'secret_name' + '}', CGI.escape(secret_name.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'SecretResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"SecretStoreItemApi.get_secret\",\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: SecretStoreItemApi#get_secret\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def google_secret\n Google::APIClient::ClientSecrets.new(\n { \"web\" =>\n { \"access_token\" => current_user.oauth_token,\n \"refresh_token\" => current_user.oauth_refresh_token,\n \"client_id\" => Rails.application.secrets.google_client_id,\n \"client_secret\" => Rails.application.secrets.google_client_secret,\n }\n }\n )\n end", "def index\n @secrets = Secret.where(user_id: current_user.id)\n end", "def secret\n source.split('/')[-1].split('_')[1]\n end", "def secret\n 's3cr37'\n end", "def secret_key\n ActionController::Base.session_options[:secret]\n end", "def update_secret\n resource.refresh_secret!\n\n respond_to do |format|\n format.json { render json: { secret: resource.secret } }\n end\n end", "def secret\n \"whatamidoing\"\n end", "def get_secrets(opts = {})\n data, _status_code, _headers = get_secrets_with_http_info(opts)\n data\n end", "def secret_key\n jwt_config['secret_key']\n end", "def generate_secret\n @secret = (1..4).map{ rand(10).to_s }.join \"\"\n @is_showing_secret = true\n return @secret\n end", "def secret\n base64_decoded_jwt_secret || client_options.secret\n end", "def decrypted_secret_key\n @decrypted_secret_key ||= get_decrypted_secret_key_from_memcache.data[:plaintext]\n end", "def get key\n deserialize backend.get key.to_s rescue nil\n end", "def get_secret_key\n secret_key = ''\n return '' unless File.file? SECRET_KEY_FILE\n open(SECRET_KEY_FILE) do |file|\n file.each do |line|\n if line.include? 'TKTAuthSecret'\n secret_key = line.gsub('TKTAuthSecret', '').strip.gsub(\"\\\"\", '')\n break\n end\n end\n end\n secret_key\n end", "def show\n if current_user.nil?\n redirect_to root_path\n # Redirects to secrets index when te user tries to access another user secret\n elsif @secret.user_id != current_user.id\n redirect_to secrets_path\n else\n @algorithm_name = CriptoAlgorithms.names\n @key = params[:key] #unsafe? :v\n end\n end", "def get_password(type, key)\n unless [:db, :user, :service, :token].include?(type)\n Chef::Log.error \"Unsupported type for get_password: #{type}\"\n return\n end\n\n if node[:garcon][:use_databags]\n if type == :token\n secret node[:garcon][:secret][:secrets_data_bag], key\n else\n secret node[:garcon][:secret][\"#{type}_passwords_data_bag\"], key\n end\n else\n node[:garcon][:secret][key][type]\n end\n end", "def index\n logger.debug(\"get secret page\")\n end", "def get_json_value(secret_id)\n response = get_value(secret_id)\n MultiJson.load(response)\n end", "def token_secret\n config_method_not_implemented\n end", "def secret\n # ````'badbreathbuffalo'\n\n # Hide in React Auth pt2 1:20:00 \n # ```ENV['jwt_secret']\n # Export in ~/.bash_profile\n # export jwt_secret = 'badbreathbuffalo'\n\n # OR\n\n # $ EDITOR='code --wait' rails credentials:edit\n # Add to the bottom of the file:\n # `jwt_secret: 'badbreathbuffalo'`\n # Save and close the file\n Rails.application.credentials.jwt_secret\n\n # Heroku Config Vars\n # ```ENV['jwt_secret']\n end", "def set_secret_code\n @secret_code = SecretCode.find(params[:id])\n end", "def set_APISecret(value)\n set_input(\"APISecret\", value)\n end", "def set_APISecret(value)\n set_input(\"APISecret\", value)\n end", "def set_APISecret(value)\n set_input(\"APISecret\", value)\n end", "def set_APISecret(value)\n set_input(\"APISecret\", value)\n end", "def set_APISecret(value)\n set_input(\"APISecret\", value)\n end", "def set_APISecret(value)\n set_input(\"APISecret\", value)\n end", "def set_APISecret(value)\n set_input(\"APISecret\", value)\n end", "def set_APISecret(value)\n set_input(\"APISecret\", value)\n end", "def set_APISecret(value)\n set_input(\"APISecret\", value)\n end", "def set_APISecret(value)\n set_input(\"APISecret\", value)\n end", "def set_APISecret(value)\n set_input(\"APISecret\", value)\n end", "def set_APISecret(value)\n set_input(\"APISecret\", value)\n end", "def set_APISecret(value)\n set_input(\"APISecret\", value)\n end", "def set_APISecret(value)\n set_input(\"APISecret\", value)\n end", "def set_APISecret(value)\n set_input(\"APISecret\", value)\n end", "def set_APISecret(value)\n set_input(\"APISecret\", value)\n end", "def set_APISecret(value)\n set_input(\"APISecret\", value)\n end", "def set_APISecret(value)\n set_input(\"APISecret\", value)\n end", "def set_APISecret(value)\n set_input(\"APISecret\", value)\n end", "def set_APISecret(value)\n set_input(\"APISecret\", value)\n end" ]
[ "0.7861695", "0.7570085", "0.7257975", "0.71788913", "0.715328", "0.70748", "0.7073112", "0.7039963", "0.7020124", "0.70143735", "0.69242084", "0.6916224", "0.6916224", "0.6913969", "0.68782926", "0.6830732", "0.68221384", "0.68221384", "0.68221384", "0.68221384", "0.67820835", "0.6775864", "0.6775864", "0.67503124", "0.6706074", "0.669603", "0.66639477", "0.6663931", "0.6663931", "0.6663931", "0.65286946", "0.65125716", "0.65006536", "0.64732295", "0.64698035", "0.64466316", "0.6423443", "0.63829213", "0.6380615", "0.6358323", "0.6345264", "0.63279426", "0.6284619", "0.6274813", "0.62598795", "0.62569773", "0.62263924", "0.6223259", "0.6206684", "0.61483276", "0.61357635", "0.6117885", "0.60889834", "0.6086926", "0.60696495", "0.6055729", "0.60361445", "0.6020927", "0.60007757", "0.5986856", "0.5973708", "0.59658194", "0.59651", "0.5952121", "0.59449834", "0.593145", "0.5930019", "0.59192765", "0.5917392", "0.59135634", "0.5901188", "0.58950603", "0.5891443", "0.5883263", "0.5874679", "0.5869441", "0.58596456", "0.58479667", "0.58456445", "0.58454823", "0.58388513", "0.58388513", "0.58388513", "0.58388513", "0.58388513", "0.58388513", "0.58388513", "0.58388513", "0.58388513", "0.58388513", "0.58388513", "0.58388513", "0.58388513", "0.58388513", "0.58388513", "0.58388513", "0.58388513", "0.58388513", "0.58388513", "0.58388513" ]
0.7575617
1
Revoke an API Secret.
def revoke(secret_id) request('/accounts/' + account_id + '/secrets/' + secret_id, type: Delete) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def revoke\n post('/api/revoke')\n end", "def revoke(user_id)\n require_user\n\n user = User.find(user_id)\n user.secrets.each do |secret|\n secret.destroy\n end\n\n user.destroy\n end", "def decrypt_api_secret\n @api_secret_d = @client_api_detail.decrypted_api_secret\n success\n end", "def revoke\n oauth_access_token.revoke\n head :ok\n end", "def revoke\n @session.do_rpc_endpoint('/revoke')\n nil\n end", "def revoke(access_token)\n option = {\n url: \"#{api_origin}/api/revoke\",\n header: {\n \"Content-Type\": \"application/x-www-form-urlencoded\",\n Authorization: \"Bearer #{access_token}\",\n }\n }\n response = post(option)\n JSON.parse(response.body)\n end", "def revoke!\n self.class.transaction do\n update_attribute :revoked, Time.now\n client.increment! :tokens_revoked\n end\n end", "def revoke_token\n raise 'To be implemented in child classes'\n end", "def delete_secret_key\n\t\takey = GPGME::Key.find(:secret, @dname)\n\t\takey.each do |akey|\n\t\takey.delete!(allow_secret = true)\n\t\tend\n\tend", "def destroy_secret_version project_id:, secret_id:, version_id:\n # Create a Secret Manager client.\n client = Google::Cloud::SecretManager.secret_manager_service\n\n # Build the resource name of the secret version.\n name = client.secret_version_path(\n project: project_id,\n secret: secret_id,\n secret_version: version_id\n )\n\n # Destroy the secret version.\n response = client.destroy_secret_version name: name\n\n # Print a success message.\n puts \"Destroyed secret version: #{response.name}\"\nend", "def revoke\n raise \"Implement me!\"\n end", "def delete_secret(opts = {})\n delete_secret_with_http_info(opts)\n nil\n end", "def revoke!\n update(revoked_at: Time.zone.now)\n end", "def revoke_oauth_token\n current_user.revoke_token\n end", "def revoke!\n return if revoked?\n update(revoked_at: Time.now)\n tokens.update_all(revoked_at: Time.now, updated_at: Time.now)\n end", "def revoke!\n self[:revoked] = Time.now\n save\n Client[client_id].token_revoked\n end", "def revoke\n @token = current_user.tokens.where(token: params[:token]).first!\n @token.invalidate!\n\n respond_with(@token) do |format|\n format.html { redirect_to([:client_applications], notice: \"You've revoked the authorization for the application '#{@token.client_application.name}'.\") }\n end\n end", "def destroy\n @secret.destroy\n head :no_content\n end", "def revoke\n @resource_access_token = finder.find(params[:id])\n revoked_response = ResourceAccessTokens::RevokeService.new(current_user, resource, @resource_access_token).execute\n\n if revoked_response.success?\n flash[:notice] = _(\"Revoked access token %{access_token_name}!\") % { access_token_name: @resource_access_token.name }\n else\n flash[:alert] = _(\"Could not revoke access token %{access_token_name}.\") % { access_token_name: @resource_access_token.name }\n end\n\n redirect_to resource_access_tokens_path\n end", "def destroy\n authorize @secret, :destroy?\n\n @secret.destroy\n respond_to do |format|\n format.html { redirect_to secrets_url, notice: 'Secret was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n conf.delete 'api'\n end", "def destroy\n @secret_key.destroy\n respond_to do |format|\n format.html { redirect_to secret_keys_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @secret = Secret.find(params[:id])\n if current_user == @secret.user\n @secret.destroy\n end\n redirect_to \"/users/#{session[:user_id]}\"\n end", "def destroy\n secret = Secret.find(params[:id])\n secret.destroy\n redirect_to \"/users/#{secret.user_id}\"\n end", "def unlock(secret)\n secret.locked = false\n secret.unlocked_value = YAML.load(security.decrypt(secret.value))\n secret\n end", "def revoke( doi )\n #puts \"=====> revoke #{doi}\"\n url = \"#{self.url}/dois/#{doi}\"\n status, _ = rest_put( url, nil )\n return status\n end", "def revoke_token\n request @google + '/accounts/AuthSubRevokeToken'\n\n @session_token = false\n end", "def destroy\n\n api_key = ApiKey.where(access_token: token).first\n\n api_key.access_token = ''\n api_key.expires_at = Time.now\n\n if api_key.save\n render json: {}, status: 200\n else\n render json: {}, status: 422\n end\n end", "def revoke\n # The authorization server first validates the client credentials\n if doorkeeper_token && doorkeeper_token.accessible?\n # Doorkeeper does not use the token_type_hint logic described in the RFC 7009\n # due to the refresh token implementation that is a field in the access token model.\n revoke_token(request.POST['token']) if request.POST['token']\n end\n # The authorization server responds with HTTP status code 200 if the\n # token has been revoked successfully or if the client submitted an invalid token\n render json: {}, status: 200\n end", "def destroy\r\n @secret = Secret.find(params[:id])\r\n @secret.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(:action => 'index') }\r\n format.xml { head :ok }\r\n end\r\n end", "def revoke_authorization user_id\n credentials = get_credentials user_id\n if credentials\n begin\n @token_store.delete user_id\n ensure\n credentials.revoke!\n end\n end\n nil\n end", "def revoke( doi )\n #puts \"=====> revoke #{doi}\"\n url = \"#{self.url}/dois/#{doi}\"\n status, _ = rest_put( url, {event: 'hide'} )\n return status\n end", "def recover_deleted_secret(secret_name, api_version, opts = {})\n data, _status_code, _headers = recover_deleted_secret_with_http_info(secret_name, api_version, opts)\n data\n end", "def revoke(params)\n params[:key] = 'attributes'\n\n run_command :revoke, :domain, params\n end", "def delete\n client.delete_access_key(resource_options)\n nil\n end", "def recreate_secret(opts = {})\n data, _status_code, _headers = recreate_secret_with_http_info(opts)\n data\n end", "def revoke_token(refresh_token_or_access_token)\n data = { \"token\" => refresh_token_or_access_token }\n query_api(\"/auth/revoke?\" + URI.encode_www_form(data))\n return nil\n end", "def revoke_token(refresh_token_or_access_token)\n data = { \"token\" => refresh_token_or_access_token }\n query_api(\"/auth/revoke?\" + URI.encode_www_form(data))\n return nil\n end", "def refresh_secret!\n set_secret\n save!\n end", "def revoke(access)\n token =\n if access.is_a?(String)\n access\n elsif access.respond_to?(:refresh_token)\n access.refresh_token\n else\n access.access_token\n end\n post('/api/v1/revoke_token', token: token)\n end", "def reset_secret_key\n r = Aws::Kms.new('saas', 'saas').decrypt(@client.api_salt)\n return r unless r.success?\n\n api_salt_d = r.data[:plaintext]\n\n client_api_secret_d = SecureRandom.hex\n\n r = LocalCipher.new(api_salt_d).encrypt(client_api_secret_d)\n return r unless r.success?\n\n client_api_secret_e = r.data[:ciphertext_blob]\n\n @client_webhook_setting.secret_key = client_api_secret_e\n @client_webhook_setting.set_decrypted_secret_key(client_api_secret_d)\n @client_webhook_setting.source = GlobalConstant::AdminActivityChangeLogger.web_source\n\n @client_webhook_setting.save! if @client_webhook_setting.changed?\n end", "def destroy\n @api_key.update(active: false)\n respond_to do |format|\n format.html { redirect_to admin_api_keys_url, notice: 'Api key was successfully deactivated.' }\n format.json { head :no_content }\n end\n end", "def revoke\n @invitation = Invitation.with_token!(params[:id])\n\n authorize! @invitation\n\n @invitation.destroy\n\n redirect_to :back, notice: \"Successfully revoked\n invitation for #{@invitation.email}\"\n end", "def purge_deleted_secret_with_http_info(secret_name, api_version, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DeletedSecretsApi.purge_deleted_secret ...'\n end\n # verify the required parameter 'secret_name' is set\n if @api_client.config.client_side_validation && secret_name.nil?\n fail ArgumentError, \"Missing the required parameter 'secret_name' when calling DeletedSecretsApi.purge_deleted_secret\"\n end\n # verify the required parameter 'api_version' is set\n if @api_client.config.client_side_validation && api_version.nil?\n fail ArgumentError, \"Missing the required parameter 'api_version' when calling DeletedSecretsApi.purge_deleted_secret\"\n end\n # resource path\n local_var_path = '/deletedsecrets/{secret-name}'.sub('{' + 'secret-name' + '}', secret_name.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'api-version'] = api_version\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DeletedSecretsApi#purge_deleted_secret\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update_secret\n resource.refresh_secret!\n\n respond_to do |format|\n format.json { render json: { secret: resource.secret } }\n end\n end", "def set_APISecret(value)\n set_input(\"APISecret\", value)\n end", "def set_APISecret(value)\n set_input(\"APISecret\", value)\n end", "def set_APISecret(value)\n set_input(\"APISecret\", value)\n end", "def set_APISecret(value)\n set_input(\"APISecret\", value)\n end", "def set_APISecret(value)\n set_input(\"APISecret\", value)\n end", "def set_APISecret(value)\n set_input(\"APISecret\", value)\n end", "def set_APISecret(value)\n set_input(\"APISecret\", value)\n end", "def set_APISecret(value)\n set_input(\"APISecret\", value)\n end", "def set_APISecret(value)\n set_input(\"APISecret\", value)\n end", "def set_APISecret(value)\n set_input(\"APISecret\", value)\n end", "def set_APISecret(value)\n set_input(\"APISecret\", value)\n end", "def set_APISecret(value)\n set_input(\"APISecret\", value)\n end", "def set_APISecret(value)\n set_input(\"APISecret\", value)\n end", "def set_APISecret(value)\n set_input(\"APISecret\", value)\n end", "def set_APISecret(value)\n set_input(\"APISecret\", value)\n end", "def set_APISecret(value)\n set_input(\"APISecret\", value)\n end", "def set_APISecret(value)\n set_input(\"APISecret\", value)\n end", "def set_APISecret(value)\n set_input(\"APISecret\", value)\n end", "def set_APISecret(value)\n set_input(\"APISecret\", value)\n end", "def set_APISecret(value)\n set_input(\"APISecret\", value)\n end", "def set_APISecret(value)\n set_input(\"APISecret\", value)\n end", "def set_APISecret(value)\n set_input(\"APISecret\", value)\n end", "def set_APISecret(value)\n set_input(\"APISecret\", value)\n end", "def set_APISecret(value)\n set_input(\"APISecret\", value)\n end", "def set_APISecret(value)\n set_input(\"APISecret\", value)\n end", "def set_APISecret(value)\n set_input(\"APISecret\", value)\n end", "def set_APISecret(value)\n set_input(\"APISecret\", value)\n end", "def set_APISecret(value)\n set_input(\"APISecret\", value)\n end", "def set_APISecret(value)\n set_input(\"APISecret\", value)\n end", "def set_APISecret(value)\n set_input(\"APISecret\", value)\n end", "def set_APISecret(value)\n set_input(\"APISecret\", value)\n end", "def set_APISecret(value)\n set_input(\"APISecret\", value)\n end", "def set_APISecret(value)\n set_input(\"APISecret\", value)\n end", "def set_APISecret(value)\n set_input(\"APISecret\", value)\n end", "def set_APISecret(value)\n set_input(\"APISecret\", value)\n end", "def set_APISecret(value)\n set_input(\"APISecret\", value)\n end", "def set_APISecret(value)\n set_input(\"APISecret\", value)\n end", "def set_APISecret(value)\n set_input(\"APISecret\", value)\n end", "def set_APISecret(value)\n set_input(\"APISecret\", value)\n end", "def set_APISecret(value)\n set_input(\"APISecret\", value)\n end", "def set_APISecret(value)\n set_input(\"APISecret\", value)\n end", "def set_APISecret(value)\n set_input(\"APISecret\", value)\n end", "def set_APISecret(value)\n set_input(\"APISecret\", value)\n end", "def set_APISecret(value)\n set_input(\"APISecret\", value)\n end", "def remove\n get_credentials\n begin\n response = resource[\"/remove/#{app}\"].post(:apikey => @credentials[1])\n rescue RestClient::InternalServerError\n display \"An error has occurred.\"\n end\n display response.to_s\n end", "def regenerate_apikey(uid)\n current_path = \"/api/v1/users/#{uid}/api-keys\"\n @conn.delete(current_path)\n end", "def revoke_token(body:,\n authorization:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::POST,\n '/oauth2/revoke',\n 'default')\n .header_param(new_parameter('application/json', key: 'Content-Type'))\n .body_param(new_parameter(body))\n .header_param(new_parameter(authorization, key: 'Authorization'))\n .header_param(new_parameter('application/json', key: 'accept'))\n .body_serializer(proc do |param| param.to_json unless param.nil? end))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end", "def destroy\n @secret.destroy\n respond_to do |format|\n format.html { redirect_to secrets_url, notice: 'Secret was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @secret.destroy\n respond_to do |format|\n format.html { redirect_to secrets_url, notice: 'El secreto se eliminó correctamente.' }\n format.json { head :no_content }\n end\n end", "def on_revoke(*)\n disconnect(:token_revoked)\n fail SlackBotManager::TokenRevoked\n end", "def revoke_token(token, params = nil, opts = nil)\n super\n .tap { |result| __ext_debug(\"--> #{result.inspect}\") }\n end", "def destroy\n puts \"In Secrets destroy method: params are: \", params.inspect\n @secret = Secret.find(params[:secret_id])\n puts \"@secret found in destroy method is: \", @secret\n if current_user.id == @secret.user.id\n puts \"Current user is the Secret Owner. Destroying secret...\"\n @secret.destroy\n puts \"@secret after destroy: \", @secret\n redirect_to \"/users/#{current_user.id}\"\n else\n # puts \"Something went wrong in Secret destroy\"\n redirect_to \"/users/#{current_user.id}\"\n end\n end", "def revoke_access_token\n\t\t\tif session[:token]\n\t\t\t\t# Use either the refresh or access token to revoke if present.\n\t\t\t\ttoken = session[:token].to_hash[:refresh_token]\n\t\t\t\ttoken = session[:token].to_hash[:access_token] unless token\n\n\t\t\t\t# You could reset the state at this point, but as-is it will still stay unique\n\t\t\t\t# to this user and we're avoiding resetting the client state.\n\t\t\t\tsession.delete(:state)\n\t\t\t\tsession.delete(:token)\n\n\t\t\t\t# Send the revocation request and return the result.\n\t\t\t\trevokePath = 'https://accounts.google.com/o/oauth2/revoke?token=' + token\n\t\t\t\turi = URI.parse revokePath\n\t\t\t\trequest = Net::HTTP.new uri.host, uri.port\n\t\t\t\trequest.use_ssl = true\n\t\t\t\trequest.get uri.request_uri\n\t\t\tend\n\t\tend", "def destroy\n @api_key = ApiKey.find(params[:id])\n @api_key.destroy\n redirect_to profile_path\n end", "def destroy\n @secret_word = SecretWord.find(params[:id])\n @secret_word.destroy\n\n respond_to do |format|\n format.html { redirect_to secret_words_url }\n format.json { head :ok }\n end\n end" ]
[ "0.70278716", "0.68591785", "0.6726838", "0.67246026", "0.6722175", "0.66734755", "0.65290856", "0.64716893", "0.64186555", "0.6398145", "0.63798296", "0.63777775", "0.6376802", "0.63757986", "0.6338414", "0.62342596", "0.6228308", "0.61449856", "0.6137439", "0.61210626", "0.61010975", "0.60993236", "0.60710686", "0.60682005", "0.6065309", "0.60116124", "0.5998039", "0.59467256", "0.5928627", "0.5923164", "0.5921424", "0.5917514", "0.58982754", "0.5890343", "0.5873967", "0.5857511", "0.5816916", "0.5816916", "0.5810444", "0.58082515", "0.58064824", "0.5791898", "0.575159", "0.57342285", "0.5730731", "0.5726279", "0.5726279", "0.5726279", "0.5726279", "0.5726279", "0.5726279", "0.5726279", "0.5726279", "0.5726279", "0.5726279", "0.5726279", "0.5726279", "0.5726279", "0.5726279", "0.5726279", "0.5726279", "0.5726279", "0.5726279", "0.5726279", "0.5726279", "0.5726279", "0.5726279", "0.5726279", "0.5726279", "0.5726279", "0.5726279", "0.5726279", "0.5726279", "0.5726279", "0.5726279", "0.5726279", "0.5726279", "0.5726279", "0.5726279", "0.5726279", "0.5726279", "0.5726279", "0.5726279", "0.5726279", "0.5726279", "0.5726279", "0.5726279", "0.5726279", "0.5726279", "0.5725492", "0.5686417", "0.5685546", "0.5684647", "0.56757116", "0.56699747", "0.56681997", "0.5667197", "0.5661799", "0.56573784", "0.5640074" ]
0.7718061
0
All the behavior we want the class CookBook to do C: add all the recipes
def add_recipe(recipe) @recipes << recipe write_csv end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(name)\n @cookbook.add_recipe(name)\n end", "def add_to_cookbook(recipe)\n @cookbook.push(recipe)\n end", "def setup\n recipes.each { |rcp| rcp.setup }\n end", "def cook(&block)\n the_recipes = [\n self.class.standard_recipes,\n self.base_recipe,\n self.recipes,\n (block_given? ? block : nil)\n ].flatten.compact.uniq\n the_recipes.each do |r|\n if r.is_a?(Proc)\n self.cap_config.load(:proc => r)\n else # assume recipe filename\n self.cap_config.load(:file => r)\n end\n end\n @cooked = true\n self.cap_config\n end", "def use(new_recipe)\n recipes.push(new_recipe)\n end", "def add_attributes_to_recipes\n EasyVegan::Recipe.all.each do |recipe|\n recipe.add_recipe_attributes(EasyVegan::Scraper.scrape_recipe_page(recipe.url))\n #binding.pry\n end\n end", "def find_recipes_that_use_me_and_create_link\n my_recipes = Recipe.search_recipe_ingredient_lists_for_ingredient(self)\n my_recipes.each {|recipe| self.recipes << recipe}\n end", "def initialize(name)\r\n @name = name \r\n @recipes = [] #all recipes that use this ingredients \r\n \r\n @@all << self \r\n end", "def setup_recipe(servings = nil)\n @prepsteps_list = []\n unless prepsteps.nil?\n @prepsteps_list = Skill.add_skill_links(prepsteps).split(\"\\n\").map {|line| line.chomp}\n end\n \n @cooksteps_list = []\n unless cooksteps.nil?\n @cooksteps_list = Skill.add_skill_links(cooksteps).split(\"\\n\").map {|line| line.chomp}\n end\n \n @new_servings = servings\n end", "def recipes\n @recipes ||= []\n end", "def cookbook_runlist\n verify_cookbook_creation\n\n Souschef::Print.header 'Berkshelf configuration'\n Souschef::Berkshelf.new(@opts).berks_create\n Souschef::Print.header 'Configure gemfile'\n Souschef::Gemfile.new(@opts).write\n Souschef::Print.header 'Create essential template files'\n Souschef::Template.run(@opts)\n # Mock Scaffold to generate default recipe and tests\n\n Souschef::Print.header 'Create default recipe and tests'\n Souschef::Scaffold.new(path: @opts[:path],\n recipe: 'default',\n profile: @opts[:profile],\n force: true,\n verbose: @opts[:verbose]).start\n\n Souschef::Print.header 'Testkitchen configuration'\n Souschef::Testkitchen.new(@opts).setup\n\n Souschef::Print.header \"Don't forget to run bundle install!\"\n end", "def recipes\n @_recipes ||= (\n %w[dorc **/*.rake].map { |f| Dir[File.join(DO_PATH, f)] }.flatten +\n %w[./Do ./Dofile].map { |f| File.expand_path(f) } <<\n File.expand_path('../common.rb', __FILE__)\n ).reject { |f| !File.exist?(f) }\n end", "def recipe args=1\n self.summary.recipe args\n end", "def initialize(ingredient, recipe)\n @recipe = recipe\n @ingredient = ingredient\n @@all << self\n end", "def initialize\n @cook_id = 0\n @recipe_id = 0\n @hungry = true\n @recipes = []\n @cooking_shortcuts = []\n init_cooking_shortcuts\n end", "def recipe(name, description)\n @recipes[name] = description\n end", "def setup_discover\n return if @recipes.blank?\n \n @recipes.each do |recipe|\n recipe.setup_recipe\n end\n @have_ingredients = current_user.kitchen.have_ingredients\n @starred_ids = current_user.kitchen.starred_meal_ingredient_ids \n @my_meals_ids = current_user.kitchen.my_meals_recipe_ids\n end", "def add_ingredients(ingredients)\n RecipeIngredient.new(ingredients, self)\nend", "def all\n # returns all recipes\n @recipes\n end", "def add_recipe(name)\n name = \"recipe[#{name}]\" unless name =~ /^recipe\\[(.+?)\\]$/\n run_list << name\n end", "def add_to_course\n @course.recipes << self unless @course.recipes.include?(self)\n end", "def test_recipe_within_recipe\n @fdb = setup\n idk = Recipe.new(\"Double PB&J\", [@fdb.get_recipe(\"PB&J Sandwich\"), @fdb.get_recipe(\"PB&J Sandwich\")])\n \n bool = @fdb.add_recipe(\"Double PB&J\", [\"PB&J Sandwich\", \"PB&J Sandwich\"])\n assert(bool == true, \"whoops fuck you\")\n end", "def add_recipe(name)\n name = \"recipe[#{name}]\" unless name =~ /^recipe\\[(.+?)\\]$/\n run_list << name\n end", "def create\n recipe_name = @view.ask_name\n recipe_description = @view.ask_description\n recipe = Recipe.new(recipe_name, recipe_description)\n @cookbook.add_recipe(recipe)\n @view.listing\n end", "def cook\n @bread.mix\n @bread.let_rise\n @bread.bake\n end", "def add_recipe(recipe)\n @recipes.push(recipe)\n save\n end", "def method_missing(meth_name, *args, &block)\n raise \"No method named: #{meth_name}\" unless recipe.respond_to? meth_name\n recipe.send(meth_name, *args, &block)\n end", "def loaded_recipe(cookbook, recipe)\n fully_qualified_recipe = \"#{cookbook}::#{recipe}\"\n\n automatic_attrs[:recipes] << fully_qualified_recipe unless Array(self[:recipes]).include?(fully_qualified_recipe)\n end", "def cookbook_order\n @cookbook_order ||= begin\n ordered_cookbooks = []\n seen_cookbooks = {}\n run_list_expansion.recipes.each do |recipe|\n cookbook = Chef::Recipe.parse_recipe_name(recipe).first\n add_cookbook_with_deps(ordered_cookbooks, seen_cookbooks, cookbook)\n end\n logger.debug(\"Cookbooks to compile: #{ordered_cookbooks.inspect}\")\n ordered_cookbooks\n end\n end", "def compile_recipes\n events.recipe_load_start(run_list_expansion.recipes.size)\n run_list_expansion.recipes.each do |recipe|\n\n path = resolve_recipe(recipe)\n run_context.load_recipe(recipe)\n events.recipe_file_loaded(path, recipe)\n rescue Chef::Exceptions::RecipeNotFound => e\n events.recipe_not_found(e)\n raise\n rescue Exception => e\n events.recipe_file_load_failed(path, e, recipe)\n raise\n\n end\n events.recipe_load_complete\n end", "def model_recipes(args)\n options = set_model_recipes_defaults(args)\n set_common_options(options)\n set_model_recipes_order_by_clause(options)\n \n if options[:b_return_list]\n if options[:b_filter_by]\n # recipes for this chef which have been given a thumbs up or down \n recipes_list = Recipe.where(\"recipes.chef_id = ?\", options[:chef_id]) \\\n .joins(:likes).where(\"likes.like = ?\", options.has_key?(:b_filter_by_likes)) \\\n .reorder(options[:reorder_clause])\n elsif options[:b_forChef]\n # get list of recipes for specified chef.\n recipes_list = Recipe.where(\"recipes.chef_id = ?\", options[:chef_id]).reorder(options[:reorder_clause])\n elsif options[:b_forStyle]\n # get list of recipes for specified style.\n recipes_list = Recipe.all.joins(:styles).where(\"styles.id = ?\", options[:style_id]).reorder(options[:reorder_clause])\n else \n # get list of all recipes.\n if options[:b_order_by_chef]\n # Recipes are listed for each Chef. Chefs are list alphabetically.\n recipes_list = Recipe.all.joins(\"left join chefs on chefs.id = recipes.chef_id\") \\\n .reorder(\"chefs.name ASC\") \\\n .order(options[:reorder_clause])\n elsif options[:b_order_by_popular]\n # Recipes are list by number of thumbs up votes. Most is first.\n recipes_list = Recipe.all.joins(:likes).where(\"likes.like = ?\", \"t\") \\\n .select(\"recipes.*, count(likes.like) as num_votes\").group(\"recipes.id\") \\\n .reorder(\"num_votes DESC\").order(options[:reorder_clause])\n elsif options[:b_order_by_reviews]\n # Recipes are list by number of reviews for each recipe. Most is first.\n recipes_list = Recipe.all.joins(:reviews) \\\n .select(\"recipes.*, count(reviews.id) as num_reviews\").group(\"recipes.id\") \\\n .reorder(\"num_reviews DESC\").order(options[:reorder_clause])\n else\n # in order calculated by defaults\n recipes_list = Recipe.all.reorder(options[:reorder_clause])\n end\n end\n end\n \n if options[:b_return_recipes_totals]\n totals = make_recipes_totals(options)\n end\n \n return model_make_results(options, recipes_list, totals) \n end", "def list\n recipes = @cookbook.all\n # byebug\n @view.display_recipes(recipes)\n end", "def add_recipe(recipe)\n @recipes << recipe\n # need to call save_to_csv\n save_to_csv\n end", "def recipe(&block)\n rules.last.recipe = block\n end", "def add_ingredients(ingredients)\n ingredients.each { |i| RecipeIngredient.new(self, i) }\n end", "def recipe_for(name)\n\t\t\tRecipe.new(self, name, self.instance_method(name))\n\t\tend", "def add_ingredients(ingredients)\n ingredients.each do |ingredient|\n RecipeIngredient.new(self, ingredient)\n end\n end", "def generate_recipes_list\n recipes = YARD::Registry.all(:recipe).uniq.sort_by {|recipe| recipe.Name.to_s}\n generate_full_list(recipes, 'Recipe', 'recipes')\nend", "def perform\n build_recipes # this returns array of recipes\n self # return the scrapper\n end", "def set_recipes(fridge)\r\n # put recipes you want to puts manumally\r\n recipe_ingredients = {\"Teriyaki\" =>[\"chicken\",\"sugar\",\"mirin\",\"soy sauce\"],\r\n \"Curry rice\" => [\"rice\",\"curry mix\",\"potato\",\"onion\",\"beef\",\"carrot\"],\r\n \"Oyakodon\" => [\"chicken\",\"sugar\",\"mirin\",\"soy sauce\",\"rice\",\"egg\",\"onion\"],\r\n \"Takoyaki\" => [\"flour\",\"octopus\",\"ginger\",\"dashi\"],\r\n \"Nikujyaga\" => [\"beef\",\"sugar\",\"mirin\",\"soy sauce\",\"carrot\",\"onion\",\"potato\"],\r\n \"Octopus Sashimi\" => [\"octopus\",\"soy sauce\"],\r\n \"Miso soup\" => [\"miso\",\"dashi\"]}\r\n\r\n # set recipes_array to make new instence of Recipe\r\n recipes_array = {\"Teriyaki\" => [\"http://natashaskitchen.com/2015/12/11/easy-teriyaki-chicken/\",15],\r\n \"Curry rice\" => [\"http://www.japanesecooking101.com/curry-and-rice-recipe/\",40],\r\n \"Oyakodon\" => [\"http://www.justonecookbook.com/oyakodon/\",30],\r\n \"Takoyaki\" => [\"http://www.justonecookbook.com/takoyaki-recipe/\",20],\r\n \"Nikujyaga\" => [\"http://www.justonecookbook.com/nikujaga/\",30],\r\n \"Octopus Sashimi\" => [\"http://www.makesushi.com/sashimi/\",5],\r\n \"Miso soup\" =>[ \"http://steamykitchen.com/106-simple-10-minute-miso-soup.html\",5]}\r\n\r\n # make new instance and put to fridge.recipes\r\n recipes_array.each do |key,value|\r\n new_recipe = Recipe.new(key,value[0],value[1])\r\n new_recipe.ingredients = recipe_ingredients[\"#{key}\"]\r\n fridge.recipes << new_recipe\r\nend # recipes_array each end\r\nend", "def create\n name = @view.ask_user_for_info(\"name\")\n description = @view.ask_user_for_info(\"description\")\n prep_time = @view.ask_user_for_attribute(\"prep_time\")\n difficulty = @view.ask_user_for_attribute(\"difficulty\")\n recipe = Recipe.new(name: name, description: description, prep_time: prep_time, difficulty: difficulty)\n @cookbook.add_recipe(recipe)\n end", "def load_recipes\n expand_node\n @recipes.each do |recipe|\n if @node.run_state[:seen_recipes].has_key?(recipe)\n Chef::Log.debug(\"I am not loading #{recipe}, because I have already seen it.\")\n next\n end\n Chef::Log.debug(\"Loading Recipe #{recipe}\")\n @node.run_state[:seen_recipes][recipe] = true\n\n rmatch = recipe.match(/(.+?)::(.+)/)\n if rmatch\n cookbook = @cookbook_loader[rmatch[1]]\n cookbook.load_recipe(rmatch[2], @node, @collection, @definitions, @cookbook_loader)\n else\n cookbook = @cookbook_loader[recipe]\n cookbook.load_recipe(\"default\", @node, @collection, @definitions, @cookbook_loader)\n end\n end\n true\n end", "def define_suits\n [{ 'name' => 'default',\n 'run_list' => [\"recipe[#{@cookbook}::default]\"],\n 'attributes' => 'nil' }]\n end", "def list\n display_recipes\n end", "def addRecipe(name, ingredients)\n calories = 0\n keys = @BasicHash.keys\n ingredients.each do |ingredient|\n ingredient.chomp!\n # if the ingredient is in the basicFood\n if @BasicHash.has_key? ingredient\n calories += @BasicHash[ingredient].calories.to_i\n else\n puts \"Can't find the ingredient\"\n puts \"#{ingredient}\"\n end\n #Making recipe object and adding it to the hash\n myrecipes = Recipe.new(name, ingredients, calories)\n @RecipeHash[name] = myrecipes\n end\n end", "def load_recipes(recipes)\n # loads a placeholder recipe hash in event of empty recipes value hash\n if recipes[\"recipes\"].empty? \n placeholder_recipe = {\"Placeholder\"=>[{\"flour\"=>0.5}]}\n RecipeBook.new(placeholder_recipe)\n else\n recipes[\"recipes\"].each do | recipe_name,recipe_ingredients |\n recipe = {\"#{recipe_name}\" => recipe_ingredients}\n recipe_name = RecipeBook.new(recipe)\n end\n end\nend", "def add_ingredient_to_recipe quantity, measure, food_item_name, recipe \n food_item = FoodItem.new(:name => food_item_name, :price => nil)\n ingredient = Ingredient.new(:food_item => food_item, :quantity => quantity, :measure => measure, :recipe_id => recipe.id)\n recipe.ingredients << ingredient\n end", "def script(name)\n @loaded_recipes ||= []\n require name\n @loaded_recipes << name\n end", "def add_ingredients(ingredients)\n ingredients.map do |ingredient|\n RecipeIngredient.new(self, ingredient)\n end \n end", "def register_cookbooks\n @cookbooks.each do |name, git_address|\n if ssh.exec? \"ls #{COOKBOOKS_PATH}/#{name}\"\n ssh.exec! \"cd #{COOKBOOKS_PATH}/#{name}; git pull origin master\", sudo: true\n else\n ssh.exec! \"git clone #{git_address} #{COOKBOOKS_PATH}/#{name}\", sudo: true\n end\n ssh.exec! \"berks vendored #{VENDOR_COOKBOOKS_PATH} --berksfile #{COOKBOOKS_PATH}/#{name}/Berksfile\"\n end\n end", "def test_add_recipe\n @fdb = setup\n assert(@fdb.recipes.length >= 2, \"at least 2 recipes were originally added from the file\")\n end", "def add_ingredients(ingre)\n ingre.each {|ingre| RecipeIngredient.new(self, ingre)}\n end", "def add_recipe(recipe)\n @recipes << recipe\n save_csv\n end", "def add_ingredients(ingredients_array)\n\t\tRecipeIngredient.new(ingredients_array, self)\n\tend", "def recipe_instances\n recipe_ingredients.map { |ri| ri.recipe }\n end", "def start_recipe\n @recipe.delete_recipes\n puts File.foreach(\"ingredient_list.txt\") { |line| puts line }\n puts \"What Ingredients do you have?\".colorize(:yellow)\n user_input = gets.chomp\n @recipe.search(user_input)\n self.print_recipe\n self.recipe_ask_for_options()\n end", "def helpers_including_recipes(included_recipes)\n @known_helpers_including_recipes.merge!(included_recipes)\n end", "def add_ingredients(ingredients_arr)\n ingredients_arr.each do |ingredient|\n RecipeIngredient.new(ingredient,self)\n end\n end", "def add_recipe(recipe:, multiplier: 1)\n full_names = recipe.ingredients_full_names(multiplier: multiplier)\n full_names.map { |ingredient| create_task(ingredient) }\n # TODO: count the responses instead of the given list\n full_names.count\n end", "def all\n @recipes\n end", "def all\n @recipes\n end", "def all\n @recipes\n end", "def apply_recipe(recipe)\n # Creates a random string name\n recipe_name = \"recipe~test~#{(0...8).map { (65 + rand(26)).chr }.join}\"\n recipe_loc = File.join(File.dirname(__FILE__), '..', 'recipes',\n \"#{recipe_name}.rb\")\n\n File.open(recipe_loc, 'w') do |file|\n file.write([build_cred, recipe].join(\"\\n\"))\n end\n recipe_path = \"google-gbigquery::#{recipe_name}\"\n begin\n yield recipe_path\n ensure\n File.delete(recipe_loc)\n end\n end", "def recipes\n # Loop through RecipeCard\n #Find cards for this user\n #Gather recipes on those cards\n self.recipe_cards.map do |recipecard|\n recipecard.recipe\n end\n end", "def system_recipe=(recipe)\n @system_recipe = recipe\n @recipes << recipe\n end", "def add_ingredients(new_ingredients_arr)\n new_ingredients_arr.each do |new_ingredients|\n #binding.pry\n RecipeIngredient.new(self, new_ingredients)\n end\nend", "def system_recipe\n raise NoSystemRecipe.new unless @system_recipe\n @system_recipe\n end", "def add_recipe(recipe)\n @recipes << recipe\n\n save_csv\n end", "def apply_recipe(recipe)\n # Creates a random string name\n recipe_name = \"recipe~test~#{(0...8).map { (65 + rand(26)).chr }.join}\"\n recipe_loc = File.join(File.dirname(__FILE__), '..', 'recipes',\n \"#{recipe_name}.rb\")\n\n File.open(recipe_loc, 'w') do |file|\n file.write([build_cred, recipe].join(\"\\n\"))\n end\n recipe_path = \"google-gcompute::#{recipe_name}\"\n begin\n yield recipe_path\n ensure\n File.delete(recipe_loc)\n end\n end", "def apply_recipe(recipe)\n # Creates a random string name\n recipe_name = \"recipe~test~#{(0...8).map { (65 + rand(26)).chr }.join}\"\n recipe_loc = File.join(File.dirname(__FILE__), '..', 'recipes',\n \"#{recipe_name}.rb\")\n\n File.open(recipe_loc, 'w') do |file|\n file.write([build_cred, recipe].join(\"\\n\"))\n end\n recipe_path = \"google-gcompute::#{recipe_name}\"\n begin\n yield recipe_path\n ensure\n File.delete(recipe_loc)\n end\n end", "def add_recipe(recipe)\n if database.has_key? recipe[0]\n puts('Recipe already in Database.')\n else\n ingredients_list = []\n recipe[1..-1].each do |ingredient|\n if database.has_key? ingredient\n temp = database[ingredient]\n ingredients_list.push(temp)\n else\n puts('Missing ingredient(s)')\n break\n end\n end\n temp = Recipe.new(recipe[0], ingredients_list)\n database[temp.name] = temp\n end\n end", "def add(name, description, ingredients, instructions)\n recipe = Bukaresep::Recipe.new(name, description, ingredients, instructions)\n\n return false unless recipe.valid?\n\n @service.add(recipe)\n end", "def all\n return @recipes\n end", "def set_recipes\n @recipes = Recipe.includes(:ingredients).all #includes will cache the ingredients info and keep it there for later use, instead of querying again for this info later when it is needed\n @message = \"No Recipes Found\" if @recipes.empty?\n end", "def install!\n include_recipe 'zypper'\n super\n end", "def cookbook\n require 'halite/gem'\n @cookbook ||= Halite::Gem.new(gemspec)\n end", "def save_dummy_cookbook_with_recipes(cookbook_name, cookbook_version, recipe_list)\n recipe_specs = normalize_recipe_specs(recipe_list)\n content_list = recipe_specs.map { |r| r[:content] }\n files = content_list.map { |content| Pedant::Utility.new_temp_file(content) }\n upload_files_to_sandbox(files)\n checksums = files.map { |f| Pedant::Utility.checksum(f) }\n recipes = recipe_specs.zip(checksums).map do |r, sum|\n dummy_recipe(r[:name], sum)\n end.sort { |a, b| a[:name] <=> b[:name] }\n opts = { :recipes => recipes }\n make_cookbook(admin_user, cookbook_name, cookbook_version, opts)\n end", "def method_missing(method, *args, &block)\n recipe = Recipe.create_recipe(self, method, *args, &block)\n if recipe\n if recipe.enabled # ignore recipe if not enabled (matching feature requirements)\n add_recipe(recipe)\n return recipe\n else\n BRIX11.log(2, \"[#{self}] recipe disabled\")\n return nil\n end\n end\n # calling super will cause error if method being called is invalid\n super\n end", "def initialize_setup\n super\n snippet_content_path = File.expand_path(File.join(static_content_path(__FILE__, 'cookbook_base'))) + '/.'\n @flavor.class.do_add_content do\n tocopy << [snippet_content_path]\n end\n end", "def process\n ChefObject.register(filename, :recipe, statement.file)\n end", "def recipes\n recipe_cards.map { |c| c.recipe }\n end", "def declare_cookbook_gems\n @flavor.class.do_declare_resources do\n if snippet?('cookbook_base')\n cookbook_gems['foodcritic'] = '~> 4.0'\n cookbook_gems['guard-foodcritic'] = '~> 1.1'\n end\n end\n end", "def recipe_condense\n @recipe_pools = []\n for recipe in $mix_recipes\n input, output = recipe[0], recipe[1]\n input_s = []\n for component in input\n #fill default values\n if component.length < 2\n component = [component[0],1,0]\n elsif component.length < 3\n component = [component[0], component[1], 0]\n end\n updated = false\n for item in input_s\n #condense items of the same type\n if component[0] == item[0] && component[1] == item[1]\n item[2] += component[2]\n updated = true\n break\n end\n end\n if !updated then input_s.push(component) end\n end\n #sort input_s to have highest-quality requirements first, makes\n #things easier later\n input_s.sort! { |a, b| a[2] <=> b[2] }\n @recipe_pools.push([input_s, output]) \n end\n end", "def test_add_multiple_recipes\n\t\tputs \"TEST 5\"\n\t\tassert( @db.empty?, \"DB should be empty\" )\n\n\t\t@db.addFood(\"burger\", \"124124\")\n\t\t@db.addFood(\"Bacon\", \"814\")\n\t\t@db.addFood(\"Lettuce\", \"12\")\n\t\t@db.addFood(\"Tomato\",\"14\")\n\t\t@db.addRecipe(\"BLT\" , [\"bacon\",\"lettuce\",\"tomato\"])\n\t\t@db.addRecipe(\"Bacon Burger\", [\"Bacon\",\"burger\"])\n\n\t\tassert( @db.size == 6, \"There should be 6 items in db, 4 foods, 2 recipes\")\n\t\tassert( @db.is_Recipe?(\"BLT\") , \"Should be BLT recipe\" )\n\t\tassert( @db.is_Recipe?(\"Bacon Burger\") , \"bacon burger should be a recipe\" )\n\t\t\n\t\t@db.addRecipe(\"BLT\" , [\"bacon\",\"lettuce\",\"tomato\"])\n\t\tassert( @db.size == 6, \"Cannot add duplicate recipies\")\n\n\t\t@db.addRecipe(\"NewRecipe\", [])\n\t\tassert( @db.size == 6, \"cannot add recipe with empty foods\")\n\n\t\t@db.addRecipe(\"Copy Recipe\", [\"bacon\", \"bacon\"])\n\t\tassert( @db.size == 7, \"Size should be 7, add copy food on recipe\")\n\n\tend", "def cookbook(name, options = {})\n @name = name\n @options = manipulate(options)\n end", "def cookbook_clean_start\n end", "def generate_cookbooks_list\n cookbooks = YARD::Registry.all(:cookbook).uniq.sort_by{|cookbook| cookbook.name.to_s}\n generate_full_list(cookbooks, 'Cookbooks', 'cookbooks')\nend", "def loaded_recipes\n node.run_context.loaded_recipes.map { |name| with_default(name) }\n end", "def loaded_recipes\n node.run_context.loaded_recipes.map { |name| with_default(name) }\n end", "def add_cookbook_with_deps(ordered_cookbooks, seen_cookbooks, cookbook)\n return false if seen_cookbooks.key?(cookbook)\n\n seen_cookbooks[cookbook] = true\n each_cookbook_dep(cookbook) do |dependency|\n add_cookbook_with_deps(ordered_cookbooks, seen_cookbooks, dependency)\n end\n ordered_cookbooks << cookbook\n end", "def ingredient_logic(ingredient)\n if all_ingredients.include?(ingredient)\n new_recipe_ingredient = ingredient_instance(ingredient)\n Recipe.last.ingredients << new_recipe_ingredient\n else\n new_recipe_ingredient = Ingredient.create(name: ingredient)\n Recipe.last.ingredients << new_recipe_ingredient\n end\n end", "def cookbook_collection\n run_context.cookbook_collection\n end", "def update_cookbooks()\n self.resolver.debug = self.options[:debug]\n unless File.exists?(\"cookbooks\")\n\tKitchenplan::Log.info \"No cookbooks directory found. Running Librarian to download necessary cookbooks.\"\n\tself.normaldo self.resolver.fetch_dependencies()\n\t#self.normaldo \"bin/librarian-chef install --clean #{(self.options[:debug] ? '--verbose' : '--quiet')}\"\n end\n if self.options[:update_cookbooks]\n\tKitchenplan::Log.info \"Updating cookbooks with #{self.resolver.name}\"\n\tself.normaldo self.resolver.update_dependencies()\n\t#self.normaldo \"bin/librarian-chef update #{(self.options[:debug] ? '--verbose' : '--quiet')}\"\n end\n end", "def dummy_recipe(name, checksum)\n {\n \"name\" => \"#{name}.rb\",\n \"path\" => \"recipes/#{name}.rb\",\n \"checksum\" => checksum,\n \"specificity\" => \"default\",\n }\n end", "def initialize(bundle)\n @description = bundle.to_s\n @thread_name = get_thread_name_from_bundle(bundle)\n @right_scripts_cookbook = RightScriptsCookbook.new(@thread_name)\n @scripts = bundle.executables.select { |e| e.is_a?(RightScriptInstantiation) }\n @only_scripts = bundle.executables.all? { |e| e.is_a?(RightScriptInstantiation) }\n run_list_recipes = bundle.executables.map { |e| e.is_a?(RecipeInstantiation) ? e : @right_scripts_cookbook.recipe_from_right_script(e) }\n @cookbooks = bundle.cookbooks\n @downloader = ReposeDownloader.new(bundle.repose_servers)\n @downloader.logger = Log\n @download_path = File.join(AgentConfig.cookbook_download_dir, @thread_name)\n @ohai_retry_delay = OHAI_RETRY_MIN_DELAY\n @audit = AuditStub.instance\n @logger = Log\n @cookbook_repo_retriever= CookbookRepoRetriever.new(@download_path, bundle.dev_cookbooks)\n\n # Determine which inputs are sensitive\n sensitive = Set.new([])\n bundle.executables.each do |e|\n next unless e.input_flags.respond_to?(:each_pair)\n e.input_flags.each_pair do |name, flags|\n sensitive << name if flags.include?(SENSITIVE)\n end\n end\n @sensitive_inputs = sensitive.to_a\n\n # Initialize run list for this sequence (partial converge support)\n @run_list = []\n @inputs = { }\n breakpoint_recipe = CookState.breakpoint_recipe\n run_list_recipes.each do |recipe|\n if recipe.nickname == breakpoint_recipe\n @audit.append_info(\"Breakpoint set to < #{breakpoint_recipe} >\")\n break\n end\n @run_list << recipe.nickname\n ::RightSupport::Data::HashTools.deep_merge!(@inputs, recipe.attributes)\n end\n\n # Retrieve node attributes and deep merge in inputs\n @attributes = ChefState.attributes\n ::RightSupport::Data::HashTools.deep_merge!(@attributes, @inputs)\n end", "def setup_projects\n recipes.each do |rec_obj|\n rec_obj.setup_projects\n end\n end", "def collect_idl_files\n recipes.each { |rcp| rcp.collect_idl_files }\n end", "def add_recipe(recipe)\n raise \"[#{self}] duplicate recipe #{recipe.recipe_id} defined.\" if @recipes.has_key?(recipe.recipe_id)\n\n @recipes[recipe.recipe_id] = recipe\n end", "def with_ingredients(ingredients = nil)\n unless ingredients.nil?\n self.recipe_data.ingredients = ingredients\n self\n end\n end" ]
[ "0.6945913", "0.69398206", "0.6747966", "0.6656515", "0.65884864", "0.6547027", "0.6501342", "0.64209527", "0.63748807", "0.6364102", "0.6342077", "0.6332726", "0.6275663", "0.6269464", "0.61720175", "0.6170489", "0.6167769", "0.61657983", "0.6108907", "0.6077471", "0.60773075", "0.60669035", "0.6049192", "0.60210574", "0.60118663", "0.60023856", "0.59639406", "0.5944745", "0.59405696", "0.5930574", "0.5907851", "0.589686", "0.58951855", "0.5891112", "0.58810467", "0.58406144", "0.58308786", "0.5819031", "0.58125186", "0.5804682", "0.580256", "0.5798217", "0.5787029", "0.5780156", "0.57334596", "0.5726725", "0.57210386", "0.5707037", "0.57012993", "0.56830794", "0.56818867", "0.5681301", "0.56770325", "0.5665692", "0.56627643", "0.5660685", "0.56566226", "0.56335884", "0.56264627", "0.56168646", "0.56168646", "0.56168646", "0.56140894", "0.5579264", "0.5579165", "0.5574155", "0.5571041", "0.5568909", "0.556373", "0.556373", "0.5555679", "0.5539748", "0.55239767", "0.5520702", "0.55139965", "0.5511527", "0.55100644", "0.54935193", "0.5484915", "0.54759634", "0.54731244", "0.54696697", "0.543182", "0.54290044", "0.54285717", "0.5424319", "0.5417413", "0.5414572", "0.5414572", "0.54141784", "0.5412192", "0.54027045", "0.5400987", "0.5399003", "0.5393437", "0.53867865", "0.53823745", "0.53813", "0.5379307" ]
0.5603127
64
R: display all recipes in the cook book
def load_csv # read each line frmo csv and append to recipes collection CSV.foreach(@csv_file) do |row| # puts "#{row[0]} | #{row[1]}" @recipes << Recipe.new(name: row[0], description: row[1], cooking_time: row[2], difficulty: row[3], tested: row[4]) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list\n recipes = @cookbook.all\n # byebug\n @view.display_recipes(recipes)\n end", "def list\n display_recipes\n end", "def all\n # returns all recipes\n @recipes\n end", "def all\n @recipes\n end", "def all\n @recipes\n end", "def all\n @recipes\n end", "def generate_recipes_list\n recipes = YARD::Registry.all(:recipe).uniq.sort_by {|recipe| recipe.Name.to_s}\n generate_full_list(recipes, 'Recipe', 'recipes')\nend", "def show\n @title = 'Categories'\n @recipes = @category.recipes.each{|c| [c.name, c.id] }\n end", "def index\n @recipes = Recipe.all\n end", "def index\n @recipes = Recipe.all\n end", "def index\n @recipes = Recipe.all\n end", "def index\n @recipes = Recipe.all\n end", "def index\n @recipes = Recipe.all\n end", "def index\n @recipes = Recipe.all\n end", "def index\n @recipes = Recipe.all\n end", "def index\n @recipes = Recipe.all\n end", "def index\n @recipes = Recipe.all\n end", "def index\n @recipes = Recipe.all\n end", "def index\n @recipes = Recipe.all\n end", "def index\n @recipes = Recipe.all\n end", "def index\n @recipes = Recipe.all\n end", "def index\n @recipes = Recipe.all\n end", "def index\n @recipes = Recipe.all\n end", "def index\n @recipes = Recipe.render_all\n end", "def display_recipe_list\n if EverythingButTheKitchenSink::Recipe.all.count == 0\n return true\n else\n EverythingButTheKitchenSink::Recipe.all.each_with_index do |recipe, index|\n puts (index + 1).to_s + \".\" + recipe.title\n end\n return false\n end\n end", "def show_recipes_in_my_kitchen\n list_recipes(@user.recipes.order(:title) ) # just list all recipes associated to the users kitchen\n end", "def all\n return @recipes\n end", "def index\n @page_title = \"All Recipes\"\n @recipes = Recipe.all\n end", "def index\n # @recipes = Recipe.all\n end", "def recipes\n recipe_cards.map { |c| c.recipe }\n end", "def recipes\n @recipes ||= []\n end", "def print_recipe\n index = 0\n @recipe.recipe_name.each do|item|\n puts \"- [#{index}] #{item}\".colorize(:yellow)\n index = index + 1\n end\n user_input = gets.chomp.to_i\n @recipe.select_recipe(user_input)\n #self.start_main_menu\n end", "def show\n @ingredients = @recipe.ingredients\n @masterpieces = @recipe.masterpieces\n end", "def index\n @cookbooks = Cookbook.all\n end", "def print_needed_ingredients\n puts \"\\n\\n\\s\\e[4m#{self.name} Recipe\\e[0m\"\n self.ingredients.each { |ingredient| puts \"\\s- #{ingredient.name}: #{RecipeIngredient.find_by(recipe_id: self.id, ingredient_id: ingredient.id).amount} cl\" }\n if self.recipe_specials.collect{|x| x.special if x.special}.uniq != [nil]\n self.recipe_specials.collect{|x| x.special if x.special}.uniq.each{|y| puts \"\\s- Special: #{y}\"}\n elsif self.recipe_specials.collect{|x| x.garnish if x.garnish}.uniq != [nil]\n puts \"\\s- Garnish: #{self.recipe_specials.collect{|x| x.garnish if x.garnish}.uniq[0]}\"\n end\n puts \"\\s- Preparation: #{self.preparation}\"\n end", "def index\n @meal_recipes = MealRecipe.all\n end", "def get_recipes(section)\n # Example: https://terraria.gamepedia.com/index.php?title=Recipes/Iron_Anvil&action=raw\n @connection.get '/index.php', {\n 'title' => \"Recipes/#{section}\",\n 'action' => 'raw'\n }\n end", "def command_printAll\n words = @database.basicFoods\n print = \"\"\n words.each { |name|\n print += \"#{name.to_s} \\n\"\n }\n\n words = @database.recipes\n words.each { |name|\n print += \"\\n #{name.to_s}\"\n }\n\n puts print\n \n end", "def recipes\n return self.selected_recipes.map do |selected_recipe|\n selected_recipe.recipe\n end\n # recipes = []\n # self.selected_recipes.each do |selected_recipe|\n # recipes << selected_recipe.recipe\n # end\n # return recipes\n end", "def drink_list #makes the menu\n Recipe.all.each.with_index(1) do |x, index|\n puts \"#{index} #{x.drink_name}\"\n end\n end", "def recipes\n # Loop through RecipeCard\n #Find cards for this user\n #Gather recipes on those cards\n self.recipe_cards.map do |recipecard|\n recipecard.recipe\n end\n end", "def generate_cookbooks_list\n cookbooks = YARD::Registry.all(:cookbook).uniq.sort_by{|cookbook| cookbook.name.to_s}\n generate_full_list(cookbooks, 'Cookbooks', 'cookbooks')\nend", "def show\n @recipes = @ingredient.recipes.reorder(ingredient_order_by(\"recipes\")).paginate(page: params[:page], per_page: 2)\n @title = \"Recipes using: \" + @ingredient.name\n # goto render /views/ingredients/show.html.erb using /shared/_show_recipes using @recipes, @title\n end", "def index\n @cooking_recipes = CookingRecipe.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @cooking_recipes }\n end\n end", "def index\n @potluck_recipes = PotluckRecipe.all\n end", "def recipes\n Array fetch(:run_list)\n end", "def index\n @ingredient_recipes = IngredientRecipe.all\n end", "def recipes\n self.recipe_cards.map do |recipe_card|\n recipe_card.recipe\n end\n end", "def recipes\n recipe_cards.map {|recipe_card| recipe_card.recipe}\n end", "def recipes\n @recipes.sort.collect {|id| $data_recipes[id] }\n end", "def list\n \n recipes = Recipe.all\n render :json => recipes.to_json\n\n end", "def show\n response = Aws.list_recipe(params[:id])\n render :json => response\n end", "def recipePrintHelper(name)\n myrecipe = @RecipeHash[name]\n puts \"#{myrecipe.name} #{myrecipe.calories}\"\n # Loop through each ingredient and print out the required ingredient name and\n # and the associated calories.\n myrecipe.ingredients.each do |ingredient|\n puts \" #{@BasicHash[ingredient].name} #{@BasicHash[ingredient].calories}\\n\"\n end\n end", "def index\n @chefs = Chef.all\n end", "def index\n @chefs = Chef.all\n end", "def index\n @cook_books = CookBook.all\n end", "def show\n @recipes = @diet.recipes.reorder(diet_order_by(\"recipes\")).paginate(page: params[:page], per_page: 2)\n @title = \"Recipes using: \" + @ingredient.name\n # goto render /views/diets/show.html.erb using /shared/_show_recipes using @recipes, @title\n end", "def index\n @recipes = Recipe.all.order(name: :asc)\n end", "def print_api_call_menus\n name = convert_name_for_api(get_recipe_name_from_user)\n recipes_array = API.call_by_recipe_name(name)\n API.recipes_titles_array.each_with_index do |title, i|\n puts \"#{i + 1}. #{title.capitalize}\"\n puts \"-------------------------------------------------------\".colorize(:cyan).bold\n end\n end", "def print_all\n # Print all BasicFoods\n @basic_foods.each do |name, basic_food|\n print(name)\n end\n # Print all Recipes\n @recipes.each do |name, recipe|\n print(name)\n end\n end", "def display_resource(recipe)\n \"Recipe ##{recipe.id} - #{recipe.name}\"\n end", "def all\n return @recipearray\n end", "def display_shelf\n\t\tputs @books\n\tend", "def show(id) \n response = request(:get, \"/recipes/#{id}.json\")\n response.first[1]\n end", "def show\n @recipes = @category.recipes.where is_draft: false\n end", "def recipes\n self.recipe_cards.map {|recipecard| recipecard.recipe}\n end", "def show_all_books\n\t\tputs \"\\nAll Books\\n\"\n\t\tBook.all.each do |book|\n\t\t\tputs \"#{book.id} #{book.title}\"\n\t\tend\nend", "def index\n @recipes = RecipeCacheService.list(per_page: per_page_param, page: page_param)\n end", "def show\n\t\tload_recipe\n\t\t\t\n\t\tload_recipes_set(@recipe.user)\n\t\t\n\t\t@recipe_index = @recipes_set.index(@recipe)\n\t\t\n\t\trecipe = [@recipe]\n\t\t@other_recipes_set = @recipes_set - recipe\n\t\trecipes_conditions = recipe_conditions(recipe_photo_required_cond, recipe_status_cond, recipe_privacy_cond, recipe_is_draft_cond)\n\n same_title_recipes_conditions_list = [ \"recipes.title = '#{@recipe.title}'\", \"recipes.common_title = '#{@recipe.title}'\" ]\n\t\tif (common_title = @recipe.common_title) && !common_title.blank?\n\t\t\tsame_title_recipes_conditions_list += [ \"recipes.common_title = '#{common_title}'\", \"recipes.title = '#{common_title}'\" ]\n\t\tend\n\t\tsame_title_recipes_conditions = \"#{recipes_conditions} AND (#{same_title_recipes_conditions_list.join(' OR ')})\"\n\t\t@same_title_recipes_set = recipes_for(nil, same_title_recipes_conditions, nil, 'RAND()') - recipe\n\t\t@same_title_recipes_set_count = @same_title_recipes_set.size\n\n related_recipes_conditions = recipes_conditions\n\t\t@related_recipes_set = taggables_for(nil, 'Recipe', @recipe.tag_list, related_recipes_conditions, nil, nil, nil, 'RAND()') - recipe - @same_title_recipes_set\n\t\t\n\t\t@favorite_users_set = favorite_users(@recipe.favorites.find(:all, :limit => 12, :order => 'RAND()'))\n\t\t@favorite_users_set_count = @favorite_users_set.size\n\t\t@entried_matches_set = entried_matches(@recipe.entries.find(:all, :limit => 12, :order => 'RAND()'))\n\t\t\n\t\tcurrent = Time.now\n\t\tif @recipe.match_id && (@match = Match.find_by_id_and_entriable_type(@recipe.match_id, 'Recipe')) && @match.doing?(current)\n\t\t\t@entry = @match.find_entry(@recipe)\n\t\tend\t\t\t\t\t\t\t\t\t\t\t\n\t\t\n\t\tshow_sidebar\n\t\t\n\t\trecipe_title = item_title(@recipe)\n\t\trecipe_common_title = @recipe.common_title.strip if !@recipe.common_title.blank?\n\t\trecipe_username = user_username(@recipe.user, true, true)\n\t\trecipe_link_url = item_first_link(@recipe)\n\t\t\n\t\tinfo = \"#{RECIPE_CN} - #{recipe_title}\"\n\t\tset_page_title(info)\n\t\tset_block_title(info)\n\t\t@meta_description = \"这是#{recipe_title}#{add_brackets(recipe_common_title, '(', ')')}的#{RECIPE_CN}信息, 来自#{recipe_username}. \"\n\t\t@meta_keywords = []\n @meta_keywords << @recipe.tag_list if !@recipe.tag_list.blank?\n @meta_keywords += [ recipe_title, recipe_username, recipe_link_url ]\n @meta_keywords << recipe_common_title if !recipe_common_title.blank?\n @meta_keywords += default_meta_keywords('Recipe')\n#\t\t@meta_keywords = [recipe_common_title] + @meta_keywords if !recipe_common_title.blank?\n\n respond_to do |format|\n format.html do\n \tlog_count(@recipe)\n end\n # format.xml { render :xml => @recipe }\n end\n end", "def index\n @recipe_items = RecipeItem.all\n end", "def index \n @cooks = Cook.all\n\n end", "def index\n @recipes_foods = RecipesFood.all\n end", "def index\n @recipeingredients = Recipeingredient.all\n end", "def index\n @fridge_item_ids = FridgeItem.pluck(:ingredient_id)\n @available_recipes = find_available_recipes\n @recipes = Recipe.paginate(page: params[:page])\n end", "def view_recipes\n# @recipe_choice holds a string of the chosen recipe's name\n @recipe_choice = @prompt.select(\"Choose your recipe\", all_recipes)\n recipe_page(@recipe_choice)\n# @current_recipe holds the instance object of currently selected recipe\n @current_recipe = recipe_instance(@recipe_choice) \n # binding.pry\n puts \"\\n\"\n nav_menu\n end", "def select_recipe_from_book(recipes)\n if recipes.length == 0\n puts ''\n puts \"*** You don't have any saved recipes. ***\".colorize(:color => :red)\n puts ''\n main_menu\n else\n puts ''\n options = [recipes, \"Delete a recipe\", \"Back\"]\n selection = @prompt.select(\"Your recipe book\", (options))\n if selection == \"Delete a recipe\"\n select_recipe_to_delete(recipes)\n elsif selection == \"Back\"\n main_menu\n else\n puts ''\n selected_user_rec = User.find(@id).recipes.find { |recipe| recipe.title == selection }\n puts selected_user_rec.content\n puts ''\n main_menu\n end\n end\n end", "def book_list\n\t\tputs \"Here are the books in our library:\"\n\t\t@books.each { |book| puts \"#{book.name}\" }\n\tend", "def printAllFood\n @BasicHash.each do |key, value|\n basicfood = @BasicHash[key]\n puts \"#{basicfood.name} #{basicfood.calories} \"\n end\n puts \"\\n\" #Adding a new line between basicFood and recipes\n @RecipeHash.each do |key, value|\n recipePrintHelper(key) #Calls helper function to print recipe as requested\n end\n end", "def display_resource(recipe)\n recipe.name\n end", "def display_resource(recipe)\n recipe.name\n end", "def index\n @cookbooks = CookbooksDecorator.decorate_collection(Cookbook.all)\n end", "def index\n @recipes = Recipe.order('name')\n end", "def display_search_results\n rec_ing = recipe_ingredients\n while rec_ing.length == 0\n puts ''\n puts \"*** Sorry, that ingredient's not available. ***\".colorize(:color => :red)\n puts ''\n search_ingredient\n rec_ing = recipe_ingredients\n end\n select_recipe_from_search(recipe_titles)\n end", "def start_recipe\n @recipe.delete_recipes\n puts File.foreach(\"ingredient_list.txt\") { |line| puts line }\n puts \"What Ingredients do you have?\".colorize(:yellow)\n user_input = gets.chomp\n @recipe.search(user_input)\n self.print_recipe\n self.recipe_ask_for_options()\n end", "def index\n info = Aws.get_recipes_from_db\n render :json => info\n end", "def recipes\n my_recipe_cards = RecipeCard.all.select do |recipe_card|\n recipe_card.user == self\n end\n my_recipe_cards.map do |recipe_card|\n recipe_card.recipe\n end\n end", "def show\n @parts = @recipe.parts\n @avaliable = @recipe.avaliable\n end", "def cookbookshelf\n \n cbs = Recipe.find_by_sql \"SELECT DISTINCT cookbook_id FROM recipes\"\n @indexedbooks = Array.new\n cbs.each do |cb|\n cbtitle = cb.cookbook.title.gsub(/^(.{50}[\\w.]*)(.*)/) {$2.empty? ? $1 : $1 + '...'}\n cb_details = {\n :id => cb.cookbook_id,\n :ISBN => cb.cookbook.ISBN,\n :author => cb.cookbook.author.name,\n :title => cbtitle\n }\n \n @indexedbooks << cb_details\n \n @indexedbooks = @indexedbooks.sort_by { |cookbook| cookbook[:author] }\n end\n respond_to do |format|\n format.html\n end\n end", "def favorite_recipes\n favorites.each do |f|\n f.recipe\n end\n end", "def index\n @recipes = Recipe.all\n @ingredients = Ingredient.all\n @cuisines = Cuisine.all\n @categories = Category.all\n end", "def recipe args=1\n self.summary.recipe args\n end", "def choose_recipe(recipes)\r\n# colors_array = [:magenta,:green,:yellow,:white,:red,:cyan,:blue]\r\n rows = []\r\n # put the list of the recipes\r\n recipes.each.with_index(1) do |recipe,i|\r\n rows << [\"#{i}\",\"#{recipe.name}\".yellow,\"#{recipe.minutes} min\"]\r\n end #recipes.each end\r\n table = Terminal::Table.new :rows => rows\r\n table = Terminal::Table.new :headings => ['Number', 'Food','Time to cook'], :rows => rows\r\n puts table\r\n # put question to let user choose\r\n chosen_recipe = nil\r\n loop do\r\n puts \"Which do you want to cook?(press the number)\"\r\n input = gets.to_i\r\n chosen_recipe = recipes[input - 1]\r\n if input == 0\r\n puts \"Error\"\r\n elsif chosen_recipe != nil\r\n puts \"#{chosen_recipe.name}: you need these ingredients #{chosen_recipe.ingredients}\\nCheck here to know how to cook!->:#{chosen_recipe.url}\"\r\n break\r\n else\r\n puts \"Error\"\r\n end # if\r\n end #loop end\r\nend", "def recipe_finder(recipe_id)\n system 'clear'\n Recipe.all.select{|recipe| recipe.id == recipe_id}.each do |i|\n puts i.name.upcase\n puts \"Rating: #{i.rating}\"\n puts \"Cooking Time: #{i.time} hours\"\n puts \"Difficulty Level: #{i.difficulty}\"\n @recipe_ingredient = i.ingredient\n end\n prompt.select(\"What would you like to do?\") do |menu|\n menu.choice \"See ingredients\", -> {recipe_ingredients(recipe_id)}\n menu.choice \"Choose a different protein\", -> {choose_protein}\n menu.choice \"Exit\", -> {exit_helper}\n end\n end", "def index\n Chef.all\n end", "def index\n @recipe_lists = RecipeList.all\n end", "def list_books\n puts \"\"\n puts \"Current Catalogue:\"\n puts \"\"\n puts \"A-G:\"\n \t@shelf_ag.to_s\n \tputs \"H-P:\"\n \t@shelf_hp.to_s\n \tputs \"Q-Z:\"\n \t@shelf_qz.to_s\n end", "def scrape_recipes(ingredient)\n\turl = \"https://www.bbcgoodfood.com/search/recipes?query=#{ingredient}\"\n\n\thtml_string = open(url).read\n\thtml = Nokogiri::HTML(html_string)\n\n\t# We are searching for this:\n\t# <h3 class=\"teaser-item__title\">\n\t# \t<a href=\"\">Chocolate brownies</a>\n\t# </h3>\n\n\thtml.search(\".teaser-item__title a\")[0...2].each do |element|\n\t\ttitle = \"********\" + element.text + \"********\"\n\t\turl = element.attribute(\"href\").value\n\n\t\tsteps = scrape_steps(url)\n\n\t\tputs title\n\n\t\tsteps.each_with_index do |step, index|\n\t\t\tputs \"#{index + 1} - #{step}\"\n\t\t\tputs\n\t\tend\n\n\t\tputs\n\tend\nend", "def index\n @recipe_ingredients = RecipeIngredient.all\n end", "def cookbook_runlist\n verify_cookbook_creation\n\n Souschef::Print.header 'Berkshelf configuration'\n Souschef::Berkshelf.new(@opts).berks_create\n Souschef::Print.header 'Configure gemfile'\n Souschef::Gemfile.new(@opts).write\n Souschef::Print.header 'Create essential template files'\n Souschef::Template.run(@opts)\n # Mock Scaffold to generate default recipe and tests\n\n Souschef::Print.header 'Create default recipe and tests'\n Souschef::Scaffold.new(path: @opts[:path],\n recipe: 'default',\n profile: @opts[:profile],\n force: true,\n verbose: @opts[:verbose]).start\n\n Souschef::Print.header 'Testkitchen configuration'\n Souschef::Testkitchen.new(@opts).setup\n\n Souschef::Print.header \"Don't forget to run bundle install!\"\n end", "def list(database, new = 0)\n puts \"\"\n puts \"Here the #{new == 1 ? 'new ' : ''}list of your recipes:\"\n database.each_with_index do |item, index|\n done = item.done == \"\" || item.done.nil? ? \" \" : \"X\"\n puts \"#{index + 1}: [#{done}] #{item.name}\"\n puts \" => #{item.description}\"\n puts \" => #{item.cooking_time}\"\n puts \" => #{item.difficulty}\"\n puts \"\"\n end\n end", "def show(cookbook)\n path = File.expand_path(cookbook.path)\n cookbooks[cookbook.cookbook_name] = { path: path }\n end" ]
[ "0.82058334", "0.79469186", "0.7315663", "0.70847344", "0.70847344", "0.70847344", "0.69080645", "0.68886364", "0.6872699", "0.6872699", "0.6872699", "0.6872699", "0.6872699", "0.6872699", "0.6872699", "0.6872699", "0.6872699", "0.6872699", "0.6872699", "0.6872699", "0.6872699", "0.6872699", "0.6872699", "0.6826725", "0.6823901", "0.6817735", "0.6796588", "0.67962307", "0.6794558", "0.6718353", "0.66744035", "0.6662777", "0.66286975", "0.6522058", "0.65196437", "0.65136594", "0.65120536", "0.6497438", "0.649118", "0.6489283", "0.64833516", "0.6465689", "0.6459353", "0.64539284", "0.64531326", "0.64493686", "0.64355266", "0.63895917", "0.6367713", "0.63576305", "0.6352482", "0.63484865", "0.6348082", "0.6335477", "0.6335477", "0.6330733", "0.63132143", "0.6293511", "0.6255248", "0.62541926", "0.62528104", "0.62509865", "0.62408066", "0.62346685", "0.623287", "0.622901", "0.6226764", "0.6219666", "0.6218107", "0.62043333", "0.61993396", "0.6184776", "0.61840725", "0.61753076", "0.61730576", "0.6171774", "0.6170387", "0.6164456", "0.6161249", "0.6161249", "0.61507523", "0.6150114", "0.61374396", "0.61261505", "0.6116664", "0.6116022", "0.61080277", "0.61021024", "0.6101397", "0.6097152", "0.6090604", "0.60841566", "0.60782135", "0.6076277", "0.60746884", "0.60733634", "0.60707027", "0.60692734", "0.60626304", "0.6052654", "0.6043233" ]
0.0
-1
D: delete the recipe in the CookBook
def remove_recipe(index) @recipes.delete_at(index) write_csv end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n recipe_index = @view.index_delete\n @cookbook.remove_recipe(recipe_index)\n @view.listing\n end", "def delete_saved_recipes\n File.open(\"recipes.txt\", 'w') {|f| f.puts \"\"}\n end", "def destroy\n @recipe.destroy\n head :no_content\n end", "def destroy\n @recipe.destroy\n \n end", "def destroy\n # Display list with indices\n recipes = @cookbook.all\n # Ask user for index\n index = @view.ask_user_for_index(recipes)\n # Remove from cookbook\n @cookbook.remove_recipe(index - 1)\n end", "def destroy\n @recipe.destroy\n redirect_to root_path, notice: \"Successfully deleted recipe\"\n end", "def removed_cookbook_file(path)\n end", "def destroy\n\t\t@recipe = Recipe.find(params[:id])\n\t @recipe.destroy\n\t redirect_to recipes_path\n\tend", "def destroy\n load_recipe(@current_user)\n\t\t\n\t\tif !@recipe.entrying?\n\t\t\tActiveRecord::Base.transaction do\n\t\t\t\tif @recipe.destroy\n\t\t\t\t\treg_homepage(@recipe, 'destroy')\n#### begin\n#### CACHE.delete('overview_recipes_set')\n#### CACHE.delete('overview_love_recipes_set')\n#### CACHE.delete('overview_love_users_set')\n#### CACHE.delete('overview_tags_set')\n#### CACHE.delete('overview_reviews_set')\n#### rescue Memcached::NotFound\n#### end\n\t\t\t\t\tafter_destroy_ok\n\t\t\t\tend\n\t\t\tend\n\t\tend\n end", "def remove_recipe(recipe_index)\n @recipes.delete_at(recipe_index)\n save\n end", "def destroy\n @cooking_recipe = CookingRecipe.find(params[:id])\n @cooking_recipe.destroy\n\n respond_to do |format|\n format.html { redirect_to(cooking_recipes_url) }\n format.xml { head :ok }\n end\n end", "def delete(id)\n request(:delete, \"/recipes/#{id}.json\")\n end", "def remove!\n windows_package 'Chef Development Kit' do\n action :remove\n end\n end", "def remove(dependency)\n unless has_dependency?(dependency)\n raise Berkshelf::CookbookNotFound, \"'#{cookbook_name(dependency)}' does not exist in this lockfile!\"\n end\n\n @dependencies.delete(cookbook_name(dependency))\n end", "def remove_cookbooks(cookbook_spec)\n cookbook_spec.each do |cookbook_name, version_specs|\n version_specs.each do |version, recipe_names|\n delete_cookbook(admin_user, cookbook_name, version)\n end\n end\n end", "def remove_recipe(recipe_index)\n @recipes.delete_at(recipe_index)\n save_csv\n end", "def after_destroy(recipe)\n expire_cache_for(recipe)\n end", "def destroy\n @cookbook = Cookbook.find(params[:id])\n @cookbook.destroy\n\n respond_to do |format|\n format.html { redirect_to cookbooks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n\t\t\t\trecipe = get_recipe_by_id(params[:id])\n\t\t\t\trecipe.destroy\n\t\t\t\trender json: {status: 'SUCCESS', message: 'Deleted recipe', data: recipe}, status: :ok\n\t\t\tend", "def destroy\n @recipe = Recipe.find(params[:id])\n @recipe.destroy\n \n respond_to do |format|\n format.html { redirect_to(recipes_url) }\n format.xml { head :ok }\n end\n end", "def uninstall\n yaourt('--noconfirm', '-R', @resource[:name])\n end", "def action_delete\n if @current_resource.exist?\n converge_by \"Delete #{r.path}\" do\n backup unless ::File.symlink?(r.path)\n ::File.delete(r.path)\n end\n r.updated_by_last_action(true)\n load_new_resource_state\n r.exist = false\n else\n Chef::Log.debug \"#{r.path} does not exists - nothing to do\"\n end\n end", "def remove_recipe(index)\n @recipes.delete_at(index)\n\n save_csv\n end", "def destroy\n @recipe.destroy\n redirect_to recipes_path, notice: 'Recipe successfully deleted!!'\n end", "def recipe_delete # /v1/user/:id/recipes/:recipe_id (DELETE)\n params[:recipes] = params[:recipe_id]\n recipes_delete\n end", "def remove_repo!\n chocolatey_package('chefdk') { action :remove }\n end", "def destroy\n @cookbook.destroy\n respond_to do |format|\n format.html { redirect_to cookbooks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @recipe = Recipe.find(params[:id])\n @recipe.destroy\n\n respond_to do |format|\n format.html { redirect_to(recipes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @recipe = Recipe.find(params[:id])\n @recipe.destroy\n\n respond_to do |format|\n format.html { redirect_to(recipes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @recipe.destroy\n redirect_to recipes_url, notice: \"Recipe was successfully destroyed.\"\n end", "def original_destroy\n @recipe = Recipe.find(params[:id])\n @recipe.destroy\n\n respond_to do |format|\n format.html { redirect_to(recipes_url) }\n format.xml { head :ok }\n end\n end", "def delete_recipe(db,id)\n q = \"DELETE FROM recipes WHERE id=#{id};\"\n return db.execute(q)\nend", "def destroy\n current_user.recipes.find(params[:id]).destroy\n redirect_to current_user\n end", "def destroy\n current_user.recipes.find(params[:id]).destroy\n redirect_to current_user\n end", "def destroy\n recipe = Recipe.find(params[:id])\n recipe.destroy()\n render json: {message:\"Recipe deleted.\"}\n end", "def destroy\n @recipe = Recipe.find(params[:id])\n @recipe.destroy\n\n respond_to do |format|\n format.html { redirect_to recipes_url }\n format.xml { head :ok }\n end\n end", "def destroy\n @recipe = Recipe.find(params[:id])\n @recipe.destroy\n\n respond_to do |format|\n format.html { redirect_to recipes_url }\n format.xml { head :ok }\n end\n end", "def delete_recipe(db,id)\n # your code here\nend", "def action_remove\n app_dir = Chef::Resource::Directory.new(\"#{@current_resource.apps_dir}/#{@current_resource.app}\", run_context)\n app_dir.path(\"#{@current_resource.apps_dir}/#{@current_resource.app}\")\n app_dir.recursive(true)\n app_dir.run_action(:delete)\n new_resource.updated_by_last_action(app_dir.updated_by_last_action?)\n end", "def destroy\n @ingredient.destroy\n redirect_to @recipe\n end", "def destroy\n # set_chef\n @chef.destroy\n redirect_to chefs_path\n end", "def deleteCookbookDetailTag\n @cookbook = Cookbook.find_by_id(params[:cookbook_id])\n \n Cookbooktag.delete_all([\"cookbook_id = ? AND tag_id = ?\", params[:cookbook_id], params[:tags_id]])\n @cookbookTags = getCBTags(@cookbook)\n render :partial => \"cookbook_details_tags\"\n \n end", "def delete_all_recipes(db)\n # your code here\nend", "def destroy\n @potluck_recipe.destroy\n respond_to do |format|\n format.html { redirect_to potluck_recipes_url, notice: 'Potluck recipe was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def cookbook_clean_complete\n end", "def destroy\n @cookbook.destroy\n respond_to do |format|\n format.html { redirect_to cookbooks_url, notice: 'Cookbook was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @recipe = Recipe.find(params[:id])\n @recipe.destroy\n\n respond_to do |format|\n format.html { redirect_to recipes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @recipe = Recipe.find(params[:id])\n @recipe.destroy\n\n respond_to do |format|\n format.html { redirect_to recipes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @recipe = Recipe.find(params[:id])\n @recipe.destroy\n\n respond_to do |format|\n format.html { redirect_to recipes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @recipe = Recipe.find(params[:id])\n @recipe.destroy\n\n respond_to do |format|\n format.html { redirect_to recipes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @recipe = Recipe.find(params[:id])\n @recipe.destroy\n\n respond_to do |format|\n format.html { redirect_to recipes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @recipe = Recipe.find(params[:id])\n @recipe.destroy\n\n respond_to do |format|\n format.html { redirect_to recipes_url }\n format.json { head :ok }\n end\n end", "def clear_obsoleted_cookbooks\n @events.cookbook_clean_start\n # Remove all cookbooks no longer relevant to this node\n cache.find(File.join(%w{cookbooks ** *})).each do |cache_file|\n cache_file =~ /^cookbooks\\/([^\\/]+)\\//\n unless have_cookbook?($1)\n Chef::Log.info(\"Removing #{cache_file} from the cache; its cookbook is no longer needed on this client.\")\n cache.delete(cache_file)\n @events.removed_cookbook_file(cache_file)\n end\n end\n @events.cookbook_clean_complete\n end", "def destroy\n begin\n recipe = Recipe.find(params[:id])\n\n recipe.destroy\n render json: { status: 'SUCCESS', message: 'Recipe deleted!', data: recipe }, status: :ok\n rescue\n render json: { status: 'ERROR', message: 'Error finding recipe', data: {} }, status: :not_found\n end\n end", "def destroy\n\n @recipe.destroy\n redirect_to root_path, notice: \"Succesfully deleted Question\"\nend", "def unshare_cookbook(cookbook_name, user)\n cookbook_path = \"/api/v1/cookbooks/#{cookbook_name}\"\n\n header = Mixlib::Authentication::SignedHeaderAuth.signing_object(\n http_method: \"delete\",\n path: cookbook_path,\n user_id: user.username,\n timestamp: Time.current.utc.iso8601,\n body: \"\"\n ).sign(private_key)\n\n delete cookbook_path, params: {}, headers: header\n end", "def remove_recipe(recipe_index)\n @recipearray.delete_at(recipe_index)\n update_csv\n end", "def destroy\n\t\t@recipe = Recipe.find(params[:id])\n\t\tif @recipe.destroy\n\t\t\trender json: {}\n\t\telse\n\t\t\trender status: 400, nothing: true\n\t\tend\n\tend", "def clean\n if File.exist?(@destination)\n Monolith.formatter.clean(@cookbook, @destination)\n FileUtils.rm_rf(@destination)\n true\n else\n rel_dest = Monolith.formatter.rel_dir(@destination)\n Monolith.formatter.skip(@cookbook, \"#{rel_dest} doesn't exist\")\n nil\n end\n end", "def remove\n uninstall_yri\n uninstall_yard\n end", "def destroy\n rid = params['id']\n if Aws.delete_recipe(rid) && Aws.delete_all_ingredients(rid)\n msg = {:notice => \"Recipe deleted!\"}\n render :json => msg\n else\n msg = {:notice => \"Error while deleting from DynamoDB!\"}\n render :json => msg\n end\n end", "def delete\n workbook.delete self\n end", "def destroy\n # @recipe = Recipe.find(params[:id])\n # @recipe.destroy\n #\n destroy! do |format|\n # format.html { redirect_to recipes_url }\n # format.json { head :ok }\n end\n end", "def destroy\n @cooking_ingredient.destroy\n\n respond_to do |format|\n format.html { redirect_to(cooking_ingredients_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @recipe = current_user.recipes.find(params[:id])\n @recipe.destroy\n respond_to do |format|\n format.html { redirect_to recipes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @recipe.destroy\n respond_to do |format|\n format.html { redirect_to recipes_url, notice: 'レシピが削除されました。' }\n format.json { head :no_content }\n end\n end", "def delete_resource(type, name, run_context: self.run_context)\n delete_resource!(type, name, run_context: run_context)\n rescue Chef::Exceptions::ResourceNotFound\n nil\n end", "def uninstall\n cmd = [:uninstall]\n case (pkg :version).chomp\n when /052adf36c3f4/\n cmd << '-r'\n end\n cmd << @resource[:name]\n self.unhold if self.properties[:mark] == :hold\n begin\n pkg cmd\n rescue StandardError, LoadError => e\n self.hold if self.properties[:mark] == :hold\n raise e\n end\n end", "def destroy\n @recipe.destroy\n respond_to do |format|\n format.html { redirect_to recipes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @recipe.destroy\n respond_to do |format|\n format.html { redirect_to recipes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @recipe.destroy\n respond_to do |format|\n format.html { redirect_to recipes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @recipe.destroy\n respond_to do |format|\n format.html { redirect_to recipes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @recipe.destroy\n respond_to do |format|\n format.html { redirect_to recipes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @recipe.destroy\n\n respond_to do |format|\n format.html { redirect_to recipes_url }\n format.json { head :ok }\n end\n end", "def remove_chef_secure_path\n chef_secure_path.run_action(:delete)\n end", "def select_recipe_to_delete(recipes)\n puts ''\n delete_options = [recipes, \"Back\"]\n ans = @prompt.select(\"Select a recipe to delete\".colorize(:color => :blue), (delete_options))\n if ans == \"Back\"\n puts ''\n select_recipe_from_book(@user.view_recipe_book)\n else\n delete_me = User.find(@id).recipes.find { |recipe| recipe.title == ans }\n @user.delete_recipe_from_book(delete_me)\n select_recipe_from_book(@user.view_recipe_book)\n end\n end", "def destroy\n @recipe.destroy\n respond_to do |format|\n format.html { redirect_to recipes_url, notice: 'La recette a été supprimée.' }\n end\n end", "def clear_obsoleted_cookbooks\n @events.cookbook_clean_start\n\n if remove_obsoleted_files\n remove_old_cookbooks\n else\n Chef::Log.info(\"Skipping removal of obsoleted cookbooks from the cache\")\n CookbookCacheCleaner.instance.skip_removal = true\n end\n\n remove_deleted_files\n\n @events.cookbook_clean_complete\n end", "def purge\n ::FileUtils.rm(@fname)\n end", "def delete_all_recipes(db)\n q = \"DELETE FROM recipes;\"\n return db.execute(q)\nend", "def destroy\n notice \"Removing #{@resource_copy[:path]}\"\n FileUtils.rm_rf(@resource_copy[:path])\n end", "def cookbook_clean_start\n end", "def destroy\n recipe = @ingredient.recipe\n @ingredient.destroy\n respond_to do |format|\n if recipe.save\n format.html { redirect_to recipe, notice: 'Ingredient was successfully removed.' }\n format.json { head :no_content }\n else\n format.html { redirect_to recipe, notice: 'An error occured while removing the ingredient.' }\n format.json { head :no_content }\n end\n end\n end", "def destroy\n @cook_book = CookBook.find(params[:id])\n @cook_book.destroy\n\n respond_to do |format|\n format.html { redirect_to cook_books_url }\n format.json { head :no_content }\n end\n end", "def removeBook(book)\n\t\tinventories.find_by(book_id: book.id).destroy\n\tend", "def destroy\n debug('Removing clone')\n cmd = [command(:crm), '-w', 'resource', 'stop', @resource[:name]]\n self.class.run_command_in_cib(cmd, @resource[:cib], false)\n cmd = [command(:crm), 'configure', 'delete', @resource[:name]]\n self.class.run_command_in_cib(cmd, @resource[:cib])\n @property_hash.clear\n end", "def delete!\n Recliner.delete(uri)\n end", "def rm path\n end", "def remove_old_cookbooks\n cache.find(File.join(%w{cookbooks ** {*,.*}})).each do |cache_file|\n cache_file =~ %r{^cookbooks/([^/]+)/}\n unless have_cookbook?($1)\n Chef::Log.info(\"Removing #{cache_file} from the cache; its cookbook is no longer needed on this client.\")\n cache.delete(cache_file)\n @events.removed_cookbook_file(cache_file)\n end\n end\n end", "def destroy\n @recipe_comment.destroy\n redirect_to @recipe\n end", "def action_uninstall\n wh_package.run_action(:uninstall)\n grunt_package.run_action(:uninstall)\n new_resource.installed = false\n end", "def destroy\n @meals_recipe = MealsRecipe.find(params[:id])\n @meals_recipe.destroy\n\n respond_to do |format|\n format.html { redirect_to(meals_recipes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n #1st you retrieve the product thanks to params[:product_id]\n product = Product.find(params[:product_id])\n #2nd you retrieve the recipe thanks to params[:id]\n @recipes = product.recipes.find(params[:id])\n @recipes.destroy\n \n respond_to do |format|\n #1st argument reference the path /posts/:post_id/comments/\n format.html { redirect_to action: \"index\", notice: 'Recipe step was successfully deleted.' }\n format.xml { head :ok }\n end\n end", "def remove!(entry)\n rel_path = Wide::PathUtils.relative_to_base(base_path, entry.path)\n\n cmd = cmd_prefix.push('rm', '-f', \"path:#{rel_path}\")\n shellout(Escape.shell_command(cmd))\n\n raise CommandFailed.new(\"Failed to remove file #{src_path} in the Mercurial repository in #{base_path}\") if $? && $?.exitstatus != 0\n end", "def ingredient_remove_helper(recipe_id)\n new_recipe_ingredient_arr = prompt.multi_select(\"Please choose from the list, ingredients you would like to keep\") do |menu|\n menu.choices user.recipes.where(id: recipe_id)[0].ingredient.split(\", \")\n end\n ingredient_change_helper(recipe_id, new_recipe_ingredient_arr)\n end", "def remove(name)\n sudo \"rm -rf #{god_confd}/#{name}\"\n end", "def uninstall\n pacman \"--noconfirm\", \"--noprogressbar\", \"-R\", @resource[:name]\n end", "def before_destroy\n # cwd: utunes_app\n logger.info(\"=======> before_destroy invoked!\")\n\n version_str = sprintf(\"%.2d\", version )\n bundle_title = \"hc12_v#{version_str}\"\n \n bundle_folder = \"lib/bundles\"\n bundle_name=\"build_\" + bundle_title\n bundle_fq_name = bundle_folder + \"/\" + bundle_name\n \n logger.info(\"rm -R #{bundle_fq_name}\")\n logger.info( %x[rm -R #{bundle_fq_name}] )\n \n end", "def remove\n base_dir = @spec.base_dir\n\n raise Gem::FilePermissionError, base_dir unless File.writable? base_dir\n\n FileUtils.rm_rf @rdoc_dir\n FileUtils.rm_rf @ri_dir\n end" ]
[ "0.7287634", "0.70133305", "0.69676733", "0.68609166", "0.67825526", "0.6682779", "0.66753685", "0.66503346", "0.6618757", "0.66020876", "0.6551775", "0.6527186", "0.65077984", "0.6386763", "0.6385767", "0.6330814", "0.6326098", "0.63168997", "0.6284455", "0.627665", "0.6253231", "0.6250499", "0.624367", "0.6232254", "0.6207577", "0.61950886", "0.61674076", "0.61483115", "0.61483115", "0.61455965", "0.61204493", "0.6092779", "0.60747147", "0.60747147", "0.6069388", "0.60416526", "0.60410696", "0.6007671", "0.60036284", "0.5998302", "0.5986458", "0.5981912", "0.59750974", "0.59509367", "0.5950251", "0.5931921", "0.5912267", "0.5912267", "0.5912267", "0.5912267", "0.5912267", "0.59093624", "0.5909269", "0.58988", "0.5888902", "0.5887382", "0.588285", "0.5876531", "0.58643395", "0.5863621", "0.58631766", "0.58459914", "0.58459824", "0.58446", "0.5843371", "0.5827113", "0.5823088", "0.58162194", "0.58013725", "0.58013725", "0.58013725", "0.58013725", "0.58013725", "0.57977164", "0.57922924", "0.57893777", "0.57880986", "0.578171", "0.5780874", "0.5779232", "0.5766878", "0.5758042", "0.5757292", "0.57556546", "0.57540965", "0.5753002", "0.57388836", "0.5734591", "0.5721818", "0.57092744", "0.5701344", "0.56991714", "0.56926113", "0.5690349", "0.56857526", "0.56771994", "0.5673576", "0.56720376", "0.5666626" ]
0.6007957
38
U: update a recipe from the cookbook
def write_csv # header = "name, description" CSV.open(@csv_file, 'wb') do |csv| # csv << header @recipes.each do |row| csv << [row.name, row.description, row.cooking_time, row.difficulty, row.tested] end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_appd_cookbook\n @ssh.exec! \"cd #{APPD_COOKBOOK_PATH}; git pull origin master\", sudo: true\n chef_exec \"berks install --path #{@cookbook_path.first} --berksfile #{APPD_COOKBOOK_PATH}/Berksfile\"\n end", "def update(recipe)\n return false unless recipe.valid?\n\n @service.update(recipe)\n end", "def update!(**args)\n @opa_recipes_context = args[:opa_recipes_context] if args.key?(:opa_recipes_context)\n @ui_entry_point = args[:ui_entry_point] if args.key?(:ui_entry_point)\n end", "def updated_cookbook_file(cookbook_name, path)\n end", "def update_cookbooks()\n self.resolver.debug = self.options[:debug]\n unless File.exists?(\"cookbooks\")\n\tKitchenplan::Log.info \"No cookbooks directory found. Running Librarian to download necessary cookbooks.\"\n\tself.normaldo self.resolver.fetch_dependencies()\n\t#self.normaldo \"bin/librarian-chef install --clean #{(self.options[:debug] ? '--verbose' : '--quiet')}\"\n end\n if self.options[:update_cookbooks]\n\tKitchenplan::Log.info \"Updating cookbooks with #{self.resolver.name}\"\n\tself.normaldo self.resolver.update_dependencies()\n\t#self.normaldo \"bin/librarian-chef update #{(self.options[:debug] ? '--verbose' : '--quiet')}\"\n end\n end", "def add(name)\n @cookbook.add_recipe(name)\n end", "def update_recipe(db,id,description)\n # your code here\nend", "def update_vault(vault, item)\n require_chef_vault!\n bootstrap_vault_item = load_chef_bootstrap_vault_item(vault, item)\n bootstrap_vault_item.clients(client)\n bootstrap_vault_item.save\n end", "def _update_chef_node\n step(\" updating chef node\", :blue)\n set_chef_node_attributes\n set_chef_node_environment\n sync_ipconfig_attribute\n sync_volume_attributes\n chef_api_server_as_admin.put_rest(\"nodes/#{@chef_node.name}\", @chef_node)\n end", "def add_to_cookbook(recipe)\n @cookbook.push(recipe)\n end", "def upgrade_repo!\n package 'apt-transport-https'\n include_recipe \"apt-chef::#{new_resource.channel}\"\n package('chefdk') { action :upgrade }\n end", "def update\n rid = params['id']\n name = params['name']\n description = params['description']\n instructions = params['instructions']\n cook_time = params['cook_time']\n quantity = params['quantity']\n serving_size = params['serving_size']\n uid = params['user_id']\n aws_params = Hash.new\n aws_params[:custom_fields] = {\n 'recipe_id' => rid,\n 'name' => name,\n 'description' => description,\n 'instructions' => instructions,\n 'cook_time' => cook_time,\n 'quantity' => quantity,\n 'serving_size' => serving_size,\n 'user_id' => uid\n }\n if Aws.update_recipe(aws_params)\n msg = {:notice => \"Recipe updated!\"}\n render :json => msg\n else\n msg = {:notice => \"Error while save to DynamoDB!\"}\n render :json => msg\n end\n end", "def update_cookbooks()\n self.resolver.config_dir = self.options[:config_dir] ? self.options[:config_dir] : Dir.pwd\n unless File.exists?(\"cookbooks\")\n\tKitchenplan::Log.info \"No cookbooks directory found. Running #{self.resolver.name} to download necessary cookbooks.\"\n\tself.platform.normaldo self.resolver.fetch_dependencies()\n end\n if self.options[:update_cookbooks]\n\tKitchenplan::Log.info \"Updating cookbooks with #{self.resolver.name}\"\n\tself.platform.normaldo self.resolver.update_dependencies()\n end\n end", "def update\n Puppet.debug(\"Debconf: updating #{resource[:name]}\")\n\n # Build the string to send\n args = [:package, :item, :type, :value].map { |e| resource[e] }.join(' ')\n\n IO.popen('/usr/bin/debconf-set-selections', 'w+') do |pipe|\n Puppet.debug(\"Debconf: debconf-set-selections #{args}\")\n pipe.puts(args)\n\n # Ignore remaining output from command\n pipe.close_write\n pipe.read(nil)\n end\n end", "def update_recipe(db,id,description)\n q = \"UPDATE recipes SET description=#{name} WHERE id=#{id};\"\n return db.execute(q)\nend", "def update\n @recipe = Recipe.find(params[:id])\n @recipe.update(recipe_params)\n redirect_to new_ingredient_path\n end", "def update\n @cooking_recipe = CookingRecipe.find(params[:id])\n\n respond_to do |format|\n if @cooking_recipe.update_attributes(params[:cooking_recipe])\n format.html { redirect_to(@cooking_recipe, :notice => 'CookingRecipe was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @cooking_recipe.errors, :status => :unprocessable_entity }\n end\n end\n end", "def edit(id, options = {})\n optional = [:label,\n :description,\n :compatible_with,\n :script_type\n ]\n params.accepts(optional).validate! options\n request(:put, \"/recipes/#{id}.json\", default_params(options))\n end", "def action_update\n if @current_resource.installed\n converge_by \"Updated #{new_resource.id}\" do\n imcl :install, new_resource.id,\n update_by(new_resource.service_repository).join(' '),\n base_options\n end\n new_resource.updated_by_last_action(true)\n else\n Chef::Log.info \"#{new_resource.id_ver} not installed - nothing to do\"\n end\n load_new_resource_state\n new_resource.installed(true)\n end", "def update\n\t\t@recipe = Recipe.find(params[:id])\n\n \tif @recipe.update(recipe_params)\n \t\tredirect_to recipe_path\n\t end\t\t\n\tend", "def apply_recipe(recipe)\n # Creates a random string name\n recipe_name = \"recipe~test~#{(0...8).map { (65 + rand(26)).chr }.join}\"\n recipe_loc = File.join(File.dirname(__FILE__), '..', 'recipes',\n \"#{recipe_name}.rb\")\n\n File.open(recipe_loc, 'w') do |file|\n file.write([build_cred, recipe].join(\"\\n\"))\n end\n recipe_path = \"google-gbigquery::#{recipe_name}\"\n begin\n yield recipe_path\n ensure\n File.delete(recipe_loc)\n end\n end", "def apply_recipe(recipe)\n # Creates a random string name\n recipe_name = \"recipe~test~#{(0...8).map { (65 + rand(26)).chr }.join}\"\n recipe_loc = File.join(File.dirname(__FILE__), '..', 'recipes',\n \"#{recipe_name}.rb\")\n\n File.open(recipe_loc, 'w') do |file|\n file.write([build_cred, recipe].join(\"\\n\"))\n end\n recipe_path = \"google-gcompute::#{recipe_name}\"\n begin\n yield recipe_path\n ensure\n File.delete(recipe_loc)\n end\n end", "def apply_recipe(recipe)\n # Creates a random string name\n recipe_name = \"recipe~test~#{(0...8).map { (65 + rand(26)).chr }.join}\"\n recipe_loc = File.join(File.dirname(__FILE__), '..', 'recipes',\n \"#{recipe_name}.rb\")\n\n File.open(recipe_loc, 'w') do |file|\n file.write([build_cred, recipe].join(\"\\n\"))\n end\n recipe_path = \"google-gcompute::#{recipe_name}\"\n begin\n yield recipe_path\n ensure\n File.delete(recipe_loc)\n end\n end", "def update(attributes: {})\n attributes = attributes.with_indifferent_access\n clean_attributes(attributes)\n titleize(attributes)\n sync_tags(attributes)\n parse_ingredients(attributes)\n recipe.update(attributes)\n recipe_response\n rescue StandardError => e\n error_response(e)\n end", "def recipe(name, description)\n @recipes[name] = description\n end", "def update\n @cookbook = Cookbook.find(params[:id])\n\n respond_to do |format|\n if @cookbook.update_attributes(params[:cookbook])\n format.html { redirect_to @cookbook, notice: 'Cookbook was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cookbook.errors, status: :unprocessable_entity }\n end\n end\n end", "def use(new_recipe)\n recipes.push(new_recipe)\n end", "def update\n # @recipe = Recipe.find(params[:id])\n #\n update! do |success, failure|\n # success.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n # success.json { head :ok }\n # failure.html { render action: \"edit\" }\n # failure.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end", "def upload_recipe\n # Write the raw recipe contents to a tempfile and upload\n Tempfile.open([\"vagrant-chef-apply\", \".rb\"]) do |f|\n f.binmode\n f.write(config.recipe)\n f.fsync\n f.close\n\n # Upload the tempfile to the guest\n @machine.communicate.upload(f.path, target_recipe_path)\n end\n end", "def update\n @recipe = Recipe.find(params[:id])\n \n respond_to do |format|\n if @recipe.update_attributes(params[:recipe])\n flash[:notice] = 'Recipe was successfully updated.'\n format.html { redirect_to(@recipe) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @recipe.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n #@recipe = Recipe.find(params[:id])\n \n if @recipe.update(recipe_params)\n flash[:success] = \"Your recipe was updated successfully!\"\n redirect_to recipe_path(@recipe)\n \n else\n render :edit\n \n end\n \n end", "def update_cookbook_path\n # both cookbook sequences and paths are listed in same order as\n # presented in repo UI. previous to RL v5.7 we received cookbook sequences\n # in an arbitrary order, but this has been fixed as of the release of v5.8\n # (we will not change the order for v5.7-).\n # for chef to execute repos and paths in the order listed, both of these\n # ordered lists need to be inserted in reverse order because the chef code\n # replaces cookbook paths as it reads the array from beginning to end.\n @cookbooks.reverse.each do |cookbook_sequence|\n local_basedir = File.join(@download_path, cookbook_sequence.hash)\n cookbook_sequence.paths.reverse.each do |path|\n dir = File.expand_path(File.join(local_basedir, path))\n unless Chef::Config[:cookbook_path].include?(dir)\n if File.directory?(dir)\n Chef::Config[:cookbook_path] << dir\n else\n RightScale::Log.info(\"Excluding #{path} from chef cookbooks_path because it was not downloaded\")\n end\n end\n end\n end\n RightScale::Log.info(\"Updated cookbook_path to: #{Chef::Config[:cookbook_path].join(\", \")}\")\n true\n end", "def install(source, cookbook)\n cookbooks[cookbook.name] ||= {}\n cookbooks[cookbook.name][:version] = cookbook.version\n\n unless source.default?\n cookbooks[cookbook.name][:api_source] = source.uri\n cookbooks[cookbook.name][:location_path] = cookbook.location_path\n end\n end", "def recipe_from_script(script, cookbook)\n recipes = cookbook.instance_variable_get(:@recipes)\n recipes.invert[script]\n end", "def edit_introduction\n @cookbook = current_cookbook\n end", "def update\n respond_to do |format|\n if @cookbook.update(cookbook_params)\n format.html { redirect_to cookbook_path(@cookbook), notice: 'Cookbook was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cookbook.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @recipe = Recipe.find(params[:id])\n if @recipe.update(recipe_params)\n redirect_to recipe_url(@recipe)\n else\n render 'edit'\n end\n end", "def update\n install\n end", "def update\n @recipe = current_user.recipes.find(params[:id])\n respond_to do |format|\n if @recipe.update_attributes(params[:recipe])\n \n unless params[:instructions].nil?\n @recipe.instructions.delete_all\n Instruction.multi_save(params[:instructions], @recipe)\n end\n \n unless params[:ingredients].nil?\n @recipe.ingredients.delete_all\n Ingredient.multi_save(params[:ingredients], @recipe)\n end\n\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { render json: {:recipe => @recipe, :tags => @recipe.tag_list} }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n begin\n recipe = Recipe.find(params[:id])\n\n if recipe.update_attributes(recipe_params)\n render json: { status: 'SUCCESS', message: 'Recipe updated!', data: recipe }, status: :ok\n else\n render json: { status: 'ERROR', message: 'Error updating recipe', data: recipe.errors }, status: :unprocessable_entity\n end\n rescue\n render json: { status: 'ERROR', message: 'Error finding recipe', data: {} }, status: :not_found\n end\n end", "def update\n @recipe = current_user.recipes.find(params[:id])\n @obj = @recipe\n if(@recipe.update(recipe_params))\n flash.alert = \"Recipe updated\"\n redirect_to current_user\n return\n else\n flash.now.alert = \"Error\"\n render 'shared/form'\n end\n end", "def install_repo!\n package 'apt-transport-https'\n include_recipe \"apt-chef::#{new_resource.channel}\"\n package 'chefdk' do\n version new_resource.version unless new_resource.version == 'latest'\n end\n end", "def ingredient_change_helper(recipe_id, new_recipe_ingredient_arr)\n puts \" \"\n p \"Ingredient(s) successfully updated!\"\n sleep(1.3)\n user.recipes.where(id: recipe_id).update(ingredient: new_recipe_ingredient_arr.join(\", \"))\n recipe_ingredients(recipe_id)\n end", "def loaded_recipe(cookbook, recipe)\n fully_qualified_recipe = \"#{cookbook}::#{recipe}\"\n\n automatic_attrs[:recipes] << fully_qualified_recipe unless Array(self[:recipes]).include?(fully_qualified_recipe)\n end", "def update\n load_recipe(@current_user)\n# new_recipe = @current_user.recipes.build(params[:recipe])\n if params[:recipe][:privacy].nil?\n params[:recipe][:privacy] = @recipe.privacy\n end\n # for love recipes\n current_roles = @recipe.roles || ''\n if (params[:recipe][:privacy] == '10' && params[:recipe][:from_type] == '1' && @recipe.is_draft == '0' && time_iso_format(@recipe.published_at) >= '2009-08-01 00:00:00')\n unless(current_roles.include?('21'))\n params[:recipe][:roles] = '21 ' + current_roles\n#### begin\n#### CACHE.delete('overview_love_recipes_set')\n#### CACHE.delete('overview_love_users_set')\n#### rescue Memcached::NotFound\n#### end\n end\n else\n if(current_roles.include?('21'))\n params[:recipe][:roles] = current_roles.gsub('21', '')\n#### begin\n#### CACHE.delete('overview_love_recipes_set')\n#### CACHE.delete('overview_love_users_set')\n#### rescue Memcached::NotFound\n#### end\n end\n end\n # end\n \n new_recipe = @recipe.user.recipes.build(params[:recipe])\n # new_recipe.cover_photo_id = @recipe.cover_photo_id\n # new_recipe.published_at = @recipe.published_at\n # new_recipe.status = new_recipe.get_status\n # new_recipe.is_draft = new_recipe.get_is_draft\n # new_recipe.published_at = new_recipe.get_published_at\n \n # params[:recipe][:status] = new_recipe.status\n # params[:recipe][:is_draft] = new_recipe.is_draft\n # params[:recipe][:published_at] = new_recipe.published_at\n params[:recipe][:original_updated_at] = Time.now if @recipe.user == @current_user\n params[:recipe][:status] = new_recipe.get_status\n\t\t\n\t\tset_tag_list\n \n ActiveRecord::Base.transaction do\n\t\t if @recipe.update_attributes(params[:recipe])\n\t\t \t# @recipe.tag_list = params[:tags].strip if params[:tags] && params[:tags].strip != @recipe.tag_list\n\t\t\t\treg_homepage(@recipe, 'update')\n#### begin\n#### CACHE.delete('overview_recipes_set')\n#### CACHE.delete('overview_tags_set')\n#### rescue Memcached::NotFound\n#### end\n\t\t\t\tafter_update_ok\n\t\t else\n\t\t\t\tafter_update_error\n\t\t end\n\t end\n end", "def update\n @recipe = current_user.recipes.find(params[:id])\n @obj = @recipe\n if(@recipe.update(recipe_params))\n flash.alert = \"Recipe updated\"\n redirect_to current_user\n else\n flash.now.alert = \"Error\"\n render 'shared/form'\n end\n end", "def cook(&block)\n the_recipes = [\n self.class.standard_recipes,\n self.base_recipe,\n self.recipes,\n (block_given? ? block : nil)\n ].flatten.compact.uniq\n the_recipes.each do |r|\n if r.is_a?(Proc)\n self.cap_config.load(:proc => r)\n else # assume recipe filename\n self.cap_config.load(:file => r)\n end\n end\n @cooked = true\n self.cap_config\n end", "def update\n Puppet.debug \"Attempting to upgrade #{@resource[:name]}\"\n install unless mas_app\n mas('upgrade')\n end", "def update\n respond_to do |format|\n if @cookbook.update(cookbook_params)\n format.html { redirect_to @cookbook, notice: 'Cookbook was successfully updated.' }\n format.json { render :show, status: :ok, location: @cookbook }\n else\n format.html { render :edit }\n format.json { render json: @cookbook.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n recipe.update(recipe_params)\n render json: recipe\n end", "def edit\n @cookbook = current_cookbook\n end", "def upgrade_repo!\n if new_resource.channel != :stable\n raise(Chef::Exceptions::UnsupportedAction,\n 'A channel property cannot be used with the :repo source')\n end\n include_recipe 'chocolatey'\n chocolatey_package 'chefdk' do\n action :upgrade\n end\n end", "def update\n authorize! @cookbook, :manage_cookbook_urls?\n\n @cookbook.update(cookbook_urls_params)\n\n if cookbook_urls_params.key?(:up_for_adoption)\n if cookbook_urls_params[:up_for_adoption] == \"true\"\n AdoptionMailer.delay.follower_email(@cookbook.id, @cookbook.class.name)\n\n if Feature.active?(:fieri) && ENV[\"FIERI_URL\"].present?\n FieriNotifyWorker.perform_async(\n @cookbook.latest_cookbook_version.id\n )\n end\n\n end\n end\n\n key = if cookbook_urls_params.key?(:up_for_adoption)\n if cookbook_urls_params[:up_for_adoption] == \"true\"\n \"adoption.up\"\n else\n \"adoption.down\"\n end\n else\n \"cookbook.updated\"\n end\n\n redirect_to cookbook_path(@cookbook), notice: t(key, name: @cookbook.name)\n end", "def update_template_files(name, cookbook_path, description)\n files = Dir.glob(\"#{cookbook_path}/**/*\").select{ |e| File.file? e }\n user = get_username || \"Your Name\"\n email = get_useremail || \"Your Email\"\n company = \"Schuberg Philis\"\n year = Time.now.year\n date = Time.now\n files.each do |file|\n contents = \"\"\n File.foreach(file) do |line|\n line.gsub!(/DESCRIPTION/, description)\n line.gsub!(/COOKBOOK/, name)\n line.gsub!(/COMPANY/, company)\n line.gsub!(/NAME/, user)\n line.gsub!(/EMAIL/, email)\n line.gsub!(/YEAR/, year.to_s)\n line.gsub!(/DATE/, date.to_s)\n contents += line\n end\n File.open(file, 'w') {|f| f.write(contents) }\n end\n return nil\n end", "def update!(**args)\n @apt = args[:apt] if args.key?(:apt)\n @deb = args[:deb] if args.key?(:deb)\n @desired_state = args[:desired_state] if args.key?(:desired_state)\n @googet = args[:googet] if args.key?(:googet)\n @msi = args[:msi] if args.key?(:msi)\n @rpm = args[:rpm] if args.key?(:rpm)\n @yum = args[:yum] if args.key?(:yum)\n @zypper = args[:zypper] if args.key?(:zypper)\n end", "def update\n @recipe = Recipe.find(params[:id])\n\n respond_to do |format|\n if @recipe.update_attributes(params[:recipe])\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @recipe = Recipe.find(params[:id])\n\n respond_to do |format|\n if @recipe.update_attributes(params[:recipe])\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @recipe = Recipe.find(params[:id])\n\n respond_to do |format|\n if @recipe.update_attributes(params[:recipe])\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @recipe = Recipe.find(params[:id])\n\n respond_to do |format|\n if @recipe.update_attributes(params[:recipe])\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @recipe = Recipe.find(params[:id])\n\n respond_to do |format|\n if @recipe.update_attributes(params[:recipe])\n format.html { redirect_to edit_recipe_path(@recipe), notice: 'Recipe was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @apt = args[:apt] if args.key?(:apt)\n @goo = args[:goo] if args.key?(:goo)\n @yum = args[:yum] if args.key?(:yum)\n @zypper = args[:zypper] if args.key?(:zypper)\n end", "def update\n\n #@recipe.ingredients = params[:recipe_ingredients].map {|k, v|\n #ingredient = @recipe.ingredients.find(k) || @recipe.ingredients.build\n #ingredient.update_attributes(:item => Food.find(v[:item_id]), :quantity => v[:quantity]) unless v[:item_id].blank?\n #ingredient\n #}.compact if params[:ingredients]\n\n @recipe.tags = params[:tags].split(/,/).map { |t|\n Tag.find_or_create_by_name(t.strip.downcase)\n }.compact if params[:tags]\n\n respond_to do |format|\n if @recipe.update_attributes(params[:recipe])\n format.html { redirect_to @recipe }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end", "def cookbook\n require 'halite/gem'\n @cookbook ||= Halite::Gem.new(gemspec)\n end", "def cookbook_file(*args, &block)\n Log.instance << \"About to cook the file: #{args[0]}\"\n @@chef_orig_cookbook_file.bind(self).call(args, &block)\n Log.instance << \"Hoora the file: #{args[0]} has been cooked\"\n end", "def update\n if @recipe.update(recipe_params)\n redirect_to @recipe, notice: \"Recipe was successfully updated.\"\n else\n render :edit, status: :unprocessable_entity\n end\n end", "def recipe args=1\n self.summary.recipe args\n end", "def update\n @user=User.find(session[:user])\n params[:recipe][:user_id]=session[:user]\n params[:recipe][:user_name]=@user.name\n @recipe = Recipe.find(params[:id])\n\n respond_to do |format|\n if @recipe.update_attributes(params[:recipe])\n format.html { redirect_to(@recipe, :notice => 'Recipe was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @recipe.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end" ]
[ "0.6896645", "0.67673415", "0.6638705", "0.6559748", "0.64904517", "0.6387237", "0.6283333", "0.62814236", "0.6240274", "0.6208242", "0.61692876", "0.6150001", "0.6108496", "0.604654", "0.60287184", "0.6014465", "0.60095936", "0.6005512", "0.59941614", "0.5976714", "0.59481555", "0.5940666", "0.5940666", "0.59379154", "0.5932024", "0.590551", "0.59047526", "0.5874221", "0.58548486", "0.5815452", "0.5795724", "0.57908493", "0.57841986", "0.57801014", "0.5776232", "0.5772488", "0.5771443", "0.57614654", "0.57524693", "0.5741739", "0.57382774", "0.5738198", "0.5737894", "0.57302827", "0.57195324", "0.5707381", "0.56955016", "0.5689075", "0.5669058", "0.566391", "0.56583333", "0.5654705", "0.5652482", "0.56386995", "0.56343776", "0.56151485", "0.56151485", "0.56151485", "0.56151485", "0.5614839", "0.56084293", "0.56007034", "0.5575212", "0.5571671", "0.55694985", "0.5545143", "0.55423146", "0.55345535", "0.55336094", "0.55336094", "0.55336094", "0.55336094", "0.55336094", "0.55336094", "0.55336094", "0.55336094", "0.55336094", "0.55336094", "0.55336094", "0.55336094", "0.55336094", "0.55336094", "0.55336094", "0.55336094", "0.55336094", "0.55336094", "0.55336094", "0.55336094", "0.55336094", "0.55336094", "0.55336094", "0.55336094", "0.55336094", "0.55336094", "0.55336094", "0.55336094", "0.55336094", "0.55336094", "0.55336094", "0.55336094", "0.55336094" ]
0.0
-1
Binds the given variables to the corresponding placeholders in the SQL text. See Databaseexecute for a description of the valid placeholder syntaxes. Example: stmt = db.prepare( "select from table where a=? and b=?" ) stmt.bind_params( 15, "hello" ) See also execute, bind_param, Statementbind_param, and Statementbind_params.
def bind_params( *bind_vars ) index = 1 bind_vars.flatten.each do |var| if Hash === var var.each { |key, val| bind_param key, val } else bind_param index, var index += 1 end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bind_params( *bind_vars )\n @statement.bind_params( *bind_vars )\n end", "def bind_named_parameters( params )\n check_parameter_count!( params.size )\n params.each_pair do | param, value |\n position = param_position_of( param )\n if position > 0 then\n bind_parameter_to( position, value )\n else\n raise Amalgalite::Error, \"Unable to find parameter '#{param}' in SQL statement [#{sql}]\"\n end\n end\n end", "def call(bind_vars={}, &block)\n sql = prepared_sql\n prepared_args.freeze\n ps = bind(bind_vars)\n ps.clone(:bind_arguments=>ps.map_to_prepared_args(ps.opts[:bind_vars]), :sql=>sql, :prepared_sql=>sql).run(&block)\n end", "def bind_positional_parameters( params )\n check_parameter_count!( params.size )\n params.each_with_index do |value, index|\n position = index + 1\n bind_parameter_to( position, value )\n end\n end", "def bind_parameters(parameters, arguments)\n if parameters.is_a? Cell\n @scope.bind(parameters.car, arguments.car)\n bind_parameters(parameters.cdr, arguments.cdr)\n elsif parameters.is_a? Symbol\n @scope.bind(parameters, arguments)\n elsif parameters.is_a? Nil\n # nothing to do\n else\n raise \"parameter is not symbol => #{parameters}\"\n end\n end", "def postgres_binds(query_with_binds)\n bind_index = 0\n query_with_binds.gsub('?') { |match|\n bind_index += 1\n \"$#{bind_index}\"\n }\nend", "def bind_param( param, value )\n @statement.bind_param( param, value )\n end", "def execute_prepared(sql,params_arr)\n prepared_statement = @database_handle.prepare(sql)\n params_arr.each_with_index do |param,index|\n prepared_statement.bind_param(index+1,param)\n end \n prepared_statement.execute\n end", "def _bind(statement, bindvars, tx = nil)\n @statement = statement\n run(:_send_bind, [statement, bindvars], tx)\n end", "def map_to_prepared_args(bind_vars)\n prepared_args.map{|v, t| [bind_vars[v], t]}\n end", "def bind_parameter_to( position, value )\n bind_type = db.type_map.bind_type_of( value ) \n case bind_type\n when DataType::FLOAT\n @stmt_api.bind_double( position, value )\n when DataType::INTEGER\n @stmt_api.bind_int64( position, value )\n when DataType::NULL\n @stmt_api.bind_null( position )\n when DataType::TEXT\n @stmt_api.bind_text( position, value.to_s )\n when DataType::BLOB\n if value.incremental? then\n @stmt_api.bind_zeroblob( position, value.length )\n @blobs_to_write << value\n else\n @stmt_api.bind_blob( position, value.source )\n end\n else\n raise ::Amalgalite::Error, \"Unknown binding type of #{bind_type} from #{db.type_map.class.name}.bind_type_of\"\n end\n end", "def bind(new_params)\n fake_bound = original_statement.clone\n fake_bound.instance_variable_set :@params, new_params\n fake_bound\n end", "def map_to_prepared_args(bind_vars)\n prepared_args.map{|v| bind_vars[v]}\n end", "def call(type, bind_vars=OPTS, *values, &block)\n ps = to_prepared_statement(type, values)\n ps.extend(BindArgumentMethods)\n ps.call(bind_vars, &block)\n end", "def execute(sql, *bind_values)\n @pool.acquire { |conn| conn.execute(sql, *bind_values) }\n end", "def prepare_for_bind(string)\n string\n end", "def query( sql, *bind_vars, &block ) # :yields: result_set\n stmt = prepare( sql )\n stmt.bind_params( *bind_vars )\n stmt.execute( &block )\n end", "def prepare(type, name=nil, *values)\n ps = to_prepared_statement(type, values)\n ps.extend(PreparedStatementMethods)\n if name\n ps.prepared_statement_name = name\n db.set_prepared_statement(name, ps)\n end\n ps\n end", "def execute_prepared(ps_name, *values)\n stmt = @prepared_statements[ps_name].last\n res = stmt.execute(*values)\n unless res\n raise Error.new(\"Error executing statement #{ps_name}: #{error_msg}\", error_sqlstate)\n end\n stmt\n end", "def prepare(sql, datatypes = nil, tx = nil)\n Statement.prepare(self, sql, datatypes, tx)\n end", "def execute(sql, name = nil, binds = [])\n log(sql, name) do\n sql = bind_params(binds, sql) if prepared_statements\n @connection.do(sql)\n end\n end", "def bind(*) end", "def sql(bindings, type = :find)\n statement, bind_values = build_statement(type)\n statement.gsub('?') { eval_bound_value(bind_values.shift, connection, bindings) }\n end", "def execute(statement, *bind_values)\n with_connection do |connection|\n command = connection.create_command(statement)\n command.execute_non_query(*bind_values)\n end\n end", "def prepared_arg(k)\n @opts[:bind_vars][k]\n end", "def _execute_prepared_statement(conn, ps_name, args, opts)\n conn.exec_prepared(ps_name, args)\n end", "def bind_string(stmt, index, value)\n case value.encoding\n when Encoding.utf_8, Encoding.us_ascii\n API.sqlite3_bind_text(stmt, index, value, value.bytesize, TRANSIENT)\n when Encoding.utf_16le, Encoding.utf_16be\n value = add_byte_order_mask(value)\n API.sqlite3_bind_text16(stmt, index, value, value.bytesize, TRANSIENT)\n else\n API.sqlite3_bind_blob(stmt, index, value, value.bytesize, TRANSIENT)\n end\n end", "def visit_Arel_Nodes_BindParam(x)\n @binds.shift[1]\n end", "def bind_arguments\n @opts[:bind_arguments]\n end", "def escape_sql(args)\n return @text if args.empty?\n sql = @text.dup\n vars = args.dup\n\n replacements = 0\n mismatch = false\n\n sql.gsub!(/'[^']*'|\"[^\"]*\"|`[^`]*`|\\?/) do |x|\n next x unless x == '?'\n replacements += 1\n if vars.empty?\n mismatch = true\n else\n var = vars.shift\n connection.quote_value(var)\n end\n end\n\n if !vars.empty? || mismatch\n raise ArgumentError, \"Binding mismatch: #{args.size} for #{replacements}\"\n else\n sql\n end\n end", "def execute(sql, opts=OPTS, &block)\n super(sql, {:arguments=>bind_arguments}.merge(opts), &block)\n end", "def bind(i, value)\n case value\n when NilClass\n bind_null(i)\n when Float\n bind_double(i, value)\n when Integer\n case value\n when RANGE_INT64\n bind_int64(i, value)\n else\n bind_varchar(i, value.to_s)\n end\n when String\n blob?(value) ? bind_blob(i, value) : bind_varchar(i, value)\n when TrueClass, FalseClass\n bind_bool(i, value)\n when Time\n bind_varchar(i, value.strftime('%Y-%m-%d %H:%M:%S.%N'))\n when Date\n bind_varchar(i, value.strftime('%Y-%m-%d'))\n when BigDecimal\n bind_varchar(i, value.to_s('F'))\n else\n raise(DuckDB::Error, \"not supported type `#{value}` (#{value.class})\")\n end\n end", "def dbupdate(table, variables, condition, names)\n if variables.kind_of?(Array) == false\n v = variables.to_s + \"=?\"\n else\n v = \"\"\n i = 0\n while i < variables.length\n v += variables[i].to_s + \"=?\"\n i += 1\n if i < variables.length\n v += \", \"\n end\n end\n end\n\n if condition.kind_of?(Array) == false\n c = condition.to_s + \"=?\"\n else\n c = \"\"\n i = 0\n while i < condition.length\n c += condition[i].to_s + \"=?\"\n i += 1\n if i < condition.length\n c += \" AND \"\n end\n end\n end\n\n return db.execute(\"UPDATE #{table} SET #{v} WHERE #{c}\", names)\nend", "def prepare_statement_sub(sql)\n sql.gsub(/\\$\\d+/, '?')\n end", "def prepare( str )\n @db.prepare( str )\n end", "def prepared_arg_placeholder\n PREPARED_ARG_PLACEHOLDER\n end", "def bound_variable_arg(arg, conn)\n case arg\n # TODO TDD it:\n when Sequel::SQL::Blob\n # the 1 means treat this as a binary blob\n {:value => arg, :format => 1}\n when Sequel::SQLTime\n # the literal methods put quotes around things, but this is a bound variable, so we can't use those\n arg.strftime(BOUND_VARIABLE_SQLTIME_FORMAT)\n when DateTime, Time\n # the literal methods put quotes around things, but this is a bound variable, so we can't use those\n from_application_timestamp(arg).strftime(BOUND_VARIABLE_TIMESTAMP_FORMAT)\n else\n arg\n end\n end", "def prepare(type, name=nil, *values)\n ps = to_prepared_statement(type, values)\n ps.extend(JDBC::Dataset::PreparedStatementMethods)\n ps.extend(::Sequel::Fdbsql::DatasetMethods::PreparedStatementMethods)\n if name\n ps.prepared_statement_name = name\n db.set_prepared_statement(name, ps)\n end\n ps\n end", "def replace_params(sql, *params)\n sql.gsub!(/\\?/) { |a| quote(params.shift) }\n end", "def dbinsert(table, variables, variable_names)\n i = 1\n marks = \"?\"\n while i < variables.length\n marks += \",?\"\n i += 1\n end\n\n v = \"\"\n i = 0\n while i < variables.length\n v += variables[i].to_s \n i += 1\n if i < variables.length\n v += \", \"\n end\n end\n\n return db.execute(\"INSERT INTO #{table}(#{v}) VALUES (#{marks})\", variable_names)\nend", "def call(bind_vars={}, &block)\n bind(bind_vars).run(&block)\n end", "def do(stmt, bindvars={})\n sanity_check(stmt)\n @handle.do(stmt, bindvars)\n #@handle.do(stmt, DBI::Utils::ConvParam.conv_param(driver_name, bindvars))\n end", "def update()\ndb = PG connect( {dbname: 'bounty_hunter',\n host: 'localhost'\n })\nsql = \"UPDATE bounty_hunters\nSET (name,\n species,\n homeworld,\n favourite_weapon\n )=(\n $1, $2, $3, $4\n )\n WHERE id = $5\n \"\n\nvalues = [@name, @species, @homeworld, @favourite_weapon]\ndb.prepare('update',sql)\n db.exec_prepared('update', values)\n db.close\nend", "def reset(*bind_params)\n @stmt.reset!\n @stmt.bind_params(*bind_params)\n end", "def execute_prepared_statement(name, args)\n check_disconnect_errors{exec_prepared(name, args)}\n end", "def prepare(*)\n raise Error, \"cannot prepare an already prepared statement\" unless allow_preparing_prepared_statements?\n super\n end", "def add_variables(variables, _binding=empty_binding)\n\t\t\t\teval variables.collect{|k,v| \"#{k} = variables[#{k.inspect}]; \"}.join, _binding\n\t\t\t\t_binding\n\t\t\tend", "def prepared_arg_placeholder\n PREPARED_ARG_PLACEHOLDER\n end", "def bind_many(*args)\n\t\targs.each do |ary|\n\t\t\tbind(*ary)\n\t\tend\n\tend", "def execute( *bind_vars )\n reset! if active? || done?\n\n bind_params(*bind_vars) unless bind_vars.empty?\n @results = ResultSet.new(@connection, self)\n\n step if 0 == column_count\n\n yield @results if block_given?\n @results\n end", "def test_assignment_binds_are_substituted\n table = Table.new(:users)\n um = Arel::UpdateManager.new Table.engine\n bp = Nodes::BindParam.new '?'\n um.set [[table[:name], bp]]\n visitor = Class.new(Arel::Visitors::ToSql) {\n include Arel::Visitors::BindVisitor\n }.new Table.engine.connection\n\n assignment = um.ast.values[0]\n actual = visitor.accept(assignment, collector) {\n \"replace\"\n }\n assert actual\n value = actual.value\n assert_like \"\\\"name\\\" = replace\", value\n end", "def set_bind( bind )\n if Option.bind_ok?( bind )\n @bind = bind\n else\n raise \"invalid bind variable name: #{ bind.to_s }\"\n end\n end", "def execute(*values)\n IBM_DB.execute(@stmt, values)\n end", "def bind_required_locals(aRuntime, theActuals)\n max_index = required_arity - 1\n actuals = theActuals\n formal_names = formals.formals.map(&:value)\n\n formals.formals.each_with_index do |arg_name, index|\n arg = actuals[index]\n if arg.nil?\n if actuals.empty? && formals.variadic?\n arg = SkmPair.create_from_a([])\n else\n raise StandardError, \"Unbound variable: '#{arg_name.value}'\"\n end\n end\n\n # IMPORTANT: execute procedure call in argument list now\n arg = arg.evaluate(aRuntime) if arg.kind_of?(ProcedureCall)\n unless arg.kind_of?(SkmElement)\n arg = to_datum(arg)\n end\n # a_def = SkmDefinition.new(position, arg_name, arg)\n a_def = SkmBinding.new(arg_name, arg)\n # $stderr.puts \"Lambda #{object_id.to_s(16)}\"\n # $stderr.puts \"LOCAL #{arg_name.value} #{arg.inspect}\"\n if arg.kind_of?(SkmVariableReference) && !formal_names.include?(arg.value)\n aRuntime.add_binding(arg_name, a_def)\n else\n aRuntime.add_binding(a_def.variable, a_def.evaluate(aRuntime))\n end\n break if index >= max_index\n end\n end", "def bind_required_locals(aRuntime, theActuals)\n max_index = required_arity - 1\n actuals = theActuals\n formal_names = formals.formals.map(&:value)\n\n formals.formals.each_with_index do |arg_name, index|\n arg = actuals[index]\n if arg.nil?\n if actuals.empty? && formals.variadic?\n arg = SkmPair.create_from_a([])\n else\n raise StandardError, \"Unbound variable: '#{arg_name.value}'\"\n end\n end\n\n # IMPORTANT: execute procedure call in argument list now\n arg = arg.evaluate(aRuntime) if arg.kind_of?(ProcedureCall)\n unless arg.kind_of?(SkmElement)\n arg = to_datum(arg)\n end\n # a_def = SkmDefinition.new(position, arg_name, arg)\n a_def = SkmBinding.new(arg_name, arg)\n # $stderr.puts \"Lambda #{object_id.to_s(16)}\"\n # $stderr.puts \"LOCAL #{arg_name.value} #{arg.inspect}\"\n if arg.kind_of?(SkmVariableReference) && !formal_names.include?(arg.value)\n aRuntime.add_binding(arg_name, a_def)\n else\n aRuntime.add_binding(a_def.variable, a_def.evaluate(aRuntime))\n end\n break if index >= max_index\n end\n end", "def prepare(*args)\n ps = super\n ps.extend(::Sequel::Postgres::DatasetMethods::PreparedStatementMethods)\n ps\n end", "def bind(*args, **kwargs)\n if args.empty? && !kwargs.empty?\n vargs, vkwargs = destructure(@value)\n kw = [kwargs.merge(vkwargs)]\n else\n vargs = [@value]\n kw = kwargs.empty? ? EMPTY_ARRAY : [kwargs]\n end\n\n if block_given?\n yield(*vargs, *args, *kw)\n else\n obj, *rest = args\n obj.(*vargs, *rest, *kw)\n end\n end", "def query(sql, *bind_values)\n @pool.acquire { |conn| conn.query(sql, *bind_values).first }\n end", "def execute(sql, *params)\n self.connect\n return nil if ! self.connected? && self.interpreter.preview?\n begin\n sth = self.dbh.prepare(sql)\n if params.empty?\n sth.execute\n else\n sth.execute(*params)\n end\n return sth\n rescue ::DBI::ProgrammingError => e\n raise \"#{e.message} -- #{sql}\"\n end\n end", "def _prepare(name, sql, datatypes = nil, tx = nil)\n run(:_send_parse, [name, sql, datatypes], tx)\n end", "def prepare_variables(variables_param) # rubocop:disable Metrics/MethodLength\n case variables_param\n when String\n ensure_string(variables_param)\n when Hash\n variables_param\n when ActionController::Parameters\n # GraphQL-Ruby will validate name and type of incoming variables.\n variables_param.to_unsafe_hash\n when nil\n {}\n else\n raise ArgumentError, \"Unexpected parameter: #{variables_param}\"\n end\n end", "def multi_query(sql, *bind_values)\n @pool.acquire { |conn| conn.query(sql, *bind_values) }\n end", "def select_values_forcing_binds(arel, name, binds)\n # remove possible force of unprepared SQL during dictionary access\n unprepared_statement_forced = prepared_statements_disabled_cache.include?(object_id)\n prepared_statements_disabled_cache.delete(object_id) if unprepared_statement_forced\n\n select_values(arel, name, binds)\n ensure\n # Restore unprepared_statement setting for surrounding SQL\n prepared_statements_disabled_cache.add(object_id) if unprepared_statement_forced\n end", "def update_where(table, what, where, *bindvars)\n sql = \"update #{table.name}\\nset #{what} where #{where}\"\n#$stderr.puts sql\n db.do(sql, *bindvars)\n end", "def execute *params\r\n sql = parse_args( *params )\r\n @driver.execute( sql )\r\n end", "def bind(params = nil)\n if @name_index\n @conf.insert(@name_index + @conf.length, \" \" + \"bind \" + params.to_s + \"\\n\")\n else\n puts \"no #{@proxy_type} name assigned\"\n return false\n end\n end", "def to_prepared_statement(type, values=nil, opts=OPTS)\n mods = opts[:extend] || []\n mods += [PreparedStatementMethods]\n\n bind.\n clone(:prepared_statement_name=>opts[:name], :prepared_type=>type, :prepared_modify_values=>values, :orig_dataset=>self, :no_cache_sql=>true, :prepared_args=>@opts[:prepared_args]||[]).\n with_extend(*mods)\n end", "def prepareInsertUserStatement\n @conn.prepare(\"insert_user\", \"insert into users (id, name) values ($1, $2)\")\n end", "def varbind(name, value=Null)\n if name.respond_to? :to_str\n vb = VarBind.new(oid(name), value)\n else\n vb = name.to_varbind\n vb.value = value\n end\n vb\n end", "def query(sql, args=nil)\n args = args.map{|v| @db.bound_variable_arg(v, self)} if args\n check_disconnect_errors{super}\n end", "def execute_statement(statement, *arguments)\n if arguments.length > 5\n raise ArgumentError, 'Too many arguments, prepared statement with only upto 5 arguments is supported for simplicity'\n elsif arguments.length == 0\n @session.execute(\"#{statement}\")\n else\n prepared_statement = @session.prepare(\"#{statement}\")\n @session.execute(prepared_statement, arguments: arguments)\n end\n end", "def query(statement, *params)\n @logger.info \"#{statement}: #{params}\"\n @db.exec_params(statement, params)\n end", "def bind(p0) end", "def bind(p0) end", "def execute_dui(sql, opts=OPTS, &block)\n super(sql, {:arguments=>bind_arguments}.merge(opts), &block)\n end", "def query(statement, *params) #Use of splat(*) parameter used with methods where you don't know how many arguements it will take \n @logger.info \"#{statement}: #{params}\" #Funtionailty for the ability to see in the local host terminal d-bug output from sinatra showing all of the requests it's accepting; this will alow us to see the SQL queries that are being executed in the db to help troubleshoot \n @db.exec_params(statement, params)\n end", "def prepare\n # Only do this once\n return if $has_prepared\n\n prepared_statements = {\n temperature_readings: :insert_temp,\n moisture_readings: :insert_moisture,\n light_readings: :insert_light,\n }\n\n prepared_statements.each do |table, name|\n DB[table].prepare(:insert, name, plant_id: :$plant_id, value: :$value)\n end\n\n $has_prepared = true\nend", "def execute_query(sql, *vars)\n if vars && vars.count > 0\n @database.prepare(sql).execute(*vars.flatten)\n else\n @database.prepare(sql).execute\n end\n rescue\n puts \"MyMysql.execute_query(): #{$!}\" if @@verbose\n end", "def sql_op(*args)\n column, expr, bind = (args.size >= 3 ? args : [nil] + args)\n (num_bind, builder) = _compile_builder(expr)\n croak(\"the operator expects num_bind but got #{bind.size}\") if num_bind != bind.size\n return _sql_op(\"sql_op\", builder, column, bind)\n end", "def execute(stmt, bindvars={})\n sanity_check(stmt)\n\n if @convert_types\n bindvars = DBI::Utils::ConvParam.conv_param(driver_name, bindvars)\n end\n\n sth = StatementHandle.new(@handle.execute(stmt, bindvars), true, true, @convert_types, true)\n # FIXME trace sth.trace(@trace_mode, @trace_output)\n sth.dbh = self\n sth.raise_error = raise_error\n\n if block_given?\n begin\n yield sth\n ensure\n sth.finish unless sth.finished?\n end\n else\n return sth\n end\n end", "def database_params= params\n # Checks the presence of the postgres extension\n begin\n require 'postgres'\n rescue LoadError\n @db_params = nil\n raise\n end\n\n begin\n #check if database connection works\n conn = PGconn.connect( params[:host],\n params[:port],\n params[:options],\n params[:tty],\n params[:dbname],\n params[:login],\n params[:password] )\n conn.close\n rescue PGError\n @db_params = nil\n raise\n end\n\n # If everything went ok, assigns the parameters\n @db_params = params\n return true\n end", "def calculate_binding(variables)\n case variables\n when Hash\n require \"ostruct\"\n OpenStruct.new(variables).instance_eval { binding }\n when Binding\n variables\n else\n variables.instance_eval { binding }\n end\n end", "def bind_data(statement,data)\n\t\tif !data.nil?\n\t\t\tdata.to_enum.with_index(1) do |value,index|\n\t\t\t\tcase value\n\t\t\t\twhen Fixnum, Bignum\n\t\t\t\t\tstatement.setLong(index,value)\n\t\t\t\twhen Float\n\t\t\t\t\t#Ruby floats are double precision\n\t\t\t\t\tstatement.setDouble(index,value)\n\t\t\t\twhen TrueClass, FalseClass\n\t\t\t\t\tstatement.setBoolean(index,value)\n\t\t\t\twhen String\n\t\t\t\t\tstatement.setString(index,value)\n\t\t\t\twhen Java::byte[]\n\t\t\t\t\tstatement.setBytes(index,value)\n\t\t\t\telse\n\t\t\t\t\tstatement.setString(index,value.to_s)\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend", "def execute_prepared_statement(ps_name, opts)\n args = opts[:arguments]\n ps = prepared_statement(ps_name)\n sql = ps.prepared_sql\n synchronize(opts[:server]) do |conn|\n unless conn.prepared_statements.fetch(ps_name, []).first == sql\n log_connection_yield(\"PREPARE #{ps_name}: #{sql}\", conn){conn.prepare(sql, ps_name)}\n end\n args = args.map{|v| v.nil? ? nil : prepared_statement_arg(v)}\n log_sql = \"EXECUTE #{ps_name}\"\n if ps.log_sql\n log_sql += \" (\"\n log_sql << sql\n log_sql << \")\"\n end\n begin\n stmt = log_connection_yield(log_sql, conn, args){conn.execute_prepared(ps_name, *args)}\n if block_given?\n yield(stmt)\n else \n stmt.affected\n end\n ensure\n stmt.free_result if stmt\n end\n end\n end", "def execute( sql, *bind_vars )\n stmt = prepare( sql )\n stmt.bind_params( *bind_vars )\n stmt.execute do |result|\n if block_given?\n result.each { |row| yield row }\n else\n return result.inject( [] ) { |arr,row| arr << row; arr }\n end\n end\n end", "def binding(*args, &block)\n method_missing(:binding, *args, &block)\n end", "def execute(*values)\n raise ClientError, \"not prepared\" unless @param_count\n raise ClientError, \"parameter count mismatch\" if values.length != @param_count\n values = values.map{|v| @mysql.charset.convert v}\n @protocol.synchronize do\n begin\n @sqlstate = \"00000\"\n @protocol.reset\n @protocol.send_packet Protocol::ExecutePacket.new(@statement_id, CURSOR_TYPE_NO_CURSOR, values)\n res_packet = @protocol.read_result_packet\n raise ProtocolError, \"invalid field_count\" unless res_packet.field_count == @fields.length\n @fieldname_with_table = nil\n if res_packet.field_count == 0\n @affected_rows, @insert_id, @server_status, @warning_conut =\n res_packet.affected_rows, res_packet.insert_id, res_packet.server_status, res_packet.warning_count\n return nil\n end\n @fields = Array.new(res_packet.field_count).map{Field.new @protocol.read_field_packet}\n @protocol.read_eof_packet\n return StatementResult.new(@mysql, @fields)\n rescue ServerError => e\n @sqlstate = e.sqlstate\n raise\n end\n end\n end", "def prepared_arg?(k)\n @opts[:bind_vars].has_key?(k)\n end", "def bind_first_unbound_field(value)\n field = @unbound_fields.first.first\n PreparedInstruction.new(bound_fields: @bound_fields + [[field,value]], unbound_fields: @unbound_fields[1..-1], operands: @operands)\n end", "def execute(sql, name = nil, _binds = [])\n log(sql, name) do\n @connection.do(sql)\n end\n end", "def execute2( sql, *bind_vars )\n stmt = prepare( sql )\n stmt.bind_params( *bind_vars )\n stmt.execute do |result|\n if block_given?\n yield result.columns\n result.each { |row| yield row }\n else\n return result.inject( [ result.columns ] ) { |arr,row| arr << row; arr }\n end\n end\n end", "def bind(id, repo_id, distributor_id, optional = {})\n required = required_params(binding.send(:local_variables), binding, ['id'])\n call(:post, path(\"#{id}/bindings/\"), :payload => { :required => required, :optional => optional })\n end", "def exec_insert(sql, name, binds)\n exec_query(sql, name, binds)\n end", "def exec_insert(sql, name, binds)\n exec_query(sql, name, binds)\n end", "def create_binding(variable_to_value_hash) \n current_binding = binding\n for variable in variable_to_value_hash.keys\n eval \"#{variable.to_s} = variable_to_value_hash[variable]\", binding\n current_binding = binding\n end\n current_binding\nend", "def check_parameter_count!( num )\n expected = @stmt_api.parameter_count\n if num != expected then \n raise Amalgalite::Error, \"#{sql} has #{expected} parameters, but #{num} were passed to bind.\"\n end\n return expected\n end", "def get_binding(variables)\n obj = Class.new {\n attr_accessor *variables.keys\n def get_binding(); binding end\n }.new\n variables.each { |name, value| obj.public_send(:\"#{name}=\", value) }\n obj.get_binding\n end", "def save()\n #connect to database\n db = PG.connect({ dbname: 'bounty_hunters', host: 'localhost' })\n #write big long SQL string\n sql = \"INSERT INTO bounties\n (\n name,\n species,\n bounty_value,\n favourite_weapon\n )\n VALUES\n ($1, $2, $3, $4)\"\n\n #make array of values for prepared statement\n values = [@name, @species, @bounty_value, @favourite_weapon]\n #prepare statement\n db.prepare(\"save\", sql)\n #exec statement\n db.exec_prepared(\"save\", values)\n #close link to db\n db.close()\n end", "def bind_result(*args)\n if @fields.length != args.length\n raise ClientError, \"bind_result: result value count(#{@fields.length}) != number of argument(#{args.length})\"\n end\n args.each do |a|\n raise TypeError unless [Numeric, Fixnum, Integer, Float, String, Mysql::Time, nil].include? a\n end\n @bind_result = args\n self\n end", "def columns_param(column_names)\n column_names.map! { |name| escape(name) }\n \"columns:!(#{column_names.join(',')})\"\n end" ]
[ "0.7914118", "0.70524013", "0.6406802", "0.6324408", "0.62096703", "0.62084997", "0.60961884", "0.60810673", "0.6011438", "0.59015197", "0.5875792", "0.58161384", "0.57922715", "0.57697296", "0.574275", "0.56216246", "0.5585722", "0.543515", "0.5432835", "0.5409647", "0.5395238", "0.5297508", "0.52835155", "0.5280361", "0.5272468", "0.5234497", "0.5217855", "0.5215725", "0.5208601", "0.52036625", "0.51724446", "0.51464283", "0.51185656", "0.51105505", "0.5105985", "0.5058527", "0.5052031", "0.5038721", "0.5010733", "0.5006877", "0.50059223", "0.49962375", "0.49915606", "0.49553514", "0.49518606", "0.49500522", "0.49354887", "0.4929481", "0.49125108", "0.4901363", "0.4846515", "0.48452288", "0.4782737", "0.47731182", "0.47731182", "0.47586188", "0.475573", "0.47520015", "0.47473744", "0.4740013", "0.47385347", "0.47377205", "0.47344175", "0.47326267", "0.47306272", "0.4729497", "0.47049773", "0.47027588", "0.47007298", "0.4700548", "0.46964186", "0.46914202", "0.46883258", "0.46883258", "0.4684451", "0.46809778", "0.46715334", "0.46688086", "0.4668202", "0.46678343", "0.46668527", "0.4657604", "0.46534", "0.46504563", "0.4639117", "0.46388057", "0.46319968", "0.4625781", "0.46178776", "0.46145347", "0.46008864", "0.45990887", "0.45923626", "0.4591991", "0.45865577", "0.4585938", "0.45841512", "0.45806035", "0.457964", "0.45771474" ]
0.67408913
2
Execute the statement. This creates a new ResultSet object for the statement's virtual machine. If a block was given, the new ResultSet will be yielded to it; otherwise, the ResultSet will be returned. Any parameters will be bound to the statement using bind_params. Example: stmt = db.prepare( "select from table" ) stmt.execute do |result| ... end See also bind_params, execute!.
def execute( *bind_vars ) reset! if active? || done? bind_params(*bind_vars) unless bind_vars.empty? @results = ResultSet.new(@connection, self) step if 0 == column_count yield @results if block_given? @results end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute(stmt, bindvars={})\n sanity_check(stmt)\n\n if @convert_types\n bindvars = DBI::Utils::ConvParam.conv_param(driver_name, bindvars)\n end\n\n sth = StatementHandle.new(@handle.execute(stmt, bindvars), true, true, @convert_types, true)\n # FIXME trace sth.trace(@trace_mode, @trace_output)\n sth.dbh = self\n sth.raise_error = raise_error\n\n if block_given?\n begin\n yield sth\n ensure\n sth.finish unless sth.finished?\n end\n else\n return sth\n end\n end", "def execute\n results = ResultSet.new( @db, @statement.to_s )\n\n if block_given?\n begin\n yield results\n ensure\n results.close\n end\n else\n return results\n end\n end", "def query( sql, *bind_vars, &block ) # :yields: result_set\n stmt = prepare( sql )\n stmt.bind_params( *bind_vars )\n stmt.execute( &block )\n end", "def execute(query, *binds)\n res = nil\n\n mutex.synchronize do\n self.last_query = query\n self.last_statement = sth = new_statement(query)\n res = sth.execute(*binds)\n sth.finish\n yield res if block_given?\n end\n\n return res\n end", "def execute( sql, *bind_vars )\n stmt = prepare( sql )\n stmt.bind_params( *bind_vars )\n stmt.execute do |result|\n if block_given?\n result.each { |row| yield row }\n else\n return result.inject( [] ) { |arr,row| arr << row; arr }\n end\n end\n end", "def execute(sql, opts = {}, &block)\n res = nil\n synchronize(opts[:server]) do |conn|\n res = check_database_errors do\n if sql.is_a?(Symbol)\n execute_prepared_statement(conn, sql, opts, &block)\n else\n log_yield(sql) do\n conn.query(sql, opts[:arguments])\n end\n end\n end\n yield res if block_given?\n res.cmd_tuples\n end\n end", "def execute( *params )\n bind( *params )\n begin\n # save the error state at the beginning of the execution. We only want to\n # reraise the error if it was raised during this execution.\n s_before = $!\n if block_given? then\n while row = next_row\n yield row\n end\n else\n all_rows\n end\n ensure\n s = $!\n begin\n reset_for_next_execute!\n rescue\n # rescuing nothing on purpose\n end\n raise s if s != s_before\n end\n end", "def execute(&block)\n TempTableContext.with_context(db) {|context| execute_in_context(context, &block)}\n end", "def execute(sql, opts=OPTS, &block)\n if opts[:sproc]\n call_sproc(sql, opts, &block)\n elsif sql.is_a?(Symbol)\n execute_prepared_statement(sql, opts, &block)\n else\n synchronize(opts[:server]){|conn| _execute(conn, sql, opts, &block)}\n end\n end", "def run(&block)\n case prepared_type\n when :select, :all\n # Most common scenario, so listed first\n all(&block)\n when :each\n each(&block)\n when :insert_select\n with_sql(prepared_sql).first\n when :first\n first\n when :insert, :update, :delete\n if opts[:returning] && supports_returning?(prepared_type)\n returning_fetch_rows(prepared_sql)\n elsif prepared_type == :delete\n delete\n else\n send(prepared_type, *prepared_modify_values)\n end\n when :insert_pk\n fetch_rows(prepared_sql){|r| return r.values.first}\n when Array\n case prepared_type[0]\n when :map, :as_hash, :to_hash, :to_hash_groups\n send(*prepared_type, &block) \n end\n else\n Sequel::Deprecation.deprecate(\"Using an unsupported prepared statement type (#{prepared_type.inspect})\", 'Switch to using :select as the prepared statement type')\n all(&block)\n end\n end", "def execute(sql, opts=OPTS, &block)\n if sql.is_a?(Symbol)\n execute_prepared_statement(sql, opts, &block)\n else\n synchronize(opts[:server]){|c| _execute(c, sql, opts, &block)}\n end\n rescue Connection::Error => e\n raise_error(e)\n end", "def execute(&block)\n define_method(:execute, &block)\n end", "def execute(sql, *bind_values)\n @pool.acquire { |conn| conn.execute(sql, *bind_values) }\n end", "def execute(sql, *params)\n self.connect\n return nil if ! self.connected? && self.interpreter.preview?\n begin\n sth = self.dbh.prepare(sql)\n if params.empty?\n sth.execute\n else\n sth.execute(*params)\n end\n return sth\n rescue ::DBI::ProgrammingError => e\n raise \"#{e.message} -- #{sql}\"\n end\n end", "def call(bind_vars={}, &block)\n sql = prepared_sql\n prepared_args.freeze\n ps = bind(bind_vars)\n ps.clone(:bind_arguments=>ps.map_to_prepared_args(ps.opts[:bind_vars]), :sql=>sql, :prepared_sql=>sql).run(&block)\n end", "def _execute(conn, sql, opts, &block)\n if sql.is_a?(Symbol)\n execute_prepared_statement(conn, sql, opts, &block)\n else\n conn.execute(sql, opts[:arguments], &block)\n end\n end", "def execute(statement, *bind_values)\n with_connection do |connection|\n command = connection.create_command(statement)\n command.execute_non_query(*bind_values)\n end\n end", "def execute command, *bind\n start = Time.now\n record, command = command, bind.shift if command.kind_of?(Class) && command < Record\n record ? Result.new(record, db.execute(command, *bind)) : db.execute(command, *bind)\n ensure\n log_command(start, command, bind) if @trace\n end", "def prepare(stmt)\n sanity_check(stmt)\n sth = StatementHandle.new(@handle.prepare(stmt), false, true, @convert_types)\n # FIXME trace sth.trace(@trace_mode, @trace_output)\n sth.dbh = self\n sth.raise_error = raise_error\n\n if block_given?\n begin\n yield sth\n ensure\n sth.finish unless sth.finished?\n end\n else\n return sth\n end\n end", "def roby_execute(&block)\n execution_engine.execute(&block)\n end", "def execute\n @result = session.execute(statement)\n execution_successful?\n end", "def execute2( sql, *bind_vars )\n stmt = prepare( sql )\n stmt.bind_params( *bind_vars )\n stmt.execute do |result|\n if block_given?\n yield result.columns\n result.each { |row| yield row }\n else\n return result.inject( [ result.columns ] ) { |arr,row| arr << row; arr }\n end\n end\n end", "def execute(sql, opts=OPTS)\n _execute(sql, opts) do |conn|\n begin\n yield(stmt = log_connection_yield(sql, conn){conn.prepare(sql)})\n ensure\n stmt.close if stmt\n end\n end\n end", "def execute(&block)\n block.call\n end", "def execute(&block)\n block.call\n end", "def execute(sql, args=nil)\n q = query(sql, args)\n block_given? ? yield(q) : q.cmd_tuples\n end", "def execute(sql, args=nil)\n\t\t\t\t\targs = args.map{|v| @db.bound_variable_arg(v, self)} if args\n\t\t\t\t\tq = check_disconnect_errors{execute_query(sql, args)}\n\t\t\t\t\tbegin\n\t\t\t\t\t\tblock_given? ? yield(q) : q.cmd_tuples\n\t\t\t\t\tensure\n\t\t\t\t\t\tq.clear if q && q.respond_to?(:clear)\n\t\t\t\t\tend\n\t\t\t\tend", "def exec_query(sql, name = 'SQL', _binds = [], prepare: false)\n log(sql, name) do\n result = @connection.run(sql)\n ActiveRecord::Result.new(result.columns, result.rows)\n end\n end", "def execute!( *bind_vars, &block )\n execute(*bind_vars)\n block_given? ? each(&block) : to_a\n end", "def execute(sql, name = nil, binds = [])\n log(sql, name) do\n sql = bind_params(binds, sql) if prepared_statements\n @connection.do(sql)\n end\n end", "def execute(*values)\n raise ClientError, \"not prepared\" unless @param_count\n raise ClientError, \"parameter count mismatch\" if values.length != @param_count\n values = values.map{|v| @charset.convert v}\n begin\n @sqlstate = \"00000\"\n nfields = @protocol.stmt_execute_command @statement_id, values\n if nfields\n @fields = @protocol.retr_fields nfields\n @result = StatementResult.new @fields, @protocol, @charset\n else\n @affected_rows, @insert_id, @server_status, @warning_count, @info =\n @protocol.affected_rows, @protocol.insert_id, @protocol.server_status, @protocol.warning_count, @protocol.message\n end\n return self\n rescue ServerError => e\n @last_error = e\n @sqlstate = e.sqlstate\n raise\n end\n end", "def execute(sql, opts=OPTS, &block)\n synchronize(opts[:server]){|c| _execute(c, sql, opts, &block)} \n end", "def do(stmt, bindvars={})\n sanity_check(stmt)\n @handle.do(stmt, bindvars)\n #@handle.do(stmt, DBI::Utils::ConvParam.conv_param(driver_name, bindvars))\n end", "def _execute(conn, sql, opts)\n stmt = log_connection_yield(sql, conn){conn.execute(sql)}\n if block_given?\n yield(stmt)\n else \n stmt.affected\n end\n ensure\n stmt.free if stmt\n end", "def execute\n yield self if block_given?\n end", "def execute(sql, args=nil)\n args = args.map{|v| @db.bound_variable_arg(v, self)} if args\n q = check_disconnect_errors{execute_query(sql, args)}\n begin\n block_given? ? yield(q) : q.cmd_tuples\n ensure\n q.clear if q && q.respond_to?(:clear)\n end\n end", "def execute(sql, opts=OPTS, &block)\n super(sql, {:arguments=>bind_arguments}.merge(opts), &block)\n end", "def execute(*values)\n IBM_DB.execute(@stmt, values)\n end", "def execute(&block)\n\tblock\nend", "def execute(&block)\n\tblock\nend", "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 execute(*values)\n raise ClientError, \"not prepared\" unless @param_count\n raise ClientError, \"parameter count mismatch\" if values.length != @param_count\n values = values.map{|v| @mysql.charset.convert v}\n @protocol.synchronize do\n begin\n @sqlstate = \"00000\"\n @protocol.reset\n @protocol.send_packet Protocol::ExecutePacket.new(@statement_id, CURSOR_TYPE_NO_CURSOR, values)\n res_packet = @protocol.read_result_packet\n raise ProtocolError, \"invalid field_count\" unless res_packet.field_count == @fields.length\n @fieldname_with_table = nil\n if res_packet.field_count == 0\n @affected_rows, @insert_id, @server_status, @warning_conut =\n res_packet.affected_rows, res_packet.insert_id, res_packet.server_status, res_packet.warning_count\n return nil\n end\n @fields = Array.new(res_packet.field_count).map{Field.new @protocol.read_field_packet}\n @protocol.read_eof_packet\n return StatementResult.new(@mysql, @fields)\n rescue ServerError => e\n @sqlstate = e.sqlstate\n raise\n end\n end\n end", "def execute(sql)\n stmt = IBM_DB.exec(@conn, sql)\n raise Error.new(error_msg, error_sqlstate) unless stmt\n Statement.new(stmt)\n end", "def execute(sql, opts=OPTS, &block)\n super(prepared_statement_name, opts, &block)\n end", "def execute\n conn = connection\n Benchmark.bm { |x| x.report { yield conn } }\n conn.close\n end", "def exec(query, args = [], result = 0, &block)\n connect do |c|\n t = Txn.new(c, @log)\n if block_given?\n t.exec(query, args, result, &block)\n else\n t.exec(query, args, result)\n end\n end\n end", "def execute(sql, opts={}, &block)\n if opts[:sproc]\n call_sproc(sql, opts, &block)\n else\n synchronize(opts[:server]){|conn| _execute(conn, sql, opts, &block)}\n end\n end", "def execute_prepared_statement(conn, name, opts=OPTS, &block)\n ps = prepared_statement(name)\n sql = ps.prepared_sql\n ps_name = name.to_s\n\n if args = opts[:arguments]\n args = args.map{|arg| bound_variable_arg(arg, conn)}\n end\n\n unless conn.prepared_statements[ps_name] == sql\n conn.execute(\"DEALLOCATE #{ps_name}\") if conn.prepared_statements.include?(ps_name)\n conn.check_disconnect_errors{log_connection_yield(\"PREPARE #{ps_name} AS #{sql}\", conn){conn.prepare(ps_name, sql)}}\n conn.prepared_statements[ps_name] = sql\n end\n\n log_sql = \"EXECUTE #{ps_name}\"\n if ps.log_sql\n log_sql += \" (\"\n log_sql << sql\n log_sql << \")\"\n end\n\n q = conn.check_disconnect_errors{log_connection_yield(log_sql, conn, args){_execute_prepared_statement(conn, ps_name, args, opts)}}\n begin\n block_given? ? yield(q) : q.cmd_tuples\n ensure\n q.clear if q && q.respond_to?(:clear)\n end\n end", "def execute(sql)\n begin\n db = SQLite3::Database.new(@@db_file)\n @@_set_db_handler.call(db)\n if block_given?\n db.execute(sql) do |row|\n yield row\n end\n else\n return db.execute(sql)\n end\n ensure\n db.close\n end\n end", "def exec(*args, &block)\n if current = Thread.current[:squirm_connection]\n current.exec(*args, &block)\n else\n use {|conn| conn.exec(*args, &block)}\n end\n end", "def exec(sql, *bindvars, &block)\n ret = nil\n thread = Thread.new { ret = super }\n thread.join\n ret\n rescue Interrupt\n self.break\n raise\n end", "def execute\n yield ResultEnumerator.new(self)\n end", "def execute(&block)\r\n block\r\nend", "def execute_block(statements, environment)\n previous = @environment\n begin\n @environment = environment\n\n statements.each do |statement|\n execute statement\n end\n ensure\n @environment = previous\n end\n nil\n end", "def execute(&block)\n block.call\nend", "def exec_query(sql, name = 'SQL', binds = [])\n log(sql, name, binds) do\n result = without_prepared_statement?(binds) ? exec_no_cache(sql) :\n exec_cache(sql, binds)\n result_array = result_as_array(result)\n if ActiveRecord::VERSION::MAJOR >= 4\n column_types = compute_field_types(result)\n ret = ActiveRecord::Result.new(result.fields, result_array, column_types)\n else\n ret = ActiveRecord::Result.new(result.fields, result_array)\n end\n result.clear\n ret\n end\n end", "def _execute(conn, sql, opts)\n r = log_connection_yield((log_sql = opts[:log_sql]) ? sql + log_sql : sql, conn){conn.query(sql)}\n if opts[:type] == :select\n yield r if r\n elsif defined?(yield)\n yield conn\n end\n if conn.respond_to?(:more_results?)\n while conn.more_results? do\n if r\n r.free\n r = nil\n end\n begin\n conn.next_result\n r = conn.use_result\n rescue Mysql::Error => e\n raise_error(e, :disconnect=>true) if MYSQL_DATABASE_DISCONNECT_ERRORS.match(e.message)\n break\n end\n yield r if opts[:type] == :select\n end\n end\n rescue Mysql::Error => e\n raise_error(e)\n ensure\n r.free if r\n # Use up all results to avoid a commands out of sync message.\n if conn.respond_to?(:more_results?)\n while conn.more_results? do\n begin\n conn.next_result\n r = conn.use_result\n rescue Mysql::Error => e\n raise_error(e, :disconnect=>true) if MYSQL_DATABASE_DISCONNECT_ERRORS.match(e.message)\n break\n end\n r.free if r\n end\n end\n end", "def executeSQL(qStr, *params, &block)\n @statement_cache ||= {}\n #@statement_cache[qStr] ||= @db.prepare(qStr)\n @statement_cache[qStr] ||= qStr\n\n puts \"executeSQL: '#{qStr}', '#{params.join(\"', '\")}'\" if ::RdfContext::debug?\n if block_given?\n @db.execute(@statement_cache[qStr], *params) do |row|\n puts \"executeSQL res: #{row.inspect}\" if ::RdfContext::debug?\n row = row.keys.select{|k| k.is_a?(Integer)}.sort.map{|k| row[k]} if row.is_a?(Hash)\n yield(row)\n end\n else\n puts \"executeSQL no block given\" if ::RdfContext::debug?\n @db.execute(@statement_cache[qStr], *params)\n end\n rescue SQLite3::SQLException => e\n puts \"SQL Exception (ignored): #{e.message}\" if ::RdfContext::debug?\n end", "def execute_block(block)\n case\n when block.is_a?(Symbol)\n send(block)\n when block.respond_to?(:call) && (block.arity == 1 || block.arity == -1)\n block.call(self)\n else\n block\n end \n end", "def execute(sql, name = nil, &block)\n log(sql, name) do\n @connection.query(sql, &block)\n end\n end", "def execute(sql, opts=OPTS, &block)\n synchronize(opts[:server]){|conn| check_database_errors{_execute(conn, sql, opts, &block)}}\n end", "def execute\n result = nil\n ActiveRecord::Base.connection_pool.with_connection do |con|\n result = con.execute(to_sql)\n end\n if @sql_returning.nil?\n nil\n else\n if @returning_flat\n result.values.map{|r| r.first}\n else\n result\n end\n end\n end", "def execute &block\n @executor = block\n end", "def execute_prepared_statement(ps_name, opts)\n args = opts[:arguments]\n ps = prepared_statement(ps_name)\n sql = ps.prepared_sql\n synchronize(opts[:server]) do |conn|\n unless conn.prepared_statements.fetch(ps_name, []).first == sql\n log_connection_yield(\"PREPARE #{ps_name}: #{sql}\", conn){conn.prepare(sql, ps_name)}\n end\n args = args.map{|v| v.nil? ? nil : prepared_statement_arg(v)}\n log_sql = \"EXECUTE #{ps_name}\"\n if ps.log_sql\n log_sql += \" (\"\n log_sql << sql\n log_sql << \")\"\n end\n begin\n stmt = log_connection_yield(log_sql, conn, args){conn.execute_prepared(ps_name, *args)}\n if block_given?\n yield(stmt)\n else \n stmt.affected\n end\n ensure\n stmt.free_result if stmt\n end\n end\n end", "def execute(&block)\n block\nend", "def execute(&block)\n block\nend", "def query(sql, *bind_values)\n @pool.acquire { |conn| conn.query(sql, *bind_values).first }\n end", "def execute_prepared(ps_name, *values)\n stmt = @prepared_statements[ps_name].last\n res = stmt.execute(*values)\n unless res\n raise Error.new(\"Error executing statement #{ps_name}: #{error_msg}\", error_sqlstate)\n end\n stmt\n end", "def execute(&block)\n block.call\nend", "def execute(&block)\n block.call\nend", "def execute(&block)\n block.call\nend", "def execute(&block)\n block.call\nend", "def execute(&block)\n block.call\nend", "def execute(&block)\n block.call\nend", "def execute(&block)\n block.call\nend", "def execute(&block)\n block.call\nend", "def execute(&block)\n block.call\nend", "def execute(&block)\n block.call\nend", "def execute(&block)\n block.call\nend", "def execute(&block)\n block.call\nend", "def execute(&block)\n block.call\nend", "def execute(&block)\n block.call\nend", "def execute(&block)\n block.call\nend", "def execute(&block)\n block.call\nend", "def execute(&block)\n block.call\nend", "def execute(&block)\n block.call\nend", "def execute(&block)\n block.call\nend", "def execute(&block)\n block.call\nend", "def execute(&block)\n block.call\nend", "def execute(&block)\n block.call\nend", "def execute(&block)\n block.call\nend", "def execute(&block)\n block.call\nend", "def execute(&block)\n block.call\nend", "def execute(&block)\n block.call\nend", "def execute(&block)\n block.call\nend", "def execute(&block)\n block.call\nend", "def execute(&block)\n block.call\nend" ]
[ "0.78412986", "0.7522994", "0.7345846", "0.6927035", "0.6924953", "0.6923811", "0.6919758", "0.66868365", "0.6662286", "0.66231287", "0.6573493", "0.6498426", "0.6485987", "0.64362", "0.6425445", "0.6412007", "0.63899696", "0.63838255", "0.6362206", "0.6327105", "0.6318795", "0.631817", "0.6258562", "0.6250547", "0.6250547", "0.6250546", "0.62478304", "0.6221338", "0.6185527", "0.6183934", "0.61589956", "0.61524165", "0.61484766", "0.6116517", "0.6077099", "0.6074133", "0.6073042", "0.6068768", "0.6045501", "0.6045501", "0.60257757", "0.6025205", "0.6025205", "0.6025205", "0.5979088", "0.5974097", "0.5945907", "0.59427756", "0.59413093", "0.59401715", "0.5939118", "0.5937832", "0.5904419", "0.5870291", "0.58655846", "0.5865098", "0.58604246", "0.5848642", "0.58403593", "0.58319616", "0.5831375", "0.5822677", "0.58202535", "0.58189374", "0.5799678", "0.57827204", "0.57744503", "0.57722473", "0.57722473", "0.5768307", "0.57528937", "0.5746608", "0.5746608", "0.5746608", "0.5746608", "0.5746608", "0.5746608", "0.5746608", "0.5746608", "0.5746608", "0.5746608", "0.5746608", "0.5746608", "0.5746608", "0.5746608", "0.5746608", "0.5746608", "0.5746608", "0.5746608", "0.5746608", "0.5746608", "0.5746608", "0.5746608", "0.5746608", "0.5746608", "0.5746608", "0.5746608", "0.5746608", "0.5746608", "0.5746608" ]
0.7812787
1
Execute the statement. If no block was given, this returns an array of rows returned by executing the statement. Otherwise, each row will be yielded to the block. Any parameters will be bound to the statement using bind_params. Example: stmt = db.prepare( "select from table" ) stmt.execute! do |row| ... end See also bind_params, execute.
def execute!( *bind_vars, &block ) execute(*bind_vars) block_given? ? each(&block) : to_a end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute( *params )\n bind( *params )\n begin\n # save the error state at the beginning of the execution. We only want to\n # reraise the error if it was raised during this execution.\n s_before = $!\n if block_given? then\n while row = next_row\n yield row\n end\n else\n all_rows\n end\n ensure\n s = $!\n begin\n reset_for_next_execute!\n rescue\n # rescuing nothing on purpose\n end\n raise s if s != s_before\n end\n end", "def execute( sql, *bind_vars )\n stmt = prepare( sql )\n stmt.bind_params( *bind_vars )\n stmt.execute do |result|\n if block_given?\n result.each { |row| yield row }\n else\n return result.inject( [] ) { |arr,row| arr << row; arr }\n end\n end\n end", "def execute( *bind_vars )\n reset! if active? || done?\n\n bind_params(*bind_vars) unless bind_vars.empty?\n @results = ResultSet.new(@connection, self)\n\n step if 0 == column_count\n\n yield @results if block_given?\n @results\n end", "def execute(stmt, bindvars={})\n sanity_check(stmt)\n\n if @convert_types\n bindvars = DBI::Utils::ConvParam.conv_param(driver_name, bindvars)\n end\n\n sth = StatementHandle.new(@handle.execute(stmt, bindvars), true, true, @convert_types, true)\n # FIXME trace sth.trace(@trace_mode, @trace_output)\n sth.dbh = self\n sth.raise_error = raise_error\n\n if block_given?\n begin\n yield sth\n ensure\n sth.finish unless sth.finished?\n end\n else\n return sth\n end\n end", "def execute\n results = ResultSet.new( @db, @statement.to_s )\n\n if block_given?\n begin\n yield results\n ensure\n results.close\n end\n else\n return results\n end\n end", "def query( sql, *bind_vars, &block ) # :yields: result_set\n stmt = prepare( sql )\n stmt.bind_params( *bind_vars )\n stmt.execute( &block )\n end", "def run(&block)\n case prepared_type\n when :select, :all\n # Most common scenario, so listed first\n all(&block)\n when :each\n each(&block)\n when :insert_select\n with_sql(prepared_sql).first\n when :first\n first\n when :insert, :update, :delete\n if opts[:returning] && supports_returning?(prepared_type)\n returning_fetch_rows(prepared_sql)\n elsif prepared_type == :delete\n delete\n else\n send(prepared_type, *prepared_modify_values)\n end\n when :insert_pk\n fetch_rows(prepared_sql){|r| return r.values.first}\n when Array\n case prepared_type[0]\n when :map, :as_hash, :to_hash, :to_hash_groups\n send(*prepared_type, &block) \n end\n else\n Sequel::Deprecation.deprecate(\"Using an unsupported prepared statement type (#{prepared_type.inspect})\", 'Switch to using :select as the prepared statement type')\n all(&block)\n end\n end", "def execute_all( sql ) # :yields: row\n loop do\n stmt = prepare( sql )\n stmt.execute do |result|\n result.each { |row| yield row if block_given? }\n end\n sql = stmt.remainder\n if sql.length > 0\n yield nil if block_given? # notify of new query starting\n else\n break\n end\n end\n end", "def execute(sql, opts = {}, &block)\n res = nil\n synchronize(opts[:server]) do |conn|\n res = check_database_errors do\n if sql.is_a?(Symbol)\n execute_prepared_statement(conn, sql, opts, &block)\n else\n log_yield(sql) do\n conn.query(sql, opts[:arguments])\n end\n end\n end\n yield res if block_given?\n res.cmd_tuples\n end\n end", "def execute(&block)\n TempTableContext.with_context(db) {|context| execute_in_context(context, &block)}\n end", "def _execute(conn, sql, opts, &block)\n if sql.is_a?(Symbol)\n execute_prepared_statement(conn, sql, opts, &block)\n else\n conn.execute(sql, opts[:arguments], &block)\n end\n end", "def roby_execute(&block)\n execution_engine.execute(&block)\n end", "def execute(&block)\n define_method(:execute, &block)\n end", "def execute(sql, args=nil)\n\t\t\t\t\targs = args.map{|v| @db.bound_variable_arg(v, self)} if args\n\t\t\t\t\tq = check_disconnect_errors{execute_query(sql, args)}\n\t\t\t\t\tbegin\n\t\t\t\t\t\tblock_given? ? yield(q) : q.cmd_tuples\n\t\t\t\t\tensure\n\t\t\t\t\t\tq.clear if q && q.respond_to?(:clear)\n\t\t\t\t\tend\n\t\t\t\tend", "def execute(&block)\n block.call\n end", "def execute(&block)\n block.call\n end", "def execute2( sql, *bind_vars )\n stmt = prepare( sql )\n stmt.bind_params( *bind_vars )\n stmt.execute do |result|\n if block_given?\n yield result.columns\n result.each { |row| yield row }\n else\n return result.inject( [ result.columns ] ) { |arr,row| arr << row; arr }\n end\n end\n end", "def execute(sql, args=nil)\n q = query(sql, args)\n block_given? ? yield(q) : q.cmd_tuples\n end", "def _execute(conn, sql, opts)\n stmt = log_connection_yield(sql, conn){conn.execute(sql)}\n if block_given?\n yield(stmt)\n else \n stmt.affected\n end\n ensure\n stmt.free if stmt\n end", "def execute(query, *binds)\n res = nil\n\n mutex.synchronize do\n self.last_query = query\n self.last_statement = sth = new_statement(query)\n res = sth.execute(*binds)\n sth.finish\n yield res if block_given?\n end\n\n return res\n end", "def execute(sql, args=nil)\n args = args.map{|v| @db.bound_variable_arg(v, self)} if args\n q = check_disconnect_errors{execute_query(sql, args)}\n begin\n block_given? ? yield(q) : q.cmd_tuples\n ensure\n q.clear if q && q.respond_to?(:clear)\n end\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 execute(&block)\n\tblock\nend", "def execute(&block)\n\tblock\nend", "def execute(statement, *bind_values)\n with_connection do |connection|\n command = connection.create_command(statement)\n command.execute_non_query(*bind_values)\n end\n end", "def execute(sql, *bind_values)\n @pool.acquire { |conn| conn.execute(sql, *bind_values) }\n end", "def execute\n [lambda, block].each do |aProc|\n next unless aProc\n aProc.call\n end\n end", "def execute\n [lambda, block].each do |aProc|\n next unless aProc\n aProc.call\n end\n end", "def execute(sql, opts=OPTS)\n _execute(sql, opts) do |conn|\n begin\n yield(stmt = log_connection_yield(sql, conn){conn.prepare(sql)})\n ensure\n stmt.close if stmt\n end\n end\n end", "def each\n @pool.with do |conn|\n conn.send_query @sql\n conn.set_single_row_mode\n loop do\n res = conn.get_result\n break unless res\n res.check\n res.stream_each { |row| yield row }\n end\n end\n end", "def execute(sql, opts=OPTS, &block)\n if opts[:sproc]\n call_sproc(sql, opts, &block)\n elsif sql.is_a?(Symbol)\n execute_prepared_statement(sql, opts, &block)\n else\n synchronize(opts[:server]){|conn| _execute(conn, sql, opts, &block)}\n end\n end", "def execute\n yield self if block_given?\n end", "def call(bind_vars={}, &block)\n sql = prepared_sql\n prepared_args.freeze\n ps = bind(bind_vars)\n ps.clone(:bind_arguments=>ps.map_to_prepared_args(ps.opts[:bind_vars]), :sql=>sql, :prepared_sql=>sql).run(&block)\n end", "def execute(*values)\n IBM_DB.execute(@stmt, values)\n end", "def execute(&block)\n block.call\nend", "def execute(sql, opts=OPTS, &block)\n if sql.is_a?(Symbol)\n execute_prepared_statement(sql, opts, &block)\n else\n synchronize(opts[:server]){|c| _execute(c, sql, opts, &block)}\n end\n rescue Connection::Error => e\n raise_error(e)\n end", "def each(*args, &block)\n @stmt.each(*args, &block)\n end", "def execute(&block)\n # block\n block.call\nend", "def execute(&block)\r\n block\r\nend", "def execute(&block)\n block.call\nend", "def execute(&block)\n block.call\nend", "def execute(&block)\n block.call\nend", "def execute(&block)\n block.call\nend", "def execute(&block)\n block.call\nend", "def execute(&block)\n block.call\nend", "def execute(&block)\n block.call\nend", "def execute(&block)\n block.call\nend", "def execute(&block)\n block.call\nend", "def execute(&block)\n block.call\nend", "def execute(&block)\n block.call\nend", "def execute(&block)\n block.call\nend", "def execute(&block)\n block.call\nend", "def execute(&block)\n block.call\nend", "def execute(&block)\n block.call\nend", "def execute(&block)\n block.call\nend", "def execute(&block)\n block.call\nend", "def execute(&block)\n block.call\nend", "def execute(&block)\n block.call\nend", "def execute(&block)\n block.call\nend", "def execute(&block)\n block.call\nend", "def execute(&block)\n block.call\nend", "def execute(&block)\n block.call\nend", "def execute(&block)\n block.call\nend", "def execute(&block)\n block.call\nend", "def execute(&block)\n block.call\nend", "def execute(&block)\n block.call\nend", "def execute(&block)\n block.call\nend", "def execute(&block)\n block.call\nend", "def execute(&block)\n block\nend", "def execute(&block)\n block\nend", "def each_row(the_query, &block)\n begin\n query(the_query)\n unless @result.nil?\n @affected_rows = @result.num_rows # This is non-zero is we do a select, and get results.\n if block_given?\n @result.each(&block)\n else\n result = []\n @result.each { |row| result << row }\n return result\n end\n end\n rescue Mysql::Error => e\n # puts \"#{e.errno}: #{e.error}\"\n raise e\n ensure\n if block_given? && @result != nil\n @result.free\n end\n end\n 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 execute(sql, opts=OPTS, &block)\n super(sql, {:arguments=>bind_arguments}.merge(opts), &block)\n end", "def execute(sql)\n begin\n db = SQLite3::Database.new(@@db_file)\n @@_set_db_handler.call(db)\n if block_given?\n db.execute(sql) do |row|\n yield row\n end\n else\n return db.execute(sql)\n end\n ensure\n db.close\n end\n end", "def execute_block(statements, environment)\n previous = @environment\n begin\n @environment = environment\n\n statements.each do |statement|\n execute statement\n end\n ensure\n @environment = previous\n end\n nil\n end", "def __execute__\n @result = @block[*@args]\n rescue Exception => e\n @result = e\n ensure\n # Prevent multiple executions\n def self.__execute__; nil; end\n end", "def executeSQL(qStr, *params, &block)\n @statement_cache ||= {}\n #@statement_cache[qStr] ||= @db.prepare(qStr)\n @statement_cache[qStr] ||= qStr\n\n puts \"executeSQL: '#{qStr}', '#{params.join(\"', '\")}'\" if ::RdfContext::debug?\n if block_given?\n @db.execute(@statement_cache[qStr], *params) do |row|\n puts \"executeSQL res: #{row.inspect}\" if ::RdfContext::debug?\n row = row.keys.select{|k| k.is_a?(Integer)}.sort.map{|k| row[k]} if row.is_a?(Hash)\n yield(row)\n end\n else\n puts \"executeSQL no block given\" if ::RdfContext::debug?\n @db.execute(@statement_cache[qStr], *params)\n end\n rescue SQLite3::SQLException => e\n puts \"SQL Exception (ignored): #{e.message}\" if ::RdfContext::debug?\n end", "def execute\n result = nil\n ActiveRecord::Base.connection_pool.with_connection do |con|\n result = con.execute(to_sql)\n end\n if @sql_returning.nil?\n nil\n else\n if @returning_flat\n result.values.map{|r| r.first}\n else\n result\n end\n end\n end", "def _execute(conn, sql, opts)\n begin\n r = log_yield(sql){conn.query(sql)}\n if opts[:type] == :select\n yield r if r\n elsif block_given?\n yield conn\n end\n rescue ::Mysql2::Error => e\n raise_error(e, :disconnect=>MYSQL_DATABASE_DISCONNECT_ERRORS.match(e.message))\n end\n end", "def execute(&block)\n puts block.call\nend" ]
[ "0.77273667", "0.7425375", "0.7233965", "0.7043422", "0.6793586", "0.6675891", "0.6615595", "0.66002375", "0.65986073", "0.65450394", "0.64950895", "0.6493661", "0.6486962", "0.6459792", "0.64573944", "0.64573944", "0.6450475", "0.6346525", "0.6297712", "0.6286969", "0.6276806", "0.6240816", "0.62404174", "0.62404174", "0.62404174", "0.6234418", "0.6234418", "0.62195975", "0.62174124", "0.6214578", "0.6214578", "0.6197671", "0.618826", "0.6170758", "0.6151872", "0.61518013", "0.6146584", "0.6119202", "0.6107539", "0.60947895", "0.6076486", "0.6067381", "0.6028674", "0.6028674", "0.6028674", "0.6028674", "0.6028674", "0.6028674", "0.6028674", "0.6028674", "0.6028674", "0.6028674", "0.6028674", "0.6028674", "0.6028674", "0.6028674", "0.6028674", "0.6028674", "0.6028674", "0.6028674", "0.6028674", "0.6028674", "0.6028674", "0.6028674", "0.6028674", "0.6028674", "0.6028674", "0.6028674", "0.6028674", "0.6028674", "0.6028674", "0.60270613", "0.60270613", "0.6013494", "0.5971253", "0.5971253", "0.5971253", "0.5971253", "0.5971253", "0.5971253", "0.5971253", "0.5971253", "0.5971253", "0.5971253", "0.5971253", "0.5971253", "0.5971253", "0.5971253", "0.5971253", "0.5971253", "0.5971253", "0.5971253", "0.59664017", "0.5958744", "0.59348285", "0.5926698", "0.59251", "0.591095", "0.5910787", "0.58912325" ]
0.7001811
4
Returns true if the statement is currently active, meaning it has an open result set.
def active? @rows && !@rows.empty? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def active?\n return false unless @connection.open?\n # return true if @connection.transaction_started\n select(\"SELECT 1 FROM RDB$DATABASE\")\n true\n rescue\n false\n end", "def active?\n return false unless @connection\n raw_connection_do 'SELECT 1'\n true\n case @connection_options[:mode]\n when :dblib\n return @connection.active?\n end\n raw_connection_do(\"SELECT 1\")\n true\n rescue *lost_connection_exceptions\n false\n end", "def active?\n @connection.query 'SELECT 1'\n true\n rescue\n false\n end", "def active\n\t\t(ActiveRecord::Base.connected? && ActiveRecord::Base.connection.active?)\n\tend", "def active?\n @connection.state == System::Data::ConnectionState::open\n end", "def active?\n # Pings the connection to check if it's still good. Note that an\n # #active? method is also available, but that simply returns the\n # last known state, which isn't good enough if the connection has\n # gone stale since the last use.\n @connection.ping\n rescue OracleEnhancedConnectionException\n false\n end", "def transaction_active?\n @db.transaction_active?\n end", "def active? # :nodoc:\n # Pings the connection to check if it's still good. Note that an\n # #active? method is also available, but that simply returns the\n # last known state, which isn't good enough if the connection has\n # gone stale since the last use.\n @raw_connection.ping\n rescue OracleEnhanced::ConnectionException\n false\n end", "def running?\n @db && @db.running?\n end", "def active?\n \n # ⎛A scope in Ruby (incl. this method) always evaluates⎞\n # ⎝to its last expression. ⎠\n \n (!@iost.nil?) && (!@iost.closed?)\n end", "def active_connection?\n connection_id = current_connection_id\n if conn = @reserved_connections.fetch(connection_id, nil)\n !! conn.in_use? # synchronize { conn.in_use? }\n else\n false\n end\n end", "def active_connections?\n self.ensure_ready\n self.connection_pool_list.any?(&:active_connection?)\n end", "def active?\n @conn.handler == self\n end", "def alive?\n @cursor_id != CLOSED_CURSOR\n end", "def active?\n [\n read_connection.stable_point,\n write_connection.stable_point\n ].all?\n end", "def closed?\n @stmt.closed?\n end", "def active_connection?\n @reserved_connections.fetch(current_connection_id) { return false }.in_use?\n end", "def closed?\n @stmt.closed?\n end", "def active_connection?\n synchronize do\n @reserved_connections.fetch(current_connection_id) do\n return false\n end\n end\n end", "def closed?\n @cursor.nil?\n end", "def available?\n @dao.active?\n end", "def active?\n active = false\n @mutex.synchronize { active = @active }\n return active\n end", "def open?\n @connection.open?\n end", "def active?\n active\n end", "def active?\n active\n end", "def open?\n @session && @session.started?\n end", "def active?\n self.class.active?(self)\n end", "def active?\n true\n end", "def active?\n end", "def active?\n end", "def active?\n @active\n end", "def active?\n @active\n end", "def active?\n @active\n end", "def active?\n !!@raw_connection&.ping\n end", "def active?\n adapter.window.active?\n end", "def active?\n @active\n end", "def active?\n @active\n end", "def active?\n @active\n end", "def active?\n @state.active?\n end", "def ready_for_query\n @connection.ready_for_query?\n end", "def active?\n true\n end", "def needs_cursor?\n return true\n end", "def opened?\n @session > -1 ? true : false\n end", "def is_connected?\n logger.debug \"Checking if DB is selected(#{@database.is_db_selected?})\"\n @database.is_db_selected?\n end", "def is_connected?\n logger.debug \"Checking if DB is selected(#{@database.is_db_selected?})\"\n @database.is_db_selected?\n end", "def active?\n if is_active\n return true\n else\n return false\n end\n end", "def active?\n\t\tstatus == STATUSES[2]\n\tend", "def available?\n @dbi.db_instance_status == 'available'\n end", "def available?\n @dbi.db_instance_status == 'available'\n end", "def active?\n ACTIVE_STATUSES.include?(self.status.to_sym)\n end", "def execute_query?\n !@execute.nil?\n end", "def running?\n # Avoid N+1 Query: `.includes_advisory_locks`\n if has_attribute?(:locktype)\n self['locktype'].present?\n else\n advisory_locked?\n end\n end", "def active?\n return @active\n end", "def active?\n !!@active\n end", "def needs_cursor?\n\t\ttrue\n\tend", "def needs_cursor?\n\t\ttrue\n\tend", "def connected?\n if @db_connection\n return true\n else\n return false\n end\n end", "def active?\n @active.value\n end", "def needs_cursor?\n return true\n end", "def active?\n if is_active\n return true\n else\n return false\n end\n end", "def active\n active?\n end", "def active?\n @status == :established\n end", "def report_active?\n\t\tbegin\n\t\t\tReport.table_exists?\n\t\trescue\n\t\t\tfalse\n\t\tend\n\tend", "def active?\n @data[:active]\n end", "def active?\n @active != false\n end", "def auto_commit?\n\t\t@connection.auto_commit?\n\tend", "def active?\n !@playground.collecting? || !connection.is_experiment_completed?(@id)\n end", "def active?\n self.internal_object['status'] == 'Active'\n end", "def open?\n @opened\n end", "def db_alive?\n \t@db_alive == true\n end", "def active?\n @subject&.open?\n end", "def active?\n self.active\n end", "def active?\n self.active\n end", "def closed?\n @db.closed?\n end", "def needs_cursor?\r\n \ttrue\r\n \t end", "def active_db?\n framework.db.active\n end", "def active?\n 'Active' == self.status\n end", "def in_use?\n active_session = access_sessions.active.first\n !active_session.nil?\n end", "def active?\n self.class.active_names.include?(@name)\n end", "def within_transaction?\n !current_transaction.nil?\n end", "def IsActive()\r\n ret = _getproperty(1610743812, [], [])\r\n @lastargs = WIN32OLE::ARGV\r\n ret\r\n end", "def IsActive()\r\n ret = _getproperty(1610743812, [], [])\r\n @lastargs = WIN32OLE::ARGV\r\n ret\r\n end", "def active?\n\t\tactive\n\tend", "def needs_cursor?\n true\n end", "def needs_cursor?\n true\n end", "def needs_cursor?\n true\n end", "def needs_cursor?\n true\n end", "def needs_cursor?\n true\n end", "def needs_cursor?\n true\n end", "def needs_cursor?\n true\n end", "def needs_cursor?\n true\n end", "def execute_mode?\r\n @context[:mode] == :execute\r\n end", "def auto_commit?\n @connection.auto_commit?\n end", "def active?\n active\n end", "def active?\n active\n end", "def active?\n active\n end", "def active?\n active\n end", "def within_transaction?\n !current_transaction.nil?\n end", "def needs_cursor?\n \ttrue\n end", "def active?\n !@socket.nil? && @socket.active?\n end" ]
[ "0.7841427", "0.7833315", "0.77466875", "0.71090865", "0.7083131", "0.6994848", "0.68817127", "0.674244", "0.6712915", "0.66582954", "0.66221863", "0.6622152", "0.6619347", "0.66106075", "0.65719855", "0.65653354", "0.65440273", "0.6524113", "0.6522171", "0.65104294", "0.6497495", "0.64874446", "0.6487286", "0.64505774", "0.64252955", "0.64153004", "0.6405157", "0.6336264", "0.6334277", "0.6334277", "0.63282275", "0.63282275", "0.63282275", "0.6311974", "0.631131", "0.631007", "0.631007", "0.631007", "0.6305708", "0.6283768", "0.6272907", "0.62544763", "0.62486196", "0.6222768", "0.6222768", "0.62158567", "0.62153345", "0.6203647", "0.6203647", "0.61940974", "0.61910456", "0.6182475", "0.61782527", "0.6168242", "0.6154904", "0.6154904", "0.61396986", "0.6138284", "0.6136362", "0.6121462", "0.6118626", "0.61077225", "0.609959", "0.60855424", "0.6080666", "0.6076479", "0.60660076", "0.60641664", "0.6054338", "0.6039714", "0.60395026", "0.60363597", "0.60363597", "0.6034197", "0.6025951", "0.6024281", "0.6022145", "0.6020095", "0.60157806", "0.60132945", "0.60084623", "0.60084623", "0.6002999", "0.6001896", "0.59980917", "0.59980917", "0.59980917", "0.59980917", "0.59980917", "0.59980917", "0.59980917", "0.59909683", "0.5988197", "0.5985392", "0.5985392", "0.5985392", "0.5985392", "0.59822005", "0.59819806", "0.5981206" ]
0.674425
7
Return an array of the column names for this statement. Note that this may execute the statement in order to obtain the metadata; this makes it a (potentially) expensive operation.
def columns must_be_open! return @columns.map(&:first) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def column_names\n columns.map(&:name)\n end", "def column_names\n @column_names ||= columns.collect(&:name)\n end", "def columns(sql)\n return self.dbh.execute(sql).column_names\n end", "def column_names\n @columns.keys\n end", "def column_names\n @entity_columns.map(&:name).map(&:to_s)\n end", "def get_column_metadata( table_name )\r\n sql=<<-SQL\r\n select column_name\r\n from information_schema.columns\r\n where\r\n table_schema = '#{ @schema || 'public' }' and\r\n table_catalog = '#{ @catalog }' and\r\n table_name = '#{ table_name }'\r\n order by ordinal_position;\r\n SQL\r\n column_names = []\r\n execute( sql.trim_tabs ).each do |record|\r\n column_names.push record.column_name\r\n end\r\n return column_names\r\n end", "def get_column_names(table_name)\r\n column_names = get_info(table_name, 'name')\r\n end", "def columns\n @stmt.columns\n end", "def column_names\n @column_names ||= @columns.keys\n end", "def column_names\n keys = COLUMN_NAMES\n keys.map{|key| [Person.field_name(key), key]}\n end", "def column_names\n @column_names || owner.column_names\n end", "def column_names\n columns_in_order.map { |c| c.name }\n end", "def column_names(table_name)\n columns(table_name).map(&:name)\n end", "def column_names\n @column_names = columns_hash.keys\n end", "def columns(table_name)\n @db.table_info(table_name).map { |info| info[\"name\"].to_sym }\n end", "def columns\n if @column_names\n columns = []\n\n # First match against fully named columns, e.g. 'attribute:name'\n @column_names.each{|cn| columns << owner.columns_hash[cn] if owner.columns_hash.has_key?(cn)}\n\n # Now match against aliases if the number of columns found previously do not\n # match the expected @columns_names size, i.e. there's still some missing.\n if columns.size != @column_names.size\n columns_left = @column_names - columns.map{|column| column.name}\n owner.columns_hash.each { |name,column| columns << column if columns_left.include?(column.alias) }\n end\n\n columns\n else\n owner.columns\n end\n end", "def get_columns_name\r\n columns = []\r\n if @columns != nil\r\n @columns.each do |column|\r\n columns.push column\r\n end\r\n end\r\n \r\n if @stats != nil and @stats.length > 0\r\n @stats.each do |stat|\r\n columns.push stat.to_column_name\r\n end\r\n end\r\n \r\n return columns\r\n end", "def column_names\n self[0].keys\n end", "def columns\n @stmt.columns\n end", "def columns()\n return @columns.keys\n end", "def columns\n @columns ||= @stats.values.flatten.map { |a| a.column_name }\n end", "def columns\n get_metadata unless @columns\n return @columns\n end", "def all\n __getobj__.column_names\n end", "def sql_columns\n columns.map(&:sql_names).compact.flatten.uniq.map(&:to_s)\n end", "def column_names\n klass.attributes\n end", "def get_columns\n return @columns\n end", "def column_names\n klass.properties.keys\n end", "def columns\n @columns_hash.values\n end", "def column_names\n klass.new.attributes.keys\n end", "def columns\n @columns ||= connection.columns(table_name, \"#{name} Columns\")\n end", "def column_header_names\r\n column_headers.collect {|header| header.name }\r\n end", "def columns\n @model.columns.map{|c| c.name}\n end", "def columns\n @columns ||= [];\n end", "def columns\n @columns ||= []\n end", "def columns_for(table_name)\n self.connection.columns(table_name)\n end", "def list_columns\n columns\n end", "def get_table_column_names(table)\r\n @db[table].columns\r\n end", "def columns!\n ds = clone(opts.merge(:sql => \"SELECT TOP 1 [T1].* FROM (#{opts[:sql]}) \\\"T1\\\"\"))\n ds.each{break}\n\n if cols = ds.cache[:_columns]\n self.columns = cols\n else\n []\n end\n end", "def column_names\n raise NotSupportedError\n end", "def columns\n return @columns\n end", "def columns\n @columns ||= [].tap do |fields|\n @model.columns.reject { |a| a.name.match(/_id$/) }.each do |column|\n fields << resolve(column.type, column.name)\n end\n end\n end", "def retrieve_name_columns\n fetch_columns.grep /name/\n end", "def columns\n @columns ||= begin\n column_indexes.map do |e|\n e.map do |e|\n @input[e]\n end\n end\n end\n end", "def columns\n orig_dataset.columns\n end", "def names\n @column_families.keys\n end", "def columns\n @columns ||= dataset.columns\n end", "def columns\n @columns ||= dataset.columns\n end", "def table_columns\n klass.column_names\n end", "def columns\n self.class.const_get(:COLUMNS) rescue []\n end", "def columns(table_name, *rest)\n @table.fields.map {|s| ::ActiveRecord::ConnectionAdapters::Column.new(s.to_s, nil, String)}\n end", "def columns\n single_record unless @columns\n @columns || []\n end", "def columns\n @columns ||= 1.upto(@rowset.get_meta_data.get_column_count).map do |i|\n {\n :id => @rowset.get_meta_data.getColumnName(i),\n :name => @rowset.get_meta_data.getColumnLabel(i)\n }\n end\n end", "def column_names(table)\n self.table_column_names ||= {}\n unless table_column_names.include? table\n table_column_names[table] = columns(table).map {|c| c.name}\n end\n table_column_names[table]\n end", "def get_data_colnames(d)\n if d == nil or d.empty?\n return []\n end\n return d.first().keys()\n end", "def columns\n self.class.instance_variable_get(:@columns)\n end", "def value_column_names\n value_columns.map(&:name)\n end", "def wanted_column_names\n nil # nil => select all columns\n end", "def query_part_column_names\n remote_query_column_types.map{|name, type| name}.join(\"\\n , \")\n end", "def columns\n return @columns if @columns\n return nil if frozen?\n set_columns(dataset.naked.columns)\n end", "def columns\n return @columns if @columns\n return nil if frozen?\n set_columns(dataset.naked.columns)\n end", "def columns\n @columns\n end", "def columns\n @columns\n end", "def columns\n collect = []\n recursive_columns(@base, collect)\n end", "def header_array\n @columns.collect {|c|\n if @table[c]\n @table[c][:name].to_s\n else\n \"\"\n end\n }.compact\n end", "def col_names_for_insert\n self.class.column_names.delete_if {|col| col == \"id\"}.join(\", \")\n #returns [\"name\", \"album\"]\n #Notice that the column names in the statement are comma separated. Our column names returned by the code above are in an array. Let's turn them into a comma separated list, contained in a string.\n #Returns \"name, album\"\n end", "def field_names\n @field_names ||= (columns_hash.keys.map(&:to_sym) rescue [])\n end", "def columns_for(table)\n db_connection.select_values(\"show columns from `#{ table }`\")\n end", "def columns\n @header.to_a\n end", "def columns; @columns_hash.values; end", "def column_list(columns)\n if columns.empty?\n WILDCARD\n else\n m = columns.map do |i|\n i.is_a?(Hash) ? i.map{|kv| \"#{literal(kv[0])} AS #{quote_identifier(kv[1])}\"} : literal(i)\n end\n m.join(COMMA_SEPARATOR)\n end\n end", "def columns(table_name, name = nil)#:nodoc:\n sql = \"SHOW FIELDS FROM #{quote_table_name(table_name)}\"\n columns = []\n result = execute(sql, name)\n result.each do |field|\n klass = field[1] =~ /geometry|point|linestring|polygon|multipoint|multilinestring|multipolygon|geometrycollection/i ? ActiveRecord::ConnectionAdapters::SpatialMysql2Column : ActiveRecord::ConnectionAdapters::Mysql2Column\n columns << klass.new(field[0], field[4], field[1], field[2] == \"YES\")\n end\n columns\n end", "def columns(table_name, _name = nil)\n result = @connection.columns(table_name.to_s)\n\n result.each_with_object([]) do |field, cols|\n col_name = field.name\n col_sql_type = native_database_types.invert[name: field.type]\n col_nullable = (field.mode == 'NULLABLE')\n\n args = { sql_type: col_sql_type, type: col_sql_type, limit: nil }\n args[:scale] = nil\n args[:precision] = nil\n\n sql_type_metadata =\n ActiveRecord::ConnectionAdapters::SqlTypeMetadata.new(**args)\n\n cols << ActiveRecord::ConnectionAdapters::Column.new(\n col_name,\n nil,\n sql_type_metadata,\n col_nullable,\n table_name\n )\n end\n end", "def all_columns(excluded_supertypes) #:nodoc:\n columns = []\n trace :columns, \"All Columns for #{name}\" do\n if is_table\n self_value_reference\n else\n columns << ActiveFacts::RMap::Column.new\n end\n references_from.each do |ref|\n trace :columns, \"Columns absorbed via #{ref}\" do\n columns += ref.columns({})\n end\n end\n end\n columns\n end", "def column_names string\n string.split(\"|\").flatten\n end", "def keys\n @klass.column_names\n end", "def columns \n []\n end", "def columns\n @pz.group_by.each_with_index { |val, n| column_id(n) }\n end", "def columns(table_name, _name = nil)\n return [] if table_name.blank?\n table_structure(table_name).each_with_object([]) do |col, cols|\n col_name = col[0] # SQLColumns: COLUMN_NAME\n col_default = col[1] # SQLColumns: COLUMN_DEF\n col_sql_type = col[2] # SQLColumns: DATA_TYPE\n col_nullable = col[3] # SQLColumns: IS_NULLABLE\n col_native_type = col[4] # SQLColumns: TYPE_NAME\n col_limit = col[5] # SQLColumns: COLUMN_SIZE\n col_scale = col[6] # SQLColumns: DECIMAL_DIGITS\n\n args = { sql_type: col_sql_type, type: col_sql_type, limit: col_limit }\n args[:sql_type] = 'boolean' if col_native_type == self.class::BOOLEAN_TYPE\n\n if [ODBC::SQL_DECIMAL, ODBC::SQL_NUMERIC].include?(col_sql_type)\n args[:scale] = col_scale || 0\n args[:precision] = col_limit\n end\n sql_type_metadata = ActiveRecord::ConnectionAdapters::SqlTypeMetadata.new(**args)\n cols << new_column(format_case(col_name), col_default, sql_type_metadata, col_nullable, table_name, col_native_type)\n end\n end", "def columns\n @columns = @clazz.columns_hash.map do |name, column|\n [name, @columns[name] || Column.new(column, @dump)]\n end.to_h.with_indifferent_access\n end", "def columns\r\n unless @columns\r\n @columns = connection.columns(table_name, \"#{name} Columns\")\r\n @columns.each {|column| column.primary = primary_keys.include?(column.name.to_sym)}\r\n end\r\n @columns\r\n end", "def columns\n @columns\n end", "def columns(table_name, _name = nil)\n stmt = @connection.columns(native_case(table_name.to_s))\n result = stmt.fetch_all || []\n stmt.drop\n\n result.each_with_object([]) do |col, cols|\n col_name = col[3] # SQLColumns: COLUMN_NAME\n col_default = col[12] # SQLColumns: COLUMN_DEF\n col_sql_type = col[4] # SQLColumns: DATA_TYPE\n col_native_type = col[5] # SQLColumns: TYPE_NAME\n col_limit = col[6] # SQLColumns: COLUMN_SIZE\n col_scale = col[8] # SQLColumns: DECIMAL_DIGITS\n\n # SQLColumns: IS_NULLABLE, SQLColumns: NULLABLE\n col_nullable = nullability(col_name, col[17], col[10])\n\n args = { sql_type: col_sql_type, type: col_sql_type, limit: col_limit }\n args[:sql_type] = 'boolean' if col_native_type == self.class::BOOLEAN_TYPE\n\n if [ODBC::SQL_DECIMAL, ODBC::SQL_NUMERIC].include?(col_sql_type)\n args[:scale] = col_scale || 0\n args[:precision] = col_limit\n end\n sql_type_metadata = ActiveRecord::ConnectionAdapters::SqlTypeMetadata.new(**args)\n\n cols << new_column(format_case(col_name), col_default, sql_type_metadata, col_nullable, table_name, col_native_type)\n end\n end", "def columns\n @columns = columns_hash.values\n end", "def sql_columns\n \"(#{attributes.keys.join(\", \")})\"\n end", "def column_names\n case csv_columns\n when 'index'\n index_column_names\n else\n collection.first.class.column_names if collection.present?\n end\n end", "def col_names_for_insert\n columns = self.class.column_names # [ \"id\", \"name\", \"grade\"]\n columns.delete_if{|col| col == \"id\"} # [ \"name\", \"grade\"]\n columns.join(\", \") # \"name, grade\"\n end", "def content_columns #:nodoc:\n model_name.constantize.content_columns.collect { |c| c.name.to_sym }.compact rescue []\n end", "def to_a\n column_names = [@query.klass.primary_key] | connect_by_columns\n column_names.map { |name| @query.table[name] }\n end", "def columns\n @columns ||= @csv_data[0].zip(*@csv_data[1..])\n end", "def table_columns\n ActiveRecord::Base.connection.columns(table_name)\n end", "def cols_array\n arr = Array.new\n @columns_hash.each{|k,v| arr << k}\n return arr\n end", "def fields\n column_names.map(&:to_sym)\n .reject { |c| [:id, :created_at, :updated_at].include? c }\n end", "def quoted_column_names(attributes = attributes_with_quotes)\n connection = self.class.connection\n attributes.keys.collect do |column_name|\n connection.quote_column_name(column_name)\n end\n end", "def columns\n unless @columns\n @columns = collection_info[table_name].columns.collect { |col_def|\n col = ActiveRecord::ConnectionAdapters::Column.new(col_def.name, col_def.default, col_def.sql_type, col_def.null)\n col.primary = col.name == primary_key\n col\n }\n end\n @columns\n end", "def columns(table_name, name = nil)#:nodoc:\n # Each table always has a row key called 'ROW'\n columns = [\n Column.new('ROW', '')\n ]\n schema = describe_table(table_name)\n doc = REXML::Document.new(schema)\n column_families = doc.elements['Schema/AccessGroup[@name=\"default\"]'].elements.to_a\n\n @hypertable_column_names[table_name] ||= {}\n for cf in column_families\n column_name = cf.elements['Name'].text\n rubified_name = rubify_column_name(column_name)\n @hypertable_column_names[table_name][rubified_name] = column_name\n columns << new_column(rubified_name, '')\n end\n\n columns\n end", "def columns\n # we want to delay initializing to the @core.columns set for as long as possible. Too soon and .search_sql will not be available to .searchable?\n unless defined? @columns\n self.columns = @core.columns.collect { |c| c.name if @core.columns._inheritable.include?(c.name) && c.searchable? && c.association.nil? && c.text? }.compact\n end\n @columns\n end", "def col_names_for_insert\n self.class.column_names.delete_if {|column| column == \"id\"}.join(\", \")\n end", "def fetch_columns\n raise \"Model name can't be blank\" if @model_name.nil?\n\n @model_name.attribute_names\n end", "def column_all_sql(ca)\n \"#{quote_identifier(ca.table)}.*\"\n end", "def colnames(_J=:*)\n return @colnames if _J == :*\n case _J\n when Array then\n _J.collect do |j| colnames(j) end.flatten(1)\n when Range then\n first = if _J.first < 0 then ncols + _J.first else _J.first end\n last = if _J.last < 0 then ncols + _J.last else _J.last end\n first.upto(last).collect do |j| @colnames[j] end\n when Integer then\n _J = ncols + _J if _J < 0\n [@colnames[_J]]\n when Regexp then\n colnames.select do |colname| _J.match?(colname) end\n else\n [_J]\n end\n end" ]
[ "0.7842423", "0.7661916", "0.76400715", "0.7555133", "0.7448656", "0.73712766", "0.72986823", "0.7296484", "0.7291443", "0.7285645", "0.7264878", "0.72425413", "0.7175319", "0.7128576", "0.7075359", "0.7057506", "0.70546097", "0.70503426", "0.70461655", "0.699372", "0.69775534", "0.6974055", "0.6957895", "0.68736726", "0.6865945", "0.6840309", "0.68150455", "0.6802764", "0.6798374", "0.6786437", "0.67036116", "0.66900325", "0.66657215", "0.6656616", "0.66320866", "0.6618731", "0.66016823", "0.6564972", "0.6562354", "0.65292865", "0.65195787", "0.64950806", "0.6457564", "0.6457247", "0.64571476", "0.645708", "0.645708", "0.6454128", "0.6451364", "0.6421693", "0.64205825", "0.6391509", "0.6381728", "0.6373559", "0.6339402", "0.63376147", "0.6332073", "0.6326429", "0.63208526", "0.63208526", "0.6309953", "0.6309953", "0.6309748", "0.628727", "0.6283189", "0.62678534", "0.62429255", "0.62392855", "0.6234387", "0.62343144", "0.61970127", "0.61904097", "0.61778367", "0.61366236", "0.61323273", "0.6114956", "0.61138505", "0.6113667", "0.6112027", "0.6103035", "0.6075073", "0.6067498", "0.6059036", "0.60582614", "0.6025871", "0.60226214", "0.6019089", "0.6015516", "0.6015304", "0.60127884", "0.60090244", "0.60064256", "0.6006404", "0.5998504", "0.5998223", "0.5995689", "0.5987473", "0.59855235", "0.59844226", "0.59605086" ]
0.6480896
42
Return an array of the data types for each column in this statement. Note that this may execute the statement in order to obtain the metadata; this makes it a (potentially) expensive operation.
def types must_be_open! @columns.map(&:last) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def column_types\n @column_types ||= @columns.values\n end", "def types\n @stmt.types\n end", "def types\n @stmt.types\n end", "def col_types\n result = {}\n columns.each do |c|\n result[c.header] = c.type\n end\n result\n end", "def get_data_types(table_name) \r\n data_types = get_info(table_name, 'type')\r\n data_types.shift\r\n data_types\r\n end", "def types_from_array_records(samples)\n columnar_types = []\n samples.each do |record|\n record.each_with_index {|value,i| (columnar_types[i] ||= []) << guess_type(value) }\n end\n columnar_types.map {|types| merge_types(types) }\n end", "def types\n list = Array.new\n\n if @db != nil\n is_ok = false\n\n begin\n stm = @db.prepare( 'SELECT qType FROM qryResults GROUP BY qType ORDER BY qType')\n rs = stm.execute\n\n rs.each do |row|\n list.push row['qType']\n end\n\n stm.close\n is_ok = true\n rescue ::SQLite3::Exception => e\n Maadi::post_message(:Warn, \"Repository (#{@type}:#{@instance_name}) encountered an SELECT Types error (#{e.message}).\")\n end\n end\n\n return list\n end", "def columns(tables)\n columns = execute <<-SQL\n SELECT\n s.nspname || '.' || t.relname AS table_name,\n a.attname AS column_name,\n pg_catalog.format_type(a.atttypid, a.atttypmod) AS data_type\n FROM pg_attribute a\n JOIN pg_class t on a.attrelid = t.oid\n JOIN pg_namespace s on t.relnamespace = s.oid\n WHERE a.attnum > 0\n AND NOT a.attisdropped\n AND s.nspname || '.' || t.relname IN (#{tables.map {|t| quote(t)}.join(\", \")})\n ORDER BY\n 1, 2\n SQL\n\n columns.map {|v| {table: v[\"table_name\"], column: v[\"column_name\"], type: v[\"data_type\"]}}\n end", "def infer_types!\n types = Array.new(ncols)\n each do |row| merge_types(types, row[:*].infer_string_types) end\n types.each.with_index do |type, i|\n colname = @colnames[i]\n if type <= Integer then\n @rownames.each do |_, rowid| @rows[rowid][colname] = Integer(@rows[rowid][colname]) end\n elsif type <= Float then\n @rownames.each do |_, rowid| @rows[rowid][colname] = Float(@rows[rowid][colname]) end\n end\n end\n self\n end", "def inspect_data_types(t)\n types = {}\n\n t.headers.each do |col|\n type = NilClass\n t[col].each do |v|\n next if v.nil?\n if v.class == String\n type = type_of(v)\n else\n type = v.class\n end\n break\n end\n types[col] = type\n end\n\n types\n end", "def datatypes\n value.document.fetch(\"#{value.key}_type\", [])\n end", "def attribute_types\n\t\treturn self.attr_oids.collect {|oid| self.schema.attribute_types[oid] }\n\tend", "def finalize_datatypes_for_csv\n csv_column_datatypes.map { |column_name, possible_datatypes|\n #If there is string type even atleast 1 there is no other option but to set the datatype to string => varchar\n if possible_datatypes.has_key?(:string)\n csv_column_datatypes[column_name] = :string\n else\n #set the max occurance datatype as the datatype of column\n csv_column_datatypes[column_name] = possible_datatypes.key(possible_datatypes.values.max)\n end\n }\n end", "def datatype_analysis\n SmarterCSV.process(filename, {:col_sep => delimiter, :chunk_size => chunk_size, \n :remove_empty_values => false, :remove_zero_values => false}) do |chunk|\n chunk.each do |row|\n row.each do |key, value|\n unless null_like?(value)\n datatype = determine_dataype(value)\n add_to_datatype(key, datatype.to_sym)\n else \n nullable.push(key) unless nullable.include?(key)\n end\n end\n end\n break\n end\n options[:csv_datatype_analysis] = csv_column_datatypes.clone # To retain the current state of csv_column_datatypes since it's altered further\n finalize_datatypes_for_csv\n options[:csv_column_datatypes] = csv_column_datatypes\n options[:nullable] = nullable\n take_further_actions\n end", "def attribute_types\n return @attribute_types if defined?(@attribute_types)\n @attribute_types = if model_class.respond_to?(:attribute_types)\n model_class.attribute_types\n else\n model_class.column_types\n end\n end", "def columns\n @columns ||= [].tap do |fields|\n @model.columns.reject { |a| a.name.match(/_id$/) }.each do |column|\n fields << resolve(column.type, column.name)\n end\n end\n end", "def column_type\r\n @type\r\n end", "def get_column_type(table_name, column_name) #:nodoc:\r\n sql = <<-SQL\r\nSELECT\r\n CASE\r\n WHEN type_name = 'VARCHAR' or type_name = 'CHAR' or type_name = 'CICHAR' or\r\n type_name = 'NVARCHAR' or type_name = 'NCHAR' or type_name = 'VARBINARY'\r\n THEN CAST(TRIM(type_name) + '(' + TRIM(CAST(column_size AS SQL_CHAR)) + ')' AS SQL_CHAR)\r\n WHEN type_name = 'NUMERIC' or type_name = 'DOUBLE' or type_name = 'CURDOUBLE'\r\n THEN CAST(TRIM(type_name) + '(' + TRIM(CAST(column_size AS SQL_CHAR)) + ',' + TRIM(CAST(decimal_digits AS SQL_CHAR)) + ')' AS SQL_CHAR)\r\n ELSE\r\n TRIM(type_name COLLATE ads_default_cs)\r\n END AS \"domain\"\r\nfrom (EXECUTE PROCEDURE sp_GetColumns( NULL, NULL, '#{table_name}', NULL)) as spgc\r\nWHERE COLUMN_NAME = '#{column_name}'\r\nSQL\r\n rs = select(sql)\r\n if !rs.nil? and !rs[0].nil?\r\n rs[0]['domain']\r\n end\r\n end", "def numeric_columns(table_name)\n columns = []\n @client.query(\"DESC `#{table_name}`;\").each do |column|\n if is_numeric(column[\"Type\"])\n columns.push(column[\"Field\"])\n end\n end\n\n columns\n end", "def types\n load_schema! unless schema_loaded?\n @types\n end", "def column_type\n class_name.columns_hash[@column.to_s].type\n end", "def add_column_types obj\n FbArray.new(obj)\n end", "def all_columns(excluded_supertypes) #:nodoc:\n columns = []\n trace :columns, \"All Columns for #{name}\" do\n if is_table\n self_value_reference\n else\n columns << ActiveFacts::RMap::Column.new\n end\n references_from.each do |ref|\n trace :columns, \"Columns absorbed via #{ref}\" do\n columns += ref.columns({})\n end\n end\n end\n columns\n end", "def datatype\n @options[:datatype] || (@column ? @column.type : nil)\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 dbms_type_cast(columns, rows)\n # Cast the values to the correct type\n columns.each_with_index do |column, col_index|\n #puts \" #{column.name} type #{column.type} length #{column.length} nullable #{column.nullable} scale #{column.scale} precision #{column.precision} searchable #{column.searchable} unsigned #{column.unsigned}\"\n rows.each do |row|\n value = row[col_index]\n\n new_value = case\n when value.nil?\n nil\n when [ODBC::SQL_CHAR, ODBC::SQL_VARCHAR, ODBC::SQL_LONGVARCHAR].include?(column.type)\n # Do nothing, because the data defaults to strings\n # This also covers null values, as they are VARCHARs of length 0\n value.is_a?(String) ? value.force_encoding(\"UTF-8\") : value\n when [ODBC::SQL_DECIMAL, ODBC::SQL_NUMERIC].include?(column.type)\n column.scale == 0 ? value.to_i : value.to_f\n when [ODBC::SQL_REAL, ODBC::SQL_FLOAT, ODBC::SQL_DOUBLE].include?(column.type)\n value.to_f\n when [ODBC::SQL_INTEGER, ODBC::SQL_SMALLINT, ODBC::SQL_TINYINT, ODBC::SQL_BIGINT].include?(column.type)\n value.to_i\n when [ODBC::SQL_BIT].include?(column.type)\n value == 1\n when [ODBC::SQL_DATE, ODBC::SQL_TYPE_DATE].include?(column.type)\n value.to_date\n when [ODBC::SQL_TIME, ODBC::SQL_TYPE_TIME].include?(column.type)\n value.to_time\n when [ODBC::SQL_DATETIME, ODBC::SQL_TIMESTAMP, ODBC::SQL_TYPE_TIMESTAMP].include?(column.type)\n value.to_datetime\n # when [\"ARRAY\"?, \"OBJECT\"?, \"VARIANT\"?].include?(column.type)\n # TODO: \"ARRAY\", \"OBJECT\", \"VARIANT\" all return as VARCHAR\n # so we'd need to parse them to make them the correct type\n\n # As of now, we are just going to return the value as a string\n # and let the consumer handle it. In the future, we could handle\n # if here, but there's not a good way to tell what the type is\n # without trying to parse the value as JSON as see if it works\n # JSON.parse(value)\n when [ODBC::SQL_BINARY].include?(column.type)\n # These don't actually ever seem to return, even though they are\n # defined in the ODBC driver, but I left them in here just in case\n # so that future us can see what they should be\n value\n else\n # the use of @connection.types() results in a \"was not dropped before garbage collection\" warning.\n raise \"Unknown column type: #{column.type} #{@connection.types(column.type).first[0]}\"\n end\n\n row[col_index] = new_value\n end\n end\n rows\n end", "def types\n @types ||= inject({}) { |memo, schema| memo.merge(schema.types) }\n end", "def info\n if @filtered_rset.empty?\n @columns = {}\n return\n end\n\n query = @filtered_rset.to_sql\n\n @columns = @filtered_rset.first.attributes.each_with_object({}) do |c, m|\n m[c[0].to_sym] = nil\n m\n end\n\n tables = ActiveRecord::Base.connection.tables.select do |t|\n Regexp.new('\\b' + t + '\\b') =~ query\n end\n\n tables.each do |t|\n ActiveRecord::Base.connection.columns(t).each do |c|\n @columns[c.name.to_sym] = c.type if @columns.key?(c.name.to_sym)\n end\n end\n\n unless (extra = @columns.values.reject(&:present?)).empty?\n msg = extra.join(', ') + 'have missing types, perhaps these are aliased?'\n raise KilterError, msg\n end\n end", "def columns(table_name, name = nil)#:nodoc:\n sql = \"SHOW FIELDS FROM #{quote_table_name(table_name)}\"\n columns = []\n result = execute(sql, name)\n result.each do |field|\n klass = field[1] =~ /geometry|point|linestring|polygon|multipoint|multilinestring|multipolygon|geometrycollection/i ? ActiveRecord::ConnectionAdapters::SpatialMysql2Column : ActiveRecord::ConnectionAdapters::Mysql2Column\n columns << klass.new(field[0], field[4], field[1], field[2] == \"YES\")\n end\n columns\n end", "def column_definitions(table_name) #:nodoc:\n query <<-end_sql\nselect\nc.name,\ncase\nwhen t.name in ('char', 'varchar', 'nchar', 'nvarchar') then 'string'\nwhen t.name in ('binary', 'varbinary', 'image') then 'binary'\nwhen t.name in ('int', 'smallint', 'tinyint') then 'integer'\nwhen t.name in ('datetime', 'smalldatetime') then 'datetime'\nwhen t.name = 'bit' then 'boolean'\nwhen t.name = 'numeric' and c.prec < 10 and c.scale = 0 then 'integer'\nwhen t.name = 'numeric' then 'decimal'\nwhen t.name = 'text' then 'text'\nelse t.name\nend type,\nd.text,\nc.isnullable\nfrom\nsyscolumns c\ninner join systypes t\non c.xusertype = t.xusertype\nleft outer join syscomments d\non c.cdefault = d.id\nwhere\nc.id = object_id('#{table_name}')\norder by\nc.colid\nend_sql\n end", "def table_columns(table)\n fields = db_client.query(\"SHOW FIELDS FROM #{table['name']}\")\n columns = {}\n fields.each do |field|\n if (table['columns'].nil? || table['columns'].include?(field['Field']))\n t = field['Type']\n t = 'varchar' if t.start_with?('varchar')\n t = 'decimal' if t.start_with?('decimal')\n t = 'int' if (t.start_with?('int') || t.start_with?('tinyint') || t.start_with?('bigint') || t.start_with?('smallint'))\n if !(COLUMN_TYPES.include?(t))\n raise \"Unknown column type #{t}, exiting.\"\n end\n columns[field['Field']] = t\n end\n end\n columns\n end", "def map_data_types(hsh)\n hsh.each_with_object({}) { |(column_name, column_type), hash| hash[column_name] = map_value(column_type) }\n end", "def fields_to_analyze\n columns = klass.columns_hash\n columns.select { |key| columns[key].type == :integer || columns[key].type == :float }\n .reject { |key| key == 'id' }.keys\n end", "def remote_query_column_types\n raise \"You must override `remote_query_column_types' in your class\"\n end", "def columns(table_name, _name = nil)\n return [] if table_name.blank?\n table_structure(table_name).each_with_object([]) do |col, cols|\n col_name = col[0] # SQLColumns: COLUMN_NAME\n col_default = col[1] # SQLColumns: COLUMN_DEF\n col_sql_type = col[2] # SQLColumns: DATA_TYPE\n col_nullable = col[3] # SQLColumns: IS_NULLABLE\n col_native_type = col[4] # SQLColumns: TYPE_NAME\n col_limit = col[5] # SQLColumns: COLUMN_SIZE\n col_scale = col[6] # SQLColumns: DECIMAL_DIGITS\n\n args = { sql_type: col_sql_type, type: col_sql_type, limit: col_limit }\n args[:sql_type] = 'boolean' if col_native_type == self.class::BOOLEAN_TYPE\n\n if [ODBC::SQL_DECIMAL, ODBC::SQL_NUMERIC].include?(col_sql_type)\n args[:scale] = col_scale || 0\n args[:precision] = col_limit\n end\n sql_type_metadata = ActiveRecord::ConnectionAdapters::SqlTypeMetadata.new(**args)\n cols << new_column(format_case(col_name), col_default, sql_type_metadata, col_nullable, table_name, col_native_type)\n end\n end", "def column_type\n return @column_type if defined?(@column_type)\n ind = index\n table[1..500].each do |row|\n if row[ind]&.cell_type\n cel_column_type = row[ind].cell_type\n if !defined?(@column_type) || @column_type.nil?\n @column_type = cel_column_type\n elsif (cel_column_type == @column_type) || (cel_column_type == :nil)\n else\n @column_type = :string\n break\n end\n end\n end\n @column_type\n end", "def column_type(type_indicator)\n case type_indicator\n when :eval; :text\n when :text; :text\n when :string; :string\n when :sec; :double\n when :msec; :double\n when :duration; :double\n when :float; :double\n when :double; :double\n when :integer; :integer\n when :int; :int\n when :timestamp; :datetime\n when :datetime; :datetime\n when :date; :date\n else :string\n end\n end", "def types\n get_metadata unless @types\n return @types\n end", "def type\n @ar_column_info.type\n end", "def data_type\n case query.class\n when ActiveRecord::Relation then\n 'ActiveRecord'\n when Array then\n 'Array'\n end\n end", "def values value_type = :formatted_value\n return @values unless @values.nil?\n\n @values = []\n while @rowset.next do\n @values << 1.upto(self.columns.size).map do |i|\n @rowset.getString i\n end\n end\n\n @values\n end", "def to_a(cols=[])\n col_info = column_info(cols)\n rows = []\n rows << col_info.keys\n while try { @result_set.next } do\n row = []\n col_info.each do |col, info|\n obj = try{ @result_set.object(info[:index]) }\n case info[:type]\n when :string\n row << obj.to_s\n when :boolean\n row << (obj.to_s =~ /true/i ? true : false)\n when :long\n row << obj.to_i\n when :double\n row << obj.to_f\n else\n log.warning \"Unkown type: #{info[:type]} for #{col}\"\n row << obj.to_s\n end\n end\n rows << row\n end\n rows\n end", "def columns(table_name, _name = nil)\n result = @connection.columns(table_name.to_s)\n\n result.each_with_object([]) do |field, cols|\n col_name = field.name\n col_sql_type = native_database_types.invert[name: field.type]\n col_nullable = (field.mode == 'NULLABLE')\n\n args = { sql_type: col_sql_type, type: col_sql_type, limit: nil }\n args[:scale] = nil\n args[:precision] = nil\n\n sql_type_metadata =\n ActiveRecord::ConnectionAdapters::SqlTypeMetadata.new(**args)\n\n cols << ActiveRecord::ConnectionAdapters::Column.new(\n col_name,\n nil,\n sql_type_metadata,\n col_nullable,\n table_name\n )\n end\n end", "def typed_values(klass, values)\n typed_values = {}\n\n values.each do |stat_name, stat_value|\n type = klass.columns_hash[stat_name].type\n typed_values[stat_name] = typed_value(stat_value, type)\n end\n\n typed_values\n end", "def column_type(col)\n self.class.column_type(col)\n end", "def column_type(col)\n column(col).type || nil\n end", "def execute(column_indexes = nil)\n guess(column_indexes).map(&:type)\n end", "def columns\n @stmt.columns\n end", "def type_names\n\t\ttypes_names = DATABASE.execute(\"SELECT name FROM types WHERE id='#{self.type_id[0]}' OR id='#{self.type_id[1]}';\") \t\n\t\treturn types_names\n\tend", "def columns(table_name)\n column_definitions(table_name.to_s).map do |column_name, type, default, notnull, oid, fmod|\n default_value = extract_value_from_default(default)\n type_metadata = fetch_type_metadata(column_name, type, oid, fmod)\n default_function = extract_default_function(default_value, default)\n new_column(column_name, default_value, type_metadata, notnull == 'f', table_name, default_function)\n end\n end", "def dbd_types (model,model_attributes)\n #hard coded mapping look mapping table\n mapping = Hash[ \"binary\"=>\"base64Binary\",\"boolean\"=>\"boolean\",\"date\"=>\"date\",\"datetime\"=>\"dateTime\",\"decimal\"=>\"decimal\",\"float\"=>\"float\",\"integer\"=>\"integer\",\"string\"=>\"string\",\"text\"=>\"string\",\"time\"=>\"time\",\"timestamp\"=>\"dateTime\",]\n dtypes = Hash.new\n model.columns_hash.each_key do |m|\n #make xsd datatye\n dtypes[m.to_s] =\"xsd:#{mapping[model.columns_hash[m].type.to_s] }\"\n end\n #replace mapping\n model_attributes.each do |k,v|\n dtypes[k.to_s]=dtypes[v.to_s]\n end\n dtypes\n end", "def add_typecast_on_load_columns(*columns)\n @typecast_on_load_columns.concat(columns)\n end", "def rows_as_native\n unless @rows_as_native\n @rows_as_native = @rows.collect { |row| Array.new(row.size) { |i| @columns[i].type.translate(row[i]) } }\n end\n @rows_as_native\n end", "def column_type\n object.class.scaffold_column_type(@method_name)\n end", "def columns(sql)\n return self.dbh.execute(sql).column_names\n end", "def column_definitions(table_name) #:nodoc:\n exec_query(<<-end_sql, 'SCHEMA')\n SELECT a.attname as column_name, format_type(a.atttypid, a.atttypmod) as column_type, d.adsrc as column_default, a.attnotnull as column_not_null\n FROM pg_attribute a LEFT JOIN pg_attrdef d\n ON a.attrelid = d.adrelid AND a.attnum = d.adnum\n WHERE a.attrelid = '#{quote_table_name(table_name)}'::regclass\n AND a.attnum > 0 AND NOT a.attisdropped\n ORDER BY a.attnum\n end_sql\n end", "def columns\n @columns.to_enum\n end", "def columns(table_name, _name = nil)\n stmt = @connection.columns(native_case(table_name.to_s))\n result = stmt.fetch_all || []\n stmt.drop\n\n result.each_with_object([]) do |col, cols|\n col_name = col[3] # SQLColumns: COLUMN_NAME\n col_default = col[12] # SQLColumns: COLUMN_DEF\n col_sql_type = col[4] # SQLColumns: DATA_TYPE\n col_native_type = col[5] # SQLColumns: TYPE_NAME\n col_limit = col[6] # SQLColumns: COLUMN_SIZE\n col_scale = col[8] # SQLColumns: DECIMAL_DIGITS\n\n # SQLColumns: IS_NULLABLE, SQLColumns: NULLABLE\n col_nullable = nullability(col_name, col[17], col[10])\n\n args = { sql_type: col_sql_type, type: col_sql_type, limit: col_limit }\n args[:sql_type] = 'boolean' if col_native_type == self.class::BOOLEAN_TYPE\n\n if [ODBC::SQL_DECIMAL, ODBC::SQL_NUMERIC].include?(col_sql_type)\n args[:scale] = col_scale || 0\n args[:precision] = col_limit\n end\n sql_type_metadata = ActiveRecord::ConnectionAdapters::SqlTypeMetadata.new(**args)\n\n cols << new_column(format_case(col_name), col_default, sql_type_metadata, col_nullable, table_name, col_native_type)\n end\n end", "def columns\n @stmt.columns\n end", "def sql_columns\n columns.map(&:sql_names).compact.flatten.uniq.map(&:to_s)\n end", "def column_definitions(table_name) #:nodoc:\n exec_query(<<-end_sql, 'SCHEMA').rows\n SELECT a.attname, format_type(a.atttypid, a.atttypmod),\n pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod\n FROM pg_attribute a LEFT JOIN pg_attrdef d\n ON a.attrelid = d.adrelid AND a.attnum = d.adnum\n WHERE a.attrelid = '#{quote_table_name(table_name)}'::regclass\n AND a.attnum > 0 AND NOT a.attisdropped\n ORDER BY a.attnum\n end_sql\n end", "def attributes\n [type, column_options]\n end", "def column_definitions(table_name) # :nodoc:\n query(<<-end_sql, 'SCHEMA')\n SELECT a.attname, format_type(a.atttypid, a.atttypmod),\n pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod,\n format_encoding(a.attencodingtype::integer)\n FROM pg_attribute a LEFT JOIN pg_attrdef d\n ON a.attrelid = d.adrelid AND a.attnum = d.adnum\n WHERE a.attrelid = '#{quote_table_name(table_name)}'::regclass\n AND a.attnum > 0 AND NOT a.attisdropped\n ORDER BY a.attnum\n end_sql\n end", "def type(column); self[column]['type']; end", "def get_column_metadata( table_name )\r\n sql=<<-SQL\r\n select column_name\r\n from information_schema.columns\r\n where\r\n table_schema = '#{ @schema || 'public' }' and\r\n table_catalog = '#{ @catalog }' and\r\n table_name = '#{ table_name }'\r\n order by ordinal_position;\r\n SQL\r\n column_names = []\r\n execute( sql.trim_tabs ).each do |record|\r\n column_names.push record.column_name\r\n end\r\n return column_names\r\n end", "def operational_attribute_types\n\t\treturn self.directory.schema.operational_attribute_types\n\tend", "def columns\n self.class.const_get(:COLUMNS) rescue []\n end", "def to_a\n columns.map { |column| @attributes[column.name.underscore] }\n end", "def native_database_types\n {\n :primary_key => \"integer not null primary key\",\n :string => { :name => \"varchar\", :limit => 255 },\n :text => { :name => \"blob sub_type text\" },\n :integer => { :name => \"integer\" },\n :float => { :name => \"float\" },\n :decimal => { :name => \"decimal\" },\n :datetime => { :name => \"timestamp\" },\n :timestamp => { :name => \"timestamp\" },\n :time => { :name => \"time\" },\n :date => { :name => \"date\" },\n :binary => { :name => \"blob\" },\n :boolean => { :name => boolean_domain[:name] }\n }\n end", "def value_types; end", "def query_part_column_names\n remote_query_column_types.map{|name, type| name}.join(\"\\n , \")\n end", "def singleTableColDef(tabName)\n res=@conn.exec(\"SELECT column_name,data_type,column_default,is_nullable FROM information_schema.columns WHERE table_name ='#{tabName}'\")\n retType=\"\"\n for i in res\n colVal = \"+\"+i[0].to_s+\"+\" \n dataType = \"+\"+i[1].to_s+\"+\" \n retType = retType + \"|\"+colVal.center(25)+\"|\"+dataType.center(24)+\"|\"+self.singleTableColDesc(tabName)\n retType = retType + \"\\n\"\n end\n return retType\n end", "def type(column_name)\n self.class.type(column_name)\n end", "def column_schema_to_ruby_type(schema)\n case t = schema[:db_type].downcase\n when /\\A(?:medium|small)?int(?:eger)?(?:\\((?:\\d+)\\))?(?: unsigned)?\\z/o\n {:type=>Integer}\n when /\\Atinyint(?:\\((\\d+)\\))?\\z/o\n {:type =>schema[:type] == :boolean ? TrueClass : Integer}\n when /\\Abigint(?:\\((?:\\d+)\\))?(?: unsigned)?\\z/o\n {:type=>Bignum}\n when /\\A(?:real|float|double(?: precision)?)\\z/o\n {:type=>Float}\n when 'boolean'\n {:type=>TrueClass}\n when /\\A(?:(?:tiny|medium|long|n)?text|clob)\\z/o\n {:type=>String, :text=>true}\n when 'date'\n {:type=>Date}\n when /\\A(?:small)?datetime\\z/o\n {:type=>DateTime}\n when /\\Atimestamp(?:\\((\\d+)\\))?(?: with(?:out)? time zone)?\\z/o\n {:type=>DateTime, :size=>($1.to_i if $1)}\n when /\\Atime(?: with(?:out)? time zone)?\\z/o\n {:type=>Time, :only_time=>true}\n when /\\An?char(?:acter)?(?:\\((\\d+)\\))?\\z/o\n {:type=>String, :size=>($1.to_i if $1), :fixed=>true}\n when /\\A(?:n?varchar|character varying|bpchar|string)(?:\\((\\d+)\\))?\\z/o\n {:type=>String, :size=>($1.to_i if $1)}\n when /\\A(?:small)?money\\z/o\n {:type=>BigDecimal, :size=>[19,2]}\n when /\\A(?:decimal|numeric|number)(?:\\((\\d+)(?:,\\s*(\\d+))?\\))?\\z/o\n s = [($1.to_i if $1), ($2.to_i if $2)].compact\n {:type=>BigDecimal, :size=>(s.empty? ? nil : s)}\n when /\\A(?:bytea|(?:tiny|medium|long)?blob|(?:var)?binary)(?:\\((\\d+)\\))?\\z/o\n {:type=>File, :size=>($1.to_i if $1)}\n when 'year'\n {:type=>Integer}\n else\n {:type=>String}\n end\n end", "def columns\n @columns ||= @stats.values.flatten.map { |a| a.column_name }\n end", "def dtypes_binary_functions_matrix func\n ary = []\n DTYPES.each do |i|\n next if i[:enum] == :NM_TYPES\n bry = []\n DTYPES.each do |j|\n next if j[:enum] == :NM_TYPES\n bry << dtypes_function_name(func, i,j)\n end\n ary << \"{ \" + bry.join(\", \") + \" }\"\n end\n ary\n end", "def values_sql_for_column_names_and_attributes( columns, array_of_attributes ) # :nodoc:\n values = []\n array_of_attributes.each do |arr|\n my_values = []\n arr.each_with_index do |val,j|\n my_values << quote( val, columns[j] )\n end\n values << my_values\n end \n values_arr = values.map{ |arr| '(' + arr.join( ',' ) + ')' }\n end", "def map_datapackage_column_types(datapackage_json, csv_name)\n csv_dp_detail = datapackage_json[\"resources\"].detect{ |a| a[\"path\"] == csv_name }\n dp_column_types = {}\n csv_dp_detail[\"schema\"][\"fields\"].each do |sf|\n dp_column_types[sf[\"name\"]] = DATAPACKAGE_TYPE_MAP[sf[\"type\"]]\n end\n dp_column_types\n end", "def field_types\r\n return @field_types\r\n end", "def type(method)\n if @object.respond_to?(:has_attribute?) && @object.has_attribute?(method)\n column = @object.column_for_attribute(method) if @object.respond_to?(:column_for_attribute)\n return column.type if column\n end\n end", "def result_meta\n unless @result_meta\n meta = []\n column_count.times do |idx|\n column_meta = ::OpenStruct.new\n column_meta.name = @stmt_api.column_name( idx )\n\n db_name = @stmt_api.column_database_name( idx ) \n tbl_name = @stmt_api.column_table_name( idx ) \n col_name = @stmt_api.column_origin_name( idx ) \n\n column_meta.schema = ::Amalgalite::Column.new( db_name, tbl_name, col_name, idx )\n column_meta.schema.declared_data_type = @stmt_api.column_declared_type( idx )\n\n # only check for rowid if we have a table name and it is not one of the\n # sqlite_master tables. We could get recursion in those cases.\n if not using_rowid_column? and tbl_name and\n not %w[ sqlite_master sqlite_temp_master ].include?( tbl_name ) and is_column_rowid?( tbl_name, col_name ) then\n @rowid_index = idx\n end\n\n meta << column_meta \n end\n\n @result_meta = meta\n end\n return @result_meta\n end", "def types\n @data.keys & TYPES\n end", "def datatype_for_columnheader(columnheader)\r\n data_type_name = clean_string(Array(data_description_sheet.column(*WBF[:group_methodvaluetype_col]))[method_index_for_columnheader(columnheader)])\r\n Datatypehelper.find_by_name(data_type_name)\r\n end", "def schema_column_type(db_type)\n case db_type\n when /\\A(int(eger)?|bigint|smallint)\\z/\n :integer\n when /\\A(character( varying)?|varchar|text)\\z/\n :string\n when /\\Adate\\z/\n :date\n when /\\A(datetime|timestamp( with(out)? time zone)?)\\z/\n :datetime\n when /\\Atime( with(out)? time zone)?\\z/\n :time\n when /\\A(boolean|tinyint)\\z/\n :boolean\n when /\\A(real|float|double( precision)?)\\z/\n :float\n when /\\A(numeric|decimal|money)\\z/\n :decimal\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 column_type(column)\n (sch = model.db_schema[column]) && sch[:type]\n end", "def set_data_type_and_array\n column_schema = SearchFacet.get_table_schema(column_name: self.big_query_id_column)\n detected_type = column_schema[:data_type]\n self.is_array_based = detected_type.include?('ARRAY')\n item_type = BQ_DATA_TYPES.detect {|d| detected_type.match(d).present?}\n self.data_type = BQ_TO_FACET_TYPES[item_type]\n end", "def columns\n select.inject([]) do |columns, column|\n columns << {\n :type => all_columns[column][:type]\n }.merge({\n :id => column.to_s,\n :label => column_label(column)\n })\n end\n end", "def columns(table_name, *rest)\n @table.fields.map {|s| ::ActiveRecord::ConnectionAdapters::Column.new(s.to_s, nil, String)}\n end", "def types\n FIELD_TYPES\n end", "def extract_types(doc)\n types = []\n @raw_types.each do |raw_type|\n doc.each_element_with_attribute('name', raw_type, 0,\n '//schema/complexType') do |type_node|\n type = {:name => raw_type, :fields => []}\n ext_node = REXML::XPath.first(type_node, 'complexContent/extension')\n if ext_node\n base_type = ext_node.attribute('base').to_s.gsub(/^.+:/, '')\n type[:base] = base_type\n @raw_types << base_type unless @raw_types.include?(base_type)\n seq_node = REXML::XPath.first(ext_node, 'sequence')\n fields = get_element_fields(seq_node)\n process_method_field_types(fields)\n type[:fields] += fields\n end\n seq_node = REXML::XPath.first(type_node, 'sequence')\n if seq_node\n fields = get_element_fields(seq_node)\n process_method_field_types(fields)\n type[:fields] += fields\n end\n types << type\n end\n end\n return types\n end", "def column_names\n klass.attributes\n end", "def column_definitions(table_name)\n fields = query(<<~SQL, \"SCHEMA\")\n SELECT a.attname, format_type(a.atttypid, a.atttypmod),\n pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod,\n c.collname, NULL AS comment,\n #{supports_virtual_columns? ? 'attgenerated' : quote('')} as attgenerated,\n NULL as is_hidden\n FROM pg_attribute a\n LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum\n LEFT JOIN pg_type t ON a.atttypid = t.oid\n LEFT JOIN pg_collation c ON a.attcollation = c.oid AND a.attcollation <> t.typcollation\n WHERE a.attrelid = #{quote(quote_table_name(table_name))}::regclass\n AND a.attnum > 0 AND NOT a.attisdropped\n ORDER BY a.attnum\n SQL\n\n crdb_fields = crdb_column_definitions(table_name)\n\n # Use regex comparison because if a type is an array it will\n # have [] appended to the end of it.\n target_types = [\n /geometry/,\n /geography/,\n /interval/,\n /numeric/\n ]\n\n re = Regexp.union(target_types)\n fields.map do |field|\n dtype = field[1]\n field[1] = crdb_fields[field[0]][2].downcase if re.match(dtype)\n field[7] = crdb_fields[field[0]][1]&.gsub!(/^\\'|\\'?$/, '')\n field[9] = true if crdb_fields[field[0]][3]\n field\n end\n fields.delete_if do |field|\n # Don't include rowid column if it is hidden and the primary key\n # is not defined (meaning CRDB implicitly created it).\n if field[0] == CockroachDBAdapter::DEFAULT_PRIMARY_KEY\n field[9] && !primary_key(table_name)\n else\n false # Keep this entry.\n end\n end\n end", "def type(key)\n column(key).type\n end", "def schema(table, opts={})\n hero = execute(\"DESCRIBE #{table}\")\n hero.map do |h|\n [\n h[:col_name].strip.to_sym,\n { :db_type => h[:data_type].strip , :comment => h[:comment].strip }\n ]\n end\n end", "def schema(table, opts={})\n hero = execute(\"DESCRIBE #{table}\")\n hero.map do |h|\n [ h[:col_name].to_sym, { :db_type => h[:data_type] , :comment => h[:comment] } ]\n end\n end", "def type(column)\n column_named(column).type || nil\n end", "def columns\n ColumnCollection.new(@data)\n end", "def get_record_types\n get_records_with_filter {|records, record_type, offset, ptr| records.push(ptr[0])}\n end", "def to_a\n columns\n end" ]
[ "0.7469181", "0.71150976", "0.7005474", "0.68865716", "0.67476064", "0.65647674", "0.63629097", "0.6311052", "0.62604487", "0.6249", "0.62456113", "0.6181214", "0.6137428", "0.6130923", "0.6054862", "0.6053559", "0.6029096", "0.6018177", "0.5953607", "0.59502286", "0.59054476", "0.5848686", "0.584486", "0.58214486", "0.57924867", "0.57626826", "0.5735145", "0.573158", "0.57248247", "0.5722157", "0.5715968", "0.56816286", "0.56690484", "0.5667066", "0.5655827", "0.5653059", "0.562666", "0.56207347", "0.56148183", "0.5591189", "0.5585295", "0.55841833", "0.5544811", "0.5521569", "0.5515765", "0.5515092", "0.55116266", "0.5495598", "0.5490225", "0.5485344", "0.54776126", "0.5475728", "0.54553753", "0.5442038", "0.542371", "0.5406688", "0.5384797", "0.53841084", "0.5377795", "0.53567785", "0.5351719", "0.53495646", "0.5348504", "0.5346421", "0.53459495", "0.53394157", "0.5332572", "0.5331347", "0.5330142", "0.5318945", "0.5305019", "0.5304486", "0.5297696", "0.52975076", "0.52953094", "0.52934456", "0.5286545", "0.52862024", "0.5274381", "0.52708817", "0.5264733", "0.5253348", "0.5252725", "0.52465034", "0.52408874", "0.52351296", "0.5233333", "0.5228694", "0.5219966", "0.5218441", "0.52092236", "0.52051777", "0.5204299", "0.5203205", "0.5197101", "0.51948065", "0.5194124", "0.5193444", "0.5188056", "0.5185186" ]
0.68075883
4
Performs a sanity check to ensure that the statement is not closed. If it is, an exception is raised.
def must_be_open! # :nodoc: if closed? raise Thredis::Exception, "cannot use a closed statement" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_statement(stmt)\n raise InterfaceError, \"Statement is empty, or contains nothing but whitespace\" if stmt !~ /\\S/\n end", "def integrity_check\n execute( \"PRAGMA integrity_check\" ) do |row|\n raise Exceptions::DatabaseException, row[0] if row[0] != \"ok\"\n end\n end", "def expects_statements?\n false\n end", "def expects_statements?\n false\n end", "def closed?\n @stmt.closed?\n end", "def expects_statements?\n true\n end", "def closed?\n @stmt.closed?\n end", "def sanity_check\n raise Net::SSH::Exception, \"session not open\" unless @open\n end", "def assert(statement = \"Assertion failed!\")\n raise statement unless yield\nend", "def assert(statement = \"Assertion failed!\")\n raise statement unless yield\nend", "def execute_query?\n !@execute.nil?\n end", "def check_execute\n unless executed?\n execute\n end\n end", "def safely(&block)\r\n begin\r\n yield\r\n rescue Exception => e\r\n if e.message =~ /connection was aborted/\r\n puts \" [yp searcher] Error: #{e} #{e.message}. Continuing.\"\r\n end\r\n end\r\n end", "def test_commit_not_connected()\n t = Scalaroid::Transaction.new()\n t.close_connection()\n #assert_raises( Scalaroid::ConnectionError ) { t.commit() }\n t.commit()\n t.close_connection()\n end", "def execute_prepared_statement(name, args)\n check_disconnect_errors{exec_prepared(name, args)}\n end", "def check_connection( conn )\n\tbegin\n\t\tconn.exec( \"SELECT 1\" )\n\trescue PG::Error => err\n\t\t$stderr.puts \"%p while testing connection: %s\" % [ err.class, err.message ]\n\t\tconn.reset\n\tend\nend", "def check_cursor!\n @current_cursor or raise NoCursor.new(\"You have not defined anything to work with!\")\n end", "def check_presence_on_table\n if !self.on_table\n throw(:abort)\n end\n end", "def testCommit_NotConnected()\n t = Scalaris::Transaction.new()\n t.close_connection()\n #assert_raise( Scalaris::ConnectionError ) { t.commit() }\n t.commit()\n t.close_connection()\n end", "def testCommit_NotConnected()\n t = Scalaris::Transaction.new()\n t.close_connection()\n #assert_raise( Scalaris::ConnectionError ) { t.commit() }\n t.commit()\n t.close_connection()\n end", "def expect_db_error(&block)\n begin\n db_error, other_error = 'db_ok', 'other_ok'\n yield\n rescue ActiveRecord::StatementInvalid\n db_error = 'db_error'\n rescue\n other_error = 'other_error'\n end\n expect(other_error).to eql 'other_ok'\n expect(db_error).to eql 'db_error'\nend", "def eof?\n @stmt.done?\n end", "def check\n mark_message \"Schema is #{'not ' unless is_current?}up to date\"\n rescue ConnectionFailed => e\n mark_failure\n mark_message \"Error: '#{e}'\"\n end", "def validate_database\n db = @database_path\n raise \"bad mode of #{db}\" unless File.world_readable?(db).nil?\n end", "def _sanity_check(schema)\n raise SchemaInternalError, \"No name provided on #{self}\" if name.nil?\n raise SchemaInternalError, \"No definition provided on #{self}\" if definition.nil?\n end", "def close\n @stmt.close\n end", "def allow_preparing_prepared_statements?\n false\n end", "def close\n @stmt.close\n end", "def valid_raw_connection\n (@verified && @raw_connection) ||\n # `allow_retry: false`, to force verification: the block won't\n # raise, so a retry wouldn't help us get the valid connection we\n # need.\n with_raw_connection(allow_retry: false, materialize_transactions: false) { |conn| conn }\n end", "def without_prepared_statement?(binds)\n !@prepared_statements || binds.empty?\n end", "def check_connection( conn )\n begin\n @conn.exec(\"SELECT 1\")\n rescue PG::Error => err\n $stderr.puts \"%p while CHECKING TESTING connection: %s\" % [ err.class, err.message ]\n @conn.reset\n puts \"--------- PG CONNECTION RESETED -------------\"\n end\nend", "def valid?\n @conn.valid?\n end", "def closed?\n @cursor.nil?\n end", "def commit_required?; end", "def _semantics_check(clazz, buffer)\n if constraints.primary_key.nil?\n buffer.add_error(self, clazz::MissingPrimaryKey)\n end\n super(clazz, buffer)\n end", "def test_commit_empty()\n t = Scalaroid::Transaction.new()\n t.commit()\n t.close_connection()\n end", "def verify_not_closed\n if @closed\n raise 'pubcontrol instance is closed'\n end\n end", "def test_abort_empty()\n t = Scalaroid::Transaction.new()\n t.abort()\n t.close_connection()\n end", "def testCommit_Empty()\n t = Scalaris::Transaction.new()\n t.commit()\n t.close_connection()\n end", "def testCommit_Empty()\n t = Scalaris::Transaction.new()\n t.commit()\n t.close_connection()\n end", "def ensure_connection!\n fail \"Must have active connection\" unless connection\n end", "def ensure_connection!\n fail \"Must have active connection\" unless connection\n end", "def ensure_connection!\n fail \"Must have active connection\" unless connection\n end", "def ensure_connection!\n fail \"Must have active connection\" unless connection\n end", "def ensure_connection!\n fail \"Must have active connection\" unless connection\n end", "def ensure_connection!\n fail \"Must have active connection\" unless connection\n end", "def validate_input\n problems = test_input\n raise OperationalError, \"Found the following problems: #{problems}\" unless problems.empty?\n end", "def assert\n raise \"Found an error!\" unless yield\nend", "def test_abort_not_connected()\n t = Scalaroid::Transaction.new()\n t.close_connection()\n #assert_raises( Scalaroid::ConnectionError ) { t.abort() }\n t.abort()\n t.close_connection()\n end", "def sanityCheck\n @executor.nil? and raise \"Executor has not been initialized.\"\n @manipulator.nil? and raise \"Manipulator has not been initialized.\"\n @monitor.nil? and raise \"Monitor has not been initialized.\"\n @subject.nil? and raise \"Subject has not been initialized.\"\n end", "def schema_valid_error(schema, message, trace)\n xprint(\"\\n** INVALID SCHEMA ** #{message}: #{schema.inspect}\\n\")\n false\n end", "def testAbort_Empty()\n t = Scalaris::Transaction.new()\n t.abort()\n t.close_connection()\n end", "def testAbort_Empty()\n t = Scalaris::Transaction.new()\n t.abort()\n t.close_connection()\n end", "def syntax_error?\n !@syntax_error.nil?\n end", "def prepared_statements\n false\n end", "def test_run_nothing_raised_if_false\n assert_nothing_raised(RuntimeError) { Execute.run('false') }\n end", "def assert\n\traise \"Uh oh.\" unless yield\nend", "def assert\n\traise \"Error! Error!\" unless yield\nend", "def database_exception_use_sqlstates?\n false\n end", "def database_exception_use_sqlstates?\n false\n end", "def _execute(conn, sql, opts)\n stmt = log_connection_yield(sql, conn){conn.execute(sql)}\n if block_given?\n yield(stmt)\n else \n stmt.affected\n end\n ensure\n stmt.free if stmt\n end", "def assert \n raise \"Error! your code sucks!\" unless yield\nend", "def is_valid?\n raise Exception\n end", "def assert cond\n fail! unless cond\n end", "def delete_statement?\n false\n end", "def statement?\n type == 'statement'\n end", "def check_nosql_connection\n @configuration.no_sql_connection.valid? && @configuration.no_sql_connection.has_connection?\n end", "def query_yields_statements?\n false\n end", "def closed?() end", "def closed?() end", "def closed?() end", "def fatal?; end", "def fatal?; 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 assert\n\traise ArgumentError.new(\"Assertion failed!\") unless yield\nend", "def check!\n evaluate!\n errors = @cursors.errors\n if errors.length > 0\n warn errors.join(\"\\n\")\n 1\n else\n puts \"No errors found!\"\n 0\n end\n end", "def ask(sql, *args, into: nil)\n catch(:ok) do\n each(sql, *args, into: into) { |row| throw :ok, row }\n nil\n end\n end", "def assert\n\traise ArgumentError.new(\"assertion error\") unless yield\nend", "def valid?; end", "def valid?; end", "def valid?; end", "def valid?; end", "def valid?; end", "def testAbort_NotConnected()\n t = Scalaris::Transaction.new()\n t.close_connection()\n #assert_raise( Scalaris::ConnectionError ) { t.abort() }\n t.abort()\n t.close_connection()\n end", "def testAbort_NotConnected()\n t = Scalaris::Transaction.new()\n t.close_connection()\n #assert_raise( Scalaris::ConnectionError ) { t.abort() }\n t.abort()\n t.close_connection()\n end", "def custom_silent_sql(q)\n begin\n query = q + ';' unless q =~ /;$/\n query = @db_connection.query(\"#{query}\")\n return true\n rescue => e\n if e =~ /MySQL server has gone away/\n print_error(\"Lost MySQL Connection!\")\n print_error(\"This is likely due to payload which is too large in size.....\")\n print_error(\"Try compressing with UPX to shrink size down: upx 9 -qq payload.exe\")\n puts \"\\t=> \".white + \"Then try again\".light_red + \".....\".white\n end\n return false\n end\n end", "def check_db_connection\n begin\n ActiveRecord::Base.verify_active_connections! if defined?(ActiveRecord)\n rescue Object => bdrb_error\n log_exception(bdrb_error)\n end\n end", "def query_yields_statements?\n false\n end", "def prepare(stmt)\n sanity_check(stmt)\n sth = StatementHandle.new(@handle.prepare(stmt), false, true, @convert_types)\n # FIXME trace sth.trace(@trace_mode, @trace_output)\n sth.dbh = self\n sth.raise_error = raise_error\n\n if block_given?\n begin\n yield sth\n ensure\n sth.finish unless sth.finished?\n end\n else\n return sth\n end\n end", "def dynamodb_execute\n begin\n yield\n rescue => error\n return error\n end\n end", "def auxiliary_statement_error(name)\n raise ArgumentError, <<-MSG.squish\n There's no '#{name}' auxiliary statement defined for #{self.class.name}.\n MSG\n end", "def invalid?(&_block)\n end", "def check_columns!\n if columns.nil? || columns.empty?\n raise Error, 'cannot literalize HashRow without columns'\n end\n end", "def prepare(*)\n raise Error, \"cannot prepare an already prepared statement\" unless allow_preparing_prepared_statements?\n super\n end", "def failed?\n closed? && !has_met_requirement?\n end", "def validate!\n unless self.lambda or self.block\n raise ArgumentError.new(\"Missing Argument: each_record must take a block/lambda as an argument (#{self.inspect})\")\n end\n\n [self.lambda, self.block].each do |proc|\n # allow negative arity, meaning variable/optional, trust em on that.\n # but for positive arrity, we need 1 or 2 args\n if proc\n unless proc.is_a?(Proc)\n raise NamingError.new(\"argument to each_record must be a block/lambda, not a #{proc.class} #{self.inspect}\")\n end\n if (proc.arity == 0 || proc.arity > 2)\n raise ArityError.new(\"block/proc given to each_record needs 1 or 2 arguments: #{self.inspect}\")\n end\n end\n end\n end", "def validate!\n unless self.lambda or self.block\n raise ArgumentError.new(\"Missing Argument: each_record must take a block/lambda as an argument (#{self.inspect})\")\n end\n\n [self.lambda, self.block].each do |proc|\n # allow negative arity, meaning variable/optional, trust em on that.\n # but for positive arrity, we need 1 or 2 args\n if proc\n unless proc.is_a?(Proc)\n raise NamingError.new(\"argument to each_record must be a block/lambda, not a #{proc.class} #{self.inspect}\")\n end\n if (proc.arity == 0 || proc.arity > 2)\n raise ArityError.new(\"block/proc given to each_record needs 1 or 2 arguments: #{self.inspect}\")\n end\n end\n end\n end", "def run_sql(sql_query)\n begin\n CONNECTION.execute(sql_query)\n rescue Exception => msg\n @errors << msg\n false\n end\n end", "def try_to_update_database\n begin\n yield\n rescue Exception => msg\n puts \"Not saved: #{msg}\"\n end\n end", "def assert\n raise \"ERROR!\" unless yield \nend" ]
[ "0.6775886", "0.614622", "0.6121186", "0.6121186", "0.60484594", "0.59901685", "0.59743994", "0.5653497", "0.56164974", "0.56164974", "0.54735667", "0.5429225", "0.5390244", "0.5353985", "0.52740806", "0.52547145", "0.5230944", "0.52300596", "0.5227438", "0.5227438", "0.5212386", "0.52094775", "0.52066314", "0.52034134", "0.518232", "0.51789796", "0.5166576", "0.5136496", "0.51212215", "0.5104724", "0.5084298", "0.50739384", "0.50709796", "0.50641644", "0.5063761", "0.5059132", "0.5056474", "0.504636", "0.5046224", "0.5046224", "0.5038008", "0.5038008", "0.5038008", "0.5038008", "0.5038008", "0.5038008", "0.5037248", "0.5033165", "0.50206375", "0.5017426", "0.501237", "0.50024563", "0.50024563", "0.49881592", "0.49877122", "0.4968396", "0.49651968", "0.4964371", "0.4961412", "0.49611136", "0.49575505", "0.49460402", "0.4942777", "0.49270573", "0.49267766", "0.49263054", "0.49239317", "0.4909661", "0.48987514", "0.48987514", "0.48987514", "0.48869994", "0.48869994", "0.4880833", "0.48659685", "0.4865232", "0.48625514", "0.4851909", "0.48510858", "0.48510858", "0.48510858", "0.48510858", "0.48510858", "0.48506218", "0.48506218", "0.4842992", "0.48426166", "0.4839034", "0.48369005", "0.4836057", "0.48239362", "0.48211876", "0.4800529", "0.47842214", "0.4782686", "0.47822413", "0.47822413", "0.47772855", "0.47711754", "0.47705397" ]
0.6764198
1
ZZZ def convert_type(rows, columns) rows.each do |row| for i in 0...row.size row[i] = Integer(row[i]) if columns[i].last == 'int' end end rows end
def query_thredis(prepare_only) if prepare_only @rows = @connection.redis.sqlprepare(@sql) else @rows = @connection.redis.sql(@sql, *@params) @prepare_only = false end if @rows.is_a? Integer @rows, @columns, @connection.changes = [], [], @rows else @columns = @rows.shift ## @rows = convert_type(@rows, @columns) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 infer_types!\n types = Array.new(ncols)\n each do |row| merge_types(types, row[:*].infer_string_types) end\n types.each.with_index do |type, i|\n colname = @colnames[i]\n if type <= Integer then\n @rownames.each do |_, rowid| @rows[rowid][colname] = Integer(@rows[rowid][colname]) end\n elsif type <= Float then\n @rownames.each do |_, rowid| @rows[rowid][colname] = Float(@rows[rowid][colname]) end\n end\n end\n self\n end", "def dbms_type_cast(columns, rows)\n # Cast the values to the correct type\n columns.each_with_index do |column, col_index|\n #puts \" #{column.name} type #{column.type} length #{column.length} nullable #{column.nullable} scale #{column.scale} precision #{column.precision} searchable #{column.searchable} unsigned #{column.unsigned}\"\n rows.each do |row|\n value = row[col_index]\n\n new_value = case\n when value.nil?\n nil\n when [ODBC::SQL_CHAR, ODBC::SQL_VARCHAR, ODBC::SQL_LONGVARCHAR].include?(column.type)\n # Do nothing, because the data defaults to strings\n # This also covers null values, as they are VARCHARs of length 0\n value.is_a?(String) ? value.force_encoding(\"UTF-8\") : value\n when [ODBC::SQL_DECIMAL, ODBC::SQL_NUMERIC].include?(column.type)\n column.scale == 0 ? value.to_i : value.to_f\n when [ODBC::SQL_REAL, ODBC::SQL_FLOAT, ODBC::SQL_DOUBLE].include?(column.type)\n value.to_f\n when [ODBC::SQL_INTEGER, ODBC::SQL_SMALLINT, ODBC::SQL_TINYINT, ODBC::SQL_BIGINT].include?(column.type)\n value.to_i\n when [ODBC::SQL_BIT].include?(column.type)\n value == 1\n when [ODBC::SQL_DATE, ODBC::SQL_TYPE_DATE].include?(column.type)\n value.to_date\n when [ODBC::SQL_TIME, ODBC::SQL_TYPE_TIME].include?(column.type)\n value.to_time\n when [ODBC::SQL_DATETIME, ODBC::SQL_TIMESTAMP, ODBC::SQL_TYPE_TIMESTAMP].include?(column.type)\n value.to_datetime\n # when [\"ARRAY\"?, \"OBJECT\"?, \"VARIANT\"?].include?(column.type)\n # TODO: \"ARRAY\", \"OBJECT\", \"VARIANT\" all return as VARCHAR\n # so we'd need to parse them to make them the correct type\n\n # As of now, we are just going to return the value as a string\n # and let the consumer handle it. In the future, we could handle\n # if here, but there's not a good way to tell what the type is\n # without trying to parse the value as JSON as see if it works\n # JSON.parse(value)\n when [ODBC::SQL_BINARY].include?(column.type)\n # These don't actually ever seem to return, even though they are\n # defined in the ODBC driver, but I left them in here just in case\n # so that future us can see what they should be\n value\n else\n # the use of @connection.types() results in a \"was not dropped before garbage collection\" warning.\n raise \"Unknown column type: #{column.type} #{@connection.types(column.type).first[0]}\"\n end\n\n row[col_index] = new_value\n end\n end\n rows\n end", "def map_row_to_numbers(row, type)\n row[4...row.length-2].map {|x| if type == 'f' then x.to_f else x.to_i end}\n end", "def int cols\n decode_values :int, cols\n end", "def ints cols\n decode_values :int, cols, true\n end", "def convert(t, dtype)\n dtype.each do |col, type|\n if type == Integer \n t[col] = t[col].map{|v| v.to_i unless v.nil?}\n elsif type == Float\n t[col] = t[col].map{|v| v.to_f unless v.nil?}\n elsif type == String\n t[col] = t[col].map{|v| v.to_s unless v.nil?}\n elsif type == DateTime\n t[col] = t[col].map do |dt|\n begin\n DateTime.parse dt.to_s\n rescue => exception\n end\n end\n elsif type == Date\n t[col] = t[col].map do |dt|\n begin\n Date.parse dt.to_s\n rescue => exception\n end\n end\n else\n throw \"Unsupported dtype '#{type}'\"\n end\n end\n end", "def typecast(obj)\n case obj \n when Array\n _typecast(convert_format(obj))\n when Hash\n unless @columns\n raise Error, 'PGRow::Parser without columns cannot typecast from a hash'\n end\n _typecast(obj)\n else\n raise Error, 'PGRow::Parser can only typecast arrays and hashes'\n end\n end", "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 setup_type_convertor_map\n super\n @type_convertor_map[Java::JavaSQL::Types::INTEGER] = @type_convertor_map[Java::JavaSQL::Types::BIGINT]\n @basic_type_convertor_map[Java::JavaSQL::Types::INTEGER] = @basic_type_convertor_map[Java::JavaSQL::Types::BIGINT]\n @type_convertor_map[Java::JavaSQL::Types::DATE] = lambda do |r, i|\n if v = r.getString(i)\n Sequel.string_to_date(v)\n end\n end\n @type_convertor_map[Java::JavaSQL::Types::BLOB] = lambda do |r, i|\n if v = r.getBytes(i)\n Sequel::SQL::Blob.new(String.from_java_bytes(v))\n elsif !r.wasNull\n Sequel::SQL::Blob.new('')\n end\n end\n end", "def type_cast(table, row)\n @table_columns ||= {}\n unless @table_columns.include?(table)\n column_array = session.left.columns(table)\n column_hash = {}\n column_array.each {|column| column_hash[column.name] = column}\n @table_columns[table] = column_hash\n end\n columns = @table_columns[table]\n type_casted_row = {}\n row.each_pair do |column_name, value|\n type_casted_row[column_name] = columns[column_name].type_cast(value)\n end\n type_casted_row\n end", "def convert_cell(value, coltype)\n case coltype\n when \"boolean\"\n value ? 'true' : 'false'\n when \"number\"\n value.to_i\n when \"string\"\n value\n when \"date\"\n DataDate.new(Date.parse(value))\n when \"datetime\"\n DataDateTime.new(DateTime.parse(value))\n when \"timeofday\"\n [ value.hour, value.min, value.sec, value.usec / 1000 ]\n end\n end", "def rows_as_native\n unless @rows_as_native\n @rows_as_native = @rows.collect { |row| Array.new(row.size) { |i| @columns[i].type.translate(row[i]) } }\n end\n @rows_as_native\n end", "def convert_row(row)\n return nil if row.nil?\n row.collect do |col|\n if col.is_a? ::ODBC::Date\n DBI::Date.new(col.year, col.month, col.day)\n elsif col.is_a? ::ODBC::Time\n DBI::Time.new(col.hour, col.minute, col.second)\n elsif col.is_a? ::ODBC::TimeStamp\n DBI::Timestamp.new(col.year, col.month, col.day,\n col.hour, col.minute, col.second, col.fraction)\n else\n col\n end\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 _normalize( rows )\n rows.map do |row|\n h = row['_id']\n h['value'] = row['value'].to_i\n h\n end\n ensure\n rows.close\n end", "def row_type(db_type, obj)\n (type_hash = @row_types[literal(db_type)]) &&\n (parser = type_hash[:parser])\n\n case obj\n when ArrayRow, HashRow\n obj\n when Array\n if parser\n parser.typecast(obj)\n else\n obj = ArrayRow.new(obj)\n obj.db_type = db_type\n obj\n end\n when Hash\n if parser \n parser.typecast(obj)\n else\n raise InvalidValue, \"Database#row_type requires the #{db_type.inspect} type have a registered parser and typecaster when called with a hash\"\n end\n else\n raise InvalidValue, \"cannot convert #{obj.inspect} to row type #{db_type.inspect}\"\n end\n end", "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 finalize_datatypes_for_csv\n csv_column_datatypes.map { |column_name, possible_datatypes|\n #If there is string type even atleast 1 there is no other option but to set the datatype to string => varchar\n if possible_datatypes.has_key?(:string)\n csv_column_datatypes[column_name] = :string\n else\n #set the max occurance datatype as the datatype of column\n csv_column_datatypes[column_name] = possible_datatypes.key(possible_datatypes.values.max)\n end\n }\n end", "def types_from_array_records(samples)\n columnar_types = []\n samples.each do |record|\n record.each_with_index {|value,i| (columnar_types[i] ||= []) << guess_type(value) }\n end\n columnar_types.map {|types| merge_types(types) }\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 column_schema_to_ruby_type(schema)\n case t = schema[:db_type].downcase\n when /\\A(?:medium|small)?int(?:eger)?(?:\\((?:\\d+)\\))?(?: unsigned)?\\z/o\n {:type=>Integer}\n when /\\Atinyint(?:\\((\\d+)\\))?\\z/o\n {:type =>schema[:type] == :boolean ? TrueClass : Integer}\n when /\\Abigint(?:\\((?:\\d+)\\))?(?: unsigned)?\\z/o\n {:type=>Bignum}\n when /\\A(?:real|float|double(?: precision)?)\\z/o\n {:type=>Float}\n when 'boolean'\n {:type=>TrueClass}\n when /\\A(?:(?:tiny|medium|long|n)?text|clob)\\z/o\n {:type=>String, :text=>true}\n when 'date'\n {:type=>Date}\n when /\\A(?:small)?datetime\\z/o\n {:type=>DateTime}\n when /\\Atimestamp(?:\\((\\d+)\\))?(?: with(?:out)? time zone)?\\z/o\n {:type=>DateTime, :size=>($1.to_i if $1)}\n when /\\Atime(?: with(?:out)? time zone)?\\z/o\n {:type=>Time, :only_time=>true}\n when /\\An?char(?:acter)?(?:\\((\\d+)\\))?\\z/o\n {:type=>String, :size=>($1.to_i if $1), :fixed=>true}\n when /\\A(?:n?varchar|character varying|bpchar|string)(?:\\((\\d+)\\))?\\z/o\n {:type=>String, :size=>($1.to_i if $1)}\n when /\\A(?:small)?money\\z/o\n {:type=>BigDecimal, :size=>[19,2]}\n when /\\A(?:decimal|numeric|number)(?:\\((\\d+)(?:,\\s*(\\d+))?\\))?\\z/o\n s = [($1.to_i if $1), ($2.to_i if $2)].compact\n {:type=>BigDecimal, :size=>(s.empty? ? nil : s)}\n when /\\A(?:bytea|(?:tiny|medium|long)?blob|(?:var)?binary)(?:\\((\\d+)\\))?\\z/o\n {:type=>File, :size=>($1.to_i if $1)}\n when 'year'\n {:type=>Integer}\n else\n {:type=>String}\n end\n end", "def convert_cell(column,xlsx,nrow,ncol)\n d = xlsx.cell(nrow,ncol)\n type = column['type'] || 'string'\n case type\n when 'long'\n d.to_i\n when 'double'\n d.to_f\n when 'string'\n d.to_s\n when 'timestamp'\n convert_time(d)\n else # TODO\n d.to_s\n end\n end", "def map_values(row, columns)\n values = columns.map do |v|\n # TODO - stw - which other cases do we need to handle?\n case v[1]\n when /int/: \n row[v[0]] || 'NULL'\n else \n (row[v[0]].nil? ? 'NULL' : \"'\" + @db1.escape_string(row[v[0]].to_s) + \"'\")\n end\n end\n values = values.join(',') \n end", "def each_row_as_native\n @rows.each { |row| yield(Array.new(row.size) { |i| @columns[i].type.translate(row[i]) }) }\n self\n end", "def type_to_sql(type, limit = nil, precision = nil, scale = nil)\n return super unless type.to_s == 'integer'\n \n if limit.nil? || limit == 4\n 'integer'\n elsif limit < 4\n 'smallint'\n else\n 'bigint'\n end\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 convert_to_ruby_types(hash) \n hash.keys.each do |key|\n value = hash[key]\n next unless value # Leave nils as nils\n case key\n when 'uid', 'aid'; hash[key] = value.to_i\n when 'created_at'; hash[key] = DateTime.parse(value)\n when 'deleted'; hash[key] = value == 't'\n when 'value'; hash[key] = BigDecimal.new(value)\n when 'count'; hash[key] = value.to_i\n when 'period'\n value =~ /\"(.*?)\",\"(.*?)\"/\n hash[key] = [DateTime.parse($1), DateTime.parse($2)]\n end\n end\n hash\nend", "def cells_to_ints!\n @height.times do |row|\n @cells[row].map!(&:to_i)\n end\n end", "def type_cast(value)\r\n @column_definition.type_cast(value)\r\n end", "def map_data_types(hsh)\n hsh.each_with_object({}) { |(column_name, column_type), hash| hash[column_name] = map_value(column_type) }\n end", "def fixnum cols\n decode_values :fixnum, cols\n end", "def convert_to(ary, type)\n new = []\n ary.each_index do |row|\n new << ary[row].collect {|elem| elem.send(type)}\n end\n new\n end", "def result_to_rows(result)\n result.rows.map do |row|\n typed_row = result.columns.zip(row).map do |column_name, value|\n typed_value = result.column_types[column_name].send(:type_cast, value)\n [column_name.to_sym, typed_value]\n end\n Hash[typed_row]\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 register_row_type(db_type, opts=OPTS)\n procs = @conversion_procs\n rel_oid = nil\n array_oid = nil\n parser_opts = {}\n\n # Try to handle schema-qualified types.\n type_schema, type_name = schema_and_table(db_type)\n schema_type_string = type_name.to_s\n\n # Get basic oid information for the composite type.\n ds = from(:pg_type).\n select{[pg_type[:oid], :typrelid, :typarray]}.\n where([[:typtype, 'c'], [:typname, type_name.to_s]])\n if type_schema\n ds = ds.join(:pg_namespace, [[:oid, :typnamespace], [:nspname, type_schema.to_s]])\n schema_type_symbol = :\"pg_row_#{type_schema}__#{type_name}\" \n else\n schema_type_symbol = :\"pg_row_#{type_name}\"\n end\n unless row = ds.first\n raise Error, \"row type #{db_type.inspect} not found in database\"\n end\n # Manually cast to integer using to_i, because adapter may not cast oid type\n # correctly (e.g. swift)\n parser_opts[:oid], rel_oid, array_oid = row.values_at(:oid, :typrelid, :typarray).map(&:to_i)\n\n # Get column names and oids for each of the members of the composite type.\n res = from(:pg_attribute).\n join(:pg_type, :oid=>:atttypid).\n where(:attrelid=>rel_oid).\n where{attnum > 0}.\n exclude(:attisdropped).\n order(:attnum).\n select_map{[:attname, Sequel.case({0=>:atttypid}, pg_type[:typbasetype], pg_type[:typbasetype]).as(:atttypid)]}\n if res.empty?\n raise Error, \"no columns for row type #{db_type.inspect} in database\"\n end\n parser_opts[:columns] = res.map{|r| r[0].to_sym}\n parser_opts[:column_oids] = res.map{|r| r[1].to_i}\n\n # Using the conversion_procs, lookup converters for each member of the composite type\n parser_opts[:column_converters] = parser_opts[:column_oids].map do |oid|\n procs[oid]\n end\n\n # Setup the converter and typecaster\n parser_opts[:converter] = opts.fetch(:converter){HashRow.subclass(db_type, parser_opts[:columns])}\n parser_opts[:typecaster] = opts.fetch(:typecaster, parser_opts[:converter])\n\n parser = Parser.new(parser_opts)\n add_conversion_proc(parser.oid, parser)\n\n if respond_to?(:register_array_type) && array_oid && array_oid > 0\n array_type_name = if type_schema\n \"#{type_schema}.#{type_name}\"\n else\n type_name\n end\n register_array_type(array_type_name, :oid=>array_oid, :converter=>parser, :scalar_typecast=>schema_type_symbol)\n end\n\n @row_types[literal(db_type)] = opts.merge(:parser=>parser, :type=>db_type)\n @row_schema_types[schema_type_string] = schema_type_symbol \n @schema_type_classes[schema_type_symbol] = ROW_TYPE_CLASSES\n @row_type_method_module.class_eval do\n meth = :\"typecast_value_#{schema_type_symbol}\"\n define_method(meth) do |v|\n row_type(db_type, v)\n end\n private meth\n alias_method(meth, meth)\n end\n\n nil\n end", "def type_literal_generic_integer(column)\n :integer\n end", "def column_value_integer\n column_value.to_i.to_s\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 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 cast_numeric(sql_type = nil)\n cast(sql_type || :integer).sql_number\n end", "def to_a(cols=[])\n col_info = column_info(cols)\n rows = []\n rows << col_info.keys\n while try { @result_set.next } do\n row = []\n col_info.each do |col, info|\n obj = try{ @result_set.object(info[:index]) }\n case info[:type]\n when :string\n row << obj.to_s\n when :boolean\n row << (obj.to_s =~ /true/i ? true : false)\n when :long\n row << obj.to_i\n when :double\n row << obj.to_f\n else\n log.warning \"Unkown type: #{info[:type]} for #{col}\"\n row << obj.to_s\n end\n end\n rows << row\n end\n rows\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 convert_type_proc(v)\n case v\n when Java::OrgPostgresqlJdbc4::Jdbc4Array\n PGArrayConverter.new(method(:convert_type_proc))\n when Java::OrgPostgresqlUtil::PGobject\n PG_OBJECT_METHOD\n else\n super\n end\n end", "def cast_numeric(arg, sql_type = nil)\n cast(arg, sql_type || Integer).sql_number\n end", "def column_type(type_indicator)\n case type_indicator\n when :eval; :text\n when :text; :text\n when :string; :string\n when :sec; :double\n when :msec; :double\n when :duration; :double\n when :float; :double\n when :double; :double\n when :integer; :integer\n when :int; :int\n when :timestamp; :datetime\n when :datetime; :datetime\n when :date; :date\n else :string\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, 2; 'smallint'\n when 3, 4; 'integer'\n when 5..8; 'bigint'\n else raise(ActiveRecordError, \"No integer type has byte size #{limit}. Use a numeric with precision 0 instead.\")\n end\n end", "def column_type\n return @column_type if defined?(@column_type)\n ind = index\n table[1..500].each do |row|\n if row[ind]&.cell_type\n cel_column_type = row[ind].cell_type\n if !defined?(@column_type) || @column_type.nil?\n @column_type = cel_column_type\n elsif (cel_column_type == @column_type) || (cel_column_type == :nil)\n else\n @column_type = :string\n break\n end\n end\n end\n @column_type\n end", "def convert_sql(sql, definition)\n sql.gsub(/\\b\\d+\\b/, ':int').gsub(/`([^`]+)`/, '\\1').gsub(/'[^']*'/, ':string').rstrip\n end", "def cast_types; end", "def array_converter *arrays\n\n arrays.flatten.map(&:to_i)\n\n # The code above is the same as the code below. arrays.each would not work because\n # it will try and convert the whole array to an int, which is not possible. map will go \n # throught each item in an array and convert them to an int.\n # \n # arrays.flatten.map { |e| i.to_i }\n # \n # OR\n # \n # arrays.flatten.map do |i|\n # i.to_i\n # end\nend", "def type_literal_generic_fixnum(column)\n type_literal_generic_integer(column)\n end", "def convert_columns(arr)\n if ccs = @column_converters\n arr.zip(ccs).map{|v, pr| (v && pr) ? pr.call(v) : v}\n else\n arr \n end\n end", "def from_database_type(obj)\n case obj\n when String, Float, Integer, NilClass, TrueClass, FalseClass\n obj\n when java.sql.Date, java.sql.Time, java.sql.Timestamp\n Time.at(obj.time/1000)\n when java.sql.Blob\n String.from_java_bytes(obj.get_bytes(1,obj.length))\n when java.sql.Clob\n obj.get_sub_string(1, obj.length)\n when java.math.BigDecimal\n BigDecimal.new(obj.to_s)\n else\n raise \"Can't find correct type to convert #{obj.inspect} into\"\n end\n end", "def convert(input)\n row = input[1].to_i\n column = convert_column(input[0])\n [row, column]\n end", "def value_transform value, type\n return nil if value.nil? || value.to_s.size == 0\n case type\n when :integer then value.to_i\n when :autoincrement then value.to_i\n when :string then value.to_s\n when :float then value.to_f\n when :bool then value.to_s\n when :symbol then value.to_s\n when :marshal then Marshal.dump(value)\n when :array then Yajl::Encoder.encode(value)\n when :hash then Yajl::Encoder.encode(value)\n when :time then Time.parse(value.to_s).strftime(\"%Y.%m.%d %H:%M:%S\")\n when :date then Date.parse(value.to_s).strftime(\"%Y-%m-%d\")\n else value\n end\n end", "def revert_mysql_type( type )\n case type\n when /\\Aint\\(\\d+\\)\\z/\n return :integer, :default_size => 11\n when /\\Aint\\(\\d+\\) unsigned\\z/\n return :integer, :unsigned => true, :default_size => 10\n when /\\Abigint\\(\\d+\\)\\z/\n return :bigint, :default_size => 20\n when /\\Abigint\\(\\d+\\) unsigned\\z/\n return :bigint, :unsigned => true, :default_size => 20\n when /\\Adecimal\\(\\d+,\\d+\\)\\z/\n return :decimal, :default_size => [ 10, 0 ]\n when /\\A(enum|set)\\((.*)\\)\\z/\n return $1.to_sym, :elements => parse_elements( $2 )\n end\n end", "def oracle_data_type_conversion(in_var, data_type, data_scale)\n \n case\n when data_type == \"VARCHAR2\"\n if in_var.nil? or in_var.empty?\n in_var = \"\"\n end\n this_in_var = in_var.to_s\n this_data_type = String\n \n when data_type == \"CHAR\"\n if in_var.nil? or in_var.empty?\n in_var = \"\"\n end\n this_in_var = in_var.to_s\n this_data_type = String\n \n when data_type == \"NUMBER\"\n if !data_scale.nil? and data_scale > 0\n \n this_in_var = in_var.to_f\n this_data_type = Float\n else\n this_in_var = in_var.to_i\n this_data_type = Fixnum\n end\n \n when data_type == \"TIMESTAMP\"\n this_in_var = in_var\n this_data_type = DateTime\n \n when data_type == \"DATE\"\n this_in_var = in_var\n this_data_type = DateTime\n \n else nil\n end \n \n return this_in_var, this_data_type \n end", "def convert_values(source, destiny, weigth)\n [Integer(source), Integer(destiny), Float(weigth)]\n end", "def cast(data_type)\n case data_type\n when String\n new_jcolumn = jcolumn.cast(data_type)\n when DataType\n jdata_type = JDataType.fromJson(data_type.json)\n new_jcolumn = jcolumn.cast(jdata_type)\n else\n raise ArgumentError, \"Unsupported type: #{data_type.class}\"\n end\n\n Column.new(new_jcolumn)\n end", "def cell_type(row, col)\n @types[row * @col_count + col]\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 convert_to_native_type(data_type, s)\r\n return kb_nil if s == KB_NIL\r\n\r\n # I added this line to keep KBTable#import_csv working after I made\r\n # the kb_nil changes.\r\n return nil if s.nil?\r\n\r\n case data_type\r\n when :String\r\n if s =~ UNENCODE_RE\r\n return s.gsub('&linefeed;', \"\\n\").gsub('&carriage_return;',\r\n \"\\r\").gsub('&substitute;', \"\\032\").gsub('&pipe;', \"|\"\r\n ).gsub('&amp;', \"&\")\r\n else\r\n return s\r\n end\r\n when :Integer\r\n return s.to_i\r\n when :Float\r\n return s.to_f\r\n when :Boolean\r\n if ['false', 'False', nil, false].include?(s)\r\n return false\r\n else\r\n return true\r\n end\r\n when :Time\r\n return Time.parse(s) \r\n when :Date\r\n return Date.parse(s)\r\n when :DateTime\r\n return DateTime.parse(s)\r\n when :YAML\r\n # This code is here in case the YAML field is the last\r\n # field in the record. Because YAML normally defines a\r\n # nil value as \"--- \", but KirbyBase strips trailing\r\n # spaces off the end of the record, so if this is the\r\n # last field in the record, KirbyBase will strip the\r\n # trailing space off and make it \"---\". When KirbyBase\r\n # attempts to convert this value back using to_yaml,\r\n # you get an exception.\r\n if s == \"---\"\r\n return nil\r\n elsif s =~ UNENCODE_RE\r\n y = s.gsub('&linefeed;', \"\\n\").gsub('&carriage_return;',\r\n \"\\r\").gsub('&substitute;', \"\\032\").gsub('&pipe;', \"|\"\r\n ).gsub('&amp;', \"&\")\r\n return YAML.load(y)\r\n else\r\n return YAML.load(s)\r\n end\r\n when :Memo\r\n memo = KBMemo.new(@tbl.db, s)\r\n memo.read_from_file\r\n return memo\r\n when :Blob\r\n blob = KBBlob.new(@tbl.db, s)\r\n blob.read_from_file\r\n return blob\r\n else\r\n raise \"Invalid field type: %s\" % data_type\r\n end\r\n end", "def clean_row(row)\n row = row.to_hash\n row['raw_ip_incoming'] = IPAddr.new(row['raw_ip_incoming']).to_i\n row['raw_ip_outgoing'] = IPAddr.new(row['raw_ip_outgoing']).to_i\n %w[port_incoming port_outgoing protocol num_packets_incoming \n size_packets_incoming num_packets_outgoing size_packets_outgoing].each do |col|\n row[col] = row[col].to_i\n end\n row\nend", "def inferDataTypes( dataset, year, filename, tablename, single_point_as_dec, nameEditor )\n file = File.new( filename, 'r' );\n line = 0\n maxvals = []\n n = 0\n topline = []\n CSV.foreach( file, { col_sep:\"\\t\" } ){\n |elements|\n line += 1\n if( line == 1 )then\n topline = elements\n n = topline.length\n n.times{\n |i|\n maxvals[i] = INT\n }\n # elsif line >= 500 then\n # break;\n else\n i = 0\n elements.each{\n |cell|\n colname = nameEditor.edit( topline[i].downcase() )\n if colname =~ /.*sernum.*/i then\n maxvals[i] = SERNUM \n elsif cell =~ /.*\\/.*/ then\n puts \"infering DATE for #{colname}; cell is |#{cell}|\\n\"\n maxvals[i] = [ maxvals[i], DATE ].max() \n elsif cell =~ /.*[\"'`a-z].*/i then\n maxvals[i] = [ maxvals[i], STRING ].max() \n elsif cell =~ /[0-9]+\\.[0-9]$/ and single_point_as_dec then \n # FIXME exactly one point as decimal XX,1; \n # this is in HSE for industry codes and so on but probably not general\n puts \"infering DECIMAL for #{colname}; cell is |#{cell}|\\n\"\n maxvals[i] = [ maxvals[i], DECIMAL ].max() \n elsif cell =~ /[0-9]+\\.[0-9]+/ or cell =~/^\\.[0-9]+/ or cell =~ /^[0-9]\\.$/ then\n puts \"infering AMOUNT for #{colname}; cell is |#{cell}|\\n\"\n maxvals[i] = [ maxvals[i], AMOUNT ].max() \n # FIXME should we blow up if remainder not obviously an integer?\n else # int of some kind - check for extreme values\n x = cell.to_f()\n if( x > 2147483647.0 ) or ( x < -2147483648.0 )then # out of postgres integer range\n puts \"inferring SERNUM for #{colname}; cell=|#{cell}|\\n\"\n maxvals[i] = [ maxvals[i], SERNUM ].max() \n end\n end # ignore enums for now\n i += 1\n } \n end\n }\n file.close()\n # connection = getConnection()\n n.times{\n |i|\n if maxvals[i] != INT then # since we default to INT anyway\n colname = nameEditor.edit( topline[i].downcase() )\n puts \"changing #{} to #{maxvals[i]}\\n\"\n puts \"#{maxvals[i]} #{dataset}, #{tablename}, #{year}, #{colname}\\n\"\n updateVarType( maxvals[i], dataset, tablename, year, colname ) \n # statement.execute( maxvals[i], dataset, tablename, year, colname ) \n end\n }\n # connection.disconnect()\nend", "def type_to_sql(type, limit = nil, precision = nil, scale = nil)\n case type.to_s\n when 'integer'\n return 'integer' unless limit\n\n case limit\n when 1, 2; 'smallint'\n when nil, 3, 4; 'integer'\n when 5..8; 'bigint'\n else raise(ActiveRecordError, \"No integer type has byte size #{limit}. Use a numeric with precision 0 instead.\")\n end\n else\n super\n end\n end", "def cast(value, type)\n case type\n when :string\n value\n when :integer\n value.to_i\n when :float\n value.to_f\n when :percent\n value.to_f\n when :currency\n BigDecimal(value)\n when :time\n value.to_i\n when :date\n parse_date(value)\n end\n end", "def convert_to_ints\n @tree.each_index do |vert_pos|\n @tree[vert_pos].each_index do |horiz_pos|\n @tree[vert_pos][horiz_pos] = @tree[vert_pos][horiz_pos].to_i\n end\n end\n end", "def map_types!(column_mapping)\n\t\tself.column_mapping = column_mapping\n\t\tself\n\tend", "def array_converter *arrays\n arrays.flatten.map(&:to_i)\nend", "def type_cast_with_composite_types(value, column)\n case value\n when PostgresCompositeType\n PostgreSQLColumn.composite_type_to_string(value, self)\n when Array, Hash\n if (klass = column.composite_type_class)\n value = klass.new(value)\n PostgreSQLColumn.composite_type_to_string(value, self)\n else\n type_cast_without_composite_types(value, column)\n end\n\t else\n type_cast_without_composite_types(value, column)\n end\n end", "def schema_parse_rows(rows)\n schema = []\n rows.each do |row| \n row[:allow_null] = row[:allow_null] == 'YES' ? true : false\n row[:default] = nil if row[:default].blank?\n row[:type] = schema_column_type(row[:db_type])\n schema << [row.delete(:column).to_sym, row]\n end\n schema\n end", "def type_to_sql(type, limit = nil, precision = nil, scale = nil)\n return super if defined?(::Jdbc::H2) || type.to_s != 'integer' || limit == nil\n\n type\n end", "def type_cast(value, type)\n return nil if value.nil?\n case type\n when :string then value\n when :text then value\n when :money then string_to_money(value)\n when :integer then value.to_i rescue value ? 1 : 0\n when :float then value.to_f\n when :datetime then string_to_time(value)\n when :timestamp then string_to_time(value)\n when :time then string_to_dummy_time(value)\n when :date then string_to_date(value)\n when :boolean then value_to_boolean(value)\n else value\n end\n end", "def map_value(column_type)\n case column_type\n when :datetime then :timestamp\n when :json then :string\n else column_type\n end\n end", "def type_cast(value, type)\n case value\n when Array\n value.collect { |v| type_cast(v, type) }\n else\n # Let's leverage ActiveRecord's type casting, so that casting is consistent\n # with the other models.\n column_for_type_cast = ::ActiveRecord::ConnectionAdapters::Column.new(\"\", nil)\n column_for_type_cast.instance_variable_set(:@type, type)\n value = column_for_type_cast.type_cast(value)\n Time.zone && value.is_a?(Time) ? value.in_time_zone : value\n end\n end", "def add_typecast_on_load_columns(*columns)\n @typecast_on_load_columns.concat(columns)\n end", "def type_to_sql(type, limit: nil, precision: nil, scale: nil, **) # :nodoc:\n # MSSQL's NVARCHAR(n | max) column supports either a number between 1 and\n # 4000, or the word \"MAX\", which corresponds to 2**30-1 UCS-2 characters.\n #\n # It does not accept NVARCHAR(1073741823) here, so we have to change it\n # to NVARCHAR(MAX), even though they are logically equivalent.\n #\n # See: http://msdn.microsoft.com/en-us/library/ms186939.aspx\n #\n type = type.to_sym if type\n native = native_database_types[type]\n\n if type == :string && limit == 1_073_741_823\n 'nvarchar(max)'\n elsif NO_LIMIT_TYPES.include?(type)\n super(type)\n elsif %i[int integer].include?(type)\n if limit.nil? || limit == 4\n 'int'\n elsif limit == 2\n 'smallint'\n elsif limit == 1\n 'tinyint'\n else\n 'bigint'\n end\n elsif type == :uniqueidentifier\n 'uniqueidentifier'\n elsif %i[datetime time].include?(type)\n precision ||= 7\n column_type_sql = (native.is_a?(Hash) ? native[:name] : native).dup\n if (0..7).include?(precision)\n column_type_sql << \"(#{precision})\"\n else\n raise(\n ArgumentError,\n \"No #{native[:name]} type has precision of #{precision}. The \" \\\n 'allowed range of precision is from 0 to 7, even though the ' \\\n 'sql type precision is 7 this adapter will persist up to 6 ' \\\n 'precision only.'\n )\n end\n else\n super\n end\n end", "def column_type(type)\n case type\n when :integer then Integer\n when :float, :decimal then Float\n when :string, :text, :uuid then String\n when :datetime, :timestamp, :time then DateTime\n when :date then Date\n when :boolean then Virtus::Attribute::Boolean # Boolean is not a standard Ruby class\n else\n raise \"Could not match column type '#{type}' for #{model_name}\"\n end\n end", "def fixnums cols\n decode_values :fixnum, cols, true\n end", "def convert_row(row_hash)\n result = ''\n row_hash.each_value do|col|\n result << '<td>'\n case col\n # Handle simple columns here, pass off more complex ones\n when String, Fixnum then result << col.to_s\n when NilClass then result << ''\n when Array then result << convert_array(col)\n else\n result << 'Unknown data type!!!'\n end\n result << '</td>'\n end\n result\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 to_int() end", "def to_int() end", "def sanitize_cells(rows)\n rows.map do |cells|\n cells.map do |cell|\n \n if cell.is_a? Float\n cell = cell ? cell.to_i.to_s : \"\"\n else\n cell = cell ? cell.to_s : \"\"\n end\n cell ? cell.strip : \"\"\n end\n end\n end", "def normalise_type(type, length)\n sql_type = case type\n when /^Auto ?Counter$/\n 'int'\n\n when /^Unsigned ?Integer$/,\n /^Signed ?Integer$/,\n /^Unsigned ?Small ?Integer$/,\n /^Signed ?Small ?Integer$/,\n /^Unsigned ?Tiny ?Integer$/\n s = case\n when length == nil\n 'int'\n when length <= 8\n 'tinyint'\n when length <= 16\n 'smallint'\n when length <= 32\n 'int'\n else\n 'bigint'\n end\n length = nil\n s\n\n when /^Decimal$/\n 'decimal'\n\n when /^Fixed ?Length ?Text$/, /^Char$/\n 'char'\n when /^Variable ?Length ?Text$/, /^String$/\n 'varchar'\n when /^Large ?Length ?Text$/, /^Text$/\n 'text'\n\n when /^Date ?And ?Time$/, /^Date ?Time$/\n 'datetime'\n when /^Date$/\n 'datetime' # SQLSVR 2K5: 'date'\n when /^Time$/\n 'datetime' # SQLSVR 2K5: 'time'\n when /^Auto ?Time ?Stamp$/\n 'timestamp'\n\n when /^Guid$/\n 'uniqueidentifier'\n when /^Money$/\n 'decimal'\n when /^Picture ?Raw ?Data$/, /^Image$/\n 'image'\n when /^Variable ?Length ?Raw ?Data$/, /^Blob$/\n 'varbinary'\n when /^BIT$/\n 'bit'\n when /^BOOLEAN$/\n 'boolean'\n else type # raise \"SQL type unknown for standard type #{type}\"\n end\n [sql_type, length]\n end", "def handle_int(int, lineno_column)\n Literal.new int.to_i\n end", "def normalise_type(type, length)\n sql_type = case type\n when /^Auto ?Counter$/\n 'int'\n\n when /^Unsigned ?Integer$/,\n /^Signed ?Integer$/,\n /^Unsigned ?Small ?Integer$/,\n /^Signed ?Small ?Integer$/,\n /^Unsigned ?Tiny ?Integer$/\n s = case\n when length == nil\n 'int'\n when length <= 8\n 'tinyint'\n when length <= 16\n 'smallint'\n when length <= 32\n 'int'\n else\n 'bigint'\n end\n length = nil\n s\n\n when /^Decimal$/\n 'decimal'\n\n when /^Fixed ?Length ?Text$/, /^Char$/\n 'char'\n when /^Variable ?Length ?Text$/, /^String$/\n 'varchar'\n when /^Large ?Length ?Text$/, /^Text$/\n 'text'\n\n when /^Date ?And ?Time$/, /^Date ?Time$/\n 'datetime'\n when /^Date$/\n 'datetime' # SQLSVR 2K5: 'date'\n when /^Time$/\n 'datetime' # SQLSVR 2K5: 'time'\n when /^Auto ?Time ?Stamp$/\n 'timestamp'\n\n when /^Guid$/\n 'uniqueidentifier'\n when /^Money$/\n 'decimal'\n when /^Picture ?Raw ?Data$/, /^Image$/\n 'image'\n when /^Variable ?Length ?Raw ?Data$/, /^Blob$/\n 'varbinary'\n when /^BIT$/\n 'bit'\n else type # raise \"SQL type unknown for standard type #{type}\"\n end\n [sql_type, length]\n end", "def type_to_sql(type, limit: nil, precision: nil, scale: nil, array: nil, **) # :nodoc:\n sql = \\\n case type.to_s\n when \"integer\"\n case limit\n when nil; \"int\"\n when 1, 2; \"int2\"\n when 3, 4; \"int4\"\n when 5..8; \"int8\"\n else super\n end\n else\n super\n end\n # The call to super might have appeneded [] already.\n if array && type != :primary_key && !sql.end_with?(\"[]\")\n sql = \"#{sql}[]\" \n end\n sql\n end", "def ints_from_csv_str\n nums_from_csv_str(:valid_int_str?, :to_i)\n end", "def to_int(*) end", "def type2type(type)\n case type\n when :char, :int8\n Fiddle::TYPE_CHAR\n when :uchar, :uint8\n -Fiddle::TYPE_CHAR\n when :short, :int16\n Fiddle::TYPE_SHORT\n when :ushort, :uint16\n -Fiddle::TYPE_SHORT\n when :int, :int32\n Fiddle::TYPE_INT\n when :uint, :uint32\n -Fiddle::TYPE_INT\n when :bool\n Fiddle::TYPE_INT\n when :long\n Fiddle::TYPE_LONG\n when :ulong\n -Fiddle::TYPE_LONG\n when :long_long, :int64\n Fiddle::TYPE_LONG_LONG\n when :ulong_long, :uint64\n -Fiddle::TYPE_LONG_LONG\n when :float\n Fiddle::TYPE_FLOAT\n when :double\n Fiddle::TYPE_DOUBLE\n when :size_t\n Fiddle::TYPE_SIZE_T\n when :string, :pointer\n Fiddle::TYPE_VOIDP\n when :void\n Fiddle::TYPE_VOID\n else\n raise \"unknown type #{type}\"\n end\n end", "def column_type\r\n @type\r\n end", "def normalize_sqlite_result(result)\n data = result.select { |hash| hash.select!{|key, val| !key.is_a? Numeric }}\n data = data.first\n end", "def convert_text_column_storage_type(table_name, column_name, to_type, temp_column_name)\n quoted_table_name = quote_table_name(table_name)\n orig_col = quote_column_name(column_name)\n temp_col = quote_column_name(temp_column_name || 'oee_temp_col')\n cmds = <<-SQL\n alter table #{quoted_table_name} add #{temp_col} #{to_type}\n update #{quoted_table_name} set #{temp_col} = #{orig_col}\n alter table #{quoted_table_name} drop column #{orig_col}\n alter table #{quoted_table_name} rename column #{temp_col} to #{orig_col}\n SQL\n cmds.split(\"\\n\").map(&:strip).each{|cmd| execute cmd}\n end", "def set(row,col,value,sheet=nil) #:nodoc:\n sheet = @default_sheet unless sheet\n read_cells(sheet) unless @cells_read[sheet]\n row,col = normalize(row,col)\n set_value(row,col,value,sheet)\n if value.class == Fixnum\n set_type(row,col,:float,sheet)\n elsif value.class == String\n set_type(row,col,:string,sheet)\n elsif value.class == Float\n set_type(row,col,:string,sheet)\n else\n raise ArgumentError, \"Type for \"+value.to_s+\" not set\"\n end\n end", "def set_type(row,col,type,sheet=nil)\n sheet = @default_value unless sheet\n @cell_type[sheet][[row,col]] = type\n end", "def _coerce_type(value)\n # Handle quoted strings\n if value =~ STRING_REGEX\n return value[1..value.length - 2]\n end\n\n # Handle booleans\n if BOOLEANS.include?(value)\n return !!(value =~ BOOLEAN_TRUE_REGEX)\n end\n\n # Handle numeric values, coerce to int or float appropriately\n if _is_numeric?(value)\n value = Float(value)\n return value % 1.0 == 0 ? value.to_i : value\n end\n\n # Handle lists\n if value.include?(LIST_DELIM)\n array = []\n value.split(LIST_DELIM).each do |val|\n # Coerce each list value to its appropriate type\n array << _coerce_type(val)\n end\n return array\n end\n\n # Otherwise, just return the value as a string\n value\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 typecast_value_integer(value)\n value.to_i\n end", "def transform_row(row)\n row\n end" ]
[ "0.7683182", "0.7397243", "0.7195339", "0.7081908", "0.68820935", "0.6714796", "0.6674798", "0.65500486", "0.6462369", "0.63822156", "0.63781893", "0.6216193", "0.6197715", "0.6109297", "0.60963625", "0.6086278", "0.6058896", "0.6053657", "0.5999433", "0.59915835", "0.5989856", "0.59832555", "0.5914248", "0.5913695", "0.59101784", "0.5895541", "0.588962", "0.5873308", "0.58710295", "0.5864384", "0.58481044", "0.5841571", "0.5832867", "0.5809119", "0.5798599", "0.57679456", "0.57602257", "0.57424206", "0.57275283", "0.57143307", "0.5666681", "0.5666471", "0.56626254", "0.56532073", "0.56359094", "0.562075", "0.56014013", "0.55975014", "0.55846983", "0.55767435", "0.557492", "0.5539216", "0.55312693", "0.5492625", "0.5481989", "0.54782635", "0.5477121", "0.5454633", "0.5448799", "0.5444993", "0.54435086", "0.543489", "0.54243183", "0.5421168", "0.541612", "0.5408269", "0.5407429", "0.5399832", "0.5395238", "0.538121", "0.53700167", "0.53595203", "0.535626", "0.53545356", "0.5344015", "0.5343201", "0.53221387", "0.5319278", "0.5317128", "0.53150845", "0.53127414", "0.5312725", "0.5295064", "0.5295064", "0.528577", "0.52841675", "0.5279916", "0.52764314", "0.5273389", "0.5272056", "0.5258671", "0.52495545", "0.524482", "0.52409875", "0.52318865", "0.5225933", "0.5224054", "0.5217114", "0.52109873", "0.5210132", "0.5203244" ]
0.0
-1