query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Exercise Debugging and Testing Example 4 Name: Arnold Redoblado Date: 20160330 Purpose: Create a class(es) that'll pass a test script This example requires methods that will take string values and manipulate and return string.
def echo( word ) word end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_fake_string_1\n pros = Prospector.new(0,0,0)\n assert pros.fake_string(1).eql? '1 fake ruby'\n end", "def test_method\n \"Here is the sample input\"\n end", "def test_end_string_ten\n pros = Prospector.new(0,0,0)\n pros.instance_variable_set(:@real, 10)\n assert pros.end_string.eql? 'Going home victorious!'\n end", "def test_ruby_string_1\n pros = Prospector.new(0,0,0)\n assert pros.ruby_string(1).eql? '1 ruby'\n end", "def basic_feature(str)\n\tputs str + \" \" + str\n\tputs str * 3\n\tputs \"1\" + \"2\"\n\tputs \"1\" * 2\n\tputs str.size\n\tputs str.length\n\tputs str.capitalize\n\tputs str.reverse\n\tputs str.upcase\n\tputs str.downcase\n\tputs str.swapcase\nend", "def my_string\n 'Hello World'\nend", "def test_end_string_twenty\n pros = Prospector.new(0,0,0)\n pros.instance_variable_set(:@real, 20)\n assert pros.end_string.eql? 'Going home victorious!'\n end", "def my_string\n'Hello World'\nend", "def str1\n 'from string'\nend", "def test_me\n puts Wisdom.new('[Initial]')\nend", "def test_say()\n student = Student.new(\"Raphael\", \"E23\")\n assert_equal(\"Hey it's me Raphael!\", student.say(\"Hey it's me Raphael!\"))\n end", "def test_getLocation_string\n\t\td = Driver::new(\"Driver 1\",0);\n\t\tdef d.getLocation; d.location=\"string\",\"string\"; end\n\t\tassert_raises (\"Invalid location\") {d.getLocation}\n\tend", "def test_end_string_one\n pros = Prospector.new(0,0,0)\n pros.instance_variable_set(:@real, 1)\n assert pros.end_string.eql? 'Going home sad.'\n end", "def initialize(string = \"hello\")\n\t\t@string = string\n\tend", "def return_string\n \"This is a test\"\nend", "def str1; end", "def str1; end", "def test_talk()\n student = Student.new(\"Cameron\", \"E35\", \"Ruby\")\n assert_equal(\"Hello my name is Cameron and I'm in cohort E35\", student.talk)\n end", "def string(*) end", "def stest_method_1(test); end", "def test_running\n assert_equal(\"Huff puff huff puff\", Human.new(\"Zelda\").run)\n assert_equal(\"Huff puff huff puff\", Human.new(\"Mary\").run)\n end", "def test_set_name_works_with_string\n obj = Sketchup.active_model.pages.add 'Testup Page'\n messy_string = 'TestString!@#%^*&(*_[]}{:\"\":><.,?>/.\\|'\n obj.name = messy_string\n result = obj.name\n expected = messy_string\n assert_equal(expected, result, 'Expected does not match result.')\n end", "def test_fake_string_0\n pros = Prospector.new(0,0,0)\n assert pros.fake_string(0).eql? ''\n end", "def test_via_numeric_string\r\n assert_equal 'Fifth Ave', @driver.via(123, 456)\r\n end", "def cheese_and_crackers(cheese_count, boxes_of_crackers)\n# provides string to run with cheese_count\n puts \"You have #{cheese_count} cheeses!\"\n# provides string to run with boxes_of_crackers\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n# provides string to run\n puts \"Man that's enough for a party!\"\n# provides string to run\n puts \"Get a blanket.\\n\"\n# ends the method\nend", "def test_names_from_string\n\n # Coprinus comatus already has an author.\n result = Name.names_from_string(\"Coprinus comatus v. bogus (With) Author\")\n assert_equal 3, result.length\n assert_equal nil, result[0].id\n assert_equal 2, result[1].id\n assert_equal nil, result[2].id\n assert_equal \"Coprinus\", result[0].text_name\n assert_equal \"Coprinus comatus\", result[1].text_name\n assert_equal \"Coprinus comatus var. bogus\", result[2].text_name\n assert_equal nil, result[0].author\n assert_equal \"(O.F. Müll.) Pers.\", result[1].author\n assert_equal \"(With) Author\", result[2].author\n\n # Conocybe filaris does not have an author.\n result = Name.names_from_string(\"Conocybe filaris var bogus (With) Author\")\n assert_equal 3, result.length\n assert_equal nil, result[0].id\n assert_equal 4, result[1].id\n assert_equal nil, result[2].id\n assert_equal \"Conocybe\", result[0].text_name\n assert_equal \"Conocybe filaris\", result[1].text_name\n assert_equal \"Conocybe filaris var. bogus\", result[2].text_name\n assert_equal nil, result[0].author\n assert_equal nil, result[1].author\n assert_equal \"(With) Author\", result[2].author\n\n # Agaricus does not have an author.\n result = Name.names_from_string(\"Agaricus L.\")\n assert_equal 1, result.length\n assert_equal 18, result[0].id\n assert_equal \"Agaricus\", result[0].text_name\n assert_equal \"L.\", result[0].author\n\n # Agaricus does not have an author.\n result = Name.names_from_string(\"Agaricus abra f. cadabra (With) Another Author\")\n assert_equal 3, result.length\n assert_equal 18, result[0].id\n assert_equal nil, result[1].id\n assert_equal nil, result[2].id\n assert_equal \"Agaricus\", result[0].text_name\n assert_equal \"Agaricus abra\", result[1].text_name\n assert_equal \"Agaricus abra f. cadabra\", result[2].text_name\n assert_equal nil, result[0].author\n assert_equal nil, result[1].author\n assert_equal \"(With) Another Author\", result[2].author\n end", "def testName\r\n name = Names::Name.new(\"John\", \"Paul\", \"Jones\")\r\n\r\n assert name.first == \"John\", \r\n \"first failed\"\r\n assert name.middle == \"Paul\",\r\n \"middle failed\"\r\n assert name.last == \"Jones\",\r\n \"last failed\"\r\n assert name.fullName == \"John Paul Jones\",\r\n \"fullName failed\"\r\n assert name.print == \"John Paul Jones\",\r\n \"print failed\"\r\n \r\n print \"All tests passed!\\n\"\r\nend", "def return_string1\n puts \"This is a test\"\nend", "def strings; end", "def test_fake_string_big\n pros = Prospector.new(0,0,0)\n assert pros.fake_string(2).eql? '2 fake rubies'\n end", "def test_set_description_works_with_string\n obj = Sketchup.active_model.pages.add 'Testup Page'\n messy_string = 'TestString!@#%^*&(*_[]}{:\"\":><.,?>/.\\|'\n obj.description = messy_string\n result = obj.description\n expected = messy_string\n assert_equal(expected, result, 'Expected does not match result.')\n end", "def str2; end", "def str2; end", "def input_string; end", "def test_to_s\n\t\tfood1 = BasicFood.new(\"QUICHE\" , \"123\", 1)\n\t\tputs food1.to_s\n\t\tassert((food1.to_s).eql?(\"QUICHE 123\"), \"to_s test1\")\n\t\tfood1.count += 1\n\t\tassert( food1.count == 2, \"Count should = 2\")\n\t\tassert(food1.to_s.eql?(\"QUICHE (2) 246\"), \"to_s test2\")\n\tend", "def test_fav_language\n result = @student1.say_favourite_language(\"Ruby\")\n assert_equal(\"I love Ruby\", result)\nend", "def _test_text ; process_test_case(\"text\") ; end", "def test_with_string1; show(\"Hello!\") end", "def test_assignment_sample04\n str_first, str_second = Jedi.mulReturn()\n assert_equal(\"Hello\", str_first)\n assert_equal(\"World\", str_second)\n end", "def hello_world(\"Hello World\", \"o\") \n \nend", "def string()\n #This is a stub, used for indexing\n end", "def p004stringusage\n\nputs PI\n\n# Defining a local variabe\nmy_string = 'I love my city, Pune'\nputs my_string\n\nvar1 = 5\nvar2 = '2'\n\nputs var1 + var2.to_i\n\na='hello'\na << 'world'\nputs a\n\nend", "def initialize(string)\n self.string = string\n end", "def initialize(string)\n self.string = string\n end", "def initialize(string)\n self.string = string\n end", "def string() end", "def test_name\n @pnt.name = 'John Q. Doe'\n assert_equal('John', @pnt.first_name, 'Person first name incorrect')\n assert_equal('Q.', @pnt.middle_name, 'Person middle name incorrect')\n assert_equal('Doe', @pnt.last_name, 'Person last name incorrect')\n end", "def test_run_string\n sim = Simulator.new(1, 2, 1)\n sim.setup_map\n mock_prospector = Minitest::Mock.new('Mock Prospector')\n def mock_prospector.mine(_param)\n 1\n end\n\n def mock_prospector.next_location(_param, _param2)\n 1\n end\n\n def mock_prospector.location_count\n 1\n end\n assert_raises(RBS::Test::Tester::TypeError) { sim.run('HI', mock_prospector) }\n end", "def foo # String instance method\n puts \"foo\"\n end", "def string; end", "def string; end", "def string; end", "def string; end", "def string; end", "def string; end", "def string; end", "def string; end", "def string; end", "def test_ruby_string_0\n pros = Prospector.new(0,0,0)\n assert pros.ruby_string(0).eql? ''\n end", "def testMethod nombre,apellido\n \nend", "def print4(nyc)\n\t4.times do puts nyc\n\n\tend\n\n#Prints an uppercase version of the argument given\ndef printupcase (live)\n\n\tputs live.upcase\nend\n\n#Object with two attributes and one method.\n\nclass Dog\nattr_accessor :name, :trait\n\nend\n\nfirst_dog = Dog.new\nfirst_dog.name = \"Bob\"\nfirst_dog.trait = \"annoying\"\n\ndef bark\n\tputs \"au au au\"\n\nend\nend", "def prepareAutokeyClass(charName, combos, specialMoves, finishingMoves)\n charName = clearCharacterName(charName) \n str = <<END\n class #{charName} extends MKTrilogyCharacter {\n ;;;;;; combos ;;;;;;;; #{combos}\n ;;;;;; special moves ;;;;;;; #{specialMoves}\n ;;;;;; finishing moves ;;;;; #{finishingMoves}\n }\nEND\n str\n end", "def test_rubyist_display_string\r\n location = Minitest::Mock.new(\"test_location_arr\")\r\n def location.get_id(index); \"Hash Crossing\"; end\r\n assert_raises('rubyist_num must be an intenger!') { @g.new_rubyist_display('a', location) }\r\n end", "def test_should_eat()\n yay_or_nay = should_eat(\"ice cream\", \"winter\")\n assert_equal(\"False\", should_eat)\n end", "def test_Method_InstanceMethods_meth\n\t\tmethod = \"cat\".method(:upcase)\n\t\tassert_equal(\"upcase\", method.name.to_s)\n\tend", "def test_name_generator_with_valid_input\nresult = name_generator(\"SH&$3aw(,n\")\nassert_equal(\"xX_ShAwN_Xx\", result)\nend", "def string=(_arg0); end", "def test_say_favourite_language()\n student = Student.new(\"Raphael\", \"E23\")\n assert_equal(\"I love Ruby!\", student.say_favourite_language(\"Ruby\"))\n end", "def string_argument(drink1, drink2)\n p \"My favorite drink is #{drink1}, but I really like #{drink2} too\"\nend", "def HelloString(str)\n puts \"Hello #{ str } !\"\nend", "def eval_string(klass, attrib)\n s = <<EOS\n class #{klass}\n def #{attrib}\n @#{attrib}\n end\n\n def #{attrib}=(value)\n @#{attrib} = value\n end\n end\nEOS\n return s\nend", "def test_start\n word = SecretWord.new(\"bob\")\n assert \"bob\" == word.get_word\nend", "def test_static\n assert_equal('1', Examples::KeywordBarBaz.check(1))\n assert_equal('Bar', Examples::KeywordBarBaz.check(3))\n assert_equal('Baz', Examples::KeywordBarBaz.check(5))\n assert_equal('BarBaz', Examples::KeywordBarBaz.check(15))\n assert_equal(3, Examples::KeywordBarBaz.bar)\n assert_equal(5, Examples::KeywordBarBaz.baz)\n assert_equal(%w[1 2 Bar], Examples::KeywordBarBaz.check_range(1..3))\n\n assert_equal('Bar', Examples::KeywordBarBaz.bar_string)\n assert_equal('Baz', Examples::KeywordBarBaz.baz_string)\n end", "def test_accepts_name_through_constructor\n Crd::Spec.new 'Testing' do |s|\n assert_equal( 'Testing', s.name )\n end\n end", "def string(food, dessert)\n puts \"#{food.upcase} & #{dessert.upcase} is my restaurant\"\nend", "def test_String_003_ToSentence\n \n puts2(\"\")\n puts2(\"#######################\")\n puts2(\"Testcase: test_String_003_ToSentence\")\n puts2(\"#######################\")\n \n \n puts2(\"\\nA specific string...\")\n sString = \"oNCE UPON a time Long ago and far away\"\n puts2(\"\\n String: \" + sString)\n sSentence = sString.to_sentence\n puts2(\" Sentence: \" + sSentence)\n \n puts2(\"\\nFour sets of 2 pseudo words as sentences...\")\n 4.times {\n sString = random_pseudowords(2,10)\n puts2(\"\\n String: \" + sString)\n sSentence = sString.to_sentence\n puts2(\" Sentence: \" + sSentence)\n }\n \n puts2(\"\\nTwo sets of 3 pseudo words ending in a period as sentences...\")\n 2.times {\n sString = random_pseudowords(3,10) + \".\"\n puts2(\"\\n String: \" + sString)\n sSentence = sString.to_sentence\n puts2(\" Sentence: \" + sSentence)\n }\n \n puts2(\"\\nTwo sets of 4 pseudo words ending in a exclamation point as sentences...\")\n 2.times {\n sString = random_pseudowords(4,10) + \"!\"\n puts2(\"\\n String: \" + sString)\n sSentence = sString.to_sentence\n puts2(\" Sentence: \" + sSentence)\n }\n \n puts2(\"\\nTwo sets of 5 pseudo words ending in a question mark as sentences...\")\n 2.times {\n sString = random_pseudowords(5,10) + \"?\"\n puts2(\"\\n String: \" + sString)\n sSentence = sString.to_sentence\n puts2(\" Sentence: \" + sSentence)\n }\n \n end", "def test_string_argument\n\t\tc = Check.new\n\t\tassert c.check_arguments([1,'1',1])\n\tend", "def initialize(string)\t\n\t\tself.string = string\n\tend", "def eval_string(klass, attrib)\n klass.class_eval do # => Dynamic class changing (changing 'self')\n define_method attrib do # => Dynamic method creation\n instance_variable_get(\"@#{attrib}\") # => Dynamic variable retrieval\n end\n\n define_method \"#{attrib}=\" do |value|\n instance_variable_set(\"@#{attrib}\", value) # => Dynamic variable setting\n end\n end\nend", "def test_say_favourite_language()\n #Act\n # phrase = @student.say_favourite_language('Ruby')\n # #Assert\n assert_equal('I love Ruby', @student.say_favourite_language('Ruby'))\n end", "def test_check_for_player\n team = Team.new(\"Best Team\", 0, \"Awesome Coach\", [\"Best Player\", \"Good Player\", \"Other Good Player\"])\n player = \"Best Player\"\n assert_equal(\"Best Player\", team.check_for_player(player))\nend", "def test_it_gets_user_input\n game = Game.new(@player1, @player2)\n\n assert_instance_of String, game.get_user_input\n end", "def test_with_string2; show([\"Hello\"]) end", "def test_return_name\n t = Town::new 'Dynamic Palisades', ['Matzburg', 'Hash Crossing'], 2, 2\n name = t.return_name\n assert_equal name, 'Dynamic Palisades'\n end", "def mt_51_char_first_name\r\n# This is a negative test for the Mt4 CI Demo form\r\n $test_count = $test_count + 1\r\n $test_count1 = $test_count \r\n $results.puts \"\"\r\n $results.puts \"Starting MT4 51 char invalid format Test.\"\r\n setup_negative_test\r\n site_connect_ci\r\n accept_cookie_policy\r\n get_server_name\r\n mt_validate_title_demo_signup\r\n $results.puts \"51 char invalid format test, brand = \" + $brand\r\n mt_populate_form_first_name_51_char\r\n mt_populate_form_last_name\r\n mt_populate_form_email\r\n mt_populate_form_phone_number\r\n mt_negative_demo_form_submit\r\n mt_negative_validate_confirm_page\r\n $results.puts \"***** MT4 51 char First Name Test Completed, Status:\" \r\n $results.puts \"Total Test Executed Pass / Fail (Running Total for Test Audit Trail.)\"\r\n $results.puts \"Test Count = \" + $test_count1.to_s\r\n $results.puts \"Test Pass Count = \" + $test_pass_count.to_s\r\n $results.puts \"Test Failed Count = \" + $test_failed_count.to_s\r\n $summary_results.puts \"***** MT4 51 char First Name Test Completed, Status:\"\r\n $summary_results.puts \"Total Test Executed Pass / Fail (Running Total for Test Audit Trail.)\"\r\n $summary_results.puts \"Test Count = \" + $test_count1.to_s\r\n $summary_results.puts \"Test Pass Count = \" + $test_pass_count.to_s\r\n $summary_results.puts \"Test Failed Count = \" + $test_failed_count.to_s\r\n $results.puts \"***************************************************************************\"\r\n $results.puts \"End MT4 Negative Form Test 51 char First Name, Country = \" + $country \r\n $results.puts \"***************************************************************************\"\r\n $summary_results.puts \"*******************************************************************\"\r\n $summary_results.puts \"******* End MT4 51 char First Name Test. ************************\"\r\n $summary_results.puts \"*******************************************************************\"\r\nend", "def say_hello(name=\"Ruby Programmer\")\n puts \"Hello #{name}!\"\nend", "def test_dsl_4\n #-------------------------\n show Spock + Lizard + Rock\n #-------------------------\n assert_equal \\\n \"Lizard poisons Spock (winner Lizard)\\n\" \\\n \"Rock crushes Lizard (winner Rock)\\n\" \\\n \"Result = Rock\\n\", \\\n @out.string\n end", "def say_hello(name=\"Ruby Programmer\")\n puts \"Hello #{name}!\"\nend", "def str3; end", "def str3; end", "def initialize(name = \"Ruby\") #initializing new instances with one argument\n @name = name #setting instance variable @name equal to name argument, which will be a string\n @rule = \"Law of Demeter\" #instance variable @rule set eql to string\n end", "def greeter(name)\n return \"hello \" + name + \" its nice to see you.\"\nend", "def run_tests()\n check_solution(1, 'Pete,201,Student', ['Pete', '201', 'Student'])\n check_solution(2, \"Pete \\t 201 , TA\", ['Pete', '201', 'TA'])\n check_solution(3, \"Pete \\t 201\", ['Pete', '201'])\nend", "def p(string);end", "def test_ruby_string_big\n pros = Prospector.new(0,0,0)\n assert pros.ruby_string(2).eql? '2 rubies'\n end", "def str; end", "def str; end", "def new_object_string(goal)\n ivar_assignment_string(goal, \".new(params[:#{goal.s}])\", \".new(params[:#{goal.s}])\")\n end", "def test_get_first_name_returns_name_from_default_array\r\n name_gen = NameGenerator2.new\r\n\r\n fn = name_gen.get_first_name(\"don\")\r\n assert_instance_of(String, fn)\r\n end", "def test_via_random_string\r\n assert_equal 'Fifth Ave', @driver.via('avc', 'dsads')\r\n end", "def string(str); end" ]
[ "0.66028106", "0.6293523", "0.6116811", "0.6054893", "0.60472727", "0.60425794", "0.6021271", "0.5947183", "0.59276813", "0.5903257", "0.5866471", "0.5864241", "0.5863483", "0.5855647", "0.58468235", "0.5841774", "0.5841774", "0.580936", "0.5803152", "0.57916427", "0.57772744", "0.57381517", "0.5734999", "0.5724657", "0.57242066", "0.5706827", "0.56979644", "0.5671809", "0.566774", "0.56588507", "0.5658776", "0.56574583", "0.56574583", "0.5650259", "0.5648776", "0.5635651", "0.5617733", "0.56117797", "0.5605847", "0.5605078", "0.5603085", "0.5597888", "0.55930007", "0.55930007", "0.55930007", "0.5585064", "0.5584449", "0.5574202", "0.5568018", "0.55501485", "0.55501485", "0.55501485", "0.55501485", "0.55501485", "0.55501485", "0.55501485", "0.55501485", "0.55501485", "0.5538366", "0.5535317", "0.5534464", "0.55341303", "0.55170274", "0.55099124", "0.5508061", "0.5503214", "0.55006176", "0.54974204", "0.54959196", "0.54839593", "0.54789823", "0.54588836", "0.5441466", "0.5440996", "0.5440253", "0.54372764", "0.5422133", "0.5418549", "0.5406024", "0.54038286", "0.54011375", "0.54007226", "0.53981334", "0.53951424", "0.53948516", "0.5393476", "0.5391507", "0.53804785", "0.5366469", "0.5366469", "0.53579634", "0.53547597", "0.53522086", "0.53517437", "0.5347383", "0.53467846", "0.53467846", "0.53401154", "0.53250647", "0.53227925", "0.53225553" ]
0.0
-1
4. As a user, I need an API to subscribe to updates from an email address. GET
def create requestor = User.where(email: @requestor) target = User.where(email: @target) if requestor.exists? && !target.exists? render json: { success: false, message: "Target Email not found" } elsif !requestor.exists? && target.exists? render json: { success: false, message: "Requestor Email not found" } elsif !requestor.exists? && !target.exists? render json: { success: false, message: "Both Email not found" } else if @requestor != @target || @target != @requestor user = User.find_by_email @requestor aim = User.find_by_email @target user.subscribes.create target_id: aim.id render json: { success: true } else render json: { success: false, message: "You can't subscribe yourself" } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def api_get\n handler.get({email: email}, path)\n end", "def subscriber(id_or_email)\n make_json_api_request :get, \"v2/#{account_id}/subscribers/#{CGI.escape id_or_email}\"\n end", "def subscribe(email, user_info = {}, email_type = \"html\", update_existing = true, double_opt = false)\n begin\n @api.call(\"listSubscribe\", @api_key, @list_id, email, user_info, email_type, double_opt, update_existing, false)\n rescue\n false\n end\n end", "def update_subscriptions(email, attrs = {})\n attrs['email'] = email\n Iterable.request(conf, '/users/updateSubscriptions').post(attrs)\n end", "def subscribe\n @bot.get_updates(fail_silently: true) do |message|\n parser = InputParser.new(message.text)\n subject = parser.parse_subject\n if subject != nil\n response = \"Hello #{subject}, I'm dad.\"\n message.reply do |reply|\n reply.text = response\n reply.send_with(@bot)\n end\n end\n end\n end", "def user_vendor_subscriptions\n get(\"/api/v1/oauth_user_vendor_subscriptions.json\")\n end", "def subscribe_to_email\n @subscription.subscribe_to_email\n return_back_or_ajax\n end", "def update\n content = get_content('email_notifications.yml')\n user = User.where(unsubscription_token: params[:unsubscription_token]).first\n\n unless user\n flash[:error] = \"Could not find user\"\n redirect_to root_path and return\n end\n\n user.subscriptions.update_all(unsubscribe_reason: reason_param)\n\n render 'email_notifications/update', layout: 'notification', status: :accepted, locals: {\n content: content['update'],\n }\n end", "def subscribe(id:, email:)\n request do\n response =\n connection.post(\"#{id}/subscribe\", 'email' => email)\n\n parse(response.body)\n end\n end", "def add_user_to_mailchimp \n Rails.logger.info(\"Mailchimp subscribe request being made\")\n unless self.email.include?('@example.com')\n mailchimp = Hominid::API.new(AppConstants.mailchimp_key) \n list_id = mailchimp.find_list_id_by_name AppConstants.mailchimp_list \n info = { }\n result = mailchimp.list_subscribe(list_id, self.email, info, 'html', false, true, false, true)\n Rails.logger.info(\"Mailchimp subscribed for the email id #{self.email} to #{AppConstants.mailchimp_list}\")\n end\n end", "def subscribe\n CampaignMonitorWrapper.subscribe(id: user.id, email: user.email, name: user.name, beta: user.beta?.to_s, billable: user.billable?.to_s)\n end", "def subscribe_to_newsletter\n # SubscribeUserToMailingListJob.perform_now(params[:email]);\n\n gb = Gibbon::Request.new\n\n list_id = ENV[\"MAILCHIMP_LIST_ID\"]\n\n gb.lists(list_id)\n .members\n .create(body: { email_address: params[:email], status: \"subscribed\"})\n\n render_success(\"Successfully Subscribed\")\n end", "def get_user_by_email_for_current_tenant(args = {}) \n get(\"/users.json/email/#{args[:email]}\", args)\nend", "def get_user_by_email_for_current_tenant(args = {}) \n get(\"/users.json/email/#{args[:email]}\", args)\nend", "def subscribe(email, merge_vars={})\n # Raise an error to warn it isn't implemented.\n raise NotImplementedError.new\n end", "def subscribe\n \nend", "def emails\n respond_with_entity(api.get('/api/v1/profile/emails'),\n NexaasID::Entities::Profile::Emails)\n end", "def subscribe\n if params[:signup][:email_address].present?\n email = params[:signup][:email_address].gsub(/\\s/, '').downcase\n list_id = params[:signup][:list_id]\n\n begin\n Klaviyo.subscribe(email, list_id, request.referer)\n @message = I18n.translate('form.success.subscribe')\n @success = true\n rescue Error => e\n @message = e.detail.to_s\n @success = false\n end\n else\n @message = I18n.translate('form.missing.email')\n @success = false\n end\n end", "def update_subscriber_list\n @mandrill = Mandrill::API.new 'nDSi_tYPhOy6QpG8Kn_lqg'\n @subscriber_list = User.where(isSubscribed: true)\n end", "def index\n # TODO pull out api key before pushing to github & pull out binding prys\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 subId = message[:data][0][:id]\n else\n # Port is open in our router\n params = { url: SUBSCRIPTION_URL, events: ['invitee.created', 'invitee.canceled'] }\n newRes = HTTParty.post URL, body: params, headers: HEADERS\n message = JSON.parse newRes.body, symbolize_names: true\n # TODO need error handling\n subId = message[:id]\n end\n end\n end", "def email(id)\n get(\"/user/emails/#{id}\")\n end", "def subscribe_to_updates\n if @subscription = @requestor.find_or_create_subscriptions(@target.id)\n @subscription.update_attributes(blocked: false) if @subscription.blocked?\n render json: { success: true }\n else\n render json: {message: @subscription.errors&.full_messages || 'Unable to subscriber updates, please try again'}, status: 202\n end\n end", "def fGetSubscribedEventsFrom(email)\n @users.getSubscribedEventsFrom(email)\n end", "def request_email ucr\n extract_variables ucr\n @url = accept_change_request_url(ucr.token)\n\n mail to: @user.email\n end", "def update_subscription old_email, user\n execute { GoGoGibbon::Commands.update_subscription old_email, user }\n end", "def subscribe!\n # TODO: Implement\n end", "def update\n response = begin\n CoachClient::Request.get(url, username: @user1.username,\n password: @user1.password)\n rescue CoachClient::Exception\n CoachClient::Request.get(url, username: @user2.username,\n password: @user2.password)\n end\n response = response.to_h\n @id = response[:id]\n @datecreated = response[:datecreated]\n @publicvisible = response[:publicvisible]\n set_user_confirmed(response)\n @subscriptions = []\n unless response[:subscriptions].nil?\n response[:subscriptions].each do |s|\n sport = s[:uri].match(/\\/(\\w+)\\/\\z/).captures.first\n @subscriptions << CoachClient::PartnershipSubscription.new(client, self,\n sport)\n end\n end\n self\n end", "def subscribe_updates\n\n \t\tif params[:requestor].blank? || params[:target].blank?\n \t\t\tlogger.info(\"[FriendUserController]subscribe_updates == params is error ,params ==#{params[:friends]}\")\n \t\t\treturn render :json => {:success => false}\n \t\tend\n\n \t\trequestor_email = params[:requestor]\n \t\ttarget_email = params[:target]\n\n \t\tif BlockUser.exists?(:email=>requestor_email,:block_email=>target_email)\n \t\t\tlogger.info(\"[FriendUserController]subscribe_updates == block updates,can not subscribe to updates ,params ==#{params}\")\n \t\t return render :json => {:success => false}\n \t\tend\n\n \t\tif SubscribeUser.exists?(:email=>requestor_email,:subscribe_email=>target_email)\n \t\t\tlogger.info(\"[FriendUserController]subscribe_updates == subscribe to updates exist ,params ==#{params}\")\n \t\t return render :json => {:success => true}\n \t\tend\n \t\t\n \t\tsubscribe_user = SubscribeUser.create(:email=>requestor_email,:subscribe_email=>target_email)\n\n \t\tif subscribe_user.save\n \t\t\tlogger.info(\"[FriendUserController]subscribe_updates == subscribe to updates success ,params ==#{params}\")\n \t\t\treturn render :json => {:success => true}\n \t\telse\n \t\t\tlogger.info(\"[FriendUserController]subscribe_updates == can not subscribe to updates ,error=#{subscribe_user.errors.full_messages} ,params ==#{params}\")\n \t\t\treturn render :json => {:success => false}\n \t\tend\n \t\t\n \tend", "def subscribe\n if User.exists?(email: params[:user][:email])\n render json: { status: 'The email is already taken' }, status: :bad_request\n else\n subscribed_user = SubscribedUser.create!(user_params)\n render json: { status: 'Created' }, status: :created if subscribed_user\n render json: { status: 'Something wrong happened' }, status: :bad_request unless subscribed_user\n end\n rescue\n render json: { status: 'Something wrong happened' }, status: :bad_request\n end", "def update_newsletter_subscription!\n return unless self.user.present?\n\n if self.receives_newsletter?\n NewsletterSubscriptionsWorker.perform_async(:subscribe, self.user.email)\n else\n NewsletterSubscriptionsWorker.perform_async(:unsubscribe, self.user.email)\n end\n end", "def get_subscriber_by_email_address_with_http_info(format, apikey, mailing_list_id, email, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SubscribersApi.get_subscriber_by_email_address ...\"\n end\n # verify the required parameter 'format' is set\n if @api_client.config.client_side_validation && format.nil?\n fail ArgumentError, \"Missing the required parameter 'format' when calling SubscribersApi.get_subscriber_by_email_address\"\n end\n # verify enum value\n if @api_client.config.client_side_validation && !['json', 'xml'].include?(format)\n fail ArgumentError, \"invalid value for 'format', must be one of json, xml\"\n end\n # verify the required parameter 'apikey' is set\n if @api_client.config.client_side_validation && apikey.nil?\n fail ArgumentError, \"Missing the required parameter 'apikey' when calling SubscribersApi.get_subscriber_by_email_address\"\n end\n # verify the required parameter 'mailing_list_id' is set\n if @api_client.config.client_side_validation && mailing_list_id.nil?\n fail ArgumentError, \"Missing the required parameter 'mailing_list_id' when calling SubscribersApi.get_subscriber_by_email_address\"\n end\n # verify the required parameter 'email' is set\n if @api_client.config.client_side_validation && email.nil?\n fail ArgumentError, \"Missing the required parameter 'email' when calling SubscribersApi.get_subscriber_by_email_address\"\n end\n # resource path\n local_var_path = \"/subscribers/{MailingListID}/view.{Format}\".sub('{' + 'Format' + '}', format.to_s).sub('{' + 'MailingListID' + '}', mailing_list_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'apikey'] = apikey\n query_params[:'Email'] = email\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(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'GetSubscriberByEmailAddressResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SubscribersApi#get_subscriber_by_email_address\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def can_receive_updates\n @user = User.where(email: params[:email])\n params[:message]\n if @user.present?\n render json: @user.unblocked_subscribers.page(params[:page]).per(params[:per_page]).distinct\n else\n render json: {message: 'User Not Found'}, status: 404\n end\n end", "def subscribe\n # PSHB.subscribe(\"/api/superfeedr/receive_feeds/\", \"http://li182-172.members.linode.com/feeds/#{self.id}\", \"async\")\n PSHB.subscribe(\"/api/superfeedr/receive_feeds/\", self.url, \"async\")\n end", "def subscribe_to_newsletter\n SubscribeToNewsletterService.new(self).call\n end", "def chimpSubscribe(apikey, list_id, email, merge_vars, content_type = 'html', double_opt = true)\n raise_errors(apikey, list_id)\n chimpAPI ||= XMLRPC::Client.new2(\"http://api.mailchimp.com/1.1/\")\n chimpAPI.call(\"listSubscribe\", apikey, list_id, email, merge_vars, content_type, double_opt)\n end", "def subscribe\n @subscription.subscribe(with_email_subscription: params[:with_email_subscription].to_s.to_boolean(ActivityNotification.config.subscribe_to_email_as_default),\n with_optional_targets: params[:with_optional_targets].to_s.to_boolean(ActivityNotification.config.subscribe_to_optional_targets_as_default))\n return_back_or_ajax\n end", "def set_action\n @email = params.fetch(:user)[:email]\n if params.fetch(:user)[:subscription] == \"1\"\n @action = \"subscribed_to_users\"\n @updated_subscription = true\n else\n @action = \"unsubscribed_from_users\"\n @updated_subscription = false\n end\n end", "def subscribe_to_list(user, list, options={})\n post(\"/#{user}/#{list}/subscribers.json\")\n end", "def subscribe_to_mailchimp(action = true)\n gibbon = Gibbon::Request.new\n gibbon.timeout = 15\n list_id = Rails.application.config.list_id\n\n response = gibbon.lists(list_id).members(Digest::MD5.hexdigest(self.email)).upsert(body: {\n email_address: self.email, \n status: action ? \"subscribed\" : \"unsubscribed\", \n })\n \n response\n end", "def request!\n self.type = :subscribe\n reply_if_needed!\n end", "def fetch_subscriber(email)\n client.get(\"members/#{subscriber_id(email)}\").body\n end", "def create / update_subscriptions\n end", "def for_email(email)\n Iterable.request(conf, \"/users/#{email}\").get\n end", "def get_user_for_tenant_by_email(args = {}) \n get(\"/tenants.json/#{args[:tenantId]}/users/email/#{args[:email]}\", args)\nend", "def update_subscription(old_email, new_email)\n # Mailchimp have a handy helper for updating an existing subscription.\n api.update_member({\n :id => @campaignable_list_id,\n :email => {\n :email => old_email\n }, \n :merge_vars => {\n :'new-email' => new_email\n }\n })\n end", "def membership_subscribe_from_billing_address(email)\n HTTParty.post(\"#{Rails.application.secrets.mapp_integration[:api_endpoint]}\"+\"/membership/subscribeByEmail\", headers: headers, query: membership_subscribe_by_email_api_query(email) )\n end", "def update\n friend = current_user.friends.find params[:id]\n return render json: { error: \"This doesn't seem to be your friend\" } if friend.nil?\n subscribed = !friend.subscribed\n change = subscribed ? 1 : -1\n friend.update subscribed: subscribed\n notify friend, change, 'subscribe'\n render json: {success: subscribed == friend.subscribed}\n end", "def subscribe\n mailchimp = Gibbon::API.new\n result = mailchimp.lists.subscribe({\n :id => ENV[\"MAILCHIMP_LIST_ID\"],\n :email => {:email => self.email},\n :merge_vars => {\n :FNAME => self.fname,\n :LNAME => self.lname,\n :COHORT_ID => self.cohort_id,\n :SCHOOL => self.school.name,\n :CITY => self.cohort.city.name,\n :SDATE => self.cohort.start_date,\n :EDATE => self.cohort.end_date,\n :ENV => Rails.env\n },\n :double_optin => false,\n :update_existing => true,\n :send_welcome => false\n })\n Rails.logger.info(\"Subscribed #{self.email} to MailChimp\") if result\n\n end", "def email_update\n participant = Participant.first\n participant.email_update_token = Participant.new_token\n ParticipantMailer.email_update(participant)\n end", "def endpoint\n @endpoint ||= 'https://api.emailcampaigns.net/2/REST/'\n end", "def update_users_password_by_e_mail(args = {}) \n put(\"/users.json/backoffice/email/#{args[:email]}/password/#{args[:password]}\", args)\nend", "def update_users_password_by_e_mail(args = {}) \n put(\"/users.json/backoffice/email/#{args[:email]}/password/#{args[:password]}\", args)\nend", "def subscribe\n if params[:signup][:email_address].present?\n email = params[:signup][:email_address].gsub(/\\s/, '').downcase\n list_id = params[:signup][:list_id]\n language_code = I18n.locale.to_s.upcase\n country_code = request.headers['CF-IPCountry']\n\n begin\n Sendinblue.subscribe(\n email,\n list_id,\n first_referrer: request.referer,\n language: I18nData.languages[language_code],\n country: I18nData.countries[country_code]\n )\n\n @message = I18n.translate('form.success.subscribe')\n @success = true\n rescue Error => e\n @message = e.detail.to_s\n @success = false\n end\n else\n @message = I18n.translate('form.missing.email')\n @success = false\n end\n end", "def subscribe! (user_id)\n check_auth :subscribe\n \n response = connection.post do |req|\n req.url \"/user/subscribe/#{user_id}\"\n req.body = { :format => @format }\n end\n response\n end", "def list_subscribers(user, list)\n get(\"/#{user}/#{list}/subscribers.json\")\n end", "def receive_update\n @text = params[:text]\n user = User.find_by_email params[:sender]\n if user\n\n friendship = Friendship.where user_id: user\n\n # get the recipient\n recipients = []\n friendship.each do |f|\n recipients << f.friend.email\n end\n mention = @text.scan(/\\w+@\\w+.\\w+/i)\n recipients << mention.join(', ')\n\n # get the block user\n excludes = []\n subscribes = Subscribe.where user: user, block: true\n subscribes.each do |f|\n excludes << f.target.email\n end\n\n recipients = recipients.reject { |i| excludes.include?(i) }\n\n render json: { success: true, recipients: recipients }\n else\n render json: { success: false, message: \"Sender email not found\" }\n end\n end", "def add(email: nil)\n if email.nil?\n raise ArgumentError.new('Missing required `email` option')\n end\n res = connection.post(\n '/api/unsubscribes.add.json',\n default_params(email: email))\n craft_response(res)\n end", "def subscribe!\n url = \"#{GRAPH_URL}/me/subscribed_apps?access_token=#{ENV['MESSENGER_BOT_ACCESS_TOKEN']}\"\n data = RestClient.post(url, nil)\n if data\n json = JSON.parse(data)\n json['success']\n else\n false\n end\n end", "def chimp_subscribe(resource, email_content_type=\"html\", double_optin=false)\n begin\n @client.call(\"listSubscribe\", @api_key, get_mailing_list_from_resource(resource), resource.email, resource.build_mail_merge(), email_content_type, double_optin)\n rescue XMLRPC::FaultException => e\n raise MailChimpAPI::CreateError, e.faultString\n end \n end", "def subscribe\n Socky.send( {:action => \"subscribe\",\n :channel => params[:channel],\n :client => (params[:client_id] || '')}.to_json)\n render :text => \"ok\"\n end", "def subscribe\n @issue.skip_email_notifications = true\n @issue.subscribe(current_user)\n render 'issues/update.js.erb', locals: {project: @project, key: @key, translation: @translation, issue: @issue }\n end", "def resource(id, account: nil)\n get account, \"email/#{id}\", {}\n end", "def emails(params={})\n @api.get(\"#{@api.path}/User/Emails\", params: params)\n end", "def subscribed(user)\n mail to: user.email\n end", "def updated(user)\n @user = user\n @email = @user.email\n\n mail to: @email,\n subject: \"Subscription Payment Received\"\n end", "def create_or_update_subscriber(*args)\n data = {}\n data[:email] = args[0] if args[0].is_a? String\n data.merge!(args.last) if args.last.is_a? Hash\n raise ArgumentError, 'email: or id: or bigcommerce_subscriber_id: parameter required' if missing_subscriber_identifier(data)\n make_json_api_request :post, \"v2/#{account_id}/subscribers\", private_generate_resource(\"subscribers\", data)\n end", "def update_subscription(old_email, new_email, merge_vars={})\n # Raise an error to warn it isn't implemented.\n raise NotImplementedError.new\n end", "def set_email_subscription\n @email_subscription = EmailSubscription.find(params[:id])\n end", "def user_lookup(email, id = false)\n if id\n send_req({act: :user_lookup, unique_id: email})\n else\n send_req({act: :user_lookup, cloudflare_email: email})\n end\n end", "def subscribe(params)\n web_id = params[\"web_id\"]\n email = params[\"merges\"][\"EMAIL\"]\n\n subscriber = nil\n enabled_models.each { |model| subscriber ||= model.constantize.find_by_email(email) }\n\n subscriber.subscribed_to_list = true\n subscriber.mail_chimp_id = web_id.to_i\n subscriber.save_without_update_list_member(:validate => false)\n end", "def update_subscription(old_email, new_email, merge_vars={})\n # Update the existing member details.\n api.lists(@campaignable_list_id).members(subscriber_hash(old_email)).update(body: {\n :email_address => new_email,\n :status => \"subscribed\",\n :merge_fields => prep_merge_fields(merge_vars) # Include additional variables to be stored.\n })\n end", "def list\n perform_request(Entities::MarketingEmail, 'newsletter/list.json')\n end", "def new_subscription(user, subscribable)\n @user = user \n @subscribable = subscribable \n\n mail to: user.email, subject: \"Subscribed to #{subscribable.name} Updates\"\n end", "def unsubscribe_from_all(id_or_email)\n make_json_api_request :post, \"v2/#{account_id}/subscribers/#{CGI.escape id_or_email}/unsubscribe_all\"\n end", "def batch_subscribe(emails=[])\n # Do this using a batch call to the MailChimp API for performance rather than lots of single API calls.\n api.batch_subscribe({\n \t:id => @campaignable_list_id,\n :batch => emails.map {|email| {:email => { :email => email }} }, # Map all users in the system into a mailchimp collcation.\n :double_optin => false, # Don't require email authorization.\n :update_existing => true, # Don't error if adding existing subscriber.\n :replace_interests => false # Don't send a welcome email when they're added to the list. \n })\n end", "def subscribed(params = {})\n @api.get(\"#{@api.path}/List/#{@id}/Recipients/Subscribed\", params: params)\n end", "def get_email(email_id)\n request :get, \"/v3/emails/#{email_id}.json\"\n end", "def subscribe\n find_and_authorize_with_security_code\n @email.subscribe!\n flash[:success] = t('.success_html', unsubscribe_href:\n unsubscribe_path(id: @email.id, security_code: @email.security_code))\n redirect_to root_path\n end", "def batch_subscribe(email)\n # Raise an error to warn it isn't implemented.\n raise NotImplementedError.new\n end", "def update_subscriptions_from_account \n contacts = params[:contacts]\n contacts_subscribing = params[:subscribers].is_a?(Hash) ? params[:subscribers].keys : []\n contacts_unsubscribing = params[:contacts] - contacts_subscribing\n \n # subscribe these contacts\n contacts_subscribing.each do |c_id|\n begin\n Case_Watcher.create_subscription!(Contact.find(c_id), \n :account => Sfaccount.find(params[:id]).synced_record )\n rescue ActiveRecord::RecordNotFound\n logger.info(\"Couldn't create subscription for contact w/id: #{c_id}. Contact doesn't exist.\")\n end\n end\n\n # unsubscribe these contacts\n contacts_unsubscribing.each do |c_id|\n begin\n Case_Watcher.remove_subscription!(Contact.find(c_id), \n :account => Sfaccount.find(params[:id]).synced_record )\n rescue ActiveRecord::RecordNotFound\n logger.info(\"Couldn't remove subscription for contact w/id: #{c_id}. Contact doesn't exist.\")\n end\n end\n \n redirect_to :action => 'account', :id => @account, :notice => \"Account subscriptions updated.\"\n end", "def send_notification\n @emails = EmployeeEmail.all\n if @emails == []\n return\n else\n #rather unwise to have my api key just sitting here in the code, need to check if a new api-key can be generated\n RestClient.post \"https://api:key-5f4ada711a8a86a1292bcfe23aa9d0aa\"\\\n \"@api.mailgun.net/v2/sandbox3fcc0ad1e9ee457da78753f228405f7e.mailgun.org/messages\",\n :from => \"Excited User <mailgun@sandbox3fcc0ad1e9ee457da78753f228405f7e.mailgun.org>\",\n :to => send_who_us,\n :subject => \"Ovuline Notification Test\",\n #ack! I need to find a way to get @company info into this next line\n :text => \"This is the Ovuline Notification System test message! A company (need to make this more specific) has submitted information to the Quotes Table! Is that former sentence incomplete or otherwise incorrect? Oh no! A bug!\"\n end\n end", "def show\n respond_with fetch_email(params[:id])\n end", "def index\n\n if @notification\n json_response(@notification.user_subscriptions)\n end\n if request.path_parameters.has_key?(:user_id)\n json_response(@user.user_subscriptions)\n end\n end", "def subscribe_client(client,email)\n cursor = parse \"BEGIN msf.acm_utils.manage_tocs(:publication, :cno, :action, :email, :cur_status, :status_dt, :r_str); end;\"\n cursor.bind_param ':cno', client.to_s\n cursor.bind_param ':email', email ||= ''\n cursor.bind_param ':action', 'ADD'\n exec cursor do\n cursor[':r_str'] == 'Ok'\n end\n end", "def subscribe_author\n self.subscriptions.create user_id: self.user.id\n end", "def set_email_newsletter_subscription\n @email_newsletter_subscription = EmailNewsletterSubscription.find(params[:id])\n end", "def userGetLibraryTSModified(userID)\n request('userGetLibraryTSModified', {'userID' => userID})\nend", "def call_api(email)\n user = generate_email\n status_url = 'https://rapportive.com/login_status?user_email=' + user\n profile_url = 'https://profiles.rapportive.com/contacts/email/' + email\n\n # exponential backoff to get session_token\n response = exp_backoff 2, status_url\n session_token = response['session_token'] if response\n\n if response.nil? || response['error']\n false\n elsif response['status'] == 200 && session_token\n header = { 'X-Session-Token' => session_token }\n\n response = exp_backoff 2, profile_url, header\n if response.nil?\n false\n elsif response['success'] != 'nothing_useful'\n response['contact']\n end\n end\nend", "def show\n @email_update = EmailUpdate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @email_update }\n end\n end", "def fAddSubscribedEventTo(email, eventID)\n @users.addSubscribedEventTo(email, eventID)\n end", "def search_subscriptions(body:)\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/v2/subscriptions/search'\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json',\n 'content-type' => 'application/json; charset=utf-8'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.post(\n _query_url,\n headers: _headers,\n parameters: body.to_json\n )\n OAuth2.apply(config, _request)\n _response = execute_request(_request)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n _errors = APIHelper.map_response(decoded, ['errors'])\n ApiResponse.new(\n _response, data: decoded, errors: _errors\n )\n end", "def subscribe(email, campaign_id, options = {})\n data = options.merge(\"email\" => email)\n url = \"v2/#{account_id}/campaigns/#{campaign_id}/subscribers\"\n make_json_api_request :post, url, private_generate_resource(\"subscribers\", data)\n end", "def fetch_users_info(emails)\n endpoint = \"/api/#{@version}/user/info/\"\n custom_params = {\n 'emails' => emails.join(',')\n }\n make_get_request(endpoint, custom_params)\n end", "def show\n @email = @user.emails.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @email }\n end\n end", "def show\n @email = @user.emails.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @email }\n end\n end", "def list_subscriptions(user)\n get(\"/#{user}/lists/subscriptions.json\")\n end", "def update\n respond_to do |format|\n if @email_newsletter_subscription.update(email_newsletter_subscription_params)\n format.html { redirect_to @email_newsletter_subscription, notice: 'Email newsletter subscription was successfully updated.' }\n format.json { render :show, status: :ok, location: @email_newsletter_subscription }\n else\n format.html { render :edit }\n format.json { render json: @email_newsletter_subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @email = @user.emails.find(params[:id])\n\n respond_to do |format|\n if @email.update_attributes(email_params)\n format.html { redirect_to @email, notice: 'Email was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @email.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @emails = JSON[access_token.get(\"/api/v1/emails\").body]\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @emails }\n end\n end", "def update_subscription\n # Only change the subscription if the models email\n # address has been changed.\n self.class.list_manager.update_subscription(self.email_was, self.email, campaignable_additional_fields) if self.email_changed?\n end", "def change_subscription\n @user = User.find(params[:id])\n @user.notify = !@user.notify\n @user.save\n respond_with(@user) do\n redirect_to \"/users/successful_unsubscribe\"\n end\n end" ]
[ "0.6914114", "0.6734552", "0.6635045", "0.6598303", "0.65398705", "0.6534972", "0.6442823", "0.6388719", "0.6379484", "0.6302087", "0.6218143", "0.62045735", "0.6199686", "0.6199686", "0.6178889", "0.61730903", "0.6170663", "0.6140942", "0.6129353", "0.6126644", "0.6122598", "0.6114283", "0.6097835", "0.60851043", "0.6062539", "0.6058924", "0.6054563", "0.60502404", "0.6049555", "0.6046183", "0.60334784", "0.60072756", "0.5998937", "0.599111", "0.59889454", "0.59779894", "0.59613925", "0.59448975", "0.5924292", "0.5917572", "0.59151095", "0.5901029", "0.5898172", "0.5878254", "0.58764106", "0.5868191", "0.5854361", "0.583005", "0.5827651", "0.5825453", "0.58176684", "0.58176684", "0.5817557", "0.5809231", "0.58082414", "0.58013093", "0.5788585", "0.5786885", "0.5785823", "0.5775202", "0.5771131", "0.5763894", "0.57512605", "0.5748452", "0.57367975", "0.57366765", "0.5719929", "0.5717187", "0.5712023", "0.5709392", "0.5707055", "0.570551", "0.570325", "0.5695595", "0.56945866", "0.56907344", "0.56748086", "0.56582344", "0.5656211", "0.56498337", "0.5648359", "0.56447625", "0.56172174", "0.5615078", "0.56149983", "0.5614679", "0.5614308", "0.5601571", "0.55961967", "0.5593655", "0.5590042", "0.5587915", "0.5584158", "0.5583556", "0.5583556", "0.55827403", "0.556794", "0.55560327", "0.5554559", "0.55485636", "0.5548217" ]
0.0
-1
5. As a user, I need an API to block updates from an email address. PUT
def block requestor = User.find_by_email @requestor target = User.find_by_email @target if requestor && target list = Subscribe.where(user: requestor, target: target).first if list.nil? list = requestor.subscribes.create target_id: target.id end list.update_attribute(:block, true) render json: { success: true } else render json: { success: false, message: "email not found" } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_users_password_by_e_mail(args = {}) \n put(\"/users.json/backoffice/email/#{args[:email]}/password/#{args[:password]}\", args)\nend", "def update_users_password_by_e_mail(args = {}) \n put(\"/users.json/backoffice/email/#{args[:email]}/password/#{args[:password]}\", args)\nend", "def block!\n self.update_attribute(:status, ConfigCenter::User::BLOCKED)\n end", "def block_updates\n @subscription = @requestor.find_or_create_subscriptions(@target.id)\n if @subscription.update_attributes(blocked: true)\n render json: { success: true }\n else\n render json: {message: @subscription.errors&.full_messages || 'Unable to block subscriptions, please try again'}, status: 202\n end\n end", "def can_receive_updates\n @user = User.where(email: params[:email])\n params[:message]\n if @user.present?\n render json: @user.unblocked_subscribers.page(params[:page]).per(params[:per_page]).distinct\n else\n render json: {message: 'User Not Found'}, status: 404\n end\n end", "def update!(**args)\n @has_blocked_requester = args[:has_blocked_requester] if args.key?(:has_blocked_requester)\n @is_blocked_by_requester = args[:is_blocked_by_requester] if args.key?(:is_blocked_by_requester)\n end", "def update\n updated_user = user_params\n\n if params[:user][:do_not_email] == '1'\n updated_user[:marketing] = '0'\n updated_user[:articles] = '0'\n updated_user[:digest] = '0'\n end\n\n user = Token.consume(params[:user][:nonce])\n\n if user == nil or user.id.to_s != params[:id] or params[:user][:url_email] != user.email\n flash[:alert] = 'Access denied!'\n redirect_to action: 'edit'\n return\n elsif user.email != params[:user][:email]\n email_already_exists = email_already_exists?(params[:user][:email])\n if email_already_exists\n redirect_to action: 'edit'\n return\n end\n else\n respond_to do |format|\n if @user.update(updated_user)\n format.html { redirect_to action: 'index' }\n format.json { render :show, status: :ok, location: @user }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def update_email(user_id:, email:)\n path = '/users/{userId}/email'\n .gsub('{userId}', user_id)\n\n if user_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"userId\"')\n end\n\n if email.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"email\"')\n end\n\n params = {\n email: email,\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'PATCH',\n path: path,\n headers: headers,\n params: params,\n response_type: Models::User\n )\n end", "def update_user_email\n user&.update!(email: email)\n end", "def update\n @email = @user.emails.find(params[:id])\n\n respond_to do |format|\n if @email.update_attributes(email_params)\n format.html { redirect_to @email, notice: 'Email was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @email.errors, status: :unprocessable_entity }\n end\n end\n end", "def block!\n self.update_attribute(:blocked, true)\n end", "def update\n @email = @user.emails.find(params[:id])\n\n respond_to do |format|\n if @email.update_attributes(params[:email])\n format.html { redirect_to [@game, @user, @email], notice: 'Email was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @email.errors, status: :unprocessable_entity }\n end\n end\n end", "def mf_api_user_update_tags\n\n # Get User From DB with client_id\n user = User.where(clientid: params[:client_id]).first\n\n # If user not found, return error response\n if user.empty?\n response = {\n success: false,\n message: 'User with ClientID not found'\n }\n\n render json: response\n end\n\n # Get the Infusionsoft contact info\n contact = Infusionsoft.data_load('Contact', user.clientid, [:Groups])\n\n # Update User Tags\n user.put('', {\n :client_tags => contact['Groups']\n })\n\n\n response = {\n success: true,\n message: 'User Tags Updated'\n }\n\n render json: response\n\n end", "def update!(**args)\n @user_emails = args[:user_emails] if args.key?(:user_emails)\n end", "def update\n inviter_mail = resource_params.delete \"invitermail\"\n \n accepted_inviter = resource_class.to_adapter.find_first(email: inviter_mail)\n \n # before inviting person gets credit for the new user: check if he is\n # really allowed to claim. Only certain vip users are allowed...\n if accepted_inviter && accepted_inviter.ability.can?(:invite, resource_class)\n self.resource = resource_class.accept_invitation!(resource_params) \n resource.invited_by = accepted_inviter\n else\n ## No discussion. User didn't have the right to invite, so show...\n flash[:error] = I18n.t(\"devise.invitations.no_authorized_inviter\")\n raise CanCan::AccessDenied\n end\n\n if resource.errors.empty?\n flash_message = resource.active_for_authentication? ? :updated : :updated_not_active \n set_flash_message :notice, flash_message\n sign_in(resource_name, resource)\n respond_with resource, :location => after_accept_path_for(resource)\n else\n respond_with_navigational(resource){ render :edit }\n end\n end", "def update!(**args)\n @email = args[:email] if args.key?(:email)\n end", "def update!(**args)\n @email = args[:email] if args.key?(:email)\n end", "def update!(**args)\n @email = args[:email] if args.key?(:email)\n end", "def update!(**args)\n @email = args[:email] if args.key?(:email)\n end", "def update!(**args)\n @email = args[:email] if args.key?(:email)\n end", "def update!(**args)\n @email = args[:email] if args.key?(:email)\n end", "def update!(**args)\n @email = args[:email] if args.key?(:email)\n end", "def update!(**args)\n @email = args[:email] if args.key?(:email)\n end", "def update!(**args)\n @email = args[:email] if args.key?(:email)\n end", "def update\n self.resource = @resource = resource_class.to_adapter.get!(send(:\"current_#{resource_name}\").to_key)\n\n # Redirect straight away if no changes\n if @resource.email == params[:user][:email]\n @resource.resend_confirmation_instructions\n redirect_to mno_enterprise.user_confirmation_lounge_path, notice: \"The confirmation email has been resent.\"\n return\n end\n\n # Update email\n previous_email = @resource.email\n @resource.email = params[:user][:email]\n @resource.skip_reconfirmation!\n\n if @resource.save\n @resource.resend_confirmation_instructions\n yield(:success,resource) if block_given?\n redirect_to mno_enterprise.user_confirmation_lounge_path, notice: \"'Email updated! A confirmation email has been resent.\"\n else\n # Rollback\n #@resource.restore_email!\n yield(resource,:error) if block_given?\n render 'lounge'\n end\n end", "def update\n self.resource = resource_class.to_adapter.get!(send(:\"current_resource_owner\").to_key)\n prev_unconfirmed_email = resource.unconfirmed_email if resource.respond_to?(:unconfirmed_email)\n\n resource_updated = update_resource(resource, configure_account_update_params)\n yield resource if block_given?\n\n if params[:additional_emails].present?\n resource.additional_emails.destroy_all\n additional_emails = []\n params[:additional_emails].each do |email|\n additional_emails << {email: email}\n end\n end\n \n if resource_updated\n\n resource.additional_emails.create(additional_emails) if params[:additional_emails].present?\n avatar = url_for(resource.avatar) if resource.avatar.attached?\n\n # set_flash_message_for_update(resource, prev_unconfirmed_email)\n bypass_sign_in resource, scope: resource_name #if sign_in_after_change_password?\n respond_to do |format|\n format.json { \n render json: resource.as_json.merge(additional_emails: resource.additional_emails.pluck(:email)).merge(avatar: avatar) # , location: after_sign_up_path_for(resource)\n }\n format.html {respond_with resource, location: after_update_path_for(resource)}\n end\n else\n clean_up_passwords resource\n set_minimum_password_length\n respond_to do |format|\n format.json { render json: { error_messages: resource.errors.full_messages.join(', ') }, status: 422 }\n format.html {respond_with resource}\n end\n end\n end", "def updateEmail\n if @user\n if (@user.authenticate(update_params[:password]))\n if @user.update(email: update_params[:email])\n render json: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n else\n render json: { message: \"Authentication Failed\" }\n end\n else\n render json: { message: \"Could not find user\"}\n end\n end", "def update!(**args)\n @email = args[:email] if args.key?(:email)\n @scopes = args[:scopes] if args.key?(:scopes)\n end", "def update_email\n form = AccountDetails::EditUserEmailForm.new(email_params)\n if form.valid?\n update_email_and_redirect(form)\n else\n render_edit_email(form)\n end\n rescue BaseApi::Error400Exception\n form.add_invalid_email_errors\n render_edit_email(form)\n end", "def update\n respond_to do |format|\n if @user\n @user.active = false\n @user.pending = false\n @user.save\n end\n format.json { render json: {:status => :ok}}\n end\n end", "def whitelist_email\n service_response = UserManagement::Whitelist::Email.new(params).perform\n render_api_response(service_response)\n end", "def email_deny(params)\n http_helper.send_post_request(\"#{@url_prefix}/#{get_user_id!(params)}/email/deny\", params)\n end", "def update!(**args)\n @enable_improved_email_privacy = args[:enable_improved_email_privacy] if args.key?(:enable_improved_email_privacy)\n end", "def update\n respond_to do |format|\n if !user_params[:email].nil? && @user.email != user_params[:email]\n puts @user.email\n puts user_params[:email]\n @user.errors.add(:base, :cannot_change_email, message: \"You cannot change your email.\")\n end\n\n if (!can? :manage, @user) && !user_params[:role].nil?\n @user.errors.add(:base, :cannot_change_role, message: \"You cannot change your role.\")\n end\n\n if !@user.errors.any? && @user.update(user_params)\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit_email\n traveller = Traveller.find(params[:pk])\n traveller.update(email: params[:value])\n\n if current_user.nil?\n if session[:trip] != nil\n travellers = session[:trip].travellers\n travellers[travellers.index(traveller)].email = params[:value]\n end\n\n if session[:travellers] != nil\n session[:travellers][session[:travellers].index(traveller)].email = params[:value]\n end\n end\n\n render json: {success: 'email updated successfully'}\n end", "def update(&block)\n Logger.d \"Updating user\"\n\n # TODO - change to post in actual network call\n json = {\n :user => {\n :name => get(:name),\n :email => get(:email),\n :gcm_token => get(:gcm_token)\n },\n :auth_token => get(:auth_token)\n }.to_json\n\n network_put(CONFIG.get(:user_save), nil, json, @on_api_call_failed) do |user_object|\n if is_valid_network_user_object?(user_object)\n @data = user_object\n Logger.d(\"Success in @user.update => \" + user_object.to_s)\n serialiaze() # Write the object to persistent storage\n block.call(@data)\n end\n end\n end", "def block_user(id)\n put(\"UserBlock/#{id}\")\n end", "def block_updates\n\n \t\tif params[:requestor].blank? || params[:target].blank?\n \t\t\tlogger.info(\"[FriendUserController]block_updates == params is error ,params ==#{params[:friends]}\")\n \t\t\treturn render :json => {:success => false}\n \t\tend\n\n \t\trequestor_email = params[:requestor]\n \t\ttarget_email = params[:target]\n \t\t\n \t\tif BlockUser.exists?(:email=>requestor_email,:block_email=>target_email)\n \t\t\tlogger.info(\"[FriendUserController]block_updates == block updates exist,params ==#{params}\")\n \t\t\treturn render :json => {:success => true}\n \t\tend\n \t\t\n \t\tblock_user = BlockUser.create(:email=>requestor_email,:block_email=>target_email)\n\n \t\tif block_user.save\n \t\t\tfriend_user = FriendUser.where(:email=>requestor_email,:friend_email=>target_email)\t\n \t\t\tfriend_user.map(&:destroy)\n\n \t\t\tsubscribe_user = SubscribeUser.where(:email=>requestor_email,:subscribe_email=>target_email)\n \t\t\tsubscribe_user.map(&:destroy)\n\n \t\t\tlogger.info(\"[FriendUserController]block_updates == block updates success,params ==#{params}\")\n\n \t\t\treturn render :json => {:success => true}\n \t\telse\n \t\t\tlogger.info(\"[FriendUserController]block_updates == can not block updates ,error=#{block_user.errors.full_messages} ,params ==#{params}\")\n \t\t\trender :json => {:success => false}\n \t\tend\n \tend", "def block!\n self.blocked = Time.now\n self.save\n Token.block_access!(client_uri, resource_owner_uri)\n Authorization.block_access!(client_uri, resource_owner_uri)\n end", "def edit\n super\n\n if resource.try(:is_email_fake)\n resource.email = ''\n end\n end", "def update\n #@invitation = Invitation.find(params[:id])\n @invitation = Invitation.find_by_verify_email_token!(params[:id])\n if @invitation\n @invitation.status = 'email verified'\n @invitation.save!\n if current_user\n # ????\n else \n redirect_to new_user_url(:email => @invitation.email)\n end\n end\n end", "def update\n @boat_user_email = BoatUserEmail.find(params[:id])\n\n respond_to do |format|\n if @boat_user_email.update_attributes(params[:boat_user_email])\n format.html { redirect_to(@boat_user_email, :notice => 'Boat user email was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @boat_user_email.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_email\n @user = current_user\n return unless request.post?\n if !params[:user][:email].blank?\n @user.change_email_address(params[:user][:email])\n if @user.save\n @changed = true\n end\n else\n flash[:notice] = \"Please enter an email address\"\n end\n end", "def update!(**args)\n @email = args[:email] if args.key?(:email)\n @user_id = args[:user_id] if args.key?(:user_id)\n end", "def update\n email = AuthenticationHelper::Auth.instance.getEmailFromJWT( request )\n if ( email == nil )\n render json: :nothing, status: :unprocessable_entity\n return\n end\n\n user = User.find_by(email: email)\n if ( user )\n account = Account.find_by(user_id: user[\"id\"], id: params[:id])\n \n if ( account == nil )\n render json: :nothing, status: :unprocessable_entity\n return\n end\n\n if account.update(account_params)\n render json: account, status: :ok\n else\n render json: account.errors, status: :unprocessable_entity\n end\n else\n render json: :nothing, status: :unprocessable_entity\n end\n end", "def update!(**args)\n @email_address = args[:email_address] if args.key?(:email_address)\n end", "def update!(**args)\n @email_address = args[:email_address] if args.key?(:email_address)\n end", "def set_email_updates\n get_email = FollowerFollowing.where('follower_id=? and following_id=?', @login_user.id, params[:id]).first\n get_email.update_attributes(:get_email_updates => !get_email.get_email_updates)\n redirect_to \"/users/profile/#{params[:id]}\"\n end", "def update(current_email, user_info, email_type = 'html')\n begin\n @api.call(\"listUpdateMember\", @api_key, @list_id, current_email, user_info, email_type, true)\n rescue\n false\n end\n end", "def update!\n unless id\n raise \"user can not be updated before it is created.\"\n end\n hash = \"W10=\"\n\n payload = {\n \"id\" => id,\n \"email\" => @email_address,\n \"time_zone\" => @time_zone,\n \"country\" => @country,\n \"preferred_language\" => @language,\n \"receive_campaign_emails\" => \"true\",\n \"hash\" => hash,\n \"username\" => @email_address,\n \"last_login_at\" => get_last_login_at!,\n \"password\" => @password,\n \"password_confirmation\" => @confirm_password,\n \"user\" => {\n \"email\" => @email_address,\n \"password\" => @password,\n \"password_confirmation\" => @confirm_password,\n \"time_zone\" => @time_zone,\n \"receive_campaign_emails\" => \"true\",\n \"country\" => @country,\n \"preferred_language\" => @language\n }\n }\n\n response = authenticated_request(:put, \"api/client/users/#{id}\", payload: payload)\n response[:status]\n end", "def update_users_password(args = {}) \n put(\"/users.json/backoffice/#{args[:userId]}/password/#{args[:password]}\", args)\nend", "def update_users_password(args = {}) \n put(\"/users.json/backoffice/#{args[:userId]}/password/#{args[:password]}\", args)\nend", "def email_changed?\n being_invited? ? false : super\n end", "def email_update\n participant = Participant.first\n participant.email_update_token = Participant.new_token\n ParticipantMailer.email_update(participant)\n end", "def update\n respond_to do |format|\n if @user_email.update(user_email_params)\n format.html { redirect_to @user_email, notice: 'User email was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_email }\n else\n format.html { render :edit }\n format.json { render json: @user_email.errors, status: :unprocessable_entity }\n end\n end\n end", "def change_user_status(email, type)\n endpoint = '/api/v1/user/change-status/'\n base_params = base_params(endpoint)\n custom_params = {\n 'email' => email,\n 'type' => type\n }\n uri = post_api_uri(endpoint)\n http = setup_request(uri)\n result = http.post(uri.path, base_params.merge(custom_params).to_query)\n JSON.parse(result.body)\n end", "def block_user(user_id)\n post(\"/users/#{user_id}/block\")\n end", "def update!(**args)\n @email = args[:email] if args.key?(:email)\n @id = args[:id] if args.key?(:id)\n @kind = args[:kind] if args.key?(:kind)\n end", "def update\n @email_user = Email::User.find(params[:id])\n\n respond_to do |format|\n if @email_user.update_attributes(params[:email_user])\n format.html { redirect_to(@email_user, :notice => 'User was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @email_user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n set_email\n @email.update(email_params)\n redirect_to user_emails_path(current_user.id)\n end", "def update\n @email.update(valid_params)\n json_response(@email)\n end", "def block!\n self.update_attribute(:status, BLOCKED)\n end", "def update\n puts \"current user\"\n puts @user.id\n puts current_user.id\n if current_user.admin || @user.id == current_user.id\n if user_params['is_disabled']\n @user.tokens = nil\n end\n if @user.update(user_params)\n render json: @user\n else\n puts @user.errors.full_messages\n render json: @user.errors, status: :unprocessable_entity\n end\n else\n render json: @user.errors, status: :bad_request\n end\n end", "def update_user\n end", "def user_blocked\n @company = Company.find(params[:company_id])\n end", "def block_users\n request('/block/users', {body: {}})\n end", "def update!(**args)\n @enable_failure_email = args[:enable_failure_email] if args.key?(:enable_failure_email)\n end", "def block\n current_user.block_user(@user.id)\n render json: {ok: 1}\n end", "def change_user_email(uid, old_email, new_email)\n\n # Update login - need to look it up then edit it by id\n request = Net::HTTP::Get.new(\n \"/api/v1/users/#{uid}/logins?\" \\\n \"access_token=#{Rails.application.secrets.canvas_access_token}\"\n )\n response = open_canvas_http.request(request)\n\n logins = JSON.parse response.body\n\n login_id = nil\n\n logins.each do |login|\n if login['unique_id'] == old_email\n login_id = login['id']\n break\n end\n end\n\n # Update primary communication channel (which is the email too)\n # Canvas doesn't have an edit function, so we'll make a new one, then\n # search for and delete any with the old one\n request = Net::HTTP::Post.new(\n \"/api/v1/users/#{uid}/communication_channels\"\n )\n data = {\n 'communication_channel[address]' => new_email,\n 'communication_channel[type]' => 'email',\n 'access_token' => Rails.application.secrets.canvas_access_token,\n 'communication_channel[skip_confirmation]' => true\n }\n request.set_form_data(data)\n response = open_canvas_http.request(request)\n\n # We might not have found the old email in the event\n # of it already being changed on Canvas; this isn't an\n # error condition, we should still try to update the CC\n # even if the login doesn't already match.\n if login_id\n request = Net::HTTP::Put.new(\n \"/api/v1/accounts/1/logins/#{login_id}\"\n )\n data = {\n 'login[unique_id]' => new_email,\n 'access_token' => Rails.application.secrets.canvas_access_token\n }\n request.set_form_data(data)\n response = open_canvas_http.request(request)\n end\n\n request = Net::HTTP::Delete.new(\n \"/api/v1/users/#{uid}/communication_channels/email/#{old_email}?access_token=#{Rails.application.secrets.canvas_access_token}\"\n )\n response = open_canvas_http.request(request)\n\n end", "def update!(**args)\n @email = args[:email] if args.key?(:email)\n @user = args[:user] if args.key?(:user)\n @user_gaia_id = args[:user_gaia_id] if args.key?(:user_gaia_id)\n @user_id = args[:user_id] if args.key?(:user_id)\n end", "def update!(**args)\n @email = args[:email] if args.key?(:email)\n @user = args[:user] if args.key?(:user)\n @user_gaia_id = args[:user_gaia_id] if args.key?(:user_gaia_id)\n @user_id = args[:user_id] if args.key?(:user_id)\n end", "def update\n @users = User.find(params[:id])\n if params[:approved]\n if current_user && current_user.is_admin?\n if @users.update(user_params)\n # Tell the UserMailer to send a welcome email after approval\n UserMailer.user_approved(@users).deliver_later\n render json: { status: 200, msg: 'User details have been updated.' }\n end\n else\n render json: { error: 'You are not authorized to modify this data'} , status: 401\n end\n else\n if @users.update(user_params)\n render json: { status: 200, msg: 'User details have been updated.' }\n end\n end\n end", "def update!(**args)\n @add_attendee_emails = args[:add_attendee_emails] if args.key?(:add_attendee_emails)\n end", "def inactive_post(email)\n end", "def update!(**args)\n @audience = args[:audience] if args.key?(:audience)\n @email = args[:email] if args.key?(:email)\n @expires_in = args[:expires_in] if args.key?(:expires_in)\n @issued_to = args[:issued_to] if args.key?(:issued_to)\n @scope = args[:scope] if args.key?(:scope)\n @user_id = args[:user_id] if args.key?(:user_id)\n @verified_email = args[:verified_email] if args.key?(:verified_email)\n end", "def update\n ActiveRecord::Base.transaction do\n @invitee = @invitation.invitee\n accepted_invitees = @meeting.invitations.count { |invitation| invitation.response == \"Accepted\"}\n if @invitee==current_user && @meeting.max_size>= accepted_invitees\n if @invitation.update_attributes(invitation_update_params)\n return json_response(@invitation, :updated)\n end\n end\n end\n head :no_content\n end", "def modify_user(user)\n query_api_object Model::User, '/rest/user', user.to_hash, 'PUT'\n end", "def add_email\n if params[:user] && params[:user][:email]\n current_user.email = params[:user][:email]\n current_user.skip_reconfirmation! # don't forget this if using Devise confirmable\n respond_to do |format|\n if current_user.save\n # TODO: i18n this notice\n format.html { redirect_to current_user, notice: 'Your email address was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { }\n format.json { render json: current_user.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def update_email_verification(user_id:, email_verification:)\n path = '/users/{userId}/verification'\n .gsub('{userId}', user_id)\n\n if user_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"userId\"')\n end\n\n if email_verification.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"emailVerification\"')\n end\n\n params = {\n emailVerification: email_verification,\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'PATCH',\n path: path,\n headers: headers,\n params: params,\n response_type: Models::User\n )\n end", "def update\n authorize! :update, @ml_external_email\n respond_to do |format|\n if @ml_external_email.update(ml_external_email_params)\n format.html { redirect_to @ml_external_email, notice: 'External email was successfully updated.' }\n format.json { render :show, status: :ok, location: @ml_external_email }\n else\n format.html { render :edit }\n format.json { render json: @ml_external_email.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_email_update_error_on_empty_email\n # Setup\n @user = setup_user\n\n # Step 1\n get_user_info(@user.oauth_token)\n assert_response(@response, :success)\n assert_equal(@user.email, @parsed_response['email'])\n\n # Step 2\n params = {\n 'new_email' => '',\n 'old_email' => @user.email\n }\n\n headers = { 'Authorization' => \"Bearer #{@user.oauth_token}\" }\n\n put '/update_email', params, headers\n assert_response(@response, :client_error)\n assert_equal('InvalidParamsError', @parsed_response['error'])\n assert_equal('Email address must not be blank', @parsed_response['message'])\n\n # Step 3\n new_email = Common.generate_email\n\n params = {\n 'new_email' => new_email,\n 'old_email' => @user.email\n }\n\n headers = { 'Authorization' => \"Bearer #{@user.oauth_token}\" }\n\n put '/update_email', params, headers\n assert_response(@response, :success)\n assert_equal(new_email, @parsed_response['email'])\n end", "def update\n self.resource = resource_class.to_adapter.get!(send(:\"current_#{resource_name}\").to_key)\n prev_unconfirmed_email = resource.unconfirmed_email if resource.respond_to?(:unconfirmed_email)\n resource.gustos_ids = if not params[:gustos_ids].nil? then params[:gustos_ids] else [] end\n resource_updated = update_resource(resource, account_update_params)\n yield resource if block_given?\n if resource_updated\n set_flash_message_for_update(resource, prev_unconfirmed_email)\n bypass_sign_in resource, scope: resource_name if sign_in_after_change_password?\n\n respond_with resource, location: after_update_path_for(resource)\n else\n clean_up_passwords resource\n set_minimum_password_length\n respond_with resource\n end\n end", "def update\n\n authorize! :manage, @user\n \n respond_to do |format|\n\n if (current_user.id == @user.id) \n # Don't let a non-administrator assign themselves admin/download/viewing priviledges.\n # (Also) Don't let the current user disable their own admin account!\n params[:user].delete \"is_administrator\"\n if ! current_user.is_administrator\n params[:user].delete \"is_data_downloader\"\n params[:user].delete \"is_data_viewer\"\n end\n end \n \n\n if @user.update(user_params)\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n # format.json { render :show, status: :ok, location: @user }\n format.json { respond_with_bip(@user) }\n else\n format.html { render :edit }\n # format.json { render json: @user.errors, status: :unprocessable_entity }\n format.json { respond_with_bip(@user) }\n end\n end\n end", "def update\n # this action is not provided for partyroles\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n\n @event.invitees_email.split(',').each do | user_email |\n user = User.find_by(email: user_email)\n \n unless @event.invitees.include?(user) || @event.attendees.include?(user)\n @event.invitees << user\n end\n end\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @instance = Resident.find(params[:id])\n assign_attributes\n @instance.user.email = email_param\n show_unless_errors\n end", "def email_confirm\n token = user_params_for_email_confirm[:email_confirm_token]\n\n render status: :forbidden and return if token.nil? or @user.email_confirm_token != token\n\n if @user.update(email_confirm_token: nil)\n render json: @user\n else\n render json: @user, status: :unprocessable_entity, adapter: :json_api, serializer: ActiveModel::Serializer::ErrorSerializer\n end\n end", "def update\n @person.authorizer = current_person\n\n respond_to do |format|\n if @person.update(person_params)\n @person.invite!(current_person) if params['resend_invite']=='true' \n \n format.html { redirect_to :people, notice: 'Profile successfully updated.' }\n format.json { render :show, status: :ok, location: @person }\n else\n format.html { render :edit }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit_user(edited_user)\n user = User.find(edited_user.email)\n user.attributes = edited_user.attributes\n user.save!\n end", "def update\n @family = Family.find(params[:id])\n @user = User.find_by_email(session[:user_email])\n if @user && @user.identity == 2\n\t@family.approved_by = nil\n end\n respond_to do |format|\n if @family.update_attributes(params[:family])\n format.html { redirect_to session[:redirect_path], notice: 'Family was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @family.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_visibility\n respond_to do |wants|\n wants.json {\n user = ::User.find_for_authentication(:email => params['email'])\n \n if !user.nil? && user.valid_password?(params['password']) && user.admin?\n json, status = change_visibility_from_params\n render json: json.to_json, status: status\n else\n render json: { error: 'unauthorized' }.to_json, status: :unauthorized\n end\n }\n end\n end", "def updateUser\n options = {\n :body => params.to_json,\n :headers => {\n 'Content-Type' => 'application/json',\n 'Authorization' => request.headers['Authorization']\n }\n }\n results = HTTParty.put(\"http://192.168.99.101:4051/users/\"+@current_user[\"id\"].to_s, options)\n render json: results.parsed_response, status: results.code\n end", "def update\n @email = Email.find(params[:id])\n if @email.read === true\n @email.update(read: false)\n else \n @email.update(read: true)\n end\n \n end", "def authorize\n render json: { status: 200, msg: 'You are not allowed to do this update' } unless current_user && current_user.can_modify_user?(params[:id])\n end", "def patch_user(user_id, body)\n raise Auth0::MissingUserId, 'Must supply a valid user_id' if user_id.to_s.empty?\n raise Auth0::InvalidParameter, 'Must supply a valid body' if body.to_s.empty? || body.empty?\n path = \"#{users_path}/#{user_id}\"\n patch(path, body)\n end", "def update\n\n if param_user[:email_work] != user.login\n param_user[:login] = param_user[:email_work]\n end\n @selected_profiles = param_user[:profile_ids]\n\n respond_to do |format|\n if user.update_attributes(param_user)\n @message = \"#{@user.full_name} has been modified.\"\n\t Resque.enqueue(Finforenet::Jobs::CheckPublicProfiles, @user.id) if @user.is_public\n if !request.xhr?\n format.html { redirect_to users_path({:page=>params[:page]}), :notice => @message }\n else\n format.html { render :action => \"edit\", :layout=> !request.xhr?}\n end\n else\n format.html { render :action => \"edit\", :layout=> !request.xhr? }\n end\n end\n end", "def update!\n @authorize = nil\n update_plan! &&\n resp = put(\"/users/#{username}.xml\", {\n :user_key => apikey,\n \"user[first_name]\" => first_name,\n \"user[last_name]\" => last_name\n })\n end", "def blocked\n @user = User.find(params[:id])\n @user.block!\n redirect_to dashboard_listing_path\n end", "def update!(**args)\n @email = args[:email] if args.key?(:email)\n @third_party_provider_id = args[:third_party_provider_id] if args.key?(:third_party_provider_id)\n end", "def update\n @users = User.all\n respond_to do |format|\n if @event.update(event_params.except(:invites))\n\n event_params.slice(:invites).values.each do |x|\n x.each do |y|\n if y.empty?\n else\n user = @users.find(y.to_i)\n @event.attendees << user\n end\n end\n end\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6622866", "0.6622866", "0.65533775", "0.64161617", "0.63643134", "0.6277218", "0.62446797", "0.6206689", "0.6178919", "0.61589766", "0.61373353", "0.6131785", "0.612585", "0.61239576", "0.60875547", "0.6078666", "0.6078666", "0.6078666", "0.6078666", "0.6078666", "0.6078666", "0.6078666", "0.6078666", "0.6078666", "0.60760957", "0.60552675", "0.60544413", "0.6031668", "0.60267043", "0.600992", "0.5972178", "0.5969716", "0.5962609", "0.5941846", "0.59182", "0.5917392", "0.5917188", "0.5908963", "0.59084386", "0.58997077", "0.58934796", "0.5888374", "0.5886156", "0.58779895", "0.5868542", "0.58667696", "0.58667696", "0.58647066", "0.5861058", "0.5852448", "0.5847075", "0.5847075", "0.58346665", "0.5811785", "0.5807401", "0.5804681", "0.58017164", "0.5801603", "0.5796813", "0.5793121", "0.57817465", "0.5781012", "0.5780571", "0.57741565", "0.5759738", "0.57522446", "0.57483655", "0.5736373", "0.5731373", "0.5723579", "0.5723579", "0.571313", "0.5711705", "0.57111865", "0.5709184", "0.5706888", "0.57033825", "0.56990486", "0.5697325", "0.56942356", "0.5691083", "0.5676456", "0.5675289", "0.56635886", "0.5662751", "0.56592166", "0.56569237", "0.5652496", "0.565128", "0.5644256", "0.5640584", "0.5635213", "0.56291544", "0.5629083", "0.5627539", "0.56256217", "0.56240153", "0.56207323", "0.5616188", "0.56118613" ]
0.617453
9
6. As a user, I need an API to retrieve all email addresses that can receive updates from an email address. POST
def receive_update @text = params[:text] user = User.find_by_email params[:sender] if user friendship = Friendship.where user_id: user # get the recipient recipients = [] friendship.each do |f| recipients << f.friend.email end mention = @text.scan(/\w+@\w+.\w+/i) recipients << mention.join(', ') # get the block user excludes = [] subscribes = Subscribe.where user: user, block: true subscribes.each do |f| excludes << f.target.email end recipients = recipients.reject { |i| excludes.include?(i) } render json: { success: true, recipients: recipients } else render json: { success: false, message: "Sender email not found" } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def emails\n respond_with_entity(api.get('/api/v1/profile/emails'),\n NexaasID::Entities::Profile::Emails)\n end", "def emails(params={})\n @api.get(\"#{@api.path}/User/Emails\", params: params)\n end", "def emails(params = {})\n @api.get(\"#{@api.path}/List/#{@id}/Emails\", params: params)\n end", "def can_receive_updates\n @user = User.where(email: params[:email])\n params[:message]\n if @user.present?\n render json: @user.unblocked_subscribers.page(params[:page]).per(params[:per_page]).distinct\n else\n render json: {message: 'User Not Found'}, status: 404\n end\n end", "def email_list\n end", "def complete_email_list\n #Email.select(:email).map{|email_record| email_record.email}\n User.all.map(&:email)\n end", "def index\n @user_emails = UserEmail.all\n end", "def email_addresses\n begin\n @email_addresses ||= xmlrpc_client.call(\"list_emails\", session_id)\n rescue Timeout::Error => e\n raise \"Error during connection. Please try again later.\" \n end\n end", "def for_email(email)\n Iterable.request(conf, \"/users/#{email}\").get\n end", "def fetch_users_info(emails)\n endpoint = \"/api/#{@version}/user/info/\"\n custom_params = {\n 'emails' => emails.join(',')\n }\n make_get_request(endpoint, custom_params)\n end", "def emails\n return [] unless email_access_allowed?\n access_token.options[:mode] = :header\n @emails ||= access_token.get('user/emails', :headers => { 'Accept' => 'application/vnd.github.v3' }).parsed\n end", "def index\n @request_emails = RequestEmail.all\n end", "def index\n @emails = @user.emails\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @emails }\n end\n end", "def index\n @emails = @user.emails\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @emails }\n end\n end", "def send_mail_to_attendees_on_update\n if self.category.eql?(\"appointment\")\n if self.changed.include?(\"start_date\") or self.changed.include?(\"attendees_emails\") or self.changed.include?(\"repeat\") or self.changed.include?(\"count\") or self.changed.include?(\"until\")\n user = self.matter_people.assignee\n if self.attendees_emails\n att_arr = self.attendees_emails.split(\",\")\n for i in att_arr\n send_update_notificaton_to_attendees(user, self, i)\n end\n end\n\n true\n end\n end\n end", "def emails(user_id = nil)\n url = user_id.to_i.zero? ? '/user/emails' : \"/users/#{user_id}/emails\"\n get(url)\n end", "def api_get\n handler.get({email: email}, path)\n end", "def getEmails(searchCriteria = Hash.new)\n if searchCriteria.is_a? String\n search = searchCriteria\n searchCriteria = Hash.new\n searchCriteria['search'] = search\n end\n searchCriteria['key'] = @API_KEY\n searchCriteria['mailbox'] = @MAILBOX\n for i in 1..10\n response = RestClient.get(\"#{@BASE_URI}/emails\", {:params => searchCriteria})\n data = JSON.parse(response.body)\n emails = data.map { |em| Email.new(em) }\n\n if !emails.nil? && emails.length>0\n return emails\n end\n # back off and retry\n sleep(i*i)\n end\n end", "def build_user_emails_for_edit\n @edit[:user_emails] = {}\n to_email = @edit[:new][:email][:to] || []\n users_in_current_groups = User.with_groups(User.current_user.miq_groups).distinct.sort_by { |u| u.name.downcase }\n users_in_current_groups.each do |u|\n next if u.email.blank?\n next if to_email.include?(u.email)\n\n @edit[:user_emails][u.email] = \"#{u.name} (#{u.email})\"\n end\n end", "def email_addresses\n emails.map(&:address)\n end", "def online_emails(params = {})\n @api.get(\"#{@api.path}/List/#{@id}/Online/Emails\", params: params)\n end", "def index\n @emails = JSON[access_token.get(\"/api/v1/emails\").body]\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @emails }\n end\n end", "def sendemailtoattendees\n \t@users = ConferenceUser.where(:conference_id => Conference.active)\n \t@sub = params[:emailbody]\n\n @array = []\n\n @users.each do |u|\n @getname = @sub.sub(\"@@Name@@\", \"#{u.user[:first_name]} #{u.user[:last_name]}\" )\n @array << @getname\n end\n\n render :text => @array.to_json\n\n\n\n end", "def getEmailList\n\t\tdata = index()\n\t\temailList = []\n\t\tdata.each do |person|\n\t\t\temailList.push(\"#{person[\"email_address\"]}\")\n\t\tend\n\t\treturn emailList\n\tend", "def create\n @email_update = EmailUpdate.new(params[:email_update])\n\n respond_to do |format|\n if @email_update.save\n @emailList = Email.pluck(:email)\n @emailList.each do |recipient|\n UserMailer.info_email(@email_update.subject, @email_update.message, recipient).deliver \n end\n format.html { redirect_to @email_update, notice: 'Email update was successfully created.' }\n format.json { render json: @email_update, status: :created, location: @email_update }\n else\n format.html { render action: \"new\" }\n format.json { render json: @email_update.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @emails = current_user.emails\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @emails }\n end\n end", "def fGetSubscribedEventsFrom(email)\n @users.getSubscribedEventsFrom(email)\n end", "def fNotificationListFrom (email)\n @users.notificationListFrom(email)\n end", "def all_emails\n User.pluck(:email)\n end", "def list_by_email(email)\n params = Hash.new\n params[:email] = email\n self.list(params)\n end", "def get_email_list(email)\n mail_list_array = []\n response = get_emails(email)\n if !response.blank?\n json_body = JSON.parse(response.body)\n if !json_body[\"items\"].blank?\n Rails.logger.info \"Total Emails: #{json_body[\"items\"].count}\"\n json_body[\"items\"].each do |item|\n Rails.logger.info \"Subject: #{item['message']['headers']['subject']}\"\n Rails.logger.info \"Storage Url: #{item['storage']['url']}\"\n mail_list_array.push(item['storage']['url'])\n end\n end\n end\n mail_list_array\n end", "def extract_user_emails(user_fields, client)\n user_emails = []\n user_fields.each_index do |row|\n user_emails.push(user_fields[row][0])\n end\n user_emails\nend", "def list_email()\nsession = GoogleDrive::Session.from_config(\"config.json\")\nws = session.spreadsheet_by_key(\"1v7XEnpGDtgjgRom3bp7OwzaK99zlUQIfKuW3QdawXBc\").worksheets[0]\n#define a lopp with each for the spreadsheet.\n(1..w_sheet.num_rows).each do |list|\n\t\tmail = ws[list, 2]\n\t\tcity = ws[list, 1]\n list_email(\"email\",\"password\",mail, city)\n end\nend", "def refresh_mailing_list\n emails = MassEmail.all.map{|m|m.email_address}\n File.open(File.join(Rails.root, 'config', 'mailing_list.txt')).each_line do |e|\n e = e.chomp\n unless emails.include?(e)\n url_code = new_random_url_code\n m = MassEmail.new(email_address: e, url_code: url_code)\n m.save!\n end\n end\n\n emails = MassEmail.all.map{|m|m.email_address}\n User.all.map{|u| u.email}.each do |e| \n unless emails.include?(e)\n url_code = new_random_url_code\n m = MassEmail.new(email_address: e, url_code: url_code)\n m.save!\n end\n end\nend", "def refresh_mailing_list\n emails = MassEmail.all.map{|m|m.email_address}\n File.open(File.join(Rails.root, 'config', 'mailing_list.txt')).each_line do |e|\n e = e.chomp\n unless emails.include?(e)\n url_code = new_random_url_code\n m = MassEmail.new(email_address: e, url_code: url_code)\n m.save!\n end\n end\n\n emails = MassEmail.all.map{|m|m.email_address}\n User.all.map{|u| u.email}.each do |e| \n unless emails.include?(e)\n url_code = new_random_url_code\n m = MassEmail.new(email_address: e, url_code: url_code)\n m.save!\n end\n end\nend", "def index\n @emails = @claim.emails.page(params[:page]).per(50)\n end", "def all_without_email\n\n end", "def mail_unread\n initialize_mocks if @fake\n\n service = Google::Apis::Core::BaseService.new('https://mail.google.com/', 'mail/feed/atom/')\n service.authorization = user_authorization\n service.http(:get, 'https://mail.google.com/mail/feed/atom/')\n end", "def list\n perform_request(Entities::MarketingEmail, 'newsletter/list.json')\n end", "def index\n @email_accounts = current_user.email_accounts.all\n end", "def emails\n Array(@emails)\n end", "def get_emails_by_search_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: EmailsApi#get_emails_by_search ...\"\n end\n \n # resource path\n local_var_path = \"/Emails/Search\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'email_from'] = opts[:'email_from'] if opts[:'email_from']\n query_params[:'email_to'] = opts[:'email_to'] if opts[:'email_to']\n query_params[:'tag'] = opts[:'tag'] if opts[:'tag']\n query_params[:'updated_after_utc'] = opts[:'updated_after_utc'] if opts[:'updated_after_utc']\n query_params[:'brief'] = opts[:'brief'] if opts[:'brief']\n query_params[:'skip'] = opts[:'skip'] if opts[:'skip']\n query_params[:'top'] = opts[:'top'] if opts[:'top']\n query_params[:'count_total'] = opts[:'count_total'] if opts[:'count_total']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<InlineResponse2009>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: EmailsApi#get_emails_by_search\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def user_email_list\n @email_list = []\n\n EmailList.all.each do |email|\n if email.creator_id == current_user.id\n @email_list << email \n end\n end\n @email_list\n end", "def get_attendees()\n\t\turl = request.referrer.split(\"/\")\t# Get the URL of where the request CAME from, not the url that was requested.\n redis_key = url[-1].to_s + \":\" + url[-2].to_s + \":emails\";\n\t\tattendees = $redis.lrange(redis_key,0,-1)\n\t\tattendees.uniq!\n\t\tlogger.error \"@@@@@@@@@@@@ ATTENDEES: \" + attendees.to_s\n\t\treturn attendees\n\tend", "def email(id)\n get(\"/user/emails/#{id}\")\n end", "def email_invitees(event, apptmnt)\n apptmnt.invitees.each do |invitee|\n user = User.find(invitee.user_id)\n payload = {:user => user, :appointment => apptmnt}\n Outboundmail.outbound_event(event, user, payload)\n end\n end", "def index\n verify_email = VerifyEmail.all\n json_response(verify_email)\n end", "def index\n @person_email_addresses = PersonEmailAddress.all\n end", "def unsubscribe_from_all(id_or_email)\n make_json_api_request :post, \"v2/#{account_id}/subscribers/#{CGI.escape id_or_email}/unsubscribe_all\"\n end", "def getResultRecepientEmailList()\n return @resultRecepients\n end", "def get_email_records(email)\n query = {\n 'email' => email\n }\n\n response = HTTParty.get(\n ENV.fetch('PATRON_MICROSERVICE_URL_V01', nil),\n query: query,\n headers:\n {\n 'Authorization' => \"Bearer #{Oauth.get_oauth_token}\",\n 'Content-Type' => 'application/json'\n }\n )\n response = JSON.parse(response.body)\n case response['statusCode']\n when 404\n LogWrapper.log('DEBUG', {\n 'message' => \"No records found with the e-mail #{email} in Sierra database\",\n 'status' => response['statusCode'],\n 'user' => { email: email }\n })\n when 409\n LogWrapper.log('DEBUG', {\n 'message' => \"The following e-mail #{email} has more then 1 record in the Sierra database with the same e-mail\",\n 'status' => response['statusCode'],\n 'user' => { email: email }\n })\n when 200\n LogWrapper.log('DEBUG', {\n 'message' => \"The following e-mail #{email} has 1 other record in the Sierra database with the same e-mail\",\n 'status' => response['statusCode'],\n 'user' => { email: email }\n })\n response = {statusCode: 200, message: 'This e-mail address already exists!'}\n else\n LogWrapper.log('ERROR', {\n 'message' => \"#{response}\",\n 'status' => response['statusCode'],\n 'user' => { email: email }\n })\n end\n return response\n end", "def email_ids\n []\n end", "def context_customer_emails(context)\n context = JSON.parse(context)\n customer_emails = context['context']['environment']['customer']['emailAddresses']\n customer_emails = customer_emails.map {|x| x[\"value\"]}\nend", "def search_user_by_email\n @users = User.get_all_users(current_user).where(email:params[:email], is_active: true).first\n get_tenants_user(@users)\n end", "def get_emails(search_criteria = {})\n if search_criteria.is_a? String\n search_criteria = {'search' => search_criteria}\n end\n search_criteria['key'] = @api_key\n search_criteria['mailbox'] = @mailbox\n response = send_get_emails_request(search_criteria)\n if response.length > 2\n data = JSON.parse(response.body)\n data.map { |em| Email.new(em) }\n else\n message.no_emails_found(search_criteria)\n end\n end", "def index\n @emails = EventEmail.scoped\n\n if params.keys.include? \"company_id\"\n @emails = @emails.where(:company_id => params[:company_id])\n end\n\n if params.keys.include? \"limit\"\n @emails = @emails.limit(params[:limit])\n end\n\n respond_with @emails\n end", "def get_emails(limit = 100, offset = 0, conditions = {})\n params = extract_query_params conditions\n\n params['limit'] = limit\n params['offset'] = offset\n\n request :get, \"/v3/emails.json\", params\n end", "def update_list\n\t\tif emails_changed? and from_contacts\n\t\t\temails_was_arr = emails_was.split(\",\")\n\t\t\temails_arr = emails.split(\",\")\n\t\t\tdeleted_emails = emails_was_arr.diff emails_arr\n\t\t\tadded_emails = emails_arr.diff - emails_was_arr\n\t\t\t\n\t\t\tdeleted_emails.each do |email|\n\t\t\t\tnewsletter.email_service(delete_member_from_list(email))\n\t\t\tend\n\n\t\t\tadded_emails.each do |email|\n\t\t\t\tnewsletter.email_service(add_member_to_list(email))\n\t\t\tend\n\t\tend\n\tend", "def index\n email_id = Email.find_by_email(current_user.email).id\n @reminds = Remind.where(:email => email_id)\n end", "def get_email_list\n return get_townhall_list_and_url.map{|town, url| {town => get_townhall_email(url)}}\n end", "def by_email address, options={}, headers={}\n params = options.merge({ email: address })\n @connection.get \"users/by_email.json\", params, headers\n end", "def index\n @usuarios_emails = UsuariosEmail.all\n end", "def updated(ticket, currentUser)\n\t@ticket = ticket\n\t@emails = Array.new\n\n @ticket.users.each do |email|\n if !(email.seKey == currentUser)\n @emails.push(email.seKey + \"@semo.edu\")\n end\n end\n\n mail :to => @emails, :subject => ticket.responses.last.user.fName + \" \" + ticket.responses.last.user.lName + \" responded to ticket \" + \"#%06d\" % ticket.id\n end", "def check_email_change\n if changed.include?('email')\n answers.destroy_all\n # Every time the email address changes, generate a new access_key\n generate_access_key\n self.email_sent_at = nil\n self.status = 'created'\n end\n end", "def index\n @emails = DirectEmail.scoped\n\n if params.keys.include? \"company_id\"\n @emails = @emails.where(:company_id => params[:company_id])\n end\n\n if params.keys.include? \"limit\"\n @emails = @emails.limit(params[:limit])\n end\n\n respond_with @emails\n end", "def search_for_user_email(username) # :yields: JSON\n begin\n if @@app_token == nil\n raise \"Authentication not provided\"\n end\n uri=URI.parse(@uri_builder.get_user_contents(Api_options::USER::EMAIL,username:username, app_token:@@app_token))\n @uri_builder=nil\n\n HttpHandler.create_http uri\n\n response=HttpHandler.get_response(@@http,uri)\n @response_status=true\n return response\n\n end\n\n\n\n\n\n end", "def set_email_updates\n get_email = FollowerFollowing.where('follower_id=? and following_id=?', @login_user.id, params[:id]).first\n get_email.update_attributes(:get_email_updates => !get_email.get_email_updates)\n redirect_to \"/users/profile/#{params[:id]}\"\n end", "def getEmailsByRecipient(recipientEmail)\n searchCriteria = Hash.new\n searchCriteria['recipient']= recipientEmail\n return getEmails(searchCriteria)\n end", "def update\n @users = User.all\n respond_to do |format|\n if @event.update(event_params.except(:invites))\n\n event_params.slice(:invites).values.each do |x|\n x.each do |y|\n if y.empty?\n else\n user = @users.find(y.to_i)\n @event.attendees << user\n end\n end\n end\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def importing_update( email_list )\n @failed_registrations = FailedRegistration.all \n # email_list.each do | email | \n mail( :to => email_list, \n :subject => \"potoSchool | Tarumanegara Failed Registration #{Time.now}\" )\n # end\n end", "def fetch(email, revoke = true)\n get_token\n\n uri = URI.parse \"http://www.google.com/m8/feeds/contacts/#{email}/full\"\n\n loop do\n res = request uri\n\n xml = Nokogiri::XML res.body\n\n parse xml\n\n next_uri = xml.xpath('//xmlns:feed/xmlns:link[@rel=\"next\"]').first\n break unless next_uri\n\n uri += next_uri['href']\n end\n\n yield if block_given?\n ensure\n revoke_token if revoke and token?\n end", "def curator_list\n users.map(&:email)\n end", "def search_by_email(email)\n # Build and send request\n response = connection.get do |req|\n req.url \"#{CS_BASE_URL}/#{@resource}/?email=#{email}\"\n end\n render_error_msg(response.body) unless response.status.eql?(200)\n\n JSONConverter.to_hash(response.body)\n end", "def send_emails\n self.attendees.distinct.each do |attendee|\n UpdatesMailer.updates_mail(attendee, self).deliver_now\n end\n end", "def rebuild_accessibilities( emails=nil )\r\n emails ||= self.contact_people.collect{ |contact| contact.email }\r\n emails << self.email\r\n StoreUser.transaction do\r\n StoreUser.update_all( \"erp_account_number = NULL\", [\"erp_account_number = ?\", self.account_num] )\r\n StoreUser.update_all(\r\n \"erp_account_number = '#{self.account_num}'\",\r\n ['email_address in (?)', emails]\r\n ) unless emails.empty?\r\n end\r\n end", "def get_for_email(email)\n full_path = full_resource_path(\"/email\")\n query_params = MaropostApi.set_query_params({\"contact[email]\" => email})\n \n MaropostApi.get_result(full_path, query_params)\n end", "def list\n user = User.find_by_email params[:email]\n if user\n friendship = Friendship.where user: user\n render json: {success: true, friends: friendship.map {|f| f.friend.email}, count: friendship.count}\n else\n render json: {message: \"email not found\"}\n end\n end", "def update!(**args)\n @user_emails = args[:user_emails] if args.key?(:user_emails)\n end", "def email_params\n params.require(:email).permit(:user_id, :subject, :content, :list_ids => [])\n end", "def search_by_email(email)\n begin\n JSON.parse(RestClient.get construct_url(\"user/search/by_email/#{email}\"))\n rescue RestClient::BadRequest => e \n @last_error = e.http_body\n @last_error_code = e.http_code\n false\n end\n end", "def get_approver_emails\n provider_targets = if Rails.env.production?\n %w[SCIOPS]\n elsif Rails.env.development? || Rails.env.test?\n %w[MMT_2]\n elsif Rails.env.sit? || Rails.env.uat?\n %w[SCIOPS SCIOPSTEST]\n end\n\n approvers_urs_users = []\n\n provider_targets.each do |provider_target|\n # Find the ACL for correct provider in this env.\n find_acl_response = cmr_client.get_permissions({ 'provider' => provider_target, 'target' => 'NON_NASA_DRAFT_APPROVER', 'include_full_acl' => true }, token)\n Rails.logger.debug(\"ACL query response while trying to send approvers emails on proposal submission for #{provider_target}: #{find_acl_response.body}\")\n next unless find_acl_response.success? && find_acl_response.body['items'].count == 1\n\n approver_groups_list = find_acl_response.body['items'][0]['acl']['group_permissions'].map { |group| group['group_id'] if group['permissions'].include?('create') }.compact\n next if approver_groups_list.empty?\n\n # For each group that has this acl, collect the users to send to URS\n approver_groups_list.each do |group|\n group_member_response = cmr_client.get_edl_group_members(group)\n next unless group_member_response.success?\n\n approvers_urs_users += group_member_response.body\n end\n end\n return [] if approvers_urs_users.empty?\n\n # Get e-mails from URS using user names\n approver_urs_users = retrieve_urs_users(approvers_urs_users.uniq)\n approver_emails = []\n approver_urs_users.each do |approver|\n approver_emails.push(name: \"#{approver['first_name']} #{approver['last_name']}\", email: approver['email_address'])\n end\n approver_emails\n end", "def index\n @emails = Email.all\n json_response(@emails)\n end", "def retrieve_all_email\n\n \t\tif params[:sender].blank?\n \t\t\tlogger.info(\"[FriendUserController]retrieve_all_email == params is error ,params ==#{params[:friends]}\")\n \t\t\treturn render :json => {:success => false}\n \t\tend\n\n \t\tsend_email = params[:sender]\n\n \t\tblock_mails = BlockUser.where(:email=>send_email).map(&:block_email)\n\n \t\tlogger.info(\"[FriendUserController]retrieve_all_email == block_mails ==#{block_mails}\")\n\n \t\tfriend_emails = get_friend_email(send_email)\n\n \t\tlogger.info(\"[FriendUserController]retrieve_all_email == friend_emails ==#{friend_emails}\")\n\n \t\tsubscribe_mails = SubscribeUser.where(:subscribe_email=>send_email).map(&:email)\n\n \t\tlogger.info(\"[FriendUserController]retrieve_all_email == subscribe_mails ==#{subscribe_mails}\")\n\n \t\tretrieve_mails = friend_emails + subscribe_mails - block_mails\n\n \t\tlogger.info(\"[FriendUserController]retrieve_all_email == retrieve_mails ==#{retrieve_mails}\")\n\n \t\treturn render :json => {:success => true,:recipients=>retrieve_mails}\n \tend", "def whitelist_email\n service_response = UserManagement::Whitelist::Email.new(params).perform\n render_api_response(service_response)\n end", "def filter_by_email\n Entry.joins(:user)\n .where('users.email = :email', email: email)\n .paginate(page: page_number)\n .order(checkin_at: :desc)\n end", "def email\n # redirect to the first page of the website\n redirect_to login_path\n\n # Get all users who subscribe\n users = User.where(subscribe: true)\n\n # Get mandril object\n mandrill = Mandrill::API.new 'SyKEz-QytC97dIODlvKQoQ'\n\n # Send a digest to each user\n users.each do |user|\n # Set the elementary content string\n content = \"Here is the list of interesting articles for you\\n\\n\"\n\n # Get all the interesting articles and order by date_time\n articles = Article.tagged_with(user.interest_list, any: true).order(date_time: :desc)\n\n # Get at most 10 new interesting articles\n num = 0\n articles.each do |article|\n # If 10 interesting articles are already extracted, break the loop\n break if num >= MAX_NUM_ARTICLES\n\n # If this article has not been sent to this user, include this to digest\n unless user.articles.include?(article)\n user.articles << article\n # Update content string\n content += make_paragraph(article.title, article.link)\n num += 1\n end\n end\n\n # If there is no interesting article\n if num == 0\n content = \"There is no any new interesting articles for you this time.\\n\"\n end\n\n # create a message to send\n message = {\n subject: 'Hello, ' + user.first_name + '. This is the digest you required',\n from_name: 'The Digest',\n text: content,\n to: [\n {\n email: user.email,\n name: user.first_name + ' ' + user.last_name\n }\n ],\n from_email: 'thedigest@thedigest.com'\n }\n\n # send the email\n mandrill.messages.send message\n end\n end", "def update!(**args)\n @add_attendee_emails = args[:add_attendee_emails] if args.key?(:add_attendee_emails)\n end", "def index\n @api_v1_enterprise_email_variables = Api::V1::EnterpriseEmailVariable.all\n end", "def index\n @emails = Email.all\n end", "def index\n @emails = Email.all\n end", "def index\n @emails = Email.all\n end", "def index\n @emails = Email.all\n end", "def index\n @emails = Email.all\n end", "def index\n @emails = Email.all\n end", "def email_list(event_id, exclude_owner = false)\n list = Array.new\n @event = Event.includes(:users).find(event_id)\n\n @event.users.where(:notification_emails => true).each do |user|\n list.push(user.email)\n end\n\n if(exclude_owner)\n list.delete(@event.owner.email)\n end\n\n return list\n end", "def send_update_email(artifact)\n @artifact = artifact\n list = []\n @artifact.project.users.each do |apu|\n list << apu.email\n end\n mail( :to => list,\n :subject => 'There is an update in your user area.' )\n end", "def index\n @emails = Email.scoped\n\n if params.keys.include? \"company_id\"\n @emails = @emails.where(:company_id => params[:company_id])\n end\n\n if params.keys.include? \"limit\"\n @emails = @emails.limit(params[:limit])\n end\n\n respond_with @emails\n end", "def email_status\n texts = []\n\n begin\n author = Mail::Address.new(params[:author].gsub(\"\\n\",''))\n recipients = Mail::AddressList.new(params[:recipients].gsub(\"\\n\",'')).addresses\n emails = [author, recipients].flatten.find_all { |addr| addr.domain && (addr.domain != 'mountainofpromos.com') }\n rescue Mail::Field::ParseError\n emails = []\n texts << \"Address Parse Error\"\n end\n\n subject = params[:subject]\n uri = nil\n\n emails.find do |addr|\n @supplier = Supplier.find(:first, :conditions => [\"lower(po_email) ~ ?\", addr.domain.downcase], :order => 'parent_id DESC')\n end\n if @supplier or emails.empty?\n texts << @supplier.name if @supplier\n if /(Q\\d{4})/i === subject and\n po = PurchaseOrder.find_by_quickbooks_ref($1)\n @order = po.purchase.order\n @supplier = po.purchase.supplier\n texts << \"Order #{@order.id}\"\n uri = { :controller => '/admin/orders', :action => :items, :id => @order }\n end\n end\n \n unless @supplier\n if /\\(#(\\d{4,5})\\)/ === subject and\n @order = Order.find_by_id($1)\n texts << \"ORDER DOESN'T MATCH CUSTOMER EMAIL\" unless emails.empty? or emails.find { |a| @order.customer.email_addresses.to_a.find { |b| b.address.downcase.include?(a.address.downcase) } }\n texts << (@order.user_id ? @order.user.name : \"UNASSIGNED\")\n texts << \"Order #{@order.id}\"\n uri = { :controller => '/admin/orders', :action => :items, :id => @order, :own => true } if @order.user_id.nil?\n else\n customers = emails.collect do |addr|\n Customer.find(:all, :include => :email_addresses, :conditions => [\"lower(email_addresses.address) ~ ?\", addr.address.downcase], :order => 'customers.id DESC')\n end.flatten\n\n unless customers.empty?\n texts << \"MULTIPLE CUSTOMERS\" if customers.length > 1\n orders = customers.collect do |customer|\n ret = customer.orders.find(:all, :conditions => { :closed => false }, :order => 'id')\n ret.empty? ? customer.orders : ret\n end.flatten\n orders.collect { |o| o.user }.uniq.each do |user|\n texts << (user ? user.name : \"UNASSIGNED\")\n end\n @order = orders.last\n else\n if !emails.empty? && recipients.find { |r| r.address == MAIN_EMAIL }\n texts << \"NEW CUSTOMER\"\n /M(\\d{4,5})/ === subject\n uri = { :controller => '/admin/orders', :action => :create_email, :email => author.address || '', :name => author.name, :subject => subject}\n else\n texts << \"UNKNOWN\"\n end\n end\n end\n end\n \n\n if @order\n texts << @order.customer.company_name unless @order.customer.company_name.blank?\n texts << @order.customer.person_name\n uri = { :controller => '/orders', :action => :status, :id => @order } unless uri\n end\n\n render :json => { :text => texts.join(' - '), :uri => uri && url_for(uri.merge({ :protocol => (Rails.env.production? ? 'https://' : 'http://') })) }\n end", "def list\n @ses.request('ListVerifiedEmailAddresses')\n end", "def get_emails_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: EmailsApi#get_emails ...\"\n end\n \n # resource path\n local_var_path = \"/Emails\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'brief'] = opts[:'brief'] if opts[:'brief']\n query_params[:'skip'] = opts[:'skip'] if opts[:'skip']\n query_params[:'top'] = opts[:'top'] if opts[:'top']\n query_params[:'count_total'] = opts[:'count_total'] if opts[:'count_total']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<InlineResponse2009>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: EmailsApi#get_emails\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end" ]
[ "0.6973286", "0.66707826", "0.64309734", "0.64139336", "0.6410701", "0.63569266", "0.6247899", "0.62467486", "0.6236308", "0.6225408", "0.61925274", "0.6137301", "0.6130819", "0.6130819", "0.6082476", "0.6063424", "0.6050747", "0.60409164", "0.6040702", "0.60211736", "0.60204566", "0.5998346", "0.5994938", "0.59889334", "0.5986028", "0.5945823", "0.5942194", "0.5940388", "0.59399194", "0.5938069", "0.59290636", "0.59179795", "0.5912653", "0.591215", "0.591215", "0.59109056", "0.5910729", "0.59071845", "0.5905296", "0.5898781", "0.5897679", "0.58966815", "0.58876085", "0.58846915", "0.58779633", "0.5862883", "0.58559936", "0.5845711", "0.5845638", "0.58375376", "0.58349866", "0.5821943", "0.58201957", "0.5816608", "0.5797667", "0.5786018", "0.578214", "0.5781865", "0.57774997", "0.5755545", "0.5750517", "0.5748732", "0.5746983", "0.57469326", "0.573956", "0.5734824", "0.57179654", "0.56995374", "0.5688479", "0.56868345", "0.56821525", "0.56791294", "0.5677532", "0.56773525", "0.5671703", "0.56692576", "0.5667056", "0.5665458", "0.5662479", "0.565868", "0.56577665", "0.5656958", "0.56566757", "0.56555474", "0.564606", "0.56404525", "0.56374127", "0.5636061", "0.5629583", "0.5629583", "0.5629583", "0.5629583", "0.5629583", "0.5629583", "0.56278247", "0.561643", "0.5610383", "0.56079406", "0.5606691", "0.56041825" ]
0.5792296
55
Convert block_size and quantity to a humanreadable disk size.
def blocks_to_bytes(block_size, qty) size = ( block_size / 1024 ) * qty if size < 1000 output = "#{size} KB" elsif size < 1000000 output = "#{size / 1000} MB" elsif size < 1000000000 output = "#{size / 1000000} GB" else output = "#{size / 1000000000} TB" end return output end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_size(block_size,blocks)\n size = block_size * blocks\n if size > SIZE_GB\n return [(size / SIZE_GB).to_i,\"GB\"]\n else\n return [(size / SIZE_MB).to_i,\"MB\"]\n end\n end", "def size\n ['o', 'k', 'G'].inject(super.to_f) do |s, unit|\n # recusively divide by 1024 until...\n if s.is_a?(Float) && s >= 1024\n s = s / 1024\n # we format it here with the unit\n elsif !s.is_a?(String)\n s = \"#{s.to_s.gsub(/(\\.\\d{3})\\d+$/, \"\\\\1\")} #{unit}\"\n end\n s\n end\n end", "def fetch_disk_size\n total_size = 0\n total_size = `lsblk -b --output SIZE -d -n | paste -s -d + - | bc`\n number_to_human_size total_size\n end", "def human_size size_bytes\n size = size_bytes\n type = \"B\"\n\n %w{KB MB GB}.each do |t|\n if size > 1024\n size = size/1024\n type = t\n else\n break\n end\n end\n\n \"#{size}#{type}\"\nend", "def human_size\n count = 0\n n = size\n while n >= 1024 and count < 4\n n /= 1024.0\n count += 1\n end\n format(\"%.1f\",n) + %w(B kB MB GB TB)[count]\n end", "def size_from_bytes(qty, unit)\n qty = qty.to_i\n case unit.downcase\n when \"b\", \"bytes\"\n qty.to_s\n when \"kb\", \"kilobytes\"\n (qty / 1000).to_s\n when \"kib\", \"kibibytes\"\n (qty / 1024).to_s\n when \"mb\", \"megabytes\"\n (qty / 1000000).to_s\n when \"m\", \"mib\", \"mebibytes\"\n (qty / 1048576).to_s\n when \"gb\", \"gigabytes\"\n (qty / 1000000000).to_s\n when \"g\", \"gib\", \"gibibytes\"\n (qty / 1073741824).to_s\n else\n raise ArgumentError, \"Unknown unit #{unit}\"\n end\n end", "def to_human_size(options = {})\n number = Float(self)\n\n storage_units_format = \"%n %u\"\n\n if number.to_i < 1024\n unit = UNIT_NAMES[:byte][:other]\n storage_units_format.gsub(/%n/, number.to_i.to_s).gsub(/%u/, unit)\n else\n max_exp = STORAGE_UNITS.size - 1\n exponent = (Math.log(number) / Math.log(1024)).to_i # Convert to base 1024\n exponent = max_exp if exponent > max_exp # we need this to avoid overflow for the highest unit\n number /= 1024 ** exponent\n\n unit_key = STORAGE_UNITS[exponent]\n unit = UNIT_NAMES[unit_key.to_sym]\n\n formatted_number = \"%.02f\" % number\n storage_units_format.gsub(/%n/, formatted_number).gsub(/%u/, unit)\n end\n end", "def formatted_size\n Helpers.rcompact(@formats)\n sz = size\n fs = @formats.size\n fs > sz ? fs : sz\n end", "def readable_file_size size, precision\n if size < KILO_SIZE then format('%d B', size)\n elsif size < MEGA_SIZE then format(\"%.#{precision}f K\", (size / KILO_SIZE))\n elsif size < GIGA_SIZE then format(\"%.#{precision}f M\", (size / MEGA_SIZE))\n else format(\"%.#{precision}f G\", (size / GIGA_SIZE))\n end\nend", "def block_size\n @disk.block_size\n end", "def size_to_s\n case\n when size == 0 then 'Empty'\n when size >= PETABYTE then size_to_f( PETABYTE ) + 'P'\n when size >= TERABYTE then size_to_f( TERABYTE ) + 'T'\n when size >= GIGABYTE then size_to_f( GIGABYTE ) + 'G'\n when size >= MEGABYTE then size_to_f( MEGABYTE ) + 'M'\n when size >= KILOBYTE then size_to_f( KILOBYTE ) + 'K'\n else size + 'B'\n end\n end", "def human_size\n number_to_human_size size\n end", "def format_space(partition, size)\n size.gsub!('.00 ', ' ')\n size.gsub!(' GiB', 'G')\n\n if (DEFAULTS.key?(partition) && DEFAULTS[partition] == size)\n return nil\n end\n size\nend", "def readable_file_size(size, precision)\n case\n #when size == 1 : \"1 B\"\n when size < KILO_SIZE then \"%d B\" % size\n when size < MEGA_SIZE then \"%.#{precision}f K\" % (size / KILO_SIZE)\n when size < GIGA_SIZE then \"%.#{precision}f M\" % (size / MEGA_SIZE)\n else \"%.#{precision}f G\" % (size / GIGA_SIZE)\n end\nend", "def readable_file_size(size, precision)\n case\n #when size == 1 : \"1 B\"\n when size < KILO_SIZE then \"%d B\" % size\n when size < MEGA_SIZE then \"%.#{precision}f K\" % (size / KILO_SIZE)\n when size < GIGA_SIZE then \"%.#{precision}f M\" % (size / MEGA_SIZE)\n else \"%.#{precision}f G\" % (size / GIGA_SIZE)\n end\nend", "def d_size\n @diskObj.info[:capacity]\n end", "def human_filesize(value)\n {\n 'B' => 1024,\n 'KB' => 1024 * 1024,\n 'MB' => 1024 * 1024 * 1024,\n 'GB' => 1024 * 1024 * 1024 * 1024,\n 'TB' => 1024 * 1024 * 1024 * 1024 * 1024\n }.each_pair { |e, s| return \"#{(value.to_f / (s / 1024)).round(1)} #{e}\" if value.to_i < s }\n end", "def readable_file_size(size, precision)\n case\n #when size == 1 : \"1 B\"\n when size < KILO_SIZE then \"%d B\" % size\n when size < MEGA_SIZE then \"%.#{precision}f K\" % (size / KILO_SIZE)\n when size < GIGA_SIZE then \"%.#{precision}f M\" % (size / MEGA_SIZE)\n else \"%.#{precision}f G\" % (size / GIGA_SIZE)\n end\n end", "def nice_size size\n number_to_human_size size, :precision => 0\n end", "def readable_file_size(size, precision)\n case\n #when size == 1 then \"1 B\"\n when size < KILO_SIZE then \"%d B\" % size\n when size < MEGA_SIZE then \"%.#{precision}f K\" % (size / KILO_SIZE)\n when size < GIGA_SIZE then \"%.#{precision}f M\" % (size / MEGA_SIZE)\n else \"%.#{precision}f G\" % (size / GIGA_SIZE)\n end\n end", "def volume_size\n # If not user-specified, I'm using a fudge factor of 1.5 on the volume size -- arbitrarily chosen\n @volume_size || (`du -x #{volume_to_bundle}`.split(/\\n/)[-1].split[0].to_f * 1.5 / 1024).ceil\n end", "def converted_file_size(size:)\n return { size: nil, unit: 'mb' } unless size.present? && size.is_a?(Numeric) && size.positive?\n return { size: size / 1.petabytes, unit: 'pb' } if size >= 1.petabytes\n return { size: size / 1.terabytes, unit: 'tb' } if size >= 1.terabytes\n return { size: size / 1.gigabytes, unit: 'gb' } if size >= 1.gigabytes\n return { size: size / 1.megabytes, unit: 'mb' } if size >= 1.megabytes\n\n { size: size, unit: '' }\n end", "def display_size\n s = self.body.size\n\n if s > 1024 * 1024\n return sprintf(\"%.1f\", s.to_f / 1024 / 1024) + 'M'\n else\n return (s / 1024).to_s + 'K'\n end\n end", "def total_file_size_human_readable\n total = self.total_file_size\n ActiveSupport::NumberHelper::NumberToHumanSizeConverter.convert( total, precision: 3 )\n end", "def size_to_f( multiplier = KILOBYTE )\n '%.2f' % ( size.to_f / multiplier )\n end", "def readable_file_size(size, precision)\n case\n when size == 1 : \"1 Byte\"\n when size < KILO_SIZE : \"%d B \" % size\n when size < MEGA_SIZE : \"%.#{precision}f KB\" % (size / KILO_SIZE)\n when size < GIGA_SIZE : \"%.#{precision}f MB\" % (size / MEGA_SIZE)\n else \"%.#{precision}f GB\" % (size / GIGA_SIZE)\n end\n end", "def size_in_bytes(qty, unit, mib=false)\n qty = qty.to_i\n unit = unit.downcase\n if !mib\n case unit\n when \"kb\", \"kilobytes\"\n unit = \"kib\"\n when \"mb\", \"megabytes\"\n unit = \"mib\"\n when \"gb\", \"gigabytes\"\n unit = \"gib\"\n end\n end\n case unit\n when \"b\", \"bytes\"\n qty.to_s\n when \"kb\", \"kilobytes\"\n (qty * 1000).to_s\n when \"kib\", \"kibibytes\"\n (qty * 1024).to_s\n when \"mb\", \"megabytes\"\n (qty * 1000000).to_s\n when \"m\", \"mib\", \"mebibytes\"\n (qty * 1048576).to_s\n when \"gb\", \"gigabytes\"\n (qty * 1000000000).to_s\n when \"g\", \"gib\", \"gibibytes\"\n (qty * 1073741824).to_s\n else\n raise ArgumentError, \"Unknown unit #{unit}\"\n end\n end", "def size\n size = File.size(@path).to_i\n case\n when size.to_i == 1; \"1 byte\"\n when size < 1024; \"%d bytes\" % size\n when size < (1024*1024); \"%.2f kilobytes\" % (size / 1024.0)\n else \"%.2f megabytes\" % (size / (1024 * 1024.0))\n end.sub(/([0-9])\\.?0+ /, '\\1 ' )\n end", "def format_size(bytes)\n sprintf \"%0.1fG\", bytes.to_f / 10**9\nend", "def size_in_bytes(qty, unit, mib = false)\n qty = qty.to_i\n unit = unit.downcase\n unless mib\n case unit\n when 'kb', 'kilobytes'\n unit = 'kib'\n when 'mb', 'megabytes'\n unit = 'mib'\n when 'gb', 'gigabytes'\n unit = 'gib'\n end\n end\n case unit\n when 'b', 'bytes'\n qty\n when 'kb', 'kilobytes'\n (qty * 1000)\n when 'kib', 'kibibytes'\n (qty * 1024)\n when 'mb', 'megabytes'\n (qty * 1_000_000)\n when 'm', 'mib', 'mebibytes'\n (qty * 1_048_576)\n when 'gb', 'gigabytes'\n (qty * 1_000_000_000)\n when 'g', 'gib', 'gibibytes'\n (qty * 1_073_741_824)\n else\n fail ArgumentError, \"Unknown unit #{unit}\"\n end\n end", "def nice_capacity\n\t\tif capacity.blank?\n\t\t\t\"Unknown Size\"\n\t\telsif capacity < 1000\n\t\t\t\"#{capacity}GB\"\n\t\telse\n\t\t\t\"#{capacity / 1000.0}TB\"\n\t\tend\n\tend", "def size_in_bytes(qty, unit, mib=false)\n qty = qty.to_i\n unit = unit.downcase\n if !mib\n case unit\n when \"kb\", \"kilobytes\"\n unit = \"kib\"\n when \"mb\", \"megabytes\"\n unit = \"mib\"\n when \"gb\", \"gigabytes\"\n unit = \"gib\"\n end\n end\n case unit\n when \"b\", \"bytes\"\n qty\n when \"kb\", \"kilobytes\"\n (qty * 1000)\n when \"kib\", \"kibibytes\"\n (qty * 1024)\n when \"mb\", \"megabytes\"\n (qty * 1000000)\n when \"m\", \"mib\", \"mebibytes\"\n (qty * 1048576)\n when \"gb\", \"gigabytes\"\n (qty * 1000000000)\n when \"g\", \"gib\", \"gibibytes\"\n (qty * 1073741824)\n else\n raise ArgumentError, \"Unknown unit #{unit}\"\n end\n end", "def readable_file_size(size, precision)\n\t\tcase\n\t\t\twhen size < KILO_SIZE\n\t\t\t\t\"%d B\" % size\n\t\t\twhen size < MEGA_SIZE\n\t\t\t\t\"%.#{precision}f Kb\" % (size / KILO_SIZE)\n\t\t\twhen size < GIGA_SIZE\n\t\t\t\t\"%.#{precision}f Mb\" % (size / MEGA_SIZE)\n\t\t\telse \"%.#{precision}f Gb\" % (size / GIGA_SIZE)\n\t\tend\n\tend", "def disk_usage_mb \n return disk_usage \n end", "def readable_file_size(size, precision = 1)\n case\n when size == 1 : \"1 Byte\"\n when size < KILO_SIZE : \"%d Bytes\" % size\n when size < MEGA_SIZE : \"%.#{precision}f KB\" % (size / KILO_SIZE)\n when size < GIGA_SIZE : \"%.#{precision}f MB\" % (size / MEGA_SIZE)\n else \"%.#{precision}f GB\" % (size / GIGA_SIZE)\n end\n end", "def size_in_bytes\n to_i description['SizeInBytes']\n end", "def to_bytes\n value = self.to_i\n if value == 0\n raise Exception::new(\"Invalid size specification: \" << self << \".\")\n end\n \n exponent = nil\n case self[-1]\n when ?M\n exponent = 2\n when ?G\n exponent = 3\n when ?K\n exponent = 1\n when ?0, ?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9\n exponent = 0\n else\n raise Exception::new(\"Invalid unit in size specification: \" << self << \".\")\n end\n \n return value * (1024 ** exponent)\n end", "def as_size2( s = nil )\n prefix = %W(ТиБ ГиБ МиБ КиБ Б)\n s = (s || self).to_f\n i = prefix.length - 1\n while s > 512 && i > 0\n s /= 1024\n i -= 1\n end\n ((s > 9 || s.modulo(1) < 0.1 ? '%d' : '%.1f') % s) + ' ' + prefix[i]\n end", "def number_to_human_size(number)\n base = 1024\n\n if number.to_i < base\n \"#{number} bytes\"\n else\n number = number.to_f\n max_exp = STORAGE_UNITS.size - 1\n exponent = (Math.log(number) / Math.log(base)).to_i # Convert to base\n exponent = max_exp if exponent > max_exp # we need this to avoid overflow for the highest unit\n number /= base ** exponent\n\n unit_key = STORAGE_UNITS[exponent]\n\n \"#{number.round(2)} #{unit_key.to_s}\"\n end\n\n end", "def volume_size(vol_path)\n # default values\n vol_vsize = {:size => 10, :unit => 'G'}\n vsize_regex = %r{virtual size:\\s+(?<size>\\d+(\\.\\d+))?(?<unit>.)\\s+\\((?<bytesize>\\d+)\\sbytes\\)}\n diskinfo = %x[qemu-img info #{vol_path}]\n diskinfo.each_line do |line|\n result = line.match(vsize_regex)\n if result\n # always take the size in bytes to avoid conversion\n vol_vsize = {:size => result[:bytesize], :unit => \"B\"}\n break\n end\n end\n return vol_vsize\n end", "def to_filesize(size)\n # size = '0' if size.nil?\n size = size.to_s\n\n units = {\n 'B' => 1.0 / (1024 * 1024),\n 'K' => 1.0 / 1024,\n 'M' => 1,\n 'G' => 1024,\n 'T' => 1024 * 1024\n }\n\n unit = size[-1]\n unit = 'B' unless units.key?(unit)\n\n \"#{size[0..-1].to_f * units[unit]}M\"\n end", "def file_size\n number_to_human_size(super)\n end", "def size_mb \n return size / 1048576 # (1024 * 1024) \n end", "def selectable_size_units\n [%w[MB mb], %w[GB gb], %w[TB tb], %w[PB pb], ['bytes', '']]\n end", "def hdd_values_string\n hdd_string = \"#{self.local_disk_size} GB\" if self.local_disk_size\n hdd_string ||= \"\"\n hdd_string.insert(0, \"#{self.local_disk_count} x \") if self.local_disk_count\n hdd_string << \"HDD\" if !self.local_disk_size && self.local_disk_count\n hdd_string\n end", "def input_to_bytes(size)\n case size\n when /g|gb/i\n size.to_i.gb.to_bytes.to_i\n when /m|mb/i\n size.to_i.mb.to_bytes.to_i\n when /t|tb/i\n size.to_i.tb.to_bytes.to_i\n else\n size.to_i.gb.to_bytes.to_i\n end\n end", "def interpret_size(size)\n case size\n when /k$/i then size.to_i * 1024\n when /m$/i then size.to_i * 1024 * 1024\n when /g$/i then size.to_i * 1024 * 1024 * 1024\n else size.to_i\n end\n end", "def list_size_swap_partitions # nelsongs\n\treturn `fdisk -l | grep /dev | grep -v Disk | awk '{if ($2==\"*\" && $6==\"82\") print $5;else {if ($5==\"82\") print $4}}' | sed s/+//g`.chomp\nend", "def pretty_memsize(memsize, unit=nil)\n un = nil\n case unit\n when nil\n un = 1\n when \"k\"\n un = 1_000\n when \"m\"\n un = 1_000_000\n when \"g\"\n un = 1_000_000_000\n else\n raise \"Error! Invalid unit '#{unit}'\"\n end\n\n res = memsize.to_i * un\n len = res.to_s.size \n\n if len < 4 \n return res.to_s + \" B\"\n elsif len < 7\n return (res/1_000).to_i.to_s + \" kB\"\n elsif len < 10\n return (res/1_000_000).to_i.to_s + \" MB\"\n elsif len < 13\n return (res/1_000_000_000).to_i.to_s + \" GB\"\n elsif len < 16\n return (res/1_000_000_000_000).to_i.to_s + \" TB\"\n elsif len < 19\n return (res/1_000_000_000_000_000).to_i.to_s + \" PB\"\n elsif len < 22\n return (res/1_000_000_000_000_000_000).to_i.to_s + \" EB\"\n else\n return (res/1_000_000_000_000_000_000_000).to_i.to_s + \" ZB\"\n end\nend", "def bytes(value)\n if value.is_a?(String)\n value =~ /([\\d\\.]+)\\s*(\\w*)/i\n size = $1.to_f\n unit = $2.strip.upcase if $2\n power = case unit\n when \"B\", \"\" then 0\n when \"K\", \"KB\" then 1\n when \"M\", \"MB\" then 2\n when \"G\", \"GB\" then 3\n when \"T\", \"TB\" then 4\n else raise UnitError\n end\n factor = 1024**power\n (size*factor).round\n elsif value.is_a?(Float)\n value.round\n elsif value.is_a?(Integer)\n value\n else\n raise ArgumentError\n end\n end", "def human_readable_file_size(num, type='file')\n string = ''\n factor = 1024\n suffixes = ['KB', 'MB', 'GB', 'TB']\n if type == 'base10'\n factor = 1000\n suffixes = ['', 'K', 'M', 'B']\n end\n\n if num < factor\n string = \"#{num}#{suffixes[0]}\"\n elsif num < factor**2\n string = \"#{((num) / factor).round(1)}#{suffixes[1]}\"\n elsif num < factor**3\n string = \"#{((num) / (factor*factor)).round(1)}#{suffixes[2]}\"\n else\n string = \"#{((num) / (factor*factor*factor)).round(1)}#{suffixes[3]}\"\n end\n\n return string\nend", "def format_size(sz)\n if (emptyval?(sz))\n EMPTYVAL\n else\n case\n when sz < KB then \"#{sz}B\"\n when sz >= KB && sz < MB then \"#{sz/KB}KB\"\n when sz >= MB && sz < GB then \"#{sz/MB}MB\"\n when sz >= GB && sz < TB then \"#{sz/GB}GB\"\n when sz >= TB && sz < PB then \"#{sz/TB}TB\"\n else\n XXL_SIZE\n end\n end\n end", "def get_file_size_in_mb\n mb = ::ApplicationController.helpers.number_to_human_size(self.file_size, precision: 2) \n return mb\n end", "def interpret_size(size)\n case size\n when /k$/i then size.to_i * 1024\n when /m$/i then size.to_i * 1024 * 1024\n when /g$/i then size.to_i * 1024 * 1024 * 1024\n else size.to_i\n end\n end", "def d_size\n @capacity / @blockSize\n end", "def block_size()\n # KB MB\n 4 * 1024 * 1024\n end", "def file_size_string(fs)\n # n cuts off all decimal places after the second\n n = lambda{|f| f.to_s[/.*\\..{0,2}/] } \n if fs < 1024\n \"#{n.call(fs)} Bytes\"\n elsif fs <= 1024**2\n \"#{n.call(fs/1024.0)} KBytes\"\n elsif fs <= 1024**3\n \"#{n.call(fs/1024.0**2)} MBytes\"\n elsif fs <= 1024**4\n \"#{n.call(fs/1024.0**3)} GBytes\"\n end\n end", "def to_mb\n self / 1048576\n end", "def size_d(floc)\n \"#{gene_d(floc)}/#{@win_size}\"\n\n end", "def sfdisk_get_size(dev_name)\n out = %x{sfdisk #{dev_name} -s}\n Chef::Log.info(\"updating geo using sfdisk: #{out}\")\n\n # sfdisk sees the world as 1k blocks\n @current.blocks(out.to_i)\nend", "def disk_current_size\n\t\treturn 1024\n\tend", "def as_byte_size(bytes)\n bytes = bytes.to_f\n i = BYTE_RANGE.length - 1\n while bytes > 512 && i > 0\n i -= 1\n bytes /= 1024\n end\n ((bytes > 9 || bytes.modulo(1) < 0.1 ? '%d' : '%.1f') % bytes) + ' ' + BYTE_RANGE[i]\n end", "def size\n size = popen(%W(du -s), full_path).first.strip.to_i\n (size.to_f / 1024).round(2)\n end", "def human_filesize(filename)\n size = File.size(filename)\n case\n when size < 2**10 then '%d bytes' % size\n when size < 2**20 then '%.1fK' % (1.0 * size / 2**10)\n when size < 2**30 then '%.1fM' % (1.0 * size / 2**20)\n else '%.1fG' % (1.0 * size / 2**30)\n end\nend", "def filesize_format\n FILESIZE_FORMAT.each do |format, size|\n return format % (self.to_f / size) if self >= size\n end\n\n self.to_s\n end", "def to_s\n format(\"%16d bytes %-10s %-60s\", size.to_i, id, name)\n end", "def display_size(size)\n size = number_to_human_size(size.to_i + 1) if size.is_a?(Numeric) || size =~ /^[0-9]+$/ # assumes bytes\n size.to_s\n end", "def convert_to_bytes(size, unit)\n size.to_f * UNITS_FACTOR[unit]\n end", "def number_to_human_size(bytes, options = {})\n NumberToHumanSize.convert(bytes, options)\n end", "def block_sizes\n unless defined?(@block_sizes) then\n @block_sizes = split_comma(@data[18]).collect { |x| x.to_i }\n end\n @block_sizes\n end", "def human_size(*args); end", "def determine_disk\n df_cmd = \"df 2>/dev/null|awk '$1 ~ /\\\\// {I=I+$3} END {print I}'\"\n disk = @shell.query('DISK_DF', df_cmd)\n\n # Result is expected to be in KiB. Convert to GB.\n @info[:disk] = disk.to_f / 1000 ** 2\n end", "def human_bytes(bytes)\n s = ['bytes', 'kb', 'MB', 'GB', 'TB', 'PB'];\n #indicates if thousands, millions ...\n place = (Math.log(bytes)/Math.log(1024)).floor\n (bytes/(1024 ** place.floor)).to_s+\" \"+s[place];\n end", "def convert_bytes_to_unit(data:, unit:)\n case unit\n when 'kb' then @usage = data.to_i / 1024\n when 'mb' then @usage = data.to_i / 1024 / 1024\n when 'gb' then @usage = data.to_i / 1024 / 1024 / 1024\n end\n end", "def display_size\n # (1.9 ** @magnitude) / 3.0 + 2.5\n (2.15 ** @magnitude) / 3.6 + 2.5\n end", "def as_size children: true\n WSFile.human_size(optimal_size)\n end", "def input_to_bytes(size)\n case size\n when /m|mb/i\n size.to_i * (1024**2)\n when /t|tb/i\n size.to_i * (1024**4)\n else\n # default is gigabytes\n size.to_i * (1024**3)\n end\n end", "def show_quantity(options = {})\n quantity_packed.to_s + 'boxes + ' + quantity_unpacked.to_s + 'pcs available'\n end", "def block_size\n check_valid\n md.block_size\n end", "def convertsize(str)\n\t\t\t\tif(str.kind_of?(Numeric))\n\t\t\t\t\treturn(str)\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tstr.strip!()\n\t\t\t\tregex = /^([0-9]+(?:\\.[0-9]+)?)\\s*([gmk])b?$/i\n\t\t\t\tmatch = regex.match(str)\n\t\t\t\tif(match == nil)\n\t\t\t\t\traise(ArgumentError, \"Unable to parse size of \\\"#{str}\\\"\")\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tsize = match[1].to_f()\n\t\t\t\t\n\t\t\t\tcase(match[2].downcase())\n\t\t\t\twhen('g')\n\t\t\t\t\tsize = size * 1024 * 1024 * 1024\n\t\t\t\twhen('m')\n\t\t\t\t\tsize = size * 1024 * 1024\n\t\t\t\twhen('k')\n\t\t\t\t\tsize = size * 1024\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\treturn(size)\n\t\t\tend", "def format_size(obj) #:nodoc:\n \"#{f(obj.size)} items\"\n end", "def total_disk_size\n if @partition_layout.find { |p| !p.size_mb.is_a?(Integer) }\n raise RuntimeError, \"Some partition sizes unspecified, cannot infer \"\\\n \"total size of all partitions\"\n end\n\n @partition_layout.inject(0) { |memo, elem| memo + elem.size_mb } \\\n + FIRST_PARTITION_OFFSET \\\n + 1\n end", "def list_size_nix_partitions # nelsongs\n\treturn `fdisk -l | grep /dev | grep -v Disk | awk '{if ($2==\"*\" && $6==\"83\") print $5;else {if ($5==\"83\") print $4}}' | sed s/+//g`.chomp.split\nend", "def calculate_disks\n slave_nodes_disk_size = @parsed_hash[:slave_nodes_storage_capacity] || 0\n if @provider == 'aws'\n volume_count = if slave_nodes_disk_size.nil? or slave_nodes_disk_size.to_i == 0\n # assume user do not want any extra volumes\n 0\n else\n # user wants extra volumes\n 4\n end\n volume_size = if slave_nodes_disk_size.nil? or slave_nodes_disk_size.to_i == 0\n 0\n else\n slave_nodes_disk_size / volume_count\n end\n return volume_count, volume_size\n elsif @provider == 'rackspace'\n volume_count = if slave_nodes_disk_size.nil? or slave_nodes_disk_size.to_i == 0\n 0\n elsif slave_nodes_disk_size.to_i > 400\n 4\n else\n slave_nodes_disk_size.to_i / 100\n end\n volume_size = if slave_nodes_disk_size.nil? or slave_nodes_disk_size.to_i == 0\n 0\n elsif slave_nodes_disk_size.to_i > 400\n slave_nodes_disk_size / volume_count\n else\n 100\n end\n return volume_count, volume_size\n end\n end", "def product_size(product)\n size_attributes = %w[size coats jacket denim knits leather overcoats ties t_shirts scarves shirts]\n size = ''\n\n size_attributes.each do |attr|\n size += product.attribute_value(attr).to_s\n end\n\n return size\n end", "def blksize() end", "def minimum_disk_size\n @partition_layout.inject(0) { |memo, elem|\n if elem.size_mb.is_a?(Integer)\n memo + elem.size_mb\n else\n memo + 1 # open ended partitions need to be at least 4MiB (arbitrary)\n end\n } \\\n + FIRST_PARTITION_OFFSET \\\n + 1\n end", "def list_swap_partitions_with_size # nelsongs\n\treturn `fdisk -l | grep /dev | grep -v Disk | awk '{if ($2==\"*\" && $6==\"82\") print $1\":\"$5;else {if ($5==\"82\") print $1\":\"$4}}' | sed s/+//g`.chomp.split\nend", "def list_nix_partitions_with_size # nelsongs \n\treturn `fdisk -l | grep /dev | grep -v Disk | awk '{if ($2==\"*\" && $6==\"83\") print $1\":\"$5;else {if ($5==\"83\") print $1\":\"$4}}' | sed s/+//g`.chomp.split\nend", "def product_sizes(product)\n return product.size.split(',').map(&:to_s)\n end", "def display(b)\n\tif b < 1000\n\t\tputs \"#{b} bytes\"\n\telsif b < 1000000\n\t\ta = b.to_f\n\t\ta = a/1000\n\t\ta = a.round(1)\n\t\tputs \"#{a} kB\"\n\telsif b < 1000000000\n\t\ta = b.to_f\n\t\ta = a/1000000\n\t\ta = a.round(1)\n\t\tputs \"#{a} MB\"\n\telsif b < 1000000000000\n\t\ta = b.to_f\n\t\ta = a/1000000000\n\t\ta = a.round(1)\n\t\tputs \"#{a} GB\"\n\telse\n\t\ta = b.to_f\n\t\ta = a/1000000000000\n\t\ta = a.round(1)\n\t\tputs \"#{a} TB\"\n\tend\nend", "def size\n @sizes ||= strip(:size)\n end", "def bytes_representation_of(megabytes)\n megabytes * 1024 * 1024\n end", "def calculate_disk_space(data)\n sum_sizes = 0\n\n data.each do |disk_name, disk|\n\n unless disk_name =~ %r{^sr}\n if disk.has_key?('size_bytes')\n sum_sizes = sum_sizes + disk['size_bytes']\n end\n end\n end\n\n sum_sizes = sum_sizes / 1024 / 1024 / 1024\n\n sum_sizes\n end", "def size_used\n info[\"size-used\"]\n end", "def bytes_from_kb kb\n\tb = (kb * 1024.0).round\nend", "def unit2raw(str)\n val, unit = str.split()\n\n if unit.casecmp(\"kb\")\n ret = val.to_i * 1024\n elsif unit.casecmp(\"mb\")\n ret = val.to_i * 1024 * 1024\n elsif unit.casecmp(\"gb\")\n ret = val.to_i * 1024 * 1024 * 1024\n end\n \n return ret.to_s\nend", "def edit_size\n\t\tif (self.type == SECT_TYPE::OUTPUT || self.type == SECT_TYPE::CODE || self.type == SECT_TYPE::NOTES)\n\t\t\treturn \"large\"\n\t\telse\n\t\t\treturn \"small\"\n\t\tend\n\tend", "def size_and_extension\n \"#{extension.sub /\\A\\./, ''}, #{human_size}\"\n end", "def size(base = self.date_from)\n\t\t\t\t\treturn self.send(\"size_#{self.capacity_type.to_s}\", base)\n\t\t\t\tend" ]
[ "0.7407986", "0.6973419", "0.6972413", "0.67802286", "0.6763028", "0.6645691", "0.66076714", "0.6480695", "0.6436258", "0.6415762", "0.6373911", "0.62670386", "0.626032", "0.62537664", "0.62537664", "0.6238297", "0.6229371", "0.6218393", "0.62069184", "0.61644036", "0.6151029", "0.6146102", "0.613143", "0.6075885", "0.60533094", "0.60457504", "0.6043786", "0.60226035", "0.60225844", "0.60196275", "0.59997725", "0.5998259", "0.59864354", "0.5975609", "0.59741366", "0.5955296", "0.5930673", "0.5909582", "0.5907696", "0.58848995", "0.5871497", "0.5868071", "0.58629996", "0.5857211", "0.5857049", "0.5852815", "0.58478284", "0.5838684", "0.5814568", "0.5791866", "0.5790402", "0.57709676", "0.5765969", "0.5754599", "0.57405543", "0.5739752", "0.57378703", "0.57266164", "0.5708287", "0.570084", "0.56754214", "0.5674145", "0.5672233", "0.5670883", "0.5659269", "0.5649743", "0.5628447", "0.56194586", "0.56095517", "0.56056607", "0.56033915", "0.56011266", "0.55875176", "0.5572373", "0.557182", "0.55661356", "0.55564415", "0.55557984", "0.55441433", "0.5537149", "0.5534379", "0.5503802", "0.54716915", "0.54707605", "0.5466831", "0.5466387", "0.54660374", "0.54590696", "0.54578584", "0.5435485", "0.543339", "0.54262495", "0.54223627", "0.54050285", "0.53902304", "0.5387842", "0.5387372", "0.53860027", "0.53815377", "0.53720176" ]
0.75626993
0
GET /hospital_categories GET /hospital_categories.json
def index @hospital_categories = HospitalCategory.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_categories\r\n categories = Taxonomy.get_categories\r\n render json: categories, root: 'categories', adapter: :json, status: :ok\r\n end", "def categories\n\t\tbegin\n\t\t\t@categories = Category.select(:id, :name)\n\t\t\trender json: @categories\n\t\trescue Exception => e\n\t\t\terror_handling_bad_request(e)\n\t\tend\n\tend", "def categories\n\t\trender :json => {:status => 1, :categories => {\"1\" => \"Apparel & Accessories\", \"2\" => \"Arts and Crafts\", \"3\" => \"Electronics\", \n\t\t\t\"4\" => \"Home Appliances\", \"5\" => \"Kids & Baby\", \"6\" => \"Movies, Music, Books & Games\", \"7\" => \"Motor Vehicles\", \n\t\t\t\"8\" => \"Office & Education\", \"9\" => \"Parties & Events\", \"10\" => \"Spaces & Venues\", \"11\" => \"Sports & Outdoors\", \"12\" => \"Tools & Gardening\", \"13\" => \"Other\"}}, :status => 200\n\t\treturn\n\tend", "def index\n @incidentcategories = Incidentcategory.all\n json_response(@incidentcategories)\n end", "def meal_categories\n # API EXAMPLE: https://www.themealdb.com/api/json/v1/1/list.php?c=list\n content = api_call('list.php?c=list')\n validate(content)\n content\n end", "def categories\n get('venues/categories').categories\n end", "def GetCategories params = {}\n\n params = params.merge(path: 'categories.json')\n APICall(params)\n\n end", "def get_department_categories\n json_response({ message: 'NOT IMPLEMENTED' })\n end", "def get_categories(project_id_or_key)\n get(\"projects/#{project_id_or_key}/categories\")\n end", "def categories(query_object)\n\t\tdata = do_get_json(CATEGORIES_ENDPOINT, query_object)\n\tend", "def index\n @hive_categories = HiveInformation.all\n end", "def set_hospital_category\n @hospital_category = HospitalCategory.find(params[:id])\n end", "def index\n categories = @vertical.catgories.order('created_at DESC');\n render json: {status: 'SUCCESS', message:'Loaded categories', data:categories},status: :ok\n end", "def get_subcategories\r\n sub_categories = Taxonomy.get_subcategories\r\n render json: sub_categories, root: 'categories', adapter: :json, status: :ok\r\n end", "def get_categories()\n\t\tzomoato_categories_url = @base_uri + \"categories\"\n\t\tresponse = HTTParty.get(zomoato_categories_url, headers: @headers)\n\t\tif response.success?\n\t\t\t@categories = response.parsed_response\n\t\telse\n\t\t\traise response.response\n\t\tend\n\t\treturn @categories\n\tend", "def get_categories(query_obj=nil)\n uri = URI.parse(@uri + \"/Categories\")\n results = get(uri,query_obj)\n end", "def get_categories\n @categories = Category.all\n end", "def categories\n response[\"categories\"].map!{|category| Foursquared::Response::Category.new(client, category)} if response[\"categories\"]\n end", "def getCategories(_, _, _)\n @db.categories\n end", "def index\n @categories = CategoryService.index\n end", "def index\n categories = Category.all\n render json:categories\n end", "def index\n @personality_categories = PersonalityCategory.all\n end", "def get_categories\n body = build_request(2935, 1501, \"ACTIVEHEADINGS\")\n response = send_to_localeze(body)\n xml_doc = respond_with_hash(Nokogiri::XML(response.to_xml).text)\n end", "def GetCategory id\n\n APICall(path: \"categories/#{id}.json\")\n\n end", "def categories\n @categories = response[\"categories\"] || []\n @categories.map!{|category| Foursquared::Response::Category.new(client, category)}\n end", "def get_categories_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CategoriesApi.get_categories ...\"\n end\n # resource path\n local_var_path = \"/categories\"\n\n # query parameters\n query_params = {}\n query_params[:'filter_search'] = opts[:'filter_search'] if !opts[:'filter_search'].nil?\n query_params[:'filter_active'] = opts[:'filter_active'] if !opts[:'filter_active'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PageResourceCategoryResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CategoriesApi#get_categories\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n\n\n @categories = Category.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @categories }\n end\n end", "def index\n @hospitalizations = Hospitalization.all\n end", "def index\n @exercise_categories = ExerciseCategory.where(\"organization_id IN (?)\", [Organization.current_organization, Organization.admin_organization])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @exercise_categories }\n end\n end", "def categories(sport_id)\n get(\"sports/en/sports/sr:sport:#{sport_id}/categories.xml\")\n end", "def get_categories_list\n args = receive_should_validate?\n get('redtube.Categories.getCategoriesList', {}, [], args[:should_validate])\n end", "def category\n client.categories.find(data[\"categoryId\"])\n end", "def get_menu_category\n require \"rest_client\"\n require \"json\"\n\n self.categories.update_all(still_present: false)\n response = RestClient.get(\"https://api.omnivore.io/0.1/locations/#{self.omnivore_id}/menu/categories\", {:content_type => :json, :'Api-Key' => Setting.first.app_api_key})\n res = JSON.parse(response)\n res[\"_embedded\"][\"categories\"].each do |category|\n cat = self.categories.where(omnivore_id: category[\"id\"]).first_or_create\n cat.name = category[\"name\"]\n cat.still_present = true\n cat.save\n end\n\n self.categories.where(still_present: false).destroy_all\n end", "def index\n @categories = @project.categories.all\n end", "def getCategoryAll()\n params = Hash.new\n return doCurl(\"get\",\"/category/all\",params)\n end", "def index\n @categories = Category.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @categories }\n end\n end", "def index\n @categories = Category.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @categories }\n end\n end", "def index\n @categories = Category.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @categories }\n end\n end", "def index\n @categories = Category.all \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @categories }\n end\n end", "def list\n categories = Meal.distinct.pluck(:category)\n meal_list = []\n categories.each { |category|\n obj = {\n groupName: category.capitalize,\n options: Meal.where(category: category).select(:id, :name)\n }\n meal_list.push(obj)\n }\n\n render json: meal_list\n end", "def get_category_list\n ret_hash = Rails.cache.fetch(\"zaim_api/category\", expired_in: 1.day) do\n json_categories = self.zaim_api.category\n tmp_ret_hash = {}\n json_categories['categories'].each do |value|\n tmp_ret_hash[value['id']] = value['name']\n end\n tmp_ret_hash\n end\n ret_hash\n end", "def get_category id\n\t\t\t\t\tFreshdesk::Api::Client.convert_to_hash( @connection.get CATEGORIES, id )\n\t\t\t\tend", "def get_category\n json_response({ message: 'NOT IMPLEMENTED' })\n end", "def getCategories\n @categories = []\n @categories << Category.new(name: \"All\", id: -1)\n @categories += Category.all\n end", "def all_categories\n end", "def categories\n []\n end", "def get_categories(add_params = nil)\n params = {\n }\n api_call('/global/categories(.:format)',:get,params,add_params)\n end", "def index\n @service_categories = ServiceCategory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @service_categories }\n end\n end", "def getcategories\n category_size = RequirementCategory.all.length\n current_offset = (params[:payload][:pagenumber] - 1)*10\n direction = params[:payload][:direction]\n\n respond_to do |format|\n format.json {\n\n \tif current_offset + direction < category_size && current_offset + direction >= 0\n offset = current_offset + direction\n \t@categories = RequirementCategory.all.offset(offset).take(10) \n \trender :json => @categories\n else\n \trender :nothing => true, :status => 200, :content_type => 'text/html'\n end\n }\n end\n\n\tend", "def index\n\t @categories = Category.all\n\n\t respond_to do |format|\n\t\tformat.html # index.html.erb\n\t\tformat.json { render json: @categories }\n\t end\n\tend", "def create\n @hospital_category = HospitalCategory.new(hospital_category_params)\n\n respond_to do |format|\n if @hospital_category.save\n format.html { redirect_to @hospital_category, notice: 'hospital_category was successfully created.' }\n format.json { render :show, status: :created, location: @hospital_category }\n else\n format.html { render :new }\n format.json { render json: @hospital_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def categories\n parsed_json['data']\n end", "def index\n @law_categories = LawCategory.all\n end", "def budget_categories_data\n # @budget.budget_items.collect { |budget_item| budget_item.category.name.to_s }.to_json\n categories = Category.for_budget.to_a\n categories << Category.find_by_name(\"Miscellaneous\")\n return categories.collect { |category| category.name.to_s }.to_json\n end", "def get_categories_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CategoriesApi.get_categories ...'\n end\n # resource path\n local_var_path = '/categories'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Array<Category>' \n\n # auth_names\n auth_names = opts[:auth_names] || ['Bearer']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CategoriesApi#get_categories\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @categories = Category.all\n @categories.each do |category|\n authorize! :read, category\n end\n render json: @categories\n end", "def index\n @cathegories = Cathegory.all\n end", "def index\n @q = scope.search(categories_name_eq: params[:category])\n @dishes = @q.result.includes(:categories).order(\"categories.position\")\n\n c = Hash.new {|x,v| x[v] = []}\n @dishes = @dishes.reduce(c) do |h, dishe|\n dishe.categories.each do |c|\n h[c.name] << dishe\n end\n h\n end.reject {|c, d| d.blank? }\n\n respond_to do |format|\n format.html\n format.json\n end\n end", "def index\n @categories = Category.all\n respond_with(@categories)\n end", "def scrape_categories_page\n categories = {}\n # On non-root pages, the xpath is:\n # \"//ul[@id='nav-categories']/li/a\"\n @agent.get(clean_url('/')) do |page|\n page.search(\"//h2[text()='Categories']/following-sibling::ul/li/a\").each do |link|\n category_url = link.attributes[\"href\"].value\n categories[link.text.gsub(/[^\\w\\s]+/,'').lstrip] = category_url\n end\n end\n\n categories\n end", "def index\n @section_categories = SectionCategory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @section_categories }\n end\n end", "def index\n @small_categories = SmallCategory.category_tree\n end", "def index\n @categories = @current_website.categories.all\n end", "def category_info\n {\n categories: self.object.appointments.map{ |appt| \n appt.category\n }\n \n }\n end", "def index\n @dish_categories = DishCategory.all\n end", "def fresh_categories\n # these are the categories that will be displayed by default\n # in the html view\n return {\n \"speakerData\" => {\"label\" => \"Character Direct Speech\", \"data\" => []},\n \"indirectData\" => {\"label\" => \"Character Indirect Diction\", \"data\" => []},\n \"traitData\" => {\"label\" => \"Trait: Character Type\", \"data\" => []}, \n \"genderData\" => {\"label\" => \"Trait: Character Sex\", \"data\" => []},\n \"maritalStateData\" => {\"label\" => \"Trait: Character Marriage Status\", \"data\" => []},\n \"socecStatusData\" => {\"label\" => \"Trait: Character Class Status\", \"data\" => []},\n \"ageData\" => {\"label\" => \"Trait: Character Age\", \"data\" => []},\n \"occupationData\" => {\"label\" => \"Trait: Character Occupation\", \"data\" => []},\n }\nend", "def categories\n category\n end", "def categories\n # @categories = Category.get_categories(@user.id)\n #@categories =Category.all.select(:id).select(:name).select(:description).select(:logo_url)\n @categories =Category.all\n user_cat= @user.categories.collect(&:id)\n categories = []\n @categories.each do |cat|\n cat_attr = cat.attributes\n user_cat.include?(cat.id) ? cat_attr.merge!('user_category' => true) : cat_attr.merge!('user_category' => false)\n categories << cat_attr\n end\n @categories = categories\n\n respond_to do |format|\n if @categories.blank?\n format.json {render json:{:success => false, :status_code => 404, :message => \"No category found\"}}\n format.xml {render xml:{:success => false, :status_code => 404, :message => \"No category found\"}}\n format.html {render json: {:success => false, :status_code => 404, :message => \"No category found\"}}\n else\n format.html {render json: {:success => true, :status_code => 200, :categories => @categories}}\n format.json {render json: {:success => true, :status_code => 200, :categories => @categories}}\n format.xml {render xml: {:success => true, :status_code => 200, :categories => @categories}}\n end\n end\n end", "def index\n @categories=Category.root\n respond_with @categories\n end", "def index\n @pit_categories = PitCategory.all\n end", "def index\n @categories = Category.roots\n end", "def index\n\t\t@categories = Category.all\n\tend", "def index\n @categories = Category.all\n @categories= @categories.sort_by(&:name)\n render json: @categories\n end", "def index\n respond_with Category.all\n end", "def categories options = {}\n perform_get_with_object(\"/categories\", options, Vimeo::Entities::Category)\n end", "def index\n @talk_categories = TalkCategory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @talk_categories }\n end\n end", "def index\n @question_categories = QuestionCategory.with_questions()\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @question_categories }\n end\n end", "def index\n\t@categories = Category.all\n\tend", "def categories\n taxonomies.all :conditions => { :classification => :category }\n end", "def categories(args={})\n res = api_request('private.request.getCategories', 'GET')\n res = JSON.parse(res)['category'] rescue []\n\n unless args[:include_deleted] and args[:include_deleted] == true\n res.reject!{|k, v| v['fDeleted'] == '1'} rescue []\n end\n \n return res\n end", "def index\n @categories = Category.help_page_categories\n \n @title = 'Help Center'\n \n respond_to do |format|\n format.html { render :layout => \"help_page\" } # index.html.erb\n format.json { render :json => @categories }\n end\n end", "def all(params = {})\n handle_all_request(\"/categories\", :categories, params)\n end", "def list_by_category\n category = Category.where(id: params[:category_id])\n if category.any? then\n @products = category.first.products\n if @products.any? then \n render json: @products, status: 200\n else\n render json: { message: \"Não há produtos associados a categoria informada\" }, status: 404\n end\n else\n render json: { message: \"Não foi encontrada a categoria informada\" }, status: 404\n end\n end", "def index\n @service_categories = ServiceCategory.all\n end", "def do_get_cats_data\n message = {country_id: @client.country_code, webapi_key: @client.webapi_key}\n @client.call(:do_get_cats_data, message: message)\n end", "def categories_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: OtherApi.categories_list ...\"\n end\n # resource path\n local_var_path = \"/categories\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<Category>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: OtherApi#categories_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @categories = MiddleCategory.category_tree\n @middle_categories = @categories.group_by {|category| category.large_category_code}\n end", "def index\n @api_v1_group_categories = Api::V1::GroupCategory.all\n end", "def index\n @categories = current_user.categories\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end" ]
[ "0.7240655", "0.6939212", "0.69276583", "0.691725", "0.6863692", "0.6838845", "0.68023413", "0.66969234", "0.66304153", "0.6615906", "0.65032655", "0.6496176", "0.64305794", "0.64298975", "0.64056236", "0.63889074", "0.6367932", "0.6365213", "0.6356687", "0.63370764", "0.6328623", "0.63032883", "0.62704486", "0.62516123", "0.62430966", "0.6233903", "0.62047136", "0.62033856", "0.619542", "0.61897594", "0.61832756", "0.61818814", "0.6178428", "0.6178149", "0.6173753", "0.6164374", "0.6163248", "0.6163248", "0.6148908", "0.61466205", "0.61380595", "0.6136109", "0.61311704", "0.6127243", "0.6120276", "0.61164004", "0.6106316", "0.6094629", "0.60773826", "0.60771376", "0.60767126", "0.6074163", "0.6072497", "0.60615504", "0.60466456", "0.604623", "0.6031986", "0.6014716", "0.60059214", "0.60056293", "0.5979377", "0.59780616", "0.59780055", "0.596482", "0.59646326", "0.5963596", "0.5962343", "0.59545743", "0.5954104", "0.59521806", "0.5937295", "0.592819", "0.59231824", "0.59201586", "0.59186023", "0.59180725", "0.5914845", "0.59111047", "0.59036946", "0.5903337", "0.59028965", "0.5900335", "0.58949494", "0.5894804", "0.58931583", "0.5892472", "0.58900577", "0.58900493", "0.5883278", "0.5883116", "0.5883116", "0.5883116", "0.5883116", "0.5883116", "0.5883116", "0.5883116", "0.5883116", "0.5883116", "0.5883116", "0.5883116" ]
0.76618177
0
GET /hospital_categories/1 GET /hospital_categories/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @hospital_categories = HospitalCategory.all\n end", "def get_categories\r\n categories = Taxonomy.get_categories\r\n render json: categories, root: 'categories', adapter: :json, status: :ok\r\n end", "def index\n @incidentcategories = Incidentcategory.all\n json_response(@incidentcategories)\n end", "def set_hospital_category\n @hospital_category = HospitalCategory.find(params[:id])\n end", "def categories\n\t\trender :json => {:status => 1, :categories => {\"1\" => \"Apparel & Accessories\", \"2\" => \"Arts and Crafts\", \"3\" => \"Electronics\", \n\t\t\t\"4\" => \"Home Appliances\", \"5\" => \"Kids & Baby\", \"6\" => \"Movies, Music, Books & Games\", \"7\" => \"Motor Vehicles\", \n\t\t\t\"8\" => \"Office & Education\", \"9\" => \"Parties & Events\", \"10\" => \"Spaces & Venues\", \"11\" => \"Sports & Outdoors\", \"12\" => \"Tools & Gardening\", \"13\" => \"Other\"}}, :status => 200\n\t\treturn\n\tend", "def categories\n\t\tbegin\n\t\t\t@categories = Category.select(:id, :name)\n\t\t\trender json: @categories\n\t\trescue Exception => e\n\t\t\terror_handling_bad_request(e)\n\t\tend\n\tend", "def GetCategory id\n\n APICall(path: \"categories/#{id}.json\")\n\n end", "def GetCategories params = {}\n\n params = params.merge(path: 'categories.json')\n APICall(params)\n\n end", "def get_category id\n\t\t\t\t\tFreshdesk::Api::Client.convert_to_hash( @connection.get CATEGORIES, id )\n\t\t\t\tend", "def index\n @hive_categories = HiveInformation.all\n end", "def index\n categories = @vertical.catgories.order('created_at DESC');\n render json: {status: 'SUCCESS', message:'Loaded categories', data:categories},status: :ok\n end", "def meal_categories\n # API EXAMPLE: https://www.themealdb.com/api/json/v1/1/list.php?c=list\n content = api_call('list.php?c=list')\n validate(content)\n content\n end", "def index\n categories = Category.all\n render json:categories\n end", "def category\n client.categories.find(data[\"categoryId\"])\n end", "def get_department_categories\n json_response({ message: 'NOT IMPLEMENTED' })\n end", "def get_category\n json_response({ message: 'NOT IMPLEMENTED' })\n end", "def categories(query_object)\n\t\tdata = do_get_json(CATEGORIES_ENDPOINT, query_object)\n\tend", "def index\n\n\n @categories = Category.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @categories }\n end\n end", "def get_categories(project_id_or_key)\n get(\"projects/#{project_id_or_key}/categories\")\n end", "def get_subcategories\r\n sub_categories = Taxonomy.get_subcategories\r\n render json: sub_categories, root: 'categories', adapter: :json, status: :ok\r\n end", "def index\n @categories = Category.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @categories }\n end\n end", "def index\n @categories = Category.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @categories }\n end\n end", "def index\n @categories = Category.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @categories }\n end\n end", "def index\n @categories = Category.all \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @categories }\n end\n end", "def index\n @categories = CategoryService.index\n end", "def categories\n get('venues/categories').categories\n end", "def create\n @hospital_category = HospitalCategory.new(hospital_category_params)\n\n respond_to do |format|\n if @hospital_category.save\n format.html { redirect_to @hospital_category, notice: 'hospital_category was successfully created.' }\n format.json { render :show, status: :created, location: @hospital_category }\n else\n format.html { render :new }\n format.json { render json: @hospital_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @hospitalizations = Hospitalization.all\n end", "def getCategories(_, _, _)\n @db.categories\n end", "def get_menu_category\n require \"rest_client\"\n require \"json\"\n\n self.categories.update_all(still_present: false)\n response = RestClient.get(\"https://api.omnivore.io/0.1/locations/#{self.omnivore_id}/menu/categories\", {:content_type => :json, :'Api-Key' => Setting.first.app_api_key})\n res = JSON.parse(response)\n res[\"_embedded\"][\"categories\"].each do |category|\n cat = self.categories.where(omnivore_id: category[\"id\"]).first_or_create\n cat.name = category[\"name\"]\n cat.still_present = true\n cat.save\n end\n\n self.categories.where(still_present: false).destroy_all\n end", "def index\n @personality_categories = PersonalityCategory.all\n end", "def show\n @category = current_mall.categories.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @category }\n end\n end", "def index\n @exercise_categories = ExerciseCategory.where(\"organization_id IN (?)\", [Organization.current_organization, Organization.admin_organization])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @exercise_categories }\n end\n end", "def index\n @categorias = Categoria.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @categorias }\n end\n end", "def index\n\t @categories = Category.all\n\n\t respond_to do |format|\n\t\tformat.html # index.html.erb\n\t\tformat.json { render json: @categories }\n\t end\n\tend", "def show\n render json: category\n end", "def show\n render json: @category\n end", "def get_category_list\n ret_hash = Rails.cache.fetch(\"zaim_api/category\", expired_in: 1.day) do\n json_categories = self.zaim_api.category\n tmp_ret_hash = {}\n json_categories['categories'].each do |value|\n tmp_ret_hash[value['id']] = value['name']\n end\n tmp_ret_hash\n end\n ret_hash\n end", "def get_categories\n @categories = Category.all\n end", "def index\n @categories = @project.categories.all\n end", "def index\n @service_categories = ServiceCategory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @service_categories }\n end\n end", "def index\n @cathegories = Cathegory.all\n end", "def list\n categories = Meal.distinct.pluck(:category)\n meal_list = []\n categories.each { |category|\n obj = {\n groupName: category.capitalize,\n options: Meal.where(category: category).select(:id, :name)\n }\n meal_list.push(obj)\n }\n\n render json: meal_list\n end", "def getCategoryAll()\n params = Hash.new\n return doCurl(\"get\",\"/category/all\",params)\n end", "def get_categories\n body = build_request(2935, 1501, \"ACTIVEHEADINGS\")\n response = send_to_localeze(body)\n xml_doc = respond_with_hash(Nokogiri::XML(response.to_xml).text)\n end", "def getCategory( category_id)\n params = Hash.new\n params['category_id'] = category_id\n return doCurl(\"get\",\"/category\",params)\n end", "def category\n data['category']\n end", "def show\n render json: @accessory_category\n end", "def get_categories_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CategoriesApi.get_categories ...\"\n end\n # resource path\n local_var_path = \"/categories\"\n\n # query parameters\n query_params = {}\n query_params[:'filter_search'] = opts[:'filter_search'] if !opts[:'filter_search'].nil?\n query_params[:'filter_active'] = opts[:'filter_active'] if !opts[:'filter_active'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PageResourceCategoryResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CategoriesApi#get_categories\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def budget_categories_data\n # @budget.budget_items.collect { |budget_item| budget_item.category.name.to_s }.to_json\n categories = Category.for_budget.to_a\n categories << Category.find_by_name(\"Miscellaneous\")\n return categories.collect { |category| category.name.to_s }.to_json\n end", "def index\n @section_categories = SectionCategory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @section_categories }\n end\n end", "def index\n @categories = Category.help_page_categories\n \n @title = 'Help Center'\n \n respond_to do |format|\n format.html { render :layout => \"help_page\" } # index.html.erb\n format.json { render :json => @categories }\n end\n end", "def index\n @api_v1_group_categories = Api::V1::GroupCategory.all\n end", "def index\n @categorias = Categoria.where(ativo: true)\n \t\n render json: @categorias\n end", "def index\n @talk_categories = TalkCategory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @talk_categories }\n end\n end", "def get_categories(query_obj=nil)\n uri = URI.parse(@uri + \"/Categories\")\n results = get(uri,query_obj)\n end", "def show\n @hospitalization = Hospitalization.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hospitalization }\n end\n end", "def index\n @categories = Category.all\n respond_with(@categories)\n end", "def categories\n response[\"categories\"].map!{|category| Foursquared::Response::Category.new(client, category)} if response[\"categories\"]\n end", "def index\n @categories = Category.all\n @categories.each do |category|\n authorize! :read, category\n end\n render json: @categories\n end", "def index\n @law_categories = LawCategory.all\n end", "def get_categories()\n\t\tzomoato_categories_url = @base_uri + \"categories\"\n\t\tresponse = HTTParty.get(zomoato_categories_url, headers: @headers)\n\t\tif response.success?\n\t\t\t@categories = response.parsed_response\n\t\telse\n\t\t\traise response.response\n\t\tend\n\t\treturn @categories\n\tend", "def getcategories\n category_size = RequirementCategory.all.length\n current_offset = (params[:payload][:pagenumber] - 1)*10\n direction = params[:payload][:direction]\n\n respond_to do |format|\n format.json {\n\n \tif current_offset + direction < category_size && current_offset + direction >= 0\n offset = current_offset + direction\n \t@categories = RequirementCategory.all.offset(offset).take(10) \n \trender :json => @categories\n else\n \trender :nothing => true, :status => 200, :content_type => 'text/html'\n end\n }\n end\n\n\tend", "def category\n @services = Service.where(\"category = ?\", params[:category])\n @category = Service.categories.key(params[:category].to_i)\n end", "def index\n\n # dla formularza new\n @category = current_user.categories.build if signed_in?\n\n # dla tabeli index\n # @categories = Category.all\n @categories = Category.find(:all, :conditions => [\"\\\"isDefault\\\" = ? or user_id = ?\", true, current_user.id])\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @categories }\n end\n end", "def index\n @categories = Category.all\n @categories= @categories.sort_by(&:name)\n render json: @categories\n end", "def index\n @q = scope.search(categories_name_eq: params[:category])\n @dishes = @q.result.includes(:categories).order(\"categories.position\")\n\n c = Hash.new {|x,v| x[v] = []}\n @dishes = @dishes.reduce(c) do |h, dishe|\n dishe.categories.each do |c|\n h[c.name] << dishe\n end\n h\n end.reject {|c, d| d.blank? }\n\n respond_to do |format|\n format.html\n format.json\n end\n end", "def index\n @incidentcategories = Incidentcategory.all\n @incidentcategory = Incidentcategory.new\n end", "def subcategories\n\t\trespond_to do |format|\n\t \tformat.json {\n\t \t\tparam = params[:payload]\n\n\t\t\t\tcategory = RequirementCategory.find_by_id(param[:target_id])\n\t\t\t\tputs category.id\n\n\t\t\t\t@subcategory = category.requirement_subcategories\n\t \t\trender :json => @subcategory\n\t \t}\n\t end\t\t\n\tend", "def getCategories\n @categories = []\n @categories << Category.new(name: \"All\", id: -1)\n @categories += Category.all\n end", "def index\n @categories=Category.root\n respond_with @categories\n end", "def index\n @taxonomy_categories = TaxonomyCategory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @taxonomy_categories }\n end\n end", "def index\n @convention_categories = ConventionCategory.sorted\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @convention_categories }\n end\n end", "def index\n @goods_categories = GoodsCategory.roots\n @goods_category = GoodsCategory.new\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @goods_categories }\n end\n end", "def index\n @small_categories = SmallCategory.category_tree\n end", "def show\n @level_category = LevelCategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @level_category }\n end\n end", "def show\n @kategory = Kategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kategory }\n end\n end", "def index\n @prompt_categories = PromptCategory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @prompt_categories }\n end\n end", "def category\n # Whats the last category we are asking for? (the rest don't matter I don't think..)\n requested_category = params[:category].split(\"/\").last\n category = Taxonomy.find_by_seo_url requested_category\n\n if category.present?\n @category = category\n @posts = get_posts category.posts\n\n\n respond_to do |format|\n format.html { render :template => 'default/index' }\n format.json { render json: @posts }\n end\n else\n # No such category found, redirect to root index\n redirect_to root_path\n end\n end", "def index\n @question_categories = QuestionCategory.with_questions()\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @question_categories }\n end\n end", "def index\n @indicator_categories = IndicatorCategory.sorted\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @indicator_categories }\n end\n end", "def index\n @pit_categories = PitCategory.all\n end", "def index\n @dish_categories = DishCategory.all\n end", "def index\n respond_with Category.all\n end", "def index\n categories = {\n \"categoryId\": params[:ids]\n }\n auction_categories = Auction::Category.list categories\n if auction_categories[:comm][:code] == \"200\"\n render json: {status: auction_categories[:comm][:code].to_i, msg: auction_categories[:comm][:msg], data: {auction_categories: auction_categories[:data]}}\n else\n render json: {status: auction_categories[:comm][:code].to_i, msg: auction_categories[:comm][:msg], data: {}}\n end\n end", "def get_categories_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CategoriesApi.get_categories ...'\n end\n # resource path\n local_var_path = '/categories'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Array<Category>' \n\n # auth_names\n auth_names = opts[:auth_names] || ['Bearer']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CategoriesApi#get_categories\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def new\r\n @administration_category = Category.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @administration_category }\r\n end\r\n end", "def show\n @categorialivro = Categorialivro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @categorialivro }\n end\n end", "def new\n @category = Category.new\n @top_categories = Category.top_categories\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @category }\n end\n end", "def destroy\n @hospital_category.destroy\n respond_to do |format|\n format.html { redirect_to hospital_categories_url, notice: 'hospital_category was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def get_categories(add_params = nil)\n params = {\n }\n api_call('/global/categories(.:format)',:get,params,add_params)\n end", "def index\n @categories = Category.all\n render :json => @categories, :except => [:created_at, :updated_at]\n end", "def index\n @subcategorias = Subcategoria.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @subcategorias }\n end\n end", "def category_info\n {\n categories: self.object.appointments.map{ |appt| \n appt.category\n }\n \n }\n end", "def index\n\t\t@categories = Category.all\n\tend", "def index\n @accessory_categories = AccessoryCategory.all.order(\"updated_at DESC\").order(\"created_at DESC\")\n\n render json: @accessory_categories\n end", "def index\n # @student_categories = StudentCategory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @student_categories }\n end\n end", "def show\n render json: @categoria\n end", "def index\n\t@categories = Category.all\n\tend", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end" ]
[ "0.75607556", "0.7058082", "0.69855326", "0.67622304", "0.6743545", "0.6741325", "0.6682665", "0.6641161", "0.65406924", "0.64844906", "0.64734966", "0.6455101", "0.64222234", "0.6403474", "0.6391466", "0.63758814", "0.6347086", "0.63459873", "0.6312276", "0.6303336", "0.6297709", "0.6296833", "0.6296833", "0.62853074", "0.62807214", "0.6280719", "0.6267353", "0.6250094", "0.62378013", "0.62070626", "0.6198127", "0.6180731", "0.6161041", "0.61239064", "0.6119048", "0.6113052", "0.6107581", "0.61035377", "0.6101824", "0.6093738", "0.6093094", "0.6092155", "0.6071687", "0.60453117", "0.6044772", "0.60355484", "0.6034561", "0.6027291", "0.60230905", "0.6021938", "0.6016802", "0.60117865", "0.6008989", "0.6006709", "0.6004496", "0.59958166", "0.59943557", "0.5988316", "0.5985947", "0.59852797", "0.59775805", "0.5974744", "0.5974232", "0.59727806", "0.5968631", "0.5968345", "0.59620446", "0.59582937", "0.595785", "0.5951184", "0.59497607", "0.5947329", "0.5943595", "0.5934923", "0.59299064", "0.5927862", "0.5927158", "0.5926859", "0.59207785", "0.5919857", "0.5918154", "0.59144276", "0.5912471", "0.5911222", "0.5907288", "0.590387", "0.58968925", "0.58920395", "0.5889535", "0.58873254", "0.588549", "0.58831954", "0.5880389", "0.5877745", "0.58774644", "0.587489", "0.58738315", "0.58627063", "0.58620644", "0.5861977", "0.5861977" ]
0.0
-1
POST /hospital_categories POST /hospital_categories.json
def create @hospital_category = HospitalCategory.new(hospital_category_params) respond_to do |format| if @hospital_category.save format.html { redirect_to @hospital_category, notice: 'hospital_category was successfully created.' } format.json { render :show, status: :created, location: @hospital_category } else format.html { render :new } format.json { render json: @hospital_category.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_category payload\n\t\t\t\t\tFreshdesk::Api::Client.convert_to_hash( @connection.post CATEGORIES, payload )\n\t\t\t\tend", "def CreateCategory params = {}\n \n APICall(path: 'categories.json',method: 'POST',payload: params.to_json)\n \n end", "def index\n @hospital_categories = HospitalCategory.all\n end", "def create\n @incidentcategory = Incidentcategory.new(incidentcategory_params)\n\n if @incidentcategory.save\n json_response(@incidentcategory)\n else\n render json: @incidentcategory.errors, status: :unprocessable_entity\n end\n end", "def create\n @category = current_mall.categories.new(params[:category])\n\n if @category.save\n render json: @category, status: :created\n else\n render json: @category.errors, status: :unprocessable_entity\n end\n end", "def create\n @categoria = Categoria.new(categoria_params)\n if @categoria.save\n render json: @categoria\n else\n render json: @categoria.errors, status: :unprocessable_entity\n end\n end", "def set_hospital_category\n @hospital_category = HospitalCategory.find(params[:id])\n end", "def create\n @category = Category.new(category_params)\n @category.save\n render json: { params: params, notice: 'Categoria registrada exitosamente' }\n end", "def hospital_category_params\n params.require(:hospital_category).permit(:name)\n end", "def create\n category = @current_user.categories.create!(category_params)\n render json: { category: category }\n end", "def create\n @incidentcategory = Incidentcategory.new(incidentcategory_params)\n\n respond_to do |format|\n if @incidentcategory.save\n format.html { redirect_to incidentcategories_path, notice: 'Incidentcategory was successfully created.' }\n format.json { render :show, status: :created, location: @incidentcategory }\n else\n format.html { render :new }\n format.json { render json: @incidentcategory.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_categories\r\n categories = Taxonomy.get_categories\r\n render json: categories, root: 'categories', adapter: :json, status: :ok\r\n end", "def create\n json_create(category_params, Category)\n end", "def create\n @exhibitior_category = ExhibitiorCategory.new(params[:exhibitior_category])\n\n respond_to do |format|\n if @exhibitior_category.save\n format.html { redirect_to @exhibitior_category, notice: 'Exhibitior category was successfully created.' }\n format.json { render json: @exhibitior_category, status: :created, location: @exhibitior_category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @exhibitior_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @personality_category = PersonalityCategory.new(personality_category_params)\n\n respond_to do |format|\n if @personality_category.save\n format.html { redirect_to @personality_category, notice: 'Personality category was successfully created.' }\n format.json { render action: 'show', status: :created, location: @personality_category }\n else\n format.html { render action: 'new' }\n format.json { render json: @personality_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if @category.save\n render json: @category, status: :created, location: @category\n else\n render json: @category.errors, status: :unprocessable_entity\n end\n end", "def create\n @exercise_category = ExerciseCategory.new(params[:exercise_category].permit(:name, :organization_id))\n\n respond_to do |format|\n if @exercise_category.save\n format.html { redirect_to exercise_categories_path }\n format.json { render json: exercise_categories_path, status: :created, location: @exercise_category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @exercise_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @categorization = Categorization.new(params[:categorization])\n @categories = category_list\n respond_to do |format|\n if @categorization.save\n format.html { redirect_to(admin_categorization_path(@categorization), :notice => 'Categorization was successfully created.') }\n format.xml { render :xml => @categorization, :status => :created, :location => @categorization }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @categorization.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n category = Category.create(category_params)\n\n \n if category\n render json:{\n status: :created,\n category: category}\n else\n render json: { status: 500 }\n end\n end", "def create\n @categorialivro = Categorialivro.new(params[:categorialivro])\n\n respond_to do |format|\n if @categorialivro.save\n format.html { redirect_to @categorialivro, :notice => 'Categorialivro was successfully created.' }\n format.json { render :json => @categorialivro, :status => :created, :location => @categorialivro }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @categorialivro.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @cathegory = Cathegory.new(cathegory_params)\n\n respond_to do |format|\n if @cathegory.save\n format.html { redirect_to @cathegory, notice: 'Cathegory was successfully created.' }\n format.json { render :show, status: :created, location: @cathegory }\n else\n format.html { render :new }\n format.json { render json: @cathegory.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @accessory_category = AccessoryCategory.new(accessory_category_params)\n\n if @accessory_category.save\n audit(@accessory_category, current_user)\n render json: @accessory_category, status: :created\n else\n render json: @accessory_category.errors, status: :unprocessable_entity\n end\n end", "def meal_categories\n # API EXAMPLE: https://www.themealdb.com/api/json/v1/1/list.php?c=list\n content = api_call('list.php?c=list')\n validate(content)\n content\n end", "def create\n @category = Category.new(category_params)\n respond_to do |format|\n if @category.save\n format.html { redirect_to management_categories_path }\n format.json { render json: @category, status: :created }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(params[:category])\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to api_v1_categories_path, notice: 'Category was successfully created.' }\n format.json { render json: @category, status: :created, location: @category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(category_params)\n authorize! :create, @category\n if @category.save\n render json: @category, status: :created\n else\n render json: @category.errors, status: :unprocessable_entity\n end\n end", "def create\n @small_category = SmallCategory.new(small_category_params)\n @middle_categories = MiddleCategory.belongs_to_select_category(@small_category)\n\n respond_to do |format|\n if @small_category.save\n format.html { redirect_to @small_category, notice: 'Small category was successfully created.' }\n format.json { render :show, status: :created, location: @small_category }\n else\n format.html { render :new }\n format.json { render json: @small_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def categories\n\t\trender :json => {:status => 1, :categories => {\"1\" => \"Apparel & Accessories\", \"2\" => \"Arts and Crafts\", \"3\" => \"Electronics\", \n\t\t\t\"4\" => \"Home Appliances\", \"5\" => \"Kids & Baby\", \"6\" => \"Movies, Music, Books & Games\", \"7\" => \"Motor Vehicles\", \n\t\t\t\"8\" => \"Office & Education\", \"9\" => \"Parties & Events\", \"10\" => \"Spaces & Venues\", \"11\" => \"Sports & Outdoors\", \"12\" => \"Tools & Gardening\", \"13\" => \"Other\"}}, :status => 200\n\t\treturn\n\tend", "def create\n if params[:categoria_producto]\n p = Producto.find(params[:producto_id])\n c = Categoria.find(params[:categoria_id])\n\n if p.categorias << c\n render json: c, status: :created\n else\n render json: {:errors => {categoria: [\"No se ha podido agregar categoria\"]}}, status: :unprocessable_entity\n end\n\n else\n @categoria = Categoria.new(parametros_categoria)\n\n if @categoria.save\n render json: @categoria, status: :created\n else\n render json: @categoria.errors, status: :unprocessable_entity\n end\n end\n end", "def create\n @internal_category = InternalCategory.new(internal_category_params)\n\n respond_to do |format|\n if @internal_category.save\n format.html { redirect_to new_internal_category_path, notice: 'Internal category was successfully created.' }\n format.json { render action: 'show', status: :created, location: @internal_category }\n else\n format.html { render action: 'new' }\n format.json { render json: @internal_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @hospitalization = Hospitalization.new(hospitalization_params)\n\n respond_to do |format|\n if @hospitalization.save\n format.html { redirect_to @hospitalization, notice: 'Hospitalization was successfully created.' }\n format.json { render :show, status: :created, location: @hospitalization }\n else\n format.html { render :new }\n format.json { render json: @hospitalization.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @technology = Technology.new(params[:technology])\n @categories = Category.find(:all)\n\n respond_to do |format|\n if @technology.save\n flash[:success] = 'Technology was successfully created.'\n format.html { redirect_to @technology }\n format.json { render json: @technology, status: :created, location: @technology }\n else\n format.html { render action: \"new\" }\n format.json { render json: @technology.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.new(project_params)\n if params[:project][:category_list].present?\n @project.category_list = []\n params[:project][:category_list].each do |cat|\n @project.category_list.add(cat)\n end \n end\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @categ = Categ.new(categ_params)\n\n respond_to do |format|\n if @categ.save\n format.html { redirect_to @categ, notice: 'Categ was successfully created.' }\n format.json { render :show, status: :created, location: @categ }\n else\n format.html { render :new }\n format.json { render json: @categ.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @status_category = StatusCategory.new(status_category_params)\n\n respond_to do |format|\n if @status_category.save\n format.html { redirect_to @status_category, notice: 'Status category was successfully created.' }\n format.json { render :show, status: :created, location: @status_category }\n else\n format.html { render :new }\n format.json { render json: @status_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @charity_category = CharityCategory.new(params[:charity_category])\n\n respond_to do |format|\n if @charity_category.save\n format.html { redirect_to admins_charity_categories_url, notice: 'Charity Category was successfully created.' }\n format.json { render json: @charity_category, status: :created, location: @charity_category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @charity_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @incidentcategories = Incidentcategory.all\n json_response(@incidentcategories)\n end", "def create\n @category = current_user.categories.new(name: params[:name])\n if @category.save\n render \"create.json.jbuilder\", status: :created\n else\n render json: { errors: @category.errors.full_messages }, status: :unprocessable_entity\n end\n end", "def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to admin_dashboard_categories_path, notice: 'Category was successfully created.' }\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pcategory = Pcategory.new(params[:pcategory])\n\n respond_to do |format|\n if @pcategory.save\n format.html { redirect_to @pcategory, notice: 'La categoria se creo satisfactoriamente.' }\n format.json { render json: @pcategory, status: :created, location: @pcategory }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pcategory.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @notification_category = NotificationCategory.new(notification_category_params)\n\n if @notification_category.save\n render json: @notification_category, status: :created\n else\n render json: @notification_category.errors, status: :unprocessable_entity\n end\n end", "def create\n @post_category = current_user.post_categories.build(params[:post_category])\n\n respond_to do |format|\n if @post_category.save\n format.html { redirect_to [:client,:post_categories], notice: 'Post category was successfully created.' }\n format.json { render json: @post_category, status: :created, location: @post_category }\n else\n format.html { render action: \"index\" }\n format.json { render json: @post_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @hospital = Hospital.new(hospital_params)\n\n respond_to do |format|\n if @hospital.save\n format.html { redirect_to @hospital, notice: 'Hospital added.' }\n format.json { render :show, status: :created, location: @hospital }\n else\n format.html { render :new }\n format.json { render json: @hospital.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = CategoryService.create(category_params)\n\n respond_to do |format|\n unless @category.errors.any?\n format.html { redirect_to backoffice_categories_path,\n notice: notification_alert('success', 'Created!', \"Category [#{@category.description}] was successfully created.\") \n }\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def user_category\n # byebug\n @user = User.where(contact: params[:contact]).first\n params[:category_ids].each do |category|\n @user.user_categories.create!(category_id: category, user_id: @user.id)\n end\n render json: {status: \"SUCCESS\", message: \"user-data\", data: \"category saved\"}, status: :ok\n end", "def create\n @categories = Category.where(validity: true)\n @category = Category.new(params[:category])\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: t(:category_created) }\n format.json { render json: @category, status: :created, location: @category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \n @categorias_tipo = CatTipo.new(params[:cat_tipo])\n\n\t\trespond_to do |format|\n\t\t\tif @categorias_tipo.save\n \t\t\tcategories = @categorias_tipo.update_attributes(:tipo_acc_ids =>params[:tipo_accs])\n\t\t\t\t@categorias_tipo.update_attributes(:estado_ids =>params[:estados])\n\t\t\t\t\n\t\t\t\n\n format.html { redirect_to cat_tipos_path, notice: 'OK' }\n format.json { render json: @categorias_tipo, status: :created, location: @categorias_tipo }\n\t\t\telse\n format.html { render action: \"new\" }\n format.json { render json: @categorias_tipo.errors, status: :unprocessable_entity }\n \tend\t\n\t\tend\n\tend", "def create\n @categor = Categor.new(categor_params)\n\n respond_to do |format|\n if @categor.save\n format.html { redirect_to @categor, notice: 'Categor was successfully created.' }\n format.json { render :show, status: :created, location: @categor }\n else\n format.html { render :new }\n format.json { render json: @categor.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @categoria = Categoria.new(params[:categoria])\n\n respond_to do |format|\n if @categoria.save\n format.html { redirect_to action: 'index', notice: 'Categoria was successfully created.' }\n format.json { render json: @categoria, status: :created, location: @categoria }\n else\n format.html { render action: \"new\" }\n format.json { render json: @categoria.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = CategoryService.create\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def addCat()\n if(!authenticateAdmin(params[:admin_id], params[:admin_auth_key]))\n render json: {status: false, reason: \"Authentication Failed\", data: \"\"}\n return\n end\n c = Category.new(name: params[:name])\n status = c.save\n error = \"\"\n if(c.errors.full_messages.count > 0)\n error = c.errors.full_messages[0]\n end\n render json: {status: status, reason: error, data: \"\"}\n end", "def create\r\n @administration_category = Category.new(params[:category])\r\n\r\n respond_to do |format|\r\n if @administration_category.save\r\n format.html { redirect_to [:administration, @administration_category], notice: 'Category was successfully created.' }\r\n format.json { render json: @administration_category, status: :created, location: @administration_category }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @administration_category.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @work_category = WorkCategory.new(work_category_params)\n authorize @work_category\n\n respond_to do |format|\n if @work_category.save\n format.html { redirect_to work_categories_url, notice: t('Record has been saved') }\n format.json { render :show, status: :created, location: @work_category }\n else\n format.html {\n @work_category.work_type_categories.build if @work_category.work_type_categories.blank?\n render :new\n }\n format.json { render json: @work_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @hive_category = HiveCategory.new(hive_category_params)\n\n respond_to do |format|\n if @hive_category.save\n format.html { redirect_to @hive_category, notice: 'Hive category was successfully created.' }\n format.json { render :show, status: :created, location: @hive_category }\n else\n format.html { render :new }\n format.json { render json: @hive_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_department_categories\n json_response({ message: 'NOT IMPLEMENTED' })\n end", "def create\n\n # @category = Category.new(params[:category])\n @category = current_user.categories.build(params[:category])\n\n respond_to do |format|\n if @category.save\n # format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.html { redirect_to categories_path, notice: 'Pomyślnie utworzono kategorię.' }\n format.json { render json: @category, status: :created, location: @category }\n else\n # format.html { render action: \"new\" }\n format.html { redirect_to categories_path, :flash => { :error => 'Nie udało się utworzyć kategorii' } }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @hospital = Hospital.find(params[:hospital_id])\n hospital_specialisations = @hospital.specialisations\n\n specialisation_categories = SpecialisationCategory.all\n @specialisation_categories_hash = {}\n\n specialisation_categories.each do |specialisation_category|\n @specialisation_categories_hash[specialisation_category] = []\n\n specialisation_category.specialisations.each do |specialisation|\n specialisation.show_checked = true if hospital_specialisations.include? specialisation\n @specialisation_categories_hash[specialisation_category] << specialisation\n end\n end\n end", "def create\n category = Category.create!(category_params)\n render json: {\n :html => render_to_string(\n :partial => \"setups/category\",\n :layout => false,\n :locals => {:category => category})\n }\n end", "def create\n @categories = Category.all\n\n @category = Category.create(category_params)\n flash[:notice]=\"Catégorie créer avec succès!!!\"\n end", "def create\n business_category_params[\"business_centerable_type\"] = business_category_params[\"business_centerable_id\"].split(';').first\n business_category_params[\"business_centerable_id\"] = business_category_params[\"business_centerable_id\"].split(';').last\n @business_category = BusinessCategory.new(business_category_params)\n\n respond_to do |format|\n if @business_category.save\n format.html { redirect_to @business_category, notice: 'Business category was successfully created.' }\n format.json { render :show, status: :created, location: @business_category }\n else\n format.html { render :new }\n format.json { render json: @business_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @middle_category = MiddleCategory.new(middle_category_params)\n\n respond_to do |format|\n if @middle_category.save\n format.html { redirect_to @middle_category, notice: 'Middle category was successfully created.' }\n format.json { render :show, status: :created, location: @middle_category }\n else\n format.html { render :new }\n format.json { render json: @middle_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @company_category = CompanyCategory.new(company_category_params)\n\n respond_to do |format|\n if @company_category.save\n format.html { redirect_to @company_category, notice: 'Company category was successfully created.' }\n format.json { render :show, status: :created, location: @company_category }\n else\n format.html { render :new }\n format.json { render json: @company_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profession_category = ProfessionCategory.new(profession_category_params)\n\n respond_to do |format|\n if @profession_category.save\n format.html { redirect_to profession_categories_path, notice: 'Profession category was successfully created.' }\n format.json { render :show, status: :created, location: @profession_category }\n else\n format.html { render :new }\n format.json { render json: @profession_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @level_category = LevelCategory.new(params[:level_category])\n\n respond_to do |format|\n if @level_category.save\n format.html { redirect_to @level_category, notice: 'Level category was successfully created.' }\n format.json { render json: @level_category, status: :created, location: @level_category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @level_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @categorium = Categorium.new(categorium_params)\n\n respond_to do |format|\n if @categorium.save\n format.html { redirect_to @categorium, notice: 'Categoría fue creada exitosamente.' }\n format.json { render :show, status: :created, location: @categorium }\n else\n format.html { render :new }\n format.json { render json: @categorium.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to categories_path, notice: 'Category was successfully created.' }\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.create(params[:category])\n respond_with(@category, location: categories_url)\n end", "def create\n @expense = @current_user.expenses.create(params[:expense])\n params[:expense][:categories].each do |category_id|\n category_id = category_id.to_i\n if category_id > 0\n @expense.categories << Category.find(category_id)\n end\n end\n respond_to do |format|\n if @expense.save\n flash[:notice] = 'Expense was successfully created.'\n format.html { redirect_to(@expense) }\n format.xml { render :xml => @expense, :status => :created, :location => @expense }\n format.iphone { redirect_to(@expense) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @expense.errors, :status => :unprocessable_entity }\n format.iphone { render :action => \"new\" }\n end\n end\n end", "def create\n @pit_category = PitCategory.new(pit_category_params)\n\n respond_to do |format|\n if @pit_category.save\n format.html { redirect_to @pit_category, notice: 'Pit category was successfully created.' }\n format.json { render :show, status: :created, location: @pit_category }\n else\n format.html { render :new }\n format.json { render json: @pit_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @hospitalization = Hospitalization.new(params[:hospitalization])\n @hospitalization.client=@client\n\n\n respond_to do |format|\n if @hospitalization.save\n format.html { redirect_to client_hospitalizations_path(@client), notice: I18n.t(:record_created) }\n format.json { render json: @hospitalization, status: :created, location: @hospitalization }\n else\n format.html { render action: \"new\" }\n format.json { render json: @hospitalization.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @resource = Integral::Category.new(resource_params)\n\n if @resource.save\n flash[:notice] = notification_message('creation_success')\n render json: { redirect_url: request.referrer }, status: :created\n else\n render json: { message: notification_message('creation_failure') }, status: :unprocessable_entity\n end\n end", "def create\n @kategory = Kategory.new(params[:kategory])\n\n respond_to do |format|\n if @kategory.save\n format.html { redirect_to @kategory, notice: 'Kategory was successfully created.' }\n format.json { render json: @kategory, status: :created, location: @kategory }\n else\n format.html { render action: \"new\" }\n format.json { render json: @kategory.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @law_category = LawCategory.new(law_category_params)\n\n respond_to do |format|\n if @law_category.save\n format.html { redirect_to @law_category, notice: 'Law category was successfully created.' }\n format.json { render :show, status: :created, location: @law_category }\n else\n format.html { render :new }\n format.json { render json: @law_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render json: @category, status: :created }\n else\n format.html { render action: 'new' }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @poi_category = PoiCategory.new(params[:poi_category])\n\n respond_to do |format|\n if @poi_category.save\n format.html { redirect_to @poi_category, :notice => 'Poi category was successfully created.' }\n format.json { render :json => @poi_category, :status => :created, :location => @poi_category }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @poi_category.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to categories_path, notice: 'Category was successfully created.' }\n format.json { render action: 'show', status: :created, location: @category }\n else\n format.html { render action: 'new' }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @taxonomy_category = TaxonomyCategory.new(params[:taxonomy_category])\n\n respond_to do |format|\n if @taxonomy_category.save\n format.html { redirect_to @taxonomy_category, notice: 'Taxonomy category was successfully created.' }\n format.json { render json: @taxonomy_category, status: :created, location: @taxonomy_category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @taxonomy_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def categories\n\t\tbegin\n\t\t\t@categories = Category.select(:id, :name)\n\t\t\trender json: @categories\n\t\trescue Exception => e\n\t\t\terror_handling_bad_request(e)\n\t\tend\n\tend", "def destroy\n @hospital_category.destroy\n respond_to do |format|\n format.html { redirect_to hospital_categories_url, notice: 'hospital_category was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def create\n @specialization_category = SpecializationCategory.new(specialization_category_params)\n\n respond_to do |format|\n if @specialization_category.save\n format.html { redirect_to @specialization_category, notice: 'Specialization category was successfully created.' }\n format.json { render :show, status: :created, location: @specialization_category }\n else\n format.html { render :new }\n format.json { render json: @specialization_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = current_user\n @category = Category.new(params[:category])\n @user.categories << @category\n #TODO: error handling\n #TODO: AJAX this\n if @user.save\n redirect_to user_path(@user)\n else\n render \"new\"\n end\n end", "def create\n @aspcategory = Aspcategory.new(aspcategory_params)\n\n respond_to do |format|\n if @aspcategory.save\n format.html { redirect_to aspcategories_path, notice: 'Aspcategory was successfully created.' }\n format.json { render :show, status: :created, location: @aspcategory }\n else\n format.html { render :new }\n format.json { render json: @aspcategory.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @exercise_category = ExerciseCategory.new(params[:exercise_category])\n\n respond_to do |format|\n if @exercise_category.save\n format.html { redirect_to @exercise_category, notice: 'Exercise category was successfully created.' }\n format.json { render json: @exercise_category, status: :created, location: @exercise_category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @exercise_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(params[:category])\n\n respond_to do |format|\n if @category.save\n format.html {\n redirect_to @category, notice: 'Category was successfully created.'\n }\n format.json {\n render json: @category, status: :created, location: @category\n }\n else\n format.html { render action: \"new\" }\n format.json {\n render json: @category.errors, status: :unprocessable_entity\n }\n end\n end\n end", "def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to edit_dashboard_category_path(@category), notice: 'Category was successfully created.' }\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @service_category = ServiceCategory.new(service_category_params)\n if current_user.role_id != Role.find_by_name(\"Super Admin\").id\n @service_category.company_id = current_user.company_id\n end\n\n respond_to do |format|\n if @service_category.save\n format.html { redirect_to service_categories_path, notice: 'Categoría de Servicios creada exitosamente.' }\n format.json { render action: 'show', status: :created, location: @service_category }\n else\n format.html { render action: 'new' }\n format.json { render json: @service_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(params[:category]) \n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: t(:created_category_success)}\n format.json { render json: @category, status: :created, location: @category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \n category = params[:category]\n category_name = category['name']\n \n write_log(\"category.to_s: #{category.to_s}\",\n __FILE__.split(\"/\")[-1],\n __LINE__.to_s)\n \n cats = []\n if category_name != nil\n cats = category_name.split(\" \")\n end\n \n write_log(\"cats.size: #{cats.size}\",\n __FILE__.split(\"/\")[-1],\n __LINE__.to_s)\n\n if cats.size > 1\n \n flag = true\n counter = 0\n \n cats.each do |cat|\n # @category = Category.new(params[:category])\n # @category = Category.new(name=cat)\n @category = Category.new({\"name\"=> cat, \"genre_id\"=> category['genre_id']})\n \n if @category.save\n else\n counter += 1\n end\n end#cats.each do |cat|\n \n respond_to do |format|\n format.html { redirect_to @category, \n notice: \"New categories: Created => #{cats.size - counter}, Failed => #{counter}\" }\n format.json { render json: @category, status: :created, location: @category }\n end\n \n else#if cats.size > 1\n @category = Category.new(params[:category])\n \n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render json: @category, status: :created, location: @category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end#if cats.size > 1\n \n \n # @category = Category.new(params[:category])\n# \n # respond_to do |format|\n # if @category.save\n # format.html { redirect_to @category, notice: 'Category was successfully created.' }\n # format.json { render json: @category, status: :created, location: @category }\n # else\n # format.html { render action: \"new\" }\n # format.json { render json: @category.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def create\n @mk_categoria = MkCategoria.new(mk_categoria_params)\n\n respond_to do |format|\n if @mk_categoria.save\n format.html { redirect_to @mk_categoria, notice: 'Mk categoria was successfully created.' }\n format.json { render :show, status: :created, location: @mk_categoria }\n else\n format.html { render :new }\n format.json { render json: @mk_categoria.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @sivic_contcategory = SivicContcategory.new(sivic_contcategory_params)\r\n\r\n respond_to do |format|\r\n if @sivic_contcategory.save\r\n format.html { redirect_to @sivic_contcategory, notice: 'Sivic contcategory was successfully created.' }\r\n format.json { render action: 'show', status: :created, location: @sivic_contcategory }\r\n else\r\n format.html { render action: 'new' }\r\n format.json { render json: @sivic_contcategory.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @category = Category.new(category_params)\n respond_to do |format|\n if @category.save\n format.html { redirect_to adminpanel_categories_path, notice: \"Категория #{@category.name} успешно создана\" }\n format.json { render :show, status: :created, location: adminpanel_categories_path }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @interviewcategory = Interviewcategory.new(interviewcategory_params)\n\n respond_to do |format|\n if @interviewcategory.save\n format.html { redirect_to @interviewcategory, notice: \"Interviewcategory was successfully created.\" }\n format.json { render :show, status: :created, location: @interviewcategory }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @interviewcategory.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(params[:category])\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render json: @category, status: :created, location: @category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(params[:category])\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render json: @category, status: :created, location: @category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(params[:category])\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render json: @category, status: :created, location: @category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(params[:category])\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render json: @category, status: :created, location: @category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(params[:category])\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render json: @category, status: :created, location: @category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render json: @category, status: :created, location: @category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @service_time_category = ServiceTimeCategory.new(service_time_category_params)\n\n respond_to do |format|\n if @service_time_category.save\n format.html { redirect_to @service_time_category, notice: 'Service time category was successfully created.' }\n format.json { render :show, status: :created, location: @service_time_category }\n else\n format.html { render :new }\n format.json { render json: @service_time_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @service_category = ServiceCategory.new(service_category_params)\n\n respond_to do |format|\n if @service_category.save\n format.html { redirect_to [:admin, @service_category], notice: 'Service category was successfully created.' }\n format.json { render :show, status: :created, location: [:admin, @service_category] }\n else\n format.html { render :new }\n format.json { render json: @service_category.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.69033563", "0.66519314", "0.6645564", "0.6614792", "0.6398817", "0.6384493", "0.6352882", "0.62959385", "0.6293843", "0.62786907", "0.6250535", "0.6215882", "0.6206162", "0.6178973", "0.6176571", "0.61559266", "0.610285", "0.61028105", "0.60753", "0.605269", "0.6052371", "0.6037215", "0.601916", "0.6018341", "0.6017299", "0.60038924", "0.5997636", "0.5978926", "0.59712714", "0.59662074", "0.59590423", "0.59565985", "0.59529644", "0.5945809", "0.59371424", "0.5917", "0.59131867", "0.59080106", "0.58992964", "0.5892931", "0.588807", "0.58826834", "0.5880511", "0.5867058", "0.58669585", "0.5865968", "0.58639026", "0.58630097", "0.5844113", "0.58435774", "0.5839387", "0.5838539", "0.58361536", "0.58346796", "0.5834524", "0.5827899", "0.5822167", "0.5814975", "0.57907546", "0.5790354", "0.5787513", "0.5787495", "0.5782849", "0.57802355", "0.57786924", "0.5776098", "0.5771935", "0.57671744", "0.57652986", "0.57619995", "0.57602155", "0.575192", "0.5751572", "0.5744857", "0.5742966", "0.57384926", "0.5737769", "0.5737081", "0.5734283", "0.57307065", "0.5730511", "0.57246083", "0.5724479", "0.57203454", "0.5720338", "0.5716344", "0.5711665", "0.57107985", "0.5710193", "0.5710159", "0.57077545", "0.57045937", "0.5701136", "0.5701136", "0.5701136", "0.5701136", "0.5701136", "0.57011294", "0.5699641", "0.569164" ]
0.72510314
0
PATCH/PUT /hospital_categories/1 PATCH/PUT /hospital_categories/1.json
def update respond_to do |format| if @hospital_category.update(hospital_category_params) format.html { redirect_to @hospital_category, notice: 'hospital_category was successfully updated.' } format.json { render :show, status: :ok, location: @hospital_category } else format.html { render :edit } format.json { render json: @hospital_category.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def UpdateCategory params = {}\n \n APICall(path: 'categories.json',method: 'PUT',payload: params.to_json)\n \n end", "def update\n json_update(category,category_params, Category)\n end", "def update\n respond_to do |format|\n if @incidentcategory.update(incidentcategory_params)\n json_response(@incidentcategory)\n else\n render json: @incidentcategory.errors, status: :unprocessable_entity\n end\n end\n end", "def set_hospital_category\n @hospital_category = HospitalCategory.find(params[:id])\n end", "def update\n respond_to do |format|\n if @personality_category.update(personality_category_params)\n format.html { redirect_to @personality_category, notice: 'Personality category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @personality_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @category.update(category_params)\n render json: @category, status: :ok\n else\n render json: @category.errors, status: :unprocessable_entity\n end\n end", "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to api_v1_categories_path, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @headline = t(:update_category)\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: t(:updated_category_success) }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @category.update(params[:category])\n head :no_content\n else\n render json: @category.errors, status: :unprocessable_entity\n end\n end", "def update\n @exhibitior_category = ExhibitiorCategory.find(params[:id])\n\n respond_to do |format|\n if @exhibitior_category.update_attributes(params[:exhibitior_category])\n format.html { redirect_to @exhibitior_category, notice: 'Exhibitior category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exhibitior_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @categoria.update(categoria_params)\n render json: @categoria\n else\n render json: @categoria.errors, status: :unprocessable_entity \n end\n end", "def update\n respond_to do |format|\n if @cathegory.update(cathegory_params)\n format.html { redirect_to @cathegory, notice: 'Cathegory was successfully updated.' }\n format.json { render :show, status: :ok, location: @cathegory }\n else\n format.html { render :edit }\n format.json { render json: @cathegory.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @category = current_mall.categories.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @status_category.update(status_category_params)\n format.html { redirect_to @status_category, notice: 'Status category was successfully updated.' }\n format.json { render :show, status: :ok, location: @status_category }\n else\n format.html { render :edit }\n format.json { render json: @status_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @hive_category.update(hive_category_params)\n format.html { redirect_to @hive_category, notice: 'Hive category was successfully updated.' }\n format.json { render :show, status: :ok, location: @hive_category }\n else\n format.html { render :edit }\n format.json { render json: @hive_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @exercise_category = ExerciseCategory.find(params[:id])\n \n respond_to do |format|\n if @exercise_category.update_attributes(params[:exercise_category])\n format.html { redirect_to exercise_categories_path }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exercise_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @notification_category = NotificationCategory.find(params[:id])\n\n if @notification_category.update(notification_category_params)\n head :no_content\n else\n render json: @notification_category.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @schema_category.update(schema_category_params)\n format.html { redirect_to schema_categories_path, notice: 'Schema category was successfully updated.' }\n format.json { render :show, status: :ok, location: @schema_category }\n else\n format.html { render :edit }\n format.json { render json: @schema_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @small_category.update(small_category_params)\n format.html { redirect_to @small_category, notice: 'Small category was successfully updated.' }\n format.json { render :show, status: :ok, location: @small_category }\n else\n format.html { render :edit }\n format.json { render json: @small_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = current_user\n if @user.commission_request_template_json.nil? \n @user.commission_request_template_json = {\"categories\" => []}.to_json\n end\n json = build_json_from_params \n @user.commission_request_template_json = nil\n @user.save\n @user.commission_request_template_json = json\n if @user.save\n flash[:notice] = \"Commission Template Saved!\"\n else\n flash[:alert] = \"Error Saving Template\"\n end \n redirect_to root_url\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.json { render :show, status: :ok, location: @category }\n else\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @incidentcategory.update(incidentcategory_params)\n format.html { redirect_to @incidentcategory, notice: 'Incidentcategory was successfully updated.' }\n format.json { render :show, status: :ok, location: @incidentcategory }\n else\n format.html { render :edit }\n format.json { render json: @incidentcategory.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to api_v1_category_path(@category), notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @exhibitor_category = ExhibitorCategory.find(params[:id])\n\n respond_to do |format|\n if @exhibitor_category.update_attributes(params[:exhibitor_category])\n format.html { redirect_to @exhibitor_category, notice: 'Exhibitor category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exhibitor_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @pcategory = Pcategory.find(params[:id])\n\n respond_to do |format|\n if @pcategory.update_attributes(params[:pcategory])\n format.html { redirect_to @pcategory, notice: 'La categoria se modifico satisfactoriamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pcategory.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @accessory_category = AccessoryCategory.find(params[:id])\n\n if @accessory_category.update(accessory_category_params)\n audit(@accessory_category, current_user)\n head :no_content\n else\n render json: @accessory_category.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @company_category.update(company_category_params)\n format.html { redirect_to @company_category, notice: 'Company category was successfully updated.' }\n format.json { render :show, status: :ok, location: @company_category }\n else\n format.html { render :edit }\n format.json { render json: @company_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @expense.categories_expenses.destroy_all\n if (params[:expense][:categories]) \n params[:expense][:categories].each do |category_id|\n category_id = category_id.to_i\n if category_id > 0\n @expense.categories << Category.find(category_id)\n end\n end\n end\n\n respond_to do |format|\n if @expense.update_attributes(params[:expense])\n flash[:notice] = 'Expense was successfully updated.'\n format.html { redirect_to(@expense) }\n format.xml { head :ok }\n format.iphone { redirect_to :controller => \"welcome\", :action => \"home\" }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @expense.errors, :status => :unprocessable_entity }\n format.iphone { render :action => \"edit\" }\n end\n end\n end", "def update\n @hospitalization = Hospitalization.find(params[:id])\n\n respond_to do |format|\n if @hospitalization.update_attributes(params[:hospitalization])\n format.html { redirect_to client_hospitalizations_path(@client), notice: I18n.t(:record_updated) }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @hospitalization.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to management_categories_path }\n format.json { render json: @category, status: :ok }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @kategory = Kategory.find(params[:id])\n\n respond_to do |format|\n if @kategory.update_attributes(params[:kategory])\n format.html { redirect_to @kategory, notice: 'Kategory was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @kategory.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @poi_category = PoiCategory.find(params[:id])\n\n respond_to do |format|\n if @poi_category.update_attributes(params[:poi_category])\n format.html { redirect_to @poi_category, :notice => 'Poi category was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @poi_category.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\r\n respond_to do |format|\r\n if @sivic_contcategory.update(sivic_contcategory_params)\r\n format.html { redirect_to @sivic_contcategory, notice: 'Sivic contcategory was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: 'edit' }\r\n format.json { render json: @sivic_contcategory.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n\n existing_categories = (Exercise.find_by id: params[:id]).categories\n is_already_category = (Exercise.find_by id: params[:id]).exercise_categorizations.pluck(:category_id).include? params[:category_id].to_i\n\n if(params[:checked] == \"checked\" )\n if(!is_already_category)\n existing_categories << (Category.find_by id: params[:category_id])\n end\n else\n if(is_already_category)\n existing_categories.delete(params[:category_id])\n end\n end\n\n respond_to do |format|\n if @exercise.update(exercise_params)\n format.html { redirect_to @exercise, notice: 'Exercise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @exercise.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @super_category = SuperCategory.find(params[:id])\n\n respond_to do |format|\n if @super_category.update_attributes(params[:super_category])\n format.html { redirect_to @super_category, notice: 'Super category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @super_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to :back, notice: 'category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def editCat()\n if(!authenticateAdmin(params[:admin_id], params[:admin_auth_key]))\n render json: {status: false, reason: \"Authentication Failed\", data: \"\"}\n return\n end\n c = Category.find(params[:id])\n status = c.update(name: params[:name])\n error = \"\"\n if(c.errors.full_messages.count > 0)\n error = c.errors.full_messages[0]\n end\n render json: {status: status, reason: error, data: \"\"}\n end", "def update\n @exercise_category = ExerciseCategory.find(params[:id])\n\n respond_to do |format|\n if @exercise_category.update_attributes(params[:exercise_category])\n format.html { redirect_to @exercise_category, notice: 'Exercise category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exercise_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @service_category.name == \"Sin Categoría\"\n redirect_to service_categories_path, notice: 'No es posible actualizar la categoría \"Sin Categoría\".'\n end\n respond_to do |format|\n if @service_category.update(service_category_params)\n format.html { redirect_to service_categories_path, notice: 'Categoría de Servicios actualizada exitosamente.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @service_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @specialization_category.update(specialization_category_params)\n format.html { redirect_to @specialization_category, notice: 'Specialization category was successfully updated.' }\n format.json { render :show, status: :ok, location: @specialization_category }\n else\n format.html { render :edit }\n format.json { render json: @specialization_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @categorialivro = Categorialivro.find(params[:id])\n\n respond_to do |format|\n if @categorialivro.update_attributes(params[:categorialivro])\n format.html { redirect_to @categorialivro, :notice => 'Categorialivro was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @categorialivro.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @api_v1_group_category.update(api_v1_group_category_params)\n format.html { redirect_to @api_v1_group_category, notice: 'Group category was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_group_category }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_group_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @law_category.update(law_category_params)\n format.html { redirect_to @law_category, notice: 'Law category was successfully updated.' }\n format.json { render :show, status: :ok, location: @law_category }\n else\n format.html { render :edit }\n format.json { render json: @law_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @category.update_attributes(params[:category])\n respond_with(@category)\n end", "def update\n @post_category = current_user.post_categories.find(params[:id])\n\n respond_to do |format|\n if @post_category.update_attributes(params[:post_category])\n format.html { redirect_to [:client,@post_category], notice: 'Post category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @categ.update(categ_params)\n format.html { redirect_to @categ, notice: 'Categ was successfully updated.' }\n format.json { render :show, status: :ok, location: @categ }\n else\n format.html { render :edit }\n format.json { render json: @categ.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @category = Category.find(params[:id])\n @category.update_attributes(params[:category])\n respond_with(@category, location: categories_url)\n end", "def update_categories(categories, options = {} )\n options.merge!(:docid => self.docid, :categories => categories)\n resp = @conn.put do |req|\n req.url \"categories\"\n req.body = options.to_json\n end\n\n resp.status \n end", "def update\n @category = Category.find(params[:id])\n\n if @category.update_attributes(params[:category])\n flash[:notice] = 'Sucesso - update'\n else\n flash[:notice] = 'Falha ao atualizar a categoria'\n end\n\n # respond_to do |format|\n # if @category.update_attributes(params[:category])\n # format.html { redirect_to categories_path}\n # format.json { head :no_content }\n # else\n # format.html { render action: \"edit\" }\n # format.json { render json: @category.errors, status: :unprocessable_entity }\n \n # end\n # end\n end", "def update\n respond_to do |format|\n if @profession_category.update(profession_category_params)\n format.html { redirect_to profession_categories_path, notice: 'Profession category was successfully updated.' }\n format.json { render :show, status: :ok, location: @profession_category }\n else\n format.html { render :edit }\n format.json { render json: @profession_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize @work_category\n respond_to do |format|\n if @work_category.update(work_category_params)\n format.html { redirect_to work_categories_url, notice: t('Record has been saved') }\n format.json { render :show, status: :ok, location: @work_category }\n else\n format.html {\n @work_category.work_type_categories.build if @work_category.work_type_categories.blank?\n render :edit\n }\n format.json { render json: @work_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n #locates the category to be updated\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @company = Company.find(params[:id])\n params[:company][:category_ids] ||= []\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to(@company, :notice => 'Company was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n\t@vehicle_categories = VehicleCategory.all\n\t@vehicle_category = VehicleCategory.find(params[:id])\n respond_to do |format|\n if @vehicle_category.update(vehicle_category_params)\n format.html { redirect_to @vehicle_category, notice: 'Vehicle category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @vehicle_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @categorization = Categorization.find(params[:id])\n @categories = category_list\n respond_to do |format|\n if @categorization.update_attributes(params[:categorization])\n format.html { redirect_to(admin_categorization_path(@categorization), :notice => 'Categorization was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @categorization.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @pit_category.update(pit_category_params)\n format.html { redirect_to @pit_category, notice: 'Pit category was successfully updated.' }\n format.json { render :show, status: :ok, location: @pit_category }\n else\n format.html { render :edit }\n format.json { render json: @pit_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @recipe = Recipe.find(params[:id])\n\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 @categories=RecipeCategory.all\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 @level_category = LevelCategory.find(params[:id])\n\n respond_to do |format|\n if @level_category.update_attributes(params[:level_category])\n format.html { redirect_to @level_category, notice: 'Level category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @level_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @service_category.update(service_category_params)\n format.html { redirect_to [:admin, @service_category], notice: 'Service category was successfully updated.' }\n format.json { render :show, status: :ok, location: [:admin, @service_category] }\n else\n format.html { render :edit }\n format.json { render json: @service_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sys_category.update(sys_category_params)\n format.html { redirect_to @sys_category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sys_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @skill_category.update(skill_category_params)\n format.html { redirect_to @skill_category, notice: 'Skill category was successfully updated.' }\n format.json { render :show, status: :ok, location: @skill_category }\n else\n format.html { render :edit }\n format.json { render json: @skill_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize! :update, Hospital\n respond_to do |format|\n if @hospital.update(hospital_params)\n format.html { redirect_to @hospital, notice: 'Hospital was successfully updated.' }\n format.json { render :show, status: :ok, location: @hospital }\n else\n format.html { render :edit }\n format.json { render json: @hospital.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to admin_dashboard_categories_path, notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to backend_shop_branch_category_path(@current_shop.slug, @current_branch, @category), notice: t('Category was successfully updated.') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n @administration_category = Category.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @administration_category.update_attributes(params[:category])\r\n format.html { redirect_to [:administration, @administration_category], notice: 'Category was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @administration_category.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html {\n redirect_to @category, notice: 'Category was successfully updated.'\n }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json {\n render json: @category.errors, status: :unprocessable_entity\n }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to admin_good_categories_url, notice: 'GoodCategory was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @exam_category = ExamCategory.find(params[:id])\n\n respond_to do |format|\n if @exam_category.update_attributes(params[:exam_category])\n format.html { redirect_to @exam_category, notice: 'Exam category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exam_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category, notice: t('update.notice', name: t('activerecord.models.category')) }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: t(:category_updated) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if current_category.category==\"noone\"\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n else\n render :file => \"/public/404.html\",:status => \"404\"\n end\n \n end", "def update\n respond_to do |format|\n if @internal_category.update(internal_category_params)\n format.html { redirect_to brands_path, notice: 'Internal category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @internal_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to backoffice_categories_path,\n notice: notification_alert('success', 'Updated!', \"Category [#{@category.description}] was successfully updated.\") \n }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update category_params\n format.html { redirect_to admin_categories_url, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @hospital = Hospital.find(params[:id])\n\n\n respond_to do |format|\n if @hospital.update_attributes(:name=>params[:name],:namefull=>params[:namefull],:description=>params[:description])\n # format.html { redirect_to @hospital, notice: 'Hospital was successfully created.' }\n format.json { render json: [:id=>@hospital.id] , status: :ok, location: @hospital }\n else\n # format.html { render action: \"new\" }\n format.json { render json: @hospital.errors, status: :unprocessable_entity }\n end\n end\n\n # respond_to do |format|\n # if @hospital.update_attributes(params[:hospital])\n # format.html { redirect_to @hospital, notice: 'Hospital was successfully updated.' }\n # format.json { head :no_content }\n # else\n # format.html { render action: \"edit\" }\n # format.json { render json: @hospital.errors, status: :unprocessable_entity }\n # end\n # end\n\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to categories_path, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @interviewcategory.update(interviewcategory_params)\n format.html { redirect_to @interviewcategory, notice: \"Interviewcategory was successfully updated.\" }\n format.json { render :show, status: :ok, location: @interviewcategory }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @interviewcategory.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(category_params)\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize @category\n\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to admin_project_path(@category.project_id), notice: t('actions.updated_with_success')}\n format.json { render :edit, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @job_category = JobCategory.find(params[:id])\n\n respond_to do |format|\n if @job_category.update_attributes(params[:job_category])\n format.html { redirect_to @job_category, notice: 'Job category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @job_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post_category = Post::Category.find(params[:id])\n\n respond_to do |format|\n if @post_category.update_attributes(params[:post_category])\n format.html { redirect_to @post_category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @service_time_category.update(service_time_category_params)\n format.html { redirect_to @service_time_category, notice: 'Service time category was successfully updated.' }\n format.json { render :show, status: :ok, location: @service_time_category }\n else\n format.html { render :edit }\n format.json { render json: @service_time_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @question_category = QuestionCategory.find(params[:id])\n\n respond_to do |format|\n if @question_category.update_attributes(params[:question_category])\n format.html { redirect_to @question_category, notice: 'Question category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @hospital.update(hospital_params)\n render :show, status: :ok, location: @hospital\n else\n render json:{ error: @hospital.errors}, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @category.update_attributes(category_params)\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @finding_category = FindingCategory.find(params[:id])\n\n respond_to do |format|\n if @finding_category.update_attributes(params[:finding_category])\n format.html { redirect_to @finding_category, notice: 'Finding category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @finding_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @recipe_category = RecipeCategory.find(params[:id])\n\n respond_to do |format|\n if @recipe_category.update_attributes(params[:recipe_category])\n format.html { redirect_to @recipe_category, notice: 'Recipe category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recipe_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @business_category.update(business_category_params)\n format.html { redirect_to @business_category, notice: 'Business category was successfully updated.' }\n format.json { render :show, status: :ok, location: @business_category }\n else\n format.html { render :edit }\n format.json { render json: @business_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n unless @category.name == \"ROOT\"\n if @category.update(category_params)\n render 'show', :status => 200, :layout => false, notice: 'Category was successfully created.'\n else\n render :json => {:message => \"Error in updating category\"}, notice: @category.errors, :layout => false, :status => 400\n end\n else\n render :json => {:message => \"Root can't be edited.\"}, :layout => false, :status => 400\n end\n end" ]
[ "0.68525875", "0.6836133", "0.6610611", "0.6419427", "0.64112025", "0.6373052", "0.6360285", "0.63505125", "0.6324173", "0.631055", "0.6308039", "0.6306478", "0.6298497", "0.6272521", "0.62650055", "0.6255187", "0.62522435", "0.6235679", "0.6223568", "0.62202203", "0.62198406", "0.6208057", "0.61764836", "0.61764145", "0.6166077", "0.61659956", "0.616158", "0.61598235", "0.61390626", "0.61326015", "0.6128219", "0.61263424", "0.612607", "0.612441", "0.61214906", "0.61198735", "0.61195546", "0.6115013", "0.6112879", "0.61123365", "0.61046195", "0.6104424", "0.61015683", "0.60997796", "0.6097492", "0.60810715", "0.60791206", "0.60767514", "0.60748994", "0.607445", "0.60736644", "0.6072703", "0.6068112", "0.6063493", "0.6057437", "0.60400087", "0.6039576", "0.6038603", "0.60381836", "0.6026791", "0.60195386", "0.60104215", "0.6004605", "0.5998225", "0.5996902", "0.59918034", "0.59864765", "0.5981102", "0.5981102", "0.5981102", "0.5981102", "0.5981102", "0.5981102", "0.5981102", "0.59806585", "0.59798104", "0.5978801", "0.59769607", "0.5972655", "0.5969434", "0.5966158", "0.5964477", "0.59622675", "0.59580415", "0.595585", "0.5949534", "0.59387165", "0.59387165", "0.5935612", "0.5931684", "0.5927913", "0.59267956", "0.5925873", "0.5923737", "0.5923106", "0.59223795", "0.592051", "0.59169567", "0.59169024", "0.59152573" ]
0.7140228
0
DELETE /hospital_categories/1 DELETE /hospital_categories/1.json
def destroy @hospital_category.destroy respond_to do |format| format.html { redirect_to hospital_categories_url, notice: 'hospital_category was successfully deleted.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n #@incidentcategory.destroy\n render json: {}, status: 200\n end", "def destroy\n @hospitalization = Hospitalization.find(params[:id])\n @hospitalization.destroy\n\n respond_to do |format|\n format.html { redirect_to client_hospitalizations_url(@client) }\n format.json { head :ok }\n end\n end", "def destroy\n @hospital = Hospital.find(params[:id])\n @hospital.destroy\n\n respond_to do |format|\n format.html { redirect_to hospitals_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admission_category = AdmissionCategory.find(params[:id])\n @admission_category.destroy\n\n respond_to do |format|\n format.html { redirect_to admission_categories_path }\n format.json { head :no_content }\n end\n end", "def destroy\n IndicatorCategory.delete_hack(params[:id])\n\n respond_to do |format|\n format.html { redirect_to indicator_categories_url }\n format.json { head :ok }\n end\n end", "def destroy\n @personality_category.destroy\n respond_to do |format|\n format.html { redirect_to personality_categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ref_hospitalization_type = Ref::HospitalizationType.find(params[:id])\n @ref_hospitalization_type.destroy\n\n respond_to do |format|\n format.html { redirect_to ref_hospitalization_types_url }\n format.json { head :ok }\n end\n end", "def destroy\r\n @sivic_contcategory.destroy\r\n respond_to do |format|\r\n format.html { redirect_to sivic_contcategories_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @hospitalization.destroy\n respond_to do |format|\n format.html { redirect_to hospitalizations_url, notice: 'Hospitalization was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @category.destroy\n render json: @category, status: :ok\n end", "def destroy\n category = set_category\n if category.destroy\n head :no_content\n else\n render json: { status: 500 }\n end\n \n end", "def DeleteCategory id\n \n APICall(path: \"categories/#{id}.json\",method: 'DELETE')\n \n end", "def destroy\n @hospital_general.destroy\n respond_to do |format|\n format.html { redirect_to hospital_generals_url, notice: 'Hospital general was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @category = current_mall.categories.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to api_wmall_categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exhibitior_category = ExhibitiorCategory.find(params[:id])\n @exhibitior_category.destroy\n\n respond_to do |format|\n format.html { redirect_to exhibitior_categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exhibitor_category = ExhibitorCategory.find(params[:id])\n @exhibitor_category.destroy\n\n respond_to do |format|\n format.html { redirect_to exhibitor_categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @hospital.destroy\n respond_to do |format|\n format.html { redirect_to hospitals_url, notice: 'Hospital was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def deleteCat()\n if(!authenticateAdmin(params[:admin_id], params[:admin_auth_key]))\n render json: {status: false, reason: \"Authentication Failed\", data: \"\"}\n return\n end\n c = Category.find(params[:id])\n status = c.destroy\n error = \"\"\n if(c.errors.full_messages.count > 0)\n error = c.errors.full_messages[0]\n end\n render json: {status: true, reason: error, data: \"\"}\n end", "def destroy\n @cathegory.destroy\n respond_to do |format|\n format.html { redirect_to cathegories_url, notice: 'Cathegory was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @alien_category.destroy\n respond_to do |format|\n format.html { redirect_to alien_categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @hive_category.destroy\n respond_to do |format|\n format.html { redirect_to hive_categories_url, notice: 'Hive category was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @level_category = LevelCategory.find(params[:id])\n @level_category.destroy\n\n respond_to do |format|\n format.html { redirect_to level_categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @incidentcategory.destroy\n respond_to do |format|\n format.html { redirect_to incidentcategories_url, notice: 'Incidentcategory was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to api_v1_categories_path }\n format.json { head :no_content }\n end\n end", "def delete_category id\n\t\t\t\t\tFreshdesk::Api::Client.delete_status_wrapper do\n\t\t\t\t\t\t( @connection.delete CATEGORIES, id ).code\n\t\t\t\t\tend\n\t\t\t\tend", "def destroy\n @small_category.destroy\n respond_to do |format|\n format.html { redirect_to small_categories_url, notice: 'Small category was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @administration_category = Category.find(params[:id])\r\n @administration_category.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to administration_categories_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @status_category.destroy\n respond_to do |format|\n format.html { redirect_to status_categories_url, notice: 'Status category was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @exam_category = ExamCategory.find(params[:id])\n @exam_category.destroy\n\n respond_to do |format|\n format.html { redirect_to exam_categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sys_category.destroy\n respond_to do |format|\n format.html { redirect_to sys_categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @desserts_category.destroy\n respond_to do |format|\n format.html { redirect_to desserts_categories_url}\n format.json { head :no_content }\n end\n end", "def destroy\n @physical_category.destroy\n respond_to do |format|\n format.html { redirect_to physical_categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @catagory.destroy\n respond_to do |format|\n format.html { redirect_to back_catagories_url, notice: I18n.t('view.notice.deleted') }\n format.json { head :no_content }\n end\n end", "def destroy\n @category.destroy\n render json: { notice: 'Categoria eliminada exitosamente' }\n end", "def destroy\n @categorialivro = Categorialivro.find(params[:id])\n @categorialivro.destroy\n\n respond_to do |format|\n format.html { redirect_to categorialivros_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mastery_category = MasteryCategory.find(params[:id])\n @mastery_category.destroy\n\n respond_to do |format|\n format.html { redirect_to mastery_categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @law_category.destroy\n respond_to do |format|\n format.html { redirect_to law_categories_url, notice: 'Law category was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise_category = ExerciseCategory.find(params[:id])\n @exercise_category.destroy\n\n respond_to do |format|\n format.html { redirect_to exercise_categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mostsmallskillcategory = Mostsmallskillcategory.find(params[:id])\n @mostsmallskillcategory.destroy\n\n respond_to do |format|\n format.html { redirect_to mostsmallskillcategories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @category_db.destroy\n respond_to do |format|\n format.html { redirect_to category_dbs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_category.destroy\n respond_to do |format|\n format.html { redirect_to admin_categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @category.destroy\n respond_to do |format|\n format.html { redirect_to admin_good_categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @dish_category.destroy\n respond_to do |format|\n format.html { redirect_to dish_categories_url, notice: 'Категория блюда удалена.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @patrimony_item_category.destroy\n respond_to do |format|\n format.html { redirect_to patrimony_item_categories_url, notice: 'Patrimony item category was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @service_time_category.destroy\n respond_to do |format|\n format.html { redirect_to service_time_categories_url, notice: 'Service time category was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @category = DishCategory.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Категория удалена.' }\n format.json { head :no_content }\n end\n end", "def destroy\n #locates the category to be destroyed\n @category = Category.find(params[:id])\n #Creates an array of all categories\n @all_categories = Category.all\n #creates an empty hash\n @all_categories_hash = {}\n #calls function to populate & sort @all_categories_hash\n sort_categories()\n #calls function to destroy the category\n destroy_category(@category)\n\n respond_to do |format|\n format.html { redirect_to '/admin' }\n format.json { head :ok }\n end\n end", "def destroy\n audit(@accessory_category, current_user)\n @accessory_category.destroy\n \n\n head :no_content\n end", "def destroy\n @categoria = Categoria.find(params[:id])\n @categoria.destroy\n\n respond_to do |format|\n format.html { redirect_to categoria_index_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity_category.destroy\n respond_to do |format|\n format.html { redirect_to activity_categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @categ.destroy\n respond_to do |format|\n format.html { redirect_to categs_url, notice: 'Categ was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @health_level.destroy\n\n respond_to do |format|\n format.html { redirect_to health_levels_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @hospitalization_day.destroy\n respond_to do |format|\n format.html { redirect_to hospitalization_days_url, notice: 'Día de estancia eliminado satisfactoriamente.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @kategory = Kategory.find(params[:id])\n @kategory.destroy\n\n respond_to do |format|\n format.html { redirect_to kategories_url }\n format.json { head :ok }\n end\n end", "def destroy\n @budgetcategory = Budgetcategory.find(params[:id])\n @budgetcategory.destroy\n\n respond_to do |format|\n format.html { redirect_to budgetcategories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @taxonomy_category = TaxonomyCategory.find(params[:id])\n @taxonomy_category.destroy\n\n respond_to do |format|\n format.html { redirect_to taxonomy_categories_url }\n format.json { head :ok }\n end\n end", "def destroy\n @gt_category.destroy\n respond_to do |format|\n format.html { redirect_to gt_categories_url, notice: 'Gt category was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @categorie_droit.destroy\n respond_to do |format|\n format.html { redirect_to categorie_droits_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @category.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_categories_path, notice: 'Category was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @coach_category.destroy\n respond_to do |format|\n format.html { redirect_to coach_categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @poi_category = PoiCategory.find(params[:id])\n @poi_category.destroy\n\n respond_to do |format|\n format.html { redirect_to poi_categories_url }\n format.json { head :ok }\n end\n end", "def destroy\n # @retailer_category = RetailerCategory.find(params[:id])\n @retailer_category.destroy\n respond_to do |format|\n format.html { redirect_to retailer_categories_url }\n format.json { head :ok }\n end\n end", "def destroy\n @categorie_analytique = CategorieAnalytique.find(params[:id])\n @categorie_analytique.destroy\n\n respond_to do |format|\n format.html { redirect_to categorie_analytiques_url }\n format.json { head :ok }\n end\n end", "def destroy\n @schema_category.destroy\n respond_to do |format|\n format.html { redirect_to schema_categories_url, notice: 'Schema category was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @section_category = SectionCategory.find(params[:id])\n @section_category.destroy\n\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_categoryall = Categoryall.find(params[:id])\n @admin_categoryall.destroy\n respond_with(@admin_categoryall, :location => admin_panels_url)\n end", "def destroy\n @category.destroy\n respond_to do |format|\n format.html { redirect_to admin_categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @company_category.destroy\n respond_to do |format|\n format.html { redirect_to company_categories_url, notice: 'Company category was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @category.destroy\n head :no_content\n end", "def destroy\n @medium_category.destroy\n respond_to do |format|\n format.html { redirect_to medium_categories_url, notice: 'Medium category was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @home_cat = HomeCat.find(params[:id])\n @home_cat.destroy\n\n respond_to do |format|\n format.html { redirect_to home_cats_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @category.destroy\n respond_to do |format|\n format.html { redirect_to backend_shop_branch_categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @achievement_category = AchievementCategory.find(params[:id])\n @achievement_category.destroy\n\n respond_to do |format|\n format.html { redirect_to achievement_categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :ok }\n end\n end", "def destroy\n @charity_category = CharityCategory.find(params[:id])\n @charity_category.destroy\n\n respond_to do |format|\n format.html { redirect_to admins_charity_categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ilance_category.destroy\n respond_to do |format|\n format.html { redirect_to ilance_categories_url, notice: 'Ilance category was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @st_category.destroy\n respond_to do |format|\n format.html { redirect_to st_categories_url, notice: 'St category was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n respond_to do |format|\n format.html { redirect_to categories_url, notice: \"Journal was successfully deleted.\" }\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 @education_service_provided_typology.destroy\n respond_to do |format|\n format.html { redirect_to education_service_provided_typologies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_v1_group_category.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_group_categories_url, notice: 'Group category was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @category.destroy\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @category.destroy\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @category.destroy\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_scenic_spots_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @clinicalsection = Clinicalsection.find(params[:id])\n @clinicalsection.destroy\n\n respond_to do |format|\n format.html { redirect_to clinicalsections_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @pit_category.destroy\n respond_to do |format|\n format.html { redirect_to pit_categories_url, notice: 'Pit category was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @convention_category = ConventionCategory.find(params[:id])\n @convention_category.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_convention_categories_url }\n format.json { head :ok }\n end\n end" ]
[ "0.7554948", "0.73819655", "0.7276389", "0.7198593", "0.71792185", "0.7163575", "0.71228874", "0.70979595", "0.7089987", "0.7089411", "0.70889765", "0.7080473", "0.7075293", "0.7067855", "0.7043566", "0.70379895", "0.7032809", "0.7025122", "0.7014303", "0.70063204", "0.7004468", "0.7002966", "0.6991466", "0.69866824", "0.69704735", "0.6962029", "0.69598687", "0.69323355", "0.6930248", "0.6920824", "0.6896798", "0.6886062", "0.6872831", "0.68668705", "0.6859863", "0.68457806", "0.6840766", "0.6837841", "0.68138134", "0.68134737", "0.6809414", "0.68077195", "0.68055874", "0.6802258", "0.67985463", "0.67937803", "0.6786125", "0.6785975", "0.67765975", "0.6771778", "0.6765342", "0.67643756", "0.67632425", "0.67600864", "0.6753899", "0.6752089", "0.67490566", "0.67452073", "0.67438656", "0.6743252", "0.6740716", "0.67394584", "0.6739078", "0.6731905", "0.672722", "0.67250156", "0.6724679", "0.6713378", "0.6712399", "0.67089456", "0.67079747", "0.66955733", "0.66943395", "0.66884005", "0.668713", "0.6687052", "0.66840494", "0.66832215", "0.66832215", "0.66832215", "0.66832215", "0.66832215", "0.66832215", "0.66832215", "0.66832215", "0.66832215", "0.66832215", "0.66832215", "0.66832215", "0.6678562", "0.66785026", "0.66775656", "0.66772", "0.66749746", "0.66749746", "0.66749746", "0.66740525", "0.66710705", "0.6670758", "0.6669527" ]
0.78571284
0
Use callbacks to share common setup or constraints between actions.
def set_hospital_category @hospital_category = HospitalCategory.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 hospital_category_params params.require(:hospital_category).permit(:name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def safe_params\n params.require(:user).permit(:name)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def active_code_params\n params[:active_code].permit\n end", "def filtering_params\n params.permit(:email)\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def list_params\n params.permit(:name)\n end", "def filter_parameters; end", "def filter_parameters; end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def url_whitelist; end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def permit_request_params\n params.permit(:address)\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def url_params\n params[:url].permit(:full)\n end", "def backend_user_params\n params.permit!\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076", "0.62894756", "0.6283177", "0.6242471", "0.62382483", "0.6217549", "0.6214457", "0.6209053", "0.6193042", "0.6177802", "0.6174604", "0.61714715", "0.6161512", "0.6151757", "0.6150663", "0.61461", "0.61213595", "0.611406", "0.6106206", "0.6105114", "0.6089039", "0.6081015", "0.6071004", "0.60620916", "0.6019971", "0.601788", "0.6011056", "0.6010898", "0.6005122", "0.6005122", "0.6001556", "0.6001049", "0.59943926", "0.5992201", "0.59909594", "0.5990628", "0.5980841", "0.59669393", "0.59589154", "0.5958826", "0.5957911", "0.5957385", "0.5953072", "0.59526145", "0.5943361", "0.59386164", "0.59375334", "0.59375334", "0.5933856", "0.59292704", "0.59254247", "0.5924164", "0.59167904", "0.59088355", "0.5907542", "0.59064597", "0.5906243", "0.5898226", "0.589687", "0.5896091", "0.5894501", "0.5894289", "0.5891739", "0.58860534", "0.5882406", "0.587974", "0.58738774", "0.5869024", "0.58679986", "0.5867561", "0.5865932", "0.5864461", "0.58639693", "0.58617616", "0.5861436", "0.5860451", "0.58602303", "0.5854586", "0.58537364", "0.5850427", "0.5850199" ]
0.0
-1
GET /server_infos/1 GET /server_infos/1.json
def show @server_info = ServerInfo.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @server_info } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def info\n result = []\n Server.all.each do |server|\n result << server.short_result\n end\n\n status_key = makeStatusKey(result)\n render :json => {servers:result}.merge(status_key)\n\n end", "def details\n data = servers_client.get(server_path, json_headers).body\n JSON.parse(data)['server']\n end", "def show\n @server = Server.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @server }\n end\n end", "def show\n puts \"=================show=================\"\n @server = Server.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @server }\n end\n end", "def show\n @name_server = NameServer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @name_server }\n end\n end", "def server_info\n return @server_info if @server_info.present?\n response = request :get, SERVER_INFO_PATH\n @server_info = response.error? ? nil :\n response.result.with_indifferent_access\n end", "def servers\n response = get \"server\"\n data = JSON.parse response.body\n data[\"servers\"][\"server\"]\n end", "def servers\n response = get \"server\"\n data = JSON.parse response.body\n data[\"servers\"][\"server\"]\n end", "def show\n @server1 = Server1.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @server1 }\n end\n end", "def servers_detailed()\n return get_request(address(\"/servers/detail\"), @token)\n end", "def new\n @server_info = ServerInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @server_info }\n end\n end", "def show\n @server = Server.find(params[:id])\n checkaccountobject(\"servers\",@server)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @server }\n end\n end", "def info\n response = from_server \"api/info.json\"\n response.data\n end", "def show\n @server_instance = ServerInstance.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @server_instance }\n end\n end", "def new\n @server = Server.new\n\n @server_options = Server.all.map{|u| [ u.server_name, u.id ] }\n # @server_ips = Server.all.map{|u| [ u.IP, u.id ] }\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @server }\n end\n end", "def show\n @licserver = Licserver.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tformat.template\n\t\t\tformat.html\n\t\t\tformat.json {\n\t\t\t\trender json: {\n\t\t\t\t\t:name => @licserver.get_port_at_server,\n\t\t\t\t\t:type => @licserver.license_type_id,\n\t\t\t\t\t:tags => @licserver.tags.map{ |x| x.title }.join(\" \")\n\t\t\t\t}\n\t\t\t}\n\t\tend\n end", "def show\n render json: Server.where(name: params[:name]).first\n end", "def new\n @server1 = Server1.new\n\n @server_options = Server1.all.map{|u| [ u.server_name, u.id ] }\n @server_ips = Server1.all.map{|u| [ u.IP, u.id ] }\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @server1 }\n end\n end", "def show\n authenticate_user!\n @server = Server.find(params[:id])\n @checks = @server.checks.page(params[:page]).per(10)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @server }\n end\n end", "def show\n @server = Server.find(params[:id])\n add_breadcrumb @server.name, [@server]\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @server.to_json(:include => { :websites => {:include => :plugins } }) }\n end\n end", "def show\n @game_server = Game::Server.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game_server }\n end\n end", "def show\n #@server_nodes = ServerNode.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @server_node }\n end\n end", "def info\n get '/'\n end", "def info\n response = rpc.request Riakpb::Util::MessageCode::GET_SERVER_INFO_REQUEST\n\n @node = response.node\n @server_version = response.server_version\n\n {:node => @node, :server_version => @server_version}\n end", "def index\n @servers = Server.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @servers }\n end\n end", "def index\n @servers = getmydata(\"Server\")\n\tpagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @servers }\n end\n end", "def show\n @server = Server.find(params[:server_id])\n @httping_log = @server.httping_logs.find(params[:id])\n\n respond_to do |format|\n format.html { render :show, layout: false } # show.html.erb\n format.json { render json: @httping_log }\n end\n end", "def server_info()\n #This is a stub, used for indexing\n end", "def info(**args)\n valid_params?(args)\n params = convert_params(args)\n client.get(\"#{ENDPOINT}/info\", options: params.compact).tap do |resp|\n resp.body = resp.body.map { |_k, data| data }\n end\n end", "def info(**args)\n valid_params?(args)\n params = convert_params(args)\n client.get(\"#{ENDPOINT}/info\", options: params.compact).tap do |resp|\n resp.body = resp.body.map { |_k, data| data }\n end\n end", "def new\n @server = Server.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @server }\n end\n end", "def new\n @server = Server.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @server }\n end\n end", "def server_info!\n @server_info = nil\n server_info\n end", "def info\n get(\"/api-info\")\n end", "def getinfo\n request :getinfo\n end", "def server\n arrayCommand( \"show server\", DictArray, RESPONSE_SERVER_INFO_FOLLOWS )\n end", "def server\n arrayCommand( \"show server\", DictArray, RESPONSE_SERVER_INFO_FOLLOWS )\n end", "def new\n authenticate_user!\n @server = Server.new\n @rackspace_servers = Server.rackspace_servers\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @server }\n end\n end", "def server(service_id, server_id)\n request :get, \"/services/#{service_id}/servers/#{server_id}\"\n end", "def server_info\n {:node => \"riak@#{node.host}\", :server_version => '2.0'}\n end", "def servers\n endpoint = 'https://pcs.baidu.com/rest/2.0/pcs/manage?method=listhost'\n @res = @api.request_json( endpoint )\n end", "def show\n @server = Server.find params[:id]\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @server }\n end\n end", "def server_info\n check_connection\n @protocol.server_info\n end", "def info\n request('getinfo')\n end", "def view\n @server = Server.find(params[:id])\n end", "def show\n @serv = Serv.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @serv }\n end\n end", "def server_info\n db(\"admin\").command({:buildinfo => 1}, {:admin => true, :check_response => true})\n end", "def index\n @game_servers = Game::Server.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @game_servers }\n end\n end", "def getinfo\n @api.request 'getinfo'\n end", "def info\n connection.server_info\n end", "def show\n @serverroom = Serverroom.find(params[:id])\n @serverrack = Serverrack.new\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @serverroom }\n end\n end", "def info\n CouchRest.get \"#{@uri}/\"\n end", "def show\n @block_list_server = BlockListServer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @block_list_server }\n end\n end", "def get_server\n get_general['server']\n end", "def read_host_info\n json { execute_prlctl('server', 'info', '--json') }\n end", "def servers(service_id)\n request :get, \"/services/#{service_id}/servers\"\n end", "def show\n @server_rack = ServerRack.find(params[:id])\n\n respond_with @server_rack\n end", "def new\n @server_instance = ServerInstance.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @server_instance }\n end\n end", "def info(kind)\n login_as :place1_admin\n get :info, :kind => kind\n\n # See if the response is success\n assert_equal \"200\", @response.code\n\n return JSON.parse(@response.body)\n end", "def info(id)\n http.get(\"/nfse/#{id}\") do |response|\n respond_with_entity(response)\n end\n end", "def show\n @networking = Networking.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @networking }\n end\n end", "def create\n @server_info = ServerInfo.new(params[:server_info])\n\n respond_to do |format|\n if @server_info.save\n format.html { redirect_to @server_info, notice: 'Server info was successfully created.' }\n format.json { render json: @server_info, status: :created, location: @server_info }\n else\n format.html { render action: \"new\" }\n format.json { render json: @server_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @project_server = ProjectServer.find(params[:id].to_i) rescue nil\n respond_to do |format|\n unless @project_server.blank?\n # to provide a version specific and secure representation of an object, wrap it in a presenter\n \n format.xml { render :xml => project_server_presenter }\n format.json { render :json => project_server_presenter }\n else\n format.xml { head :not_found }\n format.json { head :not_found }\n end\n end\n end", "def version_info\n path = File.join(SERVER_ROOT, 'public', 'version_info.json')\n JSON.load File.read(path)\nend", "def info(url)\n rest = RestClient::Request.execute(\n method: :get,\n url: url,\n user: ENV['USER'],\n password: ENV['KEY'],\n headers: {\"Content-Type\" => \"application/json\"}\n )\n JSON.parse(rest, :symbolize_names => true)\n rescue RestClient::Exception\n \"Sorry something went wrong with the API\"\n end", "def show\n # base url of the remote data\n # append the 'id' to this to generate the remote url\n baseUrl = 'https://api.gojimo.net/api/v4/'\n\n # request the meta data from the remote server and\n # extract the time its data was last updated\n meta = open(\"#{baseUrl}#{params[:id]}\").meta\n update_at = meta[\"last-modified\"].to_date\n\n # request new data when the local data timestamp pre dates the remote data\n requires_refresh = params[:update_at].blank? || update_at > params[:update_at].to_date\n\n # request the remote data if it is newer than the local copy\n data = open(\"#{baseUrl}#{params[:id]}\").read if requires_refresh\n # parse any data since we are going to add the data to an object which is then converted to json\n data = JSON.parse(data) unless data.blank?\n\n # return any data together with timestamps and a flag to show whetjer new data was retrieved\n render json: {new_data: requires_refresh, data: data, update_at: update_at.strftime('%a %d %b %Y'), check_at: Time.now.strftime('%H:%M %a %d %b %Y')}\n\n end", "def show\n @server_ins_transaction = ServerInsTransaction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @server_ins_transaction }\n end\n end", "def info( opts = {} )\n http_action :get, nil, opts\n end", "def index\n @client_infos = ClientInfo.all\n end", "def info\n @iiif_url = \"#{ENV['PROXIED_IIIF_SERVER_URL']}#{trailing_slash_fix}#{identifier}/info.json\"\n Rails.logger.info(\"Trying to proxy info from #{@iiif_url}\")\n response.set_header('Access-Control-Allow-Origin', '*')\n send_info(@iiif_url)\n end", "def get_server_comments\n begin\n params[:server_id] ? server_id = params[:server_id] : server_id = \"\"\n server = Server.where(\"id = ?\", server_id).first\n if server.nil?\n return render :status => 404, :json=>{:status=>:failed,:error=>\"Invalid Server\"}\n else\n @info = Server.find_by_sql(\"SELECT s.id FROM servers s WHERE s.id=#{server_id}\").first\n sql=\"SELECT sr.id, sr.server_id, sr.rating, sr.text,\n u.id as user_id, u.username, sr.created_at, sr.updated_at\n FROM server_ratings sr\n JOIN users u ON u.id = sr.user_id\n WHERE server_id=?\n ORDER BY sr.updated_at DESC\"\n\n limit = params[:limit]\n offset = params[:offset]\n if (!limit.nil? && !offset.nil?)\n sql << \" LIMIT #{limit} OFFSET #{offset}\"\n end\n @server_comments = find_by_sql(ServerRating, sql, server_id)\n end #end server.nil?\n rescue\n render :status => 503, :json =>{:status=>:failed}\n end\n end", "def info &block\n em_get( \"/clients/#{uuid}\" ) { |response| block.call( response ) }\n end", "def show\n client= Client.find_by_id params[:id]\n if client != nil\n render(json: client, status: 200) \n else\n head 404\n end \n end", "def show\n @sitio = Sitio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sitio }\n end\n end", "def index\n #@server_nodes = ServerNode.all, :order => 'created_at DESC'\n \n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @server_nodes }\n end\n end", "def new\n @game_server = Game::Server.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @game_server }\n end\n end", "def get_json()\n\n http = Net::HTTP.new(STATUS_URI.host, STATUS_URI.port)\n http.use_ssl = false\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Get.new(\"/api/services.json\")\n\n response = http.request(request)\n JSON.parse(response.body)\nend", "def show\n render json: @client\n end", "def index\n @servers = @site.servers\n end", "def index\n @servers = Server.all\n end", "def index\n @servers = Server.all\n end", "def index\n @servers = Server.all\n end", "def index\n @servers = Server.all\n end", "def index\n @servers = Server.all\n end", "def show\n @info_page = InfoPage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @info_page }\n end\n end", "def show\n @resource_info = ResourceInfo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @resource_info }\n end\n end", "def index\n @servers = Server.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @servers.to_json(:include => { :websites => {:include => :plugins } }) }\n end\n end", "def server_status\n http_get(:uri=>\"/server/status\", :fields=>x_cookie)\n end", "def show\n @host = Host.find_by(hostname: params[:id])\n\n render json: @host\n end", "def index\n @zabbix_servers = ZabbixServer.all\n\n respond_to do |format|\n format.json\n format.html\n end\n end", "def info() \n \treturn self.response.info()\n\tend", "def index\r\n @servers = Server.all\r\n end", "def show\n @person_info = PersonInfo.find(params[:id])\n\n render json: @person_info\n end", "def nameserver_info\n facts.fetch(\"Nameserver\", {})\n end", "def details\n data = Storm::Base::SODServer.remote_call '/Server/details',\n :uniq_id => @uniq_id\n self.from_hash data\n end", "def new\n @server_node = ServerNode.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @server_node }\n end\n end", "def show\n @servicio = Servicio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @servicio }\n end\n end", "def show\n\t\t@client = Client.find(params[:id])\n\t\tif @client.status != 0\n\t\t\trender :json => @client, status: 200\n\t\telse\n\t\t\trender :json => @client.status, status: 400\n\t\tend\n\tend", "def show\n info=Infocounter.find(params[:id])\n render json:{status: 'SUCCESS', message: 'Details By Info Counter', data:info},status: :ok\n end", "def information\n begin\n # TODO HIGH prateekm: Update this section\n gather_info if stale?\n self\n rescue Services::NotFoundException => e\n #self.destroy\n {'error' => e.message}.to_json\n end\n end" ]
[ "0.7632482", "0.74078155", "0.7344179", "0.72670954", "0.719779", "0.71064585", "0.7093832", "0.7093832", "0.707999", "0.706134", "0.699807", "0.6989398", "0.6863124", "0.6851943", "0.68321496", "0.6794796", "0.6750907", "0.6720037", "0.6710388", "0.67014265", "0.66739947", "0.66564155", "0.661686", "0.6614623", "0.6605286", "0.6427965", "0.641819", "0.6410913", "0.6361683", "0.6361683", "0.63577616", "0.63577616", "0.6353125", "0.63496584", "0.6303989", "0.63030297", "0.63030297", "0.6292776", "0.6276389", "0.62297726", "0.6226464", "0.6207227", "0.6186524", "0.6180886", "0.6173238", "0.6141522", "0.6116317", "0.61063397", "0.6099529", "0.60931563", "0.6088123", "0.6049378", "0.60409725", "0.60385954", "0.60360783", "0.6035086", "0.60279477", "0.601648", "0.59922695", "0.598733", "0.59606886", "0.5959743", "0.5947657", "0.5942289", "0.59312844", "0.59286404", "0.5922757", "0.5916616", "0.590378", "0.5902403", "0.5859257", "0.5851296", "0.5842847", "0.5833777", "0.58203095", "0.5818955", "0.5818636", "0.58155066", "0.5814753", "0.58127266", "0.58127266", "0.58127266", "0.58127266", "0.58127266", "0.5812535", "0.5803101", "0.5795599", "0.5789672", "0.57883364", "0.57853025", "0.57810295", "0.5771225", "0.5768522", "0.57642984", "0.575238", "0.5739482", "0.5731702", "0.5727888", "0.5727531", "0.5716337" ]
0.7817296
0
GET /server_infos/new GET /server_infos/new.json
def new @server_info = ServerInfo.new respond_to do |format| format.html # new.html.erb format.json { render json: @server_info } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @server = Server.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @server }\n end\n end", "def new\n @server = Server.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @server }\n end\n end", "def new\n authenticate_user!\n @server = Server.new\n @rackspace_servers = Server.rackspace_servers\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @server }\n end\n end", "def new\n @server_node = ServerNode.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @server_node }\n end\n end", "def create\n @server_info = ServerInfo.new(params[:server_info])\n\n respond_to do |format|\n if @server_info.save\n format.html { redirect_to @server_info, notice: 'Server info was successfully created.' }\n format.json { render json: @server_info, status: :created, location: @server_info }\n else\n format.html { render action: \"new\" }\n format.json { render json: @server_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @server = Server.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.js # new.js.erb\n format.json { render json: @server }\n end\n end", "def new\n @server = Server.new\n\n @server_options = Server.all.map{|u| [ u.server_name, u.id ] }\n # @server_ips = Server.all.map{|u| [ u.IP, u.id ] }\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @server }\n end\n end", "def new\n @server_instance = ServerInstance.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @server_instance }\n end\n end", "def new\n @server1 = Server1.new\n\n @server_options = Server1.all.map{|u| [ u.server_name, u.id ] }\n @server_ips = Server1.all.map{|u| [ u.IP, u.id ] }\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @server1 }\n end\n end", "def new\n @serving = Serving.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @serving }\n end\n end", "def new\n @serverroom = Serverroom.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @serverroom }\n end\n end", "def new\n @game_server = Game::Server.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @game_server }\n end\n end", "def create\n @server = @site.servers.new(server_params.merge({used_at: (Time.now - 1.day)}))\n\n respond_to do |format|\n if @server.save\n format.html { redirect_to [:admin, @site], notice: 'Server was successfully created.' }\n format.json { render action: 'show', status: :created, location: [:admin, @site] }\n else\n format.html { render action: 'new' }\n format.json { render json: @server.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @server_ins_transaction = ServerInsTransaction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @server_ins_transaction }\n end\n end", "def new\n @server = Server.new\n 1.times { @server.tags.build }\n @tags = Tag.all\n @tags_selected = [] \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @server }\n end\n end", "def create\n @server = Server.new(params[:server])\n\n respond_to do |format|\n if @server.save\n format.html { redirect_to @server, notice: 'Server was successfully created.' }\n format.json { render json: @server, status: :created, location: @server }\n else\n format.html { render action: \"new\" }\n format.json { render json: @server.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n puts \"HAHAHAHAHHA\"\n @information_request = InformationRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @information_request }\n end\n end", "def new\n @resource_info = ResourceInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource_info }\n end\n end", "def create\r\n @server = Server.new(server_params)\r\n\r\n respond_to do |format|\r\n if @server.save\r\n if current_page = new_server_path\r\n format.html { redirect_to new_server_path, notice: 'Server was successfully added.' }\r\n format.json { render :show, status: :created, location: @server }\r\n else\r\n format.html { redirect_to @server, notice: 'Server was successfully added .' }\r\n format.json { render :show, status: :created, location: @server }\r\n end\r\n else\r\n format.html { render :new }\r\n format.json { render json: @server.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def new\n @info_page = InfoPage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @info_page }\n end\n end", "def new\n @information = Information.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @information }\n end\n end", "def new\n @licserver = Licserver.new\n\n respond_to do |format|\n format.html { render :partial => 'form', :locals => { :licserver => nil } }\n\t\t\tformat.template { render :partial => 'form.html', :locals => { :licserver => nil } }\n format.json { render json: @licserver }\n end\n end", "def new\n @info_type = InfoType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @info_type }\n end\n end", "def new\n @intern = Intern.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @intern }\n end\n end", "def new\n @information = Information.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @information }\n end\n end", "def newX\n @server = Server.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @server }\n end\n end", "def new\n @sitio = Sitio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sitio }\n end\n end", "def create\n @server = Server.new(server_params)\n\n respond_to do |format|\n if @server.save\n format.html { redirect_to @server, notice: 'Server was successfully created.' }\n format.json { render :show, status: :created, location: @server }\n else\n format.html { render :new }\n format.json { render json: @server.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @domain_map = current_user.domain_maps.new\n @server_ip = server_ip\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @domain_map }\n end\n end", "def create\n authenticate_user!\n @server = Server.new(params[:server])\n\n respond_to do |format|\n if @server.save\n format.html { redirect_to @server, notice: 'Server was successfully created.' }\n format.json { render json: @server, status: :created, location: @server }\n else\n format.html { render action: \"new\" }\n format.json { render json: @server.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @block_list_server = BlockListServer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @block_list_server }\n end\n end", "def new\n @file_info = FileInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @file_info }\n end\n end", "def new\n @objects_info = ObjectsInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @objects_info }\n end\n end", "def create\n @server = Server.new(server_params)\n\n respond_to do |format|\n if @server.save\n format.html { redirect_to @server, notice: t('notice.server.created') }\n else\n format.html { render action: 'new' }\n end\n end\n end", "def new\n @host = Host.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @host }\n end\n end", "def new\n @comp_info = CompInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comp_info }\n end\n end", "def new\n @client = Client.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @client }\n end\n end", "def new\n @client = Client.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @client }\n end\n end", "def new\n @client = Client.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @client }\n end\n end", "def new\n @client = Client.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @client }\n end\n end", "def create\n @server = Server.new(params[:server])\n\n respond_to do |format|\n if @server.save\n format.html { redirect_to servers_url, flash[:info]=\"Server was successfully created.\" }\n format.js { flash[:info]=\"Server was successfully created.\" }\n format.json { render json: @server, status: :created, location: @server }\n end\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 add_breadcrumb t('model.create', model: Client.model_name.human)\n @client = Client.new\n @client.created_by_id = current_user.id\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @client }\n end\n end", "def new\n @title = t('view.providers.new_title')\n @provider = Provider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end", "def new\n @info_polen = InfoPolen.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @info_polen }\n end\n end", "def new\n @info_polen = InfoPolen.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @info_polen }\n end\n end", "def new\n @generator_info = GeneratorInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @generator_info }\n end\n end", "def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site }\n end\n end", "def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site }\n end\n end", "def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site }\n end\n end", "def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site }\n end\n end", "def new\n @notify = Notify.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @notify }\n end\n end", "def new\n @stat = Stat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stat }\n end\n end", "def new\n @system_information = SystemInformation.new\n\n \n\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @system_information }\n end\n end", "def new\n @ip = Ip.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ip }\n end\n end", "def new\n @servicio = Servicio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @servicio }\n end\n end", "def new\n #@updateavail = Updateavail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @updateavail }\n end\n end", "def new\n @stat = Stat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @stat }\n end\n end", "def new\n @site = Site.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site }\n end\n end", "def new\n @line_station = LineStation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @line_station }\n end\n end", "def new\n @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 #@instance = Instance.new\n @instance.url = \"http://#{request.host}\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @instance }\n end\n end", "def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @request }\n end\n end", "def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @request }\n end\n end", "def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @request }\n end\n end", "def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @request }\n end\n end", "def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @request }\n end\n end", "def new\n add_breadcrumb t('model.create', model: Client.model_name.human)\n @client = Client.new\n @client.created_by = current_user.id\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @client }\n end\n end", "def new\n @internship = Internship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @internship }\n end\n end", "def new\n @internship = Internship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @internship }\n end\n end", "def new\n @info = Info.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @info }\n end\n end", "def new\n @info = Info.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @info }\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 new\n @item_info = ItemInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item_info }\n end\n end", "def new\n @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 @station = Station.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @station }\n end\n end", "def new\n @station = Station.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @station }\n end\n end", "def create\n @game_server = Game::Server.new(params[:game_server])\n\n respond_to do |format|\n if @game_server.save\n format.html { redirect_to @game_server, notice: 'Server was successfully created.' }\n format.json { render json: @game_server, status: :created, location: @game_server }\n else\n format.html { render action: \"new\" }\n format.json { render json: @game_server.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @notice = @person.notices.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @notice }\n end\n end", "def new\n @latestinfo = Latestinfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @latestinfo }\n end\n end", "def new\n @getoff_info = GetoffInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @getoff_info }\n end\n end", "def new\n @update = Update.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @update }\n end\n end", "def new\n @clients = get_clients\n @client = Client.new\n\n respond_to do |format|\n format.js # new.js.erb\n end\n end", "def new\n @newapp = Newapp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newapp }\n end\n end", "def new\n @stable = Stable.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stable }\n end\n end", "def new\n @mi = Mi.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mi }\n end\n end", "def new\n @update = Update.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @update }\n end\n end", "def new\n @version = Version.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @version }\n end\n end", "def new\n @board_info = BoardInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @board_info }\n end\n end", "def new\n @hostela = Hostela.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hostela }\n end\n end", "def create\n @server = Server.new(server_params)\n if @server.save\n @server.generate_unique_invite_code\n firstMember =\n ServerMember.new(server_id: @server.id, member_id: @server.owner_id)\n if firstMember.save\n gen_channel =\n Channel.create(\n channel_name: 'general',\n server_id: @server.id,\n channel_type: 0,\n owner_id: @server.owner_id,\n )\n firstChannelMember =\n Channelmember.new(\n channel_id: gen_channel.id,\n recipient_id: @server.owner_id,\n )\n if firstChannelMember.save\n @servers = current_user.membered_servers\n render json: @servers, include: %i[channels members]\n end\n else\n render json: @server.errors.full_messages, status: 422\n end\n else\n render json: @server.errors.full_messages, status: 422\n end\n end", "def new\n @notify_observer = NotifyObserver.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @notify_observer }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource }\n end\n end", "def new\n @servicetype = Servicetype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @servicetype }\n end\n end", "def new\n session[:current] = 'menu_clients'\n @client = Client.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @client }\n end\n end", "def new\n @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 @registry = Registry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @registry }\n end\n end", "def create\n @server = Server.new(server_params)\n @server.session_id = request.session.id\n\n respond_to do |format|\n if @server.save\n format.html { redirect_to @server, notice: 'Server was successfully created.' }\n format.json { render :show, status: :created, location: @server }\n else\n format.html { render :new }\n format.json { render json: @server.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @server_rack = ServerRack.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @server_rack }\n end\n end", "def new\n @holder = Holder.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @holder }\n end\n end" ]
[ "0.7815124", "0.7815124", "0.74888957", "0.74751145", "0.74647427", "0.74019176", "0.7374422", "0.736835", "0.7130959", "0.6979633", "0.6953689", "0.6943579", "0.68458986", "0.6766609", "0.6716958", "0.67087966", "0.67079306", "0.6676945", "0.6673384", "0.6650428", "0.664408", "0.6639028", "0.6629853", "0.6625342", "0.66188073", "0.66050035", "0.65871817", "0.6584181", "0.65767354", "0.6566237", "0.64809585", "0.6468411", "0.64624184", "0.6439155", "0.6413912", "0.6399214", "0.6388477", "0.6388477", "0.6388477", "0.6388477", "0.63874274", "0.6375902", "0.636967", "0.63651985", "0.635725", "0.635725", "0.63564324", "0.63389236", "0.63389236", "0.63389236", "0.63389236", "0.63310486", "0.63258636", "0.63180435", "0.6315367", "0.6314495", "0.6314367", "0.6311072", "0.63046014", "0.6303104", "0.6303025", "0.6299455", "0.629907", "0.629907", "0.629907", "0.629907", "0.629907", "0.62822866", "0.6281827", "0.6281827", "0.6281528", "0.6281528", "0.6276012", "0.6270646", "0.62649786", "0.6262371", "0.6262371", "0.6261862", "0.62591565", "0.6257219", "0.62540644", "0.6253141", "0.6244999", "0.6224074", "0.6221697", "0.62151676", "0.62150055", "0.62137794", "0.6206332", "0.6200207", "0.6199792", "0.6197807", "0.6197782", "0.61942416", "0.6194003", "0.61939466", "0.6190398", "0.6184422", "0.6183154", "0.6181607" ]
0.8186276
0
POST /server_infos POST /server_infos.json
def create @server_info = ServerInfo.new(params[:server_info]) respond_to do |format| if @server_info.save format.html { redirect_to @server_info, notice: 'Server info was successfully created.' } format.json { render json: @server_info, status: :created, location: @server_info } else format.html { render action: "new" } format.json { render json: @server_info.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @server_info = ServerInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @server_info }\n end\n end", "def new\n @server = Server.new\n\n @server_options = Server.all.map{|u| [ u.server_name, u.id ] }\n # @server_ips = Server.all.map{|u| [ u.IP, u.id ] }\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @server }\n end\n end", "def info\n result = []\n Server.all.each do |server|\n result << server.short_result\n end\n\n status_key = makeStatusKey(result)\n render :json => {servers:result}.merge(status_key)\n\n end", "def create\n @server = Server.new(server_params)\n\n respond_to do |format|\n if @server.save\n format.html { redirect_to @server, notice: 'Server was successfully created.' }\n format.json { render :show, status: :created, location: @server }\n else\n format.html { render :new }\n format.json { render json: @server.errors, status: :unprocessable_entity }\n end\n end\n end", "def server_info\n return @server_info if @server_info.present?\n response = request :get, SERVER_INFO_PATH\n @server_info = response.error? ? nil :\n response.result.with_indifferent_access\n end", "def create\n @server = Server.new(params[:server])\n\n respond_to do |format|\n if @server.save\n format.html { redirect_to @server, notice: 'Server was successfully created.' }\n format.json { render json: @server, status: :created, location: @server }\n else\n format.html { render action: \"new\" }\n format.json { render json: @server.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n authenticate_user!\n @server = Server.new(params[:server])\n\n respond_to do |format|\n if @server.save\n format.html { redirect_to @server, notice: 'Server was successfully created.' }\n format.json { render json: @server, status: :created, location: @server }\n else\n format.html { render action: \"new\" }\n format.json { render json: @server.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @server = Server.new(server_params)\n @server.session_id = request.session.id\n\n respond_to do |format|\n if @server.save\n format.html { redirect_to @server, notice: 'Server was successfully created.' }\n format.json { render :show, status: :created, location: @server }\n else\n format.html { render :new }\n format.json { render json: @server.errors, status: :unprocessable_entity }\n end\n end\n end", "def details\n data = servers_client.get(server_path, json_headers).body\n JSON.parse(data)['server']\n end", "def new\n authenticate_user!\n @server = Server.new\n @rackspace_servers = Server.rackspace_servers\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @server }\n end\n end", "def create\n @server = @site.servers.new(server_params.merge({used_at: (Time.now - 1.day)}))\n\n respond_to do |format|\n if @server.save\n format.html { redirect_to [:admin, @site], notice: 'Server was successfully created.' }\n format.json { render action: 'show', status: :created, location: [:admin, @site] }\n else\n format.html { render action: 'new' }\n format.json { render json: @server.errors, status: :unprocessable_entity }\n end\n end\n end", "def server_info!\n @server_info = nil\n server_info\n end", "def create\n @server = Server.new(params[:server])\n @server.tags = params[:tag_ids].map { |id| Tag.find(id) }\n\n respond_to do |format|\n if @server.save\n format.html { redirect_to servers_path, notice: 'Server was successfully created.' }\n format.json { render json: @server, status: :created, location: @server }\n else\n format.html { render action: \"new\" }\n format.json { render json: @server.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @server = Server.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @server }\n end\n end", "def new\n @server = Server.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @server }\n end\n end", "def show\n @server_info = ServerInfo.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @server_info }\n end\n end", "def info\n response = rpc.request Riakpb::Util::MessageCode::GET_SERVER_INFO_REQUEST\n\n @node = response.node\n @server_version = response.server_version\n\n {:node => @node, :server_version => @server_version}\n end", "def server_params\n params.require(:server).permit(:name, :description, :ip)\n end", "def create\n @app_server = AppServer.new(app_server_params)\n\n respond_to do |format|\n if @app_server.save\n format.html { redirect_to @app_server, notice: 'App server was successfully created.' }\n format.json { render :show, status: :created, location: @app_server }\n else\n format.html { render :new }\n format.json { render json: @app_server.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @server1 = Server1.new\n\n @server_options = Server1.all.map{|u| [ u.server_name, u.id ] }\n @server_ips = Server1.all.map{|u| [ u.IP, u.id ] }\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @server1 }\n end\n end", "def create\n @server = Server.new(server_params)\n if @server.save\n @server.generate_unique_invite_code\n firstMember =\n ServerMember.new(server_id: @server.id, member_id: @server.owner_id)\n if firstMember.save\n gen_channel =\n Channel.create(\n channel_name: 'general',\n server_id: @server.id,\n channel_type: 0,\n owner_id: @server.owner_id,\n )\n firstChannelMember =\n Channelmember.new(\n channel_id: gen_channel.id,\n recipient_id: @server.owner_id,\n )\n if firstChannelMember.save\n @servers = current_user.membered_servers\n render json: @servers, include: %i[channels members]\n end\n else\n render json: @server.errors.full_messages, status: 422\n end\n else\n render json: @server.errors.full_messages, status: 422\n end\n end", "def create_server(zone: \"fi-hel1\", title:, hostname:, core_number: 1,\n memory_amount: 1024, storage_devices:, ip_addresses: :all)\n data = {\n \"server\" => {\n \"zone\" => zone,\n \"title\" => title,\n \"hostname\" => hostname,\n \"core_number\" => core_number,\n \"memory_amount\" => memory_amount,\n \"storage_devices\" => { \"storage_device\" => storage_devices }\n }\n }\n\n if ip_addresses != :all\n ips = []\n ips << { \"access\" => \"public\", \"family\" => \"IPv4\" } if ip_addresses.include? :public\n ips << { \"access\" => \"private\", \"family\" => \"IPv4\" } if ip_addresses.include? :private\n ips << { \"access\" => \"public\", \"family\" => \"IPv6\" } if ip_addresses.include? :ipv6\n\n data[\"server\"][\"ip_addresses\"] = {}\n data[\"server\"][\"ip_addresses\"][\"ip_address\"] = ips\n end\n\n json = JSON.generate data\n response = post \"server\", json\n response\n end", "def create\n @server = Server.new(params[:server])\n\n respond_to do |format|\n if @server.save\n format.html { redirect_to servers_url, flash[:info]=\"Server was successfully created.\" }\n format.js { flash[:info]=\"Server was successfully created.\" }\n format.json { render json: @server, status: :created, location: @server }\n end\n end\n end", "def server_params\n params.require(:server).permit(:name, :addr, :endpoint, :api_key, :api_secret)\n end", "def create\n @mock_server = MockServer.new(mock_server_params)\n\n respond_to do |format|\n if @mock_server.save\n format.json { render :show, status: :created, location: @mock_server }\n else\n format.json { render json: @mock_server.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @server = Server.new(server_params)\r\n\r\n respond_to do |format|\r\n if @server.save\r\n if current_page = new_server_path\r\n format.html { redirect_to new_server_path, notice: 'Server was successfully added.' }\r\n format.json { render :show, status: :created, location: @server }\r\n else\r\n format.html { redirect_to @server, notice: 'Server was successfully added .' }\r\n format.json { render :show, status: :created, location: @server }\r\n end\r\n else\r\n format.html { render :new }\r\n format.json { render json: @server.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @server = Server.new(server_params)\n\n respond_to do |format|\n if @server.save\n format.html { redirect_to @server, notice: t('notice.server.created') }\n else\n format.html { render action: 'new' }\n end\n end\n end", "def server_info()\n #This is a stub, used for indexing\n end", "def servers\n response = get \"server\"\n data = JSON.parse response.body\n data[\"servers\"][\"server\"]\n end", "def servers\n response = get \"server\"\n data = JSON.parse response.body\n data[\"servers\"][\"server\"]\n end", "def server_info\n db(\"admin\").command({:buildinfo => 1}, {:admin => true, :check_response => true})\n end", "def create\n @server_instance = ServerInstance.new(params[:server_instance])\n\n respond_to do |format|\n if @server_instance.save\n format.html { redirect_to @server_instance, notice: 'Server instance was successfully created.' }\n format.json { render json: @server_instance, status: :created, location: @server_instance }\n else\n format.html { render action: \"new\" }\n format.json { render json: @server_instance.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @server_instance = ServerInstance.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @server_instance }\n end\n end", "def server_params\n params.require(:server).permit(:name, :ip)\n end", "def servers_detailed()\n return get_request(address(\"/servers/detail\"), @token)\n end", "def server_params\n params.require(:server).permit(:ip, :sn, :os, :purchase_time, :server_size_id)\n end", "def server_info\n check_connection\n @protocol.server_info\n end", "def new\n @server_node = ServerNode.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @server_node }\n end\n end", "def create\n @server_record = ServerRecord.new(server_record_params)\n\n respond_to do |format|\n if @server_record.save\n format.html { redirect_to @server_record, notice: 'Server record was successfully created.' }\n format.json { render :show, status: :created, location: @server_record }\n else\n format.html { render :new }\n format.json { render json: @server_record.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @gameserver = Gameserver.new(server_params)\n\n respond_to do |format|\n if @gameserver.save\n format.html { redirect_to @gameserver, notice: 'Server was successfully created.' }\n format.json { render :show, status: :created, location: @gameserver }\n else\n format.html { render :new }\n format.json { render json: @gameserver.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @gameserver = Gameserver.new(server_params)\n\n respond_to do |format|\n if @gameserver.save\n format.html { redirect_to @gameserver, notice: 'Server was successfully created.' }\n format.json { render :show, status: :created, location: @gameserver }\n else\n format.html { render :new }\n format.json { render json: @gameserver.errors, status: :unprocessable_entity }\n end\n end\n end", "def server_params\n params.permit(:uuid, :addr, :port, :status)\n end", "def create\n @game_server = Game::Server.new(params[:game_server])\n\n respond_to do |format|\n if @game_server.save\n format.html { redirect_to @game_server, notice: 'Server was successfully created.' }\n format.json { render json: @game_server, status: :created, location: @game_server }\n else\n format.html { render action: \"new\" }\n format.json { render json: @game_server.errors, status: :unprocessable_entity }\n end\n end\n end", "def server_params\n params.require(:server).permit(:user_id, :category_id, :ip, :vip, :port, :banner, :name, :country, :description, :website, :youtube_id, :votes, :disabled, :status, :votifier_key, :votifier_ip, :votifier_port, :players, :max_players, :server_version, :cache_time, :protocol)\n end", "def server_info\n {:node => \"riak@#{node.host}\", :server_version => '2.0'}\n end", "def create_server\n\n end", "def info\n response = from_server \"api/info.json\"\n response.data\n end", "def create\n @server = Server.new(server_params)\n @server.user = current_user\n\n respond_to do |format|\n if @server.save\n format.html { redirect_to @server, notice: 'Server was successfully created.' }\n else\n format.html { render action: 'new' }\n end\n end\n end", "def server_params\r\n params.require(:server).permit(:host_name, :ip_address, :operating_system, :cpu_cores, :memory, :disk_space, :form_id)\r\n end", "def server_params\n params.require(:server).permit(:name, :host, :username, :password, :constant_id)\n end", "def create\n @server1 = Server1.new(params[:server1])\n #@roles1.assigned_privileges_id = params[:assigned_privileges_id].to_s\n @server1.IP = params[:IP].to_s\n @server1.IPRouting = params[:IPRouting].to_s\n\n #@users1.projects_assigned = params[:projects_assigned].to_s\n puts \"=====create =====\"\n puts params[:IP].to_s\n puts @server1.IP\n puts \"=====end =====\"\n respond_to do |format|\n if @server1.save\n format.html { redirect_to @server1, notice: 'Server was successfully created.' }\n format.json { render json: @server1, status: :created, location: @server1 }\n else\n format.html { render action: \"new\" }\n format.json { render json: @server1.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @server = Server.new(server_params)\n @server.user_id = current_user.id\n cats = params[:server][:category_id]\n\n respond_to do |format|\n if @server.save\n\n cats.each do |c|\n unless c.empty?\n stc = ServersToCategories.new\n stc.category_id = c\n stc.server_id = @server.id\n\n stc.save\n end\n end\n\n format.html { redirect_to @server, notice: 'Server was successfully created.' }\n format.json { render :show, status: :created, location: @server }\n else\n format.html { render :new }\n format.json { render json: @server.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #@server_node = ServerNode.new(params[:server_node])\n #@server_node = ServerNode.create() do |n|\n # n.name = params[:node][:name]\n\t# n.region = params[:node][:region]\n\t# n.status = params[:node][:status]\n\n #end\n\n respond_to do |format|\n if @server_node.save\n format.html { redirect_to @server_node, notice: 'Server node was successfully created.' }\n format.json { render json: @server_node, status: :created, location: @server_node }\n else\n format.html { render action: \"new\" }\n format.json { render json: @server_node.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @server = Server.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.js # new.js.erb\n format.json { render json: @server }\n end\n end", "def info\n connection.server_info\n end", "def add_server(service_id, server={})\n request :post, \"/services/#{service_id}/servers\"\n end", "def server_params\n params.require(:server).permit(:host, :session_id)\n end", "def create\n @server = Server.new(params[:server])\n @server.account_id = @oeaccount.id \n respond_to do |format|\n if @server.save\n @server.send_create\n # NOTE TO MYSELF YOU NEED TO CHECK IF THE DEPLOYMENTS AND ROLES BELONG TO THE USER\n\tif params[:deployment_ids]\n #@server.deployments << Deployment.find(params[:deployments][:ids])\n @server.deployment_ids = params[:deployment_ids]\n\tend\n\tif params[:role_ids]\n #@server.roles << Role.find(params[:roles][:ids])\n @server.role_ids = params[:role_ids]\n\tend\n format.html { redirect_to servers_url, notice: 'Server was successfully created.' }\n format.json { render json: @server, status: :created, location: @server }\n else\n format.html { render action: \"new\" }\n format.json { render json: @server.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @info = Info.new(info_params)\n\n respond_to do |format|\n if @info.save\n format.html { redirect_to @info, notice: 'Info was successfully created.' }\n format.json { render :show, status: :created, location: @info }\n else\n format.html { render :new }\n format.json { render json: @info.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @info = Info.new(info_params)\n\n respond_to do |format|\n if @info.save\n format.html { redirect_to @info, notice: 'Info was successfully created.' }\n format.json { render :show, status: :created, location: @info }\n else\n format.html { render :new }\n format.json { render json: @info.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @server = Server.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @server }\n end\n end", "def server_params\n params.require(:server).permit(:instance_id, :name, :public_ip, :private_ip, :flavor, :image, :ssh_key_name, :security_groups, :state)\n end", "def server_params\n params.require(:server).permit(:name)\n end", "def update_server_info\n @adapter.update_server_info(repository_path.to_s)\n end", "def show\n puts \"=================show=================\"\n @server = Server.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @server }\n end\n end", "def new\n @server = Server.new\n 1.times { @server.tags.build }\n @tags = Tag.all\n @tags_selected = [] \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @server }\n end\n end", "def show\n @server = Server.find(params[:id])\n checkaccountobject(\"servers\",@server)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @server }\n end\n end", "def update\n @server_info = ServerInfo.find(params[:id])\n\n respond_to do |format|\n if @server_info.update_attributes(params[:server_info])\n format.html { redirect_to @server_info, notice: 'Server info was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @server_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @info_request = InfoRequest.new(info_request_params)\n\n respond_to do |format|\n if @info_request.save\n format.html { redirect_to @info_request, notice: 'Solicitud de información enviada.' }\n format.json { render :show, status: :created, location: @info_request }\n else\n format.html { render :new }\n format.json { render json: @info_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def servers\n endpoint = 'https://pcs.baidu.com/rest/2.0/pcs/manage?method=listhost'\n @res = @api.request_json( endpoint )\n end", "def create\n\t\t#sanity checks\n\t\tif params[:'licserver-tags'].empty? || params[:'licserver-location'].empty? then\n\t\t\trender :nothing => true, :status => :bad_request\n\t\t\treturn\n\t\tend\n\n\t\tmatch_data = /(?<port_id>\\d*)@(?<server_id>[\\w.-]+)/.match( params[:'licserver-location'])\n\n\t\t#start creating\n\t\tlicserver = Licserver.new( :port => match_data[:port_id], :server => match_data[:server_id])\n\n\t\tif licserver.save! then\n\t\t\t#update licserver features\n\t\t\tlicserver.update_features\n\n\t\t\t#add the proper tags\n\t\t\tparams[:'licserver-tags'].split.each{ |x| Tag.new(:title => x.downcase, :licserver_id => licserver.id ).save! }\n\t\t\trender :nothing => true, :status => :ok\n\t\t\treturn\n\t\telse\n\t\t\trender :nothing => true, :status => :bad_request\n\t\t\treturn\n\t\tend\n\tend", "def create\n @server_monitor_log = ServerMonitorLog.new(server_monitor_log_params)\n\n respond_to do |format|\n if @server_monitor_log.save\n format.html { redirect_to @server_monitor_log, notice: 'Server monitor log was successfully created.' }\n format.json { render :show, status: :created, location: @server_monitor_log }\n else\n format.html { render :new }\n format.json { render json: @server_monitor_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def nameserver_info\n facts.fetch(\"Nameserver\", {})\n end", "def create_server(params)\n body = connection.post(\"/v2/servers/#{account}\", params).body\n async_response(body)\n end", "def create\n @bot_server = BotServer.new(bot_server_params)\n\n respond_to do |format|\n if @bot_server.save\n format.html { redirect_to bot_servers_path, notice: 'Bot server was successfully created.' }\n format.json { render action: 'show', status: :created, location: @bot_server }\n else\n format.html { render action: 'new' }\n format.json { render json: @bot_server.errors, status: :unprocessable_entity }\n end\n end\n end", "def infos_update\n device_uid = @device.uid\n device_info_post = params.except(:controller, :action, :uid, :tk)\n\n device_info_post.each do |key, value|\n device_info = DeviceInfo.where(device_uid: device_uid, stat_name: key).take\n if (!device_info.nil?)\n device_info.value = value\n device_info.last_update_at = Time.now.to_formatted_s(:db)\n device_info.save()\n else\n device_info = DeviceInfo.new\n device_info.device_uid = device_uid\n device_info.stat_name = key\n device_info.value = value\n device_info.last_update_at = Time.now.to_formatted_s(:db)\n device_info.save()\n end\n end\n\n render plain: ActiveSupport::JSON.encode({ res: :ok })\n end", "def show\n @name_server = NameServer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @name_server }\n end\n end", "def createX\n @server = Server.new(params[:server])\n\n respond_to do |format|\n if @server.save\n format.html { redirect_to(@server, :notice => 'Server was successfully created.') }\n format.xml { render :xml => @server, :status => :created, :location => @server }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @server.errors, :status => :unprocessable_entity }\n end\n end\n end", "def serverDetails( port )\n @port = port\n end", "def serverDetails( port )\n @port = port\n end", "def server_params\n params.require(:server).permit(:login, :pass, :domain, :host)\n end", "def create\n @machine_info = MachineInfo.new(machine_info_params)\n\n respond_to do |format|\n if @machine_info.save\n format.html { redirect_to @machine_info, notice: 'Machine info was successfully created.' }\n format.json { render :show, status: :created, location: @machine_info }\n else\n format.html { render :new }\n format.json { render json: @machine_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @game_server = Game::Server.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @game_server }\n end\n end", "def create\n @dockerserver = Dockerserver.new(dockerserver_params)\n\n respond_to do |format|\n if @dockerserver.save\n format.html { redirect_to @dockerserver, notice: 'Dockerserver was successfully created.' }\n format.json { render :show, status: :created, location: @dockerserver }\n else\n format.html { render :new }\n format.json { render json: @dockerserver.errors, status: :unprocessable_entity }\n end\n end\n end", "def server\n arrayCommand( \"show server\", DictArray, RESPONSE_SERVER_INFO_FOLLOWS )\n end", "def server\n arrayCommand( \"show server\", DictArray, RESPONSE_SERVER_INFO_FOLLOWS )\n end", "def create\n @server = Server.new(server_params)\n @neo = Neography::Rest.new\n\n respond_to do |format|\n if @server.save && n = Neography::Node.create(\"name\" => server_params[:name])\n n.add_to_index('servers', 'name', server_params[:name])\n n.id = n.neo_id # this construct should be improved..\n format.html { redirect_to @server, notice: 'Server was successfully created.' }\n format.json { render :show, status: :created, location: @server }\n else\n format.html { render :new }\n format.json { render json: @server.errors, status: :unprocessable_entity }\n end\n end\n end", "def read_host_info\n json { execute_prlctl('server', 'info', '--json') }\n end", "def update_server(server, ec2_info)\n server[0] = ec2_info[1] # ec2_id\n server[3] = ec2_info[3] # public host\n server[4] = ec2_info[16] # public ip\n server[5] = ec2_info[4] # private host\n server[6] = ec2_info[17] # private ip\nend", "def server_params\n\t\t\tparams.require(:server).permit(:name, :description, :password, :admin_password)\n\t\tend", "def create\n @sekilas_info = SekilasInfo.new(sekilas_info_params)\n\n respond_to do |format|\n if @sekilas_info.save\n format.html { redirect_to @sekilas_info, notice: 'Sekilas info was successfully created.' }\n format.json { render action: 'show', status: :created, location: @sekilas_info }\n else\n format.html { render action: 'new' }\n format.json { render json: @sekilas_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_servers\n # use \"rsc\" tool to get detailed deployment + server view from api 1.6, not supported by right_api_client\n old_deployment = JSON.parse(`rsc -a #{@options[:src]} cm16 show /api/deployments/#{@options[:deployment]} view=full`)\n\n old_deployment['servers'].each do |server|\n @api.account_id = @options[:src]\n name = server['next_instance']['name']\n\n puts \"Creating server: #{name} ...\\n\"\n\n cloud = find_cloud(server['next_instance']['links']['cloud']['href'], name)\n @api.account_id = @options[:src]\n\n ssh_key = choose_ssh_key(cloud)\n @api.account_id = @options[:src]\n\n instance_type = choose_instance_type(cloud)\n old_st_url = server['next_instance']['server_template']['href']\n new_st_url = @server_templates[old_st_url]['new_st_url']\n \n mci = choose_mci(new_st_url)\n @api.account_id = @options[:src]\n\n subnets = choose_subnets(cloud)\n @api.account_id = @options[:src]\n\n security_groups = choose_security_groups(cloud)\n @api.account_id = @options[:src]\n\n inputs_hash = format_inputs(@api.resource(server['next_instance']['href']).show.inputs)\n\n # Create server\n params = {}\n params[:server] = {}\n params[:server][:name] = name\n params[:server][:deployment_href] = @new_deployment\n params[:server][:instance] = {}\n params[:server][:instance][:cloud_href] = cloud\n params[:server][:instance][:server_template_href] = new_st_url\n params[:server][:instance][:ssh_key_href] = ssh_key if ssh_key\n params[:server][:instance][:instance_type_href] = instance_type\n params[:server][:instance][:multi_cloud_image_href] = mci\n params[:server][:instance][:subnet_hrefs] = subnets if subnets\n params[:server][:instance][:security_group_hrefs] = security_groups\n params[:server][:instance][:inputs] = inputs_hash\n @api.account_id = @options[:dst]\n @api.servers.create(params)\n end\nend", "def server_settings\n [\n {\n url: \"https://pinning-service.example.com\",\n description: \"No description provided\",\n }\n ]\n end", "def server_settings\n [\n {\n url: \"https://pinning-service.example.com\",\n description: \"No description provided\",\n }\n ]\n end", "def create\n #@server = Server.new(params[:server])\n @category = Category.find(params[:category_id])\n @server = @category.servers.build(params[:server])\n\n respond_to do |format|\n if @server.save\n flash[:notice] = 'Server was successfully created.'\n format.html { redirect_to(@server) }\n format.xml { render :xml => @server, :status => :created, :location => @server }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @server.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @information = Information.new(information_params)\n\n if @information.save\n render json: :ok\n else\n render json: @information.errors, status: :unprocessable_entity\n end\n end", "def create\n @info = Info.new(params[:info])\n if @info.save\n redirect_to infos_path, :notice => 'Info was successfully created.'\n else\n render :action => \"new\"\n end\n end", "def new\n @server_ins_transaction = ServerInsTransaction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @server_ins_transaction }\n end\n end", "def real_server_create (network-id, name, serverId, inService)\n org_endpoint \"/network/#{network_id}/realServer\"\n xml_params(name: name, serverId: serverId, inService: inService)\n post\n end", "def index\n @servers = Server.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @servers }\n end\n end" ]
[ "0.6858404", "0.6665254", "0.6520468", "0.6514328", "0.6437755", "0.6425043", "0.64216435", "0.6335646", "0.62769574", "0.62668175", "0.6262841", "0.6225919", "0.62258923", "0.6202646", "0.6202646", "0.6192489", "0.6184717", "0.6174436", "0.61734205", "0.6169153", "0.6150943", "0.61448896", "0.61128336", "0.60755706", "0.60687596", "0.6057064", "0.60382736", "0.6008703", "0.60017645", "0.60017645", "0.5976673", "0.59743994", "0.5969755", "0.59629136", "0.595706", "0.59243226", "0.591232", "0.5898621", "0.5894208", "0.58938456", "0.58938456", "0.58854616", "0.5849496", "0.5833471", "0.581654", "0.58016384", "0.5763985", "0.5752457", "0.5716713", "0.56887025", "0.56835246", "0.56667954", "0.5664901", "0.5654659", "0.5632914", "0.5628607", "0.5621638", "0.5597323", "0.5582449", "0.5582449", "0.55783963", "0.55643755", "0.55585366", "0.5556294", "0.5536815", "0.5536433", "0.55322343", "0.5519607", "0.5514991", "0.5504219", "0.5501149", "0.5489689", "0.5483193", "0.5474564", "0.54650974", "0.54217875", "0.5421561", "0.54209334", "0.54206276", "0.54206276", "0.5417121", "0.5414696", "0.5414359", "0.54119927", "0.54108894", "0.54108894", "0.53987485", "0.5374253", "0.536619", "0.5366144", "0.5365388", "0.5345227", "0.53378946", "0.53378946", "0.53375554", "0.5337313", "0.5314503", "0.5311776", "0.53077626", "0.53046215" ]
0.7411865
0
PUT /server_infos/1 PUT /server_infos/1.json
def update @server_info = ServerInfo.find(params[:id]) respond_to do |format| if @server_info.update_attributes(params[:server_info]) format.html { redirect_to @server_info, notice: 'Server info was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @server_info.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n name = Server.find(params[:id]).name\n n = Neography::Node.find('servers', 'name', name)\n n.name = server_params[:name]\n n.add_to_index('servers', 'name', server_params[:name]) #TODO: is this necessary?\n if @server.update(server_params)\n format.html { redirect_to @server, notice: 'Server was successfully updated.' }\n format.json { render :show, status: :ok, location: @server }\n else\n format.html { render :edit }\n format.json { render json: @server.errors, status: :unprocessable_entity }\n end\n end\n end", "def modify_server(server_uuid, params)\n data = { \"server\" => params }\n json = JSON.generate data\n response = put \"server/#{server_uuid}\", json\n\n response\n end", "def update\n @server = Server.find(params[:id])\n\n respond_to do |format|\n if @server.update_attributes(params[:server])\n format.html { redirect_to @server, notice: 'Server was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @server.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authenticate_user!\n @server = Server.find(params[:id])\n\n respond_to do |format|\n if @server.update_attributes(params[:server])\n format.html { redirect_to @server, notice: 'Server was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @server.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @server = Server.find(params[:id])\n checkaccountobject(\"servers\",@server)\n respond_to do |format|\n if @server.update_attributes(params[:server])\n @server.send_update\n format.html { redirect_to @server, notice: 'Server was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @server.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @server = Server.find(params[:id])\n if params[:tag_ids]\n @server.tags = params[:tag_ids].map { |id| Tag.find(id) }\n end\n respond_to do |format|\n if @server.update_attributes(params[:server])\n format.html { redirect_to servers_path, notice: 'Server was successfully updated.' }\n format.json { render json: @server, status: :updated, location: @server }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @server.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @server.update(server_params)\n format.html { redirect_to @server, notice: 'Server was successfully updated.' }\n format.json { render :show, status: :ok, location: @server }\n else\n format.html { render :edit }\n format.json { render json: @server.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @server.update(server_params)\n format.html { redirect_to @server, notice: 'Server was successfully updated.' }\n format.json { render :show, status: :ok, location: @server }\n else\n format.html { render :edit }\n format.json { render json: @server.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @server.update(server_params)\n format.html { redirect_to @server, notice: 'Server was successfully updated.' }\n format.json { render :show, status: :ok, location: @server }\n else\n format.html { render :edit }\n format.json { render json: @server.errors, status: :unprocessable_entity }\n end\n end\n end", "def put(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if info && info['meta'] && (etag = info['meta']['version'])\n hdrs.merge!('if-match' => etag)\n end\n reply = json_parse_reply(@key_style,\n *json_put(@target, \"#{path}/#{Addressable::URI.encode(id)}\", info, hdrs))\n\n # hide client endpoints that are not quite scim compatible\n type == :client && !reply ? get(type, info['client_id']): reply\n end", "def update_server_info\n @adapter.update_server_info(repository_path.to_s)\n end", "def update\n respond_to do |format|\n if @server.update(server_params)\n format.html { redirect_to servers_url, notice: 'Server was successfully updated.' }\n format.json { render :show, status: :ok, location: @server }\n else\n format.html { render :edit }\n format.json { render json: @server.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_server(server, ec2_info)\n server[0] = ec2_info[1] # ec2_id\n server[3] = ec2_info[3] # public host\n server[4] = ec2_info[16] # public ip\n server[5] = ec2_info[4] # private host\n server[6] = ec2_info[17] # private ip\nend", "def update\r\n respond_to do |format|\r\n if @server.update(server_params)\r\n format.html { redirect_to @server, notice: 'Server was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @server }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @server.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n @server1 = Server1.find(params[:id])\n\n respond_to do |format|\n if @server1.update_attributes(params[:server1])\n format.html { redirect_to @server1, notice: 'Server was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @server1.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @server = Server.find(params[:id])\n\n respond_to do |format|\n if @server.update_attributes(params[:server])\n format.html {redirect_to servers_url, flash[:info]='Server was successfully updated.' }\n format.js { flash[:info]='Server was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @server.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @server.update(server_params)\n format.html { redirect_to [:admin, @site], notice: 'Server was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @server.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @server_info = ServerInfo.new(params[:server_info])\n\n respond_to do |format|\n if @server_info.save\n format.html { redirect_to @server_info, notice: 'Server info was successfully created.' }\n format.json { render json: @server_info, status: :created, location: @server_info }\n else\n format.html { render action: \"new\" }\n format.json { render json: @server_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def updateServer(server, serverID)\n paramHash = {}\n paramHash[\"description\"] = server.description\n paramHash[\"dnsName\"] = server.dns\n paramHash[\"domainName\"] = server.domainName\n paramHash[\"emailID\"] = server.emailID\n paramHash[\"CI\"] = server.CI ? \"y\" : \"n\"\n paramHash[\"deploymentStatus\"] = server.deploymentStatus\n paramHash[\"instanceId\"] = server.instanceId\n paramHash[\"amiID\"] = server.imageID\n paramHash[\"username\"] = server.username\n paramHash[\"build\"] = server.build\n paramHash[\"appName\"] = server.appName\n paramHash[\"deployTempLoc\"] = server.deployTempLoc\n paramHash[\"buildLoc\"] = server.buildLocation\n paramHash[\"privateKeyLoc\"] = server.privateKeyLoc\n paramHash[\"publicKeyLoc\"] = server.publicKeyLoc\n paramHash[\"loginUser\"] = server.loginUser\n paramHash[\"serverType\"] = server.serverType\n paramHash[\"type\"] = \"server\"\n paramHash[\"status\"] = server.status\n paramHash[\"starttime\"] = server.startTime\n paramHash[\"provider\"] = server.provider\n paramHash[\"region\"] = server.region\n paramHash[\"cmserver\"] = server.cmserver\n paramHash[\"name\"] = server.serverName\n paramHash[\"instancesize\"] = server.instanceSize\n paramHash[\"password\"] = server.password\n paramHash[\"sshport\"] = server.sshport\n paramHash[\"tier\"] = server.tier\n\n serverUrl = @appContext.getMasterURL() + \"/applications/\" + @appContext.getProject() + \"/assets/\" + serverID \n return @cloudmunchDataService.updateDataForContext(serverUrl, @appContext.getAPIKey(), paramHash) \n end", "def update\n respond_to do |format|\n if @server.update(server_params)\n format.html { redirect_to @server, notice: 'Server was successfully updated.' }\n else\n format.html { render action: 'edit' }\n end\n end\n end", "def update\n @server = Server.find(params[:id])\n\n respond_to do |format|\n if @server.update_attributes(params[:server])\n flash[:notice] = 'Server was successfully updated.'\n format.html { redirect_to(@server) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @server.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @server_node = ServerNode.find(params[:id])\n\n respond_to do |format|\n if @server_node.update_attributes(params[:server_node])\n format.html { redirect_to @server_node, notice: 'Server node was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @server_node.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_server(server_id, server_data, opts={})\n body = { 'server' => {} }\n body['server']['name'] = server_data[:name] if server_data[:name]\n body['server']['adminPass'] = server_data[:password] if server_data[:password]\n api(:put, \"/servers/#{server_id}\", opts.merge(:body => body.to_json))\n end", "def update\n @game_server = Game::Server.find(params[:id])\n\n respond_to do |format|\n if @game_server.update_attributes(params[:game_server])\n format.html { redirect_to @game_server, notice: 'Server was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @game_server.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @app_server.update(app_server_params)\n format.html { redirect_to @app_server, notice: 'App server was successfully updated.' }\n format.json { render :show, status: :ok, location: @app_server }\n else\n format.html { render :edit }\n format.json { render json: @app_server.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @server_instance = ServerInstance.find(params[:id])\n\n respond_to do |format|\n if @server_instance.update_attributes(params[:server_instance])\n format.html { redirect_to @server_instance, notice: 'Server instance was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @server_instance.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @mock_server.update(mock_server_params)\n format.html { redirect_to @mock_server, notice: 'Mock server was successfully updated.' }\n format.json { render :show, status: :ok, location: @mock_server }\n else\n format.html { render :edit }\n format.json { render json: @mock_server.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @server_info = args[:server_info] if args.key?(:server_info)\n @server_trace_info = args[:server_trace_info] if args.key?(:server_trace_info)\n @service_url = args[:service_url] if args.key?(:service_url)\n end", "def updateX\n @server = Server.find(params[:id])\n\n respond_to do |format|\n if @server.update_attributes(params[:server])\n format.html { redirect_to(@server, :notice => 'Server was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @server.errors, :status => :unprocessable_entity }\n end\n end\n end", "def show\n @server_info = ServerInfo.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @server_info }\n end\n end", "def set_server\n @server = Server.find(params[:id])\n end", "def update\n respond_to do |format|\n if @gameserver.update(server_params)\n format.html { redirect_to @gameserver, notice: 'Server was successfully updated.' }\n format.json { render :show, status: :ok, location: @gameserver }\n else\n format.html { render :edit }\n format.json { render json: @gameserver.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @gameserver.update(server_params)\n format.html { redirect_to @gameserver, notice: 'Server was successfully updated.' }\n format.json { render :show, status: :ok, location: @gameserver }\n else\n format.html { render :edit }\n format.json { render json: @gameserver.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_server\r\n @server = Server.find(params[:id])\r\n end", "def update\n respond_to do |format|\n if @server.update(server_params)\n @server.servers_to_categories.destroy_all\n\n cats = params[:server][:category_id]\n cats.each do |c|\n unless c.empty?\n stc = ServersToCategories.new\n stc.category_id = c\n stc.server_id = @server.id\n\n stc.save\n end\n end\n\n format.html { redirect_to @server, notice: 'Server was successfully updated.' }\n format.json { render :show, status: :ok, location: @server }\n else\n format.html { render :edit }\n format.json { render json: @server.errors, status: :unprocessable_entity }\n end\n end\n end", "def save\n return if @vserver_hash.nil?\n put_rest \"vservers/#{@name}\", @vserver_hash.to_json, :content_type => \"application/json\"\n end", "def new\n @server_info = ServerInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @server_info }\n end\n end", "def set_server\n @server = Server.find(params[:id])\n end", "def set_server\n @server = Server.find(params[:id])\n end", "def set_server\n @server = Server.find(params[:id])\n end", "def set_server\n @server = Server.find(params[:id])\n end", "def set_server\n @server = Server.find(params[:id])\n end", "def update\n @serving = Serving.find(params[:id])\n\n respond_to do |format|\n if @serving.update_attributes(params[:serving])\n format.html { redirect_to @serving, notice: 'Serving was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @serving.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @server = Server.new\n\n @server_options = Server.all.map{|u| [ u.server_name, u.id ] }\n # @server_ips = Server.all.map{|u| [ u.IP, u.id ] }\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @server }\n end\n end", "def update(options)\n data = JSON.generate(:server => options)\n response = @compute.connection.csreq(\"PUT\",@svrmgmthost,\"#{@svrmgmtpath}/servers/#{URI.encode(self.id.to_s)}\",@svrmgmtport,@svrmgmtscheme,{'content-type' => 'application/json'},data)\n OpenStack::Exception.raise_exception(response) unless response.code.match(/^20.$/)\n # If we rename the instance, repopulate the object\n self.populate if options[:name]\n true\n end", "def server_params\n params.require(:server).permit(:name, :description, :ip)\n end", "def server_params\n params.require(:server).permit(:name, :addr, :endpoint, :api_key, :api_secret)\n end", "def update\n respond_to do |format|\n if @serving.update(serving_params)\n format.html { redirect_to @serving, notice: 'Serving was successfully updated.' }\n format.json { render :show, status: :ok, location: @serving }\n else\n format.html { render :edit }\n format.json { render json: @serving.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @server_record.update(server_record_params)\n format.html { redirect_to @server_record, notice: 'Server record was successfully updated.' }\n format.json { render :show, status: :ok, location: @server_record }\n else\n format.html { render :edit }\n format.json { render json: @server_record.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sekilas_info.update(sekilas_info_params)\n format.html { redirect_to @sekilas_info, notice: 'Sekilas info was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sekilas_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @server1 = Server1.new\n\n @server_options = Server1.all.map{|u| [ u.server_name, u.id ] }\n @server_ips = Server1.all.map{|u| [ u.IP, u.id ] }\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @server1 }\n end\n end", "def server_params\n params.require(:server).permit(:name, :ip)\n end", "def update\n respond_to do |format|\n if @serverhascontainer.update(serverhascontainer_params)\n format.html { redirect_to @serverhascontainer, notice: 'Serverhascontainer was successfully updated.' }\n format.json { render :show, status: :ok, location: @serverhascontainer }\n else\n format.html { render :edit }\n format.json { render json: @serverhascontainer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @server = @site.servers.new(server_params.merge({used_at: (Time.now - 1.day)}))\n\n respond_to do |format|\n if @server.save\n format.html { redirect_to [:admin, @site], notice: 'Server was successfully created.' }\n format.json { render action: 'show', status: :created, location: [:admin, @site] }\n else\n format.html { render action: 'new' }\n format.json { render json: @server.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @client_info.update(client_info_params)\n\n format.html { redirect_to @client_info, notice: 'Client info was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @client_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @server = Server.new(params[:server])\n @server.tags = params[:tag_ids].map { |id| Tag.find(id) }\n\n respond_to do |format|\n if @server.save\n format.html { redirect_to servers_path, notice: 'Server was successfully created.' }\n format.json { render json: @server, status: :created, location: @server }\n else\n format.html { render action: \"new\" }\n format.json { render json: @server.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bot_server.update(bot_server_params)\n format.html { redirect_to bot_servers_path, notice: 'Bot server was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bot_server.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @server = Server.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @server }\n end\n end", "def server_save(server)\n if(server.persisted?)\n else\n result = request(\n :path => 'containers',\n :method => :post,\n :expects => 202,\n :json => {\n :name => server.name,\n :profiles => [server.flavor_id],\n :ephemeral => server.custom.fetch(:ephemeral, false),\n :source => {\n :type => :image,\n :alias => server.image_id\n }\n }\n )\n wait_for_operation(result.get(:body, :operation), 60)\n server.id = server.name\n server.reload\n until(server.state == :running || server.state == :terminated)\n request(\n :path => \"containers/#{server.name}/state\",\n :method => :put,\n :expects => 202,\n :json => {\n :action => :start\n }\n )\n wait_for_operation(result.get(:body, :operation), 60)\n server.reload\n end\n if(server.state == :terminated)\n raise \"Failed to save server state! (`#{server.name}`)\"\n end\n server\n end\n end", "def update\n respond_to do |format|\n if @info.update(info_params)\n format.html { redirect_to infos_path, notice: 'Info was successfully updated.' }\n format.json { render :show, status: :ok, location: @info }\n else\n format.html { render :edit }\n format.json { render json: @info.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_aos_version(args = {}) \n id = args['id']\n temp_path = \"/aosversions.json/{aosVersionId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"aosversionId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update\n respond_to do |format|\n if @info.update(info_params)\n format.html { redirect_to @info, notice: 'Info was successfully updated.' }\n format.json { render :show, status: :ok, location: @info }\n else\n format.html { render :edit }\n format.json { render json: @info.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @info.update(info_params)\n format.html { redirect_to @info, notice: 'Info was successfully updated.' }\n format.json { render :show, status: :ok, location: @info }\n else\n format.html { render :edit }\n format.json { render json: @info.errors, status: :unprocessable_entity }\n end\n end\n end", "def modify_tag tag\n data = {\n \"tag\" => params\n }\n temp = data[\"servers\"]\n data[\"servers\"] = { \"server\" => temp }\n\n json = JSON.generate data\n\n response = put \"tag/#{tag}\", json\n return response unless response.code == 200\n\n body = JSON.parse response.body\n body[\"tag\"]\n end", "def update\n @server_rack = ServerRack.find(params[:id])\n\n respond_to do |format|\n if @server_rack.update_attributes(params[:server_rack])\n format.html { redirect_to(@server_rack, :notice => 'Server rack was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @server_rack.errors, :status => :unprocessable_entity }\n end\n end\n end", "def updateservercount(count)\n url = \"https://discordbots.org/api/bots/#{@id}/stats\"\n json = '{\"server_count\":' + count.to_s + '}'\n RestClient.post(url, json, :Authorization => @api, :'Content-Type' => :json)\n \"Successfully set the server count to #{count}\"\n end", "def create\n @server = Server.new(params[:server])\n\n respond_to do |format|\n if @server.save\n format.html { redirect_to @server, notice: 'Server was successfully created.' }\n format.json { render json: @server, status: :created, location: @server }\n else\n format.html { render action: \"new\" }\n format.json { render json: @server.errors, status: :unprocessable_entity }\n end\n end\n end", "def putDeviceInfo(info)\r\n params = {\r\n :software_version => info.swVersion,\r\n :serial_number => info.serialNb\r\n }\r\n res = apiPut(\"devices/#{info.deviceId}\", params)\r\n if res.status != 200\r\n $LOG.warn(\"Failed to put device info to backend! Status: #{res.status}, Response: #{res.body}\")\r\n end\r\n end", "def server_params\n params.require(:server).permit(:ip, :sn, :os, :purchase_time, :server_size_id)\n end", "def update\n respond_to do |format|\n if @server_size.update(server_size_params)\n format.html { redirect_to @server_size, notice: 'Server size was successfully updated.' }\n format.json { render :show, status: :ok, location: @server_size }\n else\n format.html { render :edit }\n format.json { render json: @server_size.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @server_info = ServerInfo.find(params[:id])\n @server_info.destroy\n\n respond_to do |format|\n format.html { redirect_to server_infos_url }\n format.json { head :no_content }\n end\n end", "def show\n @server = Server.find(params[:id])\n checkaccountobject(\"servers\",@server)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @server }\n end\n end", "def create\n authenticate_user!\n @server = Server.new(params[:server])\n\n respond_to do |format|\n if @server.save\n format.html { redirect_to @server, notice: 'Server was successfully created.' }\n format.json { render json: @server, status: :created, location: @server }\n else\n format.html { render action: \"new\" }\n format.json { render json: @server.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_server\n @server = Server.includes(:user).includes(:votes).find(params[:id])\n end", "def update options={}\n client.put(\"/#{id}\", options)\n end", "def show\n @server1 = Server1.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @server1 }\n end\n end", "def update_info(uid, info)\n object(\"#{uid}.info\").put(body: info.to_json)\n end", "def update\n if spot = SkateSpot.where(:id => params[:id]).first and info = parse_input(params)\n if info.has_key?(:alt_names)\n info[:alt_names].map! { |n| SpotName.find_or_create_by(:name => n, :spot => spot) }\n end\n\n if info[:name]\n info[:name] = SpotName.find_or_create_by(:name => info[:name], :spot => spot) \n end\n\n if info.has_key?(:obstacles)\n info[:obstacles].map! { |o|\n Obstacle.find_or_create_by(:type => ObstacleType.where(:name => o['type']).first, :geometry => o['geometry'], :spot => spot)\n }\n end\n\n render :json => { :status => (spot.update(info) == true ? :success : :unprocessable_entity) }\n else\n render :json => { :status => :unprocessable_entity }\n end\n\n rescue ActiveRecord::RecordNotSaved\n render :json => { :status => :unprocessable_entity }\n end", "def server_params\n params.require(:server).permit(:name)\n end", "def update\n respond_to do |format|\n if @info_request.update(info_request_params)\n format.html { redirect_to @info_request, notice: 'Info request was successfully updated.' }\n format.json { render :show, status: :ok, location: @info_request }\n else\n format.html { render :edit }\n format.json { render json: @info_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def server_params\n params.require(:server).permit(:name, :host, :username, :password, :constant_id)\n end", "def update\n @serverroom = Serverroom.find(params[:id])\n\n respond_to do |format|\n if @serverroom.update_attributes(params[:serverroom])\n format.html { redirect_to @serverroom, notice: 'Serverroom was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @serverroom.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_put\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 contents = last_response.body\n contents_id = contents['_id']\n\n data = File.read 'sample-traces/1.json'\n put(\"/traces/#{contents_id}\", data, 'CONTENT_TYPE': 'application/json')\n contents = last_response.body\n\n assert_equal contents_id, contents['_id']\n end", "def create\n @server = Server.new(server_params)\n\n respond_to do |format|\n if @server.save\n format.html { redirect_to @server, notice: 'Server was successfully created.' }\n format.json { render :show, status: :created, location: @server }\n else\n format.html { render :new }\n format.json { render json: @server.errors, status: :unprocessable_entity }\n end\n end\n end", "def server_info!\n @server_info = nil\n server_info\n end", "def server_params\n params.require(:server).permit(:user_id, :category_id, :ip, :vip, :port, :banner, :name, :country, :description, :website, :youtube_id, :votes, :disabled, :status, :votifier_key, :votifier_ip, :votifier_port, :players, :max_players, :server_version, :cache_time, :protocol)\n end", "def show\n puts \"=================show=================\"\n @server = Server.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @server }\n end\n end", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def add_server(service_id, server={})\n request :post, \"/services/#{service_id}/servers\"\n end", "def update\n respond_to do |format|\n if @info.update(info_params)\n format.html { redirect_to infos_path, notice: 'Info was successfully updated.' }\n format.json { render \"pages/info\", status: :ok, location: @info }\n else\n format.html { render :edit }\n format.json { render json: @info.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n authenticate_user!\n @server = Server.new\n @rackspace_servers = Server.rackspace_servers\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @server }\n end\n end", "def server_params\n params.permit(:uuid, :addr, :port, :status)\n end", "def patch(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if info && info['meta'] && (etag = info['meta']['version'])\n hdrs.merge!('if-match' => etag)\n end\n reply = json_parse_reply(@key_style,\n *json_patch(@target, \"#{path}/#{Addressable::URI.encode(id)}\", info, hdrs))\n\n # hide client endpoints that are not quite scim compatible\n type == :client && !reply ? get(type, info['client_id']): reply\n end", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def server(service_id, server_id)\n request :get, \"/services/#{service_id}/servers/#{server_id}\"\n end", "def put_update\n response = self.class.put(\"/service/#{$service_id}/version/#{$service_version}/logging/sftp/#{$name}\", \n headers: { \"Fastly-Key\" => $key }, \n body: $put_form_data )\n end", "def update\n @person_info = PersonInfo.find(params[:id])\n\n if @person_info.update(person_info_params(params[:person_info]))\n head :no_content\n else\n render json: @person_info.errors, status: :unprocessable_entity\n end\n end", "def update\n if @information.update(information_params)\n render json: :ok\n else\n render json: @information.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @server_account.update(server_account_params)\n format.html { redirect_to @server_account, notice: 'Server account was successfully updated.' }\n format.json { render :show, status: :ok, location: @server_account }\n else\n format.html { render :edit }\n format.json { render json: @server_account.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @name_server = NameServer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @name_server }\n end\n end" ]
[ "0.6879228", "0.6814855", "0.6721013", "0.66957366", "0.6679785", "0.66616225", "0.6648926", "0.6648926", "0.6648926", "0.661417", "0.65991783", "0.6592893", "0.659201", "0.6576404", "0.6511239", "0.64895", "0.64728624", "0.64665985", "0.6298507", "0.62783134", "0.6250062", "0.62386763", "0.6215324", "0.61859417", "0.6184336", "0.61428225", "0.6131671", "0.61239547", "0.6114219", "0.60382664", "0.6018845", "0.6010256", "0.6010256", "0.60082847", "0.6001388", "0.5996098", "0.5933254", "0.5903686", "0.5903686", "0.5903686", "0.5903686", "0.5903686", "0.5890044", "0.5876003", "0.5875121", "0.58604455", "0.58459556", "0.58386225", "0.5778821", "0.5738013", "0.5732817", "0.570116", "0.5700921", "0.568561", "0.56816715", "0.5672169", "0.56705666", "0.56562376", "0.5653812", "0.5651663", "0.5647459", "0.5646356", "0.5646356", "0.56217414", "0.5619963", "0.5616287", "0.56049293", "0.55967426", "0.55966055", "0.5586346", "0.55816805", "0.55816746", "0.55764574", "0.55612785", "0.5559431", "0.55508566", "0.55424935", "0.5538192", "0.5537943", "0.5537355", "0.5533581", "0.55330783", "0.552431", "0.5521441", "0.5519146", "0.5517622", "0.5511316", "0.55100936", "0.5508979", "0.5508875", "0.55047023", "0.5497981", "0.549062", "0.54892164", "0.548725", "0.5482995", "0.5471543", "0.54690546", "0.54644823", "0.5444176" ]
0.72281516
0
DELETE /server_infos/1 DELETE /server_infos/1.json
def destroy @server_info = ServerInfo.find(params[:id]) @server_info.destroy respond_to do |format| format.html { redirect_to server_infos_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @server = Server.find(params[:id])\n checkaccountobject(\"servers\",@server)\n @server.send_delete\n respond_to do |format|\n format.html { redirect_to servers_url }\n format.json { head :ok }\n end\n end", "def destroy\n @server1 = Server1.find(params[:id])\n @server1.destroy\n\n respond_to do |format|\n format.html { redirect_to server1s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n authenticate_user!\n @server = Server.find(params[:id])\n @server.destroy\n\n respond_to do |format|\n format.html { redirect_to servers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @server = Server.find(params[:id])\n @server.destroy\n\n respond_to do |format|\n format.html { redirect_to servers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @server = Server.find(params[:id])\n @server.destroy\n\n respond_to do |format|\n format.html { redirect_to servers_url }\n format.json { head :ok }\n end\n end", "def destroy\n destroy_server @server\n respond_to do |format|\n format.html { redirect_to servers_url, notice: 'Server was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @server = Server.find(params[:id])\n @server.destroy\n \n respond_to do |format|\n format.html { redirect_to(servers_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @server.destroy\n respond_to do |format|\n format.html { redirect_to servers_url, notice: 'Server was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @server.destroy\n respond_to do |format|\n format.html { redirect_to servers_url, notice: 'Server was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @server.destroy\n respond_to do |format|\n format.html { redirect_to servers_url, notice: 'Server was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @server.destroy\n respond_to do |format|\n format.html { redirect_to servers_url, notice: 'Server was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @server = Server.find(params[:id])\n @server.destroy\n\n respond_to do |format|\n format.html { redirect_to(servers_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @server_node = ServerNode.find(params[:id])\n @server_node.destroy\n\n respond_to do |format|\n format.html { redirect_to server_nodes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @server.destroy\n respond_to do |format|\n format.html { redirect_to servers_url }\n end\n end", "def delete_server(server_id)\n @options = {:path => \"/servers/delete\",\n :body => \"\"}.merge(@options)\n @options[:query]=@options[:query].merge(server_id)\n request(\n :expects => 200,\n :method => :delete,\n :body => @options[:body]\n )\n end", "def destroy\n @server.destroy\n respond_to do |format|\n format.html { redirect_to [:admin, @site] }\n format.json { head :no_content }\n end\n end", "def delete_server(server_uuid)\n response = delete \"server/#{server_uuid}\"\n\n response\n end", "def destroy\n @client_info.destroy\n respond_to do |format|\n format.html { redirect_to client_infos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @client_info.destroy\n respond_to do |format|\n format.html { redirect_to client_infos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @game_server = Game::Server.find(params[:id])\n @game_server.destroy\n\n respond_to do |format|\n format.html { redirect_to game_servers_url }\n format.json { head :ok }\n end\n end", "def destroy\n @server = Server.find(params[:server_id])\n @httping_log = @server.httping_logs.find(params[:id])\n @httping_log.destroy\n\n respond_to do |format|\n format.html { redirect_to servers_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @server_instance = ServerInstance.find(params[:id])\n @server_instance.destroy\n\n respond_to do |format|\n format.html { redirect_to server_instances_url }\n format.json { head :no_content }\n end\n end", "def destroyX\n @server = Server.find(params[:id])\n @server.destroy\n\n respond_to do |format|\n format.html { redirect_to(servers_url) }\n format.xml { head :ok }\n end\n end", "def delete!\n server.delete(name)\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @server_record.destroy\n respond_to do |format|\n format.html { redirect_to server_records_url, notice: 'Server record was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @server.destroy\n session[:server_id] = nil\n respond_to do |format|\n format.html { redirect_to servers_url, notice: t('notice.server.deleted') }\n end\n end", "def destroy\n client=Client.find_by_id(params[:id])\n if client != nil\n if client.destroy\n head 204\n end\n else\n head 404\n end\n end", "def destroy\n @server = Server.find(params[:id])\n @server.destroy\n \n @servers = Server.search(params[:search]).order(sort_column + \" \" + sort_direction).paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html { redirect_to servers_url, flash[:info]='Server was successfully deleted.' }\n format.js { flash[:info]='Server was successfully deleted.' }\n format.json { head :ok }\n end\n end", "def delete\n delete_from_server single_url\n end", "def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end", "def destroy\r\n @server.destroy\r\n respond_to do |format|\r\n if current_page = new_server_path\r\n format.html { redirect_to new_server_path, notice: 'Server was successfully removed.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { redirect_to servers_url, notice: 'Server was successfully removed.' }\r\n format.json { head :no_content }\r\n end\r\n end\r\n end", "def destroy\n @mock_server.destroy\n respond_to do |format|\n format.html { redirect_to mock_servers_url, notice: 'Mock server was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @gameserver.destroy\n respond_to do |format|\n format.html { redirect_to servers_url, notice: 'Server was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_server(server_id, opts={})\n api(:delete, \"/servers/#{server_id}\", opts)\n end", "def destroy\n @app_server.destroy\n respond_to do |format|\n format.html { redirect_to app_servers_url, notice: 'App server was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @server_rack = ServerRack.find(params[:id])\n @server_rack.destroy\n\n respond_to do |format|\n format.html { redirect_to(server_racks_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @bot_server.destroy\n respond_to do |format|\n format.html { redirect_to bot_servers_url }\n format.json { head :no_content }\n end\n end", "def delete\n Profitbricks.request :delete_server, server_id: self.id\n return true\n end", "def destroy\n @a_serverconfiguration.destroy\n respond_to do |format|\n format.html { redirect_to a_serverconfigurations_url, notice: 'A serverconfiguration was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_server\n super\n end", "def destroy\n @serverhascontainer.destroy\n respond_to do |format|\n format.html { redirect_to serverhascontainers_url, notice: 'Serverhascontainer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @gameserver.destroy\n respond_to do |format|\n format.html { redirect_to gameservers_path, notice: 'Server was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @server_size.destroy\n respond_to do |format|\n format.html { redirect_to server_sizes_url, notice: 'Server size was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_server(id)\n return delete_request(address(\"/servers/\" + id), @token)\n end", "def destroy\n @serverroom = Serverroom.find(params[:id])\n @serverroom.destroy\n\n respond_to do |format|\n format.html { redirect_to serverrooms_url }\n format.json { head :no_content }\n end\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def destroy\n return if @name.nil?\n delete_rest \"vservers/#{@name}\"\n end", "def destroy\n @server = current_user.administrated_servers.find_by(discord_id: params[:discord_id])\n @server.destroy\n\n render 'api/servers/show'\n end", "def destroy\n @server = Server.find(params[:id])\n @serveriproute = ServerIpRoute.where(:source_id => params[:id])\n\n\n if @server #added because delete gets submitted twice because of the jquery delete alert\n puts \"================DELETE================\"\n puts params[:id]\n # puts @serveriproute.exists?\n @server.destroy\n puts @serveriproute.exists?\n if @serveriproute.exists?\n puts \"ip route exists\"\n @serveriproute.destroy_all\n else\n puts \"no ip route exists\"\n end\n\n # @serveriproute.destroy_all\n puts \"-------deleted successfully------------\"\n else\n end\n respond_to do |format|\n format.html #{ redirect_to servers_url }\n format.js #{ render :layout => false }\n end\n end", "def destroy\n @serving = Serving.find(params[:id])\n @serving.destroy\n\n respond_to do |format|\n format.html { redirect_to servings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @game_server = GameServer.find(params[:id])\n @game_server.destroy\n\n respond_to do |format|\n format.html { redirect_to(game_servers_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @server_monitor_log.destroy\n respond_to do |format|\n format.html { redirect_to server_monitor_logs_url, notice: 'Server monitor log was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def remove_server(service_id, server_id)\n request :delete, \"/services/#{service_id}/servers/#{server_id}\"\n end", "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def destroy\n @serv = Serv.find(params[:id])\n if @serv.mngbl\n #Remueve el MR a través de una llamada al webservice del núcleo\n http = Net::HTTP.new(\"192.168.119.163\",9999)\n post_params = {'ip' => @serv.conn.ip, 'port' => @serv.conn.port}\n request = Net::HTTP::Delete.new(\"/mbs/#{@serv.domain}/#{@serv.name}\")\n request.set_form_data(post_params)\n begin\n response = http.request(request)\n rescue Errno::ECONNREFUSED\n end\n end\n @serv.destroy\n\n respond_to do |format|\n format.html { redirect_to servs_url, notice: t('servs.delete.notice') }\n format.json { head :no_content }\n end\n end", "def deleteServer(serverID)\n serverUrl = @appContext.getMasterURL() + \"/applications/\" + @appContext.getProject() + \"/assets/\" + serverID \n return @cloudmunchDataService.deleteDataForContext(serverUrl, @appContext.getAPIKey() )\n end", "def destroy\n @serving.destroy\n respond_to do |format|\n format.html { redirect_to servings_url, notice: 'Serving was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(url)\n @deleted = true\nend", "def destroy\n @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 destroy\n @egc_server_type.destroy\n respond_to do |format|\n format.html { redirect_to egc_server_types_url, notice: 'Egc server type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @server_account.destroy\n respond_to do |format|\n format.html { redirect_to server_accounts_url, notice: 'Server account was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @info_request.destroy\n respond_to do |format|\n format.html { redirect_to info_requests_url, notice: 'Info request 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 destroy\n @block_list_server = BlockListServer.find(params[:id])\n @block_list_server.destroy\n\n respond_to do |format|\n format.html { redirect_to block_list_servers_url }\n format.json { head :no_content }\n end\n end", "def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\n end", "def destroy\n @sekilas_info.destroy\n respond_to do |format|\n format.html { redirect_to sekilas_infos_url }\n format.json { head :no_content }\n end\n end", "def delete(options={})\n connection.delete(\"/\", @name)\n end", "def destroy\n @client.destroy\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @debug_info.destroy\n respond_to do |format|\n format.html { redirect_to debug_infos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @info.destroy\n respond_to do |format|\n format.html { redirect_to infos_url, notice: 'Info was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @info.destroy\n respond_to do |format|\n format.html { redirect_to infos_url, notice: 'Info was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @storage = @client.storages.find(params[:id])\n @storage.destroy\n\n respond_to do |format|\n format.html { redirect_to client_url(@client) }\n format.json { head :no_content }\n end\n end", "def destroy\n @client.destroy\n respond_to do |format|\n format.html { redirect_to clients_url, notice: 'Client a été supprimer.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @clientes_servico.destroy\n respond_to do |format|\n format.html { redirect_to clientes_servicos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @client.delete( name )\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 @client.destroy\n respond_to do |format|\n format.html { redirect_to clients_url, notice: 'El Cliente fue Eliminado Exitosamente.' }\n format.json { head :no_content }\n end\n end", "def destroy\n name, type = resource[:name].split('/')\n case type\n when 'MX'\n @dnsres.each do |res|\n preference = res.preference\n target = res.to_rdata\n nsupdate(\"server #{server}\n update delete #{name} MX #{preference} #{target}.\n send\")\n end\n when 'SRV'\n @dnsres.each do |res|\n priority = res.priority\n weight = res.weight\n port = res.port\n target = res.to_rdata\n nsupdate(\"server #{server}\n update delete #{name} SRV #{priority} #{weight} #{port} #{target}\n send\")\n end\n else\n rdata = @dnsres.to_rdata\n nsupdate(\"server #{server}\n update delete #{name} #{type} #{rdata}\n send\")\n end\n end", "def destroy\n @my_studio_client = MyStudio::Client.find(params[:id])\n @my_studio_client.destroy\n\n respond_to do |format|\n format.html { redirect_to my_studio_clients_url }\n format.json { head :ok }\n end\n end", "def destroy\n @servant.destroy\n respond_to do |format|\n format.html { redirect_to servants_url, notice: 'Servant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @recurso_servidor.destroy\n respond_to do |format|\n format.html { redirect_to recurso_servidors_url, notice: 'Recurso servidor was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @client.destroy\n respond_to do |format|\n format.html { redirect_to clients_url, notice: 'Данные по клиенту удалены.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reqinfo = Reqinfo.find(params[:id])\n @reqinfo.destroy\n\n respond_to do |format|\n format.html { redirect_to(reqinfos_url) }\n format.xml { head :ok }\n end\n end", "def cmd_delete argv\n setup argv\n uuid = @hash['uuid']\n response = @api.delete(uuid)\n msg response\n return response\n end", "def destroy\n @dockerserver.destroy\n respond_to do |format|\n format.html { redirect_to dockerservers_url, notice: 'Dockerserver was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete endpoint\n do_request :delete, endpoint\n end", "def destroy\n @client = Client.find(params[:id])\n @client.destroy\n @uuid = params[:uuid]\n respond_to do |format|\n format.html { redirect_to :controller => 'ads', :action => 'admin_dash', :id => 1, :uuid => @uuid }\n format.json { head :no_content }\n end\n end", "def delete(path)\n repository = path.split(/\\//)[2]\n objectid = path.split(/\\//)[3]\n if storage_fetch(repository, objectid) && storage_delete(repository, objectid)\n ['200', {}, []]\n else\n ['404', {}, [\"Repository #{repository} or ObjectID #{objectid} not found: #{path}\"]]\n end\n end", "def destroy\n @secubat_client = SecubatClient.find(params[:id])\n @secubat_client.destroy\n\n respond_to do |format|\n format.html { redirect_to secubat_clients_url }\n format.json { head :ok }\n end\n end", "def destroy\n @client.destroy\n respond_to do |format|\n format.html { redirect_to clients_url, notice: 'Cliente apagado com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n chef_rest_v1.delete(\"clients/#{@name}\")\n end", "def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :ok }\n end\n end", "def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :ok }\n end\n end", "def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.76029724", "0.74445516", "0.7376597", "0.7358587", "0.73473054", "0.718371", "0.71238005", "0.71072155", "0.71072155", "0.71072155", "0.71072155", "0.7058676", "0.7048098", "0.7021026", "0.6986391", "0.69784296", "0.6972603", "0.6964402", "0.6963334", "0.69252425", "0.69070417", "0.687937", "0.6874584", "0.686038", "0.6853855", "0.6853603", "0.6820943", "0.6796219", "0.67689466", "0.6768676", "0.6731238", "0.66883457", "0.66796315", "0.6679499", "0.6670726", "0.6665218", "0.6640486", "0.66376376", "0.66196394", "0.6601014", "0.66000575", "0.6592602", "0.6580582", "0.6574678", "0.6566752", "0.6543955", "0.6537254", "0.6529733", "0.6523509", "0.652334", "0.65212065", "0.6499616", "0.6498328", "0.64882654", "0.64882153", "0.64867157", "0.6458641", "0.64524436", "0.64517576", "0.64444447", "0.6430286", "0.6420468", "0.64154774", "0.6400051", "0.63804674", "0.6370379", "0.63693607", "0.6361119", "0.6356088", "0.6334108", "0.63251513", "0.63251513", "0.632497", "0.6322579", "0.6320887", "0.6317454", "0.6304942", "0.63009346", "0.62981874", "0.62915576", "0.62904835", "0.6285321", "0.627971", "0.62776875", "0.62774503", "0.62722045", "0.626197", "0.62602955", "0.6258473", "0.6250653", "0.6247309", "0.62371576", "0.623102", "0.623102", "0.62280214", "0.62280214", "0.62280214", "0.62280214", "0.62280214", "0.62280214" ]
0.7829473
0
For older RubyGems versions
def latest_version? if (rval = super) Gem.unversioned(@name) end rval end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gem_version; end", "def gem_version; end", "def gem_version; end", "def gem_version; end", "def gem_version; end", "def gem_version; end", "def gem_available_old_rubygems?(gemname)\n\tGem.available?(gemname)\nend", "def require_gems; end", "def gems; end", "def gems; end", "def gems; end", "def load_minimal_gems\r\n end", "def pluggable!\n abort \"update rubygems to >= 1.3.1\" unless Gem.respond_to? :find_files\n require_rubygems_version \">= 1.3.1\"\n end", "def update_gems\n require 'rubygems'\n require 'rubygems/gem_runner'\n suffix = %w[--no-document --env-shebang --silent]\n if RUBY_VERSION < '2.5'\n Gem::GemRunner.new.run %w[uninstall rubygems-update -x]\n # rdoc won't update without UI confirmation of bin directory file replacement ?\n Gem::GemRunner.new.run(%w[update minitest power_assert rake rdoc test-unit] + suffix)\n if RUBY_VERSION.start_with?('2.4')\n Gem::GemRunner.new.run(%w[update did_you_mean] + suffix)\n elsif RUBY_VERSION.start_with?('2.3')\n Gem::GemRunner.new.run(%w[install did_you_mean:1.0.3] + suffix)\n end\n Gem::GemRunner.new.run %w[cleanup]\n Gem::GemRunner.new.run(%w[install bundler] + suffix)\n else\n Gem::GemRunner.new.run(%w[install bundler] + suffix)\n end\n\n end", "def add_gem_paths; end", "def gemfile; end", "def gemfile; end", "def gemfile; end", "def gemfile; end", "def gemfile; end", "def gemfile; end", "def gemspec?; end", "def update_gems()\n system \"gem update --system\"\n end", "def needs_ruby_global_append_path?\n Gem::Version.new(@version) < Gem::Version.new(\"2.1.4\")\n end", "def gemspec; end", "def gemspec; end", "def gemspec; end", "def gemspec; end", "def gemspec; end", "def gemspec; end", "def gemspec; end", "def gemspec; end", "def ruby_version; '2.6.3' end", "def from_installed_gems(*deprecated); end", "def install_gem; end", "def version_constraint(gem_name); end", "def gemfile_lock; end", "def latest_mri_ruby\n \"ruby-3.2\"\n end", "def older_rubies\n @older_rubies ||= %w[ ruby-3.0 ruby-2.7 ruby-2.6 ruby-2.5 ]\n end", "def mark_version\n @rubygems_version = Gem::VERSION\n end", "def gemspecs; end", "def check_for_libraries; end", "def required_rubygems_version\n spec.required_rubygems_version\n end", "def version_specified_gem?(node); end", "def load_gem_plugins; end", "def restrictive_version_specified_gem?(node); end", "def ruby21!\n require_ruby_version \"~> 2.1\"\n end", "def path; Gem.ruby; end", "def default_ruby_system_packages\n case node['platform']\n when 'ubuntu'\n pkgs = %w[ 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 case node['platform_version']\n when '10.04' then %w[ ruby ruby-dev libopenssl-ruby1.8 ] + pkgs\n when '12.04', '12.10' then %w[ ruby1.9.1 ruby1.9.1-dev ] + pkgs\n else pkgs\n end\n end\nend", "def build_gems; end", "def installed_versions; end", "def build_gem; end", "def gem_version_more?(name, version)\n Gem.loaded_specs[name].version >= Gem::Version.new(version)\n end", "def setup\n install_latest_ruby\n\n install_global_gems\n end", "def ruby22!\n require_ruby_version \"~> 2.2\"\n end", "def required_gem_list\n Mack::Utils::GemManager.instance.required_gem_list\n end", "def check_gem # --- CHECK FOR MISSING GEMS\n begin\n\t gem 'em-websocket'\n rescue Gem::LoadError\n\t puts \"IT APPEARS YOU ARE MISSING THE SOCKET GEM\"\n puts \"TO INSTALL IT TYPE 'gem install em-websocket'\"\n\telse\n\t\t#donothing\n\tend\n\n\tbegin\n\t\tgem 'net-ping', '>=1.7.8'\n\trescue Gem::LoadError\n\t\tputs \"IT APPEARS THAT YOU ARE MISSING THE NET-PING GEM\"\n puts \"TO INSTALL IT TYPE 'gem install net-ping'\"\n\telse\n\t\t#donothing\n\tend\nend", "def require_rubygems_version *versions\n spec_extras[:required_rubygems_version] = versions\n end", "def ruby23!\n require_ruby_version \"~> 2.3\"\n end", "def ensure_gem_installed(g)\n unless Gem.available? g\n run \"sudo gem install #{g}\"\n end\nend", "def most_recent_ruby_version\n node[:rbenv][:rubies].map do |version|\n Gem::Version.new(version)\n end.sort.map(&:to_s).last\nend", "def ruby20!\n require_ruby_version \"~> 2.0\"\n end", "def gem_available?(name)\n Gem::Specification.find_by_name(name)\nrescue Gem::LoadError\n puts \"[*] - esearchy requires #{name}.\"\n if RUBY_PLATFORM =~ /mingw|mswin/\n \tsystem \"gem install #{name}\"\n else\n \tsystem \"sudo gem install #{name}\"\n end\nend", "def gemspec=(_arg0); end", "def gemspec=(_arg0); end", "def gemspec=(_arg0); end", "def gemspec=(_arg0); end", "def gemspec=(_arg0); end", "def gemspec=(_arg0); end", "def gemspec=(_arg0); end", "def upgrade(version)\n \n end", "def ensure_gem_versions_defined_in_appraisal_are_used\n gems_defined_in_appraisal = retrieve_gems_from_gemfile(ENV['BUNDLE_GEMFILE'])\n gems_defined_in_gemfile = retrieve_gems_from_gemfile('Gemfile').collect(&:gem_name)\n\n gems_defined_in_appraisal.reject { |l| gems_defined_in_gemfile.include? l.gem_name }.each do |gem|\n add_gem gem.gem_name, gem.attributes.join(',')\n end\n end", "def bump_patch_version; end", "def latest_gemspec(rubygem)\n ::Gem.source_index.gems.values.select {|e| e.name == rubygem }.sort_by {|e| e.version }[-1]\n end", "def rubygems_version_string\n VERSION.gsub(/[-\\+]/,'.')\n end", "def gems=(_arg0); end", "def bump_minor_version; end", "def try_local(gem_name)\n if ENV['USE_LOCAL_GEMS']\n gem gem_name, path: \"../#{gem_name}\"\n else\n gem gem_name, github: \"omniscrapper/#{gem_name}\"\n end\nend", "def gem_available?(gemname)\n\t# gem_available_new_rubygems?(gemname) or gem_available_old_rubygems?(gemname)\n\tif defined?(Gem::Specification) and defined?(Gem::Specification.find_by_name)\n\t\tgem_available_new_rubygems?(gemname)\n\telse\n\t\tgem_available_old_rubygems?(gemname)\n\tend\nend", "def rails_versions\n @rails_versions ||= gem_versions('rails')\nend", "def merb_gems_version\n Merb::VERSION\n end", "def merb_gems_version\n Merb::VERSION\n end", "def refresh!\n from_installed_gems\n end", "def libs; end", "def check_gems\n @gems ||= {}\n @gems.keys.select { |g| Gem.source_index.find_name(g, @gems[g]).size == 0 }\n end", "def gem(name, version = Gem::Requirement.default)\n @gems ||= {}\n @gems[name] = version\n end", "def require!\n super do\n gem @gem_name, @version if @version\n end\n end", "def upstream_gem\n @gem ||= Polisher::Gem.from_rubygems gem_name, version\n end", "def reverse_dependencies(rubygem)\n ::Gem.source_index.gems.values.select {|e| e.dependencies.any? {|e| e.name == rubygem && e.type == :runtime}}.\n map {|e| \"#{e.name}-#{e.version}\" }\n end", "def patch_version; end", "def gems(*args)\n gems.each{|g| gem(g) }\n end", "def gem(gem_name, *version_requirements)\n if gem_name =='i18n'\n puts \"skipping loading the i18n gem ...\"\n return\n end\n super(gem_name, *version_requirements)\nend", "def required_rubygems_version\n spec.required_rubygems_version || Gem::Requirement.default\n end", "def bump_major_version; end", "def version_mismatch_detected\n end", "def update_gems\n gemfile = File.read('Gemfile')\n included_gems = %w[cocina-models dor-services-client sdr-client].filter { |gem_name| gemfile.include?(gem_name)}\n ErrorEmittingExecutor.execute(\"bundle update #{included_gems.join(' ')}\") unless included_gems.empty?\nend", "def valid_gemspec?; end", "def require_ruby_version *versions\n spec_extras[:required_ruby_version] = versions\n end", "def supported_pkgs\n {\"rpm\"=>1, \"deb\"=>1}\nend", "def installed_by_version # :nodoc:\n @installed_by_version ||= Gem::Version.new(0)\n end", "def test_bad_rubinius_deps\n check_deps_fail \"notapackage\" => :rbx if which('rbx')\n end" ]
[ "0.6922463", "0.6922463", "0.6922463", "0.6922463", "0.6922463", "0.6922463", "0.6746295", "0.6737507", "0.67058414", "0.67058414", "0.67058414", "0.657117", "0.65647703", "0.63236374", "0.6308885", "0.62550277", "0.62550277", "0.62550277", "0.62550277", "0.62550277", "0.62550277", "0.62467253", "0.6207729", "0.61917096", "0.61745626", "0.61745626", "0.61745626", "0.61745626", "0.61745626", "0.61745626", "0.61745626", "0.61745626", "0.61727", "0.61625594", "0.6119217", "0.61104524", "0.6082487", "0.6077234", "0.60709625", "0.60147023", "0.60063267", "0.59567606", "0.595468", "0.59519327", "0.59491646", "0.594595", "0.5933407", "0.591789", "0.5892715", "0.58804405", "0.58542323", "0.5853862", "0.58525616", "0.5830754", "0.58307374", "0.58297545", "0.582765", "0.5822467", "0.5821589", "0.5818929", "0.58183914", "0.58175796", "0.58019656", "0.57918745", "0.57918745", "0.57918745", "0.57918745", "0.57918745", "0.57918745", "0.57918745", "0.579029", "0.578842", "0.57775664", "0.5772814", "0.576503", "0.5759143", "0.57556456", "0.5744896", "0.57329345", "0.5726985", "0.57258326", "0.57258326", "0.5720989", "0.5713232", "0.57061756", "0.57020205", "0.5700559", "0.5681453", "0.56775063", "0.56654114", "0.56597304", "0.56589323", "0.5653676", "0.564941", "0.5649057", "0.564102", "0.5637684", "0.56325895", "0.5627379", "0.56267464", "0.5622543" ]
0.0
-1
custom actions with paper trail events
def archive self.paper_trail_event = "archive" self.discard end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def action_hook; end", "def add_actions; end", "def actions; end", "def run_actions; end", "def matt_custom_action_begin(label); end", "def action_run\n end", "def define_action_hook; end", "def action_target()\n \n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def action\n trigger :click\n end", "def act\n end", "def actions() ; info[:actions] ; end", "def actions() ; info[:actions] ; end", "def action(event)\n @neko.send event.target[:action]\n end", "def action\n end", "def events; end", "def events; end", "def events; end", "def events; end", "def events; end", "def events; end", "def events; end", "def events; end", "def click_action\n raise NotImplementedError \"Subclasses must implement this method\"\n end", "def action\n end", "def process_action(...)\n send_action(...)\n end", "def factions\n \n end", "def press(point)\n\t\t\t\t\n\t\t\tend", "def clicked(e)\n \n end", "def action args = {}\n\t\tend", "def event; end", "def event; end", "def event; end", "def action\n driver.action\n end", "def before_embedded(record, action); end", "def click; end", "def click; end", "def click; end", "def copy_actions\r\n end", "def action(a)\n @actions << a\n puts a.msg\n end", "def custom_action(context, element, aspect_model)\n \n content_translation_guiblock.custom_action(context, element, aspect_model) \n \n end", "def events\n end", "def append(action); end", "def append(action); end", "def append(action); end", "def process(action, *args); end", "def release_actions; end", "def on_click\n\t\tend", "def clicked;end", "def press(point)\n\t\t\n\tend", "def after_tours; end", "def actions\n client.actions\n end", "def fire_action_event\n require 'canis/core/include/ractionevent'\n fire_handler :PRESS, ActionEvent.new(self, :PRESS, text)\n end", "def perform_action(*args)\n end", "def handle_action\n timeline_item = find_timeline_item(self.glass_item_id)\n\n # TODO: Should we uniq these? When glass doesn't have connection, it will queue up\n # actions, so users might press the same one multiple times.\n user_actions.uniq.each do |user_action|\n type = user_action[:type] == \"CUSTOM\" ? user_action[:payload] : user_action[:type]\n json_to_return = self.reply_request_hash ? self.reply_request_hash : self.params\n timeline_item.send(\"handles_#{type.downcase}\", json_to_return)\n end if user_actions\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 action _obj, _args\n \"_obj action _args;\" \n end", "def react_to *args; end", "def do_action(tag, *arg )\n # global $wp_filter, $wp_actions, $wp_current_filter\n # TODO continue\n end", "def perform_action(data); end", "def set_actions\n actions :all\n end", "def action\n super\n end", "def log_action(action, user, record, model)\n begin\n # Create a new ActionLog Object\n event = ActionLog.new()\n \n # Add the user to this object\n event.user = user\n \n # Add the action to this object\n event.action = action\n \n # Save the model type and its record ID(s) to this object\n event.target = model.to_s + ':' + record.to_s\n \n # Save the time of the event\n event.time_of_action = (Time.now.getutc - 7*60*60).to_s.gsub('UTC','PST')\n \n # Save this event to database\n event.save!\n\n rescue => e\n \n end\n end", "def triggers\n\n end", "def action_list(args = {})\n name = args[:name]\n\n # Generate and perform necessary Actions for the\n # selected, referenced additional resources.\n @@markerselector = ApexMarkerSelector.new if @@markerselector.nil?\n args[:selector] = @@markerselector\n alist = super(args)\n\n # Apex put marker callouts in normal paragraphs.\n # <p><Vidoe02></p>\n # Captured all paragraphs and now needed to\n # look at the contents to see if match.\n new_alist = []\n alist.each do |marker_action|\n content = marker_action.fragment.node.text\n new_alist << marker_action if content.match?(/\\<insert[ ]+[^\\>]+\\>/)\n end\n return new_alist\n end", "def as_nested_actions; end", "def on_entry\n end", "def do_event_action\n if self.casetype == 'order' || self.casetype == 'abandoned_cart' || self.casetype == 'preorder'\n puts \"Case do_event_action start\"\n events = Event.where(casetype: self.casetype)\n if events.present?\n puts \"case do_event_action\"\n user = User.find_by_subdomain(Apartment::Tenant.current)\n events.each do |event|\n Services::EventAction.do_action(user, event, self)\n end\n end\n puts \"Case do_event_action finish\"\n end\n end", "def on_new_investigation; end", "def on_new_investigation; end", "def on_new_investigation; end", "def perform_hook action, html\n\n # => Filter/Action\n # => This is designed to figure out whether it's a filter or action being declared\n method_name = __callee__\n\n # => Fire Hook\n # => These fire for whichever the user has defined\n case action.to_sym\n when :pre_render\n output = liquid html, layout: :application, locals: { app: AppDrop.new, user: (UserDrop.new(current_user) if current_user), flash: (FlashDrop.new(flash) if flash.keys.any?) }\n end\n\n # => Fire other hooks\n # => This allows us to iterate over the various hooks that exist\n if settings.hooks[action.to_s]\n settings.hooks[action.to_s].sort_by(&:priority).each do |hook|\n (method_name.to_s.include?('filter')) ? output = hook.function.call(output) : hook.function.call(output)\n end\n end\n\n # => Return\n # => This returns outputted data to the main script\n return output\n\n end", "def trigger(owner, event, *args); end", "def handle_action(username, actiontype)\n \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 on\n attachment = hpg_resolve(shift_argument)\n action(\"Activating #{attachment.config_var} (#{attachment.resource_name})\") do\n RestClient.post( authed_pgsnapshot_url('/client/resource'),\n json_encode({\"name\" => attachment.resource_name}) )\n end\n end", "def after_action verb = nil, &block\n playbook.after_action verb, &block\n end", "def invoke_action(name)\n end", "def invoke_action(name)\n end", "def invoke_action(name)\n end", "def action_locator_args()\n \n end", "def human_event; end", "def action_name; end", "def perform\n $driver.multi_touch @actions\n end", "def actions\n ['capture', 'void', 'credit']\n end", "def action(name, altname=nil, &block) \n Runner.instance.add_action name, altname, &block\n end", "def process_action(*_arg0); end", "def process_action(*_arg0); end", "def process_action(*_arg0); end", "def send_events; end", "def hook_report_actions\n @flavor.class.after_add_resources do\n actions = actions_taken\n @recipe.send(:ruby_block, 'report_actions_taken') do\n # :nocov:\n block do\n $stdout.puts \"\\n\\nactions taken:\"\n actions.each { |a| $stdout.puts \" #{a}\" }\n end\n # :nocov:\n end\n end\n end", "def after_wiki_activity\n end", "def print_event(printer, event)\n $stdout.puts printer.call(event)\nend", "def action\n args.first\n end", "def process_action(method_name, *args); end", "def activity\n end", "def action(&block)\n @actions << block\n end" ]
[ "0.7012183", "0.67381036", "0.65464526", "0.6540214", "0.64107007", "0.63149273", "0.6290072", "0.6268006", "0.6261901", "0.6261901", "0.6261901", "0.6261901", "0.6261901", "0.6203777", "0.60878474", "0.5980572", "0.5980572", "0.5966044", "0.59461975", "0.59430385", "0.59430385", "0.59430385", "0.59430385", "0.59430385", "0.59430385", "0.59430385", "0.59430385", "0.5933182", "0.58693564", "0.58689463", "0.5817961", "0.5812181", "0.5807062", "0.58051246", "0.5802844", "0.5802844", "0.5802844", "0.57849336", "0.5750859", "0.5749771", "0.5749771", "0.5749771", "0.5724812", "0.5719634", "0.5711078", "0.5695676", "0.5662152", "0.5662152", "0.5662152", "0.56547743", "0.5654669", "0.56470925", "0.5645224", "0.56078184", "0.5601534", "0.55924386", "0.55902994", "0.55877787", "0.55807376", "0.5572186", "0.5562128", "0.55135876", "0.55050176", "0.5496696", "0.54895055", "0.5484716", "0.5459391", "0.5455271", "0.54503113", "0.54468405", "0.54427755", "0.5438234", "0.54369307", "0.54369307", "0.54369307", "0.5435266", "0.54065186", "0.54024047", "0.5401603", "0.54007995", "0.5394291", "0.53909254", "0.53909254", "0.53892493", "0.53855157", "0.5376283", "0.53751194", "0.53729063", "0.5357686", "0.53504", "0.53429896", "0.53429896", "0.53429896", "0.5341101", "0.5334229", "0.5333644", "0.5325647", "0.5325559", "0.5322312", "0.5320992", "0.53049004" ]
0.0
-1
include nested taxonomies in json representation by default
def as_json(options={}) options[:include] = { :organisation => {}, :locations => { methods: :geometry, include: :accessibilities }, :taxonomies => { methods: :slug }, :meta => {}, :contacts => {}, :local_offer => {}, :send_needs => {}, :suitabilities => {}, :cost_options => {}, :regular_schedules => {}, :links => {} } super end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def taxonomies_json\n @taxons_json = []\n query_string = \"%#{params[:term]}%\"\n @taxons = Spree::Taxonomy.categories.taxons#.where(\"name like ? OR id like ?\", query_string, query_string)\n @taxons.collect{ |taxon|\n if (taxon.parent.present? && taxon.parent.parent.present? && taxon.parent.parent.parent.present?)\n name = (taxon.parent.parent.name+\" -> \"+taxon.parent.name+\" -> \"+taxon.name)\n @taxons_json << {'label' => name, 'id' => taxon.id} if name.downcase.include? params[:term].downcase\n end\n }\n render :json=>@taxons_json.to_json\n end", "def as_json(options={})\n \n methods = options[:methods] || []\n methods << :categories_by_taxonomy\n methods << :translated_categories\n methods << :excerpt\n\n relationships = options[:relationships] || {}\n relationships.store(:content_type, {})\n relationships.store(:categories, {:include => [:content, :category]}) \n \n super(options.merge({:relationships => relationships, :methods => methods}))\n\n end", "def taxon_to_json(taxon, options = {})\n {\n :id => taxon.id,\n :name => taxon.name,\n :rank => taxon.rank,\n :rank_level => taxon.rank_level,\n :iconic_taxon => options[:iconic_taxon] || taxon.iconic_taxon,\n :taxon_names => taxon.taxon_names,\n :photos => taxon.photos,\n :common_name => taxon.common_name,\n :image_url => taxon.image_url,\n :default_name => taxon.default_name\n }.to_json\n end", "def json_hash\r\n if children.size > 0\r\n children.collect { |node| { node.name => node.json_hash }.to_json }\r\n else\r\n { node.name => node.products.find(:all).collect(&:name) }.to_json\r\n end\r\n end", "def get_taxonomies(options = {})\n get \"/api/taxonomies\", options\n end", "def set_taxonomy\n c = case self.class.base_class.name\n when 'CollectionObject'\n a = current_taxon_name\n\n # If we have no name, see if there is a Type reference and use it as proxy\n # !! Careful/TODO this is an arbitrary choice, technically can be only one primary, but not restricted in DB yet\n a ||= type_materials.primary.first&.protonym\n when 'Otu'\n taxon_name&.valid_taxon_name\n when 'AssertedDistribution'\n otu.taxon_name&.valid_taxon_name\n end\n\n if c\n @taxonomy = c.full_name_hash\n # Check for required 'Kingdom'\n if @taxonomy['kingdom'].blank?\n\n # Det is only to kingdom!\n if c.rank == 'kingdom'\n @taxonomy['kingdom'] = c.name\n else\n\n # Kindom is provided in ancestors\n if a = c.ancestor_at_rank(:kingdom)\n @taxonomy['kingdom'] = a.name\n else\n\n # TODO: re-add when dwc_fields merged\n # Very edge case for single kingom nomenclatures (almost none)\n # if c.rank_class::KINGDOM.size == 1\n # @taxonomy['kingdom'] = c.rank_class::KINGDOM.first\n # end\n\n end\n end\n end\n @taxonomy\n else\n @taxonomy ||= {}\n end\n end", "def get_categories\r\n categories = Taxonomy.get_categories\r\n render json: categories, root: 'categories', adapter: :json, status: :ok\r\n end", "def subcategories_json\n {id: id, name: name, depth: depth}\n end", "def subcategories_json\n {id: id, name: name, depth: depth}\n end", "def get_subcategories\r\n sub_categories = Taxonomy.get_subcategories\r\n render json: sub_categories, root: 'categories', adapter: :json, status: :ok\r\n end", "def index\n @taxonomies = Taxonomy.find_all_by_taxonomy_type(params[:taxonomy_type].presence || 'category')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @taxonomies }\n end\n end", "def get_taxonomies(add_params = nil)\n params = {\n uid: uid,\n }\n api_call('/stores/:uid/taxonomies(.:format)',:get,params,add_params)\n end", "def as_json(opts={})\n super(opts.merge(:include => :places))\n end", "def js_flat_hash(options = {}) # :yield: String\n @opt = {\n :max_depth => 999,\n :depth => 0,\n :children => [],\n :relationship_type => 'all' # or an Isa#id\n }.merge!(options.symbolize_keys)\n @opt[:depth] = @opt[:depth] + 1\n if @opt[:depth] < @opt[:max_depth]\n self.child_ontology_relationships(@opt).each do |n|\n @opt[:children] << n\n n.ontology_class1.js_flat_hash(@opt)\n end\n end\n return @opt[:children]\n end", "def as_json(options={})\n super(methods: :type)\n end", "def as_json(options = nil)\n granularity.as_json(options)\n end", "def to_json\n super.merge(\n date: formatted_date(Time.current),\n taxOverride: tax_override\n )\n end", "def as_json(options={})\n super(:include => :locations)\n end", "def as_json(options=nil)\n json = super\n json.merge({\"type\"=>self.type.to_s})\n end", "def render_process_tree_json (expressions)\n\n OpenWFE::Json.encode(expressions.tree)\n end", "def show\n render json: @tax\n end", "def as_json(args={})\n root = args.fetch(:root, options[:root])\n data = serialize root[:type]\n \n if root[:type] == :collection && !root[:key]\n data\n else\n hash = {}\n hash.merge! serialize_meta\n hash.merge! root[:key] ? {root[:key] => data} : data\n end\n \n end", "def global_scope\n respond_to?(:scoped_object) && scoped_object ? scoped_object.taxonomies : Taxonomy\n end", "def as_json(options={})\n options ||= {}\n if root = options.fetch(:root, @options.fetch(:root, root_name))\n @options[:hash] = hash = {}\n @options[:unique_values] = {}\n\n hash.merge!(root => serializable_hash)\n include_meta hash\n hash\n else\n serializable_hash\n end\n end", "def as_json(_opts = {})\n {}.tap do |root|\n root[TYPE_KEY] = type\n root[ID_KEY] = object_identifier\n root[ATTRIBUTES_KEY] = generate_attributes\n append_relationships(root)\n append_meta(root)\n append_includes(root)\n end\n end", "def to_json(_ = nil)\n { @root => wrap_objects.as_json(root: false) }.to_json\n end", "def as_json \n {\n id: id,\n tax: tax,\n subtotal: subtotal,\n total: total \n }\n end", "def as_json(_opts = {})\n # Rails.logger.debug \"Tag #{id}: as_json\"\n hash = super(_opts)\n hash.reject! {|k,v| v.blank? }\n hash[:gml] = self.gml_hash && self.gml_hash['gml']\n hash[:gml] ||= self.gml_hash && self.gml_hash['GML']\n hash[:gml] ||= {}\n hash\n end", "def get_spree_taxonomies\n @spree_taxonomies = TaxonomySync.find(:all)\n end", "def as_json(options = {})\n {\n :gear => properties['gear'],\n :talents => properties['talents'],\n :active => if not properties['active'].nil?\n properties['active']\n elsif not properties['active_talents'].nil?\n properties['active_talents']\n else\n 0\n end,\n :options => {\n :general => {\n :level => properties['level'],\n :race => properties['race']\n },\n },\n :artifact => properties['artifact']\n }\n end", "def as_json(options={})\n #options[:include] = []\n options[:except] = EXCLUDED_JSON_ATTRIBUTES\n\n super(options)\n end", "def as_json(options={})\n #options[:include] = []\n options[:except] = EXCLUDED_JSON_ATTRIBUTES\n\n super(options)\n end", "def as_json(options={})\n #options[:include] = []\n options[:except] = EXCLUDED_JSON_ATTRIBUTES\n\n super(options)\n end", "def as_json(options={})\n #options[:include] = []\n options[:except] = EXCLUDED_JSON_ATTRIBUTES\n\n super(options)\n end", "def get_taxonomy(rid, add_params = nil)\n params = {\n uid: uid,\n rid: rid,\n }\n api_call('/stores/:uid/taxonomies/:rid(.:format)',:get,params,add_params)\n end", "def index\n @taxonomy_categories = TaxonomyCategory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @taxonomy_categories }\n end\n end", "def index\n render json: Term.roots\n .includes(:user)\n .map(&:serialize_list),\n status: :ok\n end", "def as_json(_options = {})\n super include: %i[sample_type object_type]\n end", "def find_taxonomies\n @document.xpath('.//taxonomy').each do |taxonomy_node|\n taxonomy_name = taxonomy_node.at_xpath('.//taxonomy_name')\n tax_node = insert_node(SecureRandom.uuid, taxonomy_name.content, @root_node)\n @taxonomies << tax_node\n add_node(taxonomy_node, tax_node, skip_add: true)\n end\n end", "def as_json(options={})\n # dont override Rails method\n if options[:is_super]\n if options[:root]\n {\"capital_project\" => (super(options)['capital_project'].merge! self.fundable_as_json)}\n else\n super(options)\n end\n else\n json = {\n object_key: object_key,\n agency: organization.try(:to_s),\n fy_year: fiscal_year,\n project_number: project_number,\n scope: team_ali_code.try(:scope),\n is_emergency: emergency?,\n is_sogr: sogr?,\n is_notional: notional?,\n is_multi_year: multi_year?,\n type: capital_project_type.try(:code),\n title: title,\n total_cost: total_cost,\n has_early_replacement_assets: has_early_replacement_assets?\n }\n\n\n if self.respond_to? :fundable_as_json\n json.merge! self.fundable_as_json(options)\n end\n\n json\n end\n end", "def to_nifty_json\n self.recursive_delete_if_nil.jsonify.to_json\n end", "def as_json(options = {})\n super(:include => { :member => { :only => [:name, :slug, :image_url] } })\n end", "def as_json\n {}.tap do |root|\n root[:id] = id\n root[:type] = self.class.type\n root[:attributes] = generate_attributes\n root[:relationships] = generate_relationships\n root[:meta] = generate_metadata\n end\n end", "def as_json(options=nil)\n super(include: [:size, :packs, :stocks])\n end", "def index\n @taxes = Tax.all\n\n render json: @taxes\n end", "def gen_tree\n new_tree = {}\n node_list = {}\n @json_tree.each do |k, v|\n if v['child_of'].nil?\n # top\n new_tree[k] = v\n node_list[k] = new_tree[k]\n else\n parent = v['child_of']\n if v['condition'] == 'and'\n node_list[parent]['and'] ||= {}\n node_list[parent]['and'][k] = v\n node_list[k] = node_list[parent]['and'][k]\n elsif v['condition'] == 'or'\n node_list[parent]['or'] ||= {}\n node_list[parent]['or'][k] = v\n node_list[k] = node_list[parent]['or'][k]\n else\n # TODO: sink?\n node_list[parent]['or'] ||= {}\n node_list[parent]['or'][k] = v\n node_list[k] = node_list[parent]['or'][k]\n end\n end\n end\n\n @json_tree_type = 'tree'\n @json_tree = new_tree\n end", "def as_json(options={})\n super(options.merge({:methods => :type}))\n end", "def as_json(options={})\n super(options.merge({:methods => :type}))\n end", "def as_json(options={})\n super(options.merge({:methods => :type}))\n end", "def as_json( options={} )\n { :id => id.to_s + \"_fsd\", :name => name, :data => description, :children => functions }\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 as_json(options={})\n \t\tsuper(:only => [:firstname,:lastname,:email, :language, :nationality, :birthdate, :phone, :description, :profile_picture, :banner_picture, :number_of_walks, :walking_region, :skills, :is_premium, :pricing, :professional, :is_walker],\n \t:include => {\n \t\t:preference => {:only => [:name]},\n \t\t:experience => {:only => [:value]},\n \t\t:address => {:only => [:street, :number, :numberAddition, :latitude, :longitude, :distance],\n \t\t\t:include => {\n \t\t\t\t\t:city => {:only => [:name]},\n \t\t\t\t\t:country => {:only => [:name]},\n \t\t\t\t}\n \t\t\t}\n \t}\n \t\t)\n\tend", "def apply_json_trait(value); end", "def show\n @taxonomy = Taxonomy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @taxonomy }\n end\n end", "def to_json(options = {})\n options[:root] = true unless options.key?(:root)\n super(options)\n end", "def show\n @taxon = Taxon.find(params[:id])\n @page_title = @taxon.common_name\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: [@taxon.as_json(:include => { :sightings => { :include => [ :trip ] }, :locations => { }, :photos => { :include => [ :taxon, :trip, :location ], :methods => [ :photo_URL ] } } )]}\n end\n end", "def to_json(*a)\n begin\n require 'json/pure'\n\n json_hash = {\n \"name\" => name,\n \"content\" => content,\n \"node_type\" => node_type,\n \"node_class\" => node_class,\n JSON.create_id => self.class.name\n }\n\n if has_children?\n json_hash[\"children\"] = children\n end\n\n return json_hash.to_json\n\n rescue LoadError => e\n warn \"The JSON gem couldn't be loaded. Due to this we cannot serialize the tree to a JSON representation\"\n end\n end", "def add_taxons\n save_if_new\n chain_list = get_each_assoc\n chain_list.each do |chain|\n # Each chain can contain either a single Taxon,\n # or the tree like structure parent>child>child\n name_list = chain.split(/\\s*>\\s*/)\n taxonomy_name = name_list.shift\n taxonomy = @@taxonomy_klass.find_or_create_by_name(taxonomy_name)\n raise DataShift::DataProcessingError.new(\"Could not find or create Taxonomy #{taxonomy_name}\") unless taxonomy\n taxon = taxonomy.root\n name_list.each do |taxon_name|\n taxon = @@taxon_klass.find_or_create_by_name_and_parent_id_and_taxonomy_id(taxon_name, taxon.id, taxonomy.id)\n end\n\n if taxon\n @product.taxons << taxon\n puts \" Added to taxon #{taxon.pretty_name}\"\n else\n puts \" Taxon not found or created: #{name}\"\n end\n\n end\n end", "def as_json(options={})\n # Don't override Rails method\n if options[:is_super]\n if options[:root]\n {\"capital_project\" => (super(options)['capital_project'].merge! self.fundable_as_json)}\n else\n super(options)\n end\n else\n json = {\n object_key: object_key,\n scenario: scenario.name,\n agency: organization.try(:to_s),\n fy_year: formatted_fiscal_year,\n project_number: project_number,\n scope: team_ali_code.try(:scope),\n is_emergency: emergency?,\n is_sogr: sogr?,\n is_notional: notional?,\n is_multi_year: multi_year?,\n type: capital_project_type.try(:code),\n title: title,\n total_cost: cost,\n has_early_replacement_assets: has_early_replacement_assets?,\n scenario_created: scenario.try(:created_at),\n scenario_modified: scenario.try(:updated_at),\n description: description,\n justification: justification,\n number_of_alis: number_of_alis,\n number_of_assets: number_of_assets,\n scenario_status: scenario.try(:state_title)\n }\n\n\n if self.respond_to? :fundable_as_json\n json.merge! self.fundable_as_json(options)\n end\n\n json\n end\n end", "def roots\n @objects = Node.roots\n respond_to do |format|\n format.html\n format.json {render json: @objects}\n end\n end", "def call\n add_fields(leeds_taxi: true)\n end", "def as_json(options={})\n \n methods = options[:methods] || []\n methods << :image_url\n methods << :thumbnail_url\n methods << :size\n \n relationships = options[:relationships] || {}\n \n super(options.merge({:relationships => relationships, :methods => methods}))\n\n end", "def flow_taxons_tree root_taxon, current_taxon\n return '' if root_taxon.children.empty?\n\n max_level = 1\n\n content_tag :ul, class: 'taxons-list' do\n taxons = root_taxon.children.map do |taxon|\n css_class = (current_taxon && current_taxon.self_and_ancestors.include?(taxon)) ? 'current' : nil\n content_tag :li, class: css_class do\n extra = nil\n extra = taxons_tree(taxon, current_taxon, max_level - 1) if @taxon && [current_taxon.parent.try(:id), current_taxon.id].include?(taxon.id)\n link_to(taxon.name, seo_url(taxon)) + extra\n end\n end\n safe_join(taxons, \"\\n\")\n end\n end", "def object_serialization_options\n {:except => [:site_id, :position, :ancestry, :published_on], :methods => [:parents, :data]}\n end", "def setup_taxa2tree\n Typhoeus.stub('http://api.unipept.ugent.be/api/v2/taxa2tree.json').and_return do |_|\n link = req.options[:body][:link] == 'true'\n if link\n Typhoeus::Response.new(code: 200, body: JSON.dump(gist: 'https://gist.github.com/8837824df7ef9831a9b4216f3fb547ee'))\n else\n result = JSON.parse(File.read(File.join(File.dirname(__FILE__), 'resources/taxa2tree.json')))\n Typhoeus::Response.new(code: 200, body: JSON.dump(result))\n end\n end\n end", "def as_json(options={})\r\n\t\tsuper({ :only => [:alias, :name, :description] })\r\n\tend", "def as_json(options = {})\n super(options.merge(except: %w[association_class unfiltered_collection collection]))\n end", "def categories_by_taxonomy\n\n self.categories.inject({}) do |result, category|\n \n if result.has_key?(category.taxonomy.id.to_sym)\n result[category.taxonomy.id.to_sym] << category\n else\n result[category.taxonomy.id.to_sym] = [category]\n end\n \n result \n end \n\n end", "def as_json(options = {})\r\n\t\tsuper\r\n\t\t {type: type,\r\n\t\t \t Title: Title,\r\n\t\t \t Authors: authors,\r\n\t\t \t With: with,\r\n\t\t \t Details: details,\r\n\t\t \t Year: year\r\n\t\t \t }\r\n\tend", "def get_field_deserializers()\n return super.merge({\n \"isDefault\" => lambda {|n| @is_default = n.get_boolean_value() },\n \"links\" => lambda {|n| @links = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SectionLinks.create_from_discriminator_value(pn) }) },\n \"pages\" => lambda {|n| @pages = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::OnenotePage.create_from_discriminator_value(pn) }) },\n \"pagesUrl\" => lambda {|n| @pages_url = n.get_string_value() },\n \"parentNotebook\" => lambda {|n| @parent_notebook = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Notebook.create_from_discriminator_value(pn) }) },\n \"parentSectionGroup\" => lambda {|n| @parent_section_group = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SectionGroup.create_from_discriminator_value(pn) }) },\n })\n end", "def index\n @taxonomies = Spree::Taxonomy.includes(:taxons).order(\"spree_taxons.name\")\n ## ajax request handler\n #if request.xhr? # get ajax request or in shops_ajax() method\n # @product_list = [];\n # if params[\"colors\"].present?\n # @colors.each do |color|\n # color.variants.each do |variant|\n # @product_list << variant if variant.present? && variant.product.present?\n # end\n # end\n # end\n # render :json => {\n # ajax:\"ajax\", :products => @product_list, searcher:@searcher, taxonomies:@taxonomies, colors:@colors, materials:@materials, prices:@prices\n # }\n #end\n end", "def as_json(options={})\n\t\tsuper(only: [:usage,:body])\n\tend", "def as_jsonld(opts = { related: Ladder::Config.settings[:with_relations] })\n JSON.parse update_resource(opts.slice :related).dump(:jsonld, { standard_prefixes: true }.merge(opts))\n end", "def set_token_data(current_types, personality, term)\n current_types.inject({}) do |token_data, content_type|\n humanized_content_type = humanize_content_type(content_type)\n token_data[humanized_content_type] = set_single_type_data(content_type, personality, term)\n token_data\n end.to_json\n end", "def to_tree\n if term?\n [type, *args]\n else\n [type, *args.map(&:to_tree)]\n end\n end", "def taxons_with_ancestors\n taxons.flat_map(&:breadcrumb_trail)\n end", "def index\n @taxes = params['item_id'] ? Item.find(params['item_id']).taxes : Tax.all\n render json: @taxes\n end", "def index\n @luxire_taxonomies = LuxireTaxonomy.all\n end", "def as_json(options={})\n super :except => [:_index, :_type, :_version, :_score, :_explanation, :sort, :highlight]\n end", "def as_indexed_json(option={})\n \t self.as_json(\n \t \t include: {\n \t \t \t department: { only: :name },\n \t \t \t bmet_model: { only: [:model_name, :manufacturer_name, :vendor_name]}\n\t\t })\n end", "def as_json(options = {})\n super(only: occurrence_fields)\n end", "def default_serializer_options\r\n\t\t{root: false}\r\n\tend", "def as_json(options = {})\n super(options.merge(include: :author))\n end", "def update!(**args)\n @taxonomies = args[:taxonomies] if args.key?(:taxonomies)\n end", "def update!(**args)\n @taxonomies = args[:taxonomies] if args.key?(:taxonomies)\n end", "def update!(**args)\n @taxonomies = args[:taxonomies] if args.key?(:taxonomies)\n end", "def as_indexed_json(options={})\n {\n title: title,\n text: text,\n categories: categories.map(&:title),\n authors: authors.as_json(methods: [:full_name], only: [:full_name, :first_name, :last_name]),\n comments: comments.as_json(only: [:text, :author])\n }\n end", "def as_indexed_json(options={})\n self.as_json(\n include: { categories: { only: :title},\n authors: { methods: [:full_name, :department], only: [:full_name, :department] },\n comments: { only: :text }\n })\n end", "def get_taxonomies_support_data\n return @client.raw(\"get\", \"/config/taxonomies/support-data\")\n end", "def create_taxonomy(rid, add_params = nil)\n params = {\n uid: uid,\n rid: rid,\n }\n api_call('/stores/:uid/taxonomies/:rid(.:format)',:post,params,add_params)\n end", "def tax_1\n get_or_build_tax_for_key(\"tax_1\")\n end", "def base_options\n {\n id: :id,\n title: :title,\n node: nil,\n type: :tree,\n root: false,\n level: 0,\n namespace: [],\n controller: params[:controller]\n }\n end", "def initialize\n @use_tree_model = :self\n @default_taxonomy_require_both = true\n end", "def get_field_deserializers()\n return super.merge({\n \"parentNotebook\" => lambda {|n| @parent_notebook = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Notebook.create_from_discriminator_value(pn) }) },\n \"parentSectionGroup\" => lambda {|n| @parent_section_group = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SectionGroup.create_from_discriminator_value(pn) }) },\n \"sectionGroups\" => lambda {|n| @section_groups = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::SectionGroup.create_from_discriminator_value(pn) }) },\n \"sectionGroupsUrl\" => lambda {|n| @section_groups_url = n.get_string_value() },\n \"sections\" => lambda {|n| @sections = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::OnenoteSection.create_from_discriminator_value(pn) }) },\n \"sectionsUrl\" => lambda {|n| @sections_url = n.get_string_value() },\n })\n end", "def show\n @taxonomy_term = TaxonomyTerm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @taxonomy_term }\n end\n end", "def as_indexed_json(options={})\n\n # define JSON structure (including nested model associations)\n _include = self.class.reflect_on_all_associations.each_with_object({}) { |a, hsh|\n hsh[a.name] = {}\n hsh[a.name][:only] = a.klass.attribute_names\n }\n\n self.as_json(include: _include)\n end", "def new\n @taxonomy_term = TaxonomyTerm.new\n\tset_site_entities @taxonomy_term\n\t\n\trespond_to do |format|\n format.html # new.html.erb\n format.json { render json: @taxonomy_term }\n end\n end", "def index\n serialized_paths = ActiveModel::ArraySerializer.new(MODEL.all,\n each_serializer: PathSerializer).serializable_array\n serialized = ActiveModel::ArraySerializer.new(Item.all,\n each_serializer: ItemSerializer).serializable_array\n user_paths = ActiveModel::ArraySerializer.new(UserPath.all,\n each_serializer: UserPathSerializer).serializable_array\n\n render json: {\n paths: serialized_paths,\n items: serialized,\n user_paths: user_paths\n }\n# , meta: { current_user: current_user }\n end", "def as_json(options = {})\n if options[:main_components]\n main_components = true\n options.delete :main_components\n end\n\n options[:root] = true\n options[:methods] ||= []\n options[:include] ||= {}\n\n options[:methods] << :app_configurations\n options[:methods] << :valid_user_access_controls unless main_components\n options[:methods] << :valid_associated_activity_logs\n options[:methods] << :associated_dynamic_models\n options[:methods] << :associated_external_identifiers\n options[:methods] << :associated_reports\n options[:methods] << :associated_general_selections unless main_components\n options[:methods] << :page_layouts\n options[:methods] << :user_roles unless main_components\n options[:methods] << :role_descriptions\n options[:methods] << :associated_message_templates\n options[:methods] << :associated_config_libraries\n options[:methods] << :associated_protocols\n options[:methods] << :associated_sub_processes unless main_components\n options[:methods] << :associated_protocol_events unless main_components\n options[:methods] << :associated_item_flag_names\n options[:methods] << :nfs_store_filters\n\n super(options)\n end", "def flat(entity_type,search_term)\n\n endpoint = \"#{@base_uri}?request=flat&level=admin&field=#{entity_type}&value=#{search_term}&auth=#{@api_key}\"\n result = JSON.parse(RestClient.get(endpoint))\n\n result\n end" ]
[ "0.747746", "0.639918", "0.6253621", "0.6112731", "0.6091568", "0.60406125", "0.59557766", "0.5881486", "0.5881486", "0.5870913", "0.5815009", "0.57920945", "0.5584982", "0.555276", "0.5549339", "0.5548807", "0.5523041", "0.55171233", "0.5516193", "0.55018777", "0.54711175", "0.54590714", "0.5443666", "0.5436053", "0.54335195", "0.54289865", "0.5402349", "0.54018855", "0.53824776", "0.5379678", "0.53599685", "0.5359479", "0.5359479", "0.5359479", "0.53511536", "0.5347991", "0.53340876", "0.5318132", "0.53153753", "0.53117126", "0.53099954", "0.53042185", "0.5299124", "0.529233", "0.52895564", "0.5283532", "0.5269362", "0.5269362", "0.5269362", "0.5267388", "0.5264642", "0.52602446", "0.5253453", "0.5225216", "0.52248675", "0.5216389", "0.52139235", "0.5199238", "0.5195384", "0.51869756", "0.5181672", "0.51710504", "0.5170372", "0.51679933", "0.51646775", "0.5164175", "0.5163027", "0.51498556", "0.5149286", "0.51480573", "0.51469743", "0.51388305", "0.513408", "0.5132106", "0.51273954", "0.51194805", "0.5116379", "0.5110013", "0.51094466", "0.5103597", "0.51006293", "0.509919", "0.5084288", "0.5082519", "0.5082519", "0.5081194", "0.507598", "0.5075166", "0.5075048", "0.5071717", "0.5063823", "0.50560284", "0.5041801", "0.5034185", "0.50318754", "0.50313896", "0.50302184", "0.5019156", "0.50115913", "0.50091666" ]
0.63595897
2
fields that we don't care about for versioning purposes
def ignorable_fields ["created_at", "updated_at", "approved", "discarded_at", "organisation", "notes_count"] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fields; end", "def fields; end", "def fields; end", "def reserved_tracked_fields\n @reserved_tracked_fields ||= begin\n fields = ['_id', history_trackable_options[:version_field].to_s]\n modifier_field = history_trackable_options[:modifier_field]\n fields << \"#{modifier_field}_id\" if modifier_field\n fields\n end\n end", "def mutable_fields\n # everything but 0 (id) and 1 (scraped_at)\n to_a[2..-1]\n end", "def fields\n @_fields ||= {}\n end", "def computed_fields; 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 filter_fields\n\t \n\t \tremove_attribute(:version)\n\t \tremove_attribute(:op_success)\n\t \tattributes\n\n\t \t\n\t end", "def filter_fields\n\t \n\t \tremove_attribute(:version)\n\t \tremove_attribute(:op_success)\n\t \tattributes\n\n\t \t\n\t end", "def field_modified!(modified_field = nil)\n serialize_fields\n end", "def fields\n missing_method :fields\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 snapshot_hidden_custom_fields=(_arg0); end", "def get_field_deserializers()\n return super.merge({\n \"comment\" => lambda {|n| @comment = n.get_string_value() },\n \"createdBy\" => lambda {|n| @created_by = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::IdentitySet.create_from_discriminator_value(pn) }) },\n \"createdDateTime\" => lambda {|n| @created_date_time = n.get_date_time_value() },\n \"items\" => lambda {|n| @items = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::DocumentSetVersionItem.create_from_discriminator_value(pn) }) },\n \"shouldCaptureMinorVersion\" => lambda {|n| @should_capture_minor_version = n.get_boolean_value() },\n })\n end", "def fields?; @fields; end", "def value_fields\n %w(fields value).freeze\n end", "def versioned_attributes\n versioned_columns.map { |attr| [attr, send(attr)] }.to_h.with_indifferent_access\n end", "def peer_fields(version=Hive::CURRENT_VERSION)\n\t\t\tPEER_FIELDS[version]\n\t\tend", "def fields\n nil\n end", "def get_field_deserializers()\n return super.merge({\n \"createdDateTime\" => lambda {|n| @created_date_time = n.get_date_time_value() },\n \"isUsable\" => lambda {|n| @is_usable = n.get_boolean_value() },\n \"isUsableOnce\" => lambda {|n| @is_usable_once = n.get_boolean_value() },\n \"lifetimeInMinutes\" => lambda {|n| @lifetime_in_minutes = n.get_number_value() },\n \"methodUsabilityReason\" => lambda {|n| @method_usability_reason = n.get_string_value() },\n \"startDateTime\" => lambda {|n| @start_date_time = n.get_date_time_value() },\n \"temporaryAccessPass\" => lambda {|n| @temporary_access_pass = n.get_string_value() },\n })\n end", "def get_field_deserializers()\n return super.merge({\n \"applicationId\" => lambda {|n| @application_id = n.get_string_value() },\n \"changeType\" => lambda {|n| @change_type = n.get_string_value() },\n \"clientState\" => lambda {|n| @client_state = n.get_string_value() },\n \"creatorId\" => lambda {|n| @creator_id = n.get_string_value() },\n \"encryptionCertificate\" => lambda {|n| @encryption_certificate = n.get_string_value() },\n \"encryptionCertificateId\" => lambda {|n| @encryption_certificate_id = n.get_string_value() },\n \"expirationDateTime\" => lambda {|n| @expiration_date_time = n.get_date_time_value() },\n \"includeResourceData\" => lambda {|n| @include_resource_data = n.get_boolean_value() },\n \"latestSupportedTlsVersion\" => lambda {|n| @latest_supported_tls_version = n.get_string_value() },\n \"lifecycleNotificationUrl\" => lambda {|n| @lifecycle_notification_url = n.get_string_value() },\n \"notificationQueryOptions\" => lambda {|n| @notification_query_options = n.get_string_value() },\n \"notificationUrl\" => lambda {|n| @notification_url = n.get_string_value() },\n \"notificationUrlAppId\" => lambda {|n| @notification_url_app_id = n.get_string_value() },\n \"resource\" => lambda {|n| @resource = n.get_string_value() },\n })\n end", "def get_field_deserializers()\n return super.merge({\n \"committedContentVersion\" => lambda {|n| @committed_content_version = n.get_string_value() },\n \"contentVersions\" => lambda {|n| @content_versions = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::MobileAppContent.create_from_discriminator_value(pn) }) },\n \"fileName\" => lambda {|n| @file_name = n.get_string_value() },\n \"size\" => lambda {|n| @size = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n })\n end", "def fields!(fields = nil)\n mutate(:fields, fields)\n end", "def get_field_deserializers()\n return super.merge({\n \"license\" => lambda {|n| @license = n.get_string_value() },\n \"licenseType\" => lambda {|n| @license_type = n.get_enum_value(MicrosoftGraph::Models::EditionUpgradeLicenseType) },\n \"productKey\" => lambda {|n| @product_key = n.get_string_value() },\n \"targetEdition\" => lambda {|n| @target_edition = n.get_enum_value(MicrosoftGraph::Models::Windows10EditionType) },\n })\n end", "def fields\n fields = _workitem.fields.dup\n fields.delete(\"callbacks\")\n fields.delete(\"dispatched_at\")\n fields.freeze\n end", "def get_field_deserializers()\n return super.merge({\n \"downloadUri\" => lambda {|n| @download_uri = n.get_string_value() },\n \"expirationDateTime\" => lambda {|n| @expiration_date_time = n.get_date_time_value() },\n \"fulfilledDateTime\" => lambda {|n| @fulfilled_date_time = n.get_date_time_value() },\n \"reviewHistoryPeriodEndDateTime\" => lambda {|n| @review_history_period_end_date_time = n.get_date_time_value() },\n \"reviewHistoryPeriodStartDateTime\" => lambda {|n| @review_history_period_start_date_time = n.get_date_time_value() },\n \"runDateTime\" => lambda {|n| @run_date_time = n.get_date_time_value() },\n \"status\" => lambda {|n| @status = n.get_enum_value(MicrosoftGraph::Models::AccessReviewHistoryStatus) },\n })\n end", "def fields_not_to_clean\n ['deleted_record','record_before','record_after']\n end", "def version_attributes\n attributes = super\n\n if @reverted_from.nil?\n attributes\n else\n attributes.merge(:reverted_from => @reverted_from)\n end\n end", "def field(name); end", "def get_field_deserializers()\n return super.merge({\n \"useDeviceLicensing\" => lambda {|n| @use_device_licensing = n.get_boolean_value() },\n \"vpnConfigurationId\" => lambda {|n| @vpn_configuration_id = n.get_string_value() },\n })\n end", "def get_field_deserializers()\n return super.merge({\n \"appCrashCount\" => lambda {|n| @app_crash_count = n.get_number_value() },\n \"appDisplayName\" => lambda {|n| @app_display_name = n.get_string_value() },\n \"appName\" => lambda {|n| @app_name = n.get_string_value() },\n \"appPublisher\" => lambda {|n| @app_publisher = n.get_string_value() },\n \"appVersion\" => lambda {|n| @app_version = n.get_string_value() },\n \"deviceCountWithCrashes\" => lambda {|n| @device_count_with_crashes = n.get_number_value() },\n \"isLatestUsedVersion\" => lambda {|n| @is_latest_used_version = n.get_boolean_value() },\n \"isMostUsedVersion\" => lambda {|n| @is_most_used_version = n.get_boolean_value() },\n })\n end", "def get_field_deserializers() \n return super.merge({\n \"categories\" => lambda {|o, n| o.categories = n.get_collection_of_primitive_values(String) },\n \"changeKey\" => lambda {|o, n| o.change_key = n.get_string_value() },\n \"createdDateTime\" => lambda {|o, n| o.created_date_time = n.get_date_value() },\n \"lastModifiedDateTime\" => lambda {|o, n| o.last_modified_date_time = n.get_date_value() },\n })\n end", "def snapshot_hidden_custom_fields; end", "def own_fields\n @own_fields ||= {}\n end", "def get_field_deserializers()\n return super.merge({\n \"createdDateTime\" => lambda {|n| @created_date_time = n.get_date_time_value() },\n \"deviceId\" => lambda {|n| @device_id = n.get_string_value() },\n \"key\" => lambda {|n| @key = n.get_string_value() },\n \"volumeType\" => lambda {|n| @volume_type = n.get_enum_value(MicrosoftGraph::Models::VolumeType) },\n })\n end", "def contractor_request_fields\n contractor_request_all_fields - %i[nonop_source justification review_comment created_at updated_at]\n end", "def site_fields_requiring_upgrade\n @attributes[:site_fields_requiring_upgrade]\n end", "def modified_data_fields\n [:gender, :hispanic_latino, :veteran_status, :disability_status]\n end", "def field_extras\r\n return @field_extras\r\n end", "def bt_versioned_attributes\n attributes.slice(*self.class.bt_versioned_columns)\n end", "def fields\n @fields ||= []\n end", "def update_fields\n fieldlist = self.class.required_on_update + @newvalues.to_a - self.class.never_on_update\n @properties.select{|key, value| fieldlist.include?(key)}\n end", "def version_attributes\n super.merge(:user => updated_by)\n end", "def non_foreign_key_fields\n self.database_field_names - self.foreign_key_fields\n end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def get_field_deserializers()\n return super.merge({\n \"certificateData\" => lambda {|n| @certificate_data = n.get_string_value() },\n \"developerId\" => lambda {|n| @developer_id = n.get_string_value() },\n \"keyId\" => lambda {|n| @key_id = n.get_string_value() },\n \"serviceId\" => lambda {|n| @service_id = n.get_string_value() },\n })\n end", "def required_fields\n @required_fields.dup\n end", "def fields=(fields)\n @fields = ::ActiveSupport::HashWithIndifferentAccess.new fields\n end", "def fields\n @fields ||= []\n end", "def initialize(*)\n super\n @extra_fields = []\n end", "def get_field_deserializers()\n return super.merge({\n \"configurationVersion\" => lambda {|n| @configuration_version = n.get_number_value() },\n \"errorCount\" => lambda {|n| @error_count = n.get_number_value() },\n \"failedCount\" => lambda {|n| @failed_count = n.get_number_value() },\n \"lastUpdateDateTime\" => lambda {|n| @last_update_date_time = n.get_date_time_value() },\n \"notApplicableCount\" => lambda {|n| @not_applicable_count = n.get_number_value() },\n \"pendingCount\" => lambda {|n| @pending_count = n.get_number_value() },\n \"successCount\" => lambda {|n| @success_count = n.get_number_value() },\n })\n end", "def get_field_deserializers()\n return super.merge({\n \"description\" => lambda {|n| @description = n.get_string_value() },\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"isAvailable\" => lambda {|n| @is_available = n.get_boolean_value() },\n })\n end", "def arrangeable_fields\n raise NotImplementedError, 'You need to overwrite this method in the calling class'\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 attributes(new_attrs)\n @new_attrs = new_attrs.symbolize_keys\n attrs = original_attributes.merge(@new_attrs.merge({\n is_current_version: true,\n id: @record.id,\n version: @record.version + 1\n }))\n end", "def staff_request_fields\n staff_request_all_fields - %i[nonop_source justification review_comment created_at updated_at]\n end", "def get_field_deserializers()\n return super.merge({\n \"isExpirationRequired\" => lambda {|n| @is_expiration_required = n.get_boolean_value() },\n \"maximumDuration\" => lambda {|n| @maximum_duration = n.get_duration_value() },\n })\n end", "def get_field_deserializers()\n return super.merge({\n \"additionalTags\" => lambda {|n| @additional_tags = n.get_collection_of_primitive_values(String) },\n \"contentWebUrl\" => lambda {|n| @content_web_url = n.get_string_value() },\n \"contributors\" => lambda {|n| @contributors = n.get_collection_of_primitive_values(String) },\n \"createdDateTime\" => lambda {|n| @created_date_time = n.get_date_time_value() },\n \"description\" => lambda {|n| @description = n.get_string_value() },\n \"duration\" => lambda {|n| @duration = n.get_duration_value() },\n \"externalId\" => lambda {|n| @external_id = n.get_string_value() },\n \"format\" => lambda {|n| @format = n.get_string_value() },\n \"isActive\" => lambda {|n| @is_active = n.get_boolean_value() },\n \"isPremium\" => lambda {|n| @is_premium = n.get_boolean_value() },\n \"isSearchable\" => lambda {|n| @is_searchable = n.get_boolean_value() },\n \"languageTag\" => lambda {|n| @language_tag = n.get_string_value() },\n \"lastModifiedDateTime\" => lambda {|n| @last_modified_date_time = n.get_date_time_value() },\n \"numberOfPages\" => lambda {|n| @number_of_pages = n.get_number_value() },\n \"skillTags\" => lambda {|n| @skill_tags = n.get_collection_of_primitive_values(String) },\n \"sourceName\" => lambda {|n| @source_name = n.get_string_value() },\n \"thumbnailWebUrl\" => lambda {|n| @thumbnail_web_url = n.get_string_value() },\n \"title\" => lambda {|n| @title = n.get_string_value() },\n })\n end", "def check_fields\n columns= resource.model.column_names - AutoRest::AR_MAGIC_COLUMNS\n\n default_columns= columns.select { |attr| attr !~ /.*_count$/ }.map do |elem|\n [elem.intern, elem.titleize]\n end\n\n # For storing columns, I use an array and not a hash --i.e.: (:column => 'Title') -- \n # to ensure the order of the columns. I convert the params from linear array to \n # grouped array to alivianate user's data entry:\n # [[:col0, \"name0\"], [:col1, \"name1\"]] becomes [:col0, \"name0\", :col1, \"name1\"]\n \n # *TODO* This should be cleaned a little, because right now is a bit difficult\n # to remember the way the attributes for each view work.\n\n [:for_index, :for_new, :for_edit, :for_show].each do |key|\n arr= fields.send(key)\n exc= exclude_fields.send(key)\n\n if !arr # User has not supplied columns.\n arr= default_columns\n else\n # enum_for creates an enum from array, therefore protecting the original array contents.\n # each slice returns an array of specified elements: [1,2,3,4] => 1..4 => [[1,2],[3,4]]\n arr= arr.enum_for(:each_slice, 2).to_a\n end\n \n # Remove excluded fields.\n arr= arr.reject { |e| exc.map{|elem|elem.to_s}.include?(e[0].to_s) } if exc\n fields.send(\"#{key}=\", arr)\n end\n end", "def attributes_from_module_fields\n self.class.register_module_fields unless module_fields_registered?\n fields = {}\n self.class.module_fields.keys.sort.each do |k|\n fields[k.to_s] = nil\n end\n fields\n end", "def info_hash\n @fields\n end", "def fields\n @fields ||= self.class.fields.collect { |f| f.clone_for(self) }\n end", "def labor_request_fields\n labor_request_all_fields - %i[nonop_source justification review_comment created_at updated_at]\n end", "def null_controlled_fields!(attrs)\n ::ScoobySnacks::METADATA_SCHEMA.controlled_field_names.each do |field_name|\n # do not null fields that are not being changed\n next unless attrs.keys.include?(\"#{field_name}_attributes\")\n\n object.public_send(\"#{field_name}=\", [])\n end\n end", "def get_field_deserializers()\n return super.merge({\n \"bitLockerEnabled\" => lambda {|n| @bit_locker_enabled = n.get_boolean_value() },\n \"codeIntegrityEnabled\" => lambda {|n| @code_integrity_enabled = n.get_boolean_value() },\n \"earlyLaunchAntiMalwareDriverEnabled\" => lambda {|n| @early_launch_anti_malware_driver_enabled = n.get_boolean_value() },\n \"osMaximumVersion\" => lambda {|n| @os_maximum_version = n.get_string_value() },\n \"osMinimumVersion\" => lambda {|n| @os_minimum_version = n.get_string_value() },\n \"passwordBlockSimple\" => lambda {|n| @password_block_simple = n.get_boolean_value() },\n \"passwordExpirationDays\" => lambda {|n| @password_expiration_days = n.get_number_value() },\n \"passwordMinimumCharacterSetCount\" => lambda {|n| @password_minimum_character_set_count = n.get_number_value() },\n \"passwordMinimumLength\" => lambda {|n| @password_minimum_length = n.get_number_value() },\n \"passwordMinutesOfInactivityBeforeLock\" => lambda {|n| @password_minutes_of_inactivity_before_lock = n.get_number_value() },\n \"passwordPreviousPasswordBlockCount\" => lambda {|n| @password_previous_password_block_count = n.get_number_value() },\n \"passwordRequireToUnlockFromIdle\" => lambda {|n| @password_require_to_unlock_from_idle = n.get_boolean_value() },\n \"passwordRequired\" => lambda {|n| @password_required = n.get_boolean_value() },\n \"passwordRequiredType\" => lambda {|n| @password_required_type = n.get_enum_value(MicrosoftGraph::Models::RequiredPasswordType) },\n \"secureBootEnabled\" => lambda {|n| @secure_boot_enabled = n.get_boolean_value() },\n \"storageRequireEncryption\" => lambda {|n| @storage_require_encryption = n.get_boolean_value() },\n })\n end", "def fields\n @fields ||= @stats.keys.select{ |k| k != RECORDS_LISTING_KEY}.flatten.uniq\n end", "def set_old_values\n self._old_values = {}\n\n self.class.fields.each do |field|\n self._old_values[field] = self.send(field) unless field[0] == '_'\n end\n end", "def get_field_deserializers()\n return super.merge({\n \"appId\" => lambda {|n| @app_id = n.get_string_value() },\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"objectId\" => lambda {|n| @object_id_escaped = n.get_string_value() },\n \"publisher\" => lambda {|n| @publisher = n.get_string_value() },\n })\n end", "def get_field_deserializers()\n return {\n \"buildNumber\" => lambda {|n| @build_number = n.get_string_value() },\n \"bundleId\" => lambda {|n| @bundle_id = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"versionNumber\" => lambda {|n| @version_number = n.get_string_value() },\n }\n end", "def difference_fields(base_fields, remove_fields)\n fields(base_fields.to_a - remove_fields.to_a)\n end", "def fields; h.fields; end", "def versioned_attributes_before_last_save\n versioned_columns.map { |attr| [attr, attribute_before_last_save(attr)] }.to_h.with_indifferent_access\n end", "def fields\n @fields ||= @raw_message[1]\n end", "def index_fields\n\t\t\tif defined? @_index_fields\n\t\t\t\t@_index_fields\n\t\t\telse\n\t\t\t\t#column_names = self.column_names.map do |m|\n\t\t\t\t\t#m.to_sym\n\t\t\t\t#end\n\t\t\t\tsorted_attributes\n\t\t\t# \tsorted_attrs + (column_names - sorted_attrs - [\"created_at\", \"updated_at\", \"id\"])\n\t\t\tend\n\t\tend", "def fields\n self.class.fields(true)\n end", "def protobuf_fields(*fields)\n options = fields.extract_options!\n options[:only] = fields if fields.present?\n\n self._protobuf_field_options = options\n end", "def editable_attribute_names; super + additional_fields end", "def editable_attribute_names; super + additional_fields end", "def editable_attribute_names; super + additional_fields end", "def public_fields\n fields.select{ |field_name| field_name[0] != '_' }\n end", "def version_attribute(attributes)\n attributes.delete(version_field)\n end", "def get_field_deserializers()\n return super.merge({\n \"firstSeenDateTime\" => lambda {|n| @first_seen_date_time = n.get_date_time_value() },\n \"host\" => lambda {|n| @host = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SecurityHost.create_from_discriminator_value(pn) }) },\n \"kind\" => lambda {|n| @kind = n.get_string_value() },\n \"lastSeenDateTime\" => lambda {|n| @last_seen_date_time = n.get_date_time_value() },\n \"value\" => lambda {|n| @value = n.get_string_value() },\n })\n end", "def fields\n column_names.map(&:to_sym)\n .reject { |c| [:id, :created_at, :updated_at].include? c }\n end", "def fields\n []\n end" ]
[ "0.71595913", "0.71595913", "0.71595913", "0.702934", "0.6767574", "0.6604728", "0.6593999", "0.637134", "0.637134", "0.637134", "0.637134", "0.637134", "0.6359335", "0.6359335", "0.6316635", "0.62985396", "0.62604946", "0.6179765", "0.61607164", "0.6156254", "0.61280286", "0.61230797", "0.61227834", "0.6106827", "0.61066633", "0.60781205", "0.60731477", "0.6071933", "0.60660803", "0.60497165", "0.60470086", "0.60461897", "0.6043115", "0.60178965", "0.60175073", "0.60076284", "0.6004671", "0.599991", "0.59998804", "0.5996693", "0.5988308", "0.5985912", "0.5983359", "0.59819657", "0.5975364", "0.59570193", "0.59524566", "0.59514606", "0.59450454", "0.59404355", "0.59404355", "0.59404355", "0.59404355", "0.59404355", "0.59404355", "0.59404355", "0.59404355", "0.59404355", "0.59404355", "0.59404355", "0.59389824", "0.59376204", "0.59372133", "0.5935366", "0.59309304", "0.5930514", "0.59233785", "0.59207946", "0.5919801", "0.5919801", "0.5918545", "0.59164846", "0.59145975", "0.59132284", "0.5900088", "0.5890897", "0.58889294", "0.58816504", "0.5877266", "0.58721507", "0.5869459", "0.58678937", "0.58675474", "0.5865654", "0.58589214", "0.5858887", "0.5856747", "0.58567214", "0.58429915", "0.58365583", "0.5835183", "0.5834732", "0.58313596", "0.58313596", "0.58313596", "0.58288115", "0.5828317", "0.5826492", "0.5824546", "0.5818323" ]
0.6468058
7
Use callbacks to share common setup or constraints between actions.
def set_wearable_label @wearable_label = WearableLabel.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def setup_handler\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def workflow\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def default_action; end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163927", "0.6046165", "0.59465253", "0.59167755", "0.58904207", "0.58346355", "0.577713", "0.5703502", "0.5703502", "0.56531286", "0.56215113", "0.54224145", "0.5410795", "0.5410795", "0.5410795", "0.53924775", "0.5379919", "0.53580743", "0.53401667", "0.53397506", "0.5332605", "0.5312215", "0.5296594", "0.52965283", "0.52957606", "0.5259903", "0.52443177", "0.523896", "0.523896", "0.523896", "0.523896", "0.523896", "0.52329034", "0.52322394", "0.5227445", "0.5222394", "0.5220348", "0.5212759", "0.5207747", "0.5205933", "0.5176468", "0.5173833", "0.5171983", "0.51663405", "0.5159596", "0.5158247", "0.51526845", "0.5152398", "0.5151361", "0.5145775", "0.5140135", "0.51338995", "0.51127726", "0.5112607", "0.5112607", "0.5110613", "0.51067513", "0.5092337", "0.508788", "0.5081578", "0.5080434", "0.50679874", "0.50567716", "0.5051213", "0.5048352", "0.5048352", "0.5035347", "0.5026666", "0.5023127", "0.5016081", "0.50129867", "0.5000684", "0.4999752", "0.49979812", "0.499026", "0.499026", "0.49866846", "0.49800366", "0.49795717", "0.49771172", "0.4968475", "0.4965813", "0.4958072", "0.49561292", "0.4954901", "0.49536785", "0.4953058", "0.49468648", "0.49424478", "0.4932989", "0.49291888", "0.49273813", "0.49271655", "0.4925948", "0.49236968", "0.49203572", "0.49181753", "0.49173692", "0.4916862", "0.49161318", "0.49155986" ]
0.0
-1
Only allow a trusted parameter "white list" through.
def wearable_label_params params.require(:wearable_label).permit(:device_id, :activity_id, :time_end) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def filtered_parameters; end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n [:rating, :review]\n end", "def valid_params?; end", "def permitted_params\n declared(params, include_missing: false)\n end", "def permitted_params\n declared(params, include_missing: false)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def filter_parameters; end", "def filter_parameters; end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def check_params; true; end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def list_params\n params.permit(:name)\n end", "def check_params\n true\n end", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def additional_permitted_params\n []\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end", "def allow_params_authentication!; end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def param_params\n params.require(:param).permit(:param_category_id, :param_table_id, :name, :english_name, :weighting, :description)\n end", "def quote_params\n params.permit!\n end", "def list_params\n params.permit(:list_name)\n end", "def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end", "def all_params; end", "def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end", "def source_params\n params.require(:source).permit(all_allowed_params)\n end", "def user_params\n end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def get_allowed_parameters\n return _get_specific_action_config(:allowed_action_parameters, :allowed_parameters)&.map(&:to_s)\n end", "def permitted_params\n @wfd_edit_parameters\n end", "def user_params\r\n end", "def param_whitelist\n whitelist = [\n :comment,\n :old_progress, :new_progress,\n :metric_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:metric_id)\n end\n \n whitelist\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def get_params\n\t\t\n\t\treturn ActionController::Parameters.new(self.attributes).permit(:first_name, :last_name, :email, :provider)\n\n\tend", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end", "def params_permit\n params.permit(:id)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def filter_params\n params.permit(*resource_filter_permitted_params)\n end", "def community_params\n params.permit(:profile_image, :name, :description, :privacy_type, :viewed_by, {tags: []}, {features: []}, {admins: []}, :members, :location, :beacon, :creator, :ambassadors, :current_events, :past_events, :feed, :category, :address, :allow_member_post_to_feed, :allow_member_post_to_events)\n end", "def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend", "def authorize_params\n super.tap do |params|\n %w[display scope auth_type].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end", "def feature_params_filter\n params.require(:feature).permit(:name, :cat, :lower, :upper, :opts, :category, :description, :company, :active, :unit, :icon)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def argument_params\n params.require(:argument).permit(:name)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def property_params\n params.permit(:name, :is_available, :is_approved, :owner_id)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end", "def whitelist_person_params\n params.require(:person).permit(:family, :pre_title, :given_name, :dates, :post_title, :epithet, :dates_of_office, same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end", "def parameters\n nil\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def sequence_param_whitelist\n default_param_whitelist << \"show_index\"\n end", "def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end", "def normal_params\n reject{|param, val| param_definitions[param][:internal] }\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def special_device_list_params\n params.require(:special_device_list).permit(:name)\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end" ]
[ "0.7121987", "0.70541996", "0.69483954", "0.6902367", "0.6733912", "0.6717838", "0.6687021", "0.6676254", "0.66612333", "0.6555296", "0.6527056", "0.6456324", "0.6450841", "0.6450127", "0.6447226", "0.6434961", "0.64121825", "0.64121825", "0.63913447", "0.63804525", "0.63804525", "0.6373396", "0.6360051", "0.6355191", "0.62856233", "0.627813", "0.62451434", "0.6228103", "0.6224965", "0.6222941", "0.6210244", "0.62077755", "0.61762565", "0.61711127", "0.6168448", "0.6160164", "0.61446255", "0.6134175", "0.6120522", "0.6106709", "0.60981655", "0.6076113", "0.60534036", "0.60410434", "0.6034582", "0.6029977", "0.6019861", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.60184896", "0.60157263", "0.6005857", "0.6003803", "0.60012573", "0.59955895", "0.5994598", "0.5993604", "0.5983824", "0.5983166", "0.5977431", "0.597591", "0.5968824", "0.5965953", "0.59647584", "0.59647584", "0.59566855", "0.59506303", "0.5950375", "0.59485626", "0.59440875", "0.5930872", "0.5930206", "0.5925668", "0.59235454", "0.5917905", "0.59164816", "0.5913821", "0.59128743", "0.5906617", "0.59053683", "0.59052664", "0.5901591", "0.58987755", "0.5897456", "0.58970183", "0.58942604" ]
0.0
-1
Passwords are always required if it's a new record, or if the password or confirmation are being set somewhere. From Devise gem
def password_required? !persisted? || !password.nil? || !password_confirmation.nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def password_required?\n if new_record?\n !(password.blank? && password_confirmation.blank?)\n else\n super\n end\n end", "def password_required?\n new_record? ? super : false\n end", "def password_required?\n new_record? ? super : false\n end", "def password_required?\n new_record? ? false : super\n end", "def password_required?\n new_record? ? false : super\n end", "def password_required?\n new_record? ? false : super\n end", "def password_required?\n self.new_record? or !self.password.nil?\n end", "def password_required?\n (!password.blank? && !password_confirmation.blank?) || new_record?\n end", "def password_required?\n (!password.blank? && !password_confirmation.blank?) || new_record?\n end", "def password_required?\n # new_record? ? false : super\n false\n end", "def password_required?; end", "def password_required?; false; end", "def password_required?\n return false if new_record?\n return false if can_log_in?\n return false if password.blank? and password_confirmation.blank?\n end", "def password_required?\n if !persisted?\n false\n else\n !password.nil? || !password_confirmation.nil?\n end\n end", "def password_required?\n if !persisted?\n false\n else\n !password.nil? || !password_confirmation.nil?\n end\n end", "def password_required?\n if !persisted? \n false\n else\n !password.nil? || !password_confirmation.nil?\n end\n end", "def password_required?\n super\n end", "def password_required?\n super\n end", "def password_required?\n false\n end", "def password_required?\n false\n end", "def password_required?\n false\n end", "def password_required?\n false\n end", "def password_required?\n false\n end", "def password_required?\n false\n end", "def password_required?\n false\n end", "def password_required?\n super if confirmed?\n end", "def password_required?\n super if confirmed?\n end", "def password_required?\n super if confirmed?\n end", "def password_required?\n self.new_record? || self.encrypted_password.blank?\n end", "def password_required?\n confirmed? ? super : false\n end", "def password_required?\n super if confirmed?\n end", "def password_required?\n super if confirmed?\n end", "def password_required?\n super if confirmed?\n end", "def password_required?\n super if confirmed?\n end", "def password_required?\n super if confirmed?\n end", "def password_required?\n super if confirmed?\n end", "def password_required?\n confirmed? ? super : false\n end", "def password_required?\n !persisted? || !password.blank? || !password_confirmation.blank?\n end", "def password_required? \n false \n end", "def needs_password?\n self.new_record? || !self.password.blank?\n end", "def needs_password?\n self.new_record? || !self.password.blank?\n end", "def password_required?\n !persisted? || password.present? || password_confirmation.present?\n end", "def password_required?\n super && self.is_password_set\n end", "def password_required?\n new? or password\n end", "def password_required?\n force_password_validation || !password.nil? || !password_confirmation.nil?\n end", "def password_required?\n allow_blank_password ? false : super\n end", "def password_required?\n allow_blank_password ? false : super\n end", "def password_required?\n super if confirmed?\nend", "def password_required?\n password.present? || password_confirmation.present?\n end", "def password_required?\n new? or password\n end", "def password_required?\n !persisted? || !password.nil? || !password_confirmation.nil?\n end", "def password_required?\n if new_record? && oauth_account\n false\n else\n super\n end\n end", "def password_required?\n !persisted? || !password.nil? || !password_confirmation.nil?\n end", "def password_required?\n !persisted? || !password.nil? || !password_confirmation.nil?\n end", "def require_password?\n if self.new_record?\n APP_CONFIG[:auto_activate] or self.password\n else\n true and !self.password.nil?\n end\n end", "def password_required?\r\n #!persisted? || !password.nil? || !password_confirmation.nil?\r\n !password.nil? || !password_confirmation.nil?\r\n end", "def password_required?\n if authentications.empty?\n super || encrypted_password.blank?\n elsif new_record?\n false\n else\n super || encrypted_password.blank? && authentications.find{|a| a.valid?}.nil?\n end\n end", "def password_required?\n if authentications.empty?\n super || encrypted_password.blank?\n elsif new_record?\n false\n else\n super || encrypted_password.blank? && authentications.find{|a| a.valid?}.nil?\n end\n end", "def password_required?\n\n ( new_record? && meetup_uid.nil? ) || !password.nil? || !password_confirmation.nil?\n end", "def password_required?\n !persisted? || !password.nil? || !password_confirmation.nil?\n end", "def password_required?\n !persisted? || !password.nil? || !password_confirmation.nil?\n end", "def password_required?\n return false if !persisted? and provider.present?\n super\n end", "def password_required?\n \n ( new_record? && oauth2_uid.nil? ) || !password.nil? || !password_confirmation.nil?\n end", "def password_required?\n return false if self.guest? || self.customer?\n super\n end", "def requires_password?\n is_new = (respond_to?(:new_record?) && new_record?)\n is_new || !ZeroAuth::Utils.empty?(password)\n end", "def validate_password?\n new_record? || password.present? || password_confirmation.present?\n end", "def password_required?\n if persisted?\n return (!password.nil? || !password_confirmation.nil?)\n else\n return (password == \"\")\n end\n end", "def password_required?\n\t\t!persisted? || ( !password.nil? and !password.blank? ) || !password_confirmation.nil?\n\tend", "def password_required?\n admin? && (!persisted? || !password.nil? || !password_confirmation.nil?)\n end", "def password_required?\n (!persisted? && user_tokens.empty?) || password.present? || password_confirmation.present?\n end", "def password_required?\n provider.present? ? false : super\n end", "def password_required?\n @password_required\n end", "def generate_password\n if new_record?\n self.password = self.password_confirmation = /\\w{0,10}/.gen unless password\n end\n end", "def password_required?\n is_user? && super && provider.blank? # provider.blank?\n end", "def password_required?\n provider.blank? && super\n end", "def password_required=(value)\n @password_required = value\n end", "def password_required=(value)\n @password_required = value\n end", "def password_required=(value)\n @password_required = value\n end", "def password_required?\n (identities.empty? || !password.blank?) && super\n end", "def password_required?\n !password.nil?\n end", "def password_required?\n !password.nil?\n end", "def password_required?\n new_record? ? not_using_openid? && (crypted_password.blank? || !password.blank?) : !password.blank?\n end", "def password_required?\n new_record? ? not_using_openid? && (crypted_password.blank? || !password.blank?) : !password.blank?\n end", "def password_required?\n new_record? ? not_using_openid? && (crypted_password.blank? || !password.blank?) : !password.blank?\n end", "def password_required?\n new_record? ? not_using_openid? && (crypted_password.blank? || !password.blank?) : !password.blank?\n end", "def password_required?\n new_record? ? not_using_openid? && (crypted_password.blank? || !password.blank?) : !password.blank?\n end", "def password_required?\n super && uid.blank?\n end", "def password_required?\n super && provider.blank?\n end", "def password_required?\n super && provider.blank?\n end", "def password_required?\n super && provider.blank?\n end", "def password_required?\n super && provider.blank?\n end", "def password_required?\n super && provider.blank?\n end", "def password_required?\n super && provider.blank?\n end", "def password_required?\n super && provider.blank?\n end", "def password_required?\n super && provider.blank?\n end" ]
[ "0.81638765", "0.7941983", "0.7941983", "0.79235035", "0.79235035", "0.79235035", "0.791259", "0.7848863", "0.7848863", "0.7837047", "0.78369117", "0.7766266", "0.7762016", "0.7751134", "0.7751134", "0.77381426", "0.77215606", "0.77215606", "0.7691685", "0.7691685", "0.76897186", "0.76897186", "0.76897186", "0.76897186", "0.76897186", "0.7679536", "0.7679536", "0.7679536", "0.7648909", "0.76447177", "0.7630739", "0.7630739", "0.7630739", "0.7630739", "0.7630739", "0.7630739", "0.7630403", "0.76042557", "0.7591321", "0.7579043", "0.7579043", "0.7565703", "0.7556529", "0.7555882", "0.75434846", "0.75394595", "0.75394595", "0.7535719", "0.7518794", "0.75051785", "0.7484588", "0.74788344", "0.74653596", "0.74653596", "0.7438694", "0.7408755", "0.74006647", "0.74006647", "0.7393115", "0.7382068", "0.7382068", "0.7375391", "0.73620474", "0.7360016", "0.73565674", "0.73428875", "0.7331003", "0.730682", "0.72975934", "0.7288321", "0.72780216", "0.7272953", "0.72563094", "0.7255142", "0.7238796", "0.7234256", "0.7234256", "0.7234256", "0.7215834", "0.72036374", "0.72036374", "0.71956444", "0.71956444", "0.71956444", "0.71956444", "0.71956444", "0.71936184", "0.71911263", "0.71911263", "0.71911263", "0.71911263", "0.71911263", "0.71911263", "0.71911263", "0.71911263" ]
0.75781906
45
Return full name of user
def full_name "#{first_name} #{last_name}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def full_name\n name = `finger $USER 2> /dev/null | grep Login | colrm 1 46`.chomp\n name.empty? ? \"John Doe\" : name.squish\n end", "def user_full_name\n if user\n user.first_name + ' ' + user.last_name\n else\n 'Anonymous'\n end\n end", "def full_name\n name = `finger $USER 2> /dev/null | grep Login | colrm 1 46`.chomp\n name.present? ? name.squish : \"John Doe\"\n end", "def user_full_name\n user ? user.full_name : \"Anonymous\"\n end", "def full_user_name\n formatedName=first_name[0].upcase+first_name[1,first_name.size].downcase+\" \"+last_name[0].upcase+last_name[1,last_name.size].downcase\n return formatedName.strip if (first_name || last_name)\n return \"Anonymous\"\n end", "def proper_name # method to get the full name of user\n first_name + \" \" + last_name\n end", "def user_full_name\n @user[\"name\"]\n end", "def full_name(user)\n user.first_name + ' ' + user.last_name\n end", "def full_name\n if user_data\n \"#{user_data['first_name']&.downcase&.capitalize} #{user_data['last_name']&.downcase&.capitalize}\"\n end\n end", "def short_user_name\n user.first_name\n end", "def full_name\n \"#{username}/#{name}\"\n end", "def simple_username\n return user.firstname + ' ' + user.lastname.first + '.' if !user.nil?\n name\n end", "def user_name\n\t\tobject.user.full_name \n\tend", "def user_name\n return User.find(user_id).name\n end", "def user_name\n return User.find(user_id).name\n end", "def name\n\t\tn = names\n\t\treturn n[:fullname] if n[:fullname]\n\t\treturn n[:username] if n[:username]\n\t\treturn I18n.translate(\"user.name.unknown\")\n\tend", "def full_name\n if self.user\n user.full_name\n else\n self.name\n end\n end", "def full_name\n if self.profile.present?\n \"#{self.profile.first_name.capitalize} #{self.profile.last_name.capitalize}\"\n else\n \"#{username.capitalize}\"\n end\n end", "def full_name \n if current_user\n current_user.firstname + \" \" + current_user.lastname\n else\n \"Please Log in\"\n end\n end", "def user_name\n user ? user.name : ''\n end", "def user_name\n user ? user.name : ''\n end", "def user_name\n user ? user.name : ''\n end", "def user_name\n user ? user.name : ''\n end", "def user_name\n user ? user.name : ''\n end", "def user_name\n user ? user.name : ''\n end", "def user_name\n user ? user.name : ''\n end", "def user_name\n user ? user.name : ''\n end", "def user_name\n user ? user.name : ''\n end", "def user_name\n user ? user.name : ''\n end", "def user_name\n name = user.nil? ? '' : user.name\n end", "def get_user_name\n\t\tretVal = \"User Not Found\"\n\t\tuser_id = self.user_id\n\t\tuser = User.find(user_id, :select=>[\"fname\",\"lname\"])\n\t\tunless user.nil?\n\t\t\tretVal = user.fname + \" \" + user.lname\n\t\tend\n\t\treturn retVal\n\tend", "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 get_full_name(user_id)\n if user_id\n u = User.find(user_id)\n return u.firstname + \" \" + u.lastname\n else\n return \"Unknown\"\n end\n end", "def display_name\n username\n end", "def full_name\n\t\tself.user_fname.capitalize + \" \" + self.user_lname.capitalize\n\tend", "def full_name\n \tif !self.first_name.nil? && !self.last_name.nil?\n\t\t\"#{self.first_name.titleize} #{self.last_name.titleize}\"\n\telsif !self.oauth_user_name.nil?\n\t\tself.oauth_user_name\n\telse\n\tend\n end", "def user_full_name\n first_name + \" \" + last_name\n end", "def user_name\n decode_string_member(:user_name)\n end", "def full_name\n \n if (not self.first_name.nil? and not self.first_name.eql? \"\") or (not self.last_name.nil? and not self.last_name.eql? \"\")\n \"#{self.title} #{self.first_name} #{self.last_name}\".strip\n elsif self.username\n self.username \n else\n # wrapped email only prefix\n\n parsed_email = self.email.split('@')\n parsed_email[0]\n end\n end", "def full_name\n \tif self.first_name != nil and self.last_name != nil\n \t\tself.first_name + \" \" + self.last_name\n \telse\n \t\t\"User does not have a full name\"\n \tend\n end", "def get_full_name(user)\n begin\n Etc.getpwnam(\"#{user}\")[\"gecos\"].chomp\n # or with dscl\n # %x(dscl /Search -read /Users/#{user} dsAttrTypeNative:cn).split.drop(1).join(\" \") \n rescue Exception => e\n end\n \n end", "def display_name \n username\n end", "def get_user_name(user_id)\n User.find(user_id).name rescue nil\n end", "def display_name\n #self.email.split('@')[0]\n self.username\n end", "def name\n \"#{user_name.titleize}\"\n end", "def full_name\n \"#{self.first_name} #{self.last_name}\"\n # can got to rails console and type command \"user = User.first\" => \"user.full_name\"\n end", "def get_user_name\n if first_name.blank?\n return email.split('@').first.capitalize unless email.blank? \n else\n return first_name.capitalize + \" \" + last_name.capitalize\n end \n return ''\n end", "def user_display_name\n @attributes[:user_display_name]\n end", "def full_name\n (@session[:current_user_details] || {})[:description]\n end", "def name\n if first_name.present? || last_name.present?\n [first_name, last_name].join(\" \").strip\n else\n username\n end\n end", "def full_username\r\n return @user.username + '#' + @user.discriminator\r\n end", "def get_realname\n response = get_current_user_meta('realname')\n realname = response['query']['userinfo']['realname']\n return if realname == ''\n\n realname\n end", "def display_name\n \"#{username} <#{email}>\"\n end", "def user_name(user)\n current_user == user ? I18n.t('helpers.me') : user.name\n end", "def full_name\n if !first_name && !last_name\n return \"New User\"\n else\n return first_name + \" \" + last_name\n end\n end", "def user_name\n User.find(self.user_id).name\n end", "def user_full_name\n return object.billing_name if object.billing_name.present?\n \"#{user_firstname} #{user_lastname}\"\n end", "def user_name\n if self.user.blank?\n \"-\"\n else\n self.user.name\n end\n end", "def hubssolib_get_user_name\n user = self.hubssolib_current_user\n user ? user.user_real_name : nil\n end", "def display_name_for(user)\n user.first_name.capitalize + ' ' + user.last_name.capitalize + ' ( ID: ' + user.reference_number + ')'\n end", "def full_name\n \treturn \"#{first_name} #{last_name}\".strip if(first_name || last_name) \n \t\"Anonymous\"\n end", "def user_name\n read_attribute('user_name') || \"anonymous\"\n end", "def to_s\n return user.name\n end", "def name_of(user)\n user.to_s\n end", "def get_user_name_not_null\n user = User.first(:id => self.user_id )\n return user.login if user\n return \"anon\"\n end", "def full_name\n \"#{user_profile.first_name} #{user_profile.last_name}\" unless user_profile.blank?\n end", "def full_name\n return '' unless profile\n profile.full_name\n end", "def user_name\n name = self.le_user.nil? ? '' : self.le_user.name\n end", "def display_user(user)\n user.name\n end", "def user_name\n @user_name ||= SlackUtils::SingletonClient.instance.find_user_name(@user_id)\n end", "def sol_full_name(user)\n user.sol_f_name + ' ' + user.sol_fl_name\n end", "def name\n userName\n end", "def name(user_id)\n User.find(user_id).email\n end", "def user_name(uid)\n deter_lab.get_profile(uid).try(:[], \"name\")\n end", "def full_name()\n name + ' ' + last_name\n end", "def user_name(user_id)\n user = User.where(id: user_id).name\n\n assert(user.kind_of?(User))\n\n return user\n end", "def get_username\n @user_name ||= self.user.username\n end", "def user_name\n self.user.login\n end", "def user_name\n self.user.login\n end", "def full_name\n \"#{first_name} #{last_name}\"\n end", "def full_name\n \"#{first_name} #{last_name}\"\n end", "def full_name\n \"#{first_name} #{last_name}\"\n end", "def full_name\n\t\treturn self.salutation.to_s + \" \" + self.last_name.to_s + \" \" + self.first_name.to_s\n end", "def full_name\n json[\"entry_data\"][\"ProfilePage\"].first[\"graphql\"][\"user\"][\"full_name\"]\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 login_user_name\n user_name.tr('.', '')\n end", "def user_name(name = nil)\n return user_name_from_name(name) if name\n\n user_name_random\n end", "def get_current_user_name\n return @name if @name\n name = get_current_user_meta\n name = name['query']['userinfo']['name'] if name\n\n name\n end", "def name\n \"#{self.class.name.titleize}: #{user.email rescue 'unknown user'}\"\n end", "def user_name\n @message[:user][:name]\n end", "def name\n if facebook_authentication && facebook_authentication.display_name\n return facebook_authentication.display_name\n end\n return username\n end", "def full_name\n \"#{first_name} #{last_name}\"\n end", "def full_name\n return first_name + \" \" + last_name\n end", "def full_name\n return first_name + \" \" + last_name\n end", "def user_name\n if /(.*)-\\d{8}-\\d{6}$/ =~ perma_link\n return $1\n else\n return \"unknown\"\n end\n end", "def full_name\n return \"#{@first_name} #{@last_name}\"\n end", "def full_name\n return \"#{@first_name} #{@last_name}\"\n end", "def full_name()\n @name.to_s\n end", "def user_name\n \"someone\"\n end" ]
[ "0.87781364", "0.87675637", "0.8756223", "0.8512964", "0.84118307", "0.835626", "0.83395845", "0.8329259", "0.83262295", "0.83164406", "0.83014554", "0.823807", "0.81992286", "0.818809", "0.818809", "0.8180574", "0.8163273", "0.81335753", "0.81133306", "0.8111114", "0.8111114", "0.8111114", "0.8111114", "0.8111114", "0.8111114", "0.8111114", "0.8111114", "0.8111114", "0.8111114", "0.80712014", "0.80508494", "0.8047182", "0.8047182", "0.8047182", "0.8045652", "0.8044641", "0.8036027", "0.80311614", "0.80257213", "0.8004985", "0.7994408", "0.79929435", "0.7974889", "0.79286546", "0.7924818", "0.7900781", "0.7898887", "0.7897171", "0.7874411", "0.78669333", "0.7858341", "0.7839702", "0.78383785", "0.78102493", "0.7774979", "0.7770733", "0.7750887", "0.7744265", "0.7737069", "0.77272636", "0.77228045", "0.7721858", "0.7721346", "0.77142996", "0.7698778", "0.7690568", "0.76858", "0.7679977", "0.7657117", "0.76537967", "0.76458716", "0.7637922", "0.7623855", "0.76206887", "0.76113546", "0.76073545", "0.76066154", "0.7592854", "0.75913584", "0.75773746", "0.75773746", "0.75694966", "0.75694966", "0.75694966", "0.7561622", "0.7551835", "0.7545886", "0.75359833", "0.7525757", "0.751376", "0.7498095", "0.7497211", "0.7493255", "0.7492667", "0.74924856", "0.74924856", "0.74823076", "0.747494", "0.747494", "0.74701345", "0.7469255" ]
0.0
-1
nulls user session (logout)
def destroy session[:user_id] = nil session[:user_name] = nil redirect_to '/login' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logout\n session[:user] = nil\n end", "def logout\n @session[:user] = nil\n end", "def log_out\n\t\tsession[:user_id] = nil\n\tend", "def log_out\n session.delete(:user_id)\n @current_user=nil\n end", "def logout\n session[:user_id] = nil\n end", "def logout\n session[:user_id] = nil\n end", "def log_out\n session.delete(:user_id)\n session.delete(:user_name)\n session.delete(:user_email)\n @current_user = nil\n end", "def logout\n\t\tsession[:user_id] = nil\n\tend", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session[:user_id] = nil\n end", "def log_out\n session.delete(:user_id)\n session.delete(:user_type)\n session.delete(:user_email)\n @current_user = nil\n end", "def log_me_out\n session['user'] = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil \n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\nend", "def log_out \n session.clear\n @current_user = nil\n end", "def log_out\n \tsession.delete(:user_id)\n \t@current_user = nil\n end", "def logout\n @current_user = session[:user_id] = nil\n end", "def log_out\n\t \tsession.delete(:user_id)\n\t \t@current_user =nil\n\t end", "def logout\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n\t\tsession.delete(:user_id)\n\t\t@current_user= nil\n\tend", "def logout_user\n session[:user_id] = nil\n end", "def logout\n # session.delete(:user_id) does the same thing\n session[:user_id] = nil\n end", "def logout\n session.delete :user_id\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n\n end", "def log_out_now\n\tsession[:user_id] = nil\nend", "def log_out\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend", "def log_out\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend", "def log_out\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend", "def log_out\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend", "def log_out\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def logout\n @current_user = nil\n session.delete(:user_id)\n end", "def signout\n session.delete(:user_id)\n @current_user = nil\n end", "def logout\n user_id = session[:user_id]\n session[:user_id] = nil\n user_id\n end", "def logout\n session.delete(:user_id)\n end", "def logout\n\t\t\tPicombo::Session.instance.unset('loggedin')\n\t\t\tPicombo::Session.instance.unset('user')\n\t\tend", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:uid)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id) #remove the user id from the browser cache\n @current_user = nil\n end", "def log_out\n session.delete(:username)\n session.delete(:token)\n @current_user = nil\n end", "def logout_user\n session[:current_user_id] = nil\n session[:current_auditor_id] = nil\n session[:company_id] = nil\n session[:name] = nil\n session[:last_login_at] = nil\n session[:plan] = nil\n reset_session\n redirect_to \"http://www.profitbooks.net/logout\"\n end", "def log_out\n session.delete(:user_id)\n session.delete(:destination)\n @current_user = nil\n @current_dest = nil\n end", "def logout\n \t\tsession[:user]=nil\n \t\tredirect_to users_url\n \tend", "def log_out\n session.delete(:user_id)\n session.delete(:type)\n @current_user = nil\n end", "def log_out\n reset_session\n @current_user = nil\n end", "def signout\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n forget(@current_user)\n @current_user=nil\n end", "def logout\n session[:user] = nil\n redirect_to '/'\n end", "def logout\n session[:user] = nil\n redirect_to '/'\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n session.delete(:user_type_string)\n @current_user = nil\n end", "def logout\n session.delete(:user_id) if current_user\n end", "def log_out\n forget(current_user)\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend", "def log_out\n session.delete(:email)\n @current_user = nil\n end", "def logout!\n session.clear\n end", "def logout!\n session.clear\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\r\n forget(current_user)\r\n session.delete(:user_id)\r\n @current_user = nil\r\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n # sessions.delete(:team_id)\n @current_user = nil\n # @current_team = nil\n\n end", "def logout!\n session.clear\n end", "def log_out\n forget current_user\n session.delete :user_id\n @current_user = nil\n end", "def logout\n session[:user_id] = nil\n session[:user_login] = nil\n session[:user_authority] = nil\n redirect_to login_url, alert: \"ログアウトしました。\"\n end", "def logout\n session[:user_id] = nil\n redirect_to(:action => \"login\")\n end", "def log_out\n\t\tforget(current_user) #call user.forget\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend", "def log_off_user\n session.delete(:user_id)\n @current_user = nil\n end", "def sign_out\n session[:user_id] = nil\n end", "def log_out\n\t\tsession.delete(:id)\n\t\t@current_user = nil\n\t\tadmin_session(false)\n\tend", "def log_out\n session.delete(:user_credentials)\n @current_user = nil\n end", "def sign_out\n session[:user_id] = nil \n session.delete(:user)\n end", "def user_log_out\n user_forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n\t\t# current_user.delete_auth_token # won't work with curl, but html is good\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend", "def logout\n session[:user_id] = nil\n redirect_to login_path\n end", "def destroy\n session[:user_id] = nil\n @curr_user = nil\n redirect_to :log_in, :notice => \"Logged out\"\n end", "def sign_out\n session.delete(:user_id)\n @current_user = nil\nend", "def logout\n session[:user_id] = nil\n session[:admin_user_id] = nil\n flash[:notice] = \"Vous êtes déconnecté\"\n redirect_to root_url\n end" ]
[ "0.8736652", "0.869647", "0.8557396", "0.8505858", "0.8501893", "0.8501893", "0.85011286", "0.8498595", "0.8488993", "0.84789145", "0.84646046", "0.8464518", "0.84386086", "0.8432696", "0.84289974", "0.8413266", "0.8412079", "0.84041405", "0.84024626", "0.8394547", "0.8386615", "0.83848685", "0.8384353", "0.8376969", "0.83258593", "0.83230066", "0.83230066", "0.83230066", "0.83230066", "0.8321316", "0.831976", "0.8318734", "0.8318734", "0.8318734", "0.8318734", "0.8318734", "0.8318734", "0.8318734", "0.8318734", "0.8318734", "0.8318734", "0.8318734", "0.8318734", "0.8318734", "0.8318734", "0.8318734", "0.8318734", "0.8318734", "0.8318734", "0.8318734", "0.8318734", "0.8318734", "0.8318734", "0.8318734", "0.830978", "0.8300353", "0.8288061", "0.82848585", "0.82756746", "0.8274176", "0.8274176", "0.8274176", "0.8274176", "0.8274176", "0.82674056", "0.8242293", "0.8235792", "0.8219788", "0.8211043", "0.82053584", "0.8192966", "0.8190769", "0.8181867", "0.8160818", "0.8149001", "0.8149001", "0.8120053", "0.8108218", "0.8097132", "0.8095838", "0.80944", "0.80944", "0.80928016", "0.8090037", "0.80881244", "0.80866194", "0.8084608", "0.8084395", "0.80657256", "0.80649024", "0.8056368", "0.8055984", "0.80537933", "0.8047151", "0.8043815", "0.80403006", "0.80401796", "0.80395806", "0.80322164", "0.802779", "0.8021201" ]
0.0
-1
Initialize an Predicate optimizer
def initialize(*) super @left = optimize_left @right = optimize_right end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(*)\n super\n @predicate = Function.optimize_operand(operation.predicate)\n end", "def set_predicate\n @predicate = Predicate.find(params[:id])\n end", "def initialize(predicates=[])\n @options = {}\n @options_parser = OptionParser.new(\"Usage: #{$0} [options] (make sure to wrap all options in quotes)\") do |opts|\n @options[:time_start] = Time.at(0)\n opts.on( '-t', '--time_start TIME',\n \"Filter outages before TIME (of the form 'YYYY.MM.DD [HH.MM.SS]'). [default 1970]\") do |time|\n @options[:time_start] = Time.parse time\n end\n \n @options[:time_end] = Time.now\n opts.on( '-e', '--time_end TIME',\n \"Filter outages after TIME (of the form 'YYYY.MM.DD [HH.MM.SS]'). [default now]\") do |time|\n @options[:time_end] = Time.parse time\n end\n \n # Hash from human readable lamda -> predicate\n # TODO: don't foce them to type 'lambda { |tracker|' -- just\n # have them specify the boolean function that goes inside\n @options[:predicates] = Predicates.NOP\n opts.on('-p', '--predicate LAMBDA',\n \"Only consider logs where LAMBDA returns true. Invokes eval on given arg. [default: #{@options[:predicates].keys.first}]\") do |filter|\n @options[:predicates][filter] = eval(filter)\n end\n\n opts.on('-n', '--no-poisoners', \"Exclude poisoners\") do |t|\n @options[:predicates].merge!(Predicates.NoPoisoners)\n end\n\n @options[:predicate_miss_counts] = Hash.new(0)\n end\n\n set_predicates!(predicates)\n end", "def initialize\n @rule_name = nil\n @predicate_text = nil\n super()\n end", "def initialize(plan)\n @scope = :global\n\t @plan = plan\n\t super()\n\t @plan_predicates = Array.new\n\t @neg_plan_predicates = Array.new\n\tend", "def add_predicate; end", "def predicate\n operand.predicate.and(super).optimize\n end", "def initialize(*)\n super\n @operand = optimize_operand\n end", "def initialize(predicate, arguments, &block)\n @predicate = predicate\n @arguments = arguments\n @block = block\n @@arguments << self\n end", "def initialize(subject, predicate, object)\n @subject = subject\n @predicate = predicate\n @object = object\n end", "def optimizer\n @optimizer ||= Optimizer.new\n end", "def define\n predicates = Object.new\n @conditions.each {|k, v| predicates.class.send(:define_method, \"#{k}?\") { v } }\n yield RuleMapper.new(self), @conditions, @context\n end", "def initialize(constraints = {})\n self.where constraints\n end", "def lazy_init\n # build index clause if possible\n @index_clause,@where_clause = create_filter @where_expression\n hop_warn \"INDEX: #{@index_clause.inspect}\"\n if @index_clause and @push_index\n ind_iter = IndexedIterator.new(@db, @collection, @index_clause, @where_clause, @parent, @current_var)\n @enumerator = ind_iter.to_enum(:each)\n hop_warn \"index pushed to Mongo #{@where_expression.to_s}\"\n else\n ind_iter = IndexedIterator.new(@db, @collection, nil, @where_clause, @parent, @current_var)\n @enumerator = ind_iter.to_enum(:each)\n hop_warn 'index not pushed to Mongo' if @where_expression\n end\n end", "def fallacy!\n @predicate << Rule.new(self, false)\n self\n end", "def initialize_wheres\n @@wheres = {}\n DEFAULT_WHERES.each do |where|\n add(*where)\n end\n end", "def predicate_matchers\n @predicate_matchers ||= {}\n end", "def predicate_matchers\n @predicate_matchers ||= {}\n end", "def predicate_attr_reader(*attrs)\n attrs.each do |attr|\n define_predicate_method(attr)\n end\n end", "def index\n @predicates = Predicate.all\n end", "def initialize(predicate, left_header, right_header)\n @left = @right = @remainder = TAUTOLOGY\n\n @left_header = left_header\n @right_header = right_header\n\n partition(predicate)\n end", "def initialize( filter_phrase=//, options={} )\r\n validate_arguments binding()\r\n @filter_phrase = filter_phrase\r\n @negate = options[ :negate ]\r\n end", "def update!(**args)\n @predicate_objs = args[:predicate_objs] if args.key?(:predicate_objs)\n end", "def fact!\n @predicate << Rule.new(self, true)\n self\n end", "def define_state_predicate; end", "def predicate_words\n _predicate_words\n end", "def with_predicate(raw_predicate)\n if raw_predicate.nil?\n self\n else\n predicate = SData::Predicate.parse(resource_class.payload_map.baze_fields, raw_predicate)\n with_conditions(predicate.to_conditions)\n end\n end", "def initialize #:nodoc:\n super\n @generated_conditions = []\n @by_table_names = HashWithIndifferentAccess.new\n end", "def predicate(&block)\n @predicate = block unless block.nil?\n @predicate\n end", "def initialize(o = {})\n @debug = o[:debug] || false\n $items = {} if !$items\n @cv = ContextVector.new\n if !cache_data(\"exists\")\n #debugger\n open_index()\n cache_data(\"exists\", \"true\")\n debug \"[Searcher#new] searcher initializd...\"\n else\n @clf = cache_data('clf')\n @con_weights = cache_data('con_weights')\n @doc_weights = cache_data('doc_weights')\n end\n end", "def predicate_params\n params.require(:predicate).permit(:name, :prolog)\n end", "def initialize(options)\n super\n\n @db_root = File.join '~', '.imap_learn',\n \"#{options[:User]}@#{options[:Host]}:#{options[:Port]}\"\n @db_root = File.expand_path @db_root\n\n @threshold = options[:Threshold]\n\n @classifiers = Hash.new do |h,k|\n filter_db = File.join @db_root, \"#{k}.db\"\n FileUtils.mkdir_p File.dirname(filter_db)\n h[k] = RBayes.new filter_db\n end\n\n @unlearned_flagged = []\n @tasty_unflagged = []\n @bland_flagged = []\n @tasty_unlearned = []\n @bland_unlearned = []\n\n @noop = false\n end", "def add(predicate, options = {})\n predicate = class_of predicate\n @set << predicate.new(self.field, options)\n end", "def initialize(core_concept_node, constraint, &action)\n @action = action\n @core_instances = []\n @root = core_concept_node\n core_concept_rsc = RDFS::Resource.new(core_concept_node.value)\n @query = Query\n q = @query.new.extend(Pbuilder::Query)\n q = q.search_by_concept(core_concept_rsc, constraint)\n @pass = false\n q.execute do |i|\n @core_instances << @action.call(i, 0, 0, nil, nil)\n @pass = true\n end\n end", "def initialize phrases, qualifiers = [], context_note = nil\n @phrases = phrases\n nps.each { |np| np.clause = self }\n @certainty = true\n @qualifiers = qualifiers\n @context_note = context_note\n end", "def initialize( &block )\n\t\t@variables = Set.new\n\t\t@constants = Set.new\n\t\t@axiom = nil\n\t\t@rules = []\n\n\t\t@rules_as_hash = nil\n\n\t\tself.instance_eval( &block ) if block\n\tend", "def initialize(repo,start,stepper)\n @repo=repo\n @stepper=stepper\n @start=start\n @visited=Set.new\n # a binding binding :start to each current value of start\n @solution=if @start.is_a? RDF::Query\n start.execute(@repo)\n elsif @start.is_a? Array\n start.map{|u|RDF::Solution.new(:end=>u)}\n elsif @start.is_a? RDF::URI\n [RDF::Query::Solution.new(:end=>@start)]\n else\n raise \"Should supply start as query or uriref or array of urirefs\"\n end\n end", "def initialize(name)\n @name = name\n @predicates = {}\n \n @@scopes[@name] = self\n end", "def pre_run_initialize\n @evaluator = @evaluator_class.new(self) if @evaluator.nil?\n @evolver = @evolver_class.new(self) if @evolver.nil?\n end", "def initialize\n super\n # Default operators\n @evaluator = Evaluator.new self\n @expressor = Expressor.new self\n @evolver = Evolver.new self\n end", "def initialize\n\t\t# Default values for query expansion\n\t\t@measure = \"jaccard\"\n\t\t@threshold_gap = 0.3 # Uses this to relax the threshold for PostgreSQL search \n\tend", "def initialize(operator, less)\n @operator = operator \n @less = less\n end", "def initialize(*)\n super\n @relation = relation.public_send(restriction) if options.fetch(:initial)\n end", "def initialize()\n #@ch = Concept.init_concept_hash()\n #Indexer.initialize_dict()\n #@ch = Indexer.init_concept_hash\n end", "def initialize_with_test_runner\n initialize_without_test_runner\n\n @test_priorities = {}\n @test_filters = Hash.new { |h, k| h[k] = [] }\n end", "def initialize who, what, how, than, where = binding, wen = nil, why = nil\n @where = where\n if self.where.instance_variable_defined? who\n @who = self.where.instance_variable_get who\n else\n @who = self.where.instance_eval who \n end\n @what = what.to_sym\n @how = how\n @then = than\n @when = wen\n @why = why\n end", "def predicate_matchers\n @predicate_matchers ||= {:exist => :exist?, :an_instance_of => :is_a?}\n end", "def initialize start_vector, goal_vector, options = {}\n @debug_level = options[:debug_level] || 1\n @epsilon = options[:epsilon] || 0.01\n @max_iterations = options[:max_iterations] || 1000\n @banned_points = options[:banned_points] || {}\n @start_vector = start_vector\n @goal_vector = goal_vector\n end", "def initialize\n\t\t@operands = []\n\tend", "def init\n return if @initialized\n\n # Fill start places with tokens to let the process start\n put_token(start_place)\n start_place[:enabled] = true\n\n # Terminators are used to identify which transitions can be executed\n @terminators = {}\n @net.places.select(&:start?).each do |start_place|\n outgoing_transitions(start_place).each do |transition|\n (@terminators[transition] ||= []) << start_place\n end\n end\n\n # Without weights assigned transition execution path search won't work\n PetriTester::DistanceWeightIndexator.new(@net).reindex\n\n @initialized = true\n execute_automated!\n end", "def initialize(op, lhs, rhs)\n @args = [lhs, rhs]\n @op = op\n end", "def predicate_aux(action, opts)\n\n if action != \"destroy\"\n\n data = LibXML::XML::Parser.string(request.raw_post).parse\n\n title = parse_element(data, :text, '/predicate/title')\n ontology = parse_element(data, :resource, '/predicate/ontology')\n description = parse_element(data, :text, '/predicate/description')\n phrase = parse_element(data, :text, '/predicate/phrase')\n equivalent_to = parse_element(data, :text, '/predicate/equivalent-to')\n\n end\n\n # Obtain object\n\n case action\n when 'create';\n return rest_response(401, :reason => \"Not authorised to create a predicate\") unless Authorization.check('create', Predicate, opts[:user], ontology)\n ob = Predicate.new\n when 'view', 'edit', 'destroy';\n ob, error = obtain_rest_resource('Predicate', opts[:query]['id'], opts[:query]['version'], opts[:user], action)\n else\n raise \"Invalid action '#{action}'\"\n end\n\n return error if ob.nil? # appropriate rest response already given\n\n if action == \"destroy\"\n\n ob.destroy\n\n else\n\n # build it\n\n ob.title = title if title\n ob.description = description if description\n ob.phrase = phrase if phrase\n ob.equivalent_to = equivalent_to if equivalent_to\n ob.ontology = ontology if ontology\n\n if not ob.save\n return rest_response(400, :object => ob)\n end\n end\n\n rest_get_request(ob, opts[:user], { \"id\" => ob.id.to_s })\nend", "def dup(goal)\n self.class.new @predicate, goal.variablise(arguments), &@block\n end", "def predicate_visitor\n join_dependency = ActiveRecord::Associations::ClassMethods::JoinDependency.new(@klass, association_joins, custom_joins)\n MetaWhere::Visitors::Predicate.new(join_dependency)\n end", "def initialize(criteria)\n @criteria = criteria\n if klass.hereditary? && !criteria.selector.keys.include?(:_type)\n @criteria = criteria.in(:_type => criteria.klass._types)\n end\n @criteria.enslave if klass.enslaved?\n @criteria.cache if klass.cached?\n end", "def statements_as_predicate\n @statements_as_predicate ||= statements_as :predicate\n end", "def create\n @predicate = Predicate.new(predicate_params)\n\n respond_to do |format|\n if @predicate.save\n format.html { redirect_to @predicate, notice: 'Predicate was successfully created.' }\n format.json { render :show, status: :created, location: @predicate }\n else\n format.html { render :new }\n format.json { render json: @predicate.errors, status: :unprocessable_entity }\n end\n end\n end", "def initialize(rule_set, name, priority, b)\r\n @rule_set = rule_set\r\n @name = name\r\n @priority = priority\r\n @conditions = []\r\n @consequences = []\r\n @parameters = []\r\n \r\n begin\r\n instance_eval(&b) if b\r\n rescue Exception => e\r\n raise RuleCheckError.new( self, e)\r\n end\r\n end", "def initialize(expr, whens, default_block)\n @expr = expr\n @whens = whens\n @default_block = default_block\n end", "def initialize(condition_expr, block)\n @condition = condition_expr\n @block = block\n end", "def create\n @predicate = Predicate.new(params[:predicate])\n if @predicate.scope_type == 'Attribute type' && aspect?\n @predicate.project_id = current_aspect.id\n end\n\n respond_to do |format|\n if @predicate.save\n format.html { redirect_to @predicate, notice: 'Predicate was successfully created.' }\n format.json { render json: @predicate, status: :created, location: @predicate }\n else\n format.html { render layout: 'form', action: \"new\" }\n format.json { render json: @predicate.errors, status: :unprocessable_entity }\n end\n end\n end", "def partition\n PredicatePartition.new(predicate, operand.left.header, operand.right.header)\n end", "def predicates\n @graphs.inject([]) {|memo, g| memo += g.predicates}\n end", "def &(predicate)\n predicate.is_a?(Predicate) ? Predicate::Intersection.new(self, predicate) : self\n end", "def initialize(expr, facts)\n # convention : facts are just fact names in expressions. The fact instances themselves are tracked at the assignment level\n @facts=facts # these values are full fact + method (thing which gets replaced at eval time)\n# @factlists=factlists\n @expression=expr\n @resolved_expr=nil\n @host=nil\n end", "def initialize(query,start_idx)\n @query = query\n @start_idx = start_idx\n end", "def test_predicate_accessor\n assert(@valid_source.predicate_set(:meetest, \"array_test_acc\", \"bla\"))\n assert_equal(@valid_source.predicate(:meetest, \"array_test_acc\"), @valid_source.meetest::array_test_acc)\n assert_equal(\"bla\", @valid_source.predicate(:meetest, \"array_test_acc\")[0])\n end", "def evaluates(&block)\n @predicate << Rule.new(self, block)\n self\n end", "def initialize(filters = [], mask: nil)\n @mask = mask || FILTERED\n @filters = filters\n @compiled_filters = compile(filters)\n end", "def initialize(method, *args)\n @finder, @args = :first, args\n case method.to_s\n when FINDER\n @finder = :all if $1 == \"all_by\"\n @finder = :last if $1 == \"last_by\"\n names = $2\n when CREATOR then\n @creator = ($1 == \"initialize\") ? :instantiate : :create\n names = $2\n else\n @finder = nil\n end\n @attributes = names && names.split(\"_and_\")\n generate_conditions\n end", "def initialize(activator = TRGLeader, condition = TRGHP,\n comparator = TRGEqual, value = 100, action_type = TRGAttack,\n action_data = 0, target = TRGTargetDefault)\n @activator = activator\n @condition = condition\n @comparator = comparator\n @value = value\n @action_type = action_type\n @action_data = action_data\n @target = target\n end", "def initialize(subject, predicate, object, language=nil, datatype=nil)\n super(subject, predicate, object)\n if language != nil && datatype != nil\n raise \"Cannot specify both language and datatype for a literal\"\n end \n @language = language\n @datatype = datatype\n end", "def define_predicate(prefix, name, pname)\n return if :singleton_method_added == pname.to_sym\n return if :make_subjunctive == pname.to_sym\n return if :make_interjective == pname.to_sym\n return if :define_predicate == pname.to_sym\n\n puts \"Nomenclature#define_predicate(#{prefix.inspect}, #{name.inspect}, #{pname.inspect})\" if $DEBUG\n\n Assertable.module_eval <<-END, __FILE__, __LINE__\n private\n def #{prefix}_#{name}(*a,&b)\n Assertable.#{pname}(*a,&b)\n end\n END\n end", "def initialize(label)\n\n # pass a new engine with name :knowledge_base_engine to the super class\n super KnowledgeBase::engine label\n\n # instantiate variables\n @engine_has_matched = false\n @yml_locations = nil\n\n @question_rules = Array.new\n @result_rules = Array.new\n @fact_rules = Array.new\n @triggered_rules = Array.new\n @start_rules = Array.new\n @rules = {}\n\n end", "def initialize(opts = {})\n @key = opts[:key]\n @operator = opts[:operator]\n @outer_op = opts[:outer_op] \n end", "def initialize(&block)\n @rules = []\n DSL.new(self).execute(&block) unless block.nil?\n end", "def optimizable?\n super || !predicate.equal?(operation.predicate)\n end", "def initialize\n @bool = Bool.new\n @aggregations = {}\n end", "def statements_as_predicate\n @statements_as_predicate ||= statements_as :predicate\n end", "def build_predicates(structure)\n construct_condition(structure, true)\n end", "def initialize name = 'default', &body\n ctx = {:name => name, :strategy => :all, :rules => []}\n self.ctx = {}\n instance_exec &body\n end", "def initial_query=(_arg0); end", "def initialize( opts = {} )\n @and = ' and '.freeze\n @or = ' or '.freeze\n @not = '-'.freeze\n @space = ' '.freeze\n @lquote = @rquote = '\"'.freeze\n @colon = ':'.freeze\n @lparen = '('.freeze\n @rparen = ')'.freeze\n @default_op = nil\n @precedence = nil\n\n opts.each do |name,val|\n send( name.to_s + '=', val )\n end\n end", "def initialize(question, args, options)\n self.parser = question.parser\n self.id = parser.new_dependency_id\n self.question_id = question.id\n self.rule = (args[0] || {})[:rule]\n self.dependency_conditions = []\n self.default_options().merge(options).merge(args[1] || {}).each{|key,value| self.instance_variable_set(\"@#{key}\", value)}\n end", "def initialize(filter_name, core, options = {})\n @name = filter_name\n @label = filter_name.to_s\n\t\t\t@core = core\n\t\t\t@options = options\n\t\t\t@filter_type = self.class.to_s.downcase\n\n # apply quick properties\n options.each_pair do |k, v|\n setter = \"#{k}=\"\n self.send(setter, v) if self.respond_to? setter\n end\n end", "def initialize_solver(literalExpression)\n\t\t\t# Allocate an expression to solve\n\t\t\t@expression = Solver::Parser.new(Solver::Lexer.new(literalExpression))\n\t\t\t@expression.expressionCache = literalExpression\n\t\t\t@expression.objectCache = @attributes\n\t\tend", "def where(predicate = nil, &blk)\n predicate = blk if blk\n SelectedRelation.new(self, predicate)\n end", "def optimize(**options)\n if operand(0).is_a?(Variable) && operand(0).bound? && operand(0).eql?(operand(1))\n RDF::Literal::TRUE\n else\n super # @see Operator#optimize!\n end\n end", "def test_direct_predicates\n my_source = make_dummy_source(\"http://direct_predicate_haver/\")\n my_source.talia::author << \"napoleon\"\n my_source.save!\n \n # Expected size of direct predicates: One for the predicate set above,\n # one for the default type and one for the default type\n assert_equal(3, my_source.direct_predicates.size, \"Direct predicates expected to have 3 elements. Real value: #{my_source.direct_predicates.inspect}\")\n assert(my_source.direct_predicates.include?(N::TALIA::author))\n end", "def singleton_predicate_accessor( *symbols )\n\t\t\tsingleton_class.extend( Assemblage::MethodUtilities )\n\t\t\tsingleton_class.attr_predicate_accessor( *symbols )\n\t\tend", "def initialize_paginator\n @page = correct_integer?(params[:page]) ? params[:page].to_i : 1\n @for_page = FOR_PAGE\n @filter = params[:filter]\n @filter = Filters::ALL_LESSONS if !Filters::LESSONS_SET.include?(@filter)\n end", "def singleton_predicate_reader( *symbols )\n\t\t\tsingleton_class.extend( Assemblage::MethodUtilities )\n\t\t\tsingleton_class.attr_predicate( *symbols )\n\t\tend", "def initialize(user, context)\n return unless context.respond_to?(:state_name)\n debug \"Initialize engine ...\"\n start_time = Time.now\n @user = user\n @context = context\n @conditions = parse_conditions\n @rule_set = RuleSet.new(@user, @context, @conditions)\n @rule_set.parse_dsl\n @rules = @rule_set.rules\n debug \"Done in #{ Time.now - start_time } s.\"\n @total_evaluation_time = 0\n end", "def init_policy\n policy = PolicyConfig.new\n static_statements.each do |statement|\n policy.add_statement(statement)\n end\n template_statements.each do |statement|\n policy.add_statement(statement)\n end\n inline_statements.each do |statement|\n policy.add_statement(statement)\n end\n policy\n end", "def initialize(expr)\r\n @expr = expr\r\n end", "def initialize(&block)\n @filter = (block || method(:filter))\n super()\n end", "def where(args)\n rule = clone\n rule.rulespec = args\n rule\n end", "def |(predicate)\n predicate.is_a?(Predicate) ? Predicate::Union.new(self, predicate) : self\n end", "def initialize(subject_collection, activation_lambda, opts={})\n @subject_collection = subject_collection\n @activation_lambda = activation_lambda\n opts.each { |k,v| instance_variable_set(\"@#{k}\", v) }\n end", "def with(**kwargs)\n fail ArgumentError, \"with requires exactly one predicate\" if kwargs.size != 1\n\n key, predicate = kwargs.first\n predicate = expand_predicate(predicate)\n\n select do |candidate|\n methods = [key, \"query_for_#{key}\", \"names_for_#{key}\"].select do |m|\n candidate.respond_to?(m)\n end\n\n methods.any? do |method|\n Array(candidate.send(method)).any? do |r|\n begin\n predicate === r # rubocop:disable Style/CaseEquality\n rescue StandardError\n # We're going to assume this is a result of a string comparison to a custom #==\n false\n end\n end\n end\n end\n end" ]
[ "0.7293722", "0.6444506", "0.6271204", "0.62665486", "0.6055156", "0.60215986", "0.59516376", "0.5875624", "0.5828855", "0.57455766", "0.56537163", "0.5625675", "0.55915254", "0.55871904", "0.55724514", "0.5539218", "0.5494119", "0.5494119", "0.547259", "0.5426721", "0.53589404", "0.53526956", "0.5263323", "0.5251485", "0.5205897", "0.51968074", "0.5194194", "0.51738197", "0.5169027", "0.5168801", "0.51517725", "0.51399183", "0.5135818", "0.5098252", "0.50880826", "0.5075545", "0.5065832", "0.5058732", "0.50282776", "0.4999827", "0.49920693", "0.4989944", "0.49868006", "0.49818093", "0.49807808", "0.49749416", "0.49500415", "0.49432933", "0.49377248", "0.4919548", "0.49119732", "0.49099037", "0.49001804", "0.48935384", "0.48922345", "0.48855636", "0.48833314", "0.48816112", "0.48809186", "0.48710117", "0.4867696", "0.48664948", "0.4857248", "0.48524237", "0.48467582", "0.48465636", "0.4842196", "0.48323962", "0.48295337", "0.48256966", "0.48251113", "0.4824117", "0.48229066", "0.4817658", "0.48112974", "0.48100737", "0.48023376", "0.4787288", "0.47866583", "0.47825122", "0.47815603", "0.47809142", "0.47593984", "0.47546223", "0.47523415", "0.47462788", "0.47452903", "0.4741215", "0.47381416", "0.47361133", "0.47356716", "0.47349906", "0.47349674", "0.47346446", "0.4733403", "0.472637", "0.472388", "0.4721118", "0.4720937", "0.47198585" ]
0.50907063
34
Optimize the left operand
def optimize_left Function.optimize_operand(operation.left) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def optimize\n left\n end", "def optimize\n left\n end", "def optimize\n left\n end", "def optimize\n left\n end", "def optimize\n left\n end", "def left_optimizable?\n !left.equal?(operation.left)\n end", "def optimize\n left.ne(right.first)\n end", "def optimize\n wrap_operand\n end", "def optimize_right\n Function.optimize_operand(operation.right)\n end", "def optimize\n operand\n end", "def wrap_left\n wrap_operand(operand.left)\n end", "def optimize\n operand\n end", "def optimize\n operation.class.call(left, right)\n end", "def optimize\n wrap_operand(operand)\n end", "def optimize\n wrap_operand(operand)\n end", "def left_restriction\n operand.left.restrict(partition.left)\n end", "def optimize\n operand.class.new(wrap_left, wrap_right)\n end", "def optimize\n right\n end", "def optimize\n right\n end", "def left=(_arg0); end", "def left=(_arg0); end", "def right_optimizable?\n !right.equal?(operation.right)\n end", "def optimize\n right\n end", "def optimize\n right\n end", "def optimize\n operation.class.reverse.new(right, left)\n end", "def optimize\n operation.class.new(left, right)\n end", "def optimize\n operation.class.call(operand)\n end", "def result \n return @left_operand + @right_operand\n end", "def elementwise_op(op,left_val,right_val)\n\n end", "def predicate\n operand.predicate.and(super).optimize\n end", "def and_op(left, right, result) #method\n left = get_dir(left)\n right = get_dir(right)\n @current_context[result] = get_value(left) && get_value(right)\n end", "def wrap_operand(operand = operand.operand)\n operand.restrict(predicate)\n end", "def _reduce_63(val, _values, result)\n @lexer.cond.push(true)\n \n result\nend", "def optimize(**options)\n if operand(0).is_a?(Variable) && operand(0).bound? && operand(0).eql?(operand(1))\n RDF::Literal::TRUE\n else\n super # @see Operator#optimize!\n end\n end", "def _reduce_63(val, _values, result)\n @lexer.cond.push(true)\n\n result\nend", "def optimize\n left_restriction.send(relation_method, right_restriction).restrict(partition.remainder)\n end", "def _low_byte(operand)\n # operand & 255\n -> { _eval_byte(operand) & 255 }\nend", "def or_op(left, right, result) #method\n left = get_dir(left)\n right = get_dir(right)\n @current_context[result] = get_value(left) || get_value(right)\n end", "def _reduce_54(val, _values, result)\n lhs, _, rhs = val\n result = logical_op :and, lhs, rhs\n\n result\nend", "def expr(min_prec = 5, step = 10)\n left = atomar\n\n loop do\n if !left || !infix || @optable[peek.value][0] < min_prec\n return left\n else\n op = consume\n line = op.line\n col = op.column\n prec, assoc = @optable[op.value]\n next_prec = prec || (prec + step if assoc == 'left')\n right = expr(next_prec) || syntax_error\n left = Apparat::Byte::Binary.new([op.value, left, right], line, col)\n end\n end\n end", "def execute_JLE(operand) # Same as the JNG instruction\n\t\tis_less_than = (@flags.value[SIGN_FLAG] ^ @flags.value[OVERFLOW_FLAG]) == 1\n\t\tis_less_than_or_equal = is_less_than || @flags.value[ZERO_FLAG] == 1\n\t\tjump_conditionally_to_signed_displacement(operand, is_less_than_or_equal)\n\tend", "def evaluate_operator(left, right)\n left < right\n end", "def _reduce_263(val, _values, result)\n result = @builder.binary_op(val[0], val[1], val[2])\n \n result\nend", "def _reduce_47(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend", "def _reduce_47(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend", "def _reduce_247(val, _values, result)\n result = @builder.binary_op(val[0], val[1], val[2])\n \n result\nend", "def _reduce_39(val, _values, result)\n result = s(:and, val[0], val[2])\n \n result\nend", "def _reduce_263(val, _values, result)\n result = @builder.binary_op(val[0], val[1], val[2])\n\n result\nend", "def _reduce_53(val, _values, result)\n lhs, _, rhs = val\n result = logical_op :and, lhs, rhs\n\n result\nend", "def _reduce_53(val, _values, result)\n lhs, _, rhs = val\n result = logical_op :and, lhs, rhs\n\n result\nend", "def _reduce_53(val, _values, result)\n lhs, _, rhs = val\n result = logical_op :and, lhs, rhs\n\n result\nend", "def _reduce_41(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend", "def _reduce_41(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend", "def _reduce_248(val, _values, result)\n result = @builder.binary_op(val[0], val[1], val[2])\n \n result\nend", "def _reduce_248(val, _values, result)\n result = @builder.binary_op(val[0], val[1], val[2])\n \n result\nend", "def _reduce_34(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend", "def result\n return @left_operand - @right_operand\n end", "def _reduce_38(val, _values, result)\n result = s(:and, val[0], val[2])\n \n result\nend", "def _reduce_38(val, _values, result)\n result = s(:and, val[0], val[2])\n \n result\nend", "def ops(node)\n if node.left.nil? || node.right.nil?\n return 1 if /[\\+\\-\\*\\%\\/\\.]/.match(node.value)\n else\n return (ops(node.left) + ops(node.right))\n end\nend", "def _reduce_49(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend", "def _reduce_49(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend", "def _reduce_49(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend", "def _reduce_49(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend", "def left_expr_node\n key_op_val? && @elements[0]\n end", "def _reduce_59(val, _values, result)\n @lexer.cond.push(true)\n \n result\nend", "def _reduce_59(val, _values, result)\n @lexer.cond.push(true)\n \n result\nend", "def _reduce_53(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend", "def _reduce_248(val, _values, result)\n result = @builder.binary_op(val[0], val[1], val[2])\n\n result\nend", "def refute_operator(o1, op, o2 = T.unsafe(nil), msg = T.unsafe(nil)); end", "def first_chk(obj)\n if (self =~ obj) && (obj.is_a? Pow)\n if self.right.is_a? Pow\n myExp, objExp = self.right.right, obj.right\n myExp.top, objExp.top = true, true\n exp = myExp + objExp\n rht = Pow.new(obj.left,exp).reduce\n return Prod.new(self.left,rht).reduce\n end\n objExp = obj.right\n objExp.top = true\n objExp += Number.new 1\n rht = Pow.new(obj.left,objExp).reduce\n return Prod.new(self.left,rht).reduce\n elsif self =~ obj\n return Prod.new(self.left,Pow.new(self.right,Number.new(2))).reduce\n end\n return nil\n end", "def _reduce_46(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend", "def _reduce_46(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend", "def _reduce_46(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend", "def _reduce_41(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n\n result\nend", "def left(i); 2*i+1; end", "def _reduce_54(val, _values, result)\n @lexer.cond.push(true)\n \n result\nend", "def _reduce_58(val, _values, result)\n lhs, _, rhs = val\n result = logical_op :and, lhs, rhs\n\n result\nend", "def visitLeftOperand(elem, data)\r\n @@log.debug(\"XmlRuleVisitor::visitLeftOperand\")\r\n @@log.debug(elem.inspect)\r\n\r\n elem.each_element do |child|\r\n data = visit(child, data)\r\n end\r\n\r\n return data\r\n end", "def _reduce_34(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n\n result\nend", "def star(reg)\n return opt(plus(reg))\nend", "def evaluate_operator(left, right)\n left <= right\n end", "def _reduce_49(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n\n result\nend", "def execute_JO(operand)\n\t\tjump_conditionally_to_signed_displacement(operand, @flags.value[OVERFLOW_FLAG] == 1) # Non-zero means set\n\tend", "def evaluate_operator(left, right)\n left >= right\n end", "def left\n @x\n end", "def calculate number\n @left_operand = number\n\n return result()\n end", "def _reduce_57(val, _values, result)\n @lexer.cond.push(true)\n \n result\nend", "def _reduce_57(val, _values, result)\n @lexer.cond.push(true)\n \n result\nend", "def optimize\n operand.drop(offset)\n end", "def _reduce_53(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n\n result\nend", "def _reduce_48(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend", "def _reduce_48(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend", "def _reduce_46(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n\n result\nend", "def _reduce_52(val, _values, result)\n lhs, _, rhs = val\n result = logical_op :and, lhs, rhs\n\n result\nend", "def _reduce_52(val, _values, result)\n lhs, _, rhs = val\n result = logical_op :and, lhs, rhs\n\n result\nend", "def _reduce_52(val, _values, result)\n lhs, _, rhs = val\n result = logical_op :and, lhs, rhs\n\n result\nend", "def _reduce_52(val, _values, result)\n lhs, _, rhs = val\n result = logical_op :and, lhs, rhs\n\n result\nend", "def _reduce_52(val, _values, result)\n lhs, _, rhs = val\n result = logical_op :and, lhs, rhs\n\n result\nend", "def _reduce_52(val, _values, result)\n lhs, _, rhs = val\n result = logical_op :and, lhs, rhs\n\n result\nend" ]
[ "0.7122969", "0.7122969", "0.7122969", "0.708683", "0.708683", "0.6968616", "0.6857908", "0.6715448", "0.6711576", "0.66502416", "0.66389805", "0.6638019", "0.6612207", "0.65555924", "0.65555924", "0.65492743", "0.6429408", "0.61505395", "0.61505395", "0.6094615", "0.6094615", "0.6067528", "0.60629314", "0.60629314", "0.6057525", "0.60385203", "0.6017361", "0.6010681", "0.60017747", "0.5941751", "0.594015", "0.58424294", "0.5840896", "0.5818224", "0.57780385", "0.5758245", "0.57469016", "0.57467884", "0.5743917", "0.5741432", "0.573617", "0.57312256", "0.572047", "0.57154673", "0.57154673", "0.57115287", "0.57070404", "0.56836885", "0.5677017", "0.5677017", "0.5677017", "0.5673979", "0.5673979", "0.56668746", "0.56668746", "0.56517994", "0.56516784", "0.5644524", "0.5644524", "0.56430364", "0.5637382", "0.5637382", "0.5637382", "0.5637382", "0.5633108", "0.56159884", "0.56159884", "0.5615889", "0.56081414", "0.56065035", "0.5601082", "0.5596397", "0.5596397", "0.5596397", "0.55961925", "0.55906457", "0.5587867", "0.55875576", "0.55787706", "0.5575937", "0.5566517", "0.5560686", "0.5553227", "0.55478024", "0.55471045", "0.5541752", "0.5536415", "0.5524103", "0.5524103", "0.5520825", "0.55194527", "0.5510718", "0.5510718", "0.5509308", "0.5506196", "0.5506196", "0.5506196", "0.5506196", "0.5506196", "0.5506196" ]
0.82758355
0
Optimize the right operand
def optimize_right Function.optimize_operand(operation.right) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def optimize\n right\n end", "def optimize\n right\n end", "def optimize\n right\n end", "def optimize\n right\n end", "def right_optimizable?\n !right.equal?(operation.right)\n end", "def optimize\n operand\n end", "def optimize_left\n Function.optimize_operand(operation.left)\n end", "def optimize\n operand\n end", "def optimize\n operation.class.reverse.new(right, left)\n end", "def optimize\n wrap_operand\n end", "def optimize\n operation.class.call(left, right)\n end", "def optimize\n wrap_operand(operand)\n end", "def optimize\n wrap_operand(operand)\n end", "def optimize\n operand.class.new(wrap_left, wrap_right)\n end", "def optimize\n left.ne(right.first)\n end", "def result \n return @left_operand + @right_operand\n end", "def wrap_right\n wrap_operand(operand.right)\n end", "def optimize\n operation.class.new(left, right)\n end", "def optimize\n left\n end", "def optimize\n left\n end", "def optimize\n left\n end", "def right_restriction\n operand.right.restrict(partition.right)\n end", "def optimize\n operation.class.call(operand)\n end", "def optimize(**options)\n operands.last.optimize(**options)\n end", "def optimize\n left\n end", "def optimize\n left\n end", "def right(i); 2*(i+1); end", "def result\n return @left_operand - @right_operand\n end", "def or_op(left, right, result) #method\n left = get_dir(left)\n right = get_dir(right)\n @current_context[result] = get_value(left) || get_value(right)\n end", "def right; return self[0]+self[2]; end", "def build_operand(arg)\n if (arg.is_a?(AS::Parser::NumLiteralArgNode))\n if (arg.value.fits_u8?)\n # no shifting needed\n @operand = arg.value\n @i = 1\n elsif (op_with_rot = calculate_u8_with_rr(arg))\n @operand = op_with_rot\n @i = 1\n else\n raise AS::AssemblyError.new(AS::ERRSTR_NUMERIC_TOO_LARGE, arg)\n end\n elsif (arg.is_a?(AS::Parser::RegisterArgNode))\n @operand = reg_ref(arg)\n @i = 0\n elsif (arg.is_a?(AS::Parser::ShiftNode))\n rm_ref = reg_ref(arg.argument)\n @i = 0\n shift_op = {'lsl' => 0b000, 'lsr' => 0b010, 'asr' => 0b100,\n 'ror' => 0b110, 'rrx' => 0b110}[arg.type]\n if (arg.type == 'ror' and arg.value.nil?)\n # ror #0 == rrx\n raise AS::AssemblyError.new('cannot rotate by zero', arg)\n end\n \n arg1 = arg.value\n if (arg1.is_a?(AS::Parser::NumLiteralArgNode))\n if (arg1.value >= 32)\n raise AS::AssemblyError.new('cannot shift by more than 31', arg1)\n end\n shift_imm = arg1.value\n elsif (arg1.is_a?(AS::Parser::RegisterArgNode))\n shift_op |= 0x1;\n shift_imm = reg_ref(arg1) << 1\n elsif (arg.type == 'rrx')\n shift_imm = 0\n end\n \n @operand = rm_ref | (shift_op << 4) | (shift_imm << 4+3)\n else\n raise AS::AssemblyError.new(AS::ERRSTR_INVALID_ARG, arg)\n end\n end", "def _reduce_247(val, _values, result)\n result = @builder.binary_op(val[0], val[1], val[2])\n \n result\nend", "def right(i)\n i*2+2\n end", "def right=(r); self[0] = r - self[2]; return r; end", "def optimize(**options)\n if operand(0).is_a?(Variable) && operand(0).bound? && operand(0).eql?(operand(1))\n RDF::Literal::TRUE\n else\n super # @see Operator#optimize!\n end\n end", "def elementwise_op(op,left_val,right_val)\n\n end", "def predicate\n operand.predicate.and(super).optimize\n end", "def left_optimizable?\n !left.equal?(operation.left)\n end", "def _reduce_248(val, _values, result)\n result = @builder.binary_op(val[0], val[1], val[2])\n \n result\nend", "def _reduce_248(val, _values, result)\n result = @builder.binary_op(val[0], val[1], val[2])\n \n result\nend", "def right(i)\n\treturn 2 * i + 2\nend", "def _reduce_263(val, _values, result)\n result = @builder.binary_op(val[0], val[1], val[2])\n \n result\nend", "def _reduce_248(val, _values, result)\n result = @builder.binary_op(val[0], val[1], val[2])\n\n result\nend", "def _reduce_242(val, _values, result)\n result = @builder.binary_op(val[0], val[1], val[2])\n \n result\nend", "def _reduce_263(val, _values, result)\n result = @builder.binary_op(val[0], val[1], val[2])\n\n result\nend", "def optimize\n operand.drop(offset)\n end", "def visitRightOperand(elem, data)\r\n @@log.debug(\"XmlRuleVisitor::visitRightOperand\")\r\n @@log.debug(elem.inspect)\r\n\r\n elem.each_element do |child|\r\n data = visit(child, data)\r\n end\r\n\r\n return data\r\n end", "def optimize\n left_restriction.send(relation_method, right_restriction).restrict(partition.remainder)\n end", "def _reduce_245(val, _values, result)\n result = @builder.binary_op(val[0], val[1], val[2])\n \n result\nend", "def alt(left, right)\n\t\t\t lambda { |x| left[x] or right[x] }\n\t\t\tend", "def evaluate(op, left_arg, right_arg)\n case\n when op == '+' then return left_arg + right_arg\n when op == '-' then return left_arg - right_arg\n when op == '*' then return left_arg * right_arg\n when op == '/' then return left_arg / right_arg\n when op == '%' then return left_arg % right_arg\n end\nend", "def either(_left, right); end", "def visitRightOperand(elem, data)\r\n @@log.debug(\"XmlVisitor::visitRightOperand\")\r\n @@log.debug(elem.inspect)\r\n\r\n elem.each_element do |child|\r\n data = visit(child, data)\r\n end\r\n\r\n return data\r\n end", "def optimize\n operation.class.new(operand)\n end", "def optimize\n operand.operand.drop(sum_offset)\n end", "def star(reg)\n return opt(plus(reg))\nend", "def _reduce_258(val, _values, result)\n result = @builder.binary_op(val[0], val[1], val[2])\n \n result\nend", "def _reduce_258(val, _values, result)\n result = @builder.binary_op(val[0], val[1], val[2])\n \n result\nend", "def right_reduce(init = nil, sym = nil, &blk)\n reverse.reduce(init, sym, &blk)\n end", "def execute_ROR(operand)\n\t\t# affects CF and OF flags\n\t\tcount = bit_rotate_count_for(operand, operand.size)\n\t\tmask = (operand.value << (operand.size - count))\n\t\toriginal_value = operand.value\n\t\toperand.value = (operand.value >> count) + mask\n\t\tset_rotate_flags_from(operand, original_value)\n\tend", "def wrap_operand(operand = operand.operand)\n operand.restrict(predicate)\n end", "def getRight\n return @x + 5\n end", "def _reduce_244(val, _values, result)\n result = @builder.binary_op(val[0], val[1], val[2])\n \n result\nend", "def process_op_asgn_or(exp)\n ref = exp.shift\n asgn = exp.shift\n asgn[2] = [:or, ref, asgn[2]]\n process(asgn)\n end", "def execute_RCR(operand)\n\t\t# affects CF and OF flags\n\t\toriginal_value = operand.value\n\t\tsize = operand.size + 1\n\t\tcount = bit_rotate_count_for(operand, size)\n\t\tcarry_flag = operand.value[count - 1]\n\t\tmask = (operand.value << (size - count))\n\t\tprevious_carry_flag = operand.v_bit.zero? ? @flags.value[CARRY_FLAG] : operand.value[count - 2]\n\t\toperand.value = (operand.value >> count) + mask + (previous_carry_flag << (operand.size - count))\n\t\tset_rotate_flags_from(operand, original_value)\n\t\t@flags.set_bit_at(CARRY_FLAG, carry_flag)\n\tend", "def right=(_arg0); end", "def right=(_arg0); end", "def _reduce_478(val, _values, result)\n result = -val[1] # TODO: pt_testcase\n \n result\nend", "def refute_operator(o1, op, o2 = T.unsafe(nil), msg = T.unsafe(nil)); end", "def optimize\n left.left.exclude(merged_right_enumerables).optimize\n end", "def _reduce_63(val, _values, result)\n @lexer.cond.push(true)\n \n result\nend", "def process_or(exp)\n a = exp.shift\n b = exp.shift\n\n res = without_result do\n want_expression do\n with_temporary_variable do |tmp|\n @local_variables_need_no_initialization.add(tmp)\n \"(#{tmp}=#{process(a)}, (#{tmp}!==false&&#{tmp}!==nil) ? #{tmp} : (#{process(b)}))\"\n end\n end\n end\n\n return resultify(res)\n end", "def process_or(exp)\n lhs = process exp.shift\n rhs = process exp.shift\n\n return \"#{lhs} || #{rhs}\"\n end", "def cf_or ( a, b )\r\n# Combine for 'A or B'\r\n if a>0 and b>0\r\n a + b - a*b\r\n elsif a<0 and b<0\r\n a + b + a*b\r\n else\r\n (a + b) / ( 1 - [a.abs, b.abs].min )\r\n end\r\nend", "def _reduce_522(val, _values, result)\n result = -val[1] # TODO: pt_testcase\n\n result\nend", "def _reduce_524(val, _values, result)\n result = -val[1] # TODO: pt_testcase\n\n result\nend", "def either(left, _right); end", "def expr\n or_expr\n end", "def _reduce_64(val, _values, result); end", "def _calc operator\n (operand1, operand2) = @stack.pop 2\n @stack.unshift @stack.first\n @stack.push operand1.send(operator.to_sym, operand2)\nend", "def wrap_left\n wrap_operand(operand.left)\n end", "def _reduce_59(val, _values, result)\n @lexer.cond.push(true)\n \n result\nend", "def _reduce_59(val, _values, result)\n @lexer.cond.push(true)\n \n result\nend", "def _reduce_63(val, _values, result)\n @lexer.cond.push(true)\n\n result\nend", "def _reduce_342(val, _values, result)\n result = @builder.multi_lhs(val[0], val[1], val[2])\n \n result\nend", "def _reduce_479(val, _values, result)\n result = -val[1] # TODO: pt_testcase\n \n result\nend", "def evaluate_operator(left, right)\n left <= right\n end", "def _high_byte(operand)\n # operand >> 8\n -> { _eval_byte(operand) >> 8 }\nend", "def interpret\r\n return @leftExpression.interpret - @rightExpression.interpret\r\n end", "def _reduce_248(val, _values, result)\n lhs, (op, _), rhs = val\n result = new_call lhs, op.to_sym, argl(rhs)\n\n result\nend", "def reduce\n self.red\n if self.arg.is_a? Number\n return Number.new(Math.sqrt(self.arg)) if self.arg == Math.sqrt(sel.arg).to_i ** 2\n elsif self.arg.is_a? Pow\n if self.arg.right.is_a? Number\n return Pow.new(self.arg.left,Number.new((Self.arg.right.val / 2.0).to_i)).reduce if self.arg.right.val % 2 == 0\n end\n end\n return self\n end", "def execute_RETFAR(operand=nil)\n\t\t@ip.direct_value = pop_stack_word\n\t\t@cs.direct_value = pop_stack_word\n\t\t@sp.value += operand.value if operand\n\tend", "def optimize\n left.left.include(merged_right_enumerables).optimize\n end", "def _reduce_48(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend", "def _reduce_48(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend", "def optimize!(**options)\n ops = operands.map {|o| o.optimize(**options) }.select {|o| o.respond_to?(:empty?) && !o.empty?}\n @operands = ops\n self\n end", "def right_expr_node\n if key_op_val?\n right_node = @elements[2]\n if !right_node\n right_node = QueryNode.new\n end\n right_node\n end\n end", "def operate( op, val = nil )\n case val\n when Coord\n @rel |= true\n @ops.push [ op, val ]\n when Numeric, NilClass\n if @rel == false\n @ops[-1][1] = calculate( op, @ops[-1][1], val )\n else\n @ops.push [ op, val ]\n end\n end\n end", "def exclusive_or (p,q)\n p ^ q\nend", "def compute_sum_r(num1,num2)\n num2>0 ? compute_sum(num1+1,num2-1) : num1\n end" ]
[ "0.7409947", "0.7409947", "0.7399987", "0.7399987", "0.72095764", "0.72021836", "0.7165248", "0.7163501", "0.7056508", "0.70205927", "0.6978733", "0.6874189", "0.6874189", "0.6778807", "0.6682689", "0.6518567", "0.6463418", "0.6437694", "0.64291227", "0.64291227", "0.64291227", "0.64080626", "0.63511205", "0.62642443", "0.62163854", "0.62163854", "0.619987", "0.61816907", "0.6173731", "0.6161343", "0.6081187", "0.6065709", "0.6065331", "0.60634947", "0.601097", "0.59571487", "0.5936779", "0.59166336", "0.59133387", "0.59133387", "0.5887661", "0.5863378", "0.58583367", "0.5850286", "0.5820628", "0.58145094", "0.5793486", "0.57742506", "0.57559025", "0.5747695", "0.5736379", "0.57237834", "0.5689526", "0.5689518", "0.56777567", "0.5673254", "0.5670151", "0.5670151", "0.5669496", "0.56679386", "0.5654823", "0.56516504", "0.5647821", "0.56346965", "0.5632637", "0.562973", "0.562973", "0.5605787", "0.56007755", "0.5584868", "0.5576704", "0.55727345", "0.5569861", "0.55655134", "0.55636406", "0.555666", "0.5551345", "0.55469114", "0.5528266", "0.55270386", "0.5522348", "0.5507864", "0.5507864", "0.54884", "0.5486416", "0.5485874", "0.5484501", "0.5484365", "0.5482135", "0.5471577", "0.54709953", "0.54680437", "0.5465278", "0.54555607", "0.54555607", "0.5453342", "0.5437796", "0.5427691", "0.54272705", "0.54247624" ]
0.8460492
0
Evaluate the operands and return the constant
def optimize operation.class.call(left, right) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate(op, left_arg, right_arg)\n case\n when op == '+' then return left_arg + right_arg\n when op == '-' then return left_arg - right_arg\n when op == '*' then return left_arg * right_arg\n when op == '/' then return left_arg / right_arg\n when op == '%' then return left_arg % right_arg\n end\nend", "def result \n return @left_operand + @right_operand\n end", "def optimize\n operand\n end", "def evaluate(ops)\n \t\tops = tokens(ops)\n \t\tmethods = {:+ => Proc.new{plus()}, :- => Proc.new{minus()}, :* => Proc.new{times()}, :/ => Proc.new{divide()}}\n \t\tops.each do |op|\n \t\t\tif methods.has_key?(op)\n \t\t\t\tmethods[op].call\n \t\t\telse\n \t\t\t\tpush(op)\n \t\t\tend\n \t\tend\n \t\tvalue()\n end", "def result\n return @left_operand - @right_operand\n end", "def eval_expression(exp, globals, indices)\n if !indices.nil?\n end\n if exp.nil?\n return 0.0/0.0 #NaN\n end\n if exp.instance_of?(Expression)\n args = exp.args\n op = exp.op\n if op.nil?\n return eval_expression(args[0], globals, indices)\n elsif op == \"+\"\n return eval_expression(args[0], globals, indices) + eval_expression(args[1], globals, indices)\n elsif op == \"-\"\n return eval_expression(args[0], globals, indices) - eval_expression(args[1], globals, indices)\n elsif op == \"*\"\n return eval_expression(args[0], globals, indices) * eval_expression(args[1], globals, indices)\n elsif op == \"/\"\n return eval_expression(args[0], globals, indices) / eval_expression(args[1], globals, indices)\n elsif op == \"%\"\n return eval_expression(args[0], globals, indices) % eval_expression(args[1], globals, indices)\n elsif op == \"^\"\n return eval_expression(args[0], globals, indices) ** eval_expression(args[1], globals, indices)\n elsif op == \"==\"\n return bool_to_i(eval_expression(args[0], globals, indices) == eval_expression(args[1], globals, indices))\n elsif op == \"<\"\n return bool_to_i(eval_expression(args[0], globals, indices) < eval_expression(args[1], globals, indices))\n elsif op == \">\"\n return bool_to_i(eval_expression(args[0], globals, indices) > eval_expression(args[1], globals, indices))\n elsif op == \"<=\"\n return bool_to_i(eval_expression(args[0], globals, indices) <= eval_expression(args[1], globals, indices))\n elsif op == \">=\"\n return bool_to_i(eval_expression(args[0], globals, indices) >= eval_expression(args[1], globals, indices))\n elsif op == \"!=\"\n return bool_to_i(eval_expression(args[0], globals, indices) != eval_expression(args[1], globals, indices))\n elsif op == \"&&\"\n return bool_to_i(eval_expression(args[0], globals, indices) != 0 && eval_expression(args[1], globals, indices) != 0)\n elsif op == \"||\"\n return bool_to_i(eval_expression(args[0], globals, indices) != 0 || eval_expression(args[1], globals, indices) != 0)\n elsif op == \"[]\"\n index_values = []\n args[1...args.length].each do |index_value|\n index_values << eval_expression(index_value, globals, indices)\n end\n builtin_return = eval_builtin_function(args[0], globals, index_values)\n return builtin_return unless builtin_return.nil?\n return eval_variable(args[0], globals, index_values)\n elsif op == \"CASE\"\n for case_index in 0...args.length/2\n if args[case_index*2] == \"else\" || eval_expression(args[case_index*2], globals, indices) != 0\n return eval_expression(args[case_index*2+1], globals, indices)\n end\n end\n # if we got here, none of the cases were true and there was no else; return arbitrary default\n return 0\n elsif op == \"ARRAY\"\n elem_count = args.length - 1\n index = eval_expression(args[0], globals, indices)\n if index.to_i != index\n raise ArgumentError, \"Array index must be an integer. Was #{index}.\"\n end\n if index < 1 || index > elem_count\n raise ArgumentError, \"Array index #{index} is out of bounds. Must be between 1 and #{elem_count}, inclusive.\"\n end\n return eval_expression(args[index], globals, indices)\n end\n else\n #exp is a string\n if exp[0] == ?@\n #exp is a symbol\n return exp[1..-1].intern\n elsif exp == \"NaN\"\n #exp is nan\n return 0.0/0.0\n elsif exp.downcase == \"true\"\n #exp is boolean true\n return 1\n elsif exp.downcase == \"false\"\n #exp is boolean false\n return 0\n elsif exp.match(/^[\\d]+(\\.[\\d]*){0,1}$|^\\.[\\d]+$/)\n #exp is a number\n return exp.to_f\n elsif exp.match(/^\\d\\d\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d$/)\n #exp is a date and time\n return DateTime.strptime(exp+\" +0\", \"%Y_%m_%d_%H_%M_%S %z\").to_time.to_f\n elsif exp.match(/^\\d\\d\\d\\d_\\d\\d_\\d\\d$/)\n #exp is a date\n return DateTime.strptime(exp+\"_00_00_00 +0\", \"%Y_%m_%d_%H_%M_%S %z\").to_time.to_f\n elsif exp.match(/^\\d\\d\\_\\d\\d_\\d\\d$/)\n #exp is a time\n return DateTime.strptime(\"1970_01_01_\"+exp+\" +0\", \"%Y_%m_%d_%H_%M_%S %z\").to_time.to_f\n else\n #exp is a variable\n if !indices.nil? && !indices[exp].nil?\n #exp is an array index variable\n return indices[exp]\n end\n return eval_variable(exp, globals, nil)\n end\n end\n end", "def w\n @w ||= operand(1).evaluate\n end", "def calculate(op1, operator, op2)\n\tstring = op1.to_s + operator + op2.to_s\n\n\t# operator is assumed to be a string; \n\t# make one big string of it and the two operands \n\teval(string) # evaluate and return a value - never use eval ! eval is EVIL lol \nend", "def optimize\n operand\n end", "def execute_expression\n valid_input\n to_roman(to_num(@operand_one).send(@operator, to_num(@operand_two)))\n end", "def evaluate(scope)\n # evaluate the first operand, should return a boolean value\n lval = @lval.safeevaluate(scope)\n\n # return result\n # lazy evaluate right operand\n case @operator\n when \"and\"\n if Puppet::Parser::Scope.true?(lval)\n rval = @rval.safeevaluate(scope)\n Puppet::Parser::Scope.true?(rval)\n else # false and false == false\n false\n end\n when \"or\"\n if Puppet::Parser::Scope.true?(lval)\n true\n else\n rval = @rval.safeevaluate(scope)\n Puppet::Parser::Scope.true?(rval)\n end\n end\n end", "def evaluate(operator=\"and\")\n unless operator == \"and\" || operator == \"or\"\n raise(ArgumentError, \"operator must be 'and' or 'or'\")\n end\n \n result_data = {}\n\n @conditions.each do |condition|\n result_data[condition[0]] = condition[1].call\n end\n \n result = case operator\n when \"and\"\n result_data.all? { |name, result| result }\n when \"or\"\n result_data.any? { |name, result| result }\n end\n \n return result, result_data\n end", "def evaluate(input)\n if input.operator?\n perform_operation(input)\n else\n input\n end\n end", "def calculate(x, operator, y)\n\t# lots of ways to do the below part ...\n\t# if/elsif would have worked,\n\t# as would a case statement\n\treturn x + y if operator == '+'\n\treturn x - y if operator == '-'\n\treturn x * y if operator == '*'\n\treturn x / y if operator == '/'\nend", "def evaluate() \n # operand stack\n opStack = []\n \n # iterate over the tokens\n @postfix.split(\"\").each do |c|\n # check if an operator\n if %w[+ - * / ^].include? c\n # pop the stack for the two operands where\n # a [operator] b\n b, a = opStack.pop, opStack.pop\n \n # evaluate the string as an arithmetic expression\n # replace all '^' characters with '**' operator\n opStack.push(eval(\"(#{a})#{c}(#{b})\".gsub(/\\^/,'**')))\n else\n # push any operands onto stack\n opStack.push(c)\n end\n end\n \n # Last item in stack should be the final answer!\n opStack.pop\n end", "def operate_value(operation, operand_type, operand)\n if operand_type == 0\n value = operand\n else\n value = $game_variables[operand]\n end\n if operation == 1\n value = -value\n end\n return value\n end", "def evaluate(exp, env)\n # exp: A current node of AST\n # env: An environment (explained later)\n\n case exp[0]\n\n#\n## Problem 1: Arithmetics\n#\n\n when \"lit\"\n exp[1] # return the immediate value as is\n when \"*\"\n evaluate(exp[1], env) * evaluate(exp[2], env)\n when \"/\"\n evaluate(exp[1], env) / evaluate(exp[2], env)\n when \"%\"\n evaluate(exp[1], env) % evaluate(exp[2], env)\n when \"+\"\n evaluate(exp[1], env) + evaluate(exp[2], env)\n when \"-\"\n evaluate(exp[1], env) - evaluate(exp[2], env)\n# ... Implement other operators that you need\n when \"<\"\n lhs, rhs = exp[1..-1].map { |v| evaluate(v, env) }\n lhs < rhs\n when \">\"\n lhs, rhs = exp[1..-1].map { |v| evaluate(v, env) }\n lhs > rhs\n when \"<=\"\n lhs, rhs = exp[1..-1].map { |v| evaluate(v, env) }\n lhs <= rhs\n when \"==\"\n lhs, rhs = exp[1..-1].map { |v| evaluate(v, env) }\n lhs == rhs\n when \">=\"\n lhs, rhs = exp[1..-1].map { |v| evaluate(v, env) }\n lhs >= rhs\n when \"==\"\n lhs, rhs = exp[1..-1].map { |v| evaluate(v, env) }\n lhs == rhs\n when \"!=\"\n lhs, rhs = exp[1..-1].map { |v| evaluate(v, env) }\n lhs != rhs\n\n\n#\n## Problem 2: Statements and variables\n#\n\n when \"stmts\"\n # Statements: sequential evaluation of one or more expressions.\n #\n # Advice 1: Insert `pp(exp)` and observe the AST first.\n # Advice 2: Apply `evaluate` to each child of this node.\n statements = exp[1..-1]\n statements.each do |v|\n evaluate(v, env)\n end\n\n# The second argument of this method, `env`, is an \"environement\" that\n# keeps track of the values stored to variables.\n# It is a Hash object whose key is a variable name and whose value is a\n# value stored to the corresponded variable.\n\n when \"var_ref\"\n var_name = exp.last\n env[var_name]\n\n when \"var_assign\"\n name, inner_exp = exp[1..-1]\n env[name] = evaluate(inner_exp, env)\n\n\n#\n## Problem 3: Branchs and loops\n#\n\n when \"if\"\n condition = evaluate(exp[1], env)\n if condition\n evaluate(exp[2], env)\n else\n evaluate(exp[3], env)\n end\n\n\n when \"while\"\n condition = evaluate(exp[1], env)\n while condition\n evaluate(exp[2], env)\n condition = evaluate(exp[1], env)\n end\n\n# Loop.\n\n\n#\n## Problem 4: Function calls\n#\n\n when \"func_call\"\n # Lookup the function definition by the given function name.\n func = $function_definitions[exp[1]]\n\n if func.nil?\n # We couldn't find a user-defined function definition;\n # it should be a builtin function.\n # Dispatch upon the given function name, and do paticular tasks.\n case exp[1]\n when \"p\"\n # MinRuby's `p` method is implemented by Ruby's `p` method.\n p(evaluate(exp[2], env))\n when \"Integer\"\n evaluate(exp[2], env).to_i\n when \"fizzbuzz\"\n n = evaluate(exp[2], env).to_i\n if n % 15 == 0\n 'FizzBuzz'\n elsif n % 3 == 0\n 'Fizz'\n elsif n % 5 == 0\n 'Buzz'\n else\n n.to_s\n end\n else\n raise(\"unknown builtin function\")\n end\n else\n arg_names = func.arg_names\n execution = func.execution\n arguments = exp[2..-1].map { |ast| evaluate(ast, env) }\n env = arg_names.zip(arguments).to_h\n evaluate(execution, env)\n\n #\n ## Problem 5: Function definition\n #\n\n # (You may want to implement \"func_def\" first.)\n #\n # Here, we could find a user-defined function definition.\n # The variable `func` should be a value that was stored at \"func_def\":\n # parameter list and AST of function body.\n #\n # Function calls evaluates the AST of function body within a new scope.\n # You know, you cannot access a varible out of function.\n # Therefore, you need to create a new environment, and evaluate the\n # function body under the environment.\n #\n # Note, you can access formal parameters (*1) in function body.\n # So, the new environment must be initialized with each parameter.\n #\n # (*1) formal parameter: a variable as found in the function definition.\n # For example, `a`, `b`, and `c` are the formal parameters of\n # `def foo(a, b, c)`.\n end\n\n when \"func_def\"\n # Function definition.\n #\n # Add a new function definition to function definition list.\n # The AST of \"func_def\" contains function name, parameter list, and the\n # child AST of function body.\n # All you need is store them into $function_definitions.\n #\n # Advice: $function_definitions[???] = ???\n func_name = exp[1]\n arg_names = exp[2...-1].flatten\n execution_ast = exp.last\n $function_definitions[func_name] = Function.new(arg_names, execution_ast)\n\n\n#\n## Problem 6: Arrays and Hashes\n#\n\n# You don't need advices anymore, do you?\n when \"ary_new\"\n exp[1..-1].map { |ast| evaluate(ast, env) }\n\n when \"ary_ref\"\n array, index = exp[1..2].map { |ast| evaluate(ast, env) }\n array[index]\n\n when \"ary_assign\"\n array, index, value = exp[1..3].map { |ast| evaluate(ast, env) }\n array[index] = value\n\n when \"hash_new\"\n exp[1..-1].map { |ast| evaluate(ast, env) }.each_slice(2).to_h\n\n else\n p(\"error\")\n pp(exp)\n raise(\"unknown node\")\n end\nend", "def interpret\r\n return @leftExpression.interpret - @rightExpression.interpret\r\n end", "def calculate_expr_part(cond_expr, row_val)\n\n\t\tcnt2 = -1 # counter for row_val\n\t\tcnt3 = -1 # counter for operators\n\t\tboolean_expr = \"\"\n\n\t\toperators = cond_expr.to_s.scan(/\\)(.*?)\\(/)\n\n\t\tcond_expr.to_s.scan(/\\((.*?)\\)/).each do |e|\n\t\t\te = e.to_s.delete(\"(\").delete(\")\")\n\n\t\t\trel_operator = get_relational(e)\n\t\t\tls = e.split(\"#{rel_operator}\")[0].scan(/\\[(.*?)\\]/)\n\t\t\trs = e.split(\"#{rel_operator}\")[1]\n\n\t\t\tif ls.size == 0\n\t\t\t\tif rs.nil?\n\t\t\t\t\t# replace vars with val\n\t\t\t\t\t# call compute()\n\n\t\t\t\t\te = e.to_s.replace_with_space(@vars)\n\t\t\t\t\texpr_part = \"\"\n\t\t\t\t\te.split(\" \").each do |v|\n\n\t\t\t\t\t\t(@vars.include? v) ? (expr_part += row_val[cnt2+=1] || '') : ( (v == \"&\") ? (expr_part += \"\") : (expr_part += v.to_s) )\n\t\t\t\t\tend\n\n\t\t\t\t\tboolean_expr += (compute(expr_part).to_s + operators[cnt3+=1].to_s)\n\t\t\t\telse\n\t\t\t\t\tls = e.split(\"#{rel_operator}\")[0]\n\t\t\t\t\tls = ls.to_s.replace_with_space(@vars)\n\t\t\t\t\texpr_part = \"\"\n\t\t\t\t\tls.split(\" \").each do |v|\n\t\t\t\t\t\t(@vars.include? v) ? expr_part += row_val[cnt2+=1] : (v == \"&\") ? expr_part += \"\" : expr_part += v.to_s\n\t\t\t\t\tend\n\n\t\t\t\t\tif compare_ls_rs(compute(expr_part), rel_operator, rs)\n\t\t\t\t\t\tboolean_expr += (\"1\" + operators[cnt3+=1].to_s)\n\t\t\t\t\telse\n\t\t\t\t\t\tboolean_expr += (\"0\" + operators[cnt3+=1].to_s)\n\t\t\t\t\tend\n\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tif compare_ls_rs(cal_group_val(row_val[cnt2+1..cnt2+=ls.size]), rel_operator, rs)\n\t\t\t\t\tboolean_expr += (\"1\" + operators[cnt3+=1].to_s)\n\t\t\t\telse\n\t\t\t\t\tboolean_expr += (\"0\" + operators[cnt3+=1].to_s)\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n=begin\n\t\tif (cond1)\n\t\t\tout 1\n\t\telse if (cond2)\n\t\t\tout 2\n\t\telse\n\t\t\tout 3\n\t\tend\n=end\n\t\tif compute(boolean_expr) == 1\n\t\t\t# Return output mentioned with cnt1 condition\n\t\t\treturn get_output\n\t\telse\n\t\t\t# go for next condition\n\t\t\t# call - calculate_expr(cond_expr, row_val)\n\t\t\tif !@expr_arr[@cnt1+=1].nil?\n\t\t\t\tcalculate_expr_part(@expr_arr[@cnt1], row_val)\n\t\t\telse\n\t\t\t\t# return last output mentioned in ELSE part\n\t\t\t\treturn get_output\n\t\t\tend\n\t\tend\n\n\tend", "def basic_op(operator, value1, value2)\n case operator\n when '+'\n value1 + value2\n when '-'\n value1 - value2\n when '*'\n value1 * value2\n when '/'\n value1 / value2\n end\nend", "def prescedence_of operator\n case operator\n when \"*\" then 2\n when \"/\" then 2\n when \"+\" then 1\n when \"-\" then 1\n when \"(\" then 0 \n end\n end", "def evaluate\n case @op\n when 'println'\n v = @args[0]\n v = v.evaluate if v.is_a?(AST)\n puts v\n when '+'\n sum = 0\n @args.each do |x|\n x = x.evaluate if x.is_a?(AST)\n sum += x\n end\n return sum\n when '-'\n diff = @args[0]\n diff = diff.evaluate if diff.is_a?(AST)\n args_tail = @args.slice(1, args.length-1)\n args_tail.each do |x|\n x = x.evaluate if x.is_a?(AST)\n diff -= x\n end\n return diff\n when '*'\n prod = 1\n @args.each do |x|\n x = x.evaluate if x.is_a?(AST)\n prod *= x\n end\n return prod\n else\n raise \"Unrecognized op '#{@op}'\"\n end\n end", "def basic_op(operator, value1, value2)\n case operator\n when \"+\"\n value1 + value2\n when \"-\"\n value1 - value2\n when \"*\"\n value1 * value2\n when \"/\"\n value1 / value2\n end\nend", "def calculate( a, operator, c )\n\tif operator == \"+\"\n\t\ta + c\n\telsif operator == \"-\"\n\t\ta - c\n\telsif operator == \"*\"\n\t\ta * c\n\telsif operator == \"/\"\n\t\ta/c\n\t\t\n\tend\n\t\nend", "def evalExpression(expr)\n\texprs = expr.get_expr\n\tif expr.class == EXPR_VALUE\n\t\tsymbol = exprs.get_symbol\n\t\tidentif = exprs.get_value\n\t\tif symbol == :IDENTIFIER\n\t\t\tsymbol = $tables.lookup(identif)\n\t\t\tif symbol[1] != nil\n\t\t\t\treturn symbol\n\t\t\telse\n\t\t\t\tputs \"ERROR: variable `#{identif}` no inicializada\"\n\t\t\t\t$error = true\n\t\t\t\treturn [:UNKNOW,nil]\n\t\t\tend\n\t\tend\n\t\treturn [symbol,identif] \n\n\t# Caso que sea una expresion binaria\n\telsif expr.class == EXPR_BIN\n\t\tarit = expr.get_arit\n\t\tsymbol1 = evalExpression(exprs[0])\n\t\tsymbol2 = evalExpression(exprs[1])\n\t\t# Chequea todos los tipos de expresiones binarias aritmeticas\n\t\t# Para cada caso, asegura que sean correctas\n\t\tif !$error\n\t\t\tcase arit\n\t\t\twhen :PLUS , :MINUS, :DIVISION, :MULTIPLY, :PERCENT\n\t\t\t\texpr_eval = expr.get_eval(arit,symbol1[1],symbol2[1])\n\t\t\t\tif !$error\t\n\t\t\t\t\tif expr_eval > 2147483647 || expr_eval < -2147483647\n\t\t\t\t\t\tputs \"ERROR: overflow numero de 32 bits excedido\"\n\t\t\t\t\t\t$error = true\n\t\t\t\t\t\treturn [:UNKNOW,nil]\n\t\t\t\t\telse\n\t\t\t\t\t\treturn [symbol1[0],expr_eval]\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\twhen :AND, :OR\n\t\t\t\texpr_eval = expr.get_eval(arit,symbol1[1],symbol2[1])\n\t\t\t\treturn [symbol1[0],expr_eval]\n\t\t\twhen :AMPERSAND, :VIRGUILE \n\t\t\t\texpr_eval = expr.get_eval(arit,symbol1[1],symbol2[1])\n\t\t\t\tif expr_eval == nil\n\t\t\t\t\tif arit == :AMPERSAND \n\t\t\t\t\t\tputs \"ERROR: concatenacion vertical incorrecta tamano incompatible\"\n\t\t\t\t\telse\n\t\t\t\t\t\tputs \"ERROR: concatenacion horizontal incorrecta tamano incompatible\"\n\t\t\t\t\tend\n\t\t\t\t\t$error = true\n\t\t\t\t\treturn [:UNKNOW,nil]\n\t\t\t\tend\n\t\t\t\treturn [symbol1[0],expr_eval]\n\t\t\twhen :LESS, :LESS_EQUAL, :MORE, :MORE_EQUAL\n\t\t\t\texpr_eval = expr.get_eval(arit,symbol1[1],symbol2[1])\n\t\t\t\treturn [:BOOLEAN,expr_eval]\n\t\t\twhen :EQUAL, :INEQUAL\n\t\t\t\texpr_eval = expr.get_eval(arit,symbol1[1],symbol2[1])\n\t\t\t\treturn [:BOOLEAN,expr_eval]\n\t\t\tend\n\t\tend\n\t\t# Caso que sea una expresion unaria\n\telsif expr.class == EXPR_UNARIA\n\t\tarit = expr.get_arit\n\t\tsymbol1 = evalExpression(exprs)\n\t\t# evalua las expresiones unarias aritmeticas\n\t\t# Para cada caso, chequea que sean correctas\n\t\tif !$error \n\t\t\tcase arit\n\t\t\twhen :MINUS_UNARY\n\t\t\t\texpr_eval = expr.get_eval(arit,symbol1[1])\n\t\t\t\treturn [symbol1[0],expr_eval]\n\t\t\twhen :DOLLAR, :APOSTROPHE \n\t\t\t\texpr_eval = expr.get_eval(arit,symbol1[1])\n\t\t\t\treturn [symbol1[0],expr_eval]\n\t\t\twhen :NOT\n\t\t\t\texpr_eval = expr.get_eval(arit,symbol1[1])\n\t\t\t\treturn [symbol1[0],expr_eval]\n\t\t\tend\n\t\tend\n\t# En caso de conseguir expresiones parentizadas, evalua la expresion\n\telsif expr.class == EXPR_PARENTHESIS\n\t\treturn evalExpression(exprs)\n\tend\nend", "def answer\n operators[@operator].call\n end", "def evaluate(env)\n left = self.left.evaluate(env) \n right =self.right.evaluate(env)\n if (left.is_a? Numeric or left.is_a? String) && (right.is_a? Numeric or right.is_a? String) then\n return left - right\n else\n raise \" Math Error: cannot multiply #{left.class} with #{right.class}\\nFrom line: #{self.line}\"\n end\n end", "def operate_value(operation, operand_type, operand)\r\n value = operand_type == 0 ? operand : $game_variables[operand]\r\n operation == 0 ? value : -value\r\n end", "def eval\n return @value unless @value.nil?\n \n debug \"\\nfor RPN expression: #{expression}\\nTerm\\tAction\\tStack\"\n stack = []\n expression.split.each do |term|\n if Operators.has_key?(term)\n a, b = stack.pop(2)\n raise ArgumentError, \"not enough operands on the stack\" if b.nil?\n a = a.to_f if term == \"/\"\n op = (term == \"^\" ? \"**\" : term)\n stack.push(a.method(op).call(b))\n debug \"#{term}\\t#{Operators[term].english}\\t#{stack}\"\n else\n begin\n number = Integer(term) rescue Float(term)\n rescue ArgumentError\n raise ArgumentError, \"cannot handle term: #{term}\"\n end\n stack.push(number)\n debug \"#{number}\\tPUSH\\t#{stack}\"\n end\n end\n @value = stack.pop\n debug \"Value = #@value\"\n @value\n end", "def execWithOperator(env)\n operatorToken = Ruby::Token.new(self.operator.token[/(.*)=/, 1])\n binaryExpression = Ruby::Binary.new(operatorToken, self.left, self.right)\n #return the partial evaluation result of the newly created binary expression.\n binaryExpression.pe(env)\n end", "def v\n @v ||= operand(0).evaluate\n end", "def expression\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 2 )\n\n\n value = nil\n\n\n a = nil\n b = nil\n\n\n begin\n # at line 9:28: a= mul ( ADD b= mul | SUB b= mul )*\n @state.following.push( TOKENS_FOLLOWING_mul_IN_expression_44 )\n a = mul\n @state.following.pop\n # at line 9:33: ( ADD b= mul | SUB b= mul )*\n while true # decision 1\n alt_1 = 3\n look_1_0 = @input.peek( 1 )\n\n if ( look_1_0 == ADD )\n alt_1 = 1\n elsif ( look_1_0 == SUB )\n alt_1 = 2\n\n end\n case alt_1\n when 1\n # at line 10:5: ADD b= mul\n match( ADD, TOKENS_FOLLOWING_ADD_IN_expression_51 )\n @state.following.push( TOKENS_FOLLOWING_mul_IN_expression_55 )\n b = mul\n @state.following.pop\n\n # --> action\n a += b \n # <-- action\n\n\n when 2\n # at line 11:5: SUB b= mul\n match( SUB, TOKENS_FOLLOWING_SUB_IN_expression_63 )\n @state.following.push( TOKENS_FOLLOWING_mul_IN_expression_67 )\n b = mul\n @state.following.pop\n\n # --> action\n a -= b \n # <-- action\n\n\n else\n break # out of loop for decision 1\n end\n end # loop for decision 1\n\n\n # --> action\n value = a \n # <-- action\n\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 2 )\n\n\n end\n\n return value\n end", "def get_result(operator, *n)\n return $operations[operator].call(*n).to_s\nend", "def math_eval(str)\n # iterate over string values\n # perhaps utilize a queue till you hit a symbol?\n # left operand and right operand (do we care about order of operations?)\n copy = str\n total = 0\n tokens = []\n\n copy.chars.each_with_index do |ch, idx|\n if ch == '*' || ch == '/' || ch == '+' || ch == '-'\n divided = str.split(ch)\n tokens << divided.shift.to_i\n tokens << ch\n copy = divided\n end\n if idx == copy.length - 1\n tokens << copy\n end\n # break if ch.match(/()+\\-*/) && operator != ''\n # operator = ch.match(/()+\\-*/)\n # left_operand = ch if ch.match(/0-9/) && operator == ''\n # right_operand += ch if ch.match(/0-9/) && operator != ''\n end\n return tokens\n\n p \"operator: #{operator}, left_operand: #{left_operand}, right_operand: #{right_operand}\"\n return left_operand.to_i if operator == ''\n return left_operand.to_i + right_operand.to_i if operator == '+'\n return left_operand.to_i - right_operand.to_i if operator == '-'\n return left_operand.to_i / right_operand.to_i if operator == '/'\n return left_operand.to_i * right_operand.to_i if operator == '*'\nend", "def calculate(starting_value, operations)\n sum = starting_value\n operations.each do |ops|\n operator = ops[0]\n operand = ops[1]\n \n case operator\n when '+'\n sum += operand \n when '-'\n sum -= operand\n when '*'\n sum *= operand\n when '/'\n sum /=operand\n else \n end\n end \n sum \nend", "def do_math(operand, val1, val2)\n case operand\n when \"+\"\n val1 + val2\n when \"-\"\n val1 - val2\n when \"*\"\n val1 * val2\n when \"/\"\n val1 / val2\n end\nend", "def operand(n) # rubocop:disable Naming/MethodParameterName\n @operands[n]\n end", "def _calc operator\n (operand1, operand2) = @stack.pop 2\n @stack.unshift @stack.first\n @stack.push operand1.send(operator.to_sym, operand2)\nend", "def calc_operator token\n ##\n # We need two operands to perform an operation, so we \n # raise `InvalidTokenError` if we don't have those \n # (as at that moment of execution operator-tokens are invalid).\n raise InvalidTokenError if @stack.length < 2\n arg2 = pop!\n arg1 = pop!\n res = get_operation(token).call(arg1, arg2)\n @stack.push(res)\n res\n end", "def calculate\n\t\tplace_in_containers()\n\n\t\t# Checks for mismatch between the number of operands and operators.\n\t\t# The only valid number of operators for N operands is (N - 1).\n\t\tunless @operands.size - @operators.size == 1\n\t\t\t@valid = false\n\t\t\t@errors.push(\"Operand/Operator mismatch.\")\n\t\tend\n\n\t\t# Checks for operators present before the first two operands\n\t\t# are written. This is incorrect RPN syntax.\n\t\tif (@instructions[0..1] & [1010, 1011, 1100, 1101]).any?\n\t\t\t@valid = false\n\t\t\t@errors.push(\"Operator present before first two operands.\")\n\t\tend\n\n\t\t# Checks for an empty operand stack. In this case, there is\n\t\t# nothing more to do in the method.\n\t\tif @operands.empty?\n\t\t\t@errors.push(\"No operands.\")\n\t\t\treturn [0, false]\n\t\tend\n\n\t\t# Runs a loop until fewer than two operands or fewer than 1\n\t\t# operators are present in their respective containers.\n\t\tuntil @operands.size == 1 || @operators.size == 0 do\n\t\t\t# Pops the first operator from the front of the queue.\n\t\t\toperator = @operators.shift\n\n\t\t\t# Pops the top and second-to-top operands off of the stack.\n\t\t\topright = @operands.pop\n\t\t\topleft = @operands.pop\n\n\t\t\t# Returns prematurely before division by zero occurs.\n\t\t\tif operator == \"/\" && opright == 0\n\t\t\t\tputs \"division by zero\"\n\t\t\t\treturn [0, false]\n\t\t\tend\n\n\t\t\t# Sends the operator and the right operand to the left operand\n\t\t\t# and thereby invokes FixedNum#+, the method used for adding\n\t\t\t# integers.\n\t\t\t@operands.push(opleft.send(operator, opright))\n\t\tend\n\n\t\t# Returns the last element of @operands and the value of @valid.\n\t\t[@operands[-1], @valid]\n\tend", "def check_operators(token, evaluation, line, file_read, ops)\n op1 = ops[0]\n op2 = ops[1]\n unless ['-', '+', '/', '*'].include?(token) && !(token == '/' && op2.to_i.zero?)\n puts \"Line #{line}: Could not evaluate expression\"\n error_eval(5, line, nil, file_read)\n return false\n end\n evaluation.push(op1.to_i.send(token.to_sym, op2.to_i))\n end", "def expr()\n #This is a stub, used for indexing\n end", "def calculate\n @equations = self.class.permutate(@inputs, @operators)\n @results = {}\n @equations.each do |eq|\n @results[eq] = eval(eq)\n end\n end", "def evaluation(input)\n operand_output = operand.call(input)\n evaluation_success(input, operand_output, !operand_output)\n end", "def perform_calc(opr, val1, val2)\n result = 0\n case opr\n when '*'\n result = val1.to_f * val2.to_f\n when \"/\"\n result = val1.to_f / val2.to_f\n when \"+\"\n result = val1.to_f + val2.to_f\n when \"-\"\n result = val1.to_f - val2.to_f\n end\n result.round(2)\n end", "def arithmetic(a, b, operator)\n $oper = operator\n case $oper\n when 'add'\n return a + b\n\n when 'subtract'\n return a - b\n\n when 'multiply'\n return a * b\n\n when 'divide'\n return a / b\n \n end\nend", "def evaluate(env)\n left = self.left.evaluate(env) \n right =self.right.evaluate(env)\n if left.is_a? Numeric and right.is_a? Numeric then\n return left + right\n else\n raise \" Math Error: cannot sum #{left.class} with #{right.class}\\nFrom line: #{self.line}\"\n end\n end", "def evaluate(interpreter, arg_stack)\n args = arg_stack.pop\n\n return @cached unless @cached.nil?\n\n raise BASICRuntimeError.new(:te_args_no_match, @name) unless\n match_args_to_signature(args, @signature1)\n\n res = args[0].floor\n\n @cached = res if @constant && $options['cache_const_expr']\n res\n end", "def eval(expr, *rest) end", "def calculate(node = self.tree)\n\n # base case when a leaf is reached (number) \n return ExpressionTree.process_number(node.value) if node.left.nil? && node.right.nil?\n\n left = Number.new(0)\n if node.left\n left = calculate(node.left)\n end\n\n right = Number.new(0)\n if node.left\n right = calculate(node.right)\n end\n\n # using send to pass the actual operator and evaluate ir using overloading of operators\n return left.send(node.value,right) \n end", "def calculate\n (2 + 2) * 2\nend", "def initialize\n @expr = gen_expr\n @ans = eval @expr\n end", "def operand\n operands.first\n end", "def calculate( op, a1, a2 = nil )\n case op\n when :abs; a2\n when :rel; a2\n when :mul; a1 * a2\n when :add; a1 + a2\n when :sub; a1 - a2\n when :inv; a1 * -1\n else 0\n end\n end", "def expression\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 29 )\n\n\n value = nil\n\n\n type = nil\n a = nil\n b = nil\n\n\n begin\n # at line 185:5: a= relation (type= ( '&&' | '||' ) b= expression )?\n @state.following.push( TOKENS_FOLLOWING_relation_IN_expression_1389 )\n a = relation\n @state.following.pop\n\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n value = a \n # <-- action\n end\n\n # at line 186:3: (type= ( '&&' | '||' ) b= expression )?\n alt_45 = 2\n look_45_0 = @input.peek( 1 )\n\n if ( look_45_0 == T__33 || look_45_0 == T__54 )\n alt_45 = 1\n end\n case alt_45\n when 1\n # at line 186:6: type= ( '&&' | '||' ) b= expression\n type = @input.look\n\n if @input.peek(1) == T__33 || @input.peek(1) == T__54\n @input.consume\n @state.error_recovery = false\n\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n\n mse = MismatchedSet( nil )\n raise mse\n\n end\n\n\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1410 )\n b = expression\n @state.following.pop\n\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n value = DoubleOperandExpressionEval.new(type.text, a, b) \n # <-- action\n end\n\n\n end\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 29 )\n\n\n end\n\n return value\n end", "def applyOperator(num1, num2, operator)\n #eval((num1.to_s + operator + num2.to_s).gsub(\"^\", \"**\"))\n @operators[operator][:action].call(num1.to_i, num2.to_i)\n end", "def evaluate(rule_base)\n left_side = lhs.evaluate(rule_base)\n right_side = rhs.evaluate(rule_base)\n if self.operator == AND\n #Return true if both lhs and rhs are true\n return Rule::TRUE if left_side == Rule::TRUE && right_side == Rule::TRUE\n return Rule::FALSE if left_side == Rule::FALSE || right_side == Rule::FALSE\n return Rule::UNKNOWN\n else #OR\n #Return true if either lhs or rhs are true\n return Rule::TRUE if left_side == Rule::TRUE || right_side == Rule::TRUE\n return Rule::FALSE if left_side == Rule::FALSE && right_side == Rule::FALSE\n return Rule::UNKNOWN\n end\n end", "def eval_stmt(stmt)\n l = eval_side(stmt.left)\n r = eval_side(stmt.right)\n case stmt.type\n when :not\n !l\n when :and\n l && r\n when :or\n l || r\n when :xor\n l ^ r\n when :implies\n l ? r : true\n when :iff\n l == r\n when :parens\n l\n end\n end", "def expression\n n = term\n while next_token == '+' || next_token == '-'\n op = consume\n m = term\n n = case op\n when '+'\n n + m\n when '-'\n n - m\n else\n nil\n end\n end\n n\n end", "def expr\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 3 )\n value = nil\n e = nil\n\n begin\n # at line 35:5: e= expr1 ( '+' e= expr1 | '-' e= expr1 )*\n @state.following.push( TOKENS_FOLLOWING_expr1_IN_expr_262 )\n e = expr1\n @state.following.pop\n # --> action\n value = e \n # <-- action\n # at line 36:5: ( '+' e= expr1 | '-' e= expr1 )*\n while true # decision 3\n alt_3 = 3\n look_3_0 = @input.peek( 1 )\n\n if ( look_3_0 == T__14 )\n alt_3 = 1\n elsif ( look_3_0 == T__15 )\n alt_3 = 2\n\n end\n case alt_3\n when 1\n # at line 36:7: '+' e= expr1\n match( T__14, TOKENS_FOLLOWING_T__14_IN_expr_272 )\n @state.following.push( TOKENS_FOLLOWING_expr1_IN_expr_276 )\n e = expr1\n @state.following.pop\n # --> action\n value += e \n # <-- action\n\n when 2\n # at line 37:7: '-' e= expr1\n match( T__15, TOKENS_FOLLOWING_T__15_IN_expr_286 )\n @state.following.push( TOKENS_FOLLOWING_expr1_IN_expr_290 )\n e = expr1\n @state.following.pop\n # --> action\n value -= e \n # <-- action\n\n else\n break # out of loop for decision 3\n end\n end # loop for decision 3\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 3 )\n\n end\n \n return value\n end", "def optimize_right\n Function.optimize_operand(operation.right)\n end", "def calculate(operator)\n operands = @memory.stack.pop(2)\n @memory.stack.push(operands.inject(operator))\n end", "def evaluate(expression)\n \texpr = tokens(expression)\n \tret = 0\n values = [] #Values stores the results from each operation\n \texpr.each do |element|\n \t\tif(element.is_a?(Fixnum))\n \t\t\tpush(element)\n \t\telse\n \t\t\tcase element\n \t\t\twhen :+\n #If numbers is empty, use the last two numbers in values \n #as the operands.\n #Implemented this in order for the \"1 2 3 * + 4 5 - /\" example\n #to pass. Kept getting the error that @numbers was empty\n if(@numbers.empty?)\n num1 = values.pop\n num2 = values.pop\n ret = num2 / num1\n break \n else \n \t\t\t\t ret = plus\n values << ret\n end\n \t\t\twhen :-\n if(@numbers.empty?)\n num1 = values.pop\n num2 = values.pop\n ret = num2 / num1\n break \n else\n \t\t\t\t ret = minus\n values << ret\n end\n \t\t\twhen :*\n if(@numbers.empty?)\n num1 = values.pop\n num2 = values.pop\n ret = num2 / num1\n break \n else\n ret = times\n values << ret\n end\n \t\t\twhen :/\n if(@numbers.empty?)\n num1 = values.pop\n num2 = values.pop\n ret = num2 / num1\n break\n else\n ret = divide\n values << ret\n end\n \t\t\tend\n \t\tend\n \tend\n\tret\n end", "def evaluate(expr)\n TupleExpression.coerce(expr).evaluate(self)\n end", "def calculate(operation, n1, n2)\n if operation == \"add\" || operation == \"+\"\n return \"#{n1} + #{n2} = #{n1+n2}\"\n elsif operation == \"subtract\" || operation == \"-\"\n return \"#{n1} - #{n2} = #{n1-n2}\"\n elsif operation == \"multiply\" || operation == \"*\"\n return \"#{n1} * #{n2} = #{n1*n2}\"\n elsif operation == \"divide\" || operation == \"/\"\n if n2 == 0\n return \"undefined\"\n else\n return \"#{n1} / #{n2} = #{n1/n2}\"\n end\n elsif operation == \"exponent\" || operation == \"^\"\n return \"#{n1} ^ #{n2} = #{n1**n2}\"\n elsif operation == \"modulo\" || operation == \"%\"\n return \"#{n1} % #{n2} = #{n1%n2}\"\n end\nend", "def test_partial_results\n exp1 = SimpleOperationEval.new(@lit_10, @lit_20, :add)\n SimpleOperationEval.new(@lit_30, exp1, :mul).eval\n assert_equal MPPCompiler.last, <<EOS\nSET B, 10\nADD B, 20\nSET A, 30\nMLI A, B\nEOS\n end", "def calculate(op, x, y)\n case op\n when 'plus'\n x.to_f + y.to_f\n when 'minus'\n x.to_f - y.to_f\n when 'divide'\n x.to_f / y.to_f\n when 'multiple'\n x.to_f * y.to_f\n end\nend", "def applyOperator(num1, num2, operator)\n\n\t\tif operator == \"+\"\n\t\t\treturn num1.to_i + num2.to_i\n\t\tend\n\n\t\tif operator == \"-\"\n\t\t\treturn num1.to_i - num2.to_i\n\t\tend\n\n\t\tif operator == \"*\"\n\t\t\treturn num1.to_i * num2.to_i\n\t\tend\n\n\t\tif operator == \"/\"\n\t\t\treturn num1.to_i / num2.to_i\n\t\tend\n\n\t\tif operator == \"%\"\n\t\t\treturn num1.to_i % num2.to_i\n\t\tend\n\n\t\tif operator == \"^\"\n\t\t\treturn num1.to_i ** num2.to_i\n\t\tend\n\n end", "def evaluate(_interpreter, arg_stack)\n args = arg_stack.pop\n\n return @cached unless @cached.nil?\n\n if match_args_to_signature(args, @signature1)\n res = TextValue.new(args[0].to_s)\n elsif match_args_to_signature(args, @signature2)\n places = args[1].to_i\n value = args[0].to_f\n text = format('%.*f', places, value)\n res = TextValue.new(text)\n else\n raise BASICRuntimeError.new(:te_args_no_match, @name)\n end\n\n @cached = res if @constant && $options['cache_const_expr']\n res\n end", "def expression\n if is_addop @look\n emit_ln 'CLR D0'\n else\n term\n end\n while is_addop @look\n emit_ln 'MOVE D0, -(SP)' \n case @look\n when '+': add\n when '-': subtract\n else expected('Addop')\n end\n end\nend", "def operator; end", "def calculator(operator, *numbers)\n result = 0\n if operator == \"*\"\n result = 1\n else\n result = numbers[0]\n numbers.shift\n end\n\n numbers.each do |arg|\n #result = arg operator.send result\n result = result.send(operator,arg)\n end\n return result\nend", "def eval\n @token = @lexer.next\n expression(0)\n end", "def operation(x)\n Math.sqrt(x.abs) + 5 * x ** 3\nend", "def calculate_expressions(expr)\n res = 0\n if expr.count(\"a-zA-Z\") > 0\n res = \"Incorrect expression or Number\"\n else\n while(has_operators?(expr))\n @logger.info \"Expression=#{expr}\"\n part_expr = \"\"\n operator = next_operator(expr)\n @logger.info \"Operator=#{operator}\"\n idx = expr.index(operator)\n val1 = find_prv_operand(expr, idx)\n val2 = find_next_operand(expr, idx)\n res = perform_calc(operator, val1, val2)\n part_expr = \"#{val1}#{operator}#{val2}\"\n @logger.info \"#{part_expr}=#{res}\"\n expr.gsub!(part_expr, res.to_s)\n end\n res = res.round(2)\n end\n res\n end", "def calculator(operator_active, num1, num2)\n case operator_active\n when \"+\"\n return num1 + num2\n when \"-\"\n return num1 - num2\n when \"*\"\n return num1 * num2\n when \"/\"\n return num1 / num2\n end\nend", "def calculate(starting_value, operations)\n for i in 0...operations.length\n # just in case an unexpected operator is given:\n if '*/+-'.include?(operations[i][0]) == false\n puts 'unexpected operator!'\n break\n end\n \n if operations[i][0] == \"*\"\n starting_value *= operations[i][1]\n elsif operations[i][0] == \"+\"\n starting_value += operations[i][1]\n elsif operations[i][0] == \"-\"\n starting_value -= operations[i][1]\n else\n starting_value /= operations[i][1]\n end\n end\n starting_value\nend", "def apply\n if operator.division? && operands.all?(&:zero?)\n warn \"Can't divide #{target} by zero. Consider rewinding.\"\n return 0\n end\n result = target.send(operator, *operands)\n result == result.to_i ? result.to_i : result\n end", "def optimize\n operand.class.new(wrap_left, wrap_right)\n end", "def evaluate\n stack = Stack.new\n\n tokens.each do |token|\n if numeric?(token)\n stack.push(token.to_i)\n elsif operator?(token)\n args = []\n SYMBOL_TABLE[token].arity.times do\n args.unshift(stack.pop)\n end\n\n stack.push(call_operator(token, *args))\n else\n raise \"omg what is this token?\"\n end\n end\n\n stack.pop\n end", "def optimize\n operation.class.call(operand)\n end", "def operation(operator, num1, num2)\n case operator \n when 1 \n puts \"The operational result is: #{num1.to_f + num2.to_f}\"\n puts \"==> #{num1.to_s} + #{num2.to_s} = #{num1.to_f + num2.to_f}\"\n when 2 \n puts \"The operational result is: #{num1.to_f - num2.to_f}\"\n puts \"==> #{num1.to_s} - #{num2.to_s} = #{num1.to_f - num2.to_f}\"\n when 3\n puts \"The operational result is: #{num1.to_f * num2.to_f}\"\n puts \"==> #{num1.to_s} * #{num2.to_s} = #{num1.to_f * num2.to_f}\"\n else\n puts \"The operational result is: #{num1.to_f / num2.to_f}\"\n puts \"==> #{num1.to_s} / #{num2.to_s} = #{num1.to_f / num2.to_f}\"\n end\nend", "def operation_of(a, b, op)\n if op == \"add\"\n return a + b\n elsif op == \"subtract\"\n return a - b \n elsif op == \"multiply\"\n return a * b \n elsif op == \"divide\"\n if b == 0\n return \"undefined\"\n else\n return a / b\n end\n end\nend", "def operate( op, val = nil )\n case val\n when Coord\n @rel |= true\n @ops.push [ op, val ]\n when Numeric, NilClass\n if @rel == false\n @ops[-1][1] = calculate( op, @ops[-1][1], val )\n else\n @ops.push [ op, val ]\n end\n end\n end", "def evaluate_operator(left, right)\n left >= right\n end", "def evaluate_operator(left, right)\n left <= right\n end", "def math(operator, first_num, second_num)\n if operator ==\"*\"\n first_num*second_num\n elsif operator == \"/\"\n first_num/second_num\n elsif operator == \"+\"\n first_num+second_num\n else\n first_num-second_num\n end\nend", "def elementwise_op(op,left_val,right_val)\n\n end", "def evaluate\n SQ.inject { |x, n| x + (@colors[n] == @mx ? (PST[n] + VALUE[@pieces[n]]) :\n @colors[n] == @mn ? -(PST[n] + VALUE[@pieces[n]]) : 0) }\n end", "def expr\n or_expr\n end", "def initialize\n @num1 = rand(20)\n @num2 = rand(20)\n @operator = OPERATORS.sample\n \n if @operator == \"+\"\n @solution = @num1 + @num2\n elsif @operator == \"-\"\n @num1 += 20 if @num2 > @num1 # avoid negative answers for now.\n @solution = @num1 - @num2\n elsif @operator == \"*\"\n @solution = @num1 * @num2\n elsif @operator == \"/\"\n @solution = @num1 / @num2\n end\n\n @expression = \"#{num1} #{operator} #{num2} equals #{solution}.\"\n end", "def operators\n {\n \"+\" => -> {@num1 + @num2},\n \"-\" => -> {@num1 - @num2}\n }\n end", "def operation_of(a, b, op)\n if op == \"add\"\n return a + b\n elsif op == \"subtract\"\n return a - b\n elsif op == \"multiply\"\n return a * b\n elsif op == \"divide\"\n if b == 0\n return \"undefined\"\n else\n return a / b\n end\n end\nend", "def optimize(**options)\n if operand(0).is_a?(Variable) && operand(0).bound? && operand(0).eql?(operand(1))\n RDF::Literal::TRUE\n else\n super # @see Operator#optimize!\n end\n end", "def Calculator(leftParam, rightParam, operator)\n\n case operator\n\n when \"+\"\n return leftParam + rightParam;\n when \"*\"\n\n i = 0\n result = 0\n while i < leftParam #2\n result = result + rightParam #@\n i= i + 1\n end\n\n return result\n end\nend", "def value\n\t\t@operands[-1]\n\tend", "def operator\n case @matches[2]\n when \"plus\" then :+\n when \"minus\" then :-\n when \"divided by\" then :/\n when \"multiplied by\" then :*\n end\n end", "def mul\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 3 )\n\n\n value = nil\n\n\n a = nil\n b = nil\n\n\n begin\n # at line 14:21: a= single ( MUL b= single | DIV b= single )*\n @state.following.push( TOKENS_FOLLOWING_single_IN_mul_88 )\n a = single\n @state.following.pop\n # at line 14:29: ( MUL b= single | DIV b= single )*\n while true # decision 2\n alt_2 = 3\n look_2_0 = @input.peek( 1 )\n\n if ( look_2_0 == MUL )\n alt_2 = 1\n elsif ( look_2_0 == DIV )\n alt_2 = 2\n\n end\n case alt_2\n when 1\n # at line 15:5: MUL b= single\n match( MUL, TOKENS_FOLLOWING_MUL_IN_mul_95 )\n @state.following.push( TOKENS_FOLLOWING_single_IN_mul_99 )\n b = single\n @state.following.pop\n\n # --> action\n a *= b \n # <-- action\n\n\n when 2\n # at line 16:5: DIV b= single\n match( DIV, TOKENS_FOLLOWING_DIV_IN_mul_107 )\n @state.following.push( TOKENS_FOLLOWING_single_IN_mul_111 )\n b = single\n @state.following.pop\n\n # --> action\n a /= b \n # <-- action\n\n\n else\n break # out of loop for decision 2\n end\n end # loop for decision 2\n\n\n # --> action\n value = a \n # <-- action\n\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 3 )\n\n\n end\n\n return value\n end", "def rec_eval(scope, expr, state)\n\n if is?(expr[:term], :register) || is?(expr[:term], :special)\n unless state[:register].nil? && state[:special].nil?\n raise EvalError.new(\"Only one register or special value may be referenced per expression.\")\n end\n \n unless state[:accum].nil? || expr[:rhs].nil?\n\n raise EvalError.new(\"Registers and special values may only appear as left- or right-most term of an expression.\")\n end\n \n if is?(expr[:term], :register)\n state[:register] = REGISTERS[expr[:term][:token]]\n state[:reg_tok] = expr[:term][:token]\n else\n state[:special] = VALUES[expr[:term][:token]]\n state[:special_tok] = expr[:term][:token]\n end\n elsif is?(expr[:term], :literal) || is?(expr[:term], :reference)\n state[:accum] = 0 if state[:accum].nil?\n loc_value = 0\n \n if is?(expr[:term], :literal)\n loc_value = expr[:term][:value]\n else\n sym = scope.ref(expr[:term][:token])\n if sym.nil?\n raise LinkError.new(\"Cannot find symbol for reference '#{expr[:term][:token]}'\")\n end\n sym.referenced\n loc_value = sym.def_instr.address\n end\n \n if expr[:term][:operator] && expr[:term][:operator] == '-'\n state[:accum] -= loc_value\n else\n state[:accum] += loc_value\n end\n else\n puts \"What the fuck is that?\"\n exit 1 \n end\n\n if expr[:rhs]\n rec_eval(scope, expr[:rhs], state)\n end\n\n return state\n end", "def calc(expr, verbose=false)\n # hash of str: func for operations\n ops_hash = {'+': method(:add), '-': method(:subt),\n '*': method(:mult), '/': method(:div),\n '**': method(:pow), '^': method(:pow)}\n\n # parse expr\n expr.strip!\n expr_arr = expr.split\n\n # check expression validity\n unless check_expr(expr_arr, false)\n return nil\n end\n\n j = 0 # used to track index while handling parens\n\n # find matching parens, then replace parens and contents with result of contents\n while j < (expr_arr.length - 1) do\n # check parens and get nest info. needs to be done inside this loop\n # if not, info fails to match as expression changes\n nest = check_parens(expr_arr)\n unless nest\n return nil\n end\n\n match_j = nil # Initialize match_j so later code can find it\n # find open paren\n if PAIRS.key?(expr_arr[j])\n # find matching close paren\n nest.each do |info_arr|\n if info_arr[2] == j\n match_j = info_arr[3]\n end\n end\n\n # join contents and send to calc\n temp_expr = expr_arr[j+1...match_j].join(' ')\n temp_result = calc(temp_expr, verbose)\n\n # return if internal expression was invalid\n unless temp_result\n return nil\n end\n\n # replace parens and contents with temp result\n expr_arr[j..match_j] = temp_result\n j = 0 # indices got moved and removed, so start from beginning\n else\n j += 1\n end\n end\n\n # If, after dealing with parens, there is only one element, return it\n if expr_arr.length == 1\n return expr_arr[0].to_f\n end\n\n result = 0 # initialize result variable so the return statement can find it\n\n # search for operations in order\n OPS.each do |op_set|\n i = 0\n\n # search expression for current operations\n # if found: calculate, replace, and search from begining of expression\n # else: move to next element in expression\n while i < (expr_arr.length - 1) do\n if op_set.include?(expr_arr[i])\n # find and assign operation and values\n op = expr_arr[i]\n x = expr_arr[i-1]\n y = expr_arr[i+1]\n\n # call appropriate op function\n result = ops_hash[op.to_sym].(x.to_f, y.to_f)\n\n # replace the 3 used elements with the result\n expr_arr[i-1..i+1] = result\n i = 0 # indices got moved and removed, so start from beginning\n\n # print verbose output\n if verbose and not expr_arr.length == 1\n puts expr_arr.join(\" \")\n end\n else\n i += 1\n end\n end\n end\n return result\nend", "def applyOperator(num1, num2, operator)\n return num1.send(operator, num2)\n end" ]
[ "0.68874955", "0.6483065", "0.64162254", "0.6378099", "0.6352187", "0.6340181", "0.6301769", "0.62800187", "0.6260919", "0.62332726", "0.6224119", "0.6205368", "0.61952364", "0.6178997", "0.6166607", "0.61437136", "0.61366314", "0.61353755", "0.6089381", "0.6067032", "0.6060771", "0.6058928", "0.60586286", "0.60437226", "0.6032554", "0.60301507", "0.6000126", "0.5996288", "0.59511757", "0.59462565", "0.59327334", "0.5927435", "0.5918808", "0.59118927", "0.5906374", "0.5899055", "0.5892078", "0.5889571", "0.58894753", "0.58838147", "0.5855802", "0.5838792", "0.5834347", "0.5831995", "0.58245444", "0.58231294", "0.58149105", "0.58136594", "0.58127797", "0.57959694", "0.57868445", "0.57821965", "0.5780829", "0.5777781", "0.5768985", "0.5762235", "0.5755886", "0.57527816", "0.57501537", "0.5749862", "0.57497215", "0.5740085", "0.57340586", "0.57290673", "0.5726521", "0.57240546", "0.57160175", "0.5709342", "0.5708538", "0.57076955", "0.5701073", "0.56996", "0.5692976", "0.56827587", "0.56816965", "0.567742", "0.5675501", "0.56752026", "0.5674596", "0.5669031", "0.5663364", "0.56529087", "0.5651878", "0.56504035", "0.5643301", "0.56397706", "0.563707", "0.56359935", "0.56353396", "0.5634965", "0.5632564", "0.5629551", "0.562662", "0.5621836", "0.56179655", "0.5615103", "0.5614765", "0.5614202", "0.561156", "0.56060684", "0.5605028" ]
0.0
-1
Return a Binary connective with optimized operands
def optimize operation.class.new(left, right) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compile_binary(node)\n compile_error(node) if node.operator != :|\n\n combine_or(compile_node(node.left), compile_node(node.right))\n end", "def binary(node, iff, label)\n #iff = true if `binary` was called to evaluate the condition clause of an (if-statement or while-stmt)\n if node.left\n leftreg = gen(node.left)\n end\n\n if(node.right)\n rightreg = gen(node.right, leftreg)\n end\n\n case node.a_type\n when :PLUS\n @cg.cgadd(leftreg, rightreg)\n when :MINUS\n @cg.cgsub(leftreg, rightreg)\n when :STAR\n @cg.cgmul(leftreg, rightreg)\n when :SLASH\n @cg.cgdiv(leftreg, rightreg)\n when :EQ_EQ, :NE, :LT, :GT, :GE, :LE\n if not iff\n @cg.cgcompare_and_set(node.a_type, leftreg, rightreg)\n else\n @cg.cgcompare_and_jump(node.a_type, leftreg, rightreg, label)\n end\n else\n puts \"unknown AST op #{node.a_type}\"\n exit(1)\n end\n end", "def translate_binary(bin)\n expr(BinaryExpression, lhs: visit(bin[0]), op: bin[1], rhs: visit(bin[2]), loc: bin)\n end", "def optimize\n operand.class.new(wrap_left, wrap_right)\n end", "def optimize\n operation.class.reverse.new(right, left)\n end", "def to_db(ex,db)\n begin\n db_val1, hop_val1 = @expr1.to_db(ex,db)\n db_val2, hop_val2 = @expr2.to_db(ex,db)\n if @short\n #short-circuit\n if not db_val1.nil? and not db_val2.nil?\n #all calculated\n\n case op\n when 'and'\n db_cond=db.and(db_val1, db_val2)\n db_cond=db_val1 if db_cond.nil?\n return db_cond, self\n when 'or'\n return db.or(db_val1, db_val2), self\n else\n hop_warn \"#{op}: unsupported short-cirtuit binary operator\"\n return nil, self\n end\n else\n # sometnig cannot be calculated\n case op\n when 'or'\n # 8( all DB must be searched...\n return nil, self\n when 'and'\n return db_val2, self if(db_val1.nil?)\n return db_val1, self\n else\n hop_warn \"#{op}: unsupported short-cirtuit binary operator\"\n return nil, nil\n end\n end #if calculated\n elsif op == 'ins'\n # nodeset\n res = nil\n db_res = db.inset db_val1, db_val2\n return db_res, self\n else\n #full evaluation\n #if @pre_conv\n # hop_val1 = hop_val1.to_f\n # hop_val2 = hop_val2.to_f\n #end\n res = nil\n db_res = db.binary(db_val1,db_val2,@op)\n\n #res = res.to_s if @post_conv\n\n return db_res, self\n end\n rescue => e\n raise #e.message+' at line '+@code_line.to_s\n end\n end", "def optimize_right\n Function.optimize_operand(operation.right)\n end", "def optimize_left\n Function.optimize_operand(operation.left)\n end", "def optimize\n operation.class.call(left, right)\n end", "def operator; end", "def result \n return @left_operand + @right_operand\n end", "def ALU1BIT(a,b,cin,binv,op1,op2) \n\tb = MUX2X1(b,binv)\n\tsUM_RESULT = ADDER(a,b,cin)\n\t#Send out an array pair of result, cout\n\treturn MUX4X1(AND(a,b),OR(a,b),sUM_RESULT[0],0,op1,op2), sUM_RESULT[1]\nend", "def add_binary a, b\n return_arr = con_to_binary(a + b)\n return_arr.shift if return_arr[0] == \"0\"\n return_arr.join\nend", "def ADDER(a,b,cin)\n\treturn XOR(XOR(a,b),cin) , OR(AND(a,b),AND(cin,XOR(a,b)))\nend", "def predicate\n operand.predicate.and(super).optimize\n end", "def execWithOperator(env)\n operatorToken = Ruby::Token.new(self.operator.token[/(.*)=/, 1])\n binaryExpression = Ruby::Binary.new(operatorToken, self.left, self.right)\n #return the partial evaluation result of the newly created binary expression.\n binaryExpression.pe(env)\n end", "def apply_boolean_nodes(input_array)\n last_index = input_array.size - 1\n return input_array.first if last_index < 1\n result = nil\n i = 0\n while i < last_index\n left = result || input_array[0]\n raise \"Invalid boolean syntax: #{params[:where]}\" unless left.is_a?(Arel::Nodes::Node)\n i += 1\n bool = input_array[i]\n raise \"Invalid boolean syntax: #{params[:where]}\" unless @boolean_operators.include?(bool)\n i += 1\n right = input_array[i]\n raise \"Invalid boolean syntax: #{params[:where]}\" unless right.is_a?(Arel::Nodes::Node)\n result = case input_array[1]\n when 'and'\n Arel::Nodes::And.new(input_array[0], input_array[2])\n when 'or'\n # noinspection RubyArgCount\n Arel::Nodes::Or.new(input_array[0], input_array[2])\n end\n end\n result\n end", "def optimize\n operation.class.new(operand)\n end", "def ALU1BIT_OF (a,b,cin,binv,op1,op2)\n\tb = MUX2X1(b,binv)\n\tsUM_RESULT = ADDER(a,b,cin)\n\tputs sUM_RESULT[0]\n\tovf = OF_CHECKING(a,b,sUM_RESULT[0])\n\t#Send out an array triple of result, cout, overflow\n\treturn MUX4X1(AND(a,b),OR(a,b),sUM_RESULT[0],0,op1,op2), sUM_RESULT[1], ovf\nend", "def bit_or\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 51 )\n return_value = BitOrReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n char_literal235 = nil\n bit_xor234 = nil\n bit_xor236 = nil\n\n tree_for_char_literal235 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 589:5: bit_xor ( '|' bit_xor )*\n @state.following.push( TOKENS_FOLLOWING_bit_xor_IN_bit_or_3894 )\n bit_xor234 = bit_xor\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, bit_xor234.tree )\n end\n # at line 589:13: ( '|' bit_xor )*\n while true # decision 54\n alt_54 = 2\n alt_54 = @dfa54.predict( @input )\n case alt_54\n when 1\n # at line 589:15: '|' bit_xor\n char_literal235 = match( PIPE, TOKENS_FOLLOWING_PIPE_IN_bit_or_3898 )\n if @state.backtracking == 0\n\n tree_for_char_literal235 = @adaptor.create_with_payload( char_literal235 )\n root_0 = @adaptor.become_root( tree_for_char_literal235, root_0 )\n\n end\n @state.following.push( TOKENS_FOLLOWING_bit_xor_IN_bit_or_3902 )\n bit_xor236 = bit_xor\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, bit_xor236.tree )\n end\n\n else\n break # out of loop for decision 54\n end\n end # loop for decision 54\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 51 )\n\n end\n \n return return_value\n end", "def addition\n expr = multiplication\n\n while match?(:minus, :plus)\n operator = previous\n right = multiplication\n expr = Ringo::Binary.new(expr, operator, right)\n end\n\n return expr\n end", "def optimize(**options)\n if operand(0).is_a?(Variable) && operand(0).bound? && operand(0).eql?(operand(1))\n RDF::Literal::TRUE\n else\n super # @see Operator#optimize!\n end\n end", "def optimize\n operation.class.call(operand)\n end", "def relational\r\n node = add()\r\n\r\n loop do\r\n if consume(\"<\")\r\n node = new_binary(ND_LT, node, add())\r\n elsif consume(\"<=\")\r\n node = new_binary(ND_LE, node, add())\r\n elsif consume(\">\")\r\n node = new_binary(ND_LT, add(), node)\r\n elsif consume(\">=\")\r\n node = new_binary(ND_LE ,add(), node)\r\n else\r\n return node\r\n end\r\n end\r\nend", "def Or(node)\n compile node.left\n output :dup\n end_label = uniqid\n output :jit, end_label\n output :pop\n compile node.right\n output :\".label\", end_label\n end", "def operator_method( op_sym )\n compiler = compiler_for(:Integer, op_sym ,{other: :Integer })\n builder = compiler.builder(compiler.source)\n integer_tmp = builder.allocate_int\n builder.build do\n integer! << message[:receiver]\n integer.reduce_int\n integer_reg! << message[:arguments]\n integer_reg << integer_reg[Parfait::NamedList.type_length + 0] #\"other\" is at index 0\n integer_reg.reduce_int\n integer.op op_sym , integer_reg\n integer_tmp[Parfait::Integer.integer_index] << integer\n message[:return_value] << integer_tmp\n end\n compiler.add_mom( Mom::ReturnSequence.new)\n return compiler\n end", "def parse_binary_expression\n left = parse_unary_expression\n return left unless match(BINARY_OPERATOR)\n\n token = lex\n right = parse_unary_expression\n\n token.precedence = binary_precedence(token)\n stack = [left, token, right]\n\n while (precedence = binary_precedence(lookahead)) > 0\n while (stack.size > 2) && (precedence <= stack[-2].precedence)\n right = stack.pop\n operator = stack.pop.value\n left = stack.pop\n stack << node(:binary_expression, operator: operator, left: left, right: right)\n end\n\n token = lex\n token.precedence = precedence\n\n stack << token\n stack << parse_unary_expression\n end\n\n i = stack.size - 1\n expr = stack[i]\n\n while i > 1\n expr = node(:binary_expression, operator: stack[i - 1].value, left: stack[i - 2], right: expr)\n i -= 2\n end\n\n expr\n end", "def binary_operator?\n Mutant::BINARY_METHOD_OPERATORS.include?(node.name)\n end", "def optimize\n operand\n end", "def arithmeticBinary(op)\n str = getTopTwoFromStack + \"M=M\"+op+\"D\"+\"\\n\"\n return str+\"\\n\"\nend", "def visit_axiom_relation_operation_binary(binary)\n generator = self.class.visit(binary)\n @name = generator.name\n @from = aliased_subquery(generator)\n generator\n end", "def to_c\n cop = { 'AND' => '&&', 'OR' => '||', 'XOR' => '^', 'SHL' => '<<', 'SHR' => '>>', 'SAR' => '>>' }\n if op == 'SHR'\n \"((unsigned)(#{lhs.to_c}) #{cop[op]} #{rhs.to_c})\"\n else\n \"(#{lhs.to_c} #{cop[op]} #{rhs.to_c})\"\n end\n end", "def __cmp__(op, other)\n Sequel::SQL::BooleanExpression.new(op, self, binary_operation_arg(other))\n end", "def MUX4X1(x,y,a,b,op1,op0)\n\td = DECODER2(op1,op0)\n\tOR(OR(AND(x,d[0]),AND(y,d[1])),OR(AND(a,d[2]),AND(b,d[3])))\nend", "def add_binary(a,b)\n return nil if( a.nil? && b.nil?)\n return a if( b.nil? || b.empty?)\n return b if( a.nil? || a.empty?)\n a_n = a.size\n b_n = b.size\n i = 0\n carry = 0\n result = ''\n while(i < a_n || i < b_n)\n if i >= a_n\n a_i = 0\n b_i = b[b_n - i -1].to_i\n elsif i >= b_n\n b_i = 0\n a_i = a[a_n - i - 1].to_i\n else\n b_i = b[b_n - i -1].to_i\n a_i = a[a_n - i - 1].to_i\n end\n add = a_i + b_i + carry\n result.prepend(add == 0 ? '0' : '1')\n carry = add < 2 ? 0 : 1\n i = i + 1\n end\n result.prepend('1') if carry == 1\n return result\nend", "def optimize\n operand\n end", "def ADD(cond,d,a,b) opcode(\"ADD\",cond, [d,a,b]) end", "def optimize\n wrap_operand\n end", "def to_sparql(**options)\n \"(!\" + operands.first.to_sparql(**options) + \")\"\n end", "def add_binary(a, b)\n (a + b).to_s(2)\nend", "def add_binary(a,b)\n sum = (a+b).to_s(2)\nend", "def simplify\n super\n return CAS.invert(@y) if @x == CAS::Zero\n return @x if @y == CAS::Zero\n return CAS::Zero if @x == @y\n return CAS.const(self.call({})) if (@x.is_a? CAS::Constant and @y.is_a? CAS::Constant)\n return @x + @y.x if @y.is_a? CAS::Invert\n return -(@x.x + @y) if @x.is_a? CAS::Invert\n return self\n end", "def bit_xor\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 52 )\n return_value = BitXorReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n char_literal238 = nil\n bit_and237 = nil\n bit_and239 = nil\n\n tree_for_char_literal238 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 593:5: bit_and ( '^' bit_and )*\n @state.following.push( TOKENS_FOLLOWING_bit_and_IN_bit_xor_3918 )\n bit_and237 = bit_and\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, bit_and237.tree )\n end\n # at line 593:13: ( '^' bit_and )*\n while true # decision 55\n alt_55 = 2\n look_55_0 = @input.peek( 1 )\n\n if ( look_55_0 == HAT )\n alt_55 = 1\n\n end\n case alt_55\n when 1\n # at line 593:16: '^' bit_and\n char_literal238 = match( HAT, TOKENS_FOLLOWING_HAT_IN_bit_xor_3923 )\n if @state.backtracking == 0\n\n tree_for_char_literal238 = @adaptor.create_with_payload( char_literal238 )\n root_0 = @adaptor.become_root( tree_for_char_literal238, root_0 )\n\n end\n @state.following.push( TOKENS_FOLLOWING_bit_and_IN_bit_xor_3927 )\n bit_and239 = bit_and\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, bit_and239.tree )\n end\n\n else\n break # out of loop for decision 55\n end\n end # loop for decision 55\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 52 )\n\n end\n \n return return_value\n end", "def bitwise_or(a, b)\n\tresult = ''\n\ta.each_char.with_index do |val, index|\n\t\tif val == '1' || b[index] == '1'\n\t\t\tresult.concat '1'\n\t\telse\n\t\t\tresult.concat '0'\n\t\tend\n\tend\n\treturn result\nend", "def opcode\n if @extended\n return 0x00 | (@op << 5) | (a_param.mode_bits << 10)\n else\n return @op | (a_param.mode_bits << 10) | (b_param.mode_bits << 5)\n end\n end", "def to_b\n lft = self.left.to_b if self.left.is_a? Pow or !(self.left.is_a? BinaryOp)\n lft = \"(#{self.left.to_b})\" unless self.left.is_a? Pow or !(self.left.is_a? BinaryOp)\n rht = self.right.to_b if self.right.is_a? Pow or !(self.right.is_a? BinaryOp)\n rht = \"(#{self.right.to_b})\" unless self.right.is_a? Pow or !(self.right.is_a? BinaryOp)\n return \"#{lft}*#{rht}\"\n end", "def logical_op(type, lhs, op_t, rhs)\n n(type, [ lhs, rhs ],\n binary_op_map(lhs, op_t, rhs))\n end", "def binaries\n value = 1 # initialize\n lambda { value += value } # the lambda is returned to the caller\nend", "def optimize\n case @type\n when :booleanop\n @children.each do |c|\n if c.type == :booleanop && c.value == @value\n c.children.each { |cc| @children << cc }\n @children.delete c\n end\n end\n end\n @children.each(&:optimize)\n self\n end", "def logical_and\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 50 )\n return_value = LogicalAndReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n string_literal232 = nil\n bit_or231 = nil\n bit_or233 = nil\n\n tree_for_string_literal232 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 585:5: bit_or ( '&&' bit_or )*\n @state.following.push( TOKENS_FOLLOWING_bit_or_IN_logical_and_3869 )\n bit_or231 = bit_or\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, bit_or231.tree )\n end\n # at line 585:13: ( '&&' bit_or )*\n while true # decision 53\n alt_53 = 2\n look_53_0 = @input.peek( 1 )\n\n if ( look_53_0 == AND )\n alt_53 = 1\n\n end\n case alt_53\n when 1\n # at line 585:15: '&&' bit_or\n string_literal232 = match( AND, TOKENS_FOLLOWING_AND_IN_logical_and_3874 )\n if @state.backtracking == 0\n\n tree_for_string_literal232 = @adaptor.create_with_payload( string_literal232 )\n root_0 = @adaptor.become_root( tree_for_string_literal232, root_0 )\n\n end\n @state.following.push( TOKENS_FOLLOWING_bit_or_IN_logical_and_3878 )\n bit_or233 = bit_or\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, bit_or233.tree )\n end\n\n else\n break # out of loop for decision 53\n end\n end # loop for decision 53\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 50 )\n\n end\n \n return return_value\n end", "def logical_calc(arr, op)\n op=='AND' ? arr.reduce(:&) : op=='OR' ? arr.reduce(:|) : arr.reduce(:^)\nend", "def pipeline_operator!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 11 )\n\n type = PIPELINE_OPERATOR\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 55:3: ( '&&' | '||' | '|' | '&' )\n alt_17 = 4\n look_17_0 = @input.peek( 1 )\n\n if ( look_17_0 == 0x26 )\n look_17_1 = @input.peek( 2 )\n\n if ( look_17_1 == 0x26 )\n alt_17 = 1\n else\n alt_17 = 4\n end\n elsif ( look_17_0 == 0x7c )\n look_17_2 = @input.peek( 2 )\n\n if ( look_17_2 == 0x7c )\n alt_17 = 2\n else\n alt_17 = 3\n end\n else\n raise NoViableAlternative( \"\", 17, 0 )\n end\n case alt_17\n when 1\n # at line 55:5: '&&'\n match( \"&&\" )\n\n when 2\n # at line 55:12: '||'\n match( \"||\" )\n\n when 3\n # at line 55:19: '|'\n match( 0x7c )\n\n when 4\n # at line 55:25: '&'\n match( 0x26 )\n # --> action\n @cmd_start = true \n # <-- action\n\n end\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__, 11 )\n\n end", "def read_operator_node(node)\n first_node = node.children.first\n solution = first_node.is_a?(GivenThatOperatorNode) ? read_operator_node(first_node) : first_node\n\n push_connector(node)\n #group =\n node.children[1..-1].inject(solution) do |sum, i|\n i = read_operator_node(i) if i.is_a?(GivenThatOperatorNode)\n if MULTIPLICATIVE_OPERATORS.include?(node.value)\n sum = sum | i\n else # Assume it's in ADDITIVE_OPERATORS\n sum = sum & i\n end\n end\n end", "def + b\n 1.plus self.plus(b)\n end", "def MUX2X1(x,y) XOR(x,y); end", "def bit_and\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 53 )\n return_value = BitAndReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n char_literal241 = nil\n equality240 = nil\n equality242 = nil\n\n tree_for_char_literal241 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 597:5: equality ( '&' equality )*\n @state.following.push( TOKENS_FOLLOWING_equality_IN_bit_and_3943 )\n equality240 = equality\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, equality240.tree )\n end\n # at line 597:14: ( '&' equality )*\n while true # decision 56\n alt_56 = 2\n look_56_0 = @input.peek( 1 )\n\n if ( look_56_0 == AMP )\n alt_56 = 1\n\n end\n case alt_56\n when 1\n # at line 597:17: '&' equality\n char_literal241 = match( AMP, TOKENS_FOLLOWING_AMP_IN_bit_and_3948 )\n if @state.backtracking == 0\n\n tree_for_char_literal241 = @adaptor.create_with_payload( char_literal241 )\n root_0 = @adaptor.become_root( tree_for_char_literal241, root_0 )\n\n end\n @state.following.push( TOKENS_FOLLOWING_equality_IN_bit_and_3952 )\n equality242 = equality\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, equality242.tree )\n end\n\n else\n break # out of loop for decision 56\n end\n end # loop for decision 56\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 53 )\n\n end\n \n return return_value\n end", "def add_binary(a,b)\n string = (a + b).to_s(2)\nend", "def sh4LowerSimpleBranchOps(list)\n newList = []\n list.each {\n | node |\n if node.is_a? Instruction\n annotation = node.annotation\n case node.opcode\n when /^b(addi|subi|ori|addp)/\n op = $1\n bc = $~.post_match\n\n case op\n when \"addi\", \"addp\"\n op = \"addi\"\n when \"subi\", \"subp\"\n op = \"subi\"\n when \"ori\", \"orp\"\n op = \"ori\"\n end\n\n if bc == \"s\"\n raise \"Invalid operands number (#{node.operands.size})\" unless node.operands.size == 3\n if node.operands[1].is_a? RegisterID or node.operands[1].is_a? SpecialRegister\n newList << Instruction.new(node.codeOrigin, op, node.operands[0..1])\n newList << Instruction.new(node.codeOrigin, \"bs\", node.operands[1..2])\n else\n tmpVal = Tmp.new(node.codeOrigin, :gpr)\n tmpPtr = Tmp.new(node.codeOrigin, :gpr)\n addr = Address.new(node.codeOrigin, tmpPtr, Immediate.new(node.codeOrigin, 0))\n newList << Instruction.new(node.codeOrigin, \"leap\", [node.operands[1], tmpPtr])\n newList << Instruction.new(node.codeOrigin, \"loadi\", [addr, tmpVal])\n newList << Instruction.new(node.codeOrigin, op, [node.operands[0], tmpVal])\n newList << Instruction.new(node.codeOrigin, \"storei\", [tmpVal, addr])\n newList << Instruction.new(node.codeOrigin, \"bs\", [tmpVal, node.operands[2]])\n end\n elsif bc == \"nz\"\n raise \"Invalid operands number (#{node.operands.size})\" unless node.operands.size == 3\n newList << Instruction.new(node.codeOrigin, op, node.operands[0..1])\n newList << Instruction.new(node.codeOrigin, \"btinz\", node.operands[1..2])\n else\n newList << node\n end\n when \"bmulio\", \"bmulpo\"\n raise \"Invalid operands number (#{node.operands.size})\" unless node.operands.size == 3\n tmp1 = Tmp.new(node.codeOrigin, :gpr)\n tmp2 = Tmp.new(node.codeOrigin, :gpr)\n newList << Instruction.new(node.codeOrigin, node.opcode, [tmp1, tmp2].concat(node.operands))\n else\n newList << node\n end\n else\n newList << node\n end\n }\n newList\nend", "def optimize\n if @raw_code.nil? || @raw_code.length == 0\n abort(\"Bad code.\")\n end\n \n #bf commands that can be optimized\n opt_comms = ['<', '>', '+', '-']\n \n #special command for the bf nil operator. '[-]' will always zero out the value\n #at the pointer, so shortcut it\n @raw_code = @raw_code.gsub(/\\[-\\]/, '=')\n \n #probably a more ruby-esque way to do this... find all optimizable commands\n #and find how many times they appear in order (sequential commands)\n i = 0\n while i < @raw_code.length do\n c, t = @raw_code[i, 1], @raw_code[i + 1, 1]\n j = 0\n \n if !(opt_comms.index(c).nil?) && t == c\n while t == c do\n j += 1\n i += 1\n t = @raw_code[i, 1]\n end\n i -= 1\n else\n j += 1\n end\n \n @opt_code.push(c).push(j)\n \n i += 1\n end\n \n stop = false\n i, j, l = 0, 0, 0\n \n #optimize bf loops, find the corresponding ']' to '[', so we can immediately\n #jump to that point instead of constantly having to look it up during run-time\n while i < @opt_code.length do\n l = i\n case @opt_code[i]\n when '['\n stop, j = false, 0\n while !(stop) do\n i += 2\n case @opt_code[i]\n when ']'\n stop = (j == 0)\n j -= 1\n when '['\n j + 1\n end\n end\n \n @opt_code[l + 1], @opt_code[i + 1] = i, l\n end\n \n i += 1\n end\n \n #puts @opt_code\n end", "def binary_operator?\n arguments.one? && BINARY_METHOD_OPERATORS.include?(selector)\n end", "def binary_operator?\n arguments.one? && BINARY_METHOD_OPERATORS.include?(selector)\n end", "def sum(x, op, y)\n x.send(op, y)\nend", "def complex_expression_sql(op, args)\n case op\n when :'||'\n super(:+, args)\n else\n super(op, args)\n end\n end", "def add_binary(a, b)\n n = a.size \n m = b.size \n return add_binary(b,a) if n<m\n l = [n,m].max \n j = m-1\n i = l-1\n carry = 0\n sb = \"\"\n i.downto(0) do |i|\n carry +=1 if a[i] == \"1\"\n carry +=1 if b[j] == \"1\" && j>-1\n if (carry%2) == 1\n sb += \"1\"\n else\n sb += \"0\"\n end\n\n carry = carry/2 \n j-=1 \n end\n sb += \"1\" if carry == 1 \n return sb.reverse!\nend", "def add_binary(a,b)\n #your code here\n sum = a + b\n return sum.to_s(2)\nend", "def initialize(*)\n super\n @predicate = Function.optimize_operand(operation.predicate)\n end", "def _reduce_58(val, _values, result)\n lhs, _, rhs = val\n result = logical_op :and, lhs, rhs\n\n result\nend", "def execute_XOR(destination, source)\n\t\t# all flags are affected except AF is undefined\n\t\tdestination.value ^= source.value\n\t\tset_logical_flags_from destination.value, destination.size\n\tend", "def src_reg_to_alu_op(reg)\n rnum = reg[1].to_i\n return rnum.even? ? $alu_ops['alu_logic_A'] : $alu_ops['alu_logic_B']\nend", "def comparison\n expr = addition\n\n while match?(:greater, :greater_equal, :less, :less_equal)\n operator = previous\n right = addition\n expr = Ringo::Binary.new(expr, operator, right)\n end\n\n return expr\n end", "def optimize\n wrap_operand(operand)\n end", "def optimize\n wrap_operand(operand)\n end", "def ADD(d,x,y) opcode \"add\", [d,x,y] end", "def optimize(**options)\n operands.last.optimize(**options)\n end", "def materialize(dest)\n # Resolve lhs and rhs operand, using 'dest' to store intermediate result so\n # a maximum of one temporary Bitmap has to be created.\n # Then apply the bitwise operator storing the final result in 'dest'.\n\n intermediate = dest\n\n lhs, *other_args = @args\n temp_intermediates = []\n\n # Side-effects: if a temp intermediate bitmap is created, it's added to 'temp_intermediates' \n # to be deleted in the \"ensure\" block. Marked with \"<- SE\".\n\n lhs_operand, intermediate = resolve_operand(lhs, intermediate, temp_intermediates) # <- SE\n other_operands, *_ = other_args.inject([[], intermediate]) do |(operands, intermediate), arg|\n operand, intermediate = resolve_operand(arg, intermediate, temp_intermediates) # <- SE\n [operands << operand, intermediate]\n end\n\n lhs_operand.bitop(@op, *other_operands, dest)\n ensure\n temp_intermediates.each(&:delete!)\n end", "def basic_op(operator, value1, value2)\nvalue1.send(operator,value2)\nend", "def _reduce_48(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend", "def _reduce_48(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend", "def ops(node)\n if node.left.nil? || node.right.nil?\n return 1 if /[\\+\\-\\*\\%\\/\\.]/.match(node.value)\n else\n return (ops(node.left) + ops(node.right))\n end\nend", "def star(reg)\n return opt(plus(reg))\nend", "def to_sparql(**options)\n operands.first.to_sparql(reduced: true, **options)\n end", "def AND(x,y); \tif x==1 && y==1 \tthen 1 else 0 end; end", "def add\r\n node = mul()\r\n\r\n loop do\r\n if consume(\"+\")\r\n node = new_binary(ND_ADD, node, mul())\r\n elsif consume(\"-\")\r\n node = new_binary(ND_SUB, node, mul())\r\n else\r\n return node\r\n end\r\n end\r\nend", "def visit_Squeel_Nodes_Operation(o, parent)\n args = o.args.map do |arg|\n case arg\n when Nodes::Function, Nodes::KeyPath, Nodes::As, Nodes::Literal\n visit(arg, parent)\n when Symbol, Nodes::Stub\n Arel.sql(arel_visitor.accept contextualize(parent)[arg.to_sym])\n else\n quote arg\n end\n end\n\n op = case o.operator\n when :+\n Arel::Nodes::Addition.new(args[0], args[1])\n when :-\n Arel::Nodes::Subtraction.new(args[0], args[1])\n when :*\n Arel::Nodes::Multiplication.new(args[0], args[1])\n when :/\n Arel::Nodes::Division.new(args[0], args[1])\n else\n Arel.sql(\"#{arel_visitor.accept(args[0])} #{o.operator} #{arel_visitor.accept(args[1])}\")\n end\n o.alias ? op.as(o.alias) : op\n end", "def compile_to_ruby\n operator_ruby_string + \"(\" + @expression.compile_to_ruby + \")\"\n end", "def execute_AND(destination, source)\n\t\t# all flags are affected except AF is undefined\n\t\tdestination.value &= source.value\n\t\tset_logical_flags_from destination.value, destination.size\n\tend", "def opcode(op,cond,args) \"#{op}#{cond} #{args.join ','}\" end", "def output\n return nil if input_wires.any?\n\n case gate\n when \"AND\"\n values[0] & values[1]\n when \"OR\"\n values[0] | values[1]\n when \"NOT\"\n ~values[0]\n when \"LSHIFT\"\n values[0] << values[1]\n when \"RSHIFT\"\n values[0] >> values[1]\n else\n values[0]\n end\n end", "def +(b)\n b = b.symdescfy\n case b\n when Infinity\n b\n when Number\n __sum_number b\n when BinaryOp\n b + self\n else\n super\n end\n end", "def initialize(*)\n super\n @operand = optimize_operand\n end", "def bitop(operation, destkey, *keys); end", "def bitop(operation, destkey, *keys); end", "def boolean_to_binary(arr)\r\n\r\n binary = \"\"\r\n\r\n # iteration each method\r\n arr.each {|bool|\r\n if bool == true\r\n\r\n # bool true to binary 1\r\n binary << \"1\"\r\n else\r\n\r\n # bool false to binary 0\r\n binary << \"0\"\r\n end }\r\n\r\n binary\r\nend", "def to_citrus # :nodoc:\n rule.to_embedded_s + operator\n end", "def to_sxp_bin\n @operands.map(&:to_sxp_bin)\n end", "def basic_op(operator, value1, value2)\n value1.send(operator, value2)\nend", "def to_sxp_bin\n [self.class.const_get(:NAME)] +\n (id ? [[:id, id]] : []) +\n (operands || []).map(&:to_sxp_bin)\n end", "def basic_op(operator, value1, value2)\n value1.send(operator.value2)\nend", "def optimize\n left.ne(right.first)\n end", "def test_constraints\n a=Wire.new('a')\n b=Wire.new('b')\n c=Wire.new('c')\n # If you want to see when c changes value, set the log_level of c to\n # Logger::DEBUG\n\n c.log_level=Logger::DEBUG\n puts \"Testing the AND gate\"\n andGate=AndGate.new a,b,c\n a.value=true\n gets\n b.value=true\n gets\n a.value=false\n gets\n\n a=Wire.new('a')\n b=Wire.new('b')\n c=Wire.new('c')\n puts \"Testing the OR gate\"\n orGate=OrGate.new a,b,c\n a.value=false\n gets \n b.value=false\n gets\nend" ]
[ "0.6564456", "0.61022294", "0.595796", "0.5902246", "0.5886567", "0.58098364", "0.5785752", "0.5736045", "0.5723668", "0.5708264", "0.57042634", "0.567623", "0.56520283", "0.5628926", "0.56267744", "0.5620675", "0.560004", "0.5570927", "0.55556345", "0.55517775", "0.55156803", "0.5515267", "0.54895353", "0.54790586", "0.5472372", "0.54496735", "0.5443344", "0.54394865", "0.54048705", "0.5389653", "0.5372808", "0.53543866", "0.5350637", "0.53492075", "0.5341263", "0.5332946", "0.53307134", "0.5318441", "0.5314195", "0.53131723", "0.53031373", "0.52944946", "0.528907", "0.528861", "0.52845216", "0.52830124", "0.52317244", "0.5228757", "0.52261704", "0.52149457", "0.519044", "0.51821613", "0.51810336", "0.5170275", "0.51699495", "0.5164418", "0.5158486", "0.5156337", "0.5155931", "0.51479125", "0.51479125", "0.514646", "0.5145236", "0.51353824", "0.51300144", "0.512241", "0.5120409", "0.51125276", "0.5110891", "0.51092523", "0.5107676", "0.5107676", "0.5102154", "0.5098725", "0.50847757", "0.50823396", "0.50798553", "0.50798553", "0.50796145", "0.5077234", "0.5076411", "0.5069289", "0.5064559", "0.5056855", "0.5053067", "0.5050654", "0.50500137", "0.5038735", "0.50372434", "0.50360954", "0.50243527", "0.50243527", "0.50234467", "0.50210464", "0.50202125", "0.50169396", "0.50159454", "0.50149745", "0.5011439", "0.50113505" ]
0.597534
2
Test if the left operand is optimizable
def left_optimizable? !left.equal?(operation.left) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def right_optimizable?\n !right.equal?(operation.right)\n end", "def optimize_left\n Function.optimize_operand(operation.left)\n end", "def optimizable?\n super || !predicate.equal?(operation.predicate)\n end", "def optimize\n left.ne(right.first)\n end", "def optimize\n left\n end", "def optimize\n left\n end", "def optimize\n left\n end", "def optimize\n left\n end", "def optimize\n left\n end", "def optimize(**options)\n if operand(0).is_a?(Variable) && operand(0).bound? && operand(0).eql?(operand(1))\n RDF::Literal::TRUE\n else\n super # @see Operator#optimize!\n end\n end", "def optimize\n operand\n end", "def optimize\n operand\n end", "def optimize_right\n Function.optimize_operand(operation.right)\n end", "def optimizable?\n super || extensions_optimizable?\n end", "def optimize\n wrap_operand\n end", "def optimize\n operation.class.call(left, right)\n end", "def optimize\n wrap_operand(operand)\n end", "def optimize\n wrap_operand(operand)\n end", "def predicate\n operand.predicate.and(super).optimize\n end", "def execute_JLE(operand) # Same as the JNG instruction\n\t\tis_less_than = (@flags.value[SIGN_FLAG] ^ @flags.value[OVERFLOW_FLAG]) == 1\n\t\tis_less_than_or_equal = is_less_than || @flags.value[ZERO_FLAG] == 1\n\t\tjump_conditionally_to_signed_displacement(operand, is_less_than_or_equal)\n\tend", "def optimize\n operation.class.call(operand)\n end", "def optimize\n operand.class.new(wrap_left, wrap_right)\n end", "def optimized?(src, dst)\n dst.size? && dst.size < src.size\n end", "def min_cost?\n false\n end", "def optimizable?(path)\n !!workers_for_image(path)\n end", "def optimizable?(path)\n !!workers_for_image(path)\n end", "def optimize\n right\n end", "def optimize\n right\n end", "def plus\n \twe_can_operate? do\n \t\t@calc_stack.pop + @calc_stack.pop\n end\n end", "def first_assignment_in?(left, right); end", "def nil_operand?\n left.nil? || right.nil?\n end", "def extensions_optimizable?\n !extensions.eql?(operation.extensions)\n end", "def left_invalid_constant?\n !right.include?(left)\n end", "def compute_on_promotion?\n @compute_on_promotion ||= calculable.respond_to?(:promotion)\n end", "def execute_JG(operand) # Same as the JNLE instruction\n\t\tsf_equals_of = (@flags.value[SIGN_FLAG] ^ @flags.value[OVERFLOW_FLAG]).zero?\n\t\tis_greater_than = sf_equals_of && @flags.value[ZERO_FLAG].zero?\n\t\tjump_conditionally_to_signed_displacement(operand, is_greater_than)\n\tend", "def optimize\n right\n end", "def optimize\n right\n end", "def left_restriction\n operand.left.restrict(partition.left)\n end", "def optimized?(src, dst)\n dst_size = dst.size?\n dst_size && dst_size < src.size\n end", "def left_of?(p1, p2)\n cross(p1, p2) > 0\n end", "def restriction_commutative?\n ! (partition_left_tautology? && partition_right_tautology?)\n end", "def evaluate_operator(left, right)\n left < right\n end", "def is_left_derivative?\n index = 1\n if @classified[index].instance_of? Parenthesis\n level = @classified[index].level\n index = index_closed_parenthesis(level)\n if @classified[index+1].instance_of?(LogicalOperator)\n if @classified[index+2].instance_of?(Proposition) || @classified[index+2].instance_of?(Constant)\n return true\n end\n end\n end\n false\n end", "def immediate?\n !dummy? and !@reloc\n end", "def left_regular?\n all? { |r| r.left_regular? }\n end", "def optimize\n operation.class.new(left, right)\n end", "def _not(memory)\n Memory::Value.bool !@left_operand.value\n end", "def optimize\n operation.class.reverse.new(right, left)\n end", "def ready_optimizing?\n state == :READY_OPTIMIZING\n end", "def execute_JL(operand) # Same as the JNGE instruction\n\t\tis_less_than = (@flags.value[SIGN_FLAG] ^ @flags.value[OVERFLOW_FLAG]) == 1\n\t\tjump_conditionally_to_signed_displacement(operand, is_less_than)\n\tend", "def evaluate_operator(left, right)\n left >= right\n end", "def optimize(**options)\n operands.last.optimize(**options)\n end", "def accesses?(rhs, lhs); end", "def first_chk(obj)\n if (self =~ obj) && (obj.is_a? Pow)\n if self.right.is_a? Pow\n myExp, objExp = self.right.right, obj.right\n myExp.top, objExp.top = true, true\n exp = myExp + objExp\n rht = Pow.new(obj.left,exp).reduce\n return Prod.new(self.left,rht).reduce\n end\n objExp = obj.right\n objExp.top = true\n objExp += Number.new 1\n rht = Pow.new(obj.left,objExp).reduce\n return Prod.new(self.left,rht).reduce\n elsif self =~ obj\n return Prod.new(self.left,Pow.new(self.right,Number.new(2))).reduce\n end\n return nil\n end", "def is_carry?(a, b, op)\n if (op == :+)\n return !((a + b) < 256);\n else\n return a < b;\n end\n end", "def optimize\n left_restriction.send(relation_method, right_restriction).restrict(partition.remainder)\n end", "def optimize\n left.left.include(merged_right_enumerables).optimize\n end", "def expr(min_prec = 5, step = 10)\n left = atomar\n\n loop do\n if !left || !infix || @optable[peek.value][0] < min_prec\n return left\n else\n op = consume\n line = op.line\n col = op.column\n prec, assoc = @optable[op.value]\n next_prec = prec || (prec + step if assoc == 'left')\n right = expr(next_prec) || syntax_error\n left = Apparat::Byte::Binary.new([op.value, left, right], line, col)\n end\n end\n end", "def evaluate_operator(left, right)\n left <= right\n end", "def strictly_regular?\n left_regular? || right_regular?\n end", "def deficient?\n divisors.reduce(:+) < self\n end", "def scalar?\n lhs == 0 and rhs == 0\n end", "def irreducible?\n all? { |qnt, exp| qnt.irreducible? }\n end", "def binary_operator?\n arguments.one? && BINARY_METHOD_OPERATORS.include?(selector)\n end", "def binary_operator?\n arguments.one? && BINARY_METHOD_OPERATORS.include?(selector)\n end", "def execute_JO(operand)\n\t\tjump_conditionally_to_signed_displacement(operand, @flags.value[OVERFLOW_FLAG] == 1) # Non-zero means set\n\tend", "def checkMulr(before, after, instruction)\n\ta = instruction[1] #reg\n\tb = instruction[2] #reg\n\tc = instruction[3] #reg\n\n\treturn after[c] == before[a] * before[b]\nend", "def cost\r\n\t\t@lr.compute_cost.class != NaN\r\n\tend", "def execute_JGE(operand) # Same as the JNL instruction\n\t\tis_greater_than = @flags.value[SIGN_FLAG] == @flags.value[OVERFLOW_FLAG]\n\t\tjump_conditionally_to_signed_displacement(operand, is_greater_than)\n\tend", "def and_op(left, right, result) #method\n left = get_dir(left)\n right = get_dir(right)\n @current_context[result] = get_value(left) && get_value(right)\n end", "def test_will_return_via_tail_call\n src =<<-EOC\ndefn g() {9}\ndefn f(x) {\n zero?(:x) && return %g\n %g + 9\n}\nEOC\n vi = mkvi src+\"\\nf(0)\\n\";ti = mkti src+\"\\nf(0)\\n\"\n assert (vi.run == 9) && (ti.run == 9), \"Expected both optimized and non_optiized to return9, but one of them did not\"\n end", "def can_overflow?\n false\n end", "def left_expr_node\n key_op_val? && @elements[0]\n end", "def lax?\n !strict?\n end", "def we_can_operate?\n \tif @calc_stack.length > 1\n \t\tself.push(yield)\n \telse\n \t\traise 'calculator is empty'\n \tend\n end", "def immediate?(arg_index)\n flags = opflags\n flag = nil\n # 10.divmod(10) => [1, 0] => position mode\n # 1.divmod(10) => [0,1] => immediate mode\n # 0.divmod(10) => [0,0] => all unspecified flags are position mode\n arg_index.times do\n flags, flag = flags.divmod(10)\n end\n\n flag == 1\n end", "def optimize!(**options)\n ops = operands.map {|o| o.optimize(**options) }.select {|o| o.respond_to?(:empty?) && !o.empty?}\n @operands = ops\n self\n end", "def optimize\n left.left.exclude(merged_right_enumerables).optimize\n end", "def evaluable?\n true\n end", "def optimize\n operation.class.new(operand)\n end", "def execute_LOOPE(operand) # Same as the LOOPZ instruction\n\t\tcondition = perform_counting_loop.zero? && @flags[ZERO_FLAG].zero?\n\t\tjump_conditionally_to_signed_displacement(operand, condition)\n\tend", "def required_field?\n left&.source_required?\nend", "def not_very_effective?\n @effectiveness > 0 && @effectiveness < 1\n end", "def has_next_state?\n return @operation != :nop\n end", "def is_auxillary_carry?(a, b, op)\n a <<= 4;\n a >>= 4;\n b <<= 4;\n b >>= 4;\n\n if (op == :+)\n return !((a + b) < 16)\n else\n return !((a - b) <= a)\n end\n end", "def refute_operator(o1, op, o2 = T.unsafe(nil), msg = T.unsafe(nil)); end", "def promotion_move?(_x_des, _y_des)\n false\n end", "def calculable_sibling?(edge, sibling)\n sibling == edge || sibling.demand\n end", "def optimize\n operand.drop(offset)\n end", "def test_iff(stmt)\n l = eval_side(stmt.left)\n r = eval_side(stmt.right)\n if r && l.nil?\n set_truth(stmt.left.left, r) if stmt.left.type == :terminal\n elsif l && r.nil?\n set_truth(stmt.right.left, l) if stmt.right.type == :terminal\n end\n end", "def needs_promotion?\n !!@promotion_coords\n end", "def includes_op(node, op)\n return true if node.value == op\n if !node.left.nil? && !node.right.nil?\n includes_op(node.left, op) || includes_op(node.right, op)\n else\n return false\n end\nend", "def _reduce_54(val, _values, result)\n lhs, _, rhs = val\n result = logical_op :and, lhs, rhs\n\n result\nend", "def execute_JNA(operand) # Same as the JBE instruction\n\t\tis_above = @flags.value[ZERO_FLAG].zero? && @flags.value[CARRY_FLAG].zero?\n\t\tjump_conditionally_to_signed_displacement(operand, !is_above)\n\tend", "def wrap_left\n wrap_operand(operand.left)\n end", "def is_right_derivative?\n index = 1\n if @classified[index].instance_of?(Proposition) || @classified[index].instance_of?(Constant)\n if @classified[index+1].instance_of? (LogicalOperator)\n if @classified[index+2].instance_of?(Parenthesis)\n return true\n end\n end\n end\n false\n end", "def left_invalid_constant?\n type = right.type\n !type.infer(left.class).equal?(type)\n end", "def higher_or_equal_precedence?(op1,op2)\n return true if LOW_PRIORITY_OPERATORS.include?(op2)\n return true if HIGH_PRIORITY_OPERATORS.include?(op1)\n return false\n end", "def is_addop(c)\n ADDOPS.include?(c)\nend", "def is_addop(c)\n ADDOPS.include?(c)\nend" ]
[ "0.7488885", "0.7419305", "0.7044481", "0.6612691", "0.65930456", "0.65930456", "0.65930456", "0.65369546", "0.65369546", "0.6535521", "0.63592416", "0.63511366", "0.6291252", "0.61894643", "0.6186002", "0.5990191", "0.5983856", "0.5983856", "0.59837115", "0.5745654", "0.5721095", "0.571206", "0.56610686", "0.56332123", "0.5628043", "0.5628043", "0.5624586", "0.5624586", "0.5622534", "0.5610717", "0.5609586", "0.5588271", "0.5586842", "0.5585152", "0.5584283", "0.5562077", "0.5562077", "0.5542305", "0.55015594", "0.5494715", "0.549034", "0.54877543", "0.5473048", "0.5470354", "0.54682565", "0.5465841", "0.5449863", "0.5439361", "0.54048765", "0.5402554", "0.53942335", "0.5392898", "0.535947", "0.5312466", "0.53098524", "0.5305243", "0.53042555", "0.52997965", "0.5296841", "0.527333", "0.5270142", "0.52654725", "0.5257959", "0.5234912", "0.5234912", "0.52342504", "0.5227291", "0.521659", "0.5202141", "0.52010596", "0.51790327", "0.51688457", "0.51686877", "0.51542735", "0.5126046", "0.51251143", "0.51132506", "0.509947", "0.50934887", "0.5089127", "0.50870913", "0.508106", "0.5077377", "0.5073547", "0.50643885", "0.506126", "0.5045134", "0.50269306", "0.50261074", "0.502568", "0.5024206", "0.50229365", "0.50179464", "0.5010919", "0.5009683", "0.5009656", "0.5004683", "0.50035584", "0.49989626", "0.49989626" ]
0.81559587
0
Test if the right operand is optimizable
def right_optimizable? !right.equal?(operation.right) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def optimize_right\n Function.optimize_operand(operation.right)\n end", "def left_optimizable?\n !left.equal?(operation.left)\n end", "def optimizable?\n super || !predicate.equal?(operation.predicate)\n end", "def optimize(**options)\n if operand(0).is_a?(Variable) && operand(0).bound? && operand(0).eql?(operand(1))\n RDF::Literal::TRUE\n else\n super # @see Operator#optimize!\n end\n end", "def optimize\n operand\n end", "def optimize\n operand\n end", "def optimize\n left.ne(right.first)\n end", "def optimize\n right\n end", "def optimize\n right\n end", "def optimize\n right\n end", "def optimize\n right\n end", "def optimize_left\n Function.optimize_operand(operation.left)\n end", "def optimize\n wrap_operand\n end", "def optimizable?\n super || extensions_optimizable?\n end", "def predicate\n operand.predicate.and(super).optimize\n end", "def optimize\n wrap_operand(operand)\n end", "def optimize\n wrap_operand(operand)\n end", "def is_right_derivative?\n index = 1\n if @classified[index].instance_of?(Proposition) || @classified[index].instance_of?(Constant)\n if @classified[index+1].instance_of? (LogicalOperator)\n if @classified[index+2].instance_of?(Parenthesis)\n return true\n end\n end\n end\n false\n end", "def optimize\n operation.class.call(left, right)\n end", "def optimize\n operation.class.reverse.new(right, left)\n end", "def optimize\n operand.class.new(wrap_left, wrap_right)\n end", "def optimize(**options)\n operands.last.optimize(**options)\n end", "def immediate?\n !dummy? and !@reloc\n end", "def right_of?(p1, p2)\n cross(p1, p2) < 0\n end", "def optimize\n operation.class.call(operand)\n end", "def right_regular?\n all? { |r| r.right_regular? }\n end", "def optimizable?(path)\n !!workers_for_image(path)\n end", "def optimizable?(path)\n !!workers_for_image(path)\n end", "def optimize\n left\n end", "def optimize\n left\n end", "def optimize\n left\n end", "def nil_operand?\n left.nil? || right.nil?\n end", "def test_will_return_via_tail_call\n src =<<-EOC\ndefn g() {9}\ndefn f(x) {\n zero?(:x) && return %g\n %g + 9\n}\nEOC\n vi = mkvi src+\"\\nf(0)\\n\";ti = mkti src+\"\\nf(0)\\n\"\n assert (vi.run == 9) && (ti.run == 9), \"Expected both optimized and non_optiized to return9, but one of them did not\"\n end", "def right_invalid_constant?\n !left.include?(right)\n end", "def right_restriction\n operand.right.restrict(partition.right)\n end", "def strictly_regular?\n left_regular? || right_regular?\n end", "def binary_operator?\n arguments.one? && BINARY_METHOD_OPERATORS.include?(selector)\n end", "def binary_operator?\n arguments.one? && BINARY_METHOD_OPERATORS.include?(selector)\n end", "def checkMulr(before, after, instruction)\n\ta = instruction[1] #reg\n\tb = instruction[2] #reg\n\tc = instruction[3] #reg\n\n\treturn after[c] == before[a] * before[b]\nend", "def evaluate_operator(left, right)\n left <= right\n end", "def evaluate_operator(left, right)\n left >= right\n end", "def irreducible?\n all? { |qnt, exp| qnt.irreducible? }\n end", "def optimized?(src, dst)\n dst.size? && dst.size < src.size\n end", "def optimize\n left\n end", "def optimize\n left\n end", "def extensions_optimizable?\n !extensions.eql?(operation.extensions)\n end", "def optimize\n operation.class.new(left, right)\n end", "def accesses?(rhs, lhs); end", "def higher_or_equal_precedence?(op1,op2)\n return true if LOW_PRIORITY_OPERATORS.include?(op2)\n return true if HIGH_PRIORITY_OPERATORS.include?(op1)\n return false\n end", "def is_carry?(a, b, op)\n if (op == :+)\n return !((a + b) < 256);\n else\n return a < b;\n end\n end", "def test_or_implies(stmt)\n l = eval_side(stmt.left)\n r = eval_side(stmt.right)\n if !l.nil? && !l\n set_truth(stmt.right.left) if stmt.right.type == :terminal\n elsif !r.nil? && !r\n set_truth(stmt.left.left) if stmt.left.type == :terminal\n end\n end", "def is_auxillary_carry?(a, b, op)\n a <<= 4;\n a >>= 4;\n b <<= 4;\n b >>= 4;\n\n if (op == :+)\n return !((a + b) < 16)\n else\n return !((a - b) <= a)\n end\n end", "def ready_optimizing?\n state == :READY_OPTIMIZING\n end", "def restriction_commutative?\n ! (partition_left_tautology? && partition_right_tautology?)\n end", "def not_safe?(speed)\n speed < 40 || speed > 60 ? true : false\nend", "def plus\n \twe_can_operate? do\n \t\t@calc_stack.pop + @calc_stack.pop\n end\n end", "def evaluate_operator(left, right)\n left < right\n end", "def not_safe?(speed)\n\tspeed > 60 || speed < 40 ? true: false\nend", "def optimized?(src, dst)\n dst_size = dst.size?\n dst_size && dst_size < src.size\n end", "def right_invalid_constant?\n type = left.type\n !type.infer(right.class).equal?(type)\n end", "def compute_on_promotion?\n @compute_on_promotion ||= calculable.respond_to?(:promotion)\n end", "def binary_method_operator?\n arguments.one? && Types::BINARY_METHOD_OPERATORS.include?(selector)\n end", "def cost\r\n\t\t@lr.compute_cost.class != NaN\r\n\tend", "def not_safe?(speed)\n speed < 40 || speed > 60 ? true : false\nend", "def execute_JLE(operand) # Same as the JNG instruction\n\t\tis_less_than = (@flags.value[SIGN_FLAG] ^ @flags.value[OVERFLOW_FLAG]) == 1\n\t\tis_less_than_or_equal = is_less_than || @flags.value[ZERO_FLAG] == 1\n\t\tjump_conditionally_to_signed_displacement(operand, is_less_than_or_equal)\n\tend", "def binary_operator?\n Mutant::BINARY_METHOD_OPERATORS.include?(node.name)\n end", "def pow2?\n return self > 0 && (self & (self - 1) == 0)\n end", "def min_cost?\n false\n end", "def left_invalid_constant?\n !right.include?(left)\n end", "def build_operand(arg)\n if (arg.is_a?(AS::Parser::NumLiteralArgNode))\n if (arg.value.fits_u8?)\n # no shifting needed\n @operand = arg.value\n @i = 1\n elsif (op_with_rot = calculate_u8_with_rr(arg))\n @operand = op_with_rot\n @i = 1\n else\n raise AS::AssemblyError.new(AS::ERRSTR_NUMERIC_TOO_LARGE, arg)\n end\n elsif (arg.is_a?(AS::Parser::RegisterArgNode))\n @operand = reg_ref(arg)\n @i = 0\n elsif (arg.is_a?(AS::Parser::ShiftNode))\n rm_ref = reg_ref(arg.argument)\n @i = 0\n shift_op = {'lsl' => 0b000, 'lsr' => 0b010, 'asr' => 0b100,\n 'ror' => 0b110, 'rrx' => 0b110}[arg.type]\n if (arg.type == 'ror' and arg.value.nil?)\n # ror #0 == rrx\n raise AS::AssemblyError.new('cannot rotate by zero', arg)\n end\n \n arg1 = arg.value\n if (arg1.is_a?(AS::Parser::NumLiteralArgNode))\n if (arg1.value >= 32)\n raise AS::AssemblyError.new('cannot shift by more than 31', arg1)\n end\n shift_imm = arg1.value\n elsif (arg1.is_a?(AS::Parser::RegisterArgNode))\n shift_op |= 0x1;\n shift_imm = reg_ref(arg1) << 1\n elsif (arg.type == 'rrx')\n shift_imm = 0\n end\n \n @operand = rm_ref | (shift_op << 4) | (shift_imm << 4+3)\n else\n raise AS::AssemblyError.new(AS::ERRSTR_INVALID_ARG, arg)\n end\n end", "def evaluable?\n true\n end", "def execute_JG(operand) # Same as the JNLE instruction\n\t\tsf_equals_of = (@flags.value[SIGN_FLAG] ^ @flags.value[OVERFLOW_FLAG]).zero?\n\t\tis_greater_than = sf_equals_of && @flags.value[ZERO_FLAG].zero?\n\t\tjump_conditionally_to_signed_displacement(operand, is_greater_than)\n\tend", "def optimal_answer?\n \tanswer_value == optimal_value\n end", "def scalar?\n lhs == 0 and rhs == 0\n end", "def or_op(left, right, result) #method\n left = get_dir(left)\n right = get_dir(right)\n @current_context[result] = get_value(left) || get_value(right)\n end", "def optimize\n left.left.include(merged_right_enumerables).optimize\n end", "def not_safe?(speed)\n\tspeed < 40 || speed > 60 ? true : false\nend", "def not_safe?(speed)\n\tspeed < 40 || speed > 60 ? true : false\nend", "def query_yields_boolean?\n operands.last.query_yields_boolean?\n end", "def combo_optimal?\n optimal_value == combo_witheffect\n end", "def test_iff(stmt)\n l = eval_side(stmt.left)\n r = eval_side(stmt.right)\n if r && l.nil?\n set_truth(stmt.left.left, r) if stmt.left.type == :terminal\n elsif l && r.nil?\n set_truth(stmt.right.left, l) if stmt.right.type == :terminal\n end\n end", "def immediate?(arg_index)\n flags = opflags\n flag = nil\n # 10.divmod(10) => [1, 0] => position mode\n # 1.divmod(10) => [0,1] => immediate mode\n # 0.divmod(10) => [0,0] => all unspecified flags are position mode\n arg_index.times do\n flags, flag = flags.divmod(10)\n end\n\n flag == 1\n end", "def is_double_negation?\n if @operator.is_negation?\n if @right_sentence.operator && @right_sentence.operator.is_negation?\n return true\n end\n end\n false\n end", "def operand_matches?(value)\n operand.matches?(value)\n end", "def first_assignment_in?(left, right); end", "def unsafe?(speed)\n if speed < 40 || speed > 60\n true\n else\n false\n end\nend", "def unsafe?(speed)\n if speed > 60 || speed < 40\n return true \nelse\n return false\n end\nend", "def logical_op(type, lhs, op_t, rhs)\n n(type, [ lhs, rhs ],\n binary_op_map(lhs, op_t, rhs))\n end", "def right_aligned?\n value == :right\n end", "def refute_operator(o1, op, o2 = T.unsafe(nil), msg = T.unsafe(nil)); end", "def not_very_effective?\n @effectiveness > 0 && @effectiveness < 1\n end", "def _not(memory)\n Memory::Value.bool !@left_operand.value\n end", "def arm_close?\n @reg[2][10] == 1\n end", "def optimize\n operation.class.new(operand)\n end", "def operand?(str)\n return str.to_i != 0;\n end", "def optimize!(**options)\n ops = operands.map {|o| o.optimize(**options) }.select {|o| o.respond_to?(:empty?) && !o.empty?}\n @operands = ops\n self\n end", "def execute_JO(operand)\n\t\tjump_conditionally_to_signed_displacement(operand, @flags.value[OVERFLOW_FLAG] == 1) # Non-zero means set\n\tend", "def is_greedy?(location)\n !@fixed_cost.include? location\n end", "def optimize\n left_restriction.send(relation_method, right_restriction).restrict(partition.remainder)\n end", "def reminder?\n !(scalar % scalar.denominator).zero?\n end" ]
[ "0.74024963", "0.71386456", "0.69105935", "0.6681015", "0.6430766", "0.64075", "0.6326411", "0.6232442", "0.6232442", "0.621197", "0.621197", "0.61888534", "0.6075977", "0.5992004", "0.5937966", "0.5922706", "0.5922706", "0.5915728", "0.5874312", "0.57795644", "0.5689674", "0.5683462", "0.5669237", "0.56097037", "0.5607504", "0.55973643", "0.55803436", "0.55803436", "0.55721563", "0.55721563", "0.55721563", "0.55707383", "0.5567359", "0.55575275", "0.55492395", "0.55314213", "0.54799896", "0.54799896", "0.5469763", "0.5422125", "0.5420184", "0.5403288", "0.5386022", "0.53847885", "0.53847885", "0.53600967", "0.53544927", "0.5348207", "0.53471506", "0.5332887", "0.53271073", "0.5313627", "0.530926", "0.5288964", "0.528076", "0.5266433", "0.5256197", "0.5255648", "0.5239621", "0.5224656", "0.52047974", "0.52047795", "0.5203429", "0.5201204", "0.5197332", "0.517675", "0.5174303", "0.51598054", "0.5152135", "0.51493186", "0.5144112", "0.5142993", "0.51424754", "0.51208156", "0.51126486", "0.5108602", "0.510756", "0.510756", "0.51073873", "0.5085832", "0.5083198", "0.50801516", "0.50719994", "0.50700897", "0.50630325", "0.5061164", "0.504049", "0.50385123", "0.503816", "0.502677", "0.5025313", "0.502048", "0.5014072", "0.500466", "0.50037795", "0.49991873", "0.4992299", "0.49842793", "0.4982688", "0.49760526" ]
0.835047
0
Party like it's mcmxcix!
def roman_to_integer(roman) values = {i: 1, v: 5, x: 10, l: 50, c: 100, d: 500, m: 1000} total = 0 prev = 0 index = roman.length - 1 while index >= 0 c = roman[index].downcase c = c.to_sym index = index - 1 value = values[c] if !value return "Not a valid roman numeral" end if value < prev value = value * -1 else prev = value end total = total + value end total end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mascot; end", "def mob; end", "def private; end", "def ca; end", "def imei; end", "def mech; end", "def mech; end", "def probers; end", "def cobasysprog\n end", "def getc() end", "def getc() end", "def getc() end", "def c\n end", "def mozart; end", "def forkless(interspinous_interdevour, cladodontid_michel)\n end", "def conscientious_require; end", "def isolated; end", "def isolated; end", "def standalone; end", "def cp_c\n end", "def chondromyxoma(buckshee, uncongenially_chiquitan)\n end", "def whiny; end", "def manufacture; end", "def moon; end", "def getc()\n #This is a stub, used for indexing\n end", "def ibu; end", "def mitch_hedberg; end", "def internal; end", "def master; end", "def weber; end", "def mambo_no_5; end", "def ready_remix() end", "def check_marc; end", "def kids_musical; end", "def intensifier; end", "def king_richard_iii; end", "def send_moola!\n # @todo\n end", "def getc\n end", "def getc\n end", "def jack_handey; end", "def medical_use; end", "def m3\n\t\t\t\t\tsuper * 2\t\t\t\t\t\t\t\t\t\t\t\t# first override to #m3\n\t\t\t\tend", "def m3\n\t\t\t\t\tsuper * 2\t\t\t\t\t\t\t\t\t\t\t\t# first override to #m3\n\t\t\t\tend", "def m3\n\t\t\t\t\tsuper * 2\t\t\t\t\t\t\t\t\t\t\t\t# first override to #m3\n\t\t\t\tend", "def user_os_complex\r\n end", "def feruchemist; end", "def vendor; end", "def external; end", "def prox(m)\n end", "def current_clown; end", "def current_clown; end", "def suivre; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def custom; end", "def custom; end", "def musician; end", "def musician; end", "def scientist; end", "def mco_action\n raise RuntimeError, \"Not implemented\"\n end", "def extra; end", "def anatomy; end", "def wip\n end", "def cable; end", "def who_we_are\r\n end", "def cop; end", "def cop; end", "def cpl\n end", "def mi_carrera\n\n\tend", "def motto; end", "def m\nend", "def m\nend", "def spy_on_cm *msgs\n this_sucks.spy_on *msgs\n end", "def metro_code; end", "def celebration; end", "def internship_passed; end", "def autorun; end", "def third_party_processors; end", "def masteries; end", "def gcdlcm(p0) end", "def getc\n raise NotImplementedError\n end", "def metal; end", "def villian; end", "def mix\n #future code\n end", "def ccf\n end", "def production_curtailment; end", "def nasa_space_craft; end", "def in_law; end", "def buzzword; end", "def buzzword; end", "def peer; end", "def centi\n big_self * CENTI\n end", "def preflight; end", "def mechanic_quest; end", "def wrapper; end", "def silly_adjective; end", "def mco_agent\n raise RuntimeError, \"Not implemented\"\n end", "def realm; end", "def realm; end" ]
[ "0.6819029", "0.6200246", "0.5905913", "0.5755679", "0.57191193", "0.5702974", "0.5702974", "0.5689283", "0.563712", "0.5572675", "0.5572675", "0.5572675", "0.54901147", "0.54894984", "0.54297084", "0.54051304", "0.53822505", "0.53822505", "0.5377077", "0.53739846", "0.53568923", "0.5354775", "0.53546256", "0.535315", "0.5352953", "0.5351955", "0.5342595", "0.5341388", "0.53250515", "0.5323686", "0.53138167", "0.53084093", "0.5300282", "0.52907383", "0.52757376", "0.52567565", "0.5238284", "0.5234422", "0.5234422", "0.52318144", "0.52261394", "0.5213479", "0.5213479", "0.5213479", "0.5211821", "0.52082324", "0.52035046", "0.51971984", "0.5178796", "0.5174333", "0.5174333", "0.51679045", "0.5166501", "0.5166501", "0.5166501", "0.5166501", "0.516381", "0.516381", "0.516263", "0.516263", "0.51575446", "0.515565", "0.5152982", "0.51492804", "0.5143894", "0.5136225", "0.51281255", "0.5123314", "0.5123314", "0.5106492", "0.5089331", "0.5087035", "0.5082851", "0.5082851", "0.50827277", "0.5082374", "0.50764555", "0.50722665", "0.5064615", "0.50615513", "0.5058185", "0.50548303", "0.50522244", "0.5049247", "0.5048819", "0.5047492", "0.5045491", "0.5044625", "0.503567", "0.5015808", "0.5015232", "0.5015232", "0.5013276", "0.501264", "0.5008863", "0.5003502", "0.5000158", "0.50001085", "0.499829", "0.49980804", "0.49980804" ]
0.0
-1
Marks inventory units short shipped. Adjusts the order based on the value of the inventory. Sends an email to the customer about what inventory has been short shipped.
def short_ship(inventory_units, whodunnit:nil) if inventory_units.map(&:order_id).uniq != [@order.id] raise ArgumentError, "Not all inventory units belong to this order" end unit_cancels = [] Spree::OrderMutex.with_lock!(@order) do Spree::InventoryUnit.transaction do inventory_units.each do |iu| unit_cancels << short_ship_unit(iu, whodunnit: whodunnit) end update_shipped_shipments(inventory_units) Spree::OrderMailer.inventory_cancellation_email(@order, inventory_units.to_a).deliver_later if Spree::OrderCancellations.send_cancellation_mailer end @order.recalculate if short_ship_tax_notifier short_ship_tax_notifier.call(unit_cancels) end end unit_cancels end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shipped(order)\n @order = order\n\n puts \">> shipped order email sent\"\n\n mail to: @admin_email, subject: 'Pragmatic Store Order Shipped'\n end", "def shipped(order)\n @order = order\n\n mail to: order.email, subject: '8 facts you will never believe! Doctors hate it!'\n end", "def shipped(order)\n @order = order\n\n mail to: order.email, subject: 'Fast Find Auto Parts Order Shipped'\n end", "def shipped(order)\n @order = order \n\n mail to: order.email, subject: 'justEat Order Shipped'\n end", "def shipped(order)\n @order = order\n\n mail to: order.email, subject: 'Pragmatic Store Order Shipped'\n end", "def shipped(order)\n @order = order\n\n mail to: order.email,subject: \"Pragmatic Store Order Shipped\"\n end", "def order_shipped\n @order = order\n\n mail :to => \"sandra_sovane@inbox.lv\", :subject => 'Pragmatic Store Order Shipped'\n end", "def shipped(order)\n @order = order\n\n mail to: order.email, subject: \"Your Favorite Store Order Shipped\"\n end", "def shipped(order)\n @order = order\n\n mail to: order.e_mail, subject: 'Eloctronic Shop Order Shipped'\n end", "def shipped(order)\n @order = order\n \n mail :to => order.email, :subject => 'Montagna Verde Order Shipped'\n end", "def shipped(order)\n @order = order\n mail to: order.email, subject: 'Pragmatic Store Order shipped'\n end", "def after_ship\n inventory_units.each &:ship!\n Spree::OrderMailer.giftor_shipped_email(self.order).deliver() unless Spree::MailLog.has_email_been_sent_already?(self.order, 'Order::giftor_shipped_email')\n Spree::OrderMailer.giftee_shipped_email(self.order).deliver() if (self.order.is_gift? && !self.order.gift.email.blank? && !Spree::MailLog.has_email_been_sent_already?(order, 'Order::giftee_shipped_email'))\n end", "def shipped(order)\n @order = order\n mail to: \"sushicat16@yandex.ru\"\n end", "def shipped(order)\n @order=order\n mail(\n to: order.email,\n subject: 'BookShelf Order Shipped',\n from: \"BookShelf\",\n return_path: \"morozhunce@gmail.com\",\n date: Time.now,\n template_path: 'order_notifier',\n template_name: 'shipped'\n )\n end", "def shipped(order)\n @greeting = \"Hi\"\n @order = order\n\n mail to: \"colin.lin@newbiiz.com\", subject: \"Success! You shipped it.\"\n end", "def order_shipped(order)\n @order = order\n\n mail :subject => \"order shipped!\"\n end", "def shipped(order)\n @order = order\n mail to: order.email, subject: 'PMAC Store Order Shipped'\n end", "def shipped(order)\n @order = order\n\n mail to: order.email, subject: 'Envío de compra Farmacia Zi'\n end", "def shipped(morder)\n @morder = morder\n\n mail to: morder.email, subject: \"Pragmatic Store Order Shipped\"\n end", "def shipped(order)\n @order = order\n\n # defaults to using html template\n mail to: order.email, subject: \"O'Trendy Store Order Shipped\"\n end", "def order_shipped(order)\n \t@order = order\n mail to: order.email, subject: 'Pragmatic Store Order Shipped'\n end", "def shipped\n order = Order.last\n\n OrderMailer.shipped(order)\n end", "def shipped(order)\r\n @order = order\r\n mail to: order.email, subject: 'Заказ из Pragmatic Store отправлен'\r\n end", "def shipped (order)\n @order=order\n\n mail to: order.email, subject: \"You are receiveing the first Mail from Depot App\"\n end", "def shipped(order)\n @order = order\n mail to: order.email, subject: 'Pragmatic Store Order Shipped'\n puts order.to_yaml\n puts \"Mail to: #{mail.to}\"\n puts \"Mail from: #{mail.from}\"\n puts \"Mail subject: #{mail.subject}\"\n puts \"Mail Body:\"\n puts mail.body.encoded\n end", "def shipped\n @greeting = \"Hi\"\n @order = order\n mail(to: order.email, subject: 'Your Chocolate Bar order was received')\n end", "def shipped(order)\n @order = order\n mail to: order.mail, subject: 'Заказ из GlebKs stall отправлен'\n end", "def shipped\n OrderNotifierMailer.shipped\n end", "def order_shipped\n @order = order\n\n mail to: order.email, subject: 'Objednávka z obchodu Pragmatická Ivona byla odeslána'\n end", "def shipped\n OrderinshopMailer.shipped\n end", "def shipped\n OrderNitifierMailer.shipped\n end", "def shipped\n OrderMailer.shipped\n end", "def shipped\n OrderMailer.shipped\n end", "def update_inventory\n self.order_items.each { |item| item.variant.add_pending_to_customer }\n end", "def after_ship\n inventory_units.each { |u| u.ship! if u.can_ship? && !u.state?('shipped') }\n end", "def shipped(order)\n @order = order\n @greeting = \"Hello from rails4book\"\n\n mail to: order.email, subject: 'rails4book order shipped'\n end", "def shipped(order)\n @order = order\n mail to: order.email, subject: 'Заказ из Card Shop отправлен'\nend", "def receive_quietly backordered_units\n \n return if backordered_units.count < 1\n \n # TODO backordered units are not in stock\n \n self.variant.update_column(:count_on_hand, self.variant.on_hand + backordered_units.count)\n self.variant.save\n backordered_units.each(&:fill_backorder)\n \n end", "def mark_stuff_shipped(values)\n values['address_list'] = @data.display_list.map do |address|\n address.add_to_hash({})\n end\n\n values['update_url'] = url(:mark_as_shipped)\n standard_page(\"Confirm Shipping\", values, CONFIRM_SHIPPING)\n end", "def order_shipped(order)\r\n @order = order\r\n\r\n mail :to => order.email, \r\n :subject => 'Objednávka z Pragmatické knihovny byla odeslána'\r\n end", "def send_email\n AlertNotifier.delay.email_zero_inventory(self)\n end", "def ship\n count = 0\n if things_to_ship = params[:to_be_shipped]\n count = do_shipping(things_to_ship)\n if count > 0\n count_text = pluralize(count, \"order\")\n flash.now[:notice] = \"#{count_text} marked as shipped\"\n end\n end\n @pending_orders = Order.pending_shipping\n end", "def reserve_inventory!(order_quantity)\n self.quantity -= order_quantity\n save!\n end", "def shipped\n \n end", "def fire\n if @shipment.partial_shipped?\n @shipment.send_shipment_mail\n flash.notice = \"Mail has been sent\"\n else\n flash[:error] = \"Can not send shipping mail without any shipping events!\" \n end\n respond_with(@shipment) { |format| format.html { redirect_to :back } }\n end", "def thank_you\n # debugger\n @order_date = DateTime.now\n @shipping = 20000\n @total = order_subtotal + @shipping\n order = {\n \"total\" => @total,\n \"shipping\" => @shipping,\n \"items\" => session[:purchase]\n }\n # debugger\n OrderMailer.order_confirmation(session[:address], order).deliver_now\n end", "def sold\n @item = item\n @buyer = buyer\n @greeting = \"Hi\"\n @name = item.owner.name\n\n mail to: @buyer.email\n end", "def order_shipped\n\t\torder = Order.first\n\t\tOrderMailer.order_shipped(order)\n end", "def order_shipped\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def order_shipped\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def order_shipped\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def order_shipped\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def order_shipped(order)\n @order = order\n mail :to => User.find_by_id(@order.user_id).email, :subject => \"来自Time international GmbH的包裹发送信息\"\n end", "def shipped\n corresponding_item = self.item.take\n current_inventory = corresponding_item.inventory_level\n corresponding_item.update_attribute(:inventory_level, (self.quantity + current_inventory)) unless previous.nil?\n self.update_attribute(:shipped_on, date.current.to_date)\n\n def item_exists_and_active?\n all_active_items = Item.active.all.map(&:id)\n if all_active_items.include?(self.item_id)\n return true\n end\n errors.add(:item_id, \"is not an active item at the chess store\")\n return false\n end\n\n def subtotal(date = nil)\n end\n\n def valid_quantity?\n if self.quantity >= 0\n return true\n end\n stock_quantity = self.item.inventory_level\n if (self.quantity* -1) > stock_quantity\n errors.add(:quantity, \"too much purchase quantity\")\n return false\n end\n return true\n end\nend", "def buy\n shipment = Shipment.find(params[:shipment_id])\n shipment.update_column(:affiliate_shipping_account, params[:affiliate_shipping_account] == \"true\")\n EasyPost.api_key = shipment.easy_post_api_key\n\n begin\n ep_shipment = EasyPost::Shipment.retrieve(params[:ep_shipment_id])\n easypost_purchase(shipment, params[:rate_id], ep_shipment)\n ShipmentItem.where(shipment_id: shipment.id, special_status: \"\").update_all(special_status: :shipped)\n rescue => e\n flash[:error] = e.message + params[:ep_shipment_id]\n return redirect_back(fallback_location: admin_root_path)\n end\n\n redirect_to admin_store_shipment_path(shipment)\n end", "def mark_as_shipped\n @context.no_going_back\n\n list = @data.display_list\n update_from_form(list)\n\n list.each do |address_entry|\n address_entry.each_order do |order_info|\n next unless order_info.ship_order\n\n order = Order.with_id(order_info.order_id)\n\n if order\n order.mark_as_shipped\n else\n raise \"Missing order\"\n end\n\n end\n end\n @session.pop\n end", "def ship\n raise NotAllowed unless submitted?\n raise NotAllowed if shipped?\n\n apply(Orders::OrderShipped.strict(data: {\n order_uuid: @uuid,\n order_number: @number\n }))\n end", "def shipped\n order = Order.second\n items = LineItem.where(order_id: order.id)\n items.each do |item|\n order.line_items << item\n end\n OrderNotifier.shipped(order)\n end", "def order_shipped\n @greeting = \"Hi\"\n\n mail :to => order.email , :subject => 'Congratulations Your Order is Succesfully Shipped..... Thanks for Shopping with us!!!!!'\n end", "def update_snack_queue\n\n order_ids = params[:undelivered_order_ids]\n cart_ids = params[:cart_ids]\n @subscription_id = params[:subscription_id]\n\n orders = []\n @all_carts_full = Cart.is_carts_full?(cart_ids)\n\n if @all_carts_full\n\n order_ids.each do |key, order_id|\n orders.push(order_id)\n order = Spree::Order.where(id: order_id).first\n cart = Cart.where(id: cart_ids[key.to_i]).first\n order_line_items = cart.get_line_items_for_order\n order.pack_line_items(order_line_items, current_user.id, \"USD\", request.remote_ip)\n order.update_total_and_item_total\n #cart.destroy\n end\n\n order = Spree::Order.where(id: order_ids[\"0\"]).first\n result = queue_update_mail_params(order)\n VeganMailer.snack_queue_update_mail(result).deliver\n\n else\n\n end #end of complete if condition.\n end", "def shipped=(value)\n return unless value == '1' && shipped_at.nil?\n self.shipped_at = Time.current\n end", "def shipped\n OrderNotifier.shipped\n end", "def shipped\n OrderNotifier.shipped\n end", "def approve!\n inventory.restock!(self, Time.current, inventory_check)\n update!(adjustment: difference)\n end", "def send_success_report\n return if @success_orders.blank?\n success_orders = ['Order, SKU, Tracking, ParcelId, Quantity, Date, Country'] + @success_orders\n Spree::AsendiaMailer.csv(success_orders.join(\"\\n\"), 'asendia', \"Sand & Sky : ASENDIA Shipments Report(#{Time.now.strftime('%d/%m/%Y')})\").deliver\n end", "def ship_order\n self.update_attributes(status: 2)\n end", "def increase!(amount = 1)\n transaction do\n self.quantity += amount\n unless in_stock?\n # fail Shoppe::Errors::NotEnoughStock, ordered_item: ordered_item, requested_stock: self.quantity\n end\n save!\n # order.remove_delivery_service_if_invalid\n end\n end", "def ship!(consignment_number, user = nil)\n run_callbacks :ship do\n self.shipped_at = Time.now\n self.shipper = user if user\n self.status = 'shipped'\n self.consignment_number = consignment_number\n self.save!\n Shoppe::OrderMailer.shipped(self).deliver_now\n end\n end", "def order_notification(user)\n @user = user\n @items = @user.items.out_of_stock\n\n mail :subject => \"Keep these items in Sto.ck\",\n :to => user.email\n end", "def order1 \n puts(\"\\n\\n- - - - - - - - - - - - - - - -\\n[SHOP] Executing order 1: ABCDABA should be $13.25\\n\\n\") \n @shop.reset_order\n @shop.add_product_to_order_by_name('A')\n @shop.add_product_to_order_by_name('B')\n @shop.add_product_to_order_by_name('C')\n @shop.add_product_to_order_by_name('D')\n @shop.add_product_to_order_by_name('A')\n @shop.add_product_to_order_by_name('B')\n @shop.add_product_to_order_by_name('A')\nend", "def notify_shipped(order)\n @order = order\n @info = @order.info\n email = @order.user.email\n subject = \"特快車出貨通知! (訂單編號:#{@order.token})\"\n\n mail(to: email, subject: subject) do |format|\n format.text\n format.html\n end\n end", "def update_shipped_shipments(inventory_units)\n shipments = Spree::Shipment.\n includes(:inventory_units).\n where(id: inventory_units.map(&:shipment_id)).\n to_a\n\n shipments.each do |shipment|\n if shipment.inventory_units.all? { |iu| iu.shipped? || iu.canceled? }\n shipment.update_attributes!(state: 'shipped', shipped_at: Time.current)\n end\n end\n end", "def shipped\n @greeting = \"Hi\"\n\n mail to: \"tariq.sulehir@khaleef.com\"\n end", "def product_back_in_inventory\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def send_success_report\n return if @success_orders.blank?\n success_orders = ['Order, SKU, Tracking, ParcelId, Quantity, Date, Country'] + @success_orders\n Spree::InnotracMailer.csv(success_orders.join(\"\\n\"), 'innotrac', \"Sand & Sky : INNOTRAC Shipments Report(#{Time.now.strftime('%d/%m/%Y')})\").deliver\n end", "def order_budget()\n \n @greeting = \"Hi\"\n\n mail :to => \"docs1006@prodigy.net.mx\", :subject => 'Pragmatic Store Order Confirmation'\n end", "def order_shipped(order)\n @order = order\n\n mail(to: @order.user.email , subject: 'Order Confirmation')\n end", "def mark_as_shipped\n self.shipped_at = Time.now\n end", "def show\n @order_items = current_order.order_items\n \n @order_items.ids.each do |id| \n @order_item = OrderItem.find(id)\n @order_item.purchased = true\n @order_item.user_id = current_user.id\n @order_history = OrderHistory.new\n @order_history.update_attribute(:product_id,@order_item.product_id)\n @order_history.update_attribute(:user_id,current_user.id)\n @order_history.update_attribute(:unit_price,@order_item.unit_price)\n @order_history.update_attribute(:quantity,@order_item.quantity)\n @order_history.update_attribute(:order_id,@order_item.order_id)\n @order_history.update_attribute(:total_price,@order_item.total_price)\n @order_history.save\n @order_item.destroy\n end\n #mail is sent to user after every successful purchase\n ApplicationMailer.send_cart_mail(current_user).deliver\n end", "def shipped\n CommentMailer.shipped\n end", "def shipping_invoice_ready(invoice) \n @invoice = invoice\n sc = invoice.site.store_config\n mail(:to => sc.shipping_email, :subject => 'Order ready for shipping')\n end", "def mark_as_delivered\n order = Order.find(params[:id])\n order.delivered_at = DateTime.now\n order.save!\n redirect_to orders_path\n end", "def mark_shipped\n @orderproduct = OrderProduct.find(params[:current_order_product].to_i)\n @orderproduct.shipped = true\n @orderproduct.save\n\n redirect_to selling_history_path\n end", "def delivered(order)\n @order = order\n\n mail to: order.email, subject: \"Your order is ready\"\n end", "def send_order_email\n\t mail( :to => 'ashley@asiancomco.com',\n\t :subject => 'Order' )\n\t end", "def item_inventory_update\n \n item = Item.find(params[:item_id])\n order= Order.find(params[:id])\n item_order = ItemOrder.where(item_id: item.id, order_id: order.id).first\n new_inventory = item.inventory - item_order.quantity\n item_order.update(status: \"fulfilled\")\n item.update(inventory: new_inventory)\n end", "def update_quantity_dispensed(drug_order, quantity)\n drug_order.quantity ||= 0\n drug_order.quantity += quantity.to_f\n\n order = drug_order.order\n # We assume patient start taking drugs on same day he/she receives them\n # thus we subtract 1 from the duration.\n quantity_duration = drug_order.quantity_duration - 1\n order.discontinued_date ||= order.auto_expire_date\n order.auto_expire_date = order.start_date + quantity_duration.days\n order.save\n\n drug_order.save\n end", "def send_ordersold_email(user, order)\n @user = user\n @order = order\n\t mail( to: @user.email, subject: \"Echtchange: #{@user.name} Your #{@order.listing.name} has Sold!\" )\n end", "def post_shipment_notifier(shipment)\n @shipment = shipment\n subject = \"WARNING: No InstaTrace Shipments Posted in 24 hours\" \n mail(:to => EMAIL_NOTIFY_POST_SHIPMENT_API, :subject => subject) if shipment.hawb && shipment.created_at\n end", "def run!\n # Validations here are intended to catch all necessary prerequisites.\n # We return early so all checks have happened already.\n return false if invalid?\n desired_shipment.save! if desired_shipment.new_record?\n\n # Retrieve how many on hand items we can take from desired stock location\n available_quantity = [desired_shipment.stock_location.count_on_hand(variant), 0].max\n\n new_on_hand_quantity = [available_quantity, quantity].min\n unstock_quantity = desired_shipment.stock_location.backorderable?(variant) ? quantity : new_on_hand_quantity\n\n ActiveRecord::Base.transaction do\n if handle_stock_counts?\n # We only run this query if we need it.\n current_on_hand_quantity = [current_shipment.inventory_units.pre_shipment.size, quantity].min\n\n # Restock things we will not fulfil from the current shipment anymore\n current_stock_location.restock(variant, current_on_hand_quantity, current_shipment)\n # Unstock what we will fulfil with the new shipment\n desired_stock_location.unstock(variant, unstock_quantity, desired_shipment)\n end\n\n # These two statements are the heart of this class. We change the number\n # of inventory units requested from one shipment to the other.\n # We order by state, because `'backordered' < 'on_hand'`.\n current_shipment.\n inventory_units.\n where(variant: variant).\n order(state: :asc).\n limit(new_on_hand_quantity).\n update_all(shipment_id: desired_shipment.id, state: :on_hand)\n\n current_shipment.\n inventory_units.\n where(variant: variant).\n order(state: :asc).\n limit(quantity - new_on_hand_quantity).\n update_all(shipment_id: desired_shipment.id, state: :backordered)\n end\n\n # We modified the inventory units at the database level for speed reasons.\n # The downside of that is that we need to reload the associations.\n current_shipment.inventory_units.reload\n desired_shipment.inventory_units.reload\n\n # If the current shipment now has no inventory units left, we won't need it any longer.\n if current_shipment.inventory_units.length.zero?\n current_shipment.destroy!\n else\n # The current shipment has changed, so we need to make sure that shipping rates\n # have the correct amount.\n current_shipment.refresh_rates\n end\n\n # The desired shipment has also change, so we need to make sure shipping rates\n # are up-to-date, too.\n desired_shipment.refresh_rates\n\n true\n end", "def product_sold\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def add_to_shipment(shipment, variant, quantity, line_item = nil)\n on_hand, back_order = shipment.stock_location.fill_status(variant, quantity)\n\n on_hand.times do\n shipment.inventory_units.create({variant_id: variant.id, line_item: line_item.id,\n state: 'on_hand'}, without_protection: true)\n end\n\n back_order.times do\n shipment.inventory_units.create({variant_id: variant.id, line_item_id: line_item.id,\n state: 'backordered'}, without_protection: true)\n end\n\n shipment.stock_location.unstock variant, quantity, shipment\n quantity\n end", "def shipped(config, order)\n\t\t@subject = \"#{config[:application][:name][:value]} Shipping Notification: Order \\##{order.id}\"\n\t\t@recipients = \"#{order.user} <#{order.user.email}>\"\n\t\t@from = \"#{config[:application][:name][:value]} <#{config[:emails][:shipping][:value]}>\"\r\n\t\t@sent_on = Time.now\n\t\t@body['order'] = order\n\t\t@body['items'] = order.items\n\t\t@body['team_name'] = config[:application][:team_name][:value]\r\n\tend", "def notify_order(order)\n @order = order\n to = ADMIN_EMAIL\n\n mail :to => email_to(to), :subject => \"Pocket Prints Order ##{order.order_code}\"\n end", "def confirm!\n no_stock_of = self.order_items.select(&:validate_stock_levels)\n unless no_stock_of.empty?\n raise Shoppe::Errors::InsufficientStockToFulfil, :order => self, :out_of_stock_items => no_stock_of\n end\n \n run_callbacks :confirmation do\n # If we have successfully charged the card (i.e. no exception) we can go ahead and mark this\n # order as 'received' which means it can be accepted by staff.\n self.status = 'received'\n self.received_at = Time.now\n self.save!\n\n self.order_items.each(&:confirm!)\n\n # Send an email to the customer\n deliver_received_order_email\n end\n \n # We're all good.\n true\n end", "def customer_status_updated(invoice) \n @invoice = invoice\n mail(:to => invoice.customer.email, :subject => 'Order status update')\n end", "def change_order_status_on_qsm(mp)\n orders = Spree::Order.where(\"market_place_id=? AND fulflmnt_state IN (?)\", mp.id, ['rfp', 'picked_up'])\n orders.each do |order|\n smp = Spree::SellersMarketPlacesProduct.where(\"seller_id=? AND market_place_id=?\", order.seller.id, mp.id) rescue nil\n if smp.present?\n uri = URI(mp.domain_url+'/ShippingBasicService.api/SetSendingInfo')\n req = Net::HTTP::Post.new(uri.path)\n req.set_form_data({'key'=>smp.first.api_secret_key,'OrderNo'=>order.market_place_order_no,'ShippingCorp'=>'Fulfillment By Anchanto','TrackingNo'=>order.fulflmnt_tracking_no})\n res = Net::HTTP.start(uri.hostname, uri.port) do |http|http.request(req)end\n end\n return res && res.code == \"200\" ? \"success\" : \"failed\"\n end\n end", "def shipped\n OrderNotifer.shipped\n end", "def ship_items\n if current_user && current_user.seller\n @cart_item = CartItem.find_by(cart_id: params[:cart_id], item_id: params[:item_id])\n @cart_item.update(shipped: true)\n redirect_to buyer_orders_path\n else\n redirec_to root_path\n end\n end", "def shipped\n OrderNotified.shipped\n end" ]
[ "0.67890847", "0.64178044", "0.64130884", "0.63560724", "0.6340769", "0.6320822", "0.6319823", "0.6302464", "0.629955", "0.6294293", "0.62783396", "0.6277701", "0.62108487", "0.61932886", "0.6162298", "0.6084835", "0.60737103", "0.6070343", "0.6069573", "0.60585403", "0.6057606", "0.6039234", "0.60163563", "0.59761775", "0.5932015", "0.59301233", "0.5920651", "0.5863637", "0.58623123", "0.5841197", "0.58235455", "0.5821948", "0.5821948", "0.57718813", "0.5757922", "0.5748964", "0.5746477", "0.57123566", "0.56891084", "0.5684851", "0.56797236", "0.5649846", "0.5621462", "0.5594489", "0.5563534", "0.5544304", "0.55430067", "0.5528904", "0.55213666", "0.55213666", "0.55213666", "0.55213666", "0.55105627", "0.5503955", "0.5470626", "0.54682577", "0.5463694", "0.54516363", "0.54494596", "0.543166", "0.5426514", "0.5419074", "0.5419074", "0.539932", "0.53687614", "0.53529173", "0.5345381", "0.53439003", "0.5335271", "0.5332698", "0.53284603", "0.5314713", "0.5306423", "0.52743703", "0.52681184", "0.5264437", "0.5238248", "0.52160937", "0.5204228", "0.5188886", "0.5174271", "0.51708066", "0.5160476", "0.5158804", "0.51580524", "0.5137197", "0.5136242", "0.51355743", "0.51228154", "0.5122279", "0.51133484", "0.5103436", "0.5095671", "0.5091389", "0.5087456", "0.5071682", "0.5060015", "0.5056805", "0.50533247", "0.50426424" ]
0.7190293
0
Marks inventory unit canceled. Optionally allows specifying the reason why and who is performing the action.
def cancel_unit(inventory_unit, reason: Spree::UnitCancel::DEFAULT_REASON, whodunnit:nil) unit_cancel = nil Spree::OrderMutex.with_lock!(@order) do unit_cancel = Spree::UnitCancel.create!( inventory_unit: inventory_unit, reason: reason, created_by: whodunnit ) inventory_unit.cancel! end unit_cancel end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cancel(reason, info = {})\n @cancelled = true\n @cancelled_by = caller(1, 1)\n @cancelled_reason = reason\n @cancelled_info = info\n cancel_notification\n nil\n end", "def cancel(*args)\n commit('cancel', *args)\n end", "def cancel!\n state_guard { modify_call 'Status' => 'cancelled' }\n end", "def cancel_reason\n @subscription_purchase.cancel_reason\n end", "def cancel_intention_if_present(reason, extra_info = {})\n @current_intention.cancel(reason, extra_info) if @current_intention\n end", "def cancel\n @error = :cancelled\n end", "def cancel_item(message)\n request(:cancel_item, Boolean, message)\n end", "def cancel(simulator, reason = :notAssigned)\n @tripViaPoint.pickUp.clearPoi(simulator) ;\n @tripViaPoint.dropOff.clearPoi(simulator) ;\n @sav = nil ;\n @cancelReason = reason ;\n @cancelTime = simulator.currentTime ;\n end", "def cancel\r\n # @todo Emit a warning for attempts to cancel an action after it's been\r\n # executed\r\n @cancelled = true\r\n end", "def cancel!\n if charged && !canceled\n refund!\n recharge!\n end\n end", "def cancel\n @result = :cancel\n $game_system.se_play($data_system.cancel_se)\n end", "def __cancel__(what, &blk)\n req = Request.new\n req.verb = Request::Verb::CANCEL\n req.id = what.tag\n\n # Hold on to the tag as unavaiable for reuse until the cancel succeeds.\n @cbx[what.tag] = nil\n\n send(req) do |res|\n # Do not send any more responses from the server to this request.\n @cbx.delete(what.tag)\n blk.call(res) if blk\n end\n end", "def cancel_action(msg=nil)\n raise_hook_failure(msg)\n end", "def cancel_action(msg=nil)\n raise_hook_failure(msg)\n end", "def canceled?\n @state == :cancel\n end", "def cancel\n\n unschedule_timeout(nil)\n\n cancel_participant\n\n trigger_on_cancel # if any\n\n @applied_workitem\n end", "def cancel\n self.solved(:abort)\n end", "def cancel_notification\n return if @cancelled_info && @cancelled_info[\"silent\"]\n @engine.send_notification({\n reason: @cancelled_reason,\n by: @cancelled_by,\n id: @intention_id,\n intention_type: self.class.to_s,\n info: @cancelled_info,\n },\n type: Demiurge::Notifications::IntentionCancelled,\n zone: @item.zone_name,\n location: @item.location_name,\n actor: @item.name,\n include_context: true)\n nil\n end", "def cancel!\r\n return if [:cancel].include? m.status\r\n raise \"Invalid state: message must be new, retry, or fail to cancel!\" unless [:new, :retry, :fail].include? m.status\r\n self.status = :cancel\r\n self.save!\r\n end", "def cancel_notification\n return if @cancelled_info && @cancelled_info[\"silent\"]\n @engine.send_notification({\n reason: @cancelled_reason,\n by: @cancelled_by,\n id: @intention_id,\n intention_type: self.class.to_s,\n info: @cancelled_info,\n queue_number: @action_queue_number,\n action_name: @action_name,\n action_args: @action_args,\n },\n type: Demiurge::Notifications::IntentionCancelled,\n zone: @item.zone_name,\n location: @item.location_name,\n actor: @item.name,\n include_context: true)\n nil\n end", "def cancellation_reason\n read_integer('cancellation_reason')\n end", "def do_cancel(msg)\n\n flavour = msg['flavour']\n\n return if h.state == 'cancelling' && flavour != 'kill'\n # cancel on cancel gets discarded\n\n return if h.state == 'failed' && flavour == 'timeout'\n # do not timeout expressions that are \"in error\" (failed)\n\n h.state = case flavour\n when 'kill' then 'dying'\n when 'timeout' then 'timing_out'\n else 'cancelling'\n end\n\n if h.state == 'timing_out'\n\n h.applied_workitem['fields']['__timed_out__'] = [\n h.fei, Ruote.now_to_utc_s, tree.first, compile_atts\n ]\n\n elsif h.state == 'cancelling'\n\n if t = msg['on_cancel']\n\n h.on_cancel = t\n\n elsif ra_opts = msg['re_apply']\n\n ra_opts = {} if ra_opts == true\n ra_opts['tree'] ||= tree\n\n h.on_re_apply = ra_opts\n end\n end\n\n cancel(flavour)\n end", "def cancel_notification\n # \"Silent\" notifications are things like an agent's action queue\n # being empty so it cancels its intention. These are normal\n # operation and nobody is likely to need notification every\n # tick that they didn't ask to do anything so they didn't.\n return if @cancelled_info && @cancelled_info[\"silent\"]\n item = @engine.item_by_name(@name)\n @engine.send_notification({ reason: @cancelled_reason, by: @cancelled_by, id: @intention_id, intention_type: self.class.to_s },\n type: Demiurge::Notifications::IntentionCancelled, zone: item.zone_name, location: item.location_name, actor: item.name,\n include_context: true)\n end", "def cancel\n self.update_status :cancelled\n end", "def do_cancel (msg)\n\n flavour = msg['flavour']\n\n return if h.state == 'cancelling' && flavour != 'kill'\n # cancel on cancel gets discarded\n\n return if h.state == 'failed' && flavour == 'timeout'\n # do not timeout expressions that are \"in error\" (failed)\n\n @msg = Ruote.fulldup(msg)\n\n h.state = case flavour\n when 'kill' then 'dying'\n when 'timeout' then 'timing_out'\n else 'cancelling'\n end\n\n h.applied_workitem['fields']['__timed_out__'] = [\n h.fei, Ruote.now_to_utc_s\n ] if h.state == 'timing_out'\n\n if h.state == 'cancelling'\n\n if t = msg['on_cancel']\n\n h.on_cancel = t\n\n elsif hra = msg['re_apply']\n\n hra = {} if hra == true\n h.on_cancel = hra['tree'] || tree\n if fs = hra['fields']\n h.applied_workitem['fields'] = fs\n end\n if mfs = hra['merge_in_fields']\n h.applied_workitem['fields'].merge!(mfs)\n end\n end\n end\n\n cancel(flavour)\n end", "def cancel\n # TODO: That thing I'm claiming to do in the comments\n super\n end", "def cancelled!\n @cancelled = true\n end", "def cancel(*)\n super.tap do\n __debug_sim('USER has decided to withdraw the submission.')\n end\n end", "def cancel\n\t\tself.status = 'Canceled'\n\t\tself.save(validate: false)\n\tend", "def dispatch_cancel(msg)\n\n flavour = msg['flavour']\n\n participant = @context.plist.instantiate(msg['participant'])\n\n begin\n participant.cancel(Ruote::FlowExpressionId.new(msg['fei']), flavour)\n rescue => e\n raise(e) if flavour != 'kill'\n end\n\n @context.storage.put_msg(\n 'reply',\n 'fei' => msg['fei'],\n 'workitem' => msg['workitem'])\n end", "def cancel_cli\n generic_step(\"cancel\")\n end", "def _on_cancel(fei, flavour)\n Ruote.participant_send(\n self, [ :on_cancel, :cancel ], 'fei' => fei, 'flavour' => flavour)\n end", "def cancel(id); end", "def cancel\n throw(:abort)\n end", "def on_item_cancel2; item_cancel(@item_window2, @category_window2); end", "def cancellation_reason_string\n CANCELATION_REASONS[cancellation_reason]\n end", "def cancel\n end", "def cancel\n end", "def canceled\n respond_to do |format|\n if @reservation.update_marked_as_canceled\n ReservationMailer.canceled_email(@reservation).deliver_later\n format.html { redirect_to [@reservation.space.location.org, @reservation.space.location, @reservation.space, @reservation], notice: 'Reservation was successfully canceled.' }\n format.json { render :show, status: :created, location: [@reservation.space.location.org, @reservation.space.location, @reservation.space, @reservation] }\n else\n format.html { render :cancel }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def on_item_cancel; item_cancel(@item_window, @category_window); end", "def canceled?\n special_message == \"This talk has been canceled/deleted\"\n end", "def subject_cancel\n self.cancel_button.click\n end", "def dispatch_cancel(msg)\n\n flavour = msg['flavour']\n\n participant = @context.plist.instantiate(msg['participant'])\n\n result = begin\n\n Ruote.participant_send(\n participant,\n [ :on_cancel, :cancel ],\n 'fei' => Ruote::FlowExpressionId.new(msg['fei']),\n 'flavour' => flavour)\n\n rescue => e\n raise(e) if flavour != 'kill'\n end\n\n @context.storage.put_msg(\n 'reply',\n 'fei' => msg['fei'],\n 'workitem' => msg['workitem']\n ) if result != false\n end", "def mark_as_cancelled\n update({\n stripe_status: 'canceled',\n ends_at: Time.current,\n })\n end", "def cancelled?; end", "def command_cancel\r\n # Play decision SE\r\n $game_system.se_play($data_system.decision_se)\r\n # Switch to menu screen\r\n $scene = Scene_Menu.new(5)\r\n end", "def orderCanceled\n order = Order.last\n user = User.find(Contract.find(order.contract_id).buyer_id)\n MagicMailer.orderCanceled(order, user)\n end", "def cancel_job(message, job_id = nil, step_id = nil, proc_id = nil)\n job_id = get_job_id(error = false) unless job_id\n if job_id and not step_id\n step_id = get_step_id(get_job_directory(job_id), error = false)\n end\n scancel(job_id, step_id) if job_id\n message = if proc_id\n \"Record Job Energy error in process #{proc_id} - #{message}\"\n else\n \"Record Job Energy error - #{message}\"\n end\n raise EnergyRecordError, message\nend", "def on_cancel &b\n @cancel_proc = b\n self\n end", "def cancel!\n # Context is already cleared in action_for_message\n end", "def cancel\n\t\tputs \"Cancelling #{self.student.forename} #{self.student.surname}'s enrollment in #{self.course.title}\"\n\n\t\tself.is_cancelled = true\n\t\tself.save\n\n\t\tmessage = \"Your cancellation was successful. You have not received a refund.\"\n\n\t\tif refund_amount > 0\n\t\t\tmessage = \"Your cancellation was successful. You will receive your refund within 48 hours.\"\n\t\tend\n\n\t\tPaymentMailer.refund_processing(self).deliver\n\n\t\treturn message\n\tend", "def cancel!\n Bumbleworks.dashboard.cancel_expression(@fei)\n end", "def cancel\n super\n end", "def cancel!\n update(request_cancelled: true)\n end", "def cancel?\n self.type == :cancel\n end", "def cancel\n super\n end", "def cancelled?\n return self.status == 'canceled'\n end", "def cancel!; end", "def on_mixitem_cancel\n case @mix_window.last_window\n when :skill_window\n on_mixitem_cancel_to_skill_window\n when :yea_bcl # $imported[\"YEA-BattleCommandList\"]\n on_mixitem_cancel_to_yea_bcl\n end\n end", "def ListView_CancelEditLabel(hwnd) send_listview_message(hwnd, :CANCELEDITLABEL) end", "def cancel(comment)\n params = { shipmentId: id, comment: comment }\n self.class.request(\n :post,\n self.class.uri('cancel'),\n json: params.merge(self.class.credentials)\n )\n end", "def canceled(request)\n @request = request\n mail to: @request.user.email, subject: default_i18n_subject(id: @request.id)\n end", "def cancel\n set_params\n show_translation\n end", "def cancel(c, ci, de, cr, cv)\n if state(COMMITMENT, c, ci, de, cr) and active(c, ci, cv)\n apply([[CANCELLED, c, ci, cv]], [])\n end\nend", "def cancel\n # Define this later\n end", "def cancel!\n self.update_attributes(status: CANCELLED)\n #self.line_items.update_attributes(status: LineItem::CANCELLED)\n end", "def cancel?(id); end", "def cancelout(message = \"Received negative number; canceling...\", rc=0)\n $stderr.print(message + \"\\n\" ) if message\n Process.exit(rc)\nend", "def cancel; end", "def cancel; end", "def cancel\n super\n end", "def cancel\n super\n end", "def cancel\n super\n end", "def cancel\n super\n end", "def cancel\n super\n end", "def cancel\n super\n end", "def cancel\n super\n end", "def cancel\n super\n end", "def cancel\n super\n end", "def cancel\n super\n end", "def cancel\n super\n end", "def cancel\n super\n end", "def cancel\n super\n end", "def cancel\n super\n end", "def cancel\n super\n end", "def cancel\n super\n end", "def cancel\n super\n end", "def cancel element\n element.perform :cancel\n end", "def cancel\n @coordinator.cancel\n\n super\n end", "def cancel\n @coordinator.cancel\n\n super\n end", "def cancel_order\n if self.status.downcase == \"pending\"\n self.status = \"Canceled\"\n self.save\n self\n else \n \"Error in Order Model\"\n end\n end", "def cancel_transfer_for_order(params)\n run_command :cancel_transfer, :transfer, params\n end", "def cancel_participant\n\n return unless @applied_workitem\n #\n # if there is an applied workitem, it means there\n # is a participant to cancel...\n\n participant = get_participant_map.lookup_participant(@participant_name)\n\n cancelitem = CancelItem.new(@applied_workitem)\n\n get_participant_map.dispatch(participant, @participant_name, cancelitem)\n end", "def cancel\n super\n end", "def cancel\n super\n end", "def cancel\n super\n end", "def stop_reason()\n #This is a stub, used for indexing\n end", "def cancel \n unless self.status == 'canceled'\n ev = Event.create(\n :event_type => :subscription,\n :event_subtype => :cancel,\n :user => self.user,\n :detail_i1 => self.id\n ) \n \n Rails::logger.debug \"Calling chargify to cancel subscription ID #{self.chargify_id}\" \n Sherlock::Chargify.new.cancel(self.chargify_id) \n \n Rails::logger.debug \"Adjusting my own status to 'canceled'\" \n \n self.status = 'canceled'\n self.save\n \n ev.finish\n \n InfusionsoftUtils.update_contact(self)\n end\n \n end", "def cancel\n self.class.cancel(self)\n end", "def command_cancel\n Sound.play_decision\n return_scene\n end" ]
[ "0.6363999", "0.63175195", "0.62801456", "0.6270991", "0.6211374", "0.6155653", "0.61353934", "0.6101082", "0.60764897", "0.60443234", "0.6041007", "0.6015684", "0.59909993", "0.59909993", "0.5933009", "0.58915377", "0.5881165", "0.58541816", "0.5844977", "0.5832736", "0.58169746", "0.579269", "0.5784036", "0.5773182", "0.5761502", "0.57543725", "0.5750822", "0.5741024", "0.57390785", "0.57355124", "0.5733339", "0.57325506", "0.5714842", "0.571386", "0.5705453", "0.5696512", "0.569613", "0.569613", "0.567816", "0.56750625", "0.5671563", "0.56693876", "0.5667109", "0.5651014", "0.56498694", "0.56350756", "0.55996114", "0.55960083", "0.55945355", "0.5594173", "0.5586359", "0.5576918", "0.557443", "0.55710405", "0.5549296", "0.5546671", "0.55343", "0.5533398", "0.5532352", "0.5530714", "0.55239236", "0.55238557", "0.55214274", "0.5502517", "0.54978764", "0.5496518", "0.54841024", "0.5481439", "0.54718053", "0.54718053", "0.5469682", "0.5469682", "0.5469682", "0.5469682", "0.5469682", "0.5469682", "0.5469682", "0.5469682", "0.5469682", "0.5469682", "0.5469682", "0.5469682", "0.5469682", "0.5469682", "0.5469682", "0.5469682", "0.5469682", "0.5453531", "0.54475147", "0.54475147", "0.5447085", "0.5442666", "0.5438439", "0.5436457", "0.5436457", "0.5436457", "0.5434405", "0.54334146", "0.54268533", "0.54263806" ]
0.72021127
0
Reimburses inventory units due to cancellation.
def reimburse_units(inventory_units) reimbursement = nil Spree::OrderMutex.with_lock!(@order) do return_items = inventory_units.map(&:current_or_new_return_item) reimbursement = Spree::Reimbursement.new(order: @order, return_items: return_items) reimbursement.return_all end reimbursement end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cancel!\n if charged && !canceled\n refund!\n recharge!\n end\n end", "def cancel!(e, quantity)\n [e, e.matchee].each do |ex|\n ex.quantity -= quantity\n quantity.times {ex.registrations.pop}\n ex.save\n end\n end", "def destroy_along_with_units\n self.quantity = 0\n OrderInventoryAssembly.new(self).verify\n self.destroy\n end", "def destroy_along_with_units\n self.quantity = 0\n OrderInventoryAssembly.new(self).verify\n self.destroy\n end", "def recover_usage(quantity_to_be_recovered)\n self.used_quantity -= quantity_to_be_recovered \n self.save \n \n self.unmark_as_finished\n \n item = self.item \n item.update_ready_quantity\n \n return self \n end", "def recover_usage(quantity_to_be_recovered)\n self.used_quantity -= quantity_to_be_recovered \n self.save \n \n self.unmark_as_finished\n \n \n \n item = self.item \n item.add_ready_quantity( quantity_to_be_recovered ) \n \n return self \n end", "def cancel_unit(inventory_unit, reason: Spree::UnitCancel::DEFAULT_REASON, whodunnit:nil)\n unit_cancel = nil\n\n Spree::OrderMutex.with_lock!(@order) do\n unit_cancel = Spree::UnitCancel.create!(\n inventory_unit: inventory_unit,\n reason: reason,\n created_by: whodunnit\n )\n\n inventory_unit.cancel!\n end\n\n unit_cancel\n end", "def reserve_inventory!(order_quantity)\n self.quantity -= order_quantity\n save!\n end", "def checkout_cart\n self.line_items.each do |li|\n li.item.inventory -= li.quantity\n li.item.save\n end\n self.line_items.clear\n self.status = \"submitted\"\n self.user.current_cart_id = nil\n self.user.save\n end", "def decrement_inventory!\n self.available_inventory = self.available_inventory - 1\n self.save\n end", "def purchase\n \t@stock -= 1\n end", "def approve!\n inventory.restock!(self, Time.current, inventory_check)\n update!(adjustment: difference)\n end", "def unit_item_ok\n return refresh_items if @unit_item_list.tb_unit.nil?\n @unit_item_list.activate\n return if (item = @unit_item_list.item).nil?\n @unit_item_list.tb_unit.lose_item(item, 1) \n TactBattleManager.rm_unit_item(@actor.id, item)\n $game_party.gain_item(item, 1)\n refresh_items\n end", "def do_close\n self.void_pending_purchase_orders\n self.closed_at = Time.now.utc\n self.kase.sweep_max_reward_price_cache if self.kase\n self.send_canceled\n end", "def withdraw exit_date, estimated_return_date, pickup_company, pickup_company_contact, additional_comments, quantity, folio\n \n return self.status if cannot_withdraw?\n\n if quantity != '' and quantity < self.quantity.to_i\n self.quantity = self.quantity.to_i - quantity\n quantity_withdrawn = quantity\n else\n self.status = InventoryItem::OUT_OF_STOCK\n quantity_withdrawn = self.quantity\n self.quantity = 0\n end\n \n if self.save\n inventory_item = InventoryItem.where( 'actable_id = ? AND actable_type = ?', self.id, 'BulkItem' ).first\n if self.warehouse_locations?\n quantity_left = quantity\n if quantity != '' and quantity < ( self.quantity.to_i + quantity_withdrawn.to_i )\n item_location = self.item_locations.where( 'quantity >= ?', quantity ).first\n location = item_location.warehouse_location\n location.remove_quantity( inventory_item.id, quantity )\n elsif quantity != ''\n while quantity_left > 0\n item_location = self.item_locations.first\n location = item_location.warehouse_location\n if quantity_left >= item_location.quantity \n current_location_quantity = item_location.quantity \n location.remove_item( inventory_item.id )\n self.item_locations.delete( item_location )\n location.update_status\n else\n location.remove_quantity( inventory_item.id, quantity_left )\n end\n quantity_left = quantity_left - current_location_quantity\n end\n else\n item_location = self.item_locations.first\n location = item_location.warehouse_location\n location.remove_item( inventory_item.id )\n self.item_locations.delete( item_location )\n location.update_status\n end\n end\n CheckOutTransaction.create( :inventory_item_id => inventory_item.id, :concept => 'Salida granel', :additional_comments => additional_comments, :exit_date => exit_date, :estimated_return_date => estimated_return_date, :pickup_company => pickup_company, :pickup_company_contact => pickup_company_contact, :quantity => quantity_withdrawn, :folio => folio )\n return true\n end\n\n return false\n end", "def sell_inventory(material, quantity)\n material.quantity -= quantity\n end", "def cancel_order\n system 'clear'\n CoffeeMan.stay_logo\n @@cart.clear\n puts \"Your cart has been emptied\"\n sleep(0.09)\n main_menu\n sleep(2)\n end", "def return_item\n items = self.see_purchases.map do |merchandise|\n {name: merchandise.name, merch_id: merchandise.id}\n end\n merch = TTY::Prompt.new.select(\"Here is a list of your purchases. What would you like to return?\",items)\n purchase = self.specific_purchase(merch)\n purchase.destroy \n puts \"your item has been refunded!\"\n restock = self.select_merchandise(merch)\n restock.update(inventory: restock.inventory + 1)\n end", "def cancel(*)\n super.tap do\n __debug_sim('USER has decided to withdraw the submission.')\n end\n end", "def remind\n _order_item_ids = params[:order_item_id]\n _order_ids = params[:order_ids]\n\n Order.remind_overdue(_order_ids, _order_item_ids)\n\n redirect_back fallback_location: admin_buyers_url\n end", "def reduce_stock(amount)\n self.stock = self.stock - amount\n end", "def cancel_hold\n if self.status == 'Held'\n create_delivery('HoldCancelled', :details => \"The hold on this validation has been removed without action.\")\n end\n end", "def release\n request = Remit::Cancel::Request.new(transaction_id: transaction_id)\n response = remit.cancel request\n response.errors.empty?\n end", "def finalize!\n update_attribute(:completed_at, Time.now)\n InventoryUnit.assign_opening_inventory(self)\n # lock any optional adjustments (coupon promotions, etc.)\n adjustments.optional.each { |adjustment| adjustment.update_attribute(\"locked\", true) }\n\t\n envia_correos_notific # Envío de correos...\n\n self.state_events.create({\n :previous_state => \"cart\",\n :next_state => \"complete\",\n :name => \"order\" ,\n :user_id => (User.respond_to?(:current) && User.current.try(:id)) || self.user_id\n })\n end", "def cancel\n\n unschedule_timeout(nil)\n\n cancel_participant\n\n trigger_on_cancel # if any\n\n @applied_workitem\n end", "def cancel!\n if AccountTransaction.transfer(self.num * self.price, self.startup.account, self.startup.account, :escrow, :balance).new_record?\n self.errors.add(:num, 'could not be refunded to your startup\\'s balance') \n return false\n end\n if self.responses.count > 0\n self.num = 0\n self.save\n else\n self.destroy\n end\n end", "def remove\n\t\t# se o usuário não entiver infectado e já existir o inventário salvo, remove a quantidade no inventário\n\t\tunless User.healthy? inventory_params[:user_id]\n \t \trender json: { error: \"Denied access. User is contaminated!\" }, status: 403 and return\n\t\tend\n\n\t\tif @inventory.remove(inventory_params[:amount].to_i)\n\t\t\trender json: @inventory, status: 200\n\t\telse\n\t\t\trender json: @inventory.errors, status: :unprocessable_entity\n\t\tend\n\tend", "def on_cancel_select\n @tb_item = nil\n $game_temp.tb_item = nil\n move_pos_off\n end", "def mark_as_cancelled\n update({\n stripe_status: 'canceled',\n ends_at: Time.current,\n })\n end", "def void_last_transaction\n #binding.pry\n @total -= @last_price * @last_quantity\n @last_quantity.times do\n @items.pop\n end\n\n end", "def deduct_quantity\n line_items.each do |i|\n i.product.current_stock -= i.quantity\n i.product.save\n end\n end", "def void_last_transaction\n transaction = @transactions.pop\n self.total -= (transaction.price * transaction.quantity)\n transaction.quantity.times{self.items.delete(transaction.item_name)}\n end", "def cancel\n self.update_status :cancelled\n end", "def cancel\n @calculator.retrieve_pending_amount\n end", "def after_cancel\n restock_items!\n\n #TODO: make_shipments_pending\n Spree::OrderMailer.cancel_email(self).deliver\n Spree::OrderMailer.cancel_email_retailer(self).deliver\n unless %w(partial shipped delivered).include?(shipment_state)\n self.payment_state = 'credit_owed'\n end\n end", "def remove_item\n product = Product.find_by_cs_sku(params[:sku])\n item = ReservedItem.find_by_sql(['SELECT qty FROM reserved_items where user_id = ? and product_id = ? and session_id = ?',\n current_user.id,\n product.id,\n session.id]).first\n unless item.nil?\n product.update_attribute(:qty, product.qty + item.qty)\n ReservedItem.delete_all(['user_id = ? and product_id = ? and session_id = ?', current_user.id,\n product.id,\n session.id])\n end\n\n respond_with_format { @cart.remove_item params[:sku] }\n end", "def finalize!\n update_attribute(:completed_at, Time.now)\n update_attribute(:payment_method_name, self.payment_method.name) unless self.payment_method_name\n self.out_of_stock_items = InventoryUnit.assign_opening_inventory(self)\n # lock any optional adjustments (coupon promotions, etc.)\n adjustments.optional.each { |adjustment| adjustment.update_attribute(\"locked\", true) }\n\n self.state_events.create({\n :previous_state => \"cart\",\n :next_state => \"complete\",\n :name => \"order\" ,\n :user_id => (User.respond_to?(:current) && User.current.try(:id)) || self.user_id\n })\n end", "def cancel\n\t\tputs \"Cancelling #{self.student.forename} #{self.student.surname}'s enrollment in #{self.course.title}\"\n\n\t\tself.is_cancelled = true\n\t\tself.save\n\n\t\tmessage = \"Your cancellation was successful. You have not received a refund.\"\n\n\t\tif refund_amount > 0\n\t\t\tmessage = \"Your cancellation was successful. You will receive your refund within 48 hours.\"\n\t\tend\n\n\t\tPaymentMailer.refund_processing(self).deliver\n\n\t\treturn message\n\tend", "def refund!\n if charged && !canceled\n transaction = Stripe::Charge.retrieve(trans_id)\n if transaction.refund\n update updated: true, canceled: true\n else\n raise result.errors\n end\n end\n end", "def item_inventory_update\n \n item = Item.find(params[:item_id])\n order= Order.find(params[:id])\n item_order = ItemOrder.where(item_id: item.id, order_id: order.id).first\n new_inventory = item.inventory - item_order.quantity\n item_order.update(status: \"fulfilled\")\n item.update(inventory: new_inventory)\n end", "def cancel!\n self.update_attributes(status: CANCELLED)\n #self.line_items.update_attributes(status: LineItem::CANCELLED)\n end", "def cancel!\n state_guard { modify_call 'Status' => 'cancelled' }\n end", "def cancel_hold\n if self.status == 'Held'\n create_delivery('HoldCancelled', :details => \"The hold on this message has been removed without action.\")\n end\n end", "def cancel\n end", "def cancel\n end", "def reduce_inventory\n begin\n if @product_available_stock.update_attribute(:items_count,\n @product_available_stock.items_count -\n inventory_stock_params[:items_count])\n response = {message: 'Inventory has been reduced of particular product stock of in specified distribution center.'}\n status_code = 200\n else\n response = {errors:\n [{detail: \"We can't apply this operation at this time, please try later.\"}]}\n status_code = 403\n end\n rescue => ex\n response = {errors: [{detail: ex.message}]}\n status_code = 403\n end\n render json: response, status: status_code\n end", "def reset_items_unit1; reset_items(@trade_win1, @item_window,@tb_unit); end", "def reset_items_unit2; reset_items(@trade_win2, @item_window2,@tb_unit2); end", "def update_inventory\n self.order_items.each { |item| item.variant.add_pending_to_customer }\n end", "def unequip!\n self.slot = EquipSlot::Inventory\n self.save!\n end", "def refill(item_name:, quantity:)\n total_items_quantity[item_name] += quantity\n items_running_low[item_name] = false\n end", "def cancel \n unless self.status == 'canceled'\n ev = Event.create(\n :event_type => :subscription,\n :event_subtype => :cancel,\n :user => self.user,\n :detail_i1 => self.id\n ) \n \n Rails::logger.debug \"Calling chargify to cancel subscription ID #{self.chargify_id}\" \n Sherlock::Chargify.new.cancel(self.chargify_id) \n \n Rails::logger.debug \"Adjusting my own status to 'canceled'\" \n \n self.status = 'canceled'\n self.save\n \n ev.finish\n \n InfusionsoftUtils.update_contact(self)\n end\n \n end", "def cancel\n @order.cancel\n render_update @order\n end", "def on_pou_cancel\n @unit_list_swap_items.show\n @unit_list_swap_items.select(0)\n deactivate_all_but(@unit_list_swap_items)\n @unit_list_swap_items.activate\n @unit_list_swap_items.refresh\n @basic_text_win.show\n @party_or_unit_win.hide\n end", "def purchase\n @order = current_order\n @order_items = @order.order_items\n @order_items.each do |item|\n new_inventory = Product.find(item.product_id).inventory_count - item.quantity\n Product.update(item.product_id, inventory_count: new_inventory)\n end\n @order_items.destroy_all\n end", "def checkout\n @current_cart.adjust_inventory\n @current_cart.mark_submited\n current_user.remove_current_cart\n redirect_to cart_path(@current_cart)\n end", "def update_cart\n product = Product.find_by_cs_sku(params[:sku])\n item = ReservedItem.where('user_id = ? and product_id = ? and session_id = ?', current_user.id,\n product.id,\n session.id).first\n qty = BigDecimal.new(get_qty)\n\n if available?(product, item, qty)\n product.update_attribute(:qty, (product.qty + item.qty) - qty)\n item.update_attribute(:qty, qty)\n respond_with_format { @cart.update_item(params[:sku], get_qty) }\n else\n flash[:error] = 'Not enough item in inventory'\n respond_with_format\n end\n end", "def toggle_down_inventory\n self.available_inventory -= 1\n self.save\n\n return self.available_inventory\n end", "def cancel\n @error = :cancelled\n end", "def cancel\n self.solved(:abort)\n end", "def cancel_mix_items\n actor = BattleManager.actor\n if actor && actor.input.mixed_item\n BattleManager.actor.return_last_mix_items\n BattleManager.actor.input.mixed_item = false\n end\n end", "def cancel_refund\n price - price * cancel_factor\n end", "def clear_inventory\n while @inventory.size.nonzero?\n @inventory.pop\n end\n end", "def consume_items(item_quantities)\n item_quantities.each do |ingredient_name, quantity|\n @ingredients[ingredient_name] = @ingredients[ingredient_name] - quantity\n end\n end", "def cancel\n throw(:abort)\n end", "def release_quantity_of_item(item, quantity)\r\n if self.items.include?(item)\r\n item.quantity -= quantity\r\n end\r\n end", "def void_last_transaction\n self.total -= self.last_item * self.last_quantity\n self.cart.pop\n if self.cart.length <= 0\n self.total = 0.0\n end\n # binding.pry\n end", "def apply\n agent = @engine.item_by_name(@name)\n agent.state[\"busy\"] -= 1 if agent.state[\"busy\"] > 0\n end", "def cancel\n super\n end", "def refill_stock\n @areas[:waste].tap { |waste|\n waste.cards.reverse_each do |card|\n @areas[:stock].add_from(waste.piles.first, card)\n end\n }\n end", "def void_last_transaction\n @items.slice!(@items.length-@last_qty, @items.length)\n @total -= @last_transaction.values[0]\n end", "def cancel\n super\n end", "def reset_items(trade_win, item_win, unit)\n trade_win.items.each do |item|\n unit.gain_item(item, trade_win.item_number(item))\n end\n trade_win.clear_data\n trade_win.refresh\n item_win.refresh\n end", "def cancel; end", "def cancel; end", "def cancel(_response_code)\n active_merchant_response(true, 'PayUIn will automatically capture the amount after creating a shipment.')\n end", "def recharge!\n if charged && !canceled\n refund!\n charge!\n end\n end", "def cancel\r\n # @todo Emit a warning for attempts to cancel an action after it's been\r\n # executed\r\n @cancelled = true\r\n end", "def refund!\n response = credit_card.credit!(total_amount_in_cents, payment.authorization)\n self.response = response\n self.description = response.message\n self.authorization = response.authorization\n if response.success?\n invoice.update_attribute(:status, \"closed\")\n self.status = \"cleared\"\n self.save!\n return true\n else\n self.status = \"failed\"\n for item in self.line_items\n item.amount = 0\n end\n self.save!\n return false\n end\n end", "def cancel\n\n get_expression_pool.cancel(@children[0]) if @applied_workitem\n\n unschedule_timeout(nil)\n\n trigger_on_cancel # if any\n\n #super\n @applied_workitem\n end", "def reclaim!(distribution)\n ActiveRecord::Base.transaction do\n distribution.line_items.each do |line_item|\n inventory_item = self.inventory_items.find_by(item: line_item.item)\n inventory_item.update_attribute(:quantity, inventory_item.quantity + line_item.quantity)\n end\n end\n distribution.destroy\n end", "def cancel!\n if transfer.present? && transfer.complete?\n return!\n update cancelled_at: Time.current\n else\n transfer.destroy! if transfer.present?\n destroy!\n end\n order.update_shipped!\n end", "def cancel\n\t\tself.status = 'Canceled'\n\t\tself.save(validate: false)\n\tend", "def cancel\n super\n end", "def cancel\n super\n end", "def cancel\n super\n end", "def dispose_item(item)\n if self == item.owner\n equipments.delete(item.in_slot) if EquipmentSlots.include? item.in_slot\n item.destroy\n # TODO: notify\n end\n end", "def unequip_item\n\t\tself.equiped = false\n\t\tself.save\n\tend", "def modInventory(opn)\n listProducts\n\n print \"Please Choose the Product : \"\n prod = @@products[gets.to_i - 1]\n\n if opn == \"add\"\n print \"Please provide number of Units to be added to Inventory : \"\n units = gets.to_i\n post_add_units = prod.units + units\n puts \"post_add_units : #{post_add_units}, prod_max_stock : #{prod.max_stock}\"\n\n if (prod.max_stock < post_add_units)\n prod.units += units\n else \n puts \"Oops! Maximum stock limit is getting exceeded. We can not accomodate #{units}-more units! :(\"\n end\n\n if prod.max_stock - prod.units <= 2\n puts \"\\n ***** Inventory Alert ***** \\n We can only accomodate #{prod.max_stock - prod.units} more Units. \\n Please do the needful to release some Inventory.\"\n end\n end\n\n if opn == \"remove\"\n print \"Please provide number of Units to be removed from Inventory : \"\n units = gets.to_i\n post_remove_units = prod.units - units\n\n if prod.min_stock > post_remove_units\n prod.units -= units\n else \n puts \"Oops! Minimum stock limit is getting breached. We can not release #{units}-more units! :(\"\n end\n\n if prod.units - prod.min_stock <= 2\n puts \"\\n ***** Inventory Alert ***** \\n We have only #{prod.units} more Units of #{prod.name} in Stock. \\n Please do the needful to procure some Inventory.\"\n end\n end\n end", "def cancel\n find_order\n @order.cancel! unless @order.canceled?\n settle_payments_if_desired\n render text: @settlement_results.to_json\n end", "def cancel!\n update(request_cancelled: true)\n end", "def cancel\n # Define this later\n end", "def stock_minus(product, amount)\n product = Product.find(product)\n quantity = product.quantity\n quantity -= amount.to_i\n product.update(quantity: quantity)\n end", "def void_last_transaction\n @items.pop\n @total -= @transactions.pop\n end", "def purchase_stock!\n nil\n end", "def cancel\n super\n end", "def cancel\n super\n end", "def cancel\n super\n end", "def cancel\n super\n end", "def cancel\n super\n end" ]
[ "0.65056944", "0.6341625", "0.631424", "0.631424", "0.61565065", "0.6146577", "0.6071971", "0.60280967", "0.60010153", "0.599832", "0.5982014", "0.59549403", "0.5896678", "0.589055", "0.58457714", "0.58274955", "0.582329", "0.57932764", "0.57355887", "0.5729849", "0.5717289", "0.5701618", "0.5677206", "0.5664356", "0.5656976", "0.56344604", "0.56289256", "0.56246096", "0.5620245", "0.5616189", "0.56111676", "0.5607032", "0.560244", "0.5598815", "0.5596322", "0.5594164", "0.55914617", "0.55869085", "0.55842596", "0.5580484", "0.5575512", "0.557298", "0.5567015", "0.5556958", "0.5556958", "0.5555472", "0.5552868", "0.55386835", "0.5535799", "0.55237365", "0.5521489", "0.5520296", "0.55201083", "0.5514639", "0.55076605", "0.55054194", "0.5499326", "0.54970473", "0.5492638", "0.54617304", "0.5452242", "0.544134", "0.5439373", "0.542528", "0.54188484", "0.54155546", "0.54145706", "0.5412496", "0.54019016", "0.5399927", "0.5391497", "0.5383708", "0.5368437", "0.5366539", "0.5366539", "0.53641355", "0.53630793", "0.53582036", "0.53557414", "0.53516424", "0.53479373", "0.53439194", "0.533028", "0.5323344", "0.5323344", "0.5323344", "0.5316302", "0.5314723", "0.53116924", "0.5308718", "0.53052366", "0.5301762", "0.52985644", "0.52932906", "0.52884346", "0.5287443", "0.5287443", "0.5287443", "0.5287443", "0.5287443" ]
0.67158717
0
if any shipments are now fully shipped then mark them as such
def update_shipped_shipments(inventory_units) shipments = Spree::Shipment. includes(:inventory_units). where(id: inventory_units.map(&:shipment_id)). to_a shipments.each do |shipment| if shipment.inventory_units.all? { |iu| iu.shipped? || iu.canceled? } shipment.update_attributes!(state: 'shipped', shipped_at: Time.current) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def after_ship\n inventory_units.each { |u| u.ship! if u.can_ship? && !u.state?('shipped') }\n end", "def mark_as_shipped\n self.shipped_at = Time.now\n end", "def shipped\n \n end", "def mark_as_shipped\n @context.no_going_back\n\n list = @data.display_list\n update_from_form(list)\n\n list.each do |address_entry|\n address_entry.each_order do |order_info|\n next unless order_info.ship_order\n\n order = Order.with_id(order_info.order_id)\n\n if order\n order.mark_as_shipped\n else\n raise \"Missing order\"\n end\n\n end\n end\n @session.pop\n end", "def after_ship\n inventory_units.each &:ship!\n Spree::OrderMailer.giftor_shipped_email(self.order).deliver() unless Spree::MailLog.has_email_been_sent_already?(self.order, 'Order::giftor_shipped_email')\n Spree::OrderMailer.giftee_shipped_email(self.order).deliver() if (self.order.is_gift? && !self.order.gift.email.blank? && !Spree::MailLog.has_email_been_sent_already?(order, 'Order::giftee_shipped_email'))\n end", "def ship\n count = 0\n if things_to_ship = params[:to_be_shipped]\n count = do_shipping(things_to_ship)\n if count > 0\n count_text = pluralize(count, \"order\")\n flash.now[:notice] = \"#{count_text} marked as shipped\"\n end\n end\n @pending_orders = Order.pending_shipping\n end", "def fully_shipped?\n shipments.where(partial: false).where(\"shipped_at IS NOT NULL\").any?\n end", "def mark_as_shipped\n each_line {|li| li.mark_as_shipped}\n end", "def shipped\n order = Order.second\n items = LineItem.where(order_id: order.id)\n items.each do |item|\n order.line_items << item\n end\n OrderNotifier.shipped(order)\n end", "def shipped?\n !!self.shipped_at?\n end", "def shippable?\n status != \"shipped\" && products.count >= 1\n end", "def shipped?\n shipped == true\n end", "def shipped\n OrderNotifier.shipped\n end", "def shipped\n OrderNotifier.shipped\n end", "def shipped\n OrderNotifer.shipped\n end", "def update_shipment_state\n # get all the shipment states for this order\n shipment_states = shipments.states\n if shipment_states.size > 1\n # multiple shiment states means it's most likely partially shipped\n self.shipment_state = 'partial'\n else\n # will return nil if no shipments are found\n self.shipment_state = shipment_states.first\n if self.shipment_state\n # shipments exist but there are unassigned inventory units\n self.shipment_state = 'partial'\n end\n end\n\n self.state_changed('shipment')\n end", "def shipped\n OrderNotified.shipped\n end", "def track_shipments?\n !store.disable_shipment_transfers?\n end", "def shipments(force=false)\n if !force and defined? @shipment\n @shipment\n elsif force or (self.shipping? and Shipment.possible_status.include? self.shipping.status)\n @shipment = super\n end\n end", "def mark_stuff_shipped(values)\n values['address_list'] = @data.display_list.map do |address|\n address.add_to_hash({})\n end\n\n values['update_url'] = url(:mark_as_shipped)\n standard_page(\"Confirm Shipping\", values, CONFIRM_SHIPPING)\n end", "def shipped\n OrderNitifierMailer.shipped\n end", "def ship(tracking_number, shipped_at)\n if Spree::Config.dmi_capture_on_ship\n success = capture_pending_payments && update_shipments(tracking_number, shipped_at)\n else\n success = update_shipments(tracking_number, shipped_at)\n end\n\n log_shipping_errors unless success\n success\n end", "def shipped\n order = Order.last\n\n OrderMailer.shipped(order)\n end", "def entirely_unshipped?\n line_items_uncancelled.empty?.not && line_items_uncancelled.detect {|li| ! li.shipment.nil? }.nil?\n end", "def can_be_shipped?\n self.tags.each do |tag|\n if tag.key == 'Not Shipped'\n return false\n end\n end\n true\n end", "def update_shipments\n shipping_method_filter = order.completed? ? ShippingMethod::DISPLAY_ON_BACK_END : ShippingMethod::DISPLAY_ON_FRONT_END\n\n shipments.each do |shipment|\n next unless shipment.persisted?\n\n shipment.update!(order)\n shipment.refresh_rates(shipping_method_filter)\n shipment.update_amounts\n end\n end", "def vendor\n @shipments = Spree::Shipment.where(stock_location_id: current_spree_user.stock_locations.first.id, state: \"pending\").joins(:order).where(spree_orders: {state: 'complete'}).order(created_at: :asc)\n end", "def order_shipped\n\t\torder = Order.first\n\t\tOrderMailer.order_shipped(order)\n end", "def update_shipments(tracking_number, shipped_at)\n shipment = order.shipments.first\n\n shipment.shipped_at = shipped_at\n shipment.tracking = tracking_number\n success = shipment.ship\n\n copy_errors(shipment) unless success\n success\n end", "def check_and_update_prepaid_shipment_status!\n update_attribute(:shipment_status_checked_at, Time.zone.now)\n ship! if SHIPPING_LABELS.shipped?(shipping_label.tx_id)\n end", "def shipped\n Notifier.shipped\n end", "def apply_free_shippling_rule\n if (@subtotal > 100.00 || @customer[:state] == 'IL') # If subtotal greater than 100 or state is IL\n if !(@line_items.detect { |item| item.sku == '123' }) # If a particular item is not present\n @shipping_charge = 0\n end\n end\n end", "def shipped?\n ! ship_date.blank?\n end", "def complete!\n return false unless pending? && transfer.feasible?\n transfer.complete!\n update shipped_at: Time.current\n order.update_shipped!\n email.shipment(to: order.billing_recipient)&.deliver_later if order.billing_address.present?\n email.shipment(to: order.shipping_recipient, bcc: false)&.deliver_later if order.has_contact_email?\n true\n end", "def ship\n if @reservation.update(ship_params) && @reservation.ship\n redirect_to reservations_path, notice: \"Reservation shipped.\"\n else\n render :mark_shipped, alert: @reservation.errors\n end\n end", "def shipped=(value)\n return unless value == '1' && shipped_at.nil?\n self.shipped_at = Time.current\n end", "def ship\n raise NotAllowed unless submitted?\n raise NotAllowed if shipped?\n\n apply(Orders::OrderShipped.strict(data: {\n order_uuid: @uuid,\n order_number: @number\n }))\n end", "def shipped\n OrderNotifierMailer.shipped\n end", "def in_shipped_list?\n MeadSchedulerService.in_shipped_list?(self.task.prod, name)\n end", "def shipped\n OrderinshopMailer.shipped\n end", "def shipped\n OrderMailer.shipped\n end", "def shipped\n OrderMailer.shipped\n end", "def update_shipped!\n update!(shipped: completed_transfer_items.sum(:amount))\n end", "def mark_shipped\n @orderproduct = OrderProduct.find(params[:current_order_product].to_i)\n @orderproduct.shipped = true\n @orderproduct.save\n\n redirect_to selling_history_path\n end", "def ship_items\n if current_user && current_user.seller\n @cart_item = CartItem.find_by(cart_id: params[:cart_id], item_id: params[:item_id])\n @cart_item.update(shipped: true)\n redirect_to buyer_orders_path\n else\n redirec_to root_path\n end\n end", "def update_shipment_state\n self.shipment_state =\n case shipments.count\n when 0\n nil\n when shipments.delivered.count\n 'delivered'\n when shipments.shipped.count\n 'shipped'\n when shipments.ready.count\n 'ready'\n when shipments.pending.count\n 'pending'\n else\n 'partial'\n end\n self.shipment_state = 'backorder' if backordered?\n\n if old_shipment_state = self.changed_attributes['shipment_state']\n self.state_events.create({\n :previous_state => old_shipment_state,\n :next_state => self.shipment_state,\n :name => 'shipment',\n :user_id => (Spree::User.respond_to?(:current) && Spree::User.current && Spree::User.current.id) || self.user_id\n })\n end\n end", "def turn_off_multiple_shipment_charges\n multiple_shipping_charges = self.adjustable.adjustments.where(:source_type => \"Spree::Shipment\")\n if multiple_shipping_charges.length > 1\n multiple_shipping_charges.each_with_index do |shipping_charges, index|\n next if index == 0\n shipping_charges.update_attribute_without_callbacks(:amount, 0)\n shipping_charges.update_attribute_without_callbacks(:eligible, false)\n end\n end\n end", "def shipping?\n each_line do |line|\n # has it shipped?\n return true if line.li_date_shipped\n # or is it queued up for shipping?\n return true if Ship.for_line_item(line)\n end\n return false\n end", "def ship_sunk?\n @ship_sunk\n end", "def check_total_shipped\n total_shipped = self.other_receivable_shipments.sum(:receivable_shipment_count) + self.receivable_shipment_count.to_f\n if total_shipped > self.so_line.so_line_shipped\n errors.add(:receivable_shipment_count, \"exceeded than total shipped!\")\n end\n end", "def ship!(consignment_number, user = nil)\n run_callbacks :ship do\n self.shipped_at = Time.now\n self.shipper = user if user\n self.status = 'shipped'\n self.consignment_number = consignment_number\n self.save!\n Shoppe::OrderMailer.shipped(self).deliver_now\n end\n end", "def ship\n load_info\n @shipment = Shipment.includes({:order_items => :variant}).find(params[:id])\n\n respond_to do |format|\n if @shipment.ship!\n format.html { redirect_to(admin_fulfillment_shipment_path(@shipment, :order_id => @shipment.order.number), :notice => 'Shipment was successfully updated.') }\n else\n format.html { redirect_to(admin_fulfillment_shipment_path(@shipment, :order_id => @shipment.order.number), :error => 'Shipment could not be shipped!!!') }\n end\n end\n end", "def ship\n load_info\n @shipment = Shipment.includes({:order_items => :variant}).find(params[:id])\n\n respond_to do |format|\n if @shipment.ship!\n format.html { redirect_to(admin_fulfillment_shipment_path(@shipment, :order_id => @shipment.order.number), :notice => 'Shipment was successfully updated.') }\n else\n format.html { redirect_to(admin_fulfillment_shipment_path(@shipment, :order_id => @shipment.order.number), :error => 'Shipment could not be shipped!!!') }\n end\n end\n end", "def update_shipment_state\n if order.backordered?\n order.shipment_state = 'backorder'\n else\n # get all the shipment states for this order\n shipment_states = shipments.states\n order.shipment_state = if shipment_states.size > 1\n # multiple shipment states means it's most likely partially shipped\n 'partial'\n else\n # will return nil if no shipments are found\n shipment_states.first\n # TODO: inventory unit states?\n # if order.shipment_state && order.inventory_units.where(shipment_id: nil).exists?\n # shipments exist but there are unassigned inventory units\n # order.shipment_state = 'partial'\n # end\n end\n end\n\n order.state_changed('shipment')\n order.shipment_state\n end", "def has_ships_still_floating?\n end", "def fire\n if @shipment.partial_shipped?\n @shipment.send_shipment_mail\n flash.notice = \"Mail has been sent\"\n else\n flash[:error] = \"Can not send shipping mail without any shipping events!\" \n end\n respond_with(@shipment) { |format| format.html { redirect_to :back } }\n end", "def ship_order\n self.update_attributes(status: 2)\n end", "def shipped\n CommentMailer.shipped\n end", "def split_shipment!\n self.shipments.destroy_all\n units = self.inventory_units.includes(:variant=>:product)\n units.group_by{|u| u.variant.product.brand_id}.each do |brand_id,units|\n s = Spree::Shipment.create!({ :order => self, :shipping_method => shipping_method, :address => self.ship_address,\n :inventory_units => units}, :without_protection => true)\n end\n end", "def handle_ship(ship, events)\n found = false\n events.each do |event|\n if ship.summary === event.summary then\n update_event(ship, event)\n found = true\n end\n end\n\n if not found then\n insert_event(ship)\n end\n\n end", "def mark_order_shipped(transaction_id, postal_company, tracking_number)\n\t\t\t\trequest = MarkOrderShipped::Request.new(\n\t\t\t\t\ttransaction_id: transaction_id,\n\t\t\t\t\tpostal_company: postal_company,\n\t\t\t\t\ttracking_number: tracking_number\n\t\t\t\t)\n\t\t\t\tresponse = call(request)\n\t\t\t\treturn response\n\t\t\tend", "def put_ship(ship)\n return false if ship.cordinates.map{ |x| @board[x]}.reduce(:+) != EMPTY\n ship.cordinates.map{ |x| @board[x] = ship.size}\n true\n end", "def shipped(order)\n @order = order\n\n mail to: order.email, subject: \"Your Favorite Store Order Shipped\"\n end", "def shipped\n corresponding_item = self.item.take\n current_inventory = corresponding_item.inventory_level\n corresponding_item.update_attribute(:inventory_level, (self.quantity + current_inventory)) unless previous.nil?\n self.update_attribute(:shipped_on, date.current.to_date)\n\n def item_exists_and_active?\n all_active_items = Item.active.all.map(&:id)\n if all_active_items.include?(self.item_id)\n return true\n end\n errors.add(:item_id, \"is not an active item at the chess store\")\n return false\n end\n\n def subtotal(date = nil)\n end\n\n def valid_quantity?\n if self.quantity >= 0\n return true\n end\n stock_quantity = self.item.inventory_level\n if (self.quantity* -1) > stock_quantity\n errors.add(:quantity, \"too much purchase quantity\")\n return false\n end\n return true\n end\nend", "def free?\n ship.nil? && neighbors.all? { |t| t.ship.nil? }\n end", "def fully_paid\n self.status = Enums::PaymentStatus::PAYMENT_RECEIVED\n self.paid_on = Date.current\n self.locked = true\n update_estimated_delivery_date unless fully_shipped?\n end", "def upload_shipped_file\n require 'fileutils'\n nmd = process_uploaded_file(params, :file_upload)\n return if nmd == false\n \n last_batch = ReadyForShipmentBatch.last\n \n unless last_batch.nil?\n if already_uploaded_this_acf?(nmd)\n @header = \"You already uploaded this address_completion_file on #{last_batch.created_at}\"\n @body = \"Did you perhaps mix up ACFs? Perhaps there's a serious bug?\"\n return\n end\n end\n \n shipped = nmd.sales\n erroneous = nmd.erroneous_sales\n \n changes_in_sales = calculate_changes_in_sales(nmd)\n \n # mark successfull sales as shipped and unmark them prepped...\n shipped.each do |sale|\n Sale.find(sale[\"id\"]).update_attributes(shipped: Time.now, prepped: false)\n end\n \n # Mark erroneous sales as erroneous\n erroneous.each do |sale|\n sale_record = Sale.find(sale[\"id\"])\n a = sale_record.address\n address_id = a.id\n \n # find all the sales with this exact address\n sales_with_this_address = Sale.find_all_by_address_id(address_id)\n \n sales_with_this_address.each do |s|\n s.prepped = false\n s.save\n end\n a.erroneous = true\n a.save\n end\n \n \n rfsb = ReadyForShipmentBatch.find_by_batch_stamp(nmd.ready_for_shipment_batch[\"batch_stamp\"])\n rfsb.update_attributes(acf_integrity_hash: nmd.integrity_hash)\n \n @header = \"You just uploaded a confirmation file of shipped POs!\"\n @body = \"There were #{changes_in_sales[0]} sales marked shipped and #{changes_in_sales[1]} addresses marked erroneous\"\n end", "def full?\n @docked_ship_ids.length >= docking_spots\n end", "def check_and_update_delivery_status!\n update_attribute(:delivery_status_checked_at, Time.zone.now)\n deliver! if dummy_tracking? || (carrier && carrier.delivered?(tracking_number))\n end", "def shipped(order)\n @order = order \n\n mail to: order.email, subject: 'justEat Order Shipped'\n end", "def set_shipper_update\n if order_status_id == 1\n Order.find(id).update_column(:shipper_id, 7)\n Order.find(id).update_column(:ship_date, nil)\n Order.find(id).update_column(:shipping_number, nil)\n end\n end", "def today_shipments\n @shipments = Shipment.today_shipments\n end", "def before_delivery\r\n return if params[:order].present?\r\n \r\n if @order.bill_address.address1 == 'dummy_address1' or @order.bill_address.city == 'dummy_city' or @order.bill_address.address2.include? \"CityBox\"\r\n @disable_all_except_citybox = true\r\n end\r\n\r\n packages = @order.shipments.map { |s| s.to_package }\r\n @differentiator = Spree::Stock::Differentiator.new(@order, packages)\r\n end", "def order_shipped\n @order = order\n\n mail :to => \"sandra_sovane@inbox.lv\", :subject => 'Pragmatic Store Order Shipped'\n end", "def shipped(order)\n @order = order\n\n mail to: order.email, subject: '8 facts you will never believe! Doctors hate it!'\n end", "def order_shipped(order)\n @order = order\n\n mail :subject => \"order shipped!\"\n end", "def shippable?\n can_supply? && !(on_hold? || collection?)\n end", "def shipping?\n true\n end", "def update\n @shipment.address = @shipment_presenter.address \n @shipment.tracking = @shipment_presenter.shipment.tracking\n @shipment.cost = @shipment_presenter.shipment.cost\n @shipment.shipped_at = Time.now if params[:mark_shipped] \n unless @shipment_presenter.valid? and @shipment.save\n render :action => \"edit\" and return\n end\n @order.state_events.create(:name => t('ship'), :user => current_user, :previous_state => @order.state) if params[:mark_shipped]\n flash[:notice] = t('updated_successfully')\n redirect_to edit_object_url\n end", "def shipped(order)\n @order = order\n\n mail to: order.email,subject: \"Pragmatic Store Order Shipped\"\n end", "def shipped(order)\n @order=order\n mail(\n to: order.email,\n subject: 'BookShelf Order Shipped',\n from: \"BookShelf\",\n return_path: \"morozhunce@gmail.com\",\n date: Time.now,\n template_path: 'order_notifier',\n template_name: 'shipped'\n )\n end", "def shipped(order)\n @order = order\n\n mail to: order.email, subject: 'Pragmatic Store Order Shipped'\n end", "def handle_stock_counts?\n current_shipment.order.completed? && current_stock_location != desired_stock_location\n end", "def process\n Trade::Shipment.update_all(\n { taxon_concept_id: @taxon_relationship.taxon_concept_id },\n {\n taxon_concept_id: @old_taxon_relationship.taxon_concept_id,\n reported_taxon_concept_id: @taxon_relationship.other_taxon_concept_id\n }\n )\n end", "def shipped(order)\n @order = order\n\n mail to: order.email, subject: 'Fast Find Auto Parts Order Shipped'\n end", "def shipped(order)\n @order = order\n\n mail to: order.e_mail, subject: 'Eloctronic Shop Order Shipped'\n end", "def package_level_delivery_confirmation?(shipment)\n origin, destination = shipment.origin.country.code, shipment.destination.country.code\n origin == destination || [['US', 'PR'], ['PR', 'US']].include?([origin, destination])\n end", "def shipped(order)\n @order = order\n mail to: order.email, subject: 'Pragmatic Store Order shipped'\n end", "def notify_final_delivery\n @reports = Reports.get_all_reports\n @delivery = Packages.get_all_packages\n if( @delivery != nil ) && ( @reports != nil )\n @reports.each do|t|\n @delivery.each do|s|\n if( ( t.reported_id == s.senders_id ) && ( s.finalDelivery == false ) && ( t.packages_id == s.id ) )\n @notification = Notifications.create(s.senders_id, \"You should confirm the final delivery\")\n end\n end\n end\n end\n return;\n end", "def void_pending_purchase_orders\n self.purchase_orders.select(&:pending?).each {|o| o.void}\n end", "def notify_final_delivery\n @reports = Reports.find( :all )\n @delivery = Packages.find( :all )\n if( @delivery != nil ) && ( @reports != nil )\n @reports.each do|t|\n @delivery.each do|s|\n if( ( t.reported_id == s.senders_id ) && ( s.finalDelivery == false ) && ( t.packages_id == s.id ) )\n @notification = Notifications.new\n @notification.users_id = s.senders_id\n @notification.description = \"You should confirm the delivery of the package\"\n @notification.save\n end\n end\n end\n end\n return;\n end", "def order_shipped(order)\n \t@order = order\n mail to: order.email, subject: 'Pragmatic Store Order Shipped'\n end", "def shipped(order)\n @order = order\n mail to: \"sushicat16@yandex.ru\"\n end", "def shipped(order)\n @order = order\n \n mail :to => order.email, :subject => 'Montagna Verde Order Shipped'\n end", "def ship\n @shipment = @order.shipments.build(shipment_params)\n\n respond_to do |format|\n if @shipment.save\n @order.apply_shipping_cost!(@shipment)\n format.js { render :ship }\n else\n head :bad_request\n end\n end\n end", "def order_shipped\n @order = order\n\n mail to: order.email, subject: 'Objednávka z obchodu Pragmatická Ivona byla odeslána'\n end", "def shipped(order)\n @order = order\n\n puts \">> shipped order email sent\"\n\n mail to: @admin_email, subject: 'Pragmatic Store Order Shipped'\n end", "def force_ship(session)\n each_line do |line|\n PaymentActions.process_payment(session, \n line,\n self)\n end\n end", "def set_shipper_save\n if order_status_id == 1\n Order.find(id).update_column(:shipper_id, 7)\n Order.find(id).update_column(:ship_date, nil)\n Order.find(id).update_column(:shipping_number, nil)\n end\n end", "def run!\n # Validations here are intended to catch all necessary prerequisites.\n # We return early so all checks have happened already.\n return false if invalid?\n desired_shipment.save! if desired_shipment.new_record?\n\n # Retrieve how many on hand items we can take from desired stock location\n available_quantity = [desired_shipment.stock_location.count_on_hand(variant), 0].max\n\n new_on_hand_quantity = [available_quantity, quantity].min\n unstock_quantity = desired_shipment.stock_location.backorderable?(variant) ? quantity : new_on_hand_quantity\n\n ActiveRecord::Base.transaction do\n if handle_stock_counts?\n # We only run this query if we need it.\n current_on_hand_quantity = [current_shipment.inventory_units.pre_shipment.size, quantity].min\n\n # Restock things we will not fulfil from the current shipment anymore\n current_stock_location.restock(variant, current_on_hand_quantity, current_shipment)\n # Unstock what we will fulfil with the new shipment\n desired_stock_location.unstock(variant, unstock_quantity, desired_shipment)\n end\n\n # These two statements are the heart of this class. We change the number\n # of inventory units requested from one shipment to the other.\n # We order by state, because `'backordered' < 'on_hand'`.\n current_shipment.\n inventory_units.\n where(variant: variant).\n order(state: :asc).\n limit(new_on_hand_quantity).\n update_all(shipment_id: desired_shipment.id, state: :on_hand)\n\n current_shipment.\n inventory_units.\n where(variant: variant).\n order(state: :asc).\n limit(quantity - new_on_hand_quantity).\n update_all(shipment_id: desired_shipment.id, state: :backordered)\n end\n\n # We modified the inventory units at the database level for speed reasons.\n # The downside of that is that we need to reload the associations.\n current_shipment.inventory_units.reload\n desired_shipment.inventory_units.reload\n\n # If the current shipment now has no inventory units left, we won't need it any longer.\n if current_shipment.inventory_units.length.zero?\n current_shipment.destroy!\n else\n # The current shipment has changed, so we need to make sure that shipping rates\n # have the correct amount.\n current_shipment.refresh_rates\n end\n\n # The desired shipment has also change, so we need to make sure shipping rates\n # are up-to-date, too.\n desired_shipment.refresh_rates\n\n true\n end" ]
[ "0.75078195", "0.7410016", "0.73235494", "0.720803", "0.7173264", "0.7141775", "0.7078664", "0.70745313", "0.6990948", "0.6978275", "0.67967904", "0.6784475", "0.67810255", "0.67810255", "0.67527163", "0.67514145", "0.67463815", "0.67315227", "0.6694792", "0.6659854", "0.6650077", "0.6633398", "0.6629467", "0.6623355", "0.6594477", "0.65485823", "0.6548442", "0.6510924", "0.6499274", "0.6496607", "0.647118", "0.6455305", "0.64499396", "0.64258045", "0.64195675", "0.64094275", "0.6392984", "0.6388599", "0.637991", "0.6346919", "0.63454", "0.63454", "0.6309099", "0.6268748", "0.62602854", "0.6204447", "0.6181281", "0.61390865", "0.61293256", "0.6111992", "0.6107314", "0.60971135", "0.60971135", "0.6070326", "0.6068713", "0.6048137", "0.60227054", "0.601615", "0.6002509", "0.5967587", "0.5965762", "0.59411454", "0.5932097", "0.5930643", "0.59242725", "0.5901431", "0.5888889", "0.5880764", "0.58792335", "0.587637", "0.58748585", "0.5871016", "0.5857275", "0.5838321", "0.5834406", "0.5826539", "0.5825103", "0.58128893", "0.58014584", "0.5796794", "0.579371", "0.5791054", "0.57910395", "0.57814354", "0.5771918", "0.5768616", "0.5767994", "0.57671183", "0.5757568", "0.5756387", "0.57501364", "0.57243943", "0.5724042", "0.5701819", "0.569448", "0.5690651", "0.5687387", "0.56797385", "0.56754565", "0.5667708" ]
0.72758406
3
GET /reservacions GET /reservacions.json
def index @reservacions = Reservacion.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n render json: reservations\n end", "def employee_vacations\n #vacaciones de este año\n vacations = Employee.find(params[:id]).get_vacation_days\n\n respond_to do |format|\n format.json { render json: vacations }\n end\n end", "def index\n @vacations = User.find(params[:user_id]).vacations \n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @vacations }\n end\n end", "def index\n @reservations = Reservation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reservations }\n end\n end", "def index\n @reservations = Reservation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reservations }\n end\n end", "def index\n if user_signed_in?\n @reservations = current_user.reservations\n elsif owner_signed_in?\n @reservations = []\n # current_owner.restaurants.each {|rest| @reservations += rest.reservations}\n if current_owner.restaurant.blank?\n @reservations = []\n else\n @reservations = current_owner.restaurant.reservations\n end\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reservations }\n end\n end", "def index\n if user_signed_in?\n @reservations = current_user.reservations\n elsif owner_signed_in?\n @reservations = []\n # current_owner.restaurants.each {|rest| @reservations += rest.reservations}\n if current_owner.restaurant.blank?\n @reservations = []\n else\n @reservations = current_owner.restaurant.reservations\n end\n end\n @reservations = @reservations.order(\"id desc\").page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reservations }\n end\n end", "def index\n @reservations = V2::Reservation.order(id: :desc).page(params[:page])\n end", "def index\n unless User.admin_by_token?(request.cookies[\"token\"])\n render json: { error: \"invalid_token\" }, status: :unauthorized\n return\n end\n\n @reservations = prep_reservation\n render json: @reservations, status: :ok\n end", "def index\n\n if request.format == Mime::XML\n limit=params[:limit].nil? ? 1000: params[:limit]\n else\n limit=params[:limit].nil? ? 50 : params[:limit]\n end\n\n @reservations = Reservation.paginate :page => params[:page] || 1, :per_page => limit, :conditions => [\"user_id = ? AND historical = ?\", session[:user_id], 0], :order => \"id\"\n\n respond_to do |format|\n format.xml { render :xml => @reservations }\n format.any { render :json => @reservations }\n end\n end", "def display\n @reservas = Reserva.order(fecha_inicio_estadia: :desc)\n render json: @reservas, include: [:cliente, :habitacion]\n end", "def index\n @vacancies = Vacancy.all_vacancies# current_user.vacancies #\n render json: @vacancies\n end", "def index\n respond_to do |format|\n if current_user.try(:admin?)\n @reservations = Reservation.all\n else\n @reservations = Reservation.where(user_id: current_user)\n end\n format.html # index.html.erb\n format.json { render json: @reservations }\n end\n end", "def index\n @reservations = Reservation.all\n end", "def index\n @reservations = Reservation.all\n end", "def index\n @reservations = Reservation.all\n end", "def index\n @reservations = Reservation.all\n end", "def index\n @reservations = Reservation.all\n end", "def index\n @reservations = Reservation.all\n end", "def index\n @reservations = Reservation.all\n end", "def index\n @reservations = Reservation.all\n end", "def index\n @reservations = Reservation.all\n end", "def index\n @reservations = Reservation.all\n end", "def index\n @reservations = Reservation.all\n end", "def index\n @reservations = Reservation.all\n end", "def index\n @reservations = Reservation.all\n end", "def index\n @reservations = Reservation.all\n end", "def index\n @reservations = Reservation.all\n end", "def show_reservations\n user = User.find(current_user.id)\n @reservations = user.reservations\n end", "def index\n @reserves = Reserve.all\n end", "def index\n @reservas = Reserva.all\n end", "def index\n @reservas = Reserva.all\n end", "def index\n @reservations = @apartment.reservations.all\n end", "def index\n @reservations = Reservation.all.where(user_id: current_user.id)\n end", "def show\n @reserf = Reserve.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reserf }\n end\n end", "def index\n @vacation_requests = VacationRequest.all\n end", "def show\n @reservation = Reservation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reservation }\n end\n end", "def show\n @reservation = Reservation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reservation }\n end\n end", "def show\n @reservation = Reservation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reservation }\n end\n end", "def show\n @reservation = Reservation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reservation }\n end\n end", "def show\n @reservation = Reservation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reservation }\n end\n end", "def show\n @reservation = Reservation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reservation }\n end\n end", "def index\n @reservations = Reservation.is_public.confirmed.order(updated_at: :desc).limit(500)\n end", "def index\n @reservations = Reservation.all\n #@reservations = current_user.reservations\n end", "def index\n if current_user.role == \"user\"\n @reservations = current_user.reservations.includes(:alleys, :user).order(:date)\n elsif current_user.role == \"cashier\"\n @reservations = Reservation.includes(:alleys, :user).by_date Date.today\n else\n @reservations = Reservation.includes(:alleys, :user).order(:date).all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reservations }\n end\n end", "def index\n @reservations = Reservation.includes(:guest).all\n end", "def index\n @reservations = Reservation.all\n @reservation_statuses = @@reservation_statuses\n end", "def index\n if user_signed_in?\n @reservations = current_user.reservations\n elsif owner_signed_in?\n @reservations = []\n current_owner.restaurants.each {|rest| @reservations += rest.reservations}\n else\n redirect_to root_url, alert: \"Please, sign in!\" \n end\n end", "def vitals\n raise UserNotAuthenticated unless access_token\n\n get('records/vitals')\n end", "def index\n scope = apply_scopes(Reservation)\n @reservations = scope.respond_to?(:to_a) ? scope.to_a : scope.all\n @reservations = @reservations.paginate(page: params['page'])\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @reserve }\n end\n end", "def index\n @reservations = @user.reservations.active_total\n end", "def show\n @reservation = current_user.reservations.find(params[:id])\n respond_with(@reservation)\n end", "def index\n @reservation_owners = ReservationOwner.all\n end", "def index\n @reserve_stat_has_manifestations = ReserveStatHasManifestation.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @reserve_stat_has_manifestations }\n end\n end", "def index\n @preservatives = Preservative.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @preservatives }\n end\n end", "def index\n @reservations = Reservation.all.paginate(:page => params[:page]).per_page(10)\n authorize! :index, :Reservations\n end", "def index\n @curriculum_vitaes = findable_curriculum_vitaes.all\n respond_to do |format|\n format.html {}\n format.json { render json: @curriculum_vitaes }\n end\n end", "def show\n @vacation = Vacation.find(params[:id])\n @vacation.define_status\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vacation }\n end\n end", "def androidreserva\n\n @reservas = Reservation.all\n \n \n\n render :json => {\n :reservas => @reservas\n \n\n }\n\n \n end", "def index\n @reserved_dates = ReservedDate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reserved_dates }\n end\n end", "def show\n @vacancies = get_vacancies if params[:vacancies]\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @reserve_stat_has_manifestation }\n end\n end", "def reservations\n @reservations ||= flight.reservations\n end", "def index\n @reservations = @bus.reservations\n end", "def index\n #@agenda_reserv_resources = Agenda::ReservResource.all\n @agenda_reserv_resources = Agenda::ReservResource.search(params[:search]).order(\"#{sort_column} #{sort_direction}\").paginate(per_page: 15, page: params[:page])\n end", "def show\n @reserva = Reserva.includes(:outdoors, :checkin).find(params[:id])\n respond_with @reserva \n end", "def index\n space = Space.find(params[:space_id])\n group = Group.find(space.group_id)\n group_admin = User.find(group.user_id)\n member = Member.find_by(group_id: group.id, user_id: @current_user.id)\n if @current_user.id == group_admin.id\n @reservations = Reservation.where(space_id: params[:space_id])\n elsif member\n @reservations = Reservation.where(\n space_id: params[:space_id], \n member_id: member.id\n )\n end\n render json: @reservations\n end", "def get_by_property\n @api_v1_reservation = current_api_v1_user.properties.find(params[:id]).reservations\n render template: '/api/v1/reservations/index', status: 200\n rescue Exception => errors\n render json: errors, status: :unprocessable_entity\n end", "def index\n @reservations = current_user.reservations.joins(:menu_item).order('menu_items.date DESC, time_slot DESC')\n respond_with(@reservations)\n end", "def stats\n result = UserReservation.stats params[:id_list]\n render json: {revenue:result[:totalRevenue]}\n end", "def index\n\t\tvendas = Venda.all\n\t\trender json: vendas, status: :ok\n\tend", "def index\n @vacancies = Vacancy.all\n end", "def index\n @vacancies = Vacancy.all\n end", "def index\n @application_vacancies = ApplicationVacancy.all\n end", "def index\n @reservations = @user.reservations\n @reservations_json = []\n @reservations.each do |r|\n ro = r\n r = r.as_json\n %w{arrived email no_show owner_id}.each {|k| r.delete(k)}\n r[:start_time] = ro.start_time_format\n r[:end_time] = ro.end_time_format\n @reservations_json << r\n end\n\n render json: @reservations_json, status: 200 \n end", "def index\n @vacancies = current_user.employer_info.vacancies.all\n end", "def index\n @employee_reservations = Employee::Reservation.all\n end", "def index\n\n headers['Access-Control-Allow-Origin'] = '*'\n @reservations = Reservation.search(params[:search])\n respond_to do |format|\n # perform the standard login check for the html version of the request.\n # ( this will also render the default index template )\n format.html { check_if_admin_logged_in }\n format.json do\n # TODO: do knock authentication check here\n render json: @reservations, include: ['users','property']\n end\n end #respond_to\n end", "def index\n reservations = Reservation.all\n render('reservations/index',:locals => {:reservations => reservations})\n end", "def index\n @space_reservations = SpaceReservation.all\n end", "def show\n @ventas_seguimiento = Ventas::Seguimiento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ventas_seguimiento }\n end\n end", "def index\n @reserva_aceita = ReservaAceitum.all\n end", "def index\n @customer_reservations = CustomerReservation.all\n end", "def index\n @miniaturas_reservas = MiniaturasReserva.all\n end", "def index\n @reservationcs = Reservationc.all\n end", "def show\n @situacion_revistum = SituacionRevistum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @situacion_revistum }\n end\n end", "def index\n @tool_reservations = ToolReservation.all\n end", "def show\n render json: @vat\n end", "def index\n @user_reservations = query_reservations(user: current_user).paginate(page: params[:user_reservations_page], :per_page => 5)\n if current_user.is_admin?\n @awaiting_approval = query_reservations(status: 'requested')\n @all_reservations = query_reservations.paginate(page: params[:all_reservations_page], :per_page => 5)\n render :admin_index\n end\n end", "def index\n #@reservations = Reservation.all\n @reservations = current_user.reservations #.order(\"created_at DESC\")\n #@eateries = Eatery.all.order(\"created_at DESC\").paginate(:page => params[:page], :per_page => 5)\n end", "def index\n #@releases = Release.all\n @releases = Release.where(cashier_id: current_user.cashier.id, view: true)\n\n # respond_to do |format|\n # format.html # index.html.erb\n # format.json { render json: @releases }\n # end\n end", "def index\n @particular_vacancy_requests = ParticularVacancyRequest.all\n end", "def show\n render :json => @reservation, :include => {:customer => {:include => :user}}, status: :ok\n end", "def show\n @reservation = Reservation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.js\n format.json { render json: @reservation }\n end\n end", "def index\n @odsreserves = Odsreserf.all.page(params[:page])\n end", "def index\n @reservation_details = ReservationDetail.all\n end", "def index\n @content_for_title = I18n.t('.vacancies.index.page_title')\n @vacancies = @current_user.vacancies.paginate(:page => params[:page], :per_page => 8, order: \"created_at DESC\")\n @vacancies_max = @current_user.orders.sum(:quantity_remained, joins: :pricelist, conditions: {status: 1, pricelists: {entry_type: 3}}) + Job::VACANCIES_FREE\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vacancies }\n end\n end", "def index\n @vacinas = current_usuario.vacinas\n #@vacinas = Vacina.all\n \n end", "def index\n @reservas = []\n reservas = Reserva.fetch_next_reservas.items\n @minhas_reservas_filter_chckd = params[\"minhas_reservas\"]\n if(@minhas_reservas_filter_chckd.nil?)\n @reservas = reservas\n else\n if(!current_user.nil?)\n reservas.each do |reserva|\n if(reserva.description == \"Reserva para: #{current_user[:name]}\")\n @reservas.push(reserva)\n end\n end\n end\n end\n \n end" ]
[ "0.69865173", "0.69388676", "0.6865676", "0.6819054", "0.6819054", "0.679509", "0.67582035", "0.668788", "0.66670537", "0.66409326", "0.66224086", "0.660064", "0.65913063", "0.6590446", "0.6590446", "0.6590446", "0.6590446", "0.6590446", "0.6590446", "0.6590446", "0.6590446", "0.6590446", "0.6590446", "0.6590446", "0.6590446", "0.6590446", "0.6590446", "0.6590446", "0.6471138", "0.6408896", "0.64083797", "0.64083797", "0.6345853", "0.63439935", "0.63166666", "0.63005424", "0.629633", "0.629633", "0.629633", "0.629633", "0.629633", "0.629633", "0.62910813", "0.62842953", "0.6265612", "0.6261311", "0.6243545", "0.6234073", "0.619661", "0.61942816", "0.6186414", "0.61841553", "0.617207", "0.6159322", "0.61431015", "0.61281484", "0.61231995", "0.61182845", "0.61170495", "0.6110255", "0.6107977", "0.6100541", "0.60994536", "0.60970825", "0.6090581", "0.60818505", "0.60747075", "0.6072821", "0.60699993", "0.60697013", "0.60579336", "0.60563076", "0.60547036", "0.60547036", "0.6050858", "0.6046298", "0.602932", "0.6017586", "0.6011606", "0.60039926", "0.5971149", "0.5969588", "0.5965672", "0.5962424", "0.5943733", "0.5942378", "0.5921077", "0.5920513", "0.5901521", "0.5893967", "0.58915883", "0.58870816", "0.58807945", "0.58730763", "0.5860608", "0.5857869", "0.5854882", "0.5837946", "0.58332604", "0.5827764" ]
0.7295768
0
GET /reservacions/1 GET /reservacions/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @reservacions = Reservacion.all\n end", "def index\n render json: reservations\n end", "def employee_vacations\n #vacaciones de este año\n vacations = Employee.find(params[:id]).get_vacation_days\n\n respond_to do |format|\n format.json { render json: vacations }\n end\n end", "def show\n @reservation = Reservation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reservation }\n end\n end", "def show\n @reservation = Reservation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reservation }\n end\n end", "def show\n @reservation = Reservation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reservation }\n end\n end", "def show\n @reservation = Reservation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reservation }\n end\n end", "def show\n @reservation = Reservation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reservation }\n end\n end", "def show\n @reservation = Reservation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reservation }\n end\n end", "def index\n @vacations = User.find(params[:user_id]).vacations \n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @vacations }\n end\n end", "def index\n @reservations = Reservation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reservations }\n end\n end", "def index\n @reservations = Reservation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reservations }\n end\n end", "def show\n @reserf = Reserve.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reserf }\n end\n end", "def index\n @reservations = V2::Reservation.order(id: :desc).page(params[:page])\n end", "def display\n @reservas = Reserva.order(fecha_inicio_estadia: :desc)\n render json: @reservas, include: [:cliente, :habitacion]\n end", "def index\n @reservations = Reservation.all\n end", "def index\n @reservations = Reservation.all\n end", "def index\n @reservations = Reservation.all\n end", "def index\n @reservations = Reservation.all\n end", "def index\n @reservations = Reservation.all\n end", "def index\n @reservations = Reservation.all\n end", "def index\n @reservations = Reservation.all\n end", "def index\n @reservations = Reservation.all\n end", "def index\n @reservations = Reservation.all\n end", "def index\n @reservations = Reservation.all\n end", "def index\n @reservations = Reservation.all\n end", "def index\n @reservations = Reservation.all\n end", "def index\n @reservations = Reservation.all\n end", "def index\n @reservations = Reservation.all\n end", "def index\n @reservations = Reservation.all\n end", "def show\n @reservation = current_user.reservations.find(params[:id])\n respond_with(@reservation)\n end", "def get_by_property\n @api_v1_reservation = current_api_v1_user.properties.find(params[:id]).reservations\n render template: '/api/v1/reservations/index', status: 200\n rescue Exception => errors\n render json: errors, status: :unprocessable_entity\n end", "def index\n unless User.admin_by_token?(request.cookies[\"token\"])\n render json: { error: \"invalid_token\" }, status: :unauthorized\n return\n end\n\n @reservations = prep_reservation\n render json: @reservations, status: :ok\n end", "def index\n if user_signed_in?\n @reservations = current_user.reservations\n elsif owner_signed_in?\n @reservations = []\n # current_owner.restaurants.each {|rest| @reservations += rest.reservations}\n if current_owner.restaurant.blank?\n @reservations = []\n else\n @reservations = current_owner.restaurant.reservations\n end\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reservations }\n end\n end", "def index\n if user_signed_in?\n @reservations = current_user.reservations\n elsif owner_signed_in?\n @reservations = []\n # current_owner.restaurants.each {|rest| @reservations += rest.reservations}\n if current_owner.restaurant.blank?\n @reservations = []\n else\n @reservations = current_owner.restaurant.reservations\n end\n end\n @reservations = @reservations.order(\"id desc\").page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reservations }\n end\n end", "def index\n @vacancies = Vacancy.all_vacancies# current_user.vacancies #\n render json: @vacancies\n end", "def index\n @reservas = Reserva.all\n end", "def index\n @reservas = Reserva.all\n end", "def index\n\n if request.format == Mime::XML\n limit=params[:limit].nil? ? 1000: params[:limit]\n else\n limit=params[:limit].nil? ? 50 : params[:limit]\n end\n\n @reservations = Reservation.paginate :page => params[:page] || 1, :per_page => limit, :conditions => [\"user_id = ? AND historical = ?\", session[:user_id], 0], :order => \"id\"\n\n respond_to do |format|\n format.xml { render :xml => @reservations }\n format.any { render :json => @reservations }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @reserve }\n end\n end", "def show\n @vacation = Vacation.find(params[:id])\n @vacation.define_status\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vacation }\n end\n end", "def index\n respond_to do |format|\n if current_user.try(:admin?)\n @reservations = Reservation.all\n else\n @reservations = Reservation.where(user_id: current_user)\n end\n format.html # index.html.erb\n format.json { render json: @reservations }\n end\n end", "def index\n @reserves = Reserve.all\n end", "def show_reservations\n user = User.find(current_user.id)\n @reservations = user.reservations\n end", "def show\n @reservation = Reservation.find(params[:id])\n end", "def show\n @reservation = Reservation.find(params[:id])\n end", "def show\n @reservation = Reservation.find(params[:id])\n end", "def index\n @reservations = @apartment.reservations.all\n end", "def show\n @reserved_date = ReservedDate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reserved_date }\n end\n end", "def show\n @reservation = Reservation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.js\n format.json { render json: @reservation }\n end\n end", "def show\n @ventas_seguimiento = Ventas::Seguimiento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ventas_seguimiento }\n end\n end", "def index\n @reservations = Reservation.all.where(user_id: current_user.id)\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @reserve_stat_has_manifestation }\n end\n end", "def show\n @situacion_revistum = SituacionRevistum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @situacion_revistum }\n end\n end", "def show\n @reservation = Reservation.find(params[:id])\n render :show \n end", "def show\n @reserva = Reserva.includes(:outdoors, :checkin).find(params[:id])\n respond_with @reserva \n end", "def androidreserva\n\n @reservas = Reservation.all\n \n \n\n render :json => {\n :reservas => @reservas\n \n\n }\n\n \n end", "def index\n @preservatives = Preservative.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @preservatives }\n end\n end", "def show\n @reservation = Reservation.new\n begin\n @current_reservation = Reservation.where(\n vacation_property_id: @vacation_property.id, \n guest_phone: @user.phone_number,\n status: 1)\n .first \n rescue Exception => e\n puts \"e.message\"\n end\n end", "def show\n @status_ativ = StatusAtiv.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @status_ativ }\n end\n end", "def index\n @reservations = Reservation.includes(:guest).all\n end", "def show\n @serv = Serv.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @serv }\n end\n end", "def show\n @serv_adicionale = ServAdicionale.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @serv_adicionale }\n end\n end", "def show\n @preservative = Preservative.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @preservative }\n end\n end", "def show\n @observacao_vocacionada = ObservacaoVocacionada.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @observacao_vocacionada }\n end\n end", "def show\n @vacancies = get_vacancies if params[:vacancies]\n end", "def index\n @reservations = Reservation.all\n #@reservations = current_user.reservations\n end", "def index\n @reservations = Reservation.all\n @reservation_statuses = @@reservation_statuses\n end", "def index\n @reservations = @bus.reservations\n end", "def show\n reservation = Reservation.find(params[:id])\n render('show',:locals => {:reservation => reservation})\n end", "def index\n @vacation_requests = VacationRequest.all\n end", "def show\n @qowa_vacation = Vacation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @qowa_vacation }\n end\n end", "def show\n render json: @vat\n end", "def index\n @reserve_stat_has_manifestations = ReserveStatHasManifestation.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @reserve_stat_has_manifestations }\n end\n end", "def show\n @servicio = Servicio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @servicio }\n end\n end", "def show\n @arrival = Arrival.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @arrival }\n end\n end", "def show\n @arrival = Arrival.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @arrival }\n end\n end", "def index\n reservations = Reservation.all\n render('reservations/index',:locals => {:reservations => reservations})\n end", "def index\n @reservation_details = ReservationDetail.all\n end", "def index\n @vacancies = Vacancy.all\n end", "def index\n @vacancies = Vacancy.all\n end", "def index\n @reservations = Reservation.is_public.confirmed.order(updated_at: :desc).limit(500)\n end", "def index\n @reserved_dates = ReservedDate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reserved_dates }\n end\n end", "def show\n @calificacion_servicio = CalificacionServicio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @calificacion_servicio }\n end\n end", "def show\n @reservation = Reservation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @reservation }\n end\n end", "def new\n @reserf = Reserve.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reserf }\n end\n end", "def index\n @curriculum_vitaes = findable_curriculum_vitaes.all\n respond_to do |format|\n format.html {}\n format.json { render json: @curriculum_vitaes }\n end\n end", "def show\n render :json => @reservation, :include => {:customer => {:include => :user}}, status: :ok\n end", "def index\n if current_user.role == \"user\"\n @reservations = current_user.reservations.includes(:alleys, :user).order(:date)\n elsif current_user.role == \"cashier\"\n @reservations = Reservation.includes(:alleys, :user).by_date Date.today\n else\n @reservations = Reservation.includes(:alleys, :user).order(:date).all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reservations }\n end\n end", "def show\n @veiculo = Veiculo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @veiculo }\n end\n end", "def vitals\n raise UserNotAuthenticated unless access_token\n\n get('records/vitals')\n end", "def show\n survivor = Suvivor.find(params[:id])\n render json: {status: 'SUCCESS', message:'Survivor founded', data:survivor},status: :ok\n end", "def show\n @vacation = Vacation.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @vacation }\n end\n end", "def new\n @reservation = Reservation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reservation }\n end\n end", "def new\n @reservation = Reservation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reservation }\n end\n end", "def new\n @reservation = Reservation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reservation }\n end\n end", "def stats\n result = UserReservation.stats params[:id_list]\n render json: {revenue:result[:totalRevenue]}\n end", "def new\n @vacation = Vacation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vacation }\n end\n end", "def show\n @vacation = Vacation.find(params[:id])\n if request.xhr?\n render 'show', :layout => false\n return\n end\n end", "def new\n @vacation = Vacation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @vacation }\n end\n end", "def index\n @reservationcs = Reservationc.all\n end" ]
[ "0.7200696", "0.7076413", "0.6963883", "0.6902407", "0.6902407", "0.6902407", "0.6902407", "0.6902407", "0.6902407", "0.68727165", "0.6861734", "0.6861734", "0.6856421", "0.6836301", "0.6646989", "0.66036916", "0.66036916", "0.66036916", "0.66036916", "0.66036916", "0.66036916", "0.66036916", "0.66036916", "0.66036916", "0.66036916", "0.66036916", "0.66036916", "0.66036916", "0.66036916", "0.66036916", "0.6583857", "0.6564227", "0.6558323", "0.6533453", "0.65180725", "0.6512914", "0.6504885", "0.6504885", "0.65039533", "0.6492566", "0.6465474", "0.6427005", "0.64009064", "0.63989556", "0.637559", "0.637559", "0.637559", "0.63463163", "0.63267684", "0.6317675", "0.6304398", "0.63035357", "0.63007116", "0.6290591", "0.6267492", "0.62618184", "0.62505543", "0.62448347", "0.62320656", "0.62278837", "0.6224124", "0.62208176", "0.62170136", "0.62077934", "0.61905956", "0.6187125", "0.61674494", "0.61507493", "0.61454284", "0.6142024", "0.6132392", "0.61290574", "0.6125793", "0.61179453", "0.6101545", "0.6096511", "0.6096511", "0.6093603", "0.6089228", "0.60771984", "0.60771984", "0.6069992", "0.6060374", "0.6048118", "0.6042876", "0.6031924", "0.6030504", "0.60262847", "0.602066", "0.602063", "0.6017875", "0.60149103", "0.60120475", "0.6009817", "0.6009817", "0.6009817", "0.5998661", "0.5995541", "0.5994733", "0.5993695", "0.5992622" ]
0.0
-1
POST /reservacions POST /reservacions.json
def create @reservacion = Reservacion.new(reservacion_params) respond_to do |format| if @reservacion.save format.html { redirect_to @reservacion, notice: 'Su solicitud fue realizada satisfactoriamente.' } format.json { render :show, status: :created, location: @reservacion } else format.html { render :new } format.json { render json: @reservacion.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @reservation = Reservation.new(reservation_params)\n @reservation.user = current_user\n @reservation.flight = flight\n\n if @reservation.save\n render json: @reservation\n else\n render json: @reservation.errors, status: :unprocessable_entity\n end\n end", "def create_reservations\n Time.use_zone(@timezone) do\n @reservations = build_reservations\n return nil unless @reservations.any?\n @reservations = commit_reservations(@reservations)\n return nil unless valid? && @reservations.all?(&:persisted?)\n charge(@reservations) && @reservations.each(&:reload) if @pay\n track(@reservations)\n\n @reservations\n end\n end", "def create\n @agenda_reserv_resource = Agenda::ReservResource.new(agenda_reserv_resource_params)\n if @agenda_reserv_resource.save\n flash[:success] = t('notices.saved_successfully')\n index\n end\n\n end", "def create\n @situacao_reserva = SituacaoReserva.new(situacao_reserva_params)\n @situacao_reservas = SituacaoReserva.all.paginate(page: params[:page], per_page: 5)\n @action = { title: \"Nova\", button: \"Salvar\"}\n\n respond_to do |format|\n if @situacao_reserva.save\n format.html { redirect_to action: \"new\", notice: 'Situação reserva criada com sucesso..' }\n format.json { render :show, status: :created, location: @situacao_reserva }\n else\n format.html { render :new }\n format.json { render json: @situacao_reserva.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @reservation = Reservation.new(reservation_params)\n\n if @reservation.save\n render :show, status: :created, location: @reservation\n else\n render json: @reservation.errors, status: :unprocessable_entity\n end\n end", "def create\n @vacation = Vacation.new(params[:vacation])\n respond_to do |format|\n if @vacation.save\n @vacations = Vacation.order(\"`vacations`.created_at DESC\").search(\n {:resource_vteam_allocation_vteam_id_eq =>params[:vteam_id],\n :resource_vteam_allocation_active_eq =>true})\n .group(:resource_vteam_allocation_id)\n .paginate(:per_page => Vacation.per_page,:page=>params[:page])\n @vacation_type = VacationType.all\n format.html\n format.js\n format.xml { render :xml => @vacation, :status => :created, :location => @vacation }\n else\n # format.html { render :action => \"new\" }\n format.xml { render :xml => @vacation.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @reserve = Reserf.new(reserf_params)\n\n respond_to do |format|\n if @reserve.save\n format.html { redirect_to @reserve, notice: 'Reserf was successfully created.' }\n format.json { render :show, status: :created, location: @reserve }\n else\n format.html { render :new }\n format.json { render json: @reserve.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.user_by_token(request.cookies[\"token\"])\n return unless valid_form?\n\n @reservation = Reservation.new(reservation_params)\n @reservation.user = @user\n\n render json: { error: \"The time selected is not available.\" }, status: :unauthorized and return unless valid_time?\n render json: { error: \"Reservation time too long.\" }, status: :unauthorized and return false unless valid_length?\n unless valid_vaccine?\n render json: { error: \"You must be vaccinated to use this amenity.\" }, status: :unauthorized and return false\n end\n\n save_reservation\n end", "def create\n @reservation = Reservation.new(reservation_params)\n\n if @reservation.save\n render 'api/reservations/show'\n else\n render json: @reservation.errors.full_messages, status: 422\n\n end \n\n\n end", "def index\n @reservacions = Reservacion.all\n end", "def create\n @reserf = Reserve.new(params[:reserf])\n\n respond_to do |format|\n if @reserf.save\n format.html { redirect_to @reserf, notice: 'Reserve was successfully created.' }\n format.json { render json: @reserf, status: :created, location: @reserf }\n else\n format.html { render action: \"new\" }\n format.json { render json: @reserf.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n unless User.admin_by_token?(request.cookies[\"token\"])\n render json: { error: \"invalid_token\" }, status: :unauthorized\n return\n end\n\n @reservations = prep_reservation\n render json: @reservations, status: :ok\n end", "def create\n @reservation = Reservation.new(reservation_params)\n\n respond_to do |format|\n if @reservation.save\n format.html { redirect_to @reservation, notice: 'Reservation was successfully created.' }\n format.json { render :show, status: :created, location: @reservation }\n else\n format.html { render :new }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @reservation = Reservation.new(reservation_params)\n\n respond_to do |format|\n if @reservation.save\n format.html { redirect_to @reservation, notice: 'Reservation was successfully created.' }\n format.json { render :show, status: :created, location: @reservation }\n else\n format.html { render :new }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # @reserva = Reserva.new(reserva_params)\n\n # zrespond_to do |format|\n # if @reserva.save\n # format.html { redirect_to @reserva, notice: 'Reserva was successfully created.' }\n # format.json { render :show, status: :created, location: @reserva }\n # else\n # format.html { render :new }\n # format.json { render json: @reserva.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def create\r\n @reservation = Reservation.new(reservation_params)\r\n respond_to do |format|\r\n if @reservation.save\r\n format.html { redirect_to reservations_path, notice: 'Reservation was successfully created.' }\r\n format.json { render :show, status: :created, location: @reservation }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create \n p_name = params[:reservation][:name]\n p_amount_people = params[:reservation][:amount_people]\n p_year1 = params[:reservation][\"arrive_date(1i)\"].to_i\n p_month1 = params[:reservation][\"arrive_date(2i)\"].to_i\n p_day1 = params[:reservation][\"arrive_date(3i)\"].to_i\n p_year2 = params[:reservation][\"departure_date(1i)\"].to_i\n p_month2 = params[:reservation][\"departure_date(2i)\"].to_i\n p_day2 = params[:reservation][\"departure_date(3i)\"].to_i\n p_needs = params[:reservation][:needs].split(' ')\n p_activities = params[:reservation][:activities].split(' ')\n\n @reservation = Reservation.new(\n username: @username_actual,\n name: p_name,\n amount_people: p_amount_people,\n arrive_date: Date.new(\n p_year1,\n p_month1,\n p_day1\n ),\n departure_date: Date.new(\n p_year2,\n p_month2,\n p_day2\n ),\n needs: p_needs,\n activities: p_activities\n )\n\n respond_to do |format|\n if @reservation.save\n format.html { redirect_to @reservation, notice: 'Reservation was successfully created.' }\n format.json { render :show, status: :created, location: @reservation }\n else\n format.html { render :new }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @gotodate = params[:vacation][:starts_at].to_time.to_i * 1000\n set_tz_offset(:vacation)\n @user = User.find(params[:user_id])\n @vacation = @user.vacations.build(params[:vacation])\n\n\n respond_to do |format|\n if @vacation.save\n format.js { render 'update_listing', :layout => false }\n else\n format.js { render :partial => 'shared/error', :locals => {:target => @vacation} }\n end\n end\n end", "def create\n sr = SeatReservation.reserve_seat(@customer, params[:seat_id])\n\n # NJS - what to return back? just a success msg?\n respond_to do |format|\n format.json { render json: {reservation_id: sr.id}} \n end\n end", "def create\n @reservation = Reservation.new(reservation_params)\n\n respond_to do |format|\n if @reservation.save\n format.html { redirect_to @reservation, notice: 'Reservation was successfully created.' }\n format.json { render json: @reservation, status: :created, location: @reservation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @reservation = Reservation.new(reservation_params)\n @reservation.apartment_id = @apartment.id\n respond_to do |format|\n if @reservation.save\n format.html { redirect_to apartment_reservations_path(@apartment), notice: 'Apartamento Reservado.' }\n format.json { render :show, status: :created, location: @reservation }\n else\n format.html { render :new }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n res = Reservation.create(\n row: params[:row],\n col: params[:col],\n user_id: params[:user_id], # DON'T DO THIS! Use current_user\n flight_id: params[:flight_id]\n )\n\n if res.persisted?\n # Send back the reservation object that was successfully created\n render json: res\n else\n # Send back an error hash, including the ActiveRecord validation error messages\n render json: { error: true, messages: res.errors.full_messages }\n end\n end", "def create\n @reservation = current_user.reservations.new(params[:reservation])\n\n respond_to do |format|\n if @reservation.save\n format.html { redirect_to @reservation, notice: 'Reservation was successfully created.' }\n format.json { render \"reservations/show\", success: true, status: :created, location: @reservation }\n else\n format.html {\n @menu_items = MenuItem.of_the_next_seven_days.includes(:restaurant)\n @restaurants = @menu_items.collect { |menu_item| menu_item.restaurant }\n render action: \"new\"\n }\n format.json {\n render json: @reservation.errors, status: :unprocessable_entity\n }\n end\n end\n end", "def create\n @reserf = Reserve.new(reserf_params)\n @reserf.busy = true\n\n respond_to do |format|\n if @reserf.save\n format.html { redirect_to root_path, notice: 'Reserve was successfully created.' }\n format.json { render :show, status: :created, location: @reserf }\n else\n format.html { render :new }\n format.json { render json: @reserf.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @reservation_owner = ReservationOwner.new(reservation_owner_params)\n\n respond_to do |format|\n if @reservation_owner.save\n format.html { redirect_to @reservation_owner, notice: 'Reservation owner was successfully created.' }\n format.json { render :show, status: :created, location: @reservation_owner }\n else\n format.html { render :new }\n format.json { render json: @reservation_owner.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @vehicle_reservation = VehicleReservation.new(vehicle_reservation_params)\n\n respond_to do |format|\n if @vehicle_reservation.save\n\n User.where(role:\"admin\").each do |user|\n NotifyUserMailer.vehicle_reservation_made(@vehicle_reservation, user).deliver\n end\n\n format.html { redirect_to @vehicle_reservation, notice: 'Reserva cadastrada com sucesso.' }\n format.json { render :show, status: :created, location: @vehicle_reservation }\n else\n format.html { render :new }\n format.json { render json: @vehicle_reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n render json: reservations\n end", "def criar_sobrevivente\n @suvivor = Sobrevivente.create(\n name: params[:name], genero: params[:genero], idade: params[:idade],\n lat: params[:lat], lon: params[:lon],\n agua: params[:agua], comida: params[:comida], medicamento: params[:medicamento],\n municao: params[:municao]\n )\n render json: @suvivor\n end", "def create\n @reserva = Reserva.new(reserva_params)\n if !params[:reserva][:tipo_reserva].blank?\n @tipo_reserva = TipoReserva.find(params[:reserva][:tipo_reserva])\n @reserva.tipo_reserva = @tipo_reserva\n end\n if !params[:reserva][:habitacion].blank?\n @habitacion = Habitacion.find(params[:reserva][:habitacion])\n @reserva.habitacion = @habitacion\n end\n\n if !params[:reserva][:cliente].blank?\n @cliente = Cliente.find(params[:reserva][:cliente])\n @reserva.cliente = @cliente\n end\n if !params[:reserva][:confirmada].blank?\n @reserva.confirmada = params[:reserva][:confirmada]\n end\n @reserva.fehca_creacion = Time.now\n\n respond_to do |format|\n if @reserva.save\n format.html { redirect_to reservas_url, notice: 'Reserva creada con exito.' }\n format.json { render action: 'show', status: :created, location: @reserva }\n else\n format.html { render action: 'new' }\n format.json { render json: @reserva.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @reservation = Reservation.new(reservation_params)\n\n total_due = @reservation.get_total_due\n @reservation[:total_due] = total_due\n @reservation.save\n\n respond_to do |format|\n\n if @reservation.persisted?\n format.html { redirect_to @reservation, notice: 'Reservation was successfully created.' }\n format.json { render json: @reservation, include:['property'] }\n else\n format.html { render :new }\n format.json { render json: { status: 401, errors: @reservation.errors } }\n\n # for the API create\n # headers['Access-Control-Allow-Origin'] = '*'\n # reservation = Reservation.create reservation_params\n #\n # render json: reservation, include: ['flight', 'user']\n end\n end\n end", "def create\n @reserva_aceitum = ReservaAceitum.new(reserva_aceitum_params)\n\n respond_to do |format|\n if @reserva_aceitum.save\n format.html { redirect_to @reserva_aceitum, notice: 'Reserva aceitum was successfully created.' }\n format.json { render :show, status: :created, location: @reserva_aceitum }\n else\n format.html { render :new }\n format.json { render json: @reserva_aceitum.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @reservation_room = ReservationRoom.new(reservation_room_params)\n @reservations = Reservation.all\n \n respond_to do |format|\n if @reservation_room.save\n format.html { redirect_to @reservation_room, notice: 'La habitacion se ha asignado a la reserva correctamente.' }\n format.json { render action: 'show', status: :created, location: @reservation_room }\n else\n format.html { render action: 'new' }\n format.json { render json: @reservation_room.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @agenda_reservation = Agenda::Reservation.new(agenda_reservation_params)\n if @agenda_reservation.save\n flash[:success] = t('notices.saved_successfully')\n index\n end\n end", "def create\n space = Space.find(params[:space_id])\n group = Group.find(space.group_id)\n group_member_ids = Member.where(group_id: group.id).pluck(:user_id)\n unless group_member_ids.include?(@current_user.id)\n return render json: { message: \"You are not permitted to perform this operation.\" }, status: :forbidden\n end\n @reservation = Reservation.new(reservation_params)\n\n if @reservation.save\n render json: @reservation, status: :created\n else\n render json: @reservation.errors, status: :unprocessable_entity\n end\n end", "def create\n @employee_reservation = Employee::Reservation.new(employee_reservation_params)\n\n respond_to do |format|\n if @employee_reservation.save\n format.html { redirect_to @employee_reservation, notice: 'Reservation was successfully created.' }\n format.json { render :show, status: :created, location: @employee_reservation }\n else\n format.html { render :new }\n format.json { render json: @employee_reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @reservation = Reservation.new(params[:reservation])\n @reservation.user_id = current_user.id\n\n respond_to do |format|\n if @reservation.save\n format.html { redirect_to @reservation, notice: 'Reservation was successfully created.' }\n format.json { render json: @reservation, status: :created, location: @reservation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @reservation = Reservation.new(reservation_params)\r\n @reservation.user = current_user\r\n\r\n respond_to do |format|\r\n if @reservation.save\r\n format.html { redirect_to @reservation, notice: 'Reservation was successfully created.' }\r\n format.json { render :show, status: :created, location: @reservation }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def employee_vacations\n #vacaciones de este año\n vacations = Employee.find(params[:id]).get_vacation_days\n\n respond_to do |format|\n format.json { render json: vacations }\n end\n end", "def create\n reservation = Reservation.new(reserve_params)\n respond_to do |format|\n if reservation.update(reserve_params)\n format.html { render :show,:locals => {:reservation => reservation}, notice: 'Reservation was successfully created.' }\n format.json { render :show,:locals => {:reservation => reservation}, status: :ok, location: reservation }\n else\n format.html { render :edit,:locals => {:reservation => reservation} }\n format.json { render json: reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @reserved = Reserved.new(reserved_params)\n\n respond_to do |format|\n if @reserved.save\n format.html { redirect_to @reserved, notice: 'Reserved was successfully created.' }\n format.json { render :show, status: :created, location: @reserved }\n else\n format.html { render :new }\n format.json { render json: @reserved.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @vacation = Vacation.new(params[:vacation])\n @vacation.user_id = current_user.id\n respond_to do |format|\n if @vacation.save\n format.html { redirect_to @vacation, notice: 'Vacation was successfully created.' }\n format.json { render json: @vacation, status: :created, location: @vacation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @vacation.errors, status: :unprocessable_entity }\n end\n end\n end", "def reservacion_params\n params.require(:reservacion).permit(:nresponsable, :nevento, :fechainicio, :fechafin, :horainicio, :horafin, :repeticion, :idrepeticiones, :aprobacion, :tipoactividad, :fechasolicitud)\n end", "def create\n #abort @resVerifByHour.inspect\n @reserva = Reserva.new(reserva_params)\n @resVerifByHour = Reserva.where(\"escenario_id = ? and fecha = ?\", @reserva.escenario, @reserva.fecha)\n #abort @reserva.horainicio(1i).inspect\n if !@resVerifByHour.empty?\n @reserva.destroy\n redirect_to escenarios_path\n flash[:notice] = 'Este escenario ya se encuentra reservado por otro usuario.'\n else\n respond_to do |format|\n @reserva.estado = \"1\"\n @reserva.save\n if @reserva.save\n format.html { redirect_to escenarios_path, notice: 'Reserva was successfully created.' }\n format.json { render :show, status: :created, location: @reserva }\n else\n format.html { render :new }\n format.json { render json: @reserva.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def create\n @reservation = Reservation.new(reservation_params)\n @user = current_user\n @date = (@reservation.reserved_on).to_formatted_s(:long_ordinal)\n @date_of_return = (@reservation.reserved_on + 1.month).to_formatted_s(:long_ordinal)\n respond_to do |format|\n if @reservation.save\n ReservationMailer.create_reservation_notifier(@user, @date, @date_of_return).deliver\n format.html { redirect_to reservations_url, notice: 'Reservation was successfully created.' }\n format.json { render action: 'show', status: :created, location: @reservation }\n else\n format.html { render action: 'new' }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n write_log(\"in create -\\n\")\n @reservation = Reservation.new(reservation_params)\n @user = User.find(session[:current_user_id])\n respond_to do |format|\n if @reservation.save\n UserMailer.reservation_confirmation(@user, @reservation).deliver\n UserMailer.car_repair_appointment(@user, @reservation).deliver\n\n format.html { redirect_to @reservation, notice: 'Reservation was successfully created.' }\n format.json { render :show, status: :created, location: @reservation }\n else\n format.html { render :new }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user_vacancy = UserVacancy.new(user_vacancy_params)\n\n respond_to do |format|\n if @user_vacancy.save\n format.html { redirect_to @user_vacancy, notice: 'Aplicación exitosa' }\n format.json { render :show, status: :created, location: @user_vacancy }\n else\n format.html { render :new }\n format.json { render json: @user_vacancy.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n reservation_id = SecureRandom.uuid\n\n Reservation::Worker::Process.perform_async(reservation_id, Time.zone.now.to_i, reservation_params)\n\n render json: { reservation_id: reservation_id }, status: 200\n end", "def create\n @reservation = Reservation.new(params[:reservation])\n\n respond_to do |format|\n if @reservation.save\n EventNotification.notify_admin(@reservation).deliver\n format.html { redirect_to @reservation, notice: 'Reservation was successfully created.' }\n format.json { render :show, status: :created, location: @reservation }\n else\n format.html { render :new }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def reserva_params\n params.require(:reserva).permit(:data_inicial, :quilometragem_inicial, :nivel_tanque, :usuario_id, :veiculo_id, :status)\n end", "def create\n @vacation = Vacation.new(params[:vacation])\n @vacation.define_status\n @vacation.user=current_user\n respond_to do |format|\n if @vacation.save\n current_user.updatetotaldays\n Notifier.create_vacation(@vacation).deliver\n format.html { redirect_to @vacation, notice: 'Vacation was successfully created.' }\n format.json { render json: @vacation, status: :created, location: @vacation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @vacation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @vacancy = Vacancy.new(vacancy_params)\n\n respond_to do |format|\n if @vacancy.save\n format.html { redirect_to vacancy_path(@vacancy), notice: 'Вакансия создана.' }\n format.json { render :show, status: :created, location: @vacancy }\n else\n format.html { render :new }\n format.json { render json: @vacancy.errors, status: :unprocessable_entity }\n end\n end\n end", "def reserva_params\n params.require(:reserva).permit( :id, :created_at, :updated_at, :fehca_creacion, :fecha_inicio_estadia, :fecha_fin_estadia, :monto, :confirmada, :moneda, :abonada, \n :forma_de_pago, :tipo_reserva_id, :cliente_id, :habitacion_id, :comentarios)\n end", "def create\n # @reservation = Reservation.new(reservation_params)\n @reservation = current_user.reservations.create!(reservation_params)\n\n respond_to do |format|\n if @reservation.save\n format.html { redirect_to @reservation, notice: 'Reservation was successfully created.' }\n format.json { render :show, status: :created, location: @reservation }\n else\n format.html { render :new }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n # current_user.book! @reservation\n end", "def create\n @ventaganancium = Ventaganancium.new(ventaganancium_params)\n\n respond_to do |format|\n if @ventaganancium.save\n format.html { redirect_to @ventaganancium, notice: 'Ventaganancium was successfully created.' }\n format.json { render :show, status: :created, location: @ventaganancium }\n else\n format.html { render :new }\n format.json { render json: @ventaganancium.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @space_reservation = SpaceReservation.new(space_reservation_params)\n\n respond_to do |format|\n if @space_reservation.save\n format.html { redirect_to @space_reservation, notice: 'Space reservation was successfully created.' }\n format.json { render :show, status: :created, location: @space_reservation }\n else\n format.html { render :new }\n format.json { render json: @space_reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @vacation_request = VacationRequest.new(vacation_request_params)\n\n respond_to do |format|\n if @vacation_request.save\n format.html { redirect_to @vacation_request, notice: 'Vacation request was successfully created.' }\n format.json { render :show, status: :created, location: @vacation_request }\n else\n format.html { render :new }\n format.json { render json: @vacation_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def reservation_params\n params.require(:reservation).permit(:name, :phone_number, :vacation_property_id, :user_id, :status)\n end", "def create\n @reservation = Reservation.new(params[:reservation])\n\n respond_to do |format|\n if @reservation.save\n format.js\n format.html { redirect_to @reservation, notice: 'Reservation was successfully created.' }\n format.json { render json: @reservation, status: :created, location: @reservation }\n else \n format.js\n format.html { render action: \"new\" }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @reservation = @space.reservations.build(reservation_params.merge(user: authed_user))\n\n respond_to do |format|\n if @reservation.save\n ReservationMailer.created_email(@reservation, root_url.gsub(/\\/$/, '')).deliver_later\n format.html { redirect_to [@reservation.space.location.org, @reservation.space.location, @reservation.space, @reservation], notice: 'Reservation was successfully created.' }\n format.json { render :show, status: :created, location: [@reservation.space.location.org, @reservation.space.location, @reservation.space, @reservation] }\n else\n format.html { render :new }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @vacancy = Vacancy.new(vacancy_params)\n\n respond_to do |format|\n if @vacancy.save\n format.html { redirect_to @vacancy, notice: 'Vacante creada correctamente.' }\n format.json { render :show, status: :created, location: @vacancy }\n else\n format.html { render :new }\n format.json { render json: @vacancy.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @reservation = V2::Reservation.new(reservation_params)\n if @reservation.save\n flash[:notice] = \"An interview has been booked for #{@reservation.time_slot.start_datetime_human}\"\n send_notifications(@reservation)\n else\n flash[:error] = \"No time slot was selected, couldn't create the reservation\"\n end\n @available_time_slots = []\n @person = @reservation.person\n respond_to do |format|\n format.js {}\n format.html { render :new }\n end\n end", "def reserva_params\n params.require(:reserva).permit(:escenario_id, :user_id, :fecha, :horainicio, :horafin, :estado)\n end", "def create\n @reserve = Reserve.new(reserve_params)\n\n respond_to do |format|\n if @reserve.save\n format.html { redirect_to @reserve, notice: 'Reserve was successfully created.' }\n format.json { render :show, status: :created, location: @reserve }\n else\n format.html { render :new }\n format.json { render json: @reserve.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @odsreserf = Odsreserf.new(odsreserf_params)\n\n respond_to do |format|\n if @odsreserf.save\n format.html { redirect_to @odsreserf, notice: 'Odsreserf was successfully created.' }\n format.json { render :show, status: :created, location: @odsreserf }\n else\n format.html { render :new }\n format.json { render json: @odsreserf.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @reservation_detail = ReservationDetail.new(reservation_detail_params)\n\n respond_to do |format|\n if @reservation_detail.save\n format.html { redirect_to @reservation_detail, notice: \"Reservation detail was successfully created.\" }\n format.json { render :show, status: :created, location: @reservation_detail }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @reservation_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @reservation = Reservation.new(reservation_params)\n\n # to help with creation errors:\n @reservation.customer = current_customer \n @reservation.restaurant = @restaurant \n\n respond_to do |format|\n if @reservation.save\n format.html { redirect_to @reservation, notice: 'Reservation was successfully created.' }\n format.json { render :show, status: :created, location: @reservation }\n else\n format.html { render :new }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def reservation_params\n params.require(:reservation).permit(:name, :amount_people, :arrive_date, :departure_date, :needs, :activities)\n end", "def create\n @situacion_revistum = SituacionRevistum.new(situacion_revistum_params)\n\n respond_to do |format|\n if @situacion_revistum.save\n format.html { redirect_to @situacion_revistum, notice: 'Situacion revistum was successfully created.' }\n format.json { render json: @situacion_revistum, status: :created, location: @situacion_revistum }\n else\n format.html { render action: \"new\" }\n format.json { render json: @situacion_revistum.errors, status: :unprocessable_entity }\n end\n end\n end", "def androidreserva\n\n @reservas = Reservation.all\n \n \n\n render :json => {\n :reservas => @reservas\n \n\n }\n\n \n end", "def create\n @reservation = @brewery.reservations.new(reservation_params)\n\n respond_to do |format|\n if @reservation.save\n format.html { notification }\n format.json { render :show, status: :created, location: @reservation }\n else\n format.html { render :new }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n @reservation = Reservation.new(reservation_params)\n\n @passenger = Passenger.new\n @passengers = Passenger.all\n @enterprise = Enterprise.new\n @enterprises = Enterprise.all\n @rooms = Room.all\n @groups = Group.all\n @room_types = RoomType.all\n\n respond_to do |format|\n if @reservation.guardar( new_reservation_rooms )\n format.html { redirect_to @reservation, notice: 'La reserva se ha registrado correctamente.' }\n format.json { render action: 'show', status: :created, location: @reservation }\n else\n format.html { render action: 'new' }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @vacuna = Vacuna.new(vacuna_params)\n @vacuna.mascota_id = @mascota.id\n respond_to do |format|\n if @vacuna.save\n format.html { redirect_to @vacuna, notice: 'Vacuna Agregada exitosamente' }\n format.json { render :show, status: :created, location: @vacuna }\n else\n format.html { render :new }\n format.json { render json: @vacuna.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @vacation_property = VacationProperty.find(params[:reservation][:property_id])\n @reservation = @vacation_property.reservations.create(reservation_params)\n\n if @reservation.save\n flash[:notice] = \"Sending your reservation request now.\"\n @reservation.notify_host\n redirect_to @vacation_property\n else\n flash[:danger] = @reservation.errors\n end\n end", "def create\n format_time_input\n check_input\n @reservation = Reservation.new(reservation_params)\n @reservation.status = :requested\n respond_to do |format|\n # TODO: Duplication\n if @conflicts.any?\n respond_to_conflicts :new, format\n elsif @reservation.save\n notify_approval_needed\n respond_to_update format\n else\n respond_to_errors :new, format\n end\n end\n end", "def create\n\n @reservation = Reservation.new(reservation_params)\n @reservation.customer = current_customer\n @reservation.car_id = 1\n @reservation.active = true\n respond_to do |format|\n if @reservation.save\n Car.find_by_id(@reservation.car_id).update_attribute(:status, \"Reserved\")\n format.html { redirect_to @reservation, notice: 'Reservation was successfully created.' }\n format.json { render :show, status: :created, location: @reservation }\n else\n format.html { render :new }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @devolucao = Devolucao.new(devolucao_params)\n @reserva.update(status: 'Devolvido')\n @veiculo.update(status: devolucao_params[:status])\n\n respond_to do |format|\n if @devolucao.save\n format.html { redirect_to @devolucao, notice: 'Devolucao was successfully created.' }\n format.json { render :show, status: :created, location: @devolucao }\n else\n format.html { render :new }\n format.json { render json: @devolucao.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n=begin temp = params[:reserf]\n temp[\"roomname\"] = params[:room][\"roomname\"]\n @reserf = Reserve.new(temp)\n @roomtype = DetailRoom.all_types\n @time = Room.all_times\n @day_list = Room.all_days\n respond_to do |format|\n if @reserf.save\n format.html { redirect_to result_path(@reserf), notice: 'Reserve was successfully created.' }\n format.json { render json: @reserf, status: :created, location: @reserf }\n else\n format.html { render action: \"new\" }\n format.json { render json: @reserf.errors, status: :unprocessable_entity }\n end\n end\n=end\n end", "def create\n @vegetable = Vegetable.new(params[:vegetable].merge (params[:date]))\n @vegetable.start = @vegetable.start_sowing_month\n @vegetable.finish = @vegetable.end_planting_out_month\n respond_to do |format|\n if @vegetable.save\n format.html { redirect_to vegetables_path, notice: 'Vegetable was successfully created.' }\n format.json { render json: @vegetable, status: :created, location: @vegetable }\n else\n format.html { render action: \"new\" }\n format.json { render json: @vegetable.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # @type [Vacancy] @vacancy\n @vacancy = current_user.employer_info.vacancies.build(vacancy_params)\n\n respond_to do |format|\n if @vacancy.save\n format.html { redirect_to @vacancy, notice: 'Vacancy was successfully created.' }\n format.json { render :show, status: :created, location: @vacancy }\n else\n format.html { render :new }\n format.json { render json: @vacancy.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @vacina = current_usuario.vacinas.build(vacina_params)\n\n respond_to do |format|\n if @vacina.save\n format.html { redirect_to @vacina, notice: \"Vacina was successfully created.\" }\n format.json { render :show, status: :created, location: @vacina }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @vacina.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if current_user.check_reservations\n return redirect_back(fallback_location: root_url,alert: \"You already have #{Variable.find_by_name(\"MAX_RESERVATIONS\").value} reservations in progress. Please deliver one of these first to make more reservations.\")\n else\n @reservation = Reservation.new(reservation_params)\n ending_time = (@reservation.job.duration / Variable.find_by_name(\"RESERVATION_FACTOR\").value.to_f)*24*60*60\n @reservation.ending_time = Time.now + ending_time\n @reservation.status = \"LIVE\"\n job = @reservation.job\n @reservation.amount = @reservation.job.amount\n respond_to do |format|\n if @reservation.save\n @reservation.job.update(status: \"RESERVED\")\n TimerJob.set(wait_until: @reservation.ending_time).perform_later(@reservation,\"LIVE\")\n format.html { redirect_to @reservation, notice: \"Job reserved successfully.\" }\n format.json { render :show, status: :created, location: @reservation }\n else\n format.html { render :new }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def create\n @vacante_aplicada = VacanteAplicada.new(vacante_aplicada_params)\n\n respond_to do |format|\n if @vacante_aplicada.save\n format.html { redirect_to root_path, notice: 'Se ha aplicado aplicado correctamente a la vacante' }\n format.json { render :show, status: :created, location: @vacante_aplicada }\n else\n format.html { render :new }\n format.json { render json: @vacante_aplicada.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @reservation = Reservation.new(reservation_params)\n @reservation.requester = current_user\n if params[:reservation][:nook_id]\n @nook = Nook.find(params[:reservation][:nook_id])\n @reservation.nook = @nook\n end\n\n respond_to do |format|\n if @reservation.save\n format.html {\n flash[:notice] = t('reservations.submitted')\n if request.xhr?\n render text: nooks_url\n else\n redirect_to nooks_path\n end\n }\n format.json { render :show, status: :created, location: @reservation }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @movimimiento_ventum = MovimimientoVentum.new(movimimiento_ventum_params)\n\n respond_to do |format|\n if @movimimiento_ventum.save\n format.html { redirect_to @movimimiento_ventum, notice: 'Movimimiento ventum was successfully created.' }\n format.json { render :show, status: :created, location: @movimimiento_ventum }\n else\n format.html { render :new }\n format.json { render json: @movimimiento_ventum.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @vacina = Vacina.new(vacina_params)\n\n respond_to do |format|\n if @vacina.save\n format.html { redirect_to @vacina, notice: 'Vacina cadastrada com sucesso.' }\n format.json { render :show, status: :created, location: @vacina }\n format.js { head :ok }\n else\n format.html { render :new }\n format.json { render json: @vacina.errors, status: :unprocessable_entity }\n format.js{}\n end\n end\n end", "def create\n\n if @veiculo.categoria_cnh == current_usuario.cnh\n @reserva = Reserva.new(reserva_params)\n @salvar = @veiculo.update(status: reserva_params[:status])\n\n respond_to do |format|\n if @reserva.save\n format.html { redirect_to reserva_path(@reserva), notice: 'Reserva was successfully created.' }\n format.json { render :show, status: :created, location: @reserva }\n else\n format.html { render :new }\n format.json { render json: @reserva.errors, status: :unprocessable_entity }\n end\n end\n\n else\n flash[:info] = \"Sua categoria de CNH é diferente da necessária para dirigir esse veículo.\"\n redirect_to index2_path\n end\n end", "def create\r\n\t\t\t\tsurvivor = Survivor.new(survivor_create_params)\r\n\t\t\t\tsurvivor.abducted = false\r\n\t\t\t\tsurvivor.abduction_reports = 0\r\n\t\t\t\tif survivor.save\r\n\t\t\t\t\trender json: {status: 'SUCCESS', message:'Survivor Registrado', data:survivor},status: :ok\r\n\t\t\t\telse\r\n\t\t\t\t\trender json: {status: 'ERROR', message:'Survivor não registrado com sucesso', data:survivor.erros},status: :unprocessable_entity\r\n\t\t\t\tend\r\n\t\t\tend", "def create\n @reservationc = Reservationc.new(reservationc_params)\n\n respond_to do |format|\n if @reservationc.save\n format.html { redirect_to @reservationc, notice: \"Reservationc was successfully created.\" }\n format.json { render :show, status: :created, location: @reservationc }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @reservationc.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n sheeps = params[:sheeps]\n return if params_are_empty(sheeps)\n \n @activity = Activity.new date: convert_date_to_i(params[:date]), comment: params[:comment], a_type: params[:type_of_a], total_costs:params[:total_costs], location: 'farma'\n sheeps.each do |p|\n @vacination = Vacination.new sheep_id:p[:sheep_id], reason: params[:reason], vaccin_name: params[:vaccin_name]\n @activity.vacinations.push(@vacination)\n end\n \n respond_to do |format|\n if @activity.save\n desrtoy_activity(params[:activity_id])\n format.html { redirect_to '/vacinations/'+ @activity.id.to_s, notice: 'Vacination was successfully created.' }\n format.json { render action: 'show', status: :created, location: @vacination }\n else\n format.html { render action: 'new' }\n format.json { render json: @vacination.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n obtener_datos()\n @ventum = current_user.ventum.new(cliente:@cliente, clave:@clave, fecha:@fecha, iva:@iva, subtotal:@preciofinal ,total:@totalcosto, descuentogeneral: @descglobal, distribuidor: @distribuidor, status: \"En proceso\")\n respond_to do |format|\n if(@ventum.save)\n salvar()\n format.html { redirect_to @ventum, notice: 'Venta almacenada exitosamente!.' }\n else\n format.html { redirect_to eventos_path, notice: 'Fallo el almacenamiento de la venta.' }\n end\n \n end\n end", "def create\n announcer = current_user.announcer\n @vacancy = Vacancy.new(vacancy_params)\n\n respond_to do |format|\n if @vacancy.save\n format.html { redirect_to edit_announcer_path(announcer), notice: 'Vaga cadastrada com sucesso.' }\n format.json { render :show, status: :created, location: @vacancy }\n else\n format.html { render :new }\n format.json { render json: @vacancy.errors, status: :unprocessable_entity }\n end\n end\n authorize! current_user, @vacancy\n end", "def create\n\tunless session[:admin] || session[:cliente]\n\t\tredirect_to :controller => \"cliente\", :action => \"login\"\n\telse\n\n @reserva = Reserva.new(params[:reserva])\n\n respond_to do |format|\n if @reserva.save\n flash[:notice] = 'Reserva was successfully created.'\n format.html { redirect_to(@reserva) }\n format.xml { render :xml => @reserva, :status => :created, :location => @reserva }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @reserva.errors, :status => :unprocessable_entity }\n end\n end\n\tend\n end", "def create\n @reservationdetail = Reservationdetail.new(reservationdetail_params)\n\n respond_to do |format|\n if @reservationdetail.save\n format.html { redirect_to reservation_reservationdetail_url(@reservation, @reservationdetail), notice: 'Reservationdetail was successfully created.' }\n format.json { render :show, status: :created, location: @reservationdetail }\n else\n format.html { render :new }\n format.json { render json: @reservationdetail.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @preservative = Preservative.new(params[:preservative])\n\n respond_to do |format|\n if @preservative.save\n format.html { redirect_to preservatives_path }#, notice: 'Preservative was successfully created.' }\n format.json { render json: @preservative, status: :created, location: @preservative }\n else\n format.html { render action: \"new\" }\n format.json { render json: @preservative.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @vacancy = Vacancy.new(vacancy_params)\n\n respond_to do |format|\n if @vacancy.save\n format.html { redirect_to @vacancy, notice: \"Vacancy was successfully created.\" }\n format.json { render :show, status: :created, location: @vacancy }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @vacancy.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @reservation = Reservation.new(reservation_params)\n\n respond_to do |format|\n if @reservation.save\n format.html { redirect_to request.referer, notice: 'Reservation was successfully created.' }\n format.json { render 'show', status: :created, location: @reservation }\n else\n format.html { redirect_to request.referer, alert: @reservation.errors.messages[:user].try(:first) }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @reservations = Reservation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reservations }\n end\n end", "def index\n @reservations = Reservation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reservations }\n end\n end", "def create\n @event = Event.find(params[:event_id])\n @user = current_user\n\n if params[:waiting_list]\n # add user to waiting_list\n @reservation = Reservation.new(reservation_params)\n @reservation.status = \"Waiting_List\"\n @reservation.save\n flash[:notice] = \"You will be notified by email if a seat becomes available!\"\n redirect_to event_path @event\n else\n begin\n if params[\"stored_card\"]\n result = Braintree::Transaction.sale(\n amount: params[\"amount\"],\n customer_id: @user.braintree_customer_id\n )\n else\n result = Braintree::Transaction.sale(\n amount: params[\"amount\"],\n credit_card: {\n number: params[\"number\"],\n cvv: params[\"cvv\"],\n expiration_month: params[\"month\"],\n expiration_year: params[\"year\"]\n },\n options: {\n submit_for_settlement: true\n }\n )\n end\n rescue SocketError => e\n logger.info(e)\n end\n\n if result.success?\n @reservation = Reservation.new(reservation_params)\n @reservation.transaction_number = result.transaction.id\n @reservation.update_attribute(:status, \"Completed\")\n @event.update_number_of_available_seats\n @event.save\n flash[:notice] = \"Reservation was successfully created. Transaction ID: #{result.transaction.id}\"\n redirect_to event_path @event\n else\n flash[:notice] = \"Error while processing payment: #{result.message}\"\n redirect_to event_path @event\n end\n end\n end", "def create\n @reservation = Reservation.new(params[:reservation])\n if user_signed_in?\n @reservation.user_id = current_user.id\n elsif owner_signed_in?\n @reservation.owner_id = current_owner.id\n @reservation.restaurant = current_owner.restaurant\n end\n\n respond_to do |format|\n if @reservation.save\n\n if user_signed_in?\n Reward.create( user_id: @reservation.user_id, \n reservation_id: @reservation.id, \n points_total: 5*@reservation.party_size, \n points_pending: 5*@reservation.party_size, \n description: \"\")\n end\n \n if user_signed_in?\n format.html { redirect_to @reservation, notice: 'Reservation was successfully created.' }\n format.json { render json: @reservation, status: :created, location: @reservation }\n else\n format.html { redirect_to root_url, notice: 'Reservation was successfully created.' }\n end\n\n # UserMailer.booking_create(current_user, @reservation).deliver\n # OwnerMailer.booking_create(@reservation).deliver\n else\n format.html { render action: \"new\" }\n # format.html { redirect_to new_reservation_path(reservation: params[:reservation]) }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n\n end\n end" ]
[ "0.64979404", "0.64805186", "0.64497864", "0.6440722", "0.6385648", "0.6333808", "0.6319449", "0.6315092", "0.6313366", "0.6262636", "0.6238035", "0.6231008", "0.61954", "0.61954", "0.6189839", "0.6158287", "0.61571306", "0.61452997", "0.6145169", "0.6130581", "0.61285365", "0.6128237", "0.60977066", "0.6079845", "0.6071872", "0.60651255", "0.6056795", "0.6055263", "0.6053881", "0.6052373", "0.6049908", "0.60383636", "0.60164666", "0.6011973", "0.6010469", "0.6004596", "0.60000104", "0.5996055", "0.5992805", "0.59760445", "0.5958824", "0.59571", "0.5934491", "0.5923411", "0.5910712", "0.59015363", "0.58950806", "0.5863255", "0.585997", "0.5841486", "0.57908773", "0.5788666", "0.5785257", "0.57844454", "0.5773062", "0.57538295", "0.5752561", "0.5747168", "0.57451737", "0.5745096", "0.5744117", "0.57428086", "0.5741517", "0.5737576", "0.5735922", "0.5734144", "0.5725926", "0.57139605", "0.57054853", "0.56979316", "0.56977344", "0.569198", "0.5683307", "0.56816506", "0.56804395", "0.5679364", "0.56755424", "0.56637937", "0.5657055", "0.5654667", "0.5649672", "0.5644533", "0.5636852", "0.5629579", "0.5629117", "0.5625526", "0.5623309", "0.5613654", "0.5611385", "0.5597998", "0.5592656", "0.55907536", "0.55888945", "0.5585743", "0.55839825", "0.5581713", "0.5581379", "0.5581379", "0.5574786", "0.557175" ]
0.64593047
2
PATCH/PUT /reservacions/1 PATCH/PUT /reservacions/1.json
def update respond_to do |format| if @reservacion.update(reservacion_params) format.html { redirect_to @reservacion, notice: 'La información de su reservación fue actualizada satisfactoriamente.' } format.json { render :show, status: :ok, location: @reservacion } else format.html { render :edit } format.json { render json: @reservacion.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n puts \"HACE ALGOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO\"\n if !params[:reserva][:tipo_reserva].blank?\n @tipo_reserva = TipoReserva.find(params[:reserva][:tipo_reserva])\n @reserva.tipo_reserva = @tipo_reserva\n end\n\n if !params[:reserva][:habitacion].blank?\n @habitacion = Habitacion.find(params[:reserva][:habitacion])\n @reserva.habitacion = @habitacion\n end\n\n if !params[:reserva][:cliente].blank?\n @cliente = Cliente.find(params[:reserva][:cliente])\n @reserva.cliente = @cliente\n end\n if !params[:reserva][:confirmada].blank?\n @reserva.confirmada = params[:reserva][:confirmada]\n end\n if @reserva.update(reserva_params)\n format.html { redirect_to reservas_url, notice: 'Reserva modificada con exito.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @reserva.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @vacancy.update(vacancy_params)\n format.html { redirect_to @vacancy, notice: 'Вакансия обновлена.' }\n format.json { render :show, status: :ok, location: @vacancy }\n else\n format.html { render :edit }\n format.json { render json: @vacancy.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @vacation = Vacation.find(params[:id])\n\n respond_to do |format|\n if @vacation.update_attributes(params[:vacation])\n format.html { redirect_to @vacation, notice: 'Vacation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @vacation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @vacancy.update(vacancy_params)\n format.html { redirect_to @vacancy, notice: 'Vacante actualizada correctamente.' }\n format.json { render :show, status: :ok, location: @vacancy }\n else\n format.html { render :edit }\n format.json { render json: @vacancy.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @vacation_request.update(vacation_request_params)\n format.html { redirect_to @vacation_request, notice: 'Vacation request was successfully updated.' }\n format.json { render :show, status: :ok, location: @vacation_request }\n else\n format.html { render :edit }\n format.json { render json: @vacation_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @particular_vacancy_request.update(particular_vacancy_request_params)\n format.html { redirect_to @particular_vacancy_request, notice: 'Particular vacancy request was successfully updated.' }\n format.json { render :show, status: :ok, location: @particular_vacancy_request }\n else\n format.html { render :edit }\n format.json { render json: @particular_vacancy_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @vacina.update(vacina_params)\n format.html { redirect_to @vacina, notice: 'Vacina editada com sucesso.' }\n format.json { render :show, status: :ok, location: @vacina }\n else\n format.html { render :edit }\n format.json { render json: @vacina.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @vacation = Vacation.find(params[:id])\n set_tz_offset(:vacation)\n\n respond_to do |format|\n if @vacation.update_attributes(params[:vacation])\n format.html { redirect_to @vacation, :notice => 'Vacation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @vacation.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @vacancy.update(vacancy_params)\n format.html { redirect_to @vacancy, notice: \"Vacancy was successfully updated.\" }\n format.json { render :show, status: :ok, location: @vacancy }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @vacancy.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @vacancy = Vacancy.find(params[:id])\n\n respond_to do |format|\n if @vacancy.update_attributes(params[:vacancy])\n format.html { redirect_to @vacancy, notice: 'Vacancy was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @vacancy.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @vacancy.update(vacancy_params)\n format.html { redirect_to @vacancy, notice: 'Vacancy was successfully updated.' }\n format.json { render :show, status: :ok, location: @vacancy }\n else\n format.html { render :edit }\n format.json { render json: @vacancy.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @vacancy.update(vacancy_params)\n format.html { redirect_to @vacancy, notice: 'Vacancy was successfully updated.' }\n format.json { render :show, status: :ok, location: @vacancy }\n else\n format.html { render :edit }\n format.json { render json: @vacancy.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @user_vacancy.update(user_vacancy_params)\n format.html { redirect_to @user_vacancy, notice: 'Aplicación actualizada correctamente' }\n format.json { render :show, status: :ok, location: @user_vacancy }\n else\n format.html { render :edit }\n format.json { render json: @user_vacancy.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @vehicle_reservation.update(vehicle_reservation_params)\n format.html { redirect_to @vehicle_reservation, notice: 'Reserva atualizada com sucesso.' }\n format.json { render :show, status: :ok, location: @vehicle_reservation }\n else\n format.html { render :edit }\n format.json { render json: @vehicle_reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @vacina.update(vacina_params)\n format.html { redirect_to @vacina, notice: \"Vacina was successfully updated.\" }\n format.json { render :show, status: :ok, location: @vacina }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @vacina.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n raise\n respond_to do |format|\n if @vacination.update(vacination_params)\n format.html { redirect_to '/vacinations/'+ activity.id.to_s, notice: 'Vacination was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @vacination.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @reservation.update(reservation_params)\n render json: @reservation\n else\n render json: @reservation.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @vacancy.update(vacancy_params)\n format.html { redirect_to @vacancy, notice: 'Vaga atualizada com sucesso.' }\n format.json { render :show, status: :ok, location: @vacancy }\n else\n format.html { render :edit }\n format.json { render json: @vacancy.errors, status: :unprocessable_entity }\n end\n end\n authorize! current_user, @vacancy\n end", "def update\n @reserf = Reserve.find(params[:id])\n @reserf.status = \"confirm\"\n respond_to do |format|\n if @reserf.update_attributes(params[:reserf])\n format.html { redirect_to reserves_path, notice: 'Reserve was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @reserf.errors, status: :unprocessable_entity }\n end\n end\n\n #redirect_to reserves_path\n end", "def update\n @vacation = Vacation.find(params[:id])\n\n respond_to do |format|\n if @vacation.update_attributes(params[:vacation])\n # format.html { redirect_to(vteam_vacations_path(@vacation.resource_vteam_allocation.vteam,@vacation), :notice => 'Vacation was successfully updated.') }\n\n format.html #{ redirect_to(@vacation, :notice => 'Vacation was successfully updated.') }\n @vacations = Vacation.order(\"created_at DESC\").search(\n :resource_vteam_allocation_vteam_id_eq =>params[:vteam_id] ).\n paginate(:per_page => Vacation.per_page,:page=>params[:page])\n format.js\n\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @vacation.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n if @vat.update(vat_params)\n head :no_content\n else\n render json: @vat.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { redirect_to @reservation, notice: 'Reservation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @vacuna.update(vacuna_params)\n format.html { redirect_to @vacuna, notice: 'Vacuna was successfully updated.' }\n format.json { render :show, status: :ok, location: @vacuna }\n else\n format.html { render :edit }\n format.json { render json: @vacuna.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @reserva.update(reserva_params)\n format.html { redirect_to @reserva, notice: 'Reserva was successfully updated.' }\n format.json { render :show, status: :ok, location: @reserva }\n else\n format.html { render :edit }\n format.json { render json: @reserva.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @reserva.update(reserva_params)\n format.html { redirect_to @reserva, notice: 'Reserva was successfully updated.' }\n format.json { render :show, status: :ok, location: @reserva }\n else\n format.html { render :edit }\n format.json { render json: @reserva.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @reserva.update(reserva_params)\n format.html { redirect_to @reserva, notice: 'Reserva was successfully updated.' }\n format.json { render :show, status: :ok, location: @reserva }\n else\n format.html { render :edit }\n format.json { render json: @reserva.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @reservation.update(reservation_add_params)\n render :json => @reservation, status: :ok\n else\n render json: @reservation.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { redirect_to reservations_url, notice: 'Reservation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { redirect_to request.referer, notice: 'Reservation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render 'edit' }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @person.seat\n render json: {errors: 'Cannot update a seated person'}, status: 422\n else\n @person.update person_params\n render json: @person\n end\n end", "def update\n @reservation = current_user.reservations.find(params[:id])\n\n respond_to do |format|\n if @reservation.update_attributes(params[:reservation])\n format.html { redirect_to @reservation, notice: 'Reservation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @vacancy_request_status.update(vacancy_request_status_params)\n format.html { redirect_to @vacancy_request_status, notice: 'Vacancy request status was successfully updated.' }\n format.json { render :show, status: :ok, location: @vacancy_request_status }\n else\n format.html { render :edit }\n format.json { render json: @vacancy_request_status.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @veiculo = Veiculo.find(params[:id])\n\n respond_to do |format|\n if @veiculo.update_attributes(params[:veiculo])\n format.html { redirect_to @veiculo, :notice => 'Veiculo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @veiculo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @reservation = Reservation.find(params[:id])\n @reservation.user_id = current_user.id\n\n respond_to do |format|\n if @reservation.update_attributes(params[:reservation])\n format.html { redirect_to @reservation, notice: 'Reservation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @servicio = Servicio.find(params[:id])\n\n respond_to do |format|\n if @servicio.update_attributes(params[:servicio])\n format.html { redirect_to @servicio, :notice => 'Servicio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @servicio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def UpdateView params = {}\n \n APICall(path: 'views.json',method: 'PUT',payload: params.to_json)\n \n end", "def update\n obtener_datos()\n @status = params[:statusproyect]\n @cliente = params[:cliente] + \" \" +params[:cliente_apellido]\n respond_to do |format|\n if @ventum.update(cliente: @cliente, clave:@clave, fecha:@fecha, iva:@iva,subtotal:@preciofinal ,total:@totalcosto, descuentogeneral: @descglobal , distribuidor: @distribuidor, status: @status)\n @detail.each do |x|\n x.destroy\n end\n salvar()\n format.html { redirect_to @ventum, notice: 'Venta actualizada correctamente.' }\n format.json { render :show, status: :ok, location: @ventum }\n else\n format.html { render :edit }\n format.json { render json: @ventum.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @reservation = Reservation.find(params[:id])\n respond_to do |format| \n if @reservation.update_attributes(params[:reservation])\n format.html { redirect_to @reservation, notice: 'Reservation was successfully updated.' }\n format.json { head :no_content }\n else \n format.js {render 'new'}\n format.html { render action: \"edit\" }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @servico.update(servico_params)\n format.html { redirect_to servicos_url, notice: 'Serviço atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @servico }\n else\n format.html { render :edit }\n format.json { render json: @servico.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { notification(false) }\n format.json { render :show, status: :ok, location: @reservation }\n else\n format.html { render :edit }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @reserf = Reserve.find(params[:id])\n\n respond_to do |format|\n if @reserf.update_attributes(params[:reserf])\n format.html { redirect_to @reserf, notice: 'Reserve was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @reserf.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @reservation_request.update(reservation_request_params)\n format.html { redirect_to @reservation_request, notice: 'Reservation fue Actualizada.' }\n format.json { render :show, status: :ok, location: @reservation_request }\n else\n format.html { render :edit }\n format.json { render json: @reservation_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { redirect_to @reservation, :flash => {:success => 'Reservation was successfully updated.'} } \n format.json { render :show, status: :ok, location: @reservation }\n else\n format.html { render :edit }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ventum.update(ventum_params)\n format.html { redirect_to @ventum, notice: 'Venta fue modificado satisfactoriamente.' }\n format.json { render :show, status: :ok, location: @ventum }\n else\n format.html { render :edit }\n format.json { render json: @ventum.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { redirect_to apartment_reservations_path(@apartment), notice: 'Reserva Actualizada.' }\n format.json { render :show, status: :ok, location: @reservation }\n else\n format.html { render :edit }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n format_time_input\n check_input\n respond_to do |format|\n # TODO: Duplication\n if @conflicts.any?\n respond_to_conflicts :edit, format\n elsif @reservation.update(reservation_params)\n notify_approval_needed\n respond_to_update format\n else\n respond_to_errors :edit, format\n end\n end\n end", "def update\n respond_to do |format|\n if @reservation_owner.update(reservation_owner_params)\n format.html { redirect_to @reservation_owner, notice: 'Reservation owner was successfully updated.' }\n format.json { render :show, status: :ok, location: @reservation_owner }\n else\n format.html { render :edit }\n format.json { render json: @reservation_owner.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n @appointment_request = current_user.requests.find_by(\n id: params[:request_id]\n )\n\n if @appointment_request.present?\n render json: { appointment_request: @appointment_request, status: 200 }\n else\n render json: { status: 404, layout: false }, status: 404\n end\n end", "def update\n @reservation = Reservation.find(params[:id])\n\n respond_to do |format|\n if @reservation.update_attributes(reservation_params)\n format.html { redirect_to reservations_path, notice: 'Reservation was successfully updated.' }\n format.json { head :no_content }\n format.js\n else\n format.html { render action: \"edit\" }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end", "def update\n @vegetable = Vegetable.find(params[:id])\n @vegetable.start = @vegetable.start_sowing_month\n @vegetable.finish = @vegetable.end_planting_out_month\n\n respond_to do |format|\n if @vegetable.update_attributes(params[:vegetable].merge (params[:date]))\n format.html { redirect_to @vegetable, notice: 'Vegetable was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @vegetable.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { redirect_to @reservation, notice: \"Reservation was successfully updated.\" }\n format.json { render :show, status: :ok, location: @reservation }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { redirect_to @reservation, notice: 'Reservation was successfully updated.' }\n format.json { render :show, status: :ok, location: @reservation }\n else\n format.html { render :edit }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { redirect_to @reservation, notice: 'Reservation was successfully updated.' }\n format.json { render :show, status: :ok, location: @reservation }\n else\n format.html { render :edit }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { redirect_to @reservation, notice: 'Reservation was successfully updated.' }\n format.json { render :show, status: :ok, location: @reservation }\n else\n format.html { render :edit }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { redirect_to @reservation, notice: 'Reservation was successfully updated.' }\n format.json { render :show, status: :ok, location: @reservation }\n else\n format.html { render :edit }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { redirect_to @reservation, notice: 'Reservation was successfully updated.' }\n format.json { render :show, status: :ok, location: @reservation }\n else\n format.html { render :edit }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { redirect_to @reservation, notice: 'Reservation was successfully updated.' }\n format.json { render :show, status: :ok, location: @reservation }\n else\n format.html { render :edit }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { redirect_to @reservation, notice: 'Reservation was successfully updated.' }\n format.json { render :show, status: :ok, location: @reservation }\n else\n format.html { render :edit }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { redirect_to @reservation, notice: 'Reservation was successfully updated.' }\n format.json { render :show, status: :ok, location: @reservation }\n else\n format.html { render :edit }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { redirect_to @reservation, notice: 'Reservation was successfully updated.' }\n format.json { render :show, status: :ok, location: @reservation }\n else\n format.html { render :edit }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { redirect_to @reservation, notice: 'Reservation was successfully updated.' }\n format.json { render :show, status: :ok, location: @reservation }\n else\n format.html { render :edit }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { redirect_to @reservation, notice: 'Reservation was successfully updated.' }\n format.json { render :show, status: :ok, location: @reservation }\n else\n format.html { render :edit }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { redirect_to @reservation, notice: 'Reservation was successfully updated.' }\n format.json { render :show, status: :ok, location: @reservation }\n else\n format.html { render :edit }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { redirect_to @reservation, notice: 'Reservation was successfully updated.' }\n format.json { render :show, status: :ok, location: @reservation }\n else\n format.html { render :edit }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { redirect_to @reservation, notice: 'Reservation was successfully updated.' }\n format.json { render :show, status: :ok, location: @reservation }\n else\n format.html { render :edit }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @calificacion_servicio = CalificacionServicio.find(params[:id])\n\n respond_to do |format|\n if @calificacion_servicio.update_attributes(params[:calificacion_servicio])\n format.html { redirect_to @calificacion_servicio, notice: 'Calificacion servicio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @calificacion_servicio.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 respond_to do |format|\n if @servidor.update(servidor_params)\n format.html { redirect_to @servidor, notice: 'Servidor atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @servidor.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @application_vacancy.update(application_vacancy_params)\n format.html { redirect_to @application_vacancy, notice: \"Application vacancy was successfully updated.\" }\n format.json { render :show, status: :ok, location: @application_vacancy }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @application_vacancy.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @solicitacoes_avaliacoes_servico.update(solicitacoes_avaliacoes_servico_params)\n format.html { redirect_to @solicitacoes_avaliacoes_servico, notice: 'Solicitacoes avaliacoes servico was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @solicitacoes_avaliacoes_servico.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @serving = Serving.find(params[:id])\n\n respond_to do |format|\n if @serving.update_attributes(params[:serving])\n format.html { redirect_to @serving, notice: 'Serving was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @serving.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @vacancy = Vacancy.find(params[:id])\n unless @current_user.is_moderator? or @vacancy.user == @current_user\n redirect_to home_path, flash: { error: \"Нет прав на редактирование вакансии.\" }\n return\n end\n respond_to do |format|\n if @vacancy.update_attributes(params[:vacancy])\n format.html { redirect_to vacancies_path, notice: 'Вакансия успешно обновлена.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @vacancy.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @employee_reservation.update(employee_reservation_params)\n format.html { redirect_to @employee_reservation, notice: 'Reservation was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee_reservation }\n else\n format.html { render :edit }\n format.json { render json: @employee_reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @vacancy.update(vacancy_params)\n update_skills\n format.html { redirect_to @vacancy, notice: 'Vacancy was successfully updated.' }\n format.json { render :show, status: :ok, location: @vacancy }\n else\n format.html { render :edit }\n format.json { render json: @vacancy.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @situacao_reserva.update(situacao_reserva_params)\n format.html { redirect_to action: \"new\", notice: 'Situação reserva atualizado com sucesso..' }\n format.json { render :show, status: :ok, location: @situacao_reserva }\n else\n format.html { render :edit }\n format.json { render json: @situacao_reserva.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @venta = Venta.find(params[:id])\n\n respond_to do |format|\n if @venta.update_attributes(params[:venta])\n format.html { redirect_to @venta, notice: 'Venta was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @venta.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n respond_to do |format|\r\n if @reservation.update(reservation_params)\r\n format.html { redirect_to @reservation, notice: 'Reservation was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @reservation }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\r\n respond_to do |format|\r\n if @reservation.update(reservation_params)\r\n format.html { redirect_to @reservation, notice: 'Reservation was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @reservation }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n respond_to do |format|\n if @servant.update(servant_params)\n format.html { redirect_to @servant, notice: 'Servant was successfully updated.' }\n format.json { render :show, status: :ok, location: @servant }\n else\n format.html { render :edit }\n format.json { render json: @servant.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @reservation_detail.update(reservation_detail_params)\n format.html { redirect_to @reservation_detail, notice: \"Reservation detail was successfully updated.\" }\n format.json { render :show, status: :ok, location: @reservation_detail }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @reservation_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sivic_discipulo.update(sivic_discipulo_params_netested)\n format.html { redirect_to @sivic_discipulo, notice: 'Registro alterado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sivic_discipulo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @safra_verdoso = SafraVerdoso.find(params[:id])\n\n respond_to do |format|\n if @safra_verdoso.update_attributes(params[:safra_verdoso])\n format.html { redirect_to \"/safra_produtos/#{@safra_verdoso.safra_produto_id}/descontos\"}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @safra_verdoso.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @reservation.update(reservation_params)\n render :show, status: :ok, location: @reservation\n else\n render json: @reservation.errors, status: :unprocessable_entity\n end\n end", "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end", "def update\n @preservative = Preservative.find(params[:id])\n\n respond_to do |format|\n if @preservative.update_attributes(params[:preservative])\n format.html { redirect_to @preservative }#, notice: 'Preservative was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @preservative.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @reserf.update(reserve_params)\n format.html { redirect_to @reserf, notice: 'Reserve was successfully updated.' }\n format.json { render :show, status: :ok, location: @reserf }\n else\n format.html { render :edit }\n format.json { render json: @reserf.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @admin_vacancy.update(admin_vacancy_params)\n format.html { redirect_to @admin_vacancy, notice: 'Vacancy was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_vacancy }\n else\n format.html { render :edit }\n format.json { render json: @admin_vacancy.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end", "def update\n respond_to do |format|\n if @reserva_aceitum.update(reserva_aceitum_params)\n format.html { redirect_to @reserva_aceitum, notice: 'Reserva aceitum was successfully updated.' }\n format.json { render :show, status: :ok, location: @reserva_aceitum }\n else\n format.html { render :edit }\n format.json { render json: @reserva_aceitum.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @servico_pacote.update(servico_pacote_params)\n format.html { redirect_to @servico_pacote, notice: 'Pacote was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @servico_pacote.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n resource.update(deposit_contract_params)\n respond_with client, resource\n end", "def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n @ticket.update_responsible(:status, 'Waiting for Staff Response')\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 @registro_servicio.update(registro_servicio_params)\n format.html { redirect_to @registro_servicio, notice: 'Servicio was successfully updated.' }\n format.json { render :show, status: :ok, location: @registro_servicio }\n else\n format.html { render :edit }\n format.json { render json: @registro_servicio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @vano.update(vano_params)\n format.html { redirect_to @vano, notice: 'Vano was successfully updated.' }\n format.json { render :show, status: :ok, location: @vano }\n else\n format.html { render :edit }\n format.json { render json: @vano.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @clientes_servico.update(clientes_servico_params)\n format.html { redirect_to @clientes_servico, notice: 'Clientes servico was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @clientes_servico.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { redirect_to venue_reservation_url, notice: 'Reservation was successfully updated.' }\n format.json { render :show, status: :created, location: @reservation }\n else\n format.html { render :new }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @volunteer.update(volunteer_params)\n format.html { redirect_to @volunteer, notice: 'Volunteer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @volunteer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n reservation = Reservation.find(params[:id])\n respond_to do |format|\n if reservation.update(car_params)\n format.html { render :show,:locals => {:reservation => reservation}, notice: 'Reservation was successfully created.' }\n format.json { render :show,:locals => {:reservation => reservation}, status: :ok, location: reservation }\n else\n format.html { render :edit,:locals => {:reservation => reservation} }\n format.json { render json: reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n puts @reservation.inspect\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { redirect_to @reservation, notice: 'Reservation was successfully updated.' }\n format.json { render :show, status: :ok, location: @reservation }\n else\n format.html { render :edit }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @compra_venta_normal.update(compra_venta_normal_params)\n format.html { redirect_to @compra_venta_normal, notice: 'Compra venta normal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @compra_venta_normal.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.639913", "0.6363221", "0.6337682", "0.6325511", "0.6313938", "0.6266817", "0.6241336", "0.6227062", "0.6212029", "0.62042904", "0.6191312", "0.6191312", "0.61896724", "0.61825114", "0.6178", "0.6173726", "0.6160837", "0.6144482", "0.61315525", "0.6122983", "0.6113391", "0.6097375", "0.60922986", "0.60730207", "0.60730207", "0.60730207", "0.60726506", "0.6069483", "0.6056645", "0.60543823", "0.6036178", "0.6035512", "0.60190094", "0.6018558", "0.6014842", "0.60131705", "0.6008966", "0.6007732", "0.60022825", "0.5995001", "0.59755874", "0.5968739", "0.59650004", "0.59639007", "0.5949212", "0.5949189", "0.5946192", "0.59396124", "0.59372634", "0.5925796", "0.5923269", "0.59070706", "0.59065104", "0.59065104", "0.59065104", "0.59065104", "0.59065104", "0.59065104", "0.59065104", "0.59065104", "0.59065104", "0.59065104", "0.59065104", "0.59065104", "0.59065104", "0.59046304", "0.5901046", "0.5899059", "0.5895948", "0.58935463", "0.58921885", "0.58815426", "0.58798206", "0.58782464", "0.587719", "0.58751595", "0.58611083", "0.58611083", "0.58598787", "0.5859595", "0.5851362", "0.58447415", "0.5844579", "0.58428836", "0.5841333", "0.5839687", "0.58275026", "0.5825389", "0.5817111", "0.58124894", "0.58121175", "0.58104545", "0.5810363", "0.5807279", "0.58020866", "0.58003396", "0.58000535", "0.5798091", "0.5797096", "0.57954615" ]
0.5968782
41
DELETE /reservacions/1 DELETE /reservacions/1.json
def destroy @reservacion.destroy respond_to do |format| format.html { redirect_to reservacions_url, notice: 'Su Reservación fue eliminada satisfactoriamente.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n reservation = Reservation.find(params[:id])\n if reservation\n reservation.destroy\n render json: reservation\n else \n render json: [\"Reservation doesnt exist\"], status: 404 \n end \n end", "def destroy\n @vacancy.destroy\n respond_to do |format|\n format.html { redirect_to vacancies_url, notice: 'Вакансия удалена.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @vacation = Vacation.find(params[:id])\n @vacation.destroy\n\n respond_to do |format|\n format.html { redirect_to vacations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @vacancy.destroy\n respond_to do |format|\n format.html { redirect_to vacancies_url, notice: 'Vacante eliminada correctamente.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reserva.destroy\n respond_to do |format|\n format.html { redirect_to reservas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @reserf = Reserve.find(params[:id])\n @reserf.destroy\n\n respond_to do |format|\n format.html { redirect_to reserves_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @vacancy = Vacancy.find(params[:id])\n @vacancy.destroy\n\n respond_to do |format|\n format.html { redirect_to vacancies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n Reservation.find(params[:id]).destroy\n #@reservation.destroy\n respond_to do |format|\n format.html { redirect_to reservation_url(1), notice: 'Reservation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reserva.destroy\n respond_to do |format|\n format.html { redirect_to reservas_url, notice: 'Reserva was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reserva.destroy\n respond_to do |format|\n format.html { redirect_to reservas_url, notice: 'Reserva was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reserva.destroy\n respond_to do |format|\n format.html { redirect_to reservas_url, notice: 'Reserva was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reserf.destroy\n respond_to do |format|\n format.html { redirect_to reserves_url, notice: 'Reserve was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reservation.destroy\n\n respond_to do |format|\n format.html { redirect_to reservations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @reservation = Reservation.find(params[:id])\n @reservation.destroy\n\n respond_to do |format|\n format.html { redirect_to reservations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @reservation = Reservation.find(params[:id])\n @reservation.destroy\n\n respond_to do |format|\n format.html { redirect_to reservations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @reservation = Reservation.find(params[:id])\n @reservation.destroy\n\n respond_to do |format|\n format.html { redirect_to reservations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @reservation = Reservation.find(params[:id])\n @reservation.destroy\n\n respond_to do |format|\n format.html { redirect_to reservations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @reserve.destroy\n respond_to do |format|\n format.html { redirect_to reserf_url, notice: 'Reserf was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to reservations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to reservations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to reservations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @vehicle_reservation.destroy\n respond_to do |format|\n format.html { redirect_to vehicle_reservations_url, notice: 'Reserva excluída com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @vacancy.destroy\n respond_to do |format|\n format.html { redirect_to vacancies_url, notice: \"Vacancy was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @vacancy.destroy\n respond_to do |format|\n format.html { redirect_to vacancies_url, notice: 'Vacancy was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @vacancy.destroy\n respond_to do |format|\n format.html { redirect_to vacancies_url, notice: 'Vacancy was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @vacation_request.destroy\n respond_to do |format|\n format.html { redirect_to vacation_requests_url, notice: 'Vacation request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to reservations_url, notice: 'La reserva fue eliminada.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @status_ativ = StatusAtiv.find(params[:id])\n @status_ativ.destroy\n\n respond_to do |format|\n format.html { redirect_to status_ativs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @odsreserf.destroy\n respond_to do |format|\n format.html { redirect_to odsreserves_url, notice: 'Odsreserf was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reserva = Reserva.find(params[:id])\n @reserva.destroy\n respond_with @reserva, :location => admin_reservas_path\n end", "def destroy\n @user_vacancy.destroy\n respond_to do |format|\n format.html { redirect_to user_vacancies_url, notice: 'Aplicación eliminada correctamente' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reserva.destroy\n respond_to do |format|\n format.html { redirect_to reservas_url, notice: 'La Reserva ha sido destruido totalmente.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @vacina.destroy\n respond_to do |format|\n format.html { redirect_to vacinas_url, notice: 'Vacina excluida.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @particular_vacancy_request.destroy\n respond_to do |format|\n format.html { redirect_to particular_vacancy_requests_url, notice: 'Particular vacancy request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reservation = current_user.reservations.find(params[:id])\n @reservation.destroy\n\n respond_to do |format|\n format.html { redirect_to reservations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @vacancy.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Vacancy was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @ventum.destroy\n respond_to do |format|\n format.html { redirect_to venta_url, notice: 'Se ha eliminado la venta exitosamente.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reserve.destroy\n respond_to do |format|\n format.html { redirect_to reserves_url, notice: 'Reserve was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @serv_adicionale = ServAdicionale.find(params[:id])\n @serv_adicionale.destroy\n\n respond_to do |format|\n format.html { redirect_to serv_adicionales_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @reservation = Reservation.find(params[:id])\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to reservations_url, notice: 'Reservation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @vacina.destroy\n respond_to do |format|\n format.html { redirect_to vacinas_url, notice: \"Vacina 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 @reservation.destroy\n respond_to do |format|\n format.html { redirect_to apartment_reservations_url(@apartment), notice: 'Reserva Eliminada.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to reservations_url, notice: \"Reservation was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to reservations_url, notice: \"Reservation was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to reservations_url, notice: 'Reservation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to reservations_url, notice: 'Reservation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to reservations_url, notice: 'Reservation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to reservations_url, notice: 'Reservation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to reservations_url, notice: 'Reservation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to reservations_url, notice: 'Reservation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to reservations_url, notice: 'Reservation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to reservations_url, notice: 'Reservation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to reservations_url, notice: 'Reservation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to reservations_url, notice: 'Reservation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to reservations_url, notice: 'Reservation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to reservations_url, notice: 'Reservation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to reservations_url, notice: 'Reservation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to reservations_url, notice: 'Reservation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to reservations_url, notice: 'Reservation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to reservations_url, notice: 'Reservation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @vacation = Vacation.find(params[:id])\n @vacation.destroy\n\n respond_to do |format|\n format.html { redirect_to(vacations_url) }\n format.xml { head :ok }\n end\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def destroy\n @servidor.destroy\n respond_to do |format|\n format.html { redirect_to servidores_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @estado_remate.destroy\n respond_to do |format|\n format.html { redirect_to estado_remates_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to venue_reservations_url, notice: 'Reservation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @venta = Venta.find(params[:id])\n @venta.destroy\n\n respond_to do |format|\n format.html { redirect_to ventas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @serving = Serving.find(params[:id])\n @serving.destroy\n\n respond_to do |format|\n format.html { redirect_to servings_url }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @reservation.destroy\r\n respond_to do |format|\r\n format.html { redirect_to reservations_url, notice: 'Reservation was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @servicio = Servicio.find(params[:id])\n @servicio.destroy\n\n respond_to do |format|\n format.html { redirect_to servicios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @servant.destroy\n respond_to do |format|\n format.html { redirect_to servants_url, notice: 'Servant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @situacao_reserva.destroy\n respond_to do |format|\n format.html { redirect_to action: \"new\", notice: 'Situação reserva deletado com sucesso..' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reservation_detail.destroy\n respond_to do |format|\n format.html { redirect_to reservation_details_url, notice: \"Reservation detail was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @vacination = Vacination.find(params[:id])\n @vacination.activity.destroy\n respond_to do |format|\n format.html { redirect_to vacinations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @reservationc.destroy\n respond_to do |format|\n format.html { redirect_to reservationcs_url, notice: \"Reservationc was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @reservation = Reservation.find(params[:id])\n authorize! :manage, @reservation\n @reservation.destroy\n\n respond_to do |format|\n format.html { redirect_to reservations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @reserved.destroy\n respond_to do |format|\n format.html { redirect_to reserveds_url, notice: 'Reserved was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ventum.destroy\n respond_to do |format|\n format.html { redirect_to venta_url, notice: 'Venteliminada satisfactoriamente.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @situacion_revistum = SituacionRevistum.find(params[:id])\n @situacion_revistum.destroy\n\n respond_to do |format|\n format.html { redirect_to situacion_revista_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @downtime.destroy\n respond_to do |format|\n format.html { redirect_to downtimes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ventaganancium.destroy\n respond_to do |format|\n format.html { redirect_to ventaganancia_url, notice: 'Ventaganancium was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @servidor.destroy\n respond_to do |format|\n format.html { redirect_to servidores_path, notice: 'Servidor excluído com sucesso!' }\n format.json { head :no_content }\n end\n end", "def destroy\n @vacuna.destroy\n respond_to do |format|\n format.html { redirect_to mascota_url, notice: 'Vacuna was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @qowa_vacation = Vacation.find(params[:id])\n @qowa_vacation.destroy\n\n respond_to do |format|\n format.html { redirect_to qowa_vacations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @manifestation_reserve_stat.destroy\n\n respond_to do |format|\n format.html { redirect_to manifestation_reserve_stats_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @trein_consul_comercial.destroy\n respond_to do |format|\n format.html { redirect_to trein_consul_comercials_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @vacancy_request_status.destroy\n respond_to do |format|\n format.html { redirect_to vacancy_request_statuses_url, notice: 'Vacancy request status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n # Logic to delete a record\n @maintenance = Maintenance.find(params[:id])\n @maintenance.destroy\n\n respond_to do |format|\n format.html { redirect_to maintenances_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @consultum = Consultum.find(params[:id])\n @consultum.destroy\n\n respond_to do |format|\n format.html { redirect_to consulta_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @vod.destroy\n respond_to do |format|\n format.html { redirect_to vods_url, notice: 'Vod was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reserva_aceitum.destroy\n respond_to do |format|\n format.html { redirect_to reserva_aceita_url, notice: 'Reserva aceitum was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ventas_agrupador_cliente.destroy\n respond_to do |format|\n format.html { redirect_to ventas_agrupador_clientes_url, notice: 'Agrupador cliente was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ventas_agrupador_cliente.destroy\n respond_to do |format|\n format.html { redirect_to ventas_agrupador_clientes_url, notice: 'Agrupador cliente was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reserve_stat_has_manifestation.destroy\n\n respond_to do |format|\n format.html { redirect_to(reserve_stat_has_manifestations_url) }\n format.json { head :no_content }\n end\n end", "def destroy\n @datos_insumos_reactivo.destroy\n respond_to do |format|\n format.html { redirect_to datos_insumos_reactivos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @appointment.destroy\n head 204\n end", "def destroy\n @preservative = Preservative.find(params[:id])\n @preservative.destroy\n\n respond_to do |format|\n format.html { redirect_to preservatives_url }\n format.json { head :ok }\n end\n end", "def destroy\n @observacao_vocacionada = ObservacaoVocacionada.find(params[:id])\n @observacao_vocacionada.destroy\n\n respond_to do |format|\n format.html { redirect_to observacao_vocacionadas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @arrival = Arrival.find(params[:id])\n @arrival.destroy\n\n respond_to do |format|\n format.html { redirect_to arrivals_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.72532225", "0.71367794", "0.71306396", "0.7126787", "0.7090269", "0.7072185", "0.7061395", "0.7012805", "0.7009868", "0.7009868", "0.7009868", "0.70001155", "0.6990178", "0.6989203", "0.6989203", "0.6989203", "0.6989203", "0.69835985", "0.69809735", "0.69809735", "0.69809735", "0.69615245", "0.69440645", "0.6942837", "0.6942837", "0.6932699", "0.69085246", "0.6897585", "0.68962055", "0.68935895", "0.68867564", "0.6884619", "0.68814105", "0.68733644", "0.6864971", "0.68648684", "0.6851363", "0.6845954", "0.68404585", "0.6839608", "0.68395865", "0.6828302", "0.68282473", "0.6828112", "0.68279195", "0.68279195", "0.6824137", "0.6824137", "0.6824137", "0.6824137", "0.6824137", "0.6824137", "0.6824137", "0.6824137", "0.6824137", "0.6824137", "0.6824137", "0.6824137", "0.6824137", "0.6824137", "0.6824137", "0.6824137", "0.6811537", "0.6805735", "0.6802056", "0.68018955", "0.67927766", "0.67915714", "0.67804784", "0.67760986", "0.6767838", "0.6762291", "0.67596906", "0.67594874", "0.67532057", "0.6748819", "0.67420626", "0.673969", "0.6736872", "0.6727212", "0.6725066", "0.67247677", "0.6723629", "0.67185825", "0.67137766", "0.6713571", "0.6712812", "0.6709907", "0.670897", "0.67017347", "0.6697949", "0.6697147", "0.66962326", "0.66962326", "0.6688742", "0.6672596", "0.66715217", "0.6671024", "0.66643757", "0.6660725" ]
0.70752263
5
Use callbacks to share common setup or constraints between actions.
def set_reservacion @reservacion = Reservacion.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 reservacion_params params.require(:reservacion).permit(:nresponsable, :nevento, :fechainicio, :fechafin, :horainicio, :horafin, :repeticion, :idrepeticiones, :aprobacion, :tipoactividad, :fechasolicitud) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def valid_params_request?; end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def safe_params\n params.require(:user).permit(:name)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def active_code_params\n params[:active_code].permit\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def filtering_params\n params.permit(:email)\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def filter_parameters; end", "def filter_parameters; end", "def list_params\n params.permit(:name)\n end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def url_whitelist; end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def permit_request_params\n params.permit(:address)\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def 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 backend_user_params\n params.permit!\n end", "def url_params\n params[:url].permit(:full)\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "0.6980629", "0.67819995", "0.67467666", "0.67419875", "0.67347664", "0.65928614", "0.6504013", "0.6498014", "0.64819515", "0.64797956", "0.64562726", "0.64400834", "0.6380117", "0.6377456", "0.63656694", "0.6320543", "0.63002014", "0.62997127", "0.629425", "0.6293866", "0.62909746", "0.62904227", "0.62837297", "0.6240993", "0.6239739", "0.6217764", "0.6214983", "0.62112504", "0.6194765", "0.6178", "0.61755055", "0.61729854", "0.61636627", "0.6153461", "0.6151674", "0.61478525", "0.6122671", "0.61188513", "0.61075556", "0.6105721", "0.6092412", "0.6081011", "0.6071054", "0.6064436", "0.6022111", "0.6018135", "0.60151577", "0.60108894", "0.60070235", "0.60070235", "0.6000806", "0.6000464", "0.5998811", "0.59926987", "0.5992257", "0.5991173", "0.5980311", "0.59660876", "0.59596545", "0.5959415", "0.59589994", "0.5957478", "0.5953214", "0.5952233", "0.5944033", "0.59396756", "0.59396756", "0.59386414", "0.59345603", "0.5931261", "0.5926345", "0.5925795", "0.59174526", "0.59108645", "0.5909469", "0.5908263", "0.59053195", "0.58980685", "0.5897738", "0.589657", "0.5895971", "0.58942044", "0.5892847", "0.588742", "0.58834344", "0.5880024", "0.58739793", "0.5868253", "0.5867907", "0.58670515", "0.58668053", "0.5865756", "0.5863549", "0.5863236", "0.5862728", "0.5861283", "0.58591247", "0.5855159", "0.5854291", "0.58512247", "0.58498096" ]
0.0
-1
creates new user from sign up page
def create # check for errors if params[:username].blank? || params[:username].blank? || params[:email].blank? || params[:password].blank? || params[:verifypassword].blank? redirect_to signup_path, notice: 'Please fill in all the required fields' else if !User.exists?(username: params[:username]) if params[:password] == params[:verifypassword] if !User.exists?(email: params[:email]) @user = User.new(:username => params[:username], :email => params[:email], :password => params[:password], :member_since => Time.now) if @user.save create_cookies(params[:username], params[:password]) redirect_to root_path else redirect_to signup_path end else redirect_to signup_path, notice: 'registration is limited per 1 student email acount' end else redirect_to signup_path, notice: 'Password doesnt match, retype password' end else redirect_to signup_path, notice: 'Username is taken' end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @user = User.new(params[:user])\n if @user.save\n redirect_to root_url, :notice => \"Signed up!\"\n else\n render \"new\"\n end\n end", "def create\n @user = User.new(user_params)\n @user.save\n if @user.save\n redirect_to root_path, :notice => \"Signed up!\"\n else\n redirect_to signup_path\n end\n end", "def new\n\t@user = User.new\n\t@title = \"Sign up\"\n end", "def create\n\t\t@user = User.new(user_params)\n\t\tif @user.save\n\t\t\tredirect_to sign_in_path\n\t\telse\n\t\t\tredirect_to sign_up_path\n\t\tend\n\tend", "def create\n @user = User.new(user_params)\n if @user.save\n\t sign_in @user unless signed_in?\n\t flash[:success] = \"Signup successful\"\n redirect_to @user\n else\n render 'new'\n end\n end", "def signup\n @user = User.new\n end", "def signup\n @user = User.new\n end", "def create #sign up button\n @user = User.new(user_params)\n if @user.save\n login(@user)\n redirect_to user_url(@user)\n else\n flash.now[:errors] = @user.errors.full_messages\n render :new\n end\n end", "def create\n @user = User.new(user_params)\n if @user.save\n redirect_to root_url, :notice => \"You have succesfully signed up!\"\n else\n :notice => \"Unable to create profile for user\"\n render :new\n end\n end", "def create\n @user = user_from_params\n if @user.save\n sign_in @user\n redirect_back_or url_after_create\n else\n render template: \"users/new\"\n end\n end", "def new\n\t@title = \"Sign Up\"\n\t@user = User.new\n end", "def sign_up\n @user = User.new\n end", "def create\n @user = User.new(user_params) # Instantiate a new user\n\n if @user.save # If user saves log them in by adding their id to the session hash\n session[:user_id] = @user.id\n redirect_to user_path(@user)\n else\n render 'new', layout: 'welcome' # If user does not save re-render sign up form with errors\n end\n\n end", "def signup\n @user = User.new(params[:user])\n return unless request.post?\n if @user.save\n flash[:notice] = \"New user added!\"\n redirect_to :action=>'show', :id=>@user\n end\n end", "def create\n\t\t@user = User.new(user_params)\n\t\tif @user.save\n\t\t\tflash[:notice] = \"Thanks for signing up\"\n\t\t\tredirect_to root_url\n\t\telse \n\t\t\trender 'new'\n\t\tend \n\tend", "def create\n # redirect user if already logged in\n if current_user\n redirect_to root_path\n else\n user = User.new(user_params)\n if user.save\n session[:user_id] = user.id\n flash[:notice] = \"Successfully signed up.\"\n redirect_to profile_path #root_path\n else\n flash[:error] = user.errors.full_messages.join(', ')\n redirect_to signup_path\n end\n end\n end", "def create_user\n fake_password = Faker::Internet.password\n params = {\n user: {\n username: Faker::Internet.user_name,\n email: Faker::Internet.email,\n password: fake_password,\n password_confirmation: fake_password\n }\n }\n post signup_post_url, { params: params }\n params[:user]\n end", "def create\n @user = User.new(user_params)\n if @user.save\n\n redirect_to edit_user_path(@user.id)\n else\n redirect_to sign_up_path\n end\n end", "def signup\n @user= User.new\n end", "def create \n\t\t@user=User.new\n\t\t@user.provider=\"native\"\n\t\t@user.assign_attributes(signup_params)\n\t\t@user.save!\n\t\tflash[:success]=\"Thanks for joining SPACEF!T, #{@user.name ||\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t@user.email.split(\"@\").first }. \"\n\t\tsign_in!(@user, true)\n\t\tredirect_to root_path\n\trescue ActiveRecord::RecordInvalid,\n\t\t\t\t\tActiveRecord::RecordNotUnique => e\n\t\tflash.now[:error]=\"We were not able to sign you up, please correct the following fields\"\n\t\t@user.wipe\n\t\trender 'new'\n\tend", "def create\n if user.save\n redirect_to users_path\n else\n render 'new'\n end\n end", "def create\n @user = User.new(params[:user])\n if @user.save\n # Handle a successful save.\n sign_in @user\n flash[:success] = \"Welcome to turftalk!\"\n redirect_to '/users'\n else\n @title = \"Sign up\"\n render 'new'\n end\n end", "def create\n @user = User.create(user_params)\n unless @user.errors\n redirect_to :signup_success\n else\n render :new\n end\n\n end", "def create\n @user = User.new(user_params)\n\n # save was requested by either current_user or else must be a new registration\n if @user.save(current_user)\n redirect_to users_path\n else\n render('new', status: :unprocessable_entity)\n end\n end", "def new\n @title = \"Sign up\"\n @user = User.new\n end", "def create\n @user = User.create user_params\n if @user.save\n session[:user_id] = @user.id\n redirect_to root_path\n else\n render :signup\n end\n end", "def create\n # Note this is different to the usual situation where anybody can create\n # an account. Here, only administrators can create accounts for others;\n # and doing so does not log them out.\n unless current_user.admin?\n flash[:error] = \"Users can only be created by administrators.\"\n redirect_to (request.env[\"HTTP_REFERER\"] || root_path) and return\n end\n \n @user = User.new(params[:user])\n success = @user && @user.save\n if success && @user.errors.empty?\n # Protects against session fixation attacks, causes request forgery\n # protection if visitor resubmits an earlier form using back\n # button. Uncomment if you understand the tradeoffs.\n # reset session\n redirect_to users_path\n flash[:notice] = \"The account #{ERB::Util.h @user.login} has been setup for #{ERB::Util.h @user.name}.\"\n else\n flash.now[:error] = \"We couldn't set up that account, sorry.\"\n render :action => 'new'\n end\n end", "def create\n logout_keeping_session!\n\n\t\t# create a new user with the parameters provided\n @user = User.new(params[:user])\n\t\t\n\t\t# if creation of @user is successful and if it was written to the database successfully\n success = @user && @user.save\n\t\t\n\t\t# if success is TRUE and if there were no errors\n if success && @user.errors.empty?\n\t\t\t# redirect back and flash a pop up regarding successful creation \n redirect_back_or_default('/')\n gflash :success => \"Thanks for signing up! We're sending you an email with your activation code.\"\n else\n\t\t\t# else display pop up error and redirect back to the page\n gflash :error => \"We couldn't set up that account, sorry. Please try again, or contact an admin (link is above).\"\n render :action => 'new'\n end\n end", "def create\n\t@user = User.new(params[:user])\n\t\n\tif @user.save\n\t\tsign_in @user\n\t\tUserMailer.welcome_email(@user).deliver\n\t\tflash[:success] = \"Welcome to g8keep!\"\n\t\tredirect_to @user\n\telse\n\t\t@title = \"Sign up\"\n\t\t@user.password = nil\n\t\t@user.password_confirmation = nil\n\t\trender 'new'\n\tend\n end", "def create\n @user = user_from_params\n\n if @user.save\n sign_in @user\n redirect_to home_path, notice: 'Thanks for signing up!'\n\n\n else \n render template: 'users/new'\n end\n end", "def new_user_create\n @user = User.create_user(user_params, current_user.account_id) # New User\n begin\n @user.save!\n @users = User.get_all(current_user.account_id)\n flash[:success] = \"User was created successfully!\"\n rescue => e\n flash[:alert] = \"User creation failed!\"\n end \n end", "def new\n\t\tmissing unless WAYGROUND['ALLOW_SIGNUP']\n\t\t@user = User.new(params[:user])\n\t\t@user.time_zone = Time.zone.name unless params[:user]\n\t\t@user.valid? if params[:user]\n\t\t@page_title = 'New User Registration'\n\tend", "def create\n @user = User.new(user_params)\n\n # Check if valid user params\n if @user.save\n # Log in user\n log_in_user!(@user)\n # Go to a new load of the signup page\n redirect_to new_user_url\n else\n # if bad user_params\n flash.now[:errors] = @user.errors.full_messages\n # render the same signup page\n render :new\n end\n end", "def create\n @user = User.new(user_params)\n if @user.save\n flash[:success] = \"You have successfully created a new user\"\n redirect_to home_path\n else\n render :signup\n #we explicitly choose to render the signup page rather than redirecting because we don't want to show errors in a flas message - it'd be too long\n #when we render it again it's storing the user and saving that instance of a user, because we have the instance variable on the signup page\n end\n end", "def create\n cookies.delete :auth_token\n @user = User.new(params[:user])\n @user.save\n if @user.errors.empty?\n self.current_user = @user\n flash[:notice] = \"Thanks for signing up!\"\n redirect_back_or_default root_path\n else\n flash[:error] = \"There was an error during signup\"\n render :action => 'new', :layout => 'login'\n end\n end", "def create\n\t\t@user = User.new(user_params)\n\t\t# If user was save with succes, then sign in automaticly, else, render new.\n\t\tif @user.save\n\t\t\tsign_in @user\n\t\t \tflash[:sucess] = \"Seja bem-vindo!\"\n\t\t\tredirect_to :action => :show, :id => @user.id\n\t\t\tCUSTOM_LOGGER.info(\"Created and associated user to params #{@user.to_yaml}\")\n\t\telse\n\t\t\trender 'new'\n\t\t\tCUSTOM_LOGGER.error(\"Not created and associated user to params #{@user.to_yaml}\")\n\t\tend\n\tend", "def create \n @myuser = User.new(params[:user]) # 'user' is a dictionary created by the signup form and containing the new user's filled-in parameters\n if @myuser.save\n flash[:success] = \"Welcome to the Sample App!\"\n redirect_to @myuser\n else\n render 'new'\n end\n end", "def create\n @user = User.new(user_params)\n # If the User instance was successfully saved then redirect to home page and display notice\n if @user.save\n # Set authentication token cookie so that the User is automatically signed in after signing up\n cookies[:authentication_token] = @user.:authentication_token\n redirect_to root_url, notice: \"Thank you for signing up.\"\n # If the User instance was not saved in the database then redisplay the sign up form\n else\n render :new\n end\n end", "def create\n\n @new_user = User.new\n\n new_user = @new_user.add(params['user_name'], params['pswd1'], params['email'], params['full_name'])\n\n if new_user.errors.any?\n redirect_to \"/\", :flash => { :error => 'User already exists'}\n else\n redirect_to \"/main\"\n end\n end", "def create\n @user = User.create(params[:user]) \n \n if @user.save\n sign_in @user\n flash[:succeess] = \"Sign up successfully\" \n redirect_to @user\n else\n render 'new'\n end\n \n end", "def new\n @title = \"Sign up\"\n @user= User.new\n end", "def create\n @user = User.new(user_params)\n if @user.save\n flash[:success] = \"Registration was successful!\"\n sign_in @user\n redirect_to root_path\n else\n render 'new'\n end\n end", "def new_user\n User.new({\n email: 'hoge@hoge',\n password: 'hoge',\n password_confirmation: 'hoge'\n })\n end", "def create\n @user = User.new(params[:user])\n if @user.save\n redirect_to users_path\n else\n redirect_to new_user_path\n end\n end", "def create\n @user = User.new(email:session[:userinfo].info.email,\n name:session[:userinfo].info.name,\n uid:session[:userinfo].uid)\n if @user.save\n @user.save\n redirect_to @user, notice: \"Welcome #{@user.name}!\"\n else\n redirect_to root_path, status: \"Something went wrong. Let's try this again.\"\n end\n end", "def create\n @user = User.new user_params #authenticating the user's information. fill in the db with these values.\n if @user.save #if it saves,\n redirect_to \"/users/#{ @user.id }\" #redirect to their profile page\n else\n render :new #if not new form.\n end\n end", "def new\n @title = \"Signup Page\"\n @user = User.new\n end", "def create\n \t@user = User.new(user_params)\n if @user.save\n redirect_to login_path, notice: \"The registration success, you can login now.\"\n else\n render 'new'\n end\n end", "def create\n\t\t@user = User.new(user_params)\n\t if @user.save\n\t \tsession[:user_id] = @user.id\n\t \tredirect_to user_url(@user)\n\t else\n\t \tflash.notice = \"User Registration failed. Try again.\"\n\t \trender 'new'\n\t end\n\tend", "def create\n @user = User.new(params[:user])\n if @user.save\n redirect_to users_path, notice: t('users.update.updated')\n else\n @page_title = t(\"actions.new_user\")\n render action: 'new'\n end\n end", "def sign_up\n @user = User.new(user_params)\n if @user.save\n sign_in(@user)\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n name = params[:name]\n email = params[:email]\n password = params[:password]\n new_user = User.create!(\n name: name,\n email: email,\n password: password,\n )\n\n response = \"Hey #{name}, You are registered successfully!\"\n render plain: response\n end", "def create\n\t\t@user = User.new(user_params)\n\t\tif @user.save\n\t\t\tsign_in @user\n\t\t\tflash[:success] = \"Successful Registration\"\n\t\t\tredirect_to problems_url\n\t else\n\t render 'new'\n\t end\n\tend", "def create\n # AR model which will interact with our database and create a new user\n user = User.new(user_params)\n saveUser = user.save\n \n if saveUser\n session[:user_id] = user.id\n redirect_to '/'\n else\n redirect_to '/signup'\n end\n end", "def new\n @user = User.new\n @is_signup = true\n end", "def create\n @user = User.new(signup_params)\n if @user.save\n sign_in @user\n respond_to do |format|\n \tformat.json { render json: @user }\n end\n else\n # render :new\n end\n end", "def create\n if logged_in?\n # User who has logged in has no need to access create action\n redirect_to current_user\n else \n # Ready to create new user\n @user = User.new(params[:user])\n if @user.save\n # Handle a successful save.\n log_in @user\n flash[:success] = \"Welcome to the Sample App!\"\n redirect_to @user\n else\n \t# Render signup page\n render 'new'\n end\n end\n end", "def create\n # Listing 7.22: Using strong parameters in the create action.\n @user = User.new(user_params)\n if @user.save\n # Listing 8.27: Signing in the user upon signup.\n sign_in @user\n # Listing 7.26: Redirecting the create action to the new user page.\n flash[:success] = \"Welcome to the Sample App!\"\n redirect_to @user\n else\n render 'new'\n end\n end", "def create\n @user = User.new(user_params)\n if @user.save\n session[:user_id] = @user.id\n redirect_to root_path, notice: \"Successfully Sign Up\"\n else\n render :new\n end\n end", "def create_new_user\n username = find_username\n @user = User.new(\n email: auth_email,\n username: username,\n password: Devise.friendly_token[0, 20]\n )\n @user.skip_confirmation!\n @user.save!\n\n @user\n end", "def create\n @user = User.new(params[:user])\n \n if @user.create_first\n flash[:message] = \"<h2>#{t('welcome', :scope => 'refinery.users.create', :who => @user.username).gsub(/\\.$/, '')}.</h2>\".html_safe\n\n sign_in(@user)\n redirect_back_or_default(refinery.admin_root_path)\n else\n render :new\n end\n end", "def create\n @user = User.new(params[:user])\n if @user.save\n # we log him in and we redirect to root path\n log_user_in(@user)\n redirect_to root_path, :notice => \"You have successfully signed up.\"\n else\n flash.now[:alert] = \"Cannot sign you up. Sorry for that.\"\n render :new, :status => :unprocessable_entity\n end\n end", "def create\n @user = User.new(user_params)\n if @user.save\n flash[:notice] = \"Confirm Your account with the link in your mail...!\"\n render signup_user_page_users_path\n else\n redirect_to signup_user_page_users_path\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n flash[:notice] = \"You signed up successfully\"\n session[:user_id] = @user.id\n render \"welcome/index\"\n else\n flash[:notice] = \"Form is invalid\"\n render \"new\"\n end\n end", "def new\n @user_signup = User.new\n @is_signup = true\n end", "def create_user\n @user = User.new(params[:user])\n @user.save\n \n redirect_to :action => :users\n end", "def create\n\t\t@user = User.new(user_params)\n\t\t\n\t\tif @user.save\n\t\t\tredirect_to users_path\n\t\telse\n\t\t\trender 'new'\n\t\tend\n\tend", "def create\n\t\tif @user.save\n\t\t\tflash[:notice] = \"Your account has been successfully created!\"\n\t\t\tUserMailer.welcome_email(@user).deliver!\n\t\t\tredirect_to root_url\n\t\telse\n\t\t\tflash[:error] = get_all_errors\n\t\t\trender 'new'\n\t\tend\n\tend", "def sign_up_new_user\n user = User.make\n visit \"/\"\n find('#join_now_link').click\n click_link 'Sign up with Email'\n fill_in 'Full name', with: user.full_name\n fill_in 'Email', with: user.email\n find('#user_password').set user.password\n find('#user_password_confirmation').set user.password\n click_button 'Sign up'\n user\nend", "def create_user\n params = {\n :client_id => Swiftype.platform_client_id,\n :client_secret => Swiftype.platform_client_secret\n }\n post(\"users.json\", params)\n end", "def create\n user = build_resource\n\n if user.save\n set_flash_message :notice, :signed_up\n sign_in('user', user)\n respond_with user, :location => after_sign_up_path_for(user)\n else\n clean_up_passwords user\n respond_with user\n end\n end", "def signup\n puts 'signup is happening here'\n permitted = params.require('signup').permit(['email', 'password', 'password_confirmation'])\n @newUser = User.new(permitted)\n if @newUser.save\n head :ok\n else\n render json:{\"reason\": \"could not create user\"}, status: 422\n end\n end", "def create\n @user = User.new(params[:user])\n if @user.save\n flash[:notice] = 'Registration successfull.' \n redirect_to root_url\n else\n render :action => \"new\"\n end\n end", "def create\n @user = User.new(signup_params)\n if @user.save\n session[:user_email]=@user.email\n render 'homepage'\n else\n render 'index'\n end\n\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n redirect_to users_path, notice: \"ユーザが保存されました\"\n else\n render :new\n end\n end", "def create\n @sign_up_user = SignUpUser.new(sign_up_user_params)\n # @sign_up_user = SignUpUser.new(user_params)\n\n respond_to do |format|\n if @sign_up_user.save\n format.html { redirect_to @sign_up_user, notice: 'Sign up user was successfully created.' }\n format.json { render action: 'show', status: :created, location: @sign_up_user }\n else\n format.html { render action: 'new' }\n format.json { render json: @sign_up_user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(user_params)\n if @user.save\n flash[:success] = 'User created!'\n redirect_to login_path\n else\n flash[:danger] = @user.errors.full_messages\n redirect_to signup_path\n end\n end", "def create\n @user = User.new(user_params)\n if @user.save\n UserMailer.registration_confirmation(@user).deliver\n redirect_to root_url, notice: \"Thank-you for enrolling!\"\n else\n render \"new\"\n end\n end", "def new\n if current_user\n flash[:notice] = 'you are already signed up'\n redirect_to home_path\n else\n @user = User.new\n render 'signup/step1'\n end\n end", "def create\n\t\t@user = User.new(user_params)\n\t\n\t\tif @user.save\n\t\t\tsign_in @user\n\t\t\tflash[:success] = \"Welcome, #{@user.name}!\"\n\t\t\tredirect_to root_path\n\t\telse\n\t\t\trender action: 'new'\n\t\tend\n\n\tend", "def new\n if logged_in?\n # User who has logged in has no need to access create action\n redirect_to current_user\n else\n # Get ready to display signup page by declaring instance var\n \t @user = User.new\n end\n end", "def create\n cookies.delete :auth_token\n @user = User.new(params[:user])\n @user.save!\n self.current_user = @user\n redirect_back_or_default('/')\n flash[:notice] = 'Your account has been created. Please check your email.'\n rescue ActiveRecord::RecordInvalid\n render :action => 'new'\n end", "def create\n @new_user = NewUser.new(new_user_params)\n\n respond_to do |format|\n if @new_user.save\n format.html { redirect_to @new_user, notice: 'New user was successfully created.' }\n format.json { render :show, status: :created, location: @new_user }\n else\n format.html { render :new }\n format.json { render json: @new_user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.create! user_params\n logger.info \"New User with id #{@user.id} has been saved.\"\n #\n # log-in the user immediately after sign-up\n # issue a refresh token with that the\n # user will request an access token.\n set_refresh_token @user\n render :show, status: :created\n end", "def create\n\t\t@user = User.new(user_params)\n\t if @user.save\n\t sign_in @user\n\t flash[:success] = \"Congratulations! You are now registered and can start playing Lightcycles.\"\n\t redirect_to root_path\n\t end\n\tend", "def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n session[:user_id] = @user.id\n format.html { redirect_to @user, notice: 'Sign Up Success.' }\n format.json { render :show, status: :created, location: @user }\n else\n @info = {:title => \"New User\", :button_name => \"Sign Up\", :new_user => true}\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(user_params)\n if @user.save\n redirect_to user_path(@user)\n else\n render :new\n end\n end", "def create\n\t\t@user = User.new(params[:user])\n\t\tif @user.save\n\t\t\tredirect_to root_url, notice: \"Added new user to the database\"\n\t\telse\n\t\t\trender \"new\"\n\t\tend\n\tend", "def create\n user = User.new(\n first_name: params[:first_name],\n last_name: params[:last_name],\n email: params[:email],\n password: params[:password]\n )\n if user.save\n session[:current_user_id] = user.id\n redirect_to \"/\"\n else\n flash[:error] = user.errors.full_messages.join(\". \")\n redirect_to new_user_path\n end\n end", "def create_user(options = {})\n post \"/users\", options\n end", "def create\n\t\t@user = User.new(user_params)\n\t\trespond_to do |format|\n\t\t\tif @user.save\n\t\t\t\t@user.send_activation_email\t\n\t\t\t\tformat.html {redirect_to root_url, notice: \"Thank you for signing up! You will have received a confirmation link in your email shortly which you must click before posting.\"}\n\t\t\t\t#Create User Profile on Successful User Save\n\t\t\t\t@user.create_profile(location: \"Add your location here.\", occupation: \"Add your occupation here.\", about_me: \"Write a little bit about yourself here!\", image_url: \"Add a link to a profile image here\")\n\t\t\telse\n\t\t\t\tformat.html { redirect_to signup_path, notice: \"Please enter a valid e-mail address and a matching password and password confirmation. Your password must contain 8 or more characters, a digit (0-9), at least one lower case character, at least one upper case character, and a symbol.\"}\n\t\t\tend\n\t\tend\n\tend", "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n format.html { flash.now[:info] = t('users.create.success'); redirect_to root_path }\n format.json { render json: @user, status: :created, location: @user }\n else\n @btn_text = t('users.new.btn_signup')\n @user.password = ''\n @user.password_confirmation = ''\n format.html { render action: 'new' }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new params[:user]\n if @user.save\n session[:user_id] = @user.id\n redirect_to @user, notice: \"Thank you for signing up\"\n else\n render :new\n end\n end", "def create\n @user = User.new(user_params)\n if @user.save\n session[:user_id] = @user.id\n redirect_to root_path, :notice => \"Sign up successful!\"\n else\n render \"new\"\n end\n end", "def signup\n @user = User.new(params[:user])\n if @user.save\n redirect_to :controller => 'sessions', :action => 'new'\n else\n render'index'\n flash.now[:error]= \"Sign up failure, please try again.\"\n end\n end", "def create\n @user = User.new(user_params)\n if @user.save\n redirect_to @user, notice: 'Se creo un usuario exitosamente.'\n else\n render :new\n end\n end", "def create\n\t\tcookies.delete 'auth_token'\n\t\treset_session\n\t\t\n\t\tself.new\n\t\t# User model doesn’t require email, but web login does\n\t\t@user.email_required = true\n\t\t@user.login_at = Time.current\n\t\t# anti-spam\n\t\tunless (params[:user].nil? or params[:user][:login].blank?) and (params[:user].nil? or params[:user][:url].blank?)\n\t\t\t# looks like a non-human is trying to auto-fill the form\n\t\t\traise Wayground::SpammerDetected\n\t\tend\n\t\t@user.save!\n\t\tself.current_user = @user\n\t\t\n\t\t# send email confirmation\n\t\tif @user.email_addresses[0] and Notifier.deliver_signup_confirmation(@user.email_addresses[0])\n\t\t\tflash[:notice] = \"Thanks for signing up! A confirmation email has been sent to you at #{@user.email}. Please look for a message from #{(WAYGROUND['SENDER'].gsub(/[><]/){|x|{'>'=>'&gt;','<'=>'&lt;'}[x]})}.\"\n\t\telse\n\t\t\tflash[:error] = \"Your new user account has been created, but there was an error when trying to send an email confirmation. Please contact the website administrator about this problem. #{WAYGROUND['EMAIL']}\"\n\t\tend\n\t\t\n\t\tredirect_to '/users/account'\n\trescue Wayground::SpammerDetected\n\t\tblock_spammer\n\t\t# skip the save, but let them think it was saved\n\t\tflash.now[:notice] = \"Thanks for signing up! A confirmation email has been sent to you at #{@user.email}. Please look for a message from #{(WAYGROUND['SENDER'].gsub(/[><]/){|x|{'>'=>'&gt;','<'=>'&lt;'}[x]})}.\"\n\t\t@page_title = 'User Account'\n\t\trender :action=>:account\n\trescue ActiveRecord::RecordInvalid\n\t\trender :action=>'new'\n\tend", "def sign_up(user)\n visit '/users/new'\n # expect(page.status_code).to eq 200\n fill_in :email, with: user.email\n fill_in :username, with: user.username\n fill_in :password, with: user.password\n fill_in :password_confirmation, with: user.password_confirmation\n click_button 'Sign up'\n end", "def signup\n end", "def signup\n end", "def create\n omniauth = request.env['omniauth.auth']\n\n user = User.find_by_uid(omniauth['uid'])\n if not user\n # registruje novog usera\n user = User.new(:uid => omniauth['uid'])\n end\n user.email = omniauth['info']['email']\n user.save\n\n # sve info o useru u sesiji\n session[:user_id] = omniauth\n\n flash[:notice] = \"Successfully logged in\"\n redirect_to root_path\n end" ]
[ "0.79006076", "0.7896057", "0.78539085", "0.7823053", "0.7810865", "0.77963984", "0.77963984", "0.77775645", "0.7759127", "0.77134234", "0.7712291", "0.7712246", "0.7703805", "0.7702826", "0.77009547", "0.7681409", "0.76804477", "0.7676785", "0.7668975", "0.7664327", "0.7661848", "0.7659188", "0.7641881", "0.7635767", "0.76244396", "0.76243097", "0.76079845", "0.7603071", "0.7601683", "0.75935787", "0.7590161", "0.7575948", "0.75712633", "0.75704724", "0.75620574", "0.75594825", "0.7550826", "0.7544532", "0.7543049", "0.75409293", "0.75312203", "0.7529547", "0.7502369", "0.7489", "0.74870485", "0.74825865", "0.74813175", "0.74793875", "0.74774224", "0.7476969", "0.745435", "0.74522996", "0.7450489", "0.74503386", "0.7440866", "0.74374664", "0.7429884", "0.7426212", "0.74247825", "0.7422821", "0.7417227", "0.74144846", "0.74115217", "0.7400142", "0.73996854", "0.73977464", "0.7394803", "0.73934495", "0.73892754", "0.7377079", "0.7377034", "0.7373653", "0.73666275", "0.7365741", "0.7364025", "0.73638296", "0.73635286", "0.7362192", "0.73516273", "0.7338644", "0.7332997", "0.733222", "0.73299694", "0.7322571", "0.7320397", "0.73195213", "0.7319358", "0.73193276", "0.7319048", "0.73163474", "0.7315556", "0.73142326", "0.7309783", "0.7308215", "0.73076916", "0.73052996", "0.7303671", "0.73032385", "0.7303054", "0.7303054", "0.7297711" ]
0.0
-1
gets profile information to be displayed
def profile if User.exists?(id: params[:id]) @user = User.where(id: params[:id]) @name = @user[0].username @member_since = @user[0].member_since @email = @user[0].email @xp = @user[0].xp @answercount = @user[0].no_comment @postcount = @user[0].no_thread #add achievements if @u_id == params[:id].to_i @achievements = Achievement.find(:all) @achievements.each do |a| if @xp >= a.condition if UserAchievement.where(user_id: @u_id, achievement_id: a.id).empty? @ua = UserAchievement.new(:user_id => @u_id, :achievement_id => a.id) @ua.save end end end end # retrieves achievements to be displayed @achievement = UserAchievement.where(user_id: params[:id]) else redirect_to root_path end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_profile_information\n # body = {\n # cmd: \"get_profile_information\"\n # }\n\n end", "def profile\n end", "def profile\n end", "def profile\n end", "def profile\n end", "def profile\n end", "def profile\n end", "def profile\n \n end", "def profile\n\n end", "def show\n @profile = current_user.profile\n\n # ToDo: error message if no profile is found for user\n\n puts 'Got profile='\n pp @profile\n \n\n puts 'got other_names='\n pp @profile.other_names\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @profile }\n format.json { render :json => @profile }\n end\n \n end", "def profile; Profile.get(self.profile_id); end", "def profile\n check_auth :profile\n \n response = connection.post do |req|\n req.url '/user/profile'\n req.body = { :format => @format }\n end\n response.body[0]\n end", "def show\n @profile = @user.profile\n end", "def profile; end", "def profile; end", "def show\n @profiles = @grab.profiles\n end", "def profile\n render_json 0,\"ok\",current_member.as_profile\n end", "def _profile\n @link['profile']\n end", "def profile\n @profile = current_user\n end", "def get_profile(id)\n \t\tfb_profile_url = FB_PROFILE + id + FB_PROFILE_FIELDS\n \t\tprofile_details = HTTParty.get(fb_profile_url)\n \t\t@first_name = profile_details[\"first_name\"]\n \t\t@last_name = profile_details[\"last_name\"]\n \t\t@profile_pic = profile_details[\"profile_pic\"]\n \t\t@locale = profile_details[\"locale\"]\n \t\t@gender = profile_details[\"gender\"]\n \tend", "def profile\n\t@user = current_user\n\t@title = \"This is your profile page\"\n end", "def profile()\n title = Sketchup.active_model.title or 'Untitled'\n @@profilemap[title]\n end", "def profile\n service_response = UserManagement::ProfileDetail.new(params).perform\n render_api_response(service_response)\n end", "def profile\n @profile ||= GATEWAY.get_profile_details(self.profile_id) unless profile_id.nil?\n end", "def user_info\n @user_info ||= raw_info.nil? ? {} : raw_info['query']['results'][\"profile\"]\n end", "def show\n @profile = Profile.find(params[:id]) || current_user.profile\n end", "def profile\n\t\t@user = User.find(current_user)\n\tend", "def show\n @profile = current_user.profile\n @hash = Gmaps4rails.build_markers(@profile) do |profile, marker|\n marker.lat profile.latitude\n marker.lng profile.longitude\n marker.infowindow profile.first_name\n end\n end", "def profileName \n \"profileName\" \n end", "def profile\n\t\t# determine which user's profile page\n\t\t@user = User.find_by_login(params[:username])\n\t\t# retrieve all bids by this user\n\t @bids = Bid.find_all_by_bidder_id(@user.id, :group => 'item_id')\n\t\t# get all comments for this user\n\t @comments = @user.user_comments\n\t\t# get all user_items by this user\n\t @user_items = @user.posted_items\n\n\t\t# code for facebox\n\t respond_to do |format|\n\t\t\tformat.html\n format.js { render_to_facebox }\n end\n\tend", "def get_profile\n begin\n client.profile(fields: PROFILE_FIELDS)\n rescue Exception => e\n logger.error \"Linkedin #get_profile error #{e}\"\n end\n end", "def show\n\n\t\t@current_profile = Profile.get_profile params[:id], \"asdf\"\n\n\t\tpretty_render \"api/public_user\"\t\n\n\tend", "def get_profile\n path = self.api_root + '/register/profile'\n process_firecloud_request(:get, path)\n end", "def profile\r\n if params[:id] && User.exists?(params[:id])\r\n @prof = User.find(params[:id])\r\n else\r\n redirect_to_info_page t(:redir)\r\n return\r\n end\r\n end", "def fetch_profile_data\n puts \"Step 10: Extracting freelancer profile data\"\n freelance_profile_page = FreelancerProfilePage.new\n data = freelance_profile_page.get_profile_header\n data2 = data.find_element(css: \".overlay-container\")\n title = data2.find_element(css: \"h3\").text\n description = data2.find_elements(css: \"o-profile-overview\").first.text\n skills = freelance_profile_page.get_profile_skills.collect{|t| t.text}\n\n @profile_data = {\n title: title,\n description: description,\n skills: skills\n }\n puts \"Profile data extracted successfully\"\n end", "def profile\n @property[:profile]\n end", "def profile\n @profile ||= @request.do_request { FacebookUserProfile.populate(user) }\n end", "def profile\n @user = @current_user\n\n render :show\n\n end", "def profile\n\t\t\n\t\tif !current_user\n\t\t\tredirect_to root_url and return\n\t\tend\n\t\t\n\t\t@user = current_user\n\t\t\n\tend", "def profile_name\n return self.profile.name\n end", "def profile\n\t\t@user = User.where(username: params[:username])[0]\n\t\t@pics = Picture.where(user_id: @user.id).reverse\n\n\tend", "def profile\n raw = client.get @json['user']['links']['self']\n client.factory.create(GoodData::Profile, raw)\n end", "def show\n @title = \"#{@profile.forenames} #{@profile.surnames}\"\n end", "def profile\n self.profilelink.click\n end", "def profile\n\t\t@user = current_user\n\tend", "def profile\n account_id = params[:account_id].to_i if (params[:account_id] != nil)\n account = SystemTrack::AccountsProxy.new.account(session, account_id)\n form = AccountEntryPage.new(session, account)\n render text: form.render\n end", "def profile\n super\n end", "def profile\n super\n end", "def get_profile\n self.class.get '/members/private', @options\n end", "def get_profile\n\n # Auth\n token = auth\n\n # Get Client info based on fields provided\n client = LinkedIn::Client.new(API_KEY, API_SECRET, token)\n client.profile(:fields => @profile_fields)\n end", "def load_profile_data\n @profile_data = Nokogiri::HTML(open(\"#{PROFILE_URI}/#{@uid}\"))\n end", "def show\n @profile = Profile.find(params[:id])\n end", "def show\n @profile = Profile.find(params[:id])\n end", "def show\n @profile = Profile.find(params[:id])\n end", "def show\n @profile = Profile.find(params[:id])\n end", "def show\n @profile = Profile.find(params[:id])\n end", "def show\n @profile = Profile.find(params[:id])\n end", "def profile\n unless @profile\n if associated_profile\n @profile = Profile.new(associated_profile)\n else\n options = {:fields => 'user_id', :includes => 'Profile'}\n options = options.merge(:access_token => token, :access_secret => secret) if (token && secret)\n tmp = User.find(username, options)\n @profile = Profile.new(tmp.associated_profile)\n end\n end\n @profile\n end", "def get_user_profile_description\n get_profile_description(\"Users\")\n end", "def show\n @profile = Profile.find(:first, :conditions => {:user_id => params[:user_id]})\n end", "def find_profile\n @user = User.find_by_username(params[:id])\n @profile = @user.profile\n end", "def show\n \t@profile = Profile.where(profile_name: params[:id]).first\n end", "def public_profile\n if params['form_profile']\n CsApi::Member.update(current_access_token, @current_user.username, params['form_profile'])\n Resque.enqueue(UpdateBadgeVillePlayer, current_access_token, @current_user.username, 'name,first_name,last_name,profile_pic,badgeville_id') unless ENV['BADGEVILLE_ENABLED'].eql?('false')\n flash.now[:notice] = 'Your profile information has been updated.'\n # get the updated account\n get_account \n end\n @page_title = 'Public Profile'\n end", "def profile\n @user = current_user\n end", "def set_profile\n end", "def profile\n @presenter = Users::ProfilePresenter.new(current_user.id)\n @message = Message.new\n end", "def myprofile\n \n end", "def show_a_profile_with_name_and_more(my_name, my_age, my_gender)\n # TODO: This profile should provide more information based on the\n # person's name, age, and gender\n puts \"<h1>#{my_name}</h1>\"\n puts \"<p>I am a #{my_age}-year-old #{my_gender}.<p>\"\nend", "def profiles; end", "def profile\n return nil unless user_loa3\n\n mvi_response&.profile\n end", "def personal_profile\n RubyRedtail::Query.run(\"contacts/#{@id}/personalprofile\", @api_hash, \"GET\")\n end", "def user_profile(id)\n users(request(\"users/profile/#{id}.xml\", :auth => true))\n end", "def profile_url\n @data[:profile_url]\n end", "def profile\n \t@user = UsersService.findUserById(params[:id])\n end", "def show\n @profiles_all = current_user.profiles.order('lastname ASC')\n if current_user.business\n @business = current_user.business.name\n end\n @profile = current_user.profiles.find(params[:id])\n @profile_tickets = Ticket.where(:user => @user).order('date_opened DESC')\n .paginate(page: params[:page])\n @profile_assets = Asset.where(:owner => @user).order('serial ASC')\n .paginate(page: params[:page])\n end", "def profile(username)\n Person.profile(username, @api_key, @https)\n end", "def show\n @user = User.find(params[:id])\n can_edit_hash = Permissions.currentLoggedInOrHasMorePermissions(@current_user,@user)\n @can_edit = can_edit_hash[:has_permission]\n\n #max needs\n @can_see_pref= Permissions.is_at_least_manager(@current_user)\n\n profile_attrs = [:first_name,:last_name, :email,:phone_number]\n @first_name = @user.first_name\n @last_name = @user.last_name\n @email = @user.email\n @phone_number = @user.phone_number\n @role = @user.role\n end", "def show\n @title = \"Perfil del Candidato: #{@profile.forenames} #{@profile.surnames}\"\n end", "def small_profile\n\t\t# determine which user's profile page\n \t@user = User.find_by_login(params[:username])\n\t\t# get all comments for this user\n\t @comments = @user.user_comments\n\t\t# get all user_items by this user\n\t @user_items = current_user.user_items\n\t\trespond_to do |format|\n\t\t\tformat.html\n format.js { render_to_facebox }\n end\n\tend", "def name\n profile.user.name\n end", "def find_profile\n\t\t# Find particular Profile \n\t\t@profile = Profile.find(params[:id])\n\tend", "def retrieve_account_details\n\t\taccount = $twitter.user(\"#{self.handle}\")\n\t\tself.name = account.name\n\t\tself.avatar_url = account.profile_image_uri\n\tend", "def show\n totalPicture=Timeline.where(\"user_id=#{@user.id}\").count\n @user_info ={profileImage:\"#{@user.profileImage}\", totalPicture:\"#{totalPicture}\"}\n end", "def show\n unless params[:id].blank?\n @user = User.find_by_id(params[:id])\n else\n if logged_in?\n @user = current_user\n else\n require_login and return\n end\n end\n \n if @user.blank?\n flash[:error] = \"User not found\"\n redirect_to root_path and return\n end\n\n @own_profile = (logged_in? && (@user.id == current_user.id))\n\n @page_title = @own_profile ? \"My profile\" : \"View profile\"\n\n @memberships = @user.liga_users.approved.map(&:league)\n end", "def getProfile(oStatsProxy, iMechanizeAgent)\n # Click on the Profile link from the home page\n lProfilePage = iMechanizeAgent.get('http://www.myspace.com/home').link_with(:text => 'Profile').click\n # Screen scrap it\n lNbrComments = Integer(lProfilePage.root.css('article#module18 div.wrapper section.content div.commentContainer a.moreComments span.cnt').first.content.match(/of (\\d*)/)[1])\n\n oStatsProxy.add_stat('Global', 'Comments', lNbrComments)\n end", "def profile\n if !GraderConfiguration['system.user_setting_enabled']\n redirect_to :controller => 'main', :action => 'list'\n else\n @user = current_user;\n end\n end", "def index\n @profiles = current_user\n end", "def show\n @profile = current_user.profile\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end", "def profile(profile_name:)\n claim_url = \"#{@@profile_service_url}/profile/#{profile_name}/next\"\n response = Faraday.get claim_url\n profile = JSON.parse(response.body)\n raise \"No profile available for #{profile_name}\" unless profile\n profile\n end", "def set_profiledetail\n @profiledetail = current_user.profiledetail\n end", "def show\n \tif(params[:id])\n \t\t @profile = Profile.find(params[:id])\n \telse\n \t\t@profile = Profile.find_by_user_id(current_user.id)\n \tend\n # authorize! :show, @profile\n\n add_breadcrumb @profile.first_name + \" \" + @profile.last_name, \"\"\n \n @recentposts = Post.where('user_id = ?', @profile.user.id).order('id desc')\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end", "def show\n @profile_attribute = current_user.profile_attributes.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @profile_attribute }\n format.json { render :json => @profile_attribute }\n end\n end", "def getUserProfile(uid)\r\n uri = sprintf(\"/api/v1/users/%d/profile\",uid)\r\n dbg(uri)\r\n profile = $canvas.get(uri)\r\n return profile\r\nend", "def getUserProfile(uid)\r\n uri = sprintf(\"/api/v1/users/%d/profile\",uid)\r\n dbg(uri)\r\n profile = $canvas.get(uri)\r\n return profile\r\nend", "def info()\n get(:session, {:method => \"user.getInfo\"})\n end", "def set_profile\n @profile = User.friendly.find(params[:user_id]).profile\n end", "def set_profile\n @user = User.find(params[:id])\n @profile = @user.profile\n end", "def profile(username, **info)\n print username\n info.each { |k, v| puts \"#{k} = #{v}\" }\nend", "def profile\n \t\t@patient = Patient.all\n #@current_user = User.find(params[:id])\n end", "def profile\n @user = UserService.getUserById(params[:id])\n end", "def show\r\n jump_to(\"/profiles/#{session[:account_id]}/basic\")\r\n end" ]
[ "0.7838227", "0.7756334", "0.7756334", "0.7756334", "0.7756334", "0.7756334", "0.7756334", "0.7639181", "0.7620818", "0.755514", "0.7547923", "0.7539129", "0.73539233", "0.72903836", "0.72903836", "0.72892445", "0.7282755", "0.7260617", "0.7218822", "0.7206924", "0.7197529", "0.7168923", "0.71598625", "0.7153263", "0.71071357", "0.7084935", "0.7062854", "0.70541054", "0.70367706", "0.7033855", "0.7016561", "0.70055103", "0.7004566", "0.6993195", "0.6984724", "0.6970545", "0.6968536", "0.696025", "0.6958057", "0.69571996", "0.6936808", "0.6934182", "0.6926994", "0.69107336", "0.69072926", "0.68985295", "0.6895344", "0.6895344", "0.6893888", "0.6890907", "0.68894035", "0.68842614", "0.68842614", "0.68842614", "0.68842614", "0.68842614", "0.68842614", "0.6878378", "0.68607706", "0.6858634", "0.68581665", "0.6853061", "0.68497294", "0.68484503", "0.6845205", "0.68324035", "0.68310905", "0.68302083", "0.68282443", "0.68214244", "0.67985886", "0.6788048", "0.67811805", "0.67690015", "0.6765149", "0.6763165", "0.6761548", "0.6758331", "0.67418873", "0.67247784", "0.67196", "0.6713121", "0.67118084", "0.6707805", "0.6700453", "0.6695742", "0.66901195", "0.66874874", "0.6679372", "0.6678662", "0.66746455", "0.66740257", "0.667114", "0.667114", "0.6670748", "0.66672474", "0.66670495", "0.66642255", "0.6662278", "0.6661765", "0.66608185" ]
0.0
-1
Version 2 Dynamic Programming
def DP_solve(a) max, head, tail = 0, 0, 0 cur_head = 0 sum = [ [0, a[0]].max ] # base case (1...a.size).each do |j| sum[j] = [0, sum[j-1] + a[j]].max # bottom-up cur_head = j if sum[j-1] == 0 and sum[j] > 0 if sum[j] > max head = cur_head tail = j max = sum[j] end end return max, head, tail end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dynamicArray(n, queries)\n solver = Solver.new(n, queries)\n solver.execute\nend", "def alg; end", "def recursive_solution\n\n end", "def solve\n perms = (1..9).to_a.permutation.map {|p| p.join}\n prods = []\n\n perms.each do |p|\n (1..2).each do |len|\n a, b, c = p[0, len].to_i, p[len..4].to_i, p[5, 4].to_i\n prods << c if a * b == c\n end\n end\n \n prods.uniq.reduce( :+ )\n end", "def solve\n end", "def solve\n # Generate uniques\n spaces = student_ids.product(bag_ids)\n\n visited_nodes = 0\n student_ids.each do |sid|\n bid = solver.choose(*bag_choices_for_student(sid))\n visited_nodes +=1\n partial_plan[sid] = bid\n solver.assert assigned_bags_are_unique(partial_plan)\n solver.assert assigned_bags_without_student_repeats(partial_plan)\n end\n\n puts \"Visited: #{visited_nodes} nodes\"\n partial_plan.to_a\n end", "def test_DP_20\n path=\"/home/miro/NetBeansProjects/Knapsack/test/\"\n\n p=Solver.new\n\n p.read_problem(path+\"input3\")\n\n assert_equal(1995, p.dynamic)\n\n p=Solver.new\n p.read_problem(path+\"input4\")\n\n assert_equal(2168, p.dynamic)\n\n p=Solver.new\n p.read_problem(path+\"input5\")\n\n assert_equal(2623, p.dynamic)\n\n\n\n end", "def min_ops(n)\n\n # Step 1:\n # Create a table containing the minimum operations\n # needed to reach n given our permitted operators.\n all_parents = Array.new\n all_min_ops = [0] + [nil] * n\n\n (1..n+1).each do |k|\n curr_parent = k - 1\n curr_min_ops = all_min_ops[curr_parent] + 1\n [2, 3].each do |i|\n if k % i == 0\n parent = k / i\n num_ops = all_min_ops[parent] + 1\n if num_ops < curr_min_ops\n curr_parent, curr_min_ops = parent, num_ops\n end\n end\n end\n all_parents[k], all_min_ops[k] = curr_parent, curr_min_ops\n end\n\n # Step 2: Trace back to find the optimal choices\n # made in the previous step.\n numbers = Array.new\n k = n\n while k > 0\n numbers << k\n k = all_parents[k]\n end\n puts numbers.size - 1\n numbers.reverse\nend", "def solve\n return ((1..40).inject(:*) / ((1..20).inject(:*) ** 2))\nend", "def build_subsolutions\n @success_probability = Array.new(@size)\n @success_probability[@size-1] = 1.0/@size\n (@size-1).downto(1).each { |k|\n @success_probability[k-1] = 1.0/@size + @success_probability[k]*(k-1)/k\n }\n end", "def solution4(input)\n end", "def algorithms; end", "def algorithms; end", "def algorithms; end", "def algorithms; end", "def algorithms; end", "def solve\n s = Hash[(1...1000).map { |i| [i, i * i] }]\n (1...1000).each do |c|\n (1...c).each do |b|\n (1..b).each do |a|\n return a * b * c if (a + b + c) == 1000 && (s[a] + s[b]) == s[c]\n end\n end\n end\nend", "def solve(ingredients, part_two: false)\n score = 0\n max = 0\n\n (0..100).each do |i|\n (0..100 - i).each do |j|\n (0..100 - i - j).each do |k|\n l = 100 - i - j - k\n capacity = calculate_total(ingredients, \"capacity\", i, j, k, l)\n durability = calculate_total(ingredients, \"durability\", i, j, k, l)\n flavor = calculate_total(ingredients, \"flavor\", i, j, k, l)\n texture = calculate_total(ingredients, \"texture\", i, j, k, l)\n calories = calculate_total(ingredients, \"calories\", i, j, k, l)\n\n next if part_two && calories != 500\n next if capacity <= 0 || durability <= 0 || flavor <= 0 || texture <= 0\n\n score = capacity * durability * flavor * texture\n max = score if score > max\n end\n end\n end\n max\nend", "def solve\n\t\tres = solveRec()\n\t\treturn res if res == [-1]\n\t\twhile ((nextIter = solveRec()) != [])\n\t\t\tres += nextIter\n\t\tend\n\n\t\treturn res;\n\tend", "def n_queens_problem_sum_variant(n)\n n_queens_problem_rec(0, Array.new(n, -1))\nend", "def algorithm=(_); end", "def algorithm=(_); end", "def algorithm=(_); end", "def algorithm=(_); end", "def compute(array)\n\n index = 0\n while index < array.length\n code = array[index]\n instruction = code % 100\n case instruction\n when 1\n add(code, array, array[index + 1], array[index + 2], array[index + 3])\n index += 4\n when 2\n multiply(code, array, array[index + 1], array[index + 2], array[index + 3])\n index += 4\n when 3\n # Input\n consume_input(code, array, array[index + 1])\n index += 2\n when 4\n # Output\n write_to_output(code, array, array[index + 1])\n index += 2\n when 5\n bool, new_index = jump_if_true(code, array, array[index + 1], array[index + 2])\n\n index = bool ? new_index : index + 3\n when 6\n bool, new_index = jump_if_false(code, array, array[index + 1], array[index + 2])\n\n index = bool ? new_index : index + 3\n when 7\n less_than(code, array, array[index + 1], array[index + 2], array[index + 3])\n index += 4\n when 8\n equals(code, array, array[index + 1], array[index + 2], array[index + 3])\n index += 4\n when 9\n add_to_relative_base(code, array, array[index + 1])\n index += 2\n when 99\n break\n else\n break\n end\n end\nend", "def solve\n loop { break if !shift }\n return @solutions\n end", "def solution \n row_search \n columns_search \n diagonal_search\n end", "def solution\n (1..40).inject(:*) / (1..20).inject(:*)**2\nend", "def solution5(input)\n # Approach\n # Map over the initial array (to return a transformed array)\n # Map over each interal array (to return a transformed array)\n # Creates an enumerable range up to the value in the array\n # Multiple each value in the range using the inject method\n # which iterates and keeps the running total\n\n # Final solution\n # Uses shorthand version of inject\n # Remove the useless multiple by 1\n # Note the use of the starting value of 1 for inject\n # which makes 0!=1 class Quiz\n # find even values\n def solution1(input)\n # Final solution\n input.flatten.select do |value|\n value.even?\n end\n\n # First solution:\n # Works correctly\n # Unoptimized\n #\n # input.map do |ary|\n # ary.select do |value|\n # value.even?\n # end\n # end.flatten\n end\n\n # find value sum\n def solution2(input)\n # Final Solution\n input.flatten.inject(:+)\n\n # Second solution:\n # Works correctly\n # Doesn't use shortcut version of inject\n #\n # input.flatten.inject do |sum, value|\n # sum += value\n # end\n\n # First solution:\n # Works correctly\n # Unoptimized\n #\n # input.map do |ary|\n # ary.inject do |sum, value|\n # sum += value\n # end\n # end.inject do |sum, value|\n # sum += value\n # end\n end\n\n # find max value\n def solution3(input)\n # Final solution\n input.flatten.max\n\n # First solution:\n # Works correctly\n # Unoptimized\n #\n # input.map do |ary|\n # ary.max\n # end.max\n end\n\n # sum the array lengths\n def solution4(input)\n # Final solution\n input.map(&:length).inject(0, :+)\n\n # Second solution:\n # Works correctly\n # Doesn't use shortcut version of inject\n #\n # input.map(&:length).inject{|sum, value| sum += value}\n\n # First solution:\n # Works correctly\n # Unoptimized\n #\n # input.map do |ary|\n # ary.length\n # end.inject {|sum, value| sum += value}\n end\n\n # transform to factorials\n # Factorial is defined as the product of all the whole numbers from 1 to n\n # Examples:\n # 4! = 4*3*2*1\n # 1! = 1\n # 0! = 1\n def solution5(input)\n # Approach\n # Map over the initial array (to return a transformed array)\n # Map over each interal array (to return a transformed array)\n # Creates an enumerable range up to the value in the array\n # Multiple each value in the range using the inject method\n # which iterates and keeps the running total\n\n # Final solution\n # Uses shorthand version of inject\n # Remove the useless multiple by 1\n # Note the use of the starting value of 1 for inject\n # which makes this work properly for all values (including 0, 1)\n input.map do |ary|\n ary.map do |value|\n (2..value).inject(1, :*)\n end\n end\n\n # First solution\n # Mostly optimized\n # Does 1 more multiplication than needed (mult by 1)\n #\n # input.map do |ary|\n # ary.map do |value|\n # (1..value).inject(1) do |factorial, value|\n # factorial *= value\n # end\n # end\n # end\n end\nend", "def solve\n a = Time.new\n for i in 0..@itemsSize - 1\n @table[0][i] = 0\n end\n \n for i in 1..@itemsSize - 1\n price = @problem.prices[i-1]\n weight = @problem.weights[i-1]\n for w in 1..@weights - 1\n if weight <= w\n if (price + @table[w - weight][i - 1]) > @table[w][i -1]\n @table [w][i]= price + @table[w - weight][i - 1]\n else\n @table[w][i] = @table[w][i - 1]\n end\n else\n @table[w][i] = @table[w][i - 1]\n end\n end\n end\n \n \n prev_item = 0\n for i in 1..@itemsSize - 1\n curr_item = @table[@weights - 1][i]\n if prev_item < curr_item\n @best_configuration.push(1)\n else\n @best_configuration.push(0)\n end\n prev_item = curr_item\n end\n \n @best_fitness = @table[@weights - 1][@itemsSize - 1]\n \n b = Time.new\n @time = b-a\n end", "def primordial; end", "def solve!\n end", "def solution(a)\n # write your code in Ruby 2.2\n \n is_perm = 0\n \n n = a.length\n b = [0]*n\n \n \n a.each do |v|\n break if v > n \n break if b[v] == 1 \n b[v] = 1\n end\n \n sum = b.inject(:+)\n if sum == n\n is_perm = 1\n end\n \n is_perm\nend", "def solve\n @time = Time.new\n for j in 0..@generations\n new_generation = Array.new\n @selection.init(@population)\n \n for i in 0..(@population_size/2)-1\n children = @reproduction.reproduce(@selection.select,@selection.select,@mutation)\n \n son = children[0]\n daughter = children[1]\n \n if son.fitness > @best_fitness\n @best_fitness = son.fitness\n @best_configuration = son.configuration.conf\n end\n \n if daughter.fitness > @best_fitness\n @best_fitness = daughter.fitness\n @best_configuration = daughter.configuration.conf\n end\n \n new_generation.push(son)\n new_generation.push(daughter)\n \n end\n \n @population = new_generation\n \n end\n @time = Time.new - @time\n end", "def arrayManipulation(n, queries)\n\n arr = Array.new(n + 1, 0)\n\n queries.each do |query|\n # cycle through and get the inputs\n start = query[0]\n finish = query[1]\n value = query[2]\n # increment value at start of sequence\n arr[start - 1] += value\n # decrement value at first position after sequence\n arr[finish] -= value\n end\n\n tmp = 0\n max = 0\n\n arr.each do |value|\n # step through summing array\n tmp += value\n # capture the max value of tmp\n max = tmp if max < tmp\n end\n\n result = max\nend", "def solve_for_d_optimized\n hash = {}\n for a in (1..5)\n for b in (1..5)\n result = (a**2) + (b**2)\n if hash[result].nil?\n hash[result] = [\"(#{a}, #{b})\"]\n else\n hash[result] << \"(#{a}, #{b})\"\n end\n end\n end\n\n hash.each do |key, array|\n if array.length > 1\n puts \"This is the result (#{array})\"\n end\n end\nend", "def arrayManipulation(n, queries)\r\n arr = Array.new(n, 0)\r\n\r\n queries.each do |query|\r\n left = query[0] - 1\r\n right = query[1] - 1\r\n summand = query[2]\r\n\r\n arr[(left..right)] = arr[(left..right)].map { |a| a + summand }\r\n end\r\n\r\n arr.max\r\nend", "def has_solution(n)\n# Store input in variable N\n$N = n\n\n#Declare and initialize variables to find the maximum number of times 6, 9 and 20 divide into N\n$A_1 = $N/$x\n$A_2 = $N/$y\n$A_3 = $N/$z\n\n#Declare and initialize arrays to store potential combinations, where A is number of 6 packs, B number of 9 packs and C number of 20 packs\n@A = (0..$A_1).to_a\n@B = (0..$A_2).to_a\n@C = (0..$A_3).to_a\n\n#Declare function to calculate different combinations of A, B and C\ndef test(i,j,k)\nreturn @A[i]*$x + @B[j]*$y + @C[k]*$z\nend\n\n#Loop to exhaustively test combinations of A, B and C, with values ranging between 1 and the maximum number of times 6, 9 and 20 divide into N\nfor i in (0..$A_1)\n for j in (0..$A_2)\n for k in (0..$A_3)\n #Use declared function test to check each combination of i,j and k, and if it is equal to N, print out values of i, j and k\n if test(i,j,k) == $N\n return true\n end\n end\n end\nend\n\nend", "def arrayManipulation(n, queries)\n diffArr =[]\n for i in 0..n\n diffArr.push(0)\n end\n for j in queries\n diffArr[j[0]-1] += j[2]\n diffArr[j[1]] -= j[2]\n end\n max = 0\n sum = 0\n for k in diffArr\n sum += k\n max = [sum, max].max\n end\n return max\n\nend", "def problem_60\n prime_check = lambda do |a,b|\n (a + b).to_i.prime? && (b + a).to_i.prime?\n end\n\n find_match = lambda do |a,k|\n r = a.select {|p| k != p && prime_check.call(k,p) }\n end\n\n primes = Primes.upto(10_000).map(&:to_s)\n primes.delete(\"2\")\n\n hit = {}\n\n primes.each do |p1|\n p1a = find_match.call(primes,p1)\n p1a.each do |p2|\n p2a = find_match.call(p1a,p2)\n p2a.each do |p3|\n p3a = find_match.call(p2a,p2)\n p3a.each do |p3|\n p4a = find_match.call(p3a,p3)\n p4a.each do |p4|\n p5a = find_match.call(p4a,p4)\n if p5a.length > 0\n p5a.each do |p5|\n a = [p1,p2,p3,p4,p5]\n sum = a.map(&:to_i).reduce(&:+)\n unless hit[sum]\n puts \"#{sum} #{a.inspect}\"\n else\n hit[sum] = true\n end\n return sum\n end\n end\n end\n end\n end\n end\n end\nend", "def arrayManipulation(n, queries)\n dq = Array.new(n+1,0)\n queries.each do |q|\n a,b,k = q\n dq[a-1]+=k\n dq[b]-=k\n end\n max_sum = 0\n sum = 0\n dq.each do |x|\n sum += x\n max_sum = [max_sum, sum].max\n end\n return max_sum\nend", "def solve_problem\n max = 4000000\n f_curr = 8\n f_prev = 2\n p_curr = 1\n sum = f_prev \n while f_curr <= max\n sum += f_curr\n temp = f_curr\n f_curr = 3*f_curr + 4*f_prev + 2*p_curr\n p_curr = 2*f_prev + p_curr\n f_prev = temp\n end\n return sum\nend", "def solved(ans)\n\n end", "def solve\n n = 33\n while true\n begin\n n += 2\n end while n.prime?\n\n s, ds = 2, 6\n while s < n && !(n - s).prime?\n s += ds\n ds += 4\n end\n\n break if s >= n\n end\n \n n\n end", "def compare_solutions(count = 5, n_min = 1, n_max = 300)\n arr = generate(count, n_min, n_max)\n if solve(arr) != solve_opt(arr)\n puts \"\\nFAILED\"\n puts 'data: ' + arr.to_s\n puts 'solution: ' + solve(arr).to_s\n puts 'optimized solution: ' + solve_opt(arr).to_s\n end\nend", "def solution(s, p, q)\n # write your code in Ruby 2.2\n g = s.length + 1\n a = (s.length + 1)**3\n c = (s.length + 1)**2\n tmp = []\n res = []\n tmp.push 0\n o = 0\n s.split('').each do |i|\n o += if i == 'T'\n 1\n elsif i == 'G'\n g\n elsif i == 'C'\n c\n else\n a\nend\n tmp.push o\n end\n (0...p.length).each do |k|\n o = tmp[q[k] + 1] - tmp[p[k]]\n if o >= a\n res.push 1\n elsif o >= c\n res.push 2\n elsif o >= g\n res.push 3\n else\n res.push 4\n end\n end\n res\nend", "def problem_108(size = 1001)\n func = lambda do |a|\n if a.length == 1\n a[0]+1\n else\n m = a[0]\n (2*m+1) * func.call(a[1,a.length]) -m\n end\n end\n\n primes = Primes.upto(200)\n prime_number = lambda do |a|\n r = 1\n a.sort.reverse.each_with_index { |m,i| r *= primes[i] ** m }\n r\n end\n\n values = {}\n last = 0\n 1.upto(100).each do |nn|\n nn.groupings do |a|\n sols = func.call a\n ans = prime_number.call a\n# puts \"np=#{nn} sols=#{sols} ans=#{ans} => #{a.inspect}\"\n if values[sols]\n values[sols] = [values[sols],[ans,a]].min\n else\n values[sols] = [ans,a]\n end\n true\n end\n size.upto(size*5/4) do |num|\n if values[num]\n puts \"for np = #{nn} => #{num} => #{values[num].inspect}\"\n if last == values[num]\n puts \"factors = #{values[num][0].factors}\"\n return values[num][0] \n end\n last = values[num]\n break\n end\n end\n #values.sort.each do |k,v|\n # puts \"#{k} => #{v}\"\n #end\n end\n nil\nend", "def solution(s, p, q)\r\n # write your code in Ruby 2.2\r\n # A -1\r\n # C -2\r\n # G -3\r\n # T -4\r\n # s - string with n charactekrs\r\n #cagccta\r\n #0123345\r\n #p,q - not empty arrays\r\n #\r\n #p[0]=2 q[0]=4 gcc 322 => 2\r\n #p[1]=5 q[1]=5 t 4 => 4\r\n \r\n \r\n arr = Array.new(q.count)\r\n \r\n \r\n\r\n \r\n arr.each_with_index{|el, i|\r\n \r\n ss = s[p[i]..q[i]]\r\n \r\n if ss.index('A') \r\n n = 1\r\n elsif ss.index('C')\r\n n=2\r\n elsif ss.index('G')\r\n n=3\r\n else \r\n n=4\r\n end\r\n \r\n arr[i] = n\r\n \r\n }\r\n \r\n \r\n \r\n arr\r\n \r\nend", "def greedy1_fill!(remaining_partitions)\n remaining_partitions.each do |src_partition|\n # Test each site ...\n src_partition.sites.each do |site|\n\n simulation_result_below_bound = {}\n simulation_result_above_bound = {}\n # ... in each bin ...\n self.each_with_index do |bin, bin_index|\n target_partition = bin.list[src_partition.name]\n if target_partition.nil?\n # Creating a new partition is more costly than the worst case\n operations = @operations_worst_case + 1\n else\n # Simulate insertion of site into existing partition of current bin\n operations = target_partition.incr_add_sites!([site], simulate = true)\n end\n # Check if bin.size is smaller than lower_bound. Save simulation_result accordingly to prefer addition below lower_bound.\n if bin.update_size!.size < @operations_lower_bound\n simulation_result_below_bound.merge!({operations => bin_index})\n else\n simulation_result_above_bound.merge!({operations => bin_index})\n end\n\n end\n\n # Insert at lowest operation cost\n best = if simulation_result_below_bound.empty?\n simulation_result_above_bound.min_by { |operations, bin_index| operations }\n else\n simulation_result_below_bound.min_by { |operations, bin_index| operations }\n end\n target_partition = @list[best[1]].list[src_partition.name]\n if target_partition.nil?\n @list[best[1]].add!([Partition.new(src_partition.name, [site], src_partition.tree)])\n else\n target_partition.incr_add_sites!([site])\n end\n\n end\n end\n end", "def arrayManipulation(n, queries)\n nums = Array.new(n+1, 0)\n queries.each do |query|\n nums[query[0]-1] += query[2]\n nums[query[1]] -= query[2]\n end\n\n max = nums.first\n (1..nums.length-1).each do |i|\n nums[i] += nums[i - 1]\n max = nums[i] if nums[i] > max && i < (nums.size - 1)\n end\n\n max\nend", "def qytt\n # procure the numbers\n arrNumbers = [ arrNumbersOfProcGivenMinMax( method(:intGetTriangleInt), 1000, 10000),\n arrNumbersOfProcGivenMinMax( method(:intGetSquareInt), 1000, 10000),\n arrNumbersOfProcGivenMinMax( method(:intGetPentagonalInt), 1000, 10000),\n arrNumbersOfProcGivenMinMax( method(:intGetHexagonalInt), 1000, 10000),\n arrNumbersOfProcGivenMinMax( method(:intGetHeptagonalInt), 1000, 10000),\n arrNumbersOfProcGivenMinMax( method(:intGetOctagonalInt), 1000, 10000) ]\n arrNumbers.map! do |arr|\n deletable = []\n arr.each do |num|\n if ( num / 10 % 10 == 0 )\n deletable << num\n end\n end\n arr -= deletable\n end\n\n # get the hash numbers which we will jump to and from\n hashNumbers = Array.new(6){ HashChained.new }\n (0..5).each do |i|\n arrNumbers[i].each do |num|\n hashNumbers[i][num/100] = num % 100\n end\n end\n\n threads = []\n # we're guaranteed only one solution\n superResult = 0\n\n # iterate through the octagonal numbers\n arrNumbers.last.each do | firstNum |\n checker = firstNum % 100\n hashNumbers[0..4].permutation.each do |perm|\n t = Thread.new do\n result = qyttRecursion( checker, perm )\n if result[0] > 0 && result[1] == firstNum / 100\n superResult = result[0] + firstNum\n end\n end\n threads << t\n end\n end\n\n threads.each do |t|\n t.join\n end\n superResult\n\nend", "def solve(a=nil, b=nil)\n program = @program.dup\n pointer = 0\n opcode = 0\n program[1] = a if a\n program[2] = b if b\n\n while (opcode != @STOP && pointer < program.length) do \n puts \"pointer: #{pointer}\" if @DEBUG\n opcode = program[pointer]\n a = 0\n b = 0\n c = 0\n\n # Check Immeidate Mode\n if(opcode.to_s.length > 2)\n opcode = opcode.to_s\n # need to parse that fancy code\n instruction = opcode[-2..-1].to_i\n puts \"instruction: #{instruction}\\nopcode: #{opcode}\" if @DEBUG\n \n if (opcode.length == 3)\n puts \"length: 3\" if @DEBUG\n c = opcode[0].to_i\n elsif (opcode.length == 4)\n puts \"length: 4\" if @DEBUG\n b = opcode[0].to_i\n c = opcode[1].to_i\n elsif (opcode.length == 5)\n puts \"length: 5\" if @DEBUG\n a = opcode[0].to_i\n b = opcode[1].to_i\n c = opcode[2].to_i\n end\n else\n puts \"opcode only: #{opcode}\" if @DEBUG\n instruction = opcode.to_i\n end\n\n if(instruction == @STOP)\n puts \"STOP\"\n break\n end\n\n puts \"a: #{a}\\nb: #{b}\\nc: #{c}\\n\" if @DEBUG\n \n if(instruction == @ADD || instruction == @MULTIPLY)\n position_a = program[pointer + 1].to_i\n position_a = program[position_a].to_i if c == 0\n\n position_b = program[pointer + 2].to_i\n position_b = program[position_b].to_i if b == 0\n\n position_c = program[pointer + 3].to_i #if a == 0\n #position_c = program[pointer + 3].to_i if a == 1\n \n if(instruction == @ADD)\n program[position_c] = position_a + position_b\n elsif(instruction == @MULTIPLY)\n program[position_c] = position_a * position_b\n end\n pointer += 4\n puts \"incrementing pointer by 4\" if @DEBUG\n end\n\n if(instruction == @READ)\n if (c == 0)\n puts \"\\nSTATUS: #{program[program[pointer + 1].to_i]}\\n\"\n else\n puts \"\\nSTATUS: #{program[pointer + 1]}\\n\"\n end\n pointer += 2\n puts \"incrementing pointer by 2\" if @DEBUG\n end\n\n if(instruction == @STORE)\n print \"input: \"\n number = gets.strip\n target = program[pointer + 1].to_i\n program[target] = number.to_i\n pointer += 2\n puts \"incrementing pointer by 2\" if @DEBUG\n end\n\n # only two params\n if(instruction == @JUMP_IF_TRUE)\n puts \"Jump if true\" if @DEBUG\n first = pointer + 1\n first = program[first].to_i if c == 0\n\n second = pointer + 2\n second = program[second].to_i if b == 0\n\n if @DEBUG\n puts \"first: #{first}\\nsecond: #{second}\"\n puts \"first_value: #{program[first]}\\nsecond_value: #{program[second]}\"\n end\n\n unless program[first].to_i == 0\n pointer = program[second].to_i\n puts \"assigning pointer to #{pointer}\" if @DEBUG\n else\n pointer += 3\n puts \"incrementing pointer by 3\" if @DEBUG\n end\n end\n\n # only two params\n if(instruction == @JUMP_IF_FALSE)\n puts \"Jump if false\" if @DEBUG\n\n first = pointer + 1\n first = program[first].to_i if c == 0\n\n second = pointer + 2\n second = program[second].to_i if b == 0\n \n if @DEBUG\n puts \"first: #{first}\\nsecond: #{second}\"\n puts \"first_value: #{program[first]}\\nsecond_value: #{program[second]}\"\n end\n\n if program[first].to_i == 0\n pointer = program[second].to_i\n puts \"assigning pointer to #{pointer}\" if @DEBUG\n else\n pointer += 3\n puts \"incrementing pointer by 3\" if @DEBUG\n end\n end\n\n # four parameters\n if(instruction == @LESS)\n puts \"Less\" if @DEBUG\n\n first = pointer + 1\n first = program[first].to_i if c == 0\n\n second = pointer + 2\n second = program[second].to_i if b == 0\n\n third = pointer + 3\n third = program[third].to_i if a == 0\n\n if(program[first].to_i < program[second].to_i)\n program[third] = 1\n else\n program[third] = 0\n end\n\n pointer += 4\n end\n\n if(instruction == @EQUALS)\n puts \"Equals\" if @DEBUG\n\n first = pointer + 1\n first = program[pointer + 1].to_i if c == 0\n\n second = pointer + 2\n second = program[second].to_i if b == 0\n\n third = pointer + 3\n third = program[third].to_i if a == 0\n\n puts \"first: #{program[first]}, second: #{program[second]}\" if @DEBUG\n\n if(program[first].to_i == program[second].to_i)\n puts \"Setting #{third} to 1\" if @DEBUG\n program[third] = 1\n else\n puts \"Setting #{third} to 0\" if @DEBUG\n program[third] = 0\n end\n\n pointer += 4\n end\n gets if @DEBUG\n end\n return program[0]\n end", "def solve( n = 10_000 )\n (1..n).select {|i| i.amicable?}.reduce( :+ )\n end", "def solve_prims\n linked, unlinked = [nodes.first], nodes[1..-1].dup\n end", "def dp_possible_trees(n)\n array = Array.new(n+2) { Array.new(n+1) { 0 } }\n (0...n+2).to_a.each do |i|\n array[i][0] = 1\n end\n\n sum = 0\n (1...n+1).to_a.each do |i|\n sum = 0\n (1..i).to_a.each do |j|\n array[j][i] = array[n+1][i-j] * array[n+1][j-1]\n sum += array[j][i]\n end\n array[n+1][i] = sum\n end\n array[n+1].last\nend", "def dpll\n\t\t#need to count degree, best_guess, assignments and such heuristic stuff somewhere... makes sense to do it here\n\t\t#should make a version without heuristics aswell\n##############################################3\n#\t\tputs \"the kb : \" + @kb.to_s\n\n\t\t@kb.each do |sente|\n##########################################################333\n#\t\t\tputs \" the sentences: \" + sente.to_s\n\n\t\t\tif(sente.size==1)\n\t\t\t\tindex=sente[0]\n\t\t\t\tif(index > 0)\n\t\t\t\t\t@id_array[index-1].pos_increment\n\t\t\t\t\t@id_array[index-1].puret=true\t\t\t\t\t\n\t\t\t\telse\n\t\t\t\t\tindex*=-1\n\t\t\t\t\t@id_array[index-1].neg_increment\n\t\t\t\t\t@id_array[index-1].puref = true\n\t\t\t\tend\t\n\t\t\telse\t\n\t\t\t\tsente.each do |atome|\n#############################################################\n#\t\t\t\t\tputs \"the individual atoms: \" + atome.to_s\n\t\t\t\t\tif(atome > 0)\n\t\t\t\t\t\tindex = atome-1\n\t\t\t\t\t\t@id_array[index].pos_increment\n\t\t\t\t\telse\n\t\t\t\t\t\tindex = -1*atome-1\n\t\t\t\t\t\t@id_array[index].neg_increment\n\t\t\t\t\tend\t\t\t\n\t\t\t\tend\n\t\t\tend\t\n\t\tend\n\t\t@id_array.each do |var|\n\t\t\tif(!var.assignment_intialize)\n\t\t\t\treturn false\n\t\t\tend\n\t\tend\n\t\t\n\t\t#intialization stuff\n\t\t##########heuristic sort!\n\t\tvar_list = @id_array\n\t\tvar_list.sort!\n\t\t\n\t\tdepth=0\n\t\tassignment = Array.new\n\t\tsatisfiable = false\n\t\tstack = []\n\t\n\t\t#make parallel array assignment\n\t\tid_array.map { assignment << 0}\n\t\t\n\n\t\t#insert root\n\t\t(var_list[depth].assignments).map do |child|\n\t\t\tstack.push(Assign_Stack_Object.new(child,depth))\n\t\tend\n\t\t\n\t\t#start depth-first search\n\t\twhile(stack.size()>0)\n\t\n\t\t\ttemp = stack.pop\n\t\t\n\t\t\t#comparing depth to make sure assignment variables reassigned if popping up the tree\n\t\t\twhile(depth>temp.depth)\n\t\t\t\tassignment[depth] = 0\n\t\t\t\tdepth -=1\n\t\t\tend\t\n\t\t\t#add it to the assignment evaluation list (depth doubles as index through var_list)\n\t\t\tassignment[var_list[temp.depth].id - 1] = temp.value\n\t\t\n\t\t\t#Evaluate the assignment list\n\t\t\tif(satisfiable_assignment?(assignment)==1)\n##########################################################################333\n\t\t\t\tputs \"the kb is: \" + @kb.to_s \n\t\t\t\tputs \"the assignment that evaluates to true: \"\n\t\t\t\tputs assignment.to_s\n#############################################################################\n\t\t\t\t\n\t\t\t\treturn true\n\t\t\tend\n\t\n\t\t\t#add children\n\t\t\tdepth+=1\t\n\t\n\t\t\t#if not bottumed out, add more children based on values from the var\n\t\t\tif(depth<var_list.size())\n\t\t\t\t(var_list[depth].assignments).map do |child|\n\t\t\t\t\tstack.push(Assign_Stack_Object.new(child,depth))\n\t\t\t\tend\t \n\t\t\telse\n\t\t#reset to bottom value\n\t\t\t\tdepth =var_list.size-1\n\t\t\tend\n\t\tend\n\t\treturn false\n\tend", "def solution(x, y, d)\r\n # write your code in Ruby 2.2\r\n i=1\r\n loop do\r\n s=x+i*d\r\n \r\n break if(s>=y)\r\n \r\n i+=1\r\n end \r\n i\r\nend", "def part2(program)\n special = 19690720\n (0..99).to_a.repeated_permutation(2).each do |noun, verb|\n input = program.dup\n input[1] = noun\n input[2] = verb\n\n output = run(input)\n puts \"noun = #{noun}, verb = #{verb}, output = #{output[0]}\"\n if output[0] == special\n return [noun, verb]\n end\n end\n puts \"fuck\"\n return [-1, -1]\nend", "def solver (seed_char, blanks_words_sizes, matrix)\n\t# Set numerical target\n\ttarget = magic_num(seed_char)\t\n\t# Find magic number sum buckets\n\tskynet(target, blanks_words_sizes, blanks_words_sizes.length - 1, 0, [])\n\t# Alphabetical sort input matrix\n\tsorted_seed_char = seed_char.chars.sort.join\t\n\n\t# Find unique sets from skynet solutions\n\t$answer[:trace].each do |arrOarr|\n\t\tarrOarr.sort!\n\tend \n\n\t$answer[:trace].uniq!\t\n\t\n\t# Finds match for complete set of words from skynet solutions\n\t$answer[:trace].each do |answer_arr_el|\t\t\t\t\n\t\tunordered_match(sorted_seed_char, matrix, answer_arr_el, answer_arr_el.length - 1, \"\", [])\n\t\t# Can be ignored\n\t\t$ops += $seed[answer_arr_el[0][0]][:num_groups][answer_arr_el[0][1]].length *\n\t\t\t$seed[answer_arr_el[1][0]][:num_groups][answer_arr_el[1][1]].length *\n\t\t\t$seed[answer_arr_el[1][0]][:num_groups][answer_arr_el[1][1]].length *\n\t\t\t$seed[answer_arr_el[1][0]][:num_groups][answer_arr_el[1][1]].length\t\t\n\tend\n\t\n\treturn $answer[:words]\nend", "def problem(a=100,b=100)\n (2..a).inject(0) {|s1,i| s1 += (2..b).inject(0) {|s2,j| @terms.add?(i**j) ? s2 += 1 : s2}}\n end", "def find_solution(arr)\n arr.each_with_index do |e, i|\n rest = arr[0..i - 1] + arr[i + 1..-1]\n prod = rest.reduce(:*)\n arr[i] = prod\n end\n\n arr\nend", "def solution(n, p, q)\n primes = primes(n)\n # puts \"primes:#{primes}\"\n semi_primes_count = Array.new n+1, 0\n primes.each do |p1|\n primes.each do |p2|\n break if p1 * p2 > n\n semi_primes_count[p1 * p2] = 1\n end\n end\n\n 1.upto(n) do |i|\n semi_primes_count[i] += semi_primes_count[i - 1]\n end\n\n queries = [p,q].transpose\n\n res = queries.map do |query|\n semi_primes_count[query.last] - semi_primes_count[query.first - 1]\n end\n\n # puts \"res:#{res}\"\n\n res\n end", "def resolve\n\t\treturn 1 if @n == 0\n\t\trow = [1,1]\n\t\t2.upto(@n) do\n\t\t\tcurrent = [1]\t\t\t\n\t\t\t1.upto(row.size-1) do |i|\n\t\t\t\tcurrent << row[i-1] + row[i]\n\t\t\tend\n\t\t\tcurrent << 1\n\t\t\trow = current\n\t\tend\n\t\trow.inject(0) {|sum, n| sum + n*n}\n\tend", "def problem_106a\n combin = lambda { |m,h| m.factorial / (h.factorial * (m - h).factorial) }\n max = 20\n\n sum = Array.new(max+1,-1)\n 1.upto(max) do |n|\n 0.upto(n/2) do |k|\n sum[n] += combin.call(n,2*k) * combin.call(2*k - 1, k + 1)\n end\n puts \"#{n} #{sum[n]}\"\n end\n sum[12]\nend", "def getMoneySpent(keyboards, drives, budget)\n #\n # Write your code here.\n #\n highest_combination = -1\n keyboards.each do |keyboard|\n drives.each do |drive|\n sum = keyboard + drive\n highest_combination = sum if sum <= budget && sum > highest_combination\n end\n end\n highest_combination;\nend", "def minimize; 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 find_limit(universe, subset)\n \n large_number = 10_000_000_000\n resource = universe + 1\n my_array = Array.new\n \n (0...universe).each do |value|\n my_array\n .push([value+1, value, 0])\n .push([value, value +1, 1])\n end\n p my_array if $PRINT_ARRAY\n \n (0...universe+1).each do |value|\n my_array.push([resource, value, 0])\n end\n p my_array if $PRINT_ARRAY\n \n subset.each do |value|\n my_array\n .push([value[0]-1,value[1], value[2]])\n .push([value[1],value[0]-1, -value[2]])\n end\n p my_array if $PRINT_ARRAY\n \n distribution = [large_number]*(universe+2)\n distribution[resource] = 0\n \n (0...universe+1).each do |value|\n my_array.each do |value|\n distribution[value[1]] = [distribution[value[1]], distribution[value[0]]+value[2]].min\n end\n end\n distribution[universe]-distribution[0]\nend", "def knapsack_dp(w, w_arr, v_arr, n)\n return 0 if w == 0 || n == 0\n cache = {}\n\n (0..n).each do |nn|\n cache[nn] = {}\n (0..w).each do |ww|\n cache[nn][ww] = if ww == 0 || nn == 0\n 0\n elsif w_arr[nn - 1] > ww\n cache[nn - 1][ww]\n else\n [v_arr[nn - 1] + cache[nn - 1][ww - w_arr[nn - 1]], cache[nn - 1][ww]].max\n end\n end\n end\n cache[n][w]\nend", "def solve\n @time = Time.new\n while true\n if @stack.pop == 0\n else\n while (not @stack.empty?) && (@stack.peek == 1)\n @stack.pop\n end\n if not @stack.empty?\n @stack.pop\n else\n b = Time.new\n @time = b - @time\n return\n end\n \n end\n \n @current_configuration[@stack.size] = 1\n @stack.push(1)\n while @stack.size < @dimension\n @current_configuration[@stack.size] = 0\n @stack.push(0)\n end\n \n conf = Configuration.new(@current_configuration, @problem)\n curr_fitness = conf.fitness\n if curr_fitness > @best_fitness\n @best_fitness = curr_fitness\n for i in 0..@current_configuration.size - 1\n @best_configuration[i] = @current_configuration[i]\n end\n \n end\n \n end\n \n \n end", "def calculate_subsolutions_space_efficient\n @subsolutions_1 = Array.new(@max_weight+1, 0)\n @subsolutions_2 = Array.new(@max_weight+1)\n\n (1..@items.size).each { |i|\n puts i\n (0..@max_weight).each { |j|\n # case 1. Item i excluded, no additional weight added to knapsack\n value1 = @subsolutions_1[j]\n # case 2. Item i is included, requires adding item's weight to knapsack\n value2 = (@items[i-1].weight<=j) ? (@items[i-1].value + @subsolutions_1[j-@items[i-1].weight]) : -1\n # a total value stored in a knapsack, when i items and j max_knapsack_weight\n @subsolutions_2[j] = (value1>value2) ? value1 : value2\n }\n # move newly found subsolutions to subsolutions1\n (0..@subsolutions_2.size-1).each {|i| @subsolutions_1[i] = @subsolutions_2[i] }\n }\n @max_value = @subsolutions_2[@max_weight]\n end", "def prog\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 1 )\n\n begin\n # at line 39:11: PROGRAM LKEY ( dclrG ';' )* ( fun )* RKEY\n match( PROGRAM, TOKENS_FOLLOWING_PROGRAM_IN_prog_143 )\n match( LKEY, TOKENS_FOLLOWING_LKEY_IN_prog_145 )\n # at line 39:24: ( dclrG ';' )*\n while true # decision 1\n alt_1 = 2\n case look_1 = @input.peek( 1 )\n when T__44 then look_1_1 = @input.peek( 2 )\n\n if ( look_1_1 == ID )\n alt_1 = 1\n\n end\n when T__45 then look_1_2 = @input.peek( 2 )\n\n if ( look_1_2 == ID )\n alt_1 = 1\n\n end\n when T__46 then look_1_3 = @input.peek( 2 )\n\n if ( look_1_3 == ID )\n alt_1 = 1\n\n end\n when T__47 then look_1_4 = @input.peek( 2 )\n\n if ( look_1_4 == ID )\n alt_1 = 1\n\n end\n end\n case alt_1\n when 1\n # at line 39:25: dclrG ';'\n @state.following.push( TOKENS_FOLLOWING_dclrG_IN_prog_148 )\n dclrG\n @state.following.pop\n match( T__42, TOKENS_FOLLOWING_T__42_IN_prog_149 )\n\n else\n break # out of loop for decision 1\n end\n end # loop for decision 1\n # at line 39:36: ( fun )*\n while true # decision 2\n alt_2 = 2\n look_2_0 = @input.peek( 1 )\n\n if ( look_2_0.between?( T__44, T__47 ) )\n alt_2 = 1\n\n end\n case alt_2\n when 1\n # at line 39:36: fun\n @state.following.push( TOKENS_FOLLOWING_fun_IN_prog_153 )\n fun\n @state.following.pop\n\n else\n break # out of loop for decision 2\n end\n end # loop for decision 2\n match( RKEY, TOKENS_FOLLOWING_RKEY_IN_prog_156 )\n # --> action\n agc_8\n # <-- action\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 1 )\n\n end\n \n return \n end", "def start_solution plan\n solutions = []\n 15.times do\n s = mutate_pairs plan, valid_solution2(false)\n solutions << s\n end\n\n #0.times do\n # s = random_solution plan\n #end\n\n 10.times do\n s = structured_solution plan\n solutions << mutate_pairs(plan, s)\n end\n sort_soluitons plan, solutions\n end", "def solve\n\t\trowData = @data[0].split(\" \")\n\t\tcolData = @data[1].split(\" \")\n\n\t\t@rows = self.getCandidates(rowData, colData.size)\n\t\t@cols = self.getCandidates(colData, rowData.size)\n\n\t\tbegin\n\t\t\tnumChanged = self.reduceMutual(@cols, @rows)\n\t\t\tif (numChanged == -1)\n\t\t\t\treturn\n\t\t\tend\n\t\tend while (numChanged > 0)\n\n\t\t@rows.each do |row|\n\t\t\tfor i in 0...(@cols.size)\n\t\t\t\tprint row[0][i]? \"# \" : \". \"\n\t\t\tend\n\t\t\tprint \"\\n\"\n\t\tend\n\t\treturn self\n\tend", "def solution(size=5)\n ([1] + (3..size).select(&:odd?).map do |x|\n 4*x**2 - 6*x + 6\n end).reduce(:+)\nend", "def [](*parameters)\n homogenized_parameters = homogenized_list_of_arrays(parameters)\n\n permutation_lookup = {}\n\n all_range_permutations = permutations_of_list_of_ranges(homogenized_parameters)\n all_range_permutations.each do |parameter_permutation|\n permutation_lookup[parameter_permutation] = call(*parameter_permutation)\n end\n\n should_reduce_results = permutation_lookup.values.uniq.count == 1\n if should_reduce_results\n permutation_lookup.values.first\n else\n permutation_lookup\n end\n end", "def solve\n dp = H.times.map { [nil] * W }\n dp[0][0] = 1 << 60\n dp[1][0] = A[0][0] + A[1][0] + C\n dp[0][1] = A[0][0] + A[0][1] + C\n\n (1...W).each do |x|\n dp[0][x] = [A[0][x - 1] + C + A[0][x],\n dp[0][x - 1] + C + A[0][x] - A[0][x - 1]].min\n end\n (1...H).each do |y|\n dp[y][0] = [A[y - 1][0] + C + A[y][0],\n dp[y - 1][0] + C + A[y][0] - A[y - 1][0]].min\n end\n (1...H).each do |y|\n (1...W).each do |x|\n now = A[y][x]\n dp[y][x] = [\n A[y - 1][x] + C + now,\n A[y][x - 1] + C + now,\n dp[y - 1][x] + C + now - A[y - 1][x],\n dp[y][x - 1] + C + now - A[y][x - 1]\n ].min\n end\n end\n\n dp.flatten.min\nend", "def solution(a)\r\n n=a.size\r\n i=1\r\n for k in a.sort do\r\n\tif k!=i \r\n\t then \r\n\t return 0\r\n\t break;\r\n\tend\r\n i+=1;\r\n end\t\r\n return 1 if a.inject(:+) ==n*(n+1)/2;\r\nend", "def problem_76a\n num = 100\n solve = lambda do |a,off,max|\n n = 0\n while a[off] < max && (a.length-off) >= 2 \n a[off] += a.pop\n n += 1\n n += solve.call(a.dup,off+1,a[off]) if a.length - off > 1\n end\n n\n end\n puts 1 + solve.call([1] * num, 0,num-1)\nend", "def solution(k, m, a)\n from = a.max\n to = a.inject(:+)\n min = from\n while from <= to\n mid = (from + to) / 2\n if check(mid, k, m, a)\n min = mid\n to = mid - 1\n else\n from = mid + 1\n end\n end\n min\nend", "def testInput inputArray\n testDimensionBaseNumber inputArray\n\n dim = inputArray[0][0]\n puts \"Dimensions: \" + dim\n nOfSetNumbers = inputArray[1][0]\n puts \"Number of given numbers: \" + nOfSetNumbers\n \n testMaxValueEach(inputArray,1)\n \n lineOfNumberConstraints = (2 + nOfSetNumbers.to_i)\n \n testPositionOfAdditionalConstraints(inputArray, lineOfNumberConstraints)\n\n testMaxValueEach(inputArray, lineOfNumberConstraints)\n \n numberOfAdditionalConstraints = inputArray[lineOfNumberConstraints][0]\n \n puts \"Number of given constraints: \" + numberOfAdditionalConstraints\n \n if inputArray.length != (numberOfAdditionalConstraints.to_i+nOfSetNumbers.to_i+3)\n puts \"wrong input file - number of lines is not matching with given numbers of constraints\"\n end\n \n (2..(nOfSetNumbers.to_i+1)).each do |i|\n testNumberOfElements(inputArray,i,3)\n end\n\n (lineOfNumberConstraints+1..(numberOfAdditionalConstraints.to_i+lineOfNumberConstraints)).each do |i|\n testNumberOfElements(inputArray,i,4)\n end\n\n testValueOfElements(inputArray,dim, nOfSetNumbers,numberOfAdditionalConstraints)\n\n return dim\nend", "def solution_dp_bu(p, n)\n dp = Array.new(n, MIN_INT)\n # we set p[0] and dp[0] to 0\n dp[0] = 0\n p = p.dup.unshift(0)\n\n (1..n).each do |i|\n dp[i] = (0..(i - 1)).reduce(MIN_INT) do |max, j|\n [max, dp[j] + p[i - j]].max\n end\n end\n\n dp.last\nend", "def calculates(problems)\n problems.each do |each_prob|\n calculate_problem(each_prob)\n end\nend", "def eval_prog env\n\t\tresults = env.select { |pair| pair[0] == @s }\n\t\tif results.length > 0\n=begin\n for i in 0..results.length-1\n puts results[i][0]\n puts results[i][1]\n puts \"\\n\"\n end\n=end\n results[0][1]\n\t\telse\n\t\t\traise (\"var not found: \" + @s)\n\t\tend\n\tend", "def knapsack0(weights, values, capacity) #C = 6 #W = [1,2,3] #V = [10, 4, 8]--equal-sized\n @knapsack = {}\n @capacity_cache = {}\n @value_cache = {}\n #First, store & cache weight-value pairs\n weights.each_index do |idx|\n @knapsack[weights[idx]] = values[idx] #{1: 10, 2: 4, 3: 8}\n @capacity_cache[weights[idx]] = [ values[idx] ] #{1: [10], 2: [4], 3: [8]}\n @value_cache[values[idx]] = [ weights[idx] ] #{10: [1], 4: [2], 8: [3]}\n end\n\n weight_keys = weights.sort #[1,2,3] #[23...]\n @min = weight_keys[0]\n #Check if any valid weights\n return 0 if capacity < @min #6 < 1 => false\n return @capacity_cache[@min].first if capacity == @min\n\n #set base case; value keyed to weights array # 10: [1] #92: [23]\n latest_value = @knapsack[@min]\n latest_weights = @value_cache[latest_value].dup\n #Combine valid weights' values w/ cached weight-value sets\n #Cache highest value set to current weight\n (@min + 1..capacity).each do |weight| #2 | 3 | 4 | 5 | 6\n #select possible keys\n valid_keys = weight_keys.select{|key| key <= weight && !latest_weights.include?(key)} #[1,2] | [1,2,3]\n\n (0...valid_keys.length).each do |i| #0 |, 1\n\n current_value_set = @capacity_cache[@min]\n (@min + 1..weight).each do |cap_weight|\n\n new_weight = valid_keys[i] + latest_weights.inject(:+) #2+1= 3|, 3+1+2= 6 |,|2+1+3= 6\n #can either:\n #Add a weight to the set,\n if new_weight <= weight #3 <= 2 => false | #3 <= 3 => true, 6 <= 3 => false ||| 6 <= 6 => true\n #set new value to weights array\n latest_sum = 0\n latest_weights.each {|wt| latest_sum += @knapsack[wt]} #=> 10 |||| 10+8\n latest_value = @knapsack[valid_keys[i]] + latest_sum #| 10+4= 14 ||| +4= 22\n @value_cache[latest_value] = latest_weights << valid_keys[i] #| 14: [1,2] ||| 22: [1,3,2]\n latest_weights = @value_cache[latest_value] #[1] | [1,2] | [1,3,2]\n #Replace a weight from the set,\n else\n smallest = @knapsack[valid_keys[i]] #4 |. 8\n weight_of_smallest = valid_keys[i] #2 |. 3\n latest_weights.each do |wt|\n #10 < 4 => false |. 10 < 8 => false, 4 < 8 but 1+3 <= 3 => false |\n #1+3 <= 4 => true |. 8 < 4 => false\n if @knapsack[wt] < smallest && #one weight's value is less\n latest_weights.inject(:+) - wt + valid_keys[i] <= capacity\n #and replacing it w/ new weight would be valid\n smallest = @knapsack[wt] #||4\n weight_of_smallest = wt #||2\n end\n end\n\n #or Do nothing\n if smallest != @knapsack[valid_keys[i]] #false |. false | true | false\n latest_weights.delete(weight_of_smallest)\n latest_weights.push(valid_keys[i]) #||[1,3]\n latest_value = latest_value - smallest + @knapsack[valid_keys[i]] #||14-4+8= 18\n @value_cache[latest_value] = latest_weights #18: [1,3]\n end\n end\n end\n end\n\n capacity_array = [] #[1] | [1,2] | [1,3] || [1,3,2]\n @value_cache[latest_value].each{ |wt| capacity_array.push(@knapsack[wt]) }\n @capacity_cache[weight] = capacity_array #2: [10] | 3: [10,4] | 4: [10, 8] | 5: [10, 8] | 6: [10, 8, 4]\n end\n p '----'\n p @capacity_cache[capacity]\n sum = @capacity_cache[capacity].inject(:+) #22\n sum\n end", "def greedy1_initial_alt2!(remaining_partitions)\n\n virtual_remaining_partitions = DeepClone.clone remaining_partitions\n\n sites_in_current_partition = 0\n # Fill each bin starting with the least filled\n self.each_with_index do |bin, bin_index|\n\n free_space = (@operations_lower_bound - bin.size)\n\n # condition can be equal since the first remaining partition might be split\n dropped_partitions = if virtual_remaining_partitions.first.op_optimized == free_space || (virtual_remaining_partitions.size == 1 && virtual_remaining_partitions.first.op_optimized <= free_space)\n virtual_remaining_partitions.drop!(1)\n sites_in_current_partition = 0\n elsif virtual_remaining_partitions.first.op_optimized < free_space\n partition = virtual_remaining_partitions.drop!(1).first\n sites_in_current_partition = virtual_remaining_partitions.first.sites.size\n space_per_site = (virtual_remaining_partitions.first.op_optimized / sites_in_current_partition).floor\n [partition,\n virtual_remaining_partitions.drop_sites!(((free_space - partition.op_optimized).to_f/space_per_site).ceil, compute = false)]\n else\n sites_in_current_partition = virtual_remaining_partitions.first.sites.size if sites_in_current_partition == 0\n space_per_site = (virtual_remaining_partitions.first.op_optimized / sites_in_current_partition).floor\n virtual_remaining_partitions.drop_sites!((free_space.to_f/space_per_site).ceil, compute = false)\n end\n\n # Phase 2: Add site in the middle of each partition to the bin\n dropped_partitions.each do |partition|\n # Get site in the middle of partition\n mid_site = partition.sites[partition.sites.size / 2]\n\n # Actual assignment of site\n dropped_partition = remaining_partitions.list[partition.name].drop_specific_site!(mid_site)\n bin.add!([dropped_partition])\n end\n end\n\n remaining_partitions\n end", "def calculate_subsolutions\n @subsolutions = Array.new(@items.size+1) { Array.new(@max_weight+1) }\n @subsolutions[0].map!{|value| 0}\n (1..@items.size).each { |i|\n (0..@max_weight).each { |j|\n # case 1. Item i excluded, no additional weight added to knapsack\n value1 = @subsolutions[i-1][j]\n # case 2. Item i is included, requires adding item's weight to knapsack\n value2 = (@items[i-1].weight<=j) ? (@items[i-1].value + @subsolutions[i-1][j-@items[i-1].weight]) : -1\n # a total value stored in a knapsack, when i items and j max_knapsack_weight\n @subsolutions[i][j] = (value1>value2) ? value1 : value2\n }\n }\n @max_value = @subsolutions[@items.size][@max_weight]\n end", "def solution(a, b)\n a.size > b.size ? b+a+b : a+b+a\nend", "def solution_slow_2(n, p, q)\n sieve = sieve_of_erathosteneses(n)\n # puts \"sieve:#{sieve}\"\n semi = semiprimes(n, sieve)\n # puts \"sp:#{semi}\"\n prefix = [0,0,0,0,1]\n 5.upto(n) do |x|\n if semi.include? x \n prefix << prefix.last + 1\n else\n prefix << prefix.last\n end\n end\n # puts \"prefix:#{prefix}\"\n\n queries = [p,q].transpose\n\n\n res = queries.map do |query|\n prefix[query.last] - prefix[query.first - 1]\n end\n\n # puts \"res:#{res}\"\n\n res\n end", "def max_sub_array_DYNAMIC(nums)\n puts \"\\nSTARTING WITH #{nums}\"\n return 0 if nums == nil\n \n # take inventory of the continuous patches\n continuousPositiveSegments = {}\n continuousNegativeAndZeroSegments = {}\n # key = startingIndex, value = sum\n \n # iterate thru to assemble the 2 inventories \n curr_index = 0\n startingPosIndex = nil\n runningPosTotal = 0\n startingNegIndex = nil\n runningNegTotal = 0\n \n while curr_index < nums.length \n \n if nums[curr_index] > 0\n # positive element\n if !startingPosIndex\n # start a new pos segment\n startingPosIndex = curr_index\n runningPosTotal += nums[curr_index]\n \n if startingNegIndex\n # end previous neg segment, add to inventory and reset counters\n continuousNegativeAndZeroSegments[startingNegIndex] = runningNegTotal\n startingNegIndex = nil\n runningNegTotal = 0\n end\n \n elsif startingPosIndex\n # already in the middle of a pos segment\n runningPosTotal += nums[curr_index]\n end\n \n else\n # negative or zero element\n if !startingNegIndex\n # start a new neg segment\n startingNegIndex = curr_index\n runningNegTotal += nums[curr_index]\n \n if startingPosIndex\n # end previous pos segment, add to inventory and reset counters\n continuousPositiveSegments[startingPosIndex] = runningPosTotal\n startingPosIndex = nil\n runningPosTotal = 0\n end\n elsif startingNegIndex\n # already in the middle of a neg segment\n runningNegTotal += nums[curr_index]\n end\n end\n \n curr_index += 1\n end\n \n # nums array ended, wrap up whatever the last segment happened to be\n if startingPosIndex\n continuousPositiveSegments[startingPosIndex] = runningPosTotal\n else\n continuousNegativeAndZeroSegments[startingNegIndex] = runningNegTotal\n end\n \n ###### FINISHED TAKING INVENTORY #####\n puts \"Continuous positive segments:\\t#{continuousPositiveSegments}\"\n puts \"Continuous neg/zero segments:\\t#{continuousNegativeAndZeroSegments}\\n\\n\"\n \n \n \n ###### EVALUATE FOR BEST SUM #####\n positiveSegStartingIndices = continuousPositiveSegments.keys\n \n if positiveSegStartingIndices.length == 0\n # return the least negative single element then\n return nums.max()\n \n elsif positiveSegStartingIndices.length == 1\n # only 1 single patch of continuousPositive Segments exist\n return continuousPositiveSegments.values[0]\n \n else\n # evaluate which patches add up for highest number\n # we want to start from each positive segment\n curr_winner = 0\n \n positiveSegStartingIndices.each do |i|\n puts \"starting at #{i}\"\n curr_contender = 0\n \n if continuousPositiveSegments[i]\n curr_contender += continuousPositiveSegments[i]\n elsif continuousNegativeAndZeroSegments[i]\n curr_contender += continuousNegativeAndZeroSegments[i]\n else\n # this index is in not the start of a pos or neg segment\n end\n \n if curr_contender > curr_winner\n curr_winner = curr_contender\n puts \"new winner! #{curr_contender}\"\n end\n \n j = i + 1\n while j < nums.length \n if continuousPositiveSegments[j]\n curr_contender += continuousPositiveSegments[j]\n elsif continuousNegativeAndZeroSegments[j]\n curr_contender += continuousNegativeAndZeroSegments[j]\n else\n # this index is in not the start of a pos or neg segment\n end\n \n if curr_contender > curr_winner\n curr_winner = curr_contender\n puts \"\\tnew winner of #{curr_contender}! From index #{i} to end of segment starting with index #{j}\"\n end\n j += 1\n end\n end\n \n puts \"WINNER!!! #{curr_winner}\"\n return curr_winner\n end\nend", "def process_solutions\n raise NotImplementedError, 'You must implement this'\n end", "def solution(a)\r\n # write your code in Ruby 2.2\r\n #trangular\r\n # a[0] = 10\r\n # a[2] = 5\r\n # a[4] = 8\r\n # 10 + 5 > 8\r\n # 5 + 8 > 10\r\n #8 + 10 > 5\r\n \r\n \r\n l=a.count\r\n \r\n i=0\r\n while(i<l) do\r\n j=i+1\r\n while(j<l) do\r\n k=j+1\r\n \r\n \r\n while(k<l) do\r\n if((a[i] + a[j] > a[k]) && (a[j] +a[k] > a[i]) && (a[k] + a[i] >a[j]))\r\n return 1\r\n end\r\n k+=1 \r\n end \r\n \r\n j+=1 \r\n end\r\n i+=1\r\n end\r\n \r\n return 0\r\n \r\nend", "def find_solutions_dp\n solutions = Array.new(@amount+1).map {|i| 0 }\n solutions[0] = 1\n\n @coins.each do |coin|\n for i in coin..@amount\n solutions[i] = solutions[i] + solutions[i-coin]\n end\n end\n\n solutions[@amount]\n end", "def arrayManipulation(n, queries)\n arr = Array.new(n + 2, 0)\n\n queries.each do |a, b, k|\n arr[a] += k\n arr[b + 1] -= k\n end\n\n max_sum = 0\n sum = 0\n arr.filter { |diff| diff != 0 }.each do |diff|\n sum += diff\n max_sum = [max_sum, sum].max\n end\n\n max_sum\nend", "def calculate_optimal_k\n k=0\n @k_optimal = Array.new(@size)\n (3..@size).each{|n|\n k+=1 while(cost(n,k)<cost(n,k+1))\n @k_optimal[n]=k\n }\n end", "def main()\n rules = { # a/bc/bcd/bcdd/bcda/bcdbc/bcbc/cbc/aa/\n 'abcd' => [''],\n 'a' => ['bc'],\n 'bc' => ['bcd', 'c'],\n 'd' => ['a', 'db'],\n 'db' => ['b'],\n 'cbc' => ['ab'],\n '...' => ['a']\n }\n rows= [\n 'bd',\n ]\n moves = 10\n width = 7\n solver = Solver.new(rules, moves, width)\n game_data = GameState.new(rules, rows[0], width)\n solution = solver.find_solution(game_data)\n\n if !solution.nil?\n solution.each do |move|\n puts(move.to_s)\n end\n else\n puts 'No solution found'\n end\nend", "def problem_77\n primes = Primes.upto(120)\n\n # num is the value we want and\n # off is the index in primes to use next\n hits = 0\n solve = lambda do |num, off|\n return 1 if num == 0\n return 0 if num == 1\n ret = 0\n p = primes[off]\n ret += 1 if num % p == 0 # Add if a multiple\n ret += solve.call(num,off-1) if off > 0 \n n = num / p\n if n > 0 # Do each multiple\n 1.upto(n) do |i|\n left = num - i*p\n ret += solve.call(left,off-1) if off > 0 && left > 1\n end\n end\n ret\n end\n\n #(2..100).each do |num|\n num = 0\n (2..100).each do |num|\n off = primes.index {|i| i > num } - 1\n hits = solve.call(num,off)\n puts \"#{num} => #{hits}\"\n return num if hits >= 5000\n end\nend", "def calculate_solution\n Solve.it!(\n GraphBuilder.graph_from_cache(@cache, @options),\n resolver.constraints\n )\n end", "def solve\n @sorted_things.each do |thing|\n break if (config_weight + thing.weight) > @instance.weight_capacity\n @config[thing.index] = 1\n end\n @best_price = config_price\n @best_config = @config.dup\n end", "def solve\n max = nil\n\n # Start with the longest possible and work down. \n 9.downto( 1 ) do |i|\n max = Array.new( i ) {|j| 1 + j}.permutation.to_a.map! {|j| j.join.to_i}.select {|j| j.prime? }.max\n break if max\n end\n \n max\n end" ]
[ "0.6096856", "0.5896055", "0.5887088", "0.58372724", "0.5804033", "0.57174605", "0.5714055", "0.5639955", "0.55930513", "0.5584535", "0.5579958", "0.5576427", "0.5576427", "0.5576427", "0.5576427", "0.5576427", "0.5548676", "0.5542368", "0.5540436", "0.55289817", "0.55137277", "0.55137277", "0.55137277", "0.55137277", "0.55023706", "0.5481519", "0.5467906", "0.54624635", "0.54548633", "0.5446861", "0.54425544", "0.5441055", "0.5438696", "0.54365045", "0.5425251", "0.5424154", "0.5400687", "0.539766", "0.5356699", "0.5352115", "0.5335173", "0.53261125", "0.5323706", "0.5317226", "0.53119916", "0.53035927", "0.5299151", "0.5293986", "0.5292222", "0.5292076", "0.5291862", "0.5291685", "0.5290303", "0.5279395", "0.52706856", "0.52630097", "0.523987", "0.5233892", "0.52248114", "0.5222809", "0.5217792", "0.5215105", "0.5193185", "0.5190655", "0.51775104", "0.51772225", "0.51746875", "0.51741046", "0.5173118", "0.51701736", "0.51637816", "0.51563305", "0.51556915", "0.51516503", "0.5147505", "0.5126541", "0.51208586", "0.51136184", "0.5112852", "0.5108683", "0.5105103", "0.51048756", "0.5102963", "0.5098252", "0.5091298", "0.50904197", "0.5089451", "0.5087736", "0.50763106", "0.5075633", "0.50662786", "0.5059981", "0.50576633", "0.5055144", "0.50498575", "0.5047772", "0.50436145", "0.50428814", "0.5040046", "0.5035373" ]
0.5179445
64
find the maximum sub array in an array
def max_sub_array (0...self.size).inject([self.first]) do |max_sub,i| (i...self.size).each do |j| if max_sub.int_sum < self[i..j].int_sum max_sub = self[i..j] end end max_sub end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def maximum_sub_array2(arr)\n current = []\n max_sum = cur_sum = 0\n max = (0...arr.size).inject([]) do |max, i|\n current << arr[i]\n cur_sum += arr[i]\n if cur_sum > max_sum\n max << i\n max_sum = cur_sum\n end\n max\n end\n arr[max[0]..max[-1]]\nend", "def maxSubarray(arr)\n [_max_subarray(arr), _max_subsequence(arr)]\nend", "def maxSubarray(arr)\n [_max_subarray(arr, 0, arr.length - 1), _max_subsequence(arr)]\nend", "def max_sub_array(array)\n max_sum = current_val = array[0]\n array.each_with_index do |num, i|\n if (i > 0)\n sum = current_val + num\n if (sum > num)\n current_val = sum\n else\n current_val = num\n end\n if current_val > max_sum\n max_sum = current_val\n end\n end\n end\n max_sum\nend", "def max_sub_array(nums)\n max = -Float::INFINITY\n\n (0...nums.length) do |left_i|\n sub\n\n end", "def max_sub_array(arr)\n current_sum = arr[0]\n max_sum = current_sum\n\n arr[1..-1].each do |num|\n current_sum = [num, current_sum + num].max\n max_sum = [max_sum, current_sum].max\n end\n\n return max_sum\nend", "def maxSubArray(a)\n return nil if a.empty?\n curr_sum = a[0]\n max_sum = a[0]\n (1...a.length).each do |i| \n if curr_sum <= 0\n curr_sum = a[i]\n else\n curr_sum += a[i]\n end\n max_sum = curr_sum if max_sum < curr_sum\n end\n max_sum\nend", "def max_sub_array(nums)\n return if nums.empty?\n\n max_so_far = Array.new(nums.length)\n max_so_far[0] = nums[0]\n\n (1...nums.length).each do |i|\n max_so_far[i] = [nums[i], nums[i] + max_so_far[i-1]].max\n end\n\n return max_so_far.max\nend", "def find_max(array)\n max = 0\n array.each do |subarray|\n subarray.each_cons(4) do |chunk|\n product = quad_product(chunk)\n max = product if product > max\n end\n end\n max\n end", "def sub_max(array)\n so_far = array[0]\n max_point = array[0] # [0] -2 and [1] 1 sum -1, number 1\n\n array.each do |number|\n # to find the max between the two values:\n max_point = max((number + max_point), number)\n so_far = max(max_point, so_far)\n end\n\n return so_far\nend", "def max(array)\n if array.length == 2\n array[0] > array[1] ? array[0] : array[1]\n else\n sub_max = max(array[1..-1])\n array[0] > sub_max ? array[0] : sub_max\n end\nend", "def max_subarray_v2(numbers)\n max = numbers[0].to_i\n max_current = numbers[0].to_i\n\n for i in 1..numbers.length\n max_current = [numbers[i].to_i, max_current + numbers[i].to_i].max\n max = [max, max_current].max\n end\n\n max\n end", "def max_sub(a)\na[(0...(n=a.size)).inject([]){|r,i|(i...n).inject(r){|r,j|r<<(i..j)}}.sort_by{|r|a[r].inject{|i,j|i+j}}[-1]]\nend", "def max_sub_array(numbers)\n max = numbers[0]\n\n (1...numbers.size).each do |idx|\n current_sum = numbers[idx] + numbers[idx - 1]\n numbers[idx] = current_sum if current_sum > numbers[idx]\n max = numbers[idx] if numbers[idx] > max\n end\n\n max\nend", "def max_sub_array(nums)\n dp = [nums.first]\n max = dp[0]\n\n (1...nums.length).each do |i|\n prev_max = dp[i - 1] > 0 ? dp[i - 1] : 0\n dp[i] = nums[i] + prev_max\n max = [max, dp[i]].max\n end\n\n max\nend", "def maximum_value_contiguous_subsequence_dp(array)\n len = array.length\n result = [array[0]]\n\n for i in (1...len)\n result[i] = maximum(array[i], array[i] + result[-1])\n end\n\n result.max\nend", "def find_max_value (array)\n array.max # Add your solution here\nend", "def find_max_value(array)\n array.sort!\n return array[-1]\nend", "def maximum_value_contiguous_subsequence(array)\n len = array.length\n return array.max if all_negatives?(array)\n\n max = array[0]\n for i in (0...len)\n current_sum = 0\n for j in (i...len)\n current_sum += array[j]\n max = maximum(max, current_sum)\n end\n end\n max\nend", "def max_sub_array(nums)\n return 0 if nums.empty?\n return nums[0] if nums.size == 1\n dp = [0] * nums.size\n dp[0] = nums[0]\n max = dp[0]\n \n for i in 1...nums.size do\n dp[i] = nums[i] + (dp[i - 1] > 0 ? dp[i - 1] : 0)\n max = [max, dp[i]].max\n end\n max\nend", "def find_max_value(array)\n array.max \nend", "def max_subarray_sum(array)\n new_sum = max = array[0]\n (1...array.length).each do |i|\n new_sum = find_max(new_sum + array[i], array[i])\n max = find_max(max, new_sum)\n end\n return max\nend", "def find_max_value(array)\n array.max { |item|\n return array.max\n }\n \nend", "def max_sub_array(nums)\n return 0 if nums.nil? \n return nil if nums.empty?\n \n max_so_far = nums[0]\n max_for_sub_array = 0\n\n nums.each do |num|\n max_for_sub_array = max_for_sub_array + num\n if num > max_for_sub_array\n max_for_sub_array = num\n end\n if max_for_sub_array > max_so_far\n max_so_far = max_for_sub_array\n end\n end\n return max_so_far\n\nend", "def max_sub_array2(nums)\n ans = nums[0]\n\n (1..nums.size).each do |size|\n nums.each_cons(size) do |a|\n ans = [ans, a.sum].max\n end\n end\n\n ans\nend", "def max_sum_of_subarray(arr)\n current_max = global_max = arr.first\n array_size = arr.size\n\n (1..(array_size-1)).each do |i|\n current_max = [arr[i], current_max + arr[i]].max\n\n if current_max > global_max\n global_max = current_max\n end\n end\n\n global_max\nend", "def solution(a)\n # first and last positions are excluded for the double slice\n a[0] = 0\n a[-1] = 0\n\n #get the sum of maximum subarray, from the left to the right direction\n max_from_left = []\n max_ending = 0\n a.each do |v|\n max_ending = [0, max_ending + v].max\n max_from_left << max_ending\n end\n \n #get the sum of maximum subarray, from the right to the left direction\n max_from_right = []\n max_ending = 0\n a.reverse.each do |v|\n max_ending = [0, max_ending + v].max\n max_from_right << max_ending\n end\n max_from_right.reverse!\n\n # when comparing both directions excludes the i index and take the maximum double slice value.\n n = a.size\n max_double_slice = 0\n for i in 1..n-2\n max_double_slice = [max_double_slice, max_from_left[i - 1] + max_from_right[i + 1]].max\n end\n\n max_double_slice\n\nend", "def find_max_subarray(arr, low=0, high=arr.length-1)\n low ||= 0\n high ||= arr.length-1\n\n return [low, high, arr[low]] if low == high\n mid = (low+high)/2\n left_subarray = find_max_subarray(arr, low, mid)\n right_subarray = find_max_subarray(arr, mid+1, high)\n cross_subarray = find_max_crossing_subarray(arr, low, mid, high)\n\n return left_subarray if left_subarray[2] > right_subarray[2] && left_subarray[2] > cross_subarray[2]\n return right_subarray if right_subarray[2] > left_subarray[2] && right_subarray[2] > cross_subarray[2]\n return cross_subarray\nend", "def find_max_value(array)\n sorted_array = array.sort\n sorted_array.last\nend", "def max_sub_array(nums)\n\tmax = count = nums.shift\n\n\tnums.each do |num|\n\t\tcount = num > count + num ? num : count + num\n\t\tmax = count if count > max\n\tend\n\n\tmax\nend", "def find_max_value(array)\n return array.max\nend", "def max_sub_array(nums)\n max_sum = nums[0]\n\n for i in (0...nums.length) do\n sum_so_far = 0\n for j in (i...nums.length) do\n sum_so_far += nums[j]\n max_sum = [sum_so_far, max_sum].max\n end\n end\n\n return max_sum\nend", "def maxSubArraySum(a)\n maxint =(2**(0.size * 8 -2) -1)\n msf = -maxint - 1\n max_end = 0\n \n for i in (0..a.length-1)\n max_end = max_end + a[i] \n if (msf < max_end)\n msf = max_end\n end\n \n if (max_end < 0) \n max_end = 0 \n end\n end\n return msf\nend", "def cusmax(array)\r\n return array.sort.max\r\nend", "def max_sub_array(nums)\n return 0 if nums == nil\n return nil if nums.empty?\n \n max_by_here = nums[0]\n max_so_far = nums[0]\n \n nums.each_with_index do |num, index|\n unless index == 0\n if max_so_far < 0\n if num > max_so_far\n max_so_far = num\n end\n else\n max_by_here += num\n \n if max_by_here < 0\n max_by_here = 0\n elsif max_by_here > max_so_far\n max_so_far = max_by_here\n end\n end\n end\n end\n \n return max_so_far\nend", "def maximum_subarray(arr)\n max_arr = []\n max_sum = 0\n curr = []\n curr_sum = 0\n i = 0\n while i < arr.size\n if curr_sum < 0\n curr_sum = 0\n curr = []\n end\n \n curr << arr[i]\n curr_sum += arr[i]\n\n if curr_sum > max_sum \n max_sum = curr_sum\n first = curr.first\n last = curr.last\n max_arr = curr.dup\n p max_arr\n end\n i += 1\n end\n \n max_arr\nend", "def max_sub_array(nums)\n current_sum = nil\n max_sum = nil\n \n nums.each do |n|\n if current_sum.nil?\n current_sum = n\n elsif current_sum + n < n\n current_sum = n\n else\n current_sum = current_sum + n\n end\n max_sum = current_sum if max_sum.nil? || current_sum > max_sum\n end\n max_sum\nend", "def max_sub_array3(nums)\n max_sum = nums[0]\n\n (1...nums.size).each do |i|\n # nums[i] 记录到该位置时,可能获得的最大和\n # 如果前面的一个是正的,那么就加上\n # 如果前面的是付的,那么就保留当前值\n nums[i] += nums[i - 1] if nums[i - 1] > 0\n max_sum = [nums[i], max_sum].max\n end\n p nums\n p nums.max\n max_sum\nend", "def find_maximum_subarray(arr, low, high)\n if high == low or arr.length == 0\n return low, high, arr[low]\n else\n mid = (low + high)/2\n left_low, left_high, left_sum =\n find_maximum_subarray(arr, low, mid)\n right_low, right_high, right_sum =\n find_maximum_subarray(arr, mid + 1, high)\n cross_low, cross_high, cross_sum =\n find_maximum_crossing_subarray(arr, low, mid, high)\n if left_sum >= right_sum and left_sum >= cross_sum\n return left_low, left_high, left_sum\n elsif right_sum >= left_sum and right_sum >= cross_sum\n return right_low, right_high, right_sum\n else\n return cross_low, cross_high, cross_sum\n end\n end\n end", "def largest_contiguous_subsum1(array)\r\n subset = []\r\n array.each_index do |i| # make subets, store into 'subset' array\r\n (i...array.length).each do |j| # o(n^2)\r\n subset << array[i..j] # o(n^3) cause slicing\r\n end\r\n end\r\n\r\n subset_sum = []\r\n subset.each do |ele|\r\n subset_sum << ele.sum\r\n end\r\n subset_sum.max\r\nend", "def largest_contiguous_subsum(array)\n sub_arrays = []\n (0...array.length).each do |i|\n (0...array.length).each do |x|\n sub_arrays << array[i..x] unless array[i..x].empty?\n end\n end\n p sub_arrays.length\n max_array = sub_arrays.max_by { |sub| sub.sum }\n max_array.sum\n\nend", "def my_max(array)\n\t\n\tarray.max\n\nend", "def maximum_value_contiguous_subsequence_3(array)\n len = array.length\n max, current_sum = array[0], array[0]\n\n for i in (1...len)\n current_sum = maximum(array[i], array[i] + current_sum)\n max = maximum(max, current_sum)\n end\n max\nend", "def max_subarray arr\n neg = []\n pos = []\n \n arr.each do |x|\n x < 0 ? neg << x : pos << x\n end\n \n sum = pos.reduce(:+)\n final = []\n \n if pos.empty?\n final << neg.max\n final << neg.max \n elsif neg.empty? || neg.size == 1\n final << sum\n final << sum\n else\n final << sum + neg.max\n final << sum\n end \n \n puts final.join(' ')\nend", "def largest(array)\nend", "def largest_contiguous_subsum(array)\r\n max = array.first \r\n current_sum = 0\r\n array.each do |ele|\r\n current_sum += ele\r\n max = current_sum if current_sum > max\r\n current_sum = 0 if current_sum < 0\r\n end\r\n max\r\nend", "def largest_contiguous_subsum(array)\n sub_arrs = []\n array.each_index do |ind1|\n array[ind1..-1].each_index do |ind2|\n sub_arrs.push(array[ind1..ind2+ind1])\n end\n end\n max_sum = sub_arrs.first.sum\n sub_arrs.each {|sub| max_sum = sub.sum if sub.sum >= max_sum }\n return max_sum\nend", "def max_subarray(numbers)\n max_current = 0\n max_end = 0\n\n for i in 0..numbers.length\n max_end += numbers[i].to_i\n\n if max_end < 0\n max_end = 0\n end\n\n if max_current < max_end\n max_current = max_end\n end\n end\n\n max_current\n end", "def arr_max (arr)\n arr.sort! { |x,y| y <=> x}\n arr.first()\nend", "def max\n return -1 if @count == 0\n return @array[0]\n end", "def largest_contiguous_subsum(arr)\n\n\nend", "def lis(array)\n helper = Array.new(array.length, 1)\n (1..array.length - 1).each do |array_index|\n (0..array_index).each do |inner_value|\n if array[inner_value] < array[array_index]\n helper[array_index] = [helper[inner_value] + 1, helper[array_index]].max\n end\n end\n end\n helper.max\nend", "def find_max_value(array)\n \n (find_max_value(scale)).to eq(5)\n (find_max_value(scale_2)).to eq(6)\n (find_max_value(hill)).to eq(5)\n (find_max_value(valley)).to eq(5)\n (find_max_value(zig_zag)).to eq(1000)\n end", "def find_max_value(array)\nx = 0 \n array.length.times { |index|\n if array[index] > x \n x = array[index]\n end\n }\n x\n end", "def max arr\n\tarr.max\nend", "def optimized_largest_subsum(arr)\n max = arr.first\n sum = arr.first \n arr.shift\n arr.each do |el|\n sum += el\n if el > max && el > sum \n max = el \n sum = el \n elsif sum > max\n max = sum\n end \n end \n max\nend", "def max_sub_arr(arr)\n max_so_far = 0\n max_ending_here = 0\n start_i = nil\n end_i = nil\n arr.each_with_index do |el, i|\n if max_ending_here == 0 && max_ending_here + el > 0\n start_i = i\n end\n\n max_ending_here = max_ending_here + el\n if max_ending_here < 0\n max_ending_here = 0\n end\n\n if max_so_far < max_ending_here\n max_so_far = max_ending_here\n end_i = i\n end\n end\n\n return [start_i, end_i], max_so_far\nend", "def find_max(array)\n max_difference = 0\n for i in 0..array.length - 1 do\n for j in i + 1..array.length - 1 do\n difference = (array[i] - array[j]).abs\n if difference > max_difference\n max_difference = difference\n end\n end\n end\n max_difference\n end", "def maximum(arr)\n\t# for empty input\n\treturn nil if arr.nil? or arr.length == 0\n\tmax = arr[0]\n\tarr.each do |elem|\n\t\tmax = elem if elem > max\n\tend\n\tmax\nend", "def find_max_value(array)\n max_element = 0\n array.length.times { |index|\n if max_element < array[index]\n max_element = array[index]\n end\n }\n return max_element\nend", "def largest_sub_sum1 #0(n^2)\n result = []\n (0...self.length).each do |idx1|\n (idx1...self.length).each do |idx2|\n subarray_result = self[idx1..idx2]\n result << subarray_result\n end\n end\n\n largest_sum = result[0][0]\n result.each do |arr|\n largest_sum = arr.sum if arr.sum > largest_sum\n end\n largest_sum\n end", "def largest_contiguous_subsum_good(arr) \n last_max = arr.first\n current_max = 0\n arr.each do |num|\n temp_sum = current_max + num\n if temp_sum < 0\n last_max = current_max if temp_sum > last_max\n else\n if temp_sum > last_max\n last_max = temp_sum\n end\n end\n if num > temp_sum\n current_max = num\n else\n current_max = temp_sum\n end\n end\n last_max\nend", "def find_max_value(array)\n x = 0\n array.length.times { |index| x = array[index] if array[index] > x }\n x\nend", "def max \n if max_element.kind_of? Array\n max_element.first\n else\n max_element\n end\n end", "def custom_max(array)\n array.max\nend", "def largest_contiguous_subsum(array)\n sub_arrays = []\n i = 1\n until i == array.length + 1\n array.each_cons(i) do |sub|\n sub_arrays << sub\n end\n i += 1\n end\n sub_arrays.map {|sub| sub.reduce(:+)}.max\nend", "def largest_sub_sum(array) #technically I believe this is a n^3 operation since you are first doing a n^2 with the nested loop and then multiplying by n at the end (the map/ another loop) -- hence the n^3\n answer_subs = []\n\n (0...array.length).each do |i|\n ((i + 1)...array.length).each do |j|\n answer_subs << [array[i]]\n answer_subs << [array[j]]\n answer_subs << array[i..j] #should have every combo in subs now\n end\n end\n answer_subs.sort.uniq.map{|sub| sub.reduce(:+)}.max\n # .map {|sub| sub.reduce(:+)}.max # should 1) reduce(:+)/ add up every element in each array. The map returns the array and then max returns the max number\nend", "def largest_contiguous_subsum(arr)\r\n # sub_arr = []\r\n # (0...arr.length).each do |idx|\r\n # (idx...arr.length).each do |idx_2| \r\n # sub_arr << arr[idx..idx_2]\r\n # end\r\n # end\r\n # p sub_arr.length \r\n # sub_arr.map {|sub| sub.sum }.max\r\n max = arr.first #8\r\n curr = arr.first #8\r\n arr.drop(1).each do |ele| \r\n curr = 0 if curr < 0\r\n curr += ele\r\n max = curr if curr > max\r\n end\r\n max\r\nend", "def largest_sub_sum(array)\n subsets = []\n i = 0\n while i < array.length\n j = i\n while j < array.length\n subsets << array[i..j]\n j += 1\n end\n i += 1\n end\n result = nil\n subsets.map {|subset| subset.inject(:+)}.each do |sum|\n result = sum if result.nil? || result < sum\n end\n result\nend", "def max_value(our_array)\n\treference = -100000\n\tour_array.each do |number|\n\t\tif number > reference\n\t\t\treference = number\n\t\tend\n\tend\n\treference\nend", "def largest_cont_subsum_slow(list) # n = list.length\n subarrs = find_subarrays(list) # n^2 runtime\n largest = subarrs[0].sum\n \n subarrs.each do |subarr| # n^2 length subarrs\n largest = [largest, subarr.sum].max # constant\n end\n\n return largest\n # n^2 overall\nend", "def largest_contiguous_subsum(arr)\n max = arr.first\n arr.each_index do |idx1|\n (idx1+1..arr.length).each do |idx2|\n sub_arr = arr[idx1...idx2]\n sum = sub_arr.reduce(:+)\n max = sum if max < sum \n end\n\n end\n max\nend", "def max_submatrix(matrix)\n n = matrix.length\n max_value = matrix[0][0]\n # i and j are the initial index, k and l are the lengths of the matrix\n for i in 0..(n - 1)\n for j in 0..(n - 1)\n for k in 0..(n - 1 - i)\n for l in 0..(n - 1 - j)\n sum = sum_submatrix(matrix[i..(i+k)][j..(j+l)])\n max_value = sum if sum > max_value\n end\n end\n end\n end\n\n max_value\nend", "def find_max_value(array)\n x = array[0]\narray.length.times {|index|\n if array[index] > x\n x = array[index]\n end\n\n}\nx\nend", "def largest_contiguous_subsum2(arr)\n max = arr[0]\n current = arr[0]\n arr.drop(1).each do |num|\n current += num\n max = current if current > max\n current = 0 if current < 0\n end\n max\nend", "def max(arr)\n return nil if arr.empty?\n result = arr[0]\n arr[1...-1].each do |item|\n if item > result\n result = item\n end\n end\n return result\nend", "def maximum_sum_subarray(nums)\n highest_seen = nums[0]\n lowest_seen = nums[0]\n highest_curr = nums[0]\n lowest_curr = nums[0]\n\n nums[1..-1].each do |num|\n temp = highest_curr\n highest_curr = [num, highest_curr + num, lowest_curr + num].max\n lowest_curr = [num, temp + num, lowest_curr + num].min\n\n highest_seen = [highest_seen, highest_curr].max\n lowest_seen = [lowest_seen, lowest_curr].max\n end\n highest_seen\nend", "def max_slice(a)\n n = a.length\n k1 = Array.new(n, 0)\n k2 = Array.new(n, 0)\n\n (1..(n-1)).each {|i| k1[i] = [k1[i-1] + a[i], 0].max }\n\n i = n - 2\n while i > 0 do\n k2[i] = [k2[i+1]+a[i], 0].max\n i -= 1\n end\n\n max_val = 0\n (1..(n-2)).each do |i|\n max_val = [max_val, k1[i-1] + k2[i + 1]].max\n end\n\n return max_val\nend", "def maximum(arr, &prc)\n\n return nil if arr.length == 0\n max = 0\n max_idx = nil\n arr.each_with_index do |ele, idx|\n if prc.call(ele) >= max\n max = prc.call(ele)\n max_idx = idx\n end\n end\n arr[max_idx]\nend", "def maxValuePosition(arr)\n return max_value_position_helper(arr, 0, max_index = 0)\nend", "def custon_max(arr)\n return nil if arr.empty?\n\n max = arr[0]\n arr.each do |value|\n max = value if value > max\n end\n max\nend", "def sub_sum_improved(array)\n max = array[0]\n current_sum = array[0]\n i = 0\n (1...array.length).each do |i|\n max = [array[i], array[i] + max].max\n current_sum = [current_sum, max].max\n end\n current_sum\n end", "def most_a(arr)\n arr\nend", "def largest_difference_divide_and_conquer(array)\n # To lower space complexity, I'll call \"array[0..array.length / 2]\" etc.\n # manually each time, but I'd rather store the subarrays as their own variable\n # to make the code cleaner\n max_difference_first = largest_difference_nested_iteration(array[0..(array.length / 2)])\n max_difference_second = largest_difference_nested_iteration(array[(array.length / 2 + 1)..(array.length - 1)])\n\n max_difference = [max_difference_first, max_difference_second].max\n [max_difference, (array[(array.length / 2 + 1)..(array.length - 1)].max - array[0..(array.length / 2)].min)].max\nend", "def find_max_value(array)\n i = 0 \n max = 0 \n \n while i < array.length do\n if max < array[i]\n max = array[i]\n end \n i += 1 \nend \n return max\nend", "def new_max array_of_elements\n\ti = 0\n\tlargest = array_of_elements[0]\n\twhile i < array_of_elements.length do\n\t\tif array_of_elements[i] > largest\n\t\t\tlargest = array_of_elements[i]\n\t\tend\n\t\ti += 1\n\tend\n\tlargest\nend", "def part6(in_array)\n themax = in_array[2]\n in_array.each do |item|\n if item > themax\n themax = item\n end\n end\n themax\nend", "def exp array\n max_spread = highest_to_low_spread array\n sub_arr = array.dup\n while sub_arr.length > 1\n high_index = index_of_highest sub_arr\n low_index = index_of_lowest array\n local_spread = first_last_length_spread array[high_index..low_index]\n max_spread = [max_spread, local_spread].max\n sub_arr = sub_arr[0...high_index]\n end\n max_spread\nend", "def largest_contiguous_subsum_1(arr)\n largest = []\n (0...arr.length).each do |i|\n (i...arr.length).each do |j|\n largest << arr[i..j]\n end\n end\n sums = largest.map do |sub_array|\n sub_array.sum\n end\n sums.max\nend", "def max(arr)\n greatest = array[0]\n arr.each do |num|\n if num > greatest\n greatest = num\n end\n end\n greatest\nend", "def largest_contiguous_subsum(arr)\n max = arr[0]\n current = 0\n (0...arr.length).each do |i|\n current += arr[i]\n max = current if current > max\n current = 0 if current < 0\n end\n max\nend", "def max\n\t\tmax = @m[0][0]\n\t\tfor i in 0...@fi \n\t\t\tfor k in 0...@co\n\t\t\t\tif (@m[i][k] > max) then\n\t\t\t\t\tmax=@m[i][k] \n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tmax\n\tend", "def find_max(array)\n max = array.sort.reverse\n puts max[0]\nend", "def largest_contiguous_subsum_2(arr)\n sum = 0\n max = 0\n arr.each do |num|\n sum += num\n if sum > 0\n max = sum if sum > max\n else\n sum = 0\n end\n end\n max\nend", "def max_slice_sum(a)\n n = a.length - 1\n result = nil\n\n (0..n).each do |p|\n sum = 0\n\n (p..n).each do |q|\n sum += a[q]\n result = result.nil? ? sum : [result, sum].max\n end\n end\n result\nend", "def largest_contiguous_subsum2(array)\r\n largest = array[0]\r\n current_sum = array[0]\r\n\r\n (1...array.length).each do |i|\r\n current_sum = 0 if current_sum < 0\r\n num = array[i]\r\n current_sum += num\r\n if current_sum > largest\r\n largest = current_sum\r\n end\r\n end\r\n\r\n largest\r\nend", "def largest_contiguous_subsum(arr)\n subsets = [] \n\n (0...arr.length).each do |i| \n (i...arr.length).each do |j| \n subsets << arr[i..j]\n end \n end \n \n subsets.map {|sub| sub.sum}.max \nend", "def maximum(arr)\n bubble_sort(arr).last\nend", "def max_by(array)\n return nil if array.empty?\n result = []\n array.each { |num| result << yield(num) }\n array.fetch(result.index(result.max))\nend", "def max_sequence(arr)\r\n return 0 if arr.all? { |el| el < 0 }\r\n return arr.sum if arr.all? { |el| el > 0 }\r\n return 0 if arr.empty?\r\n \r\n sub_arrs = []\r\n (0...arr.size).each do |start_index|\r\n # p \"start #{start_index}\"\r\n (1..arr.size - start_index).each do |length|\r\n # p \"length #{length}\"\r\n sub_arrs << arr[start_index, length]\r\n end\r\n end\r\n sub_arrs.map do |sub_arr|\r\n sub_arr.sum\r\n end.max\r\nend" ]
[ "0.82740986", "0.82339823", "0.81471395", "0.80629534", "0.7910162", "0.7902042", "0.78675115", "0.7766517", "0.7761502", "0.7736341", "0.7718618", "0.77082103", "0.77059853", "0.76874137", "0.7681162", "0.76617724", "0.7643433", "0.76412463", "0.76098824", "0.7598411", "0.75760514", "0.7529466", "0.75226", "0.7522032", "0.75130856", "0.7510427", "0.7504788", "0.74979347", "0.7485618", "0.747762", "0.7465129", "0.7435469", "0.7418281", "0.7410639", "0.73953253", "0.73875535", "0.7366785", "0.73655885", "0.7345673", "0.73387325", "0.7330754", "0.7311326", "0.7310491", "0.730437", "0.7299702", "0.7284979", "0.72736233", "0.7261736", "0.7258313", "0.72573984", "0.724794", "0.72455496", "0.72315", "0.72119117", "0.72057515", "0.7200134", "0.7175635", "0.71719027", "0.71672827", "0.71637857", "0.71526515", "0.71497226", "0.71234065", "0.7107169", "0.71062666", "0.7104394", "0.7080735", "0.7067881", "0.7067739", "0.70649636", "0.7060392", "0.70373166", "0.7035405", "0.7031174", "0.7030868", "0.70264155", "0.7018202", "0.7014173", "0.7011716", "0.69989777", "0.6992476", "0.6991328", "0.6989892", "0.6989034", "0.69810563", "0.6977445", "0.69687647", "0.6967166", "0.695982", "0.69572574", "0.6950413", "0.6946633", "0.6933049", "0.6922638", "0.6920442", "0.6915743", "0.69097054", "0.6908753", "0.69079643", "0.69045776" ]
0.8459658
0
Subject can be set in your I18n file at config/locales/en.yml with the following lookup: en.subscriber_mailer.subscribe.subject
def subscribe(subscriber) @subscriber = subscriber mail to: subscriber.email, subject: "Subscription Confirmation: Welcome, #{subscriber.name}!" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def message_subject=(value)\n @message_subject = value\n end", "def subject (recipient)\n subject_variables = alert_variables[:subject].dup\n subject_variables.merge!(recipient_details(recipient))\n subject = \"#{I18n.t(\"#{recipient_type.to_s}_subject_#{alert_name.to_s}\", subject_variables)}\"\n subject\n end", "def subject\n @subject ||= Envelope::MessageTools.normalize(message.subject || '')\n end", "def subject\n self['subject'] || msg['subject']\n end", "def subject=(subject); @message_impl.setSubject subject; end", "def translate(mapping, key)\n I18n.t(:\"#{mapping.name}_subject\", :scope => [:devise, :mailer, key],\n :default => [:subject, key.to_s.humanize])\n end", "def subject=(string)\n set('Subject', string)\n end", "def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end", "def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end", "def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end", "def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end", "def translate(mapping, key)\n I18n.t(:\"notifications_subject\", :scope => [:eventifier, :notifications, key],\n :default => [:subject, key.to_s.humanize])\n end", "def subject() self.headers[\"Subject\"] || \"[NO SUBJECT]\" end", "def set_Subject(value)\n set_input(\"Subject\", value)\n end", "def set_Subject(value)\n set_input(\"Subject\", value)\n end", "def set_Subject(value)\n set_input(\"Subject\", value)\n end", "def set_Subject(value)\n set_input(\"Subject\", value)\n end", "def set_Subject(value)\n set_input(\"Subject\", value)\n end", "def set_Subject(value)\n set_input(\"Subject\", value)\n end", "def set_Subject(value)\n set_input(\"Subject\", value)\n end", "def set_Subject(value)\n set_input(\"Subject\", value)\n end", "def setSubject(subject)\n @fields['subject'] = subject\n self\n end", "def setSubject(subject)\n @fields['subject'] = subject\n self\n end", "def setSubject(subject)\n @fields['subject'] = subject\n self\n end", "def setSubject(subject)\n @fields['subject'] = subject\n self\n end", "def send_subscribe_email(subscriptor)\n @subscriptor = subscriptor\n @subject = \"Thanks for subscribe for our amazing app\"\n mail(to: @subscriptor.email, subject: @subject)\n # mail(to: , from: , subject:)\n end", "def message_subject\n return @message_subject\n end", "def subject\n @mail.subject\n end", "def subject=(value)\n @subject = value\n end", "def subject=(value)\n @subject = value\n end", "def subject=(value)\n @subject = value\n end", "def subject=(value)\n @subject = value\n end", "def subject=(value)\n @subject = value\n end", "def subject=(value)\n @subject = value\n end", "def subject_name=(value)\n @subject_name = value\n end", "def subject\n @options.fetch(:subject) { \"Invitation\" }\n end", "def subject\n @subject ||= \"(sans sujet)\"\n if @no_header_subject.nil?\n \"#{header_subject}#{@subject}\"\n else\n @subject\n end\n end", "def subject\n message.subject\n end", "def formatted_subject(text)\n name = PersonMailer.global_prefs.app_name\n label = name.blank? ? \"\" : \"[#{name}] \"\n \"#{label}#{text}\"\n end", "def set_subject(subject)\n\t\tend", "def subject_name\n return @subject_name\n end", "def subject_for(template, attributes = {})\n subject = EmailTemplate.subject_for(template)\n subject = I18n.t(\"email_templates.#{template}.default_subject\") if subject.nil?\n subject = \"No Subject\" if subject.nil?\n Florrick.convert(subject, add_default_attributes(attributes))\n end", "def subject; @message_impl.getSubject; end", "def mmm_test_subj_call\n ->(candidate) { I18n.t('email.test_monthly_mail_subject_initial_input', candidate_account_name: candidate.account_name) }\n end", "def subject\n self['subject']\n end", "def SetSubject(subject)\n\t\t#Subject of document\n\t\t@subject = subject\n\tend", "def subject_name\n subject_full_name\n end", "def subject_titles\n @subject_titles ||= sw_subject_titles\n end", "def email_subject(&blk)\n @email_subject_block = blk if blk\n @email_subject_block\n end", "def choose_subject(action, params = {})\n scope = [:mailers, mailer_name, action]\n key = :subject\n experiment_name = \"#{mailer_name}_mailer_#{action}_subject\".to_sym\n if experiment_active?(experiment_name)\n scope << key\n key = ab_test(experiment_name)\n end\n params.merge!(scope: scope)\n I18n.t(key, params)\n end", "def deliver_invitation(options = {})\n super(options.merge(subject: _('A Data Management Plan in %{application_name} has been shared with you') % {application_name: Rails.configuration.branding[:application][:name]}))\n end", "def subject(options = {})\n options = { :capitalize => true, :case => Grammar::Case::SUBJECT }.merge(options)\n pronoun_or_noun(@subject, @audience, options)\n end", "def subject\n title \n end", "def send_subscribe_mail\n\t UserMailer.request_invite(self.email).deliver\n\tend", "def newsletter_subscribe_alert(subscriptions, email)\n\t\t@subscriptions = subscriptions\n\t\t@email = email\n\t\tsendgrid_category 'Newsletter-only Subscription Alert'\n\t\tmail subject: \"New newsletter subscriber: #{email} \", to: ADMIN_EMAIL\n\tend", "def subject_alternative_name\n extensions[R509::Cert::Extensions::SubjectAlternativeName]\n end", "def get_subject\n\t\tend", "def subject_names\n @subject_names ||= sw_subject_names\n end", "def alerts_subscribe_alert(subscriptions, email, options={})\n\t\t@subscriptions = subscriptions\n\t\t@email = email\n\t\t@duebirth1 = options[:merge_vars].try :[], 'DUEBIRTH1'\n\t\t@newsletter_name = t 'views.newsletter.name'\n\t\tsendgrid_category \"#{@newsletter_name}-only Subscription Alert\"\n\t\tmail subject: \"#{@newsletter_name} sign-up from directory site\", to: ADMIN_EMAIL\n\tend", "def email_subject\n sponsor_name = @config.plan.sponsor_name\n display_date = @date.to_s()\n if @config.div_id.present?\n email_subject = \"Payroll report for #{sponsor_name} for division #{@config.division_name}: #{display_date}\"\n else\n email_subject = \"Payroll report for #{sponsor_name}: #{display_date}\"\n end\n return email_subject\n end", "def get_email_subject(email_type)\n email_subject = email_type\n case(email_type)\n when \"welcome\"\n email_subject = \"Welcome to Aspera Files\"\n when \"reset\"\n email_subject = \"Password Reset\"\n end\n return email_subject\n end", "def adhoc_test_subj_call\n ->(candidate) { I18n.t('email.test_adhoc_subject_initial_input', candidate_account_name: candidate.account_name) }\n end", "def get_subject_name\n subject_name = subject_header.text.sub! 'Subject:', ''\n subject_name = subject_name.strip!\n subject_name\n end", "def course_notification_item_details(course)\n t('notifications.subscribe_course')\n end", "def set_subject_and_message(form, subject, message)\n raise Impostor::MissingTemplateMethodError.new(\"set_subject_and_message must be implemented\")\n end", "def data_subject=(value)\n @data_subject = value\n end", "def subject\n @subject=EzCrypto::Name.new(@cert.subject) unless @subject\n @subject\n end", "def subject=(subject)\n self.subjects = [subject]\n end", "def notify_subscription_created(email)\n @email = email\n mail to: email, subject: 'Your subscription confirmation'\n end", "def send_signup_email(subscriber)\n @subscriber = subscriber\n mail( :to => 'ashortsleeves@gmail.com',\n :subject => 'Thanks for signing up for our amazing app' )\n end", "def compose_email\n @title = t 'conclusion_draft_review.send_by_email'\n end", "def subscribe\n\t\t@subject = Subject.find_by_name(params[:name])\n\t\t@customer = current_user.customer\n\t\t@customer.subjects << @subject\n\t\tflash[:success] = \"You have subscribed to #{@subject.name}.\"\n\t\tredirect_to root_url\n\tend", "def subscriber_notice_subscription_paid\n BrandMailer.subscriber_notice(\n brand: Brand.find_by(company_name: 'Brand Nine'),\n stage: 'subscription_paid'\n )\n end", "def email_subject(form)\n \"#{form.type_of_enquiry} - #{reference}\"\n end", "def set_subject\n @subject = Subject.find(params[:subject_id])\n end", "def subscribe_to_email(options = {})\n subscribed_to_email_at = options[:subscribed_to_email_at] || Time.current\n update(subscribing_to_email: true, subscribed_to_email_at: subscribed_to_email_at)\n end", "def subscriber_notice_subscription_renewal\n BrandMailer.subscriber_notice(\n brand: Brand.find_by(company_name: 'Brand Nine'),\n stage: 'subscription_renewal'\n )\n end", "def set_additional_subject\n @additional_subject = AdditionalSubject.find(params[:id])\n end", "def set_subject\n\t\t\t@subject = Subject.find(params[:id])\n\t\tend", "def email_confirmation(newsletter_subscriber)\n @newsletter_subscriber = newsletter_subscriber\n\n\tmail to: newsletter_subscriber.email, subject: \"Email Subscriber Confirm\", bcc: \"tom.meehan+EMAILSUB@minibarra.com, tomeehan+dizcberx12pd5lsiliz4@boards.trello.com\"\n end", "def headers\n {\n :subject => \"Subscription Request\"\n }\n end", "def subscribe(email, merge_vars={})\n # Raise an error to warn it isn't implemented.\n raise NotImplementedError.new\n end", "def newsletter_unsubscribe_alert(subscription, email)\n\t\t@list_name = User.human_attribute_name subscription\n\t\t@email = email\n\t\tsendgrid_category 'Newsletter Unsubscribe Alert'\n\t\tmail subject: \"User with email #{email} has unsubscribed from \\\"#{@list_name}\\\" newsletters\", to: ADMIN_EMAIL\n\tend", "def subject\n @subject\n end", "def subject\n @subject\n end", "def set_subject\n @subject = Subject.find(params[:id])\n end", "def set_subject\n @subject = Subject.find(params[:id])\n end", "def set_subject\n @subject = Subject.find(params[:id])\n end", "def set_subject\n @subject = Subject.find(params[:id])\n end", "def set_subject\n @subject = Subject.find(params[:id])\n end", "def set_subject\n @subject = Subject.find(params[:id])\n end", "def set_subject\n @subject = Subject.find(params[:id])\n end", "def set_subject\n @subject = Subject.find(params[:id])\n end", "def set_subject\n @subject = Subject.find(params[:id])\n end", "def set_subject\n @subject = Subject.find(params[:id])\n end", "def set_subject\n @subject = Subject.find(params[:id])\n end", "def set_subject\n @subject = Subject.find(params[:id])\n end", "def set_subject\n @subject = Subject.find(params[:id])\n end", "def set_subject\n @subject = Subject.find(params[:id])\n end", "def set_subject\n @subject = Subject.find(params[:id])\n end" ]
[ "0.7304906", "0.70163953", "0.68857616", "0.6840519", "0.682674", "0.65897477", "0.6577401", "0.65592337", "0.6558088", "0.6542849", "0.6540858", "0.6483301", "0.6449051", "0.6400153", "0.6400153", "0.6400153", "0.6400153", "0.6400153", "0.6400153", "0.6400153", "0.6400153", "0.6399545", "0.6399545", "0.6399545", "0.6399545", "0.636012", "0.63535756", "0.6338379", "0.6311888", "0.6311888", "0.6311888", "0.6311888", "0.6311888", "0.6311888", "0.6273663", "0.62465996", "0.6228478", "0.61873585", "0.6186125", "0.6157215", "0.6140142", "0.6126898", "0.6121299", "0.611813", "0.60982937", "0.6093445", "0.6084292", "0.6032253", "0.59492093", "0.59258986", "0.5903254", "0.5887323", "0.5859796", "0.5840688", "0.5833244", "0.5828712", "0.58149", "0.5814327", "0.58101326", "0.58067733", "0.58063847", "0.5765013", "0.575812", "0.57135195", "0.57116544", "0.57063556", "0.5695835", "0.5690852", "0.568513", "0.5671611", "0.5646104", "0.56456304", "0.56449145", "0.5609076", "0.560309", "0.555833", "0.55545807", "0.55464375", "0.5539733", "0.55362713", "0.5533837", "0.5533411", "0.5525685", "0.5524566", "0.5524566", "0.5505549", "0.5505549", "0.5505549", "0.5505549", "0.5505549", "0.5505549", "0.5505549", "0.5505549", "0.5505549", "0.5505549", "0.5505549", "0.5505549", "0.5505549", "0.5505549", "0.5505549" ]
0.6683858
5
Subject can be set in your I18n file at config/locales/en.yml with the following lookup: en.subscriber_mailer.unsubscribe.subject
def unsubscribe(subscriber) @subscriber = subscriber mail to: subscriber.email, subject: "Unsubscribed from ML@B" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def newsletter_unsubscribe_alert(subscription, email)\n\t\t@list_name = User.human_attribute_name subscription\n\t\t@email = email\n\t\tsendgrid_category 'Newsletter Unsubscribe Alert'\n\t\tmail subject: \"User with email #{email} has unsubscribed from \\\"#{@list_name}\\\" newsletters\", to: ADMIN_EMAIL\n\tend", "def message_subject=(value)\n @message_subject = value\n end", "def subject\n @subject ||= Envelope::MessageTools.normalize(message.subject || '')\n end", "def subject (recipient)\n subject_variables = alert_variables[:subject].dup\n subject_variables.merge!(recipient_details(recipient))\n subject = \"#{I18n.t(\"#{recipient_type.to_s}_subject_#{alert_name.to_s}\", subject_variables)}\"\n subject\n end", "def subject\n self['subject'] || msg['subject']\n end", "def unsubscribe\n\t\t@subject = Subject.find(params[:id])\n\t\t@customer = current_user.customer\n\t\t@customer.subjects.delete(@subject)\n\t\tflash[:success] = \"You have unsubscribed from #{@subject.name}.\"\n\t\tredirect_to root_url\n\tend", "def subject=(subject); @message_impl.setSubject subject; end", "def subject() self.headers[\"Subject\"] || \"[NO SUBJECT]\" end", "def newsletter_subscriber_delete_alert(subscription, email)\n\t\t@list_name = User.human_attribute_name subscription\n\t\t@email = email\n\t\tsendgrid_category 'Newsletter Subscriber Delete Alert'\n\t\tmail subject: \"User with email #{email} was deleted from \\\"#{@list_name}\\\" newsletter list\", to: ADMIN_EMAIL\n\tend", "def subject\n @mail.subject\n end", "def subject=(string)\n set('Subject', string)\n end", "def unsubscribe_to_email(options = {})\n unsubscribed_to_email_at = options[:unsubscribed_to_email_at] || Time.current\n update(subscribing_to_email: false, unsubscribed_to_email_at: unsubscribed_to_email_at)\n end", "def translate(mapping, key)\n I18n.t(:\"#{mapping.name}_subject\", :scope => [:devise, :mailer, key],\n :default => [:subject, key.to_s.humanize])\n end", "def message_subject\n return @message_subject\n end", "def confirm_unsubscribtion(user_profile, newsletter)\n @newsletter = newsletter\n @structure = newsletter.structure\n\n mail to: user_profile.email,\n subject: '',\n from: \"\\\"#{@newsletter.sender_name}\\\" <noreply@coursavenue.com>\"\n end", "def subscribe(subscriber)\n @subscriber = subscriber\n mail to: subscriber.email, subject: \"Subscription Confirmation: Welcome, #{subscriber.name}!\"\n end", "def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end", "def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end", "def subject\n message.subject\n end", "def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end", "def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end", "def translate(mapping, key)\n I18n.t(:\"notifications_subject\", :scope => [:eventifier, :notifications, key],\n :default => [:subject, key.to_s.humanize])\n end", "def unsubscrible\n NewsletterMailer.unsubscrible\n end", "def devalert(subject, body='', extra_to=[])\n recipients = CONTACT_EMAIL_ACCOUNTS\n if RAILS_ENV == 'production'\n extra_to = [extra_to] if extra_to.is_a?(String)\n recipients = [recipients].concat(extra_to).join(',')\n end\n @subject = subject\n @body = {:msg => body}\n @recipients = recipients\n @from = ALERT_EMAIL_DEV\n @sent_on = Time.now\n @headers = {}\n end", "def subject\n @subject ||= \"(sans sujet)\"\n if @no_header_subject.nil?\n \"#{header_subject}#{@subject}\"\n else\n @subject\n end\n end", "def subject\n @options.fetch(:subject) { \"Invitation\" }\n end", "def unsubscribe_url(address=nil)\n \"#{@mailgun.base_url}/#{@domain}/unsubscribes#{'/' + address if address}\"\n end", "def subject=(value)\n @subject = value\n end", "def subject=(value)\n @subject = value\n end", "def subject=(value)\n @subject = value\n end", "def subject=(value)\n @subject = value\n end", "def subject=(value)\n @subject = value\n end", "def subject=(value)\n @subject = value\n end", "def subject; @message_impl.getSubject; end", "def set_Subject(value)\n set_input(\"Subject\", value)\n end", "def set_Subject(value)\n set_input(\"Subject\", value)\n end", "def set_Subject(value)\n set_input(\"Subject\", value)\n end", "def set_Subject(value)\n set_input(\"Subject\", value)\n end", "def set_Subject(value)\n set_input(\"Subject\", value)\n end", "def set_Subject(value)\n set_input(\"Subject\", value)\n end", "def set_Subject(value)\n set_input(\"Subject\", value)\n end", "def set_Subject(value)\n set_input(\"Subject\", value)\n end", "def subject_name\n return @subject_name\n end", "def subject_name=(value)\n @subject_name = value\n end", "def subject_for(template, attributes = {})\n subject = EmailTemplate.subject_for(template)\n subject = I18n.t(\"email_templates.#{template}.default_subject\") if subject.nil?\n subject = \"No Subject\" if subject.nil?\n Florrick.convert(subject, add_default_attributes(attributes))\n end", "def setSubject(subject)\n @fields['subject'] = subject\n self\n end", "def setSubject(subject)\n @fields['subject'] = subject\n self\n end", "def setSubject(subject)\n @fields['subject'] = subject\n self\n end", "def setSubject(subject)\n @fields['subject'] = subject\n self\n end", "def send_subscribe_email(subscriptor)\n @subscriptor = subscriptor\n @subject = \"Thanks for subscribe for our amazing app\"\n mail(to: @subscriptor.email, subject: @subject)\n # mail(to: , from: , subject:)\n end", "def subject_name\n subject_full_name\n end", "def get_subject_name\n subject_name = subject_header.text.sub! 'Subject:', ''\n subject_name = subject_name.strip!\n subject_name\n end", "def subject_names\n @subject_names ||= sw_subject_names\n end", "def subject_titles\n @subject_titles ||= sw_subject_titles\n end", "def unsubscribe\n if request.post?\n @recipient = Recipient.find_by_email( params[:recipient][:email] )\n if (! @recipient)\n flash.now[:error] = _(\"Email address not found in the database!\")\n elsif Subscription.unsubscribe( @recipient, @project )\n render :text => @project.templets.find_by_name('PAGE_UNSUBSCRIBE_OK').render( @project ), :layout => true\n return\n end\n end\n render :text => @project.templets.find_by_name('PAGE_UNSUBSCRIBE').render( @project ), :layout => true\n end", "def subject\n self['subject']\n end", "def unsubscribe(user_name, email, plan)\n @user_name = user_name\n @plan = plan\n @email = email\n\n mail to: \"Susie Ye <susie@baserails.com>\", subject: \"#{user_name} unsubscribed from the #{plan} plan\"\n end", "def email_confirmation(newsletter_subscriber)\n @newsletter_subscriber = newsletter_subscriber\n\n\tmail to: newsletter_subscriber.email, subject: \"Email Subscriber Confirm\", bcc: \"tom.meehan+EMAILSUB@minibarra.com, tomeehan+dizcberx12pd5lsiliz4@boards.trello.com\"\n end", "def set_subject(subject)\n\t\tend", "def formatted_subject(text)\n name = PersonMailer.global_prefs.app_name\n label = name.blank? ? \"\" : \"[#{name}] \"\n \"#{label}#{text}\"\n end", "def subject(options = {})\n options = { :capitalize => true, :case => Grammar::Case::SUBJECT }.merge(options)\n pronoun_or_noun(@subject, @audience, options)\n end", "def SetSubject(subject)\n\t\t#Subject of document\n\t\t@subject = subject\n\tend", "def subid\n unsubscribe[:subid]\n end", "def deliver_invitation(options = {})\n super(options.merge(subject: _('A Data Management Plan in %{application_name} has been shared with you') % {application_name: Rails.configuration.branding[:application][:name]}))\n end", "def notify_subscription_created(email)\n @email = email\n mail to: email, subject: 'Your subscription confirmation'\n end", "def get_email_subject(email_type)\n email_subject = email_type\n case(email_type)\n when \"welcome\"\n email_subject = \"Welcome to Aspera Files\"\n when \"reset\"\n email_subject = \"Password Reset\"\n end\n return email_subject\n end", "def alerts_subscribe_alert(subscriptions, email, options={})\n\t\t@subscriptions = subscriptions\n\t\t@email = email\n\t\t@duebirth1 = options[:merge_vars].try :[], 'DUEBIRTH1'\n\t\t@newsletter_name = t 'views.newsletter.name'\n\t\tsendgrid_category \"#{@newsletter_name}-only Subscription Alert\"\n\t\tmail subject: \"#{@newsletter_name} sign-up from directory site\", to: ADMIN_EMAIL\n\tend", "def mail_footer(options = {})\n t('message_mailer.footer', :namespace => @conference.tag)\n end", "def subject\n subject = self.read_attribute(:subject)\n begin\n Rfc2047.decode subject if subject\n rescue Rfc2047::Unparseable\n return subject\n end\n end", "def subject\n @subject=EzCrypto::Name.new(@cert.subject) unless @subject\n @subject\n end", "def signup_notification(recipient_id)\n @user = User.find(recipient_id)\n @key = UsersNewsletter.unsubscribe_key(@user.email)\n\n mail(:to => @user.email_address_with_name,\n :subject => \"Thank you for Subscribing!\")\n end", "def subject=(subject)\n self.subjects = [subject]\n end", "def unsubscribe\n user = User.where(email: params[:md_email]).first\n user.unsubscribe!\n\n redirect_to root_path, notice: t(\"unsubscribed\")\n end", "def unsubscribe(name)\n id = @subs[name]\n\n self.send(msg: 'unsub', id: id)\n end", "def subject\n title \n end", "def data_subject=(value)\n @data_subject = value\n end", "def email_subject(&blk)\n @email_subject_block = blk if blk\n @email_subject_block\n end", "def unsubscribe(mailbox)\n tagged_response(\"UNSUBSCRIBE\", to_utf7(mailbox))\n end", "def unsubscribe_to_email\n @subscription.unsubscribe_to_email\n return_back_or_ajax\n end", "def rezm_subject_and_status(message)\n if message.receiver_deleted?\n message.subject + \" (Deleted)\" \n elsif message.read_at.nil?\n message.subject + \" (Unread)\" \n else \n message.subject\n end\n end", "def unsubscribe(id_or_email, options = {})\n url = \"v2/#{account_id}/subscribers/#{CGI.escape id_or_email}/remove\"\n url += options[:campaign_id] ? \"?campaign_id=#{options[:campaign_id]}\" : \"\"\n make_json_api_request :post, url\n end", "def mmm_test_subj_call\n ->(candidate) { I18n.t('email.test_monthly_mail_subject_initial_input', candidate_account_name: candidate.account_name) }\n end", "def notify_subscriber\n @greeting = \"Hi\"\n mail to: \"thanhquang1988@gmail.com\"\n end", "def subid=(subid)\n unsubscribe[:subid] = subid\n end", "def get_subject\n\t\tend", "def send_signup_email(subscriber)\n @subscriber = subscriber\n mail( :to => 'ashortsleeves@gmail.com',\n :subject => 'Thanks for signing up for our amazing app' )\n end", "def remove_subject_topic(index)\n self.descMetadata.remove_subject_topic(index)\n end", "def unsubscribe2\n if Spree::Chimpy::Subscriber.where(email:self.email).first\n self.unsubscribe\n end\n end", "def unsubscribe(email)\n\t # Logic for mailchimp unsubscription.\n\t api.unsubscribe({\n\t \t:id => @campaignable_list_id,\n\t :email => {\n\t :email => email\n\t }, \n\t :send_goodbye => false, # Don't send a goodbye email.\n\t :send_notify => false # Don't notify the user of the unsubscription.\n\t })\n end", "def subscribed_to(meetup, user)\n @user = user\n @meetup = meetup\n I18n.with_locale(@user.locale) do\n mail(to: @user.email,\n subject: I18n.t('meetup_mailer.subscribed_to.subject', \\\n meetup: @meetup.title))\n end\n end", "def user_rejected_email(course, user)\n ActsAsTenant.without_tenant do\n @course = course\n end\n @recipient = user\n\n I18n.with_locale(@recipient.locale) do\n mail(to: @recipient.email, subject: t('.subject', course: @course.title))\n end\n end", "def email_sub(emails)\n subs = self.config[:sub]\n if subs.nil? || subs.empty?\n emails\n else\n emails.map do |email|\n # Apply substitutions to and return a copy of the email\n email_sub = email.slice(0..-1)\n subs.each { |sub| email_sub.gsub!(sub[0], sub[1]) }\n email_sub\n end\n end\n end", "def ezm_subject_and_status(message)\r\n if message.receiver_deleted?\r\n message.subject + \" (Deleted)\" \r\n elsif message.read_at.nil?\r\n message.subject + \" (Unread)\" \r\n else \r\n message.subject\r\n end\r\n end", "def unsubscribe(email)\n # Raise an error to warn it isn't implemented.\n raise NotImplementedError.new\n end", "def subject_alternative_name\n extensions[R509::Cert::Extensions::SubjectAlternativeName]\n end", "def choose_subject(action, params = {})\n scope = [:mailers, mailer_name, action]\n key = :subject\n experiment_name = \"#{mailer_name}_mailer_#{action}_subject\".to_sym\n if experiment_active?(experiment_name)\n scope << key\n key = ab_test(experiment_name)\n end\n params.merge!(scope: scope)\n I18n.t(key, params)\n end", "def survey_closing_reminder_email(recipient, survey)\n ActsAsTenant.without_tenant do\n @course = survey.course\n end\n @recipient = recipient\n @survey = survey\n\n I18n.with_locale(@recipient.locale) do\n mail(to: @recipient.email,\n subject: t('.subject', course: @course.title, survey: @survey.title))\n end\n end", "def email_subject\n sponsor_name = @config.plan.sponsor_name\n display_date = @date.to_s()\n if @config.div_id.present?\n email_subject = \"Payroll report for #{sponsor_name} for division #{@config.division_name}: #{display_date}\"\n else\n email_subject = \"Payroll report for #{sponsor_name}: #{display_date}\"\n end\n return email_subject\n end", "def unsubscribe_url\n nil\n end", "def unsubscribed_reason\n @attributes[:unsubscribed_reason]\n end" ]
[ "0.68017083", "0.679624", "0.67463094", "0.6642214", "0.64759916", "0.6364603", "0.6307766", "0.61941695", "0.61399263", "0.6115054", "0.60848945", "0.60542506", "0.60260874", "0.6019179", "0.601729", "0.6011866", "0.5983655", "0.5981097", "0.59723336", "0.5951749", "0.59504515", "0.5944768", "0.59437484", "0.5921675", "0.59004474", "0.5877288", "0.5817969", "0.58137286", "0.58137286", "0.58137286", "0.58137286", "0.58137286", "0.58137286", "0.58112484", "0.58079135", "0.58079135", "0.58079135", "0.58079135", "0.58079135", "0.58079135", "0.58079135", "0.58079135", "0.57620907", "0.57497513", "0.5746379", "0.5744059", "0.5744059", "0.5744059", "0.5744059", "0.57182896", "0.5691459", "0.56859374", "0.5657705", "0.5640171", "0.56375116", "0.5627737", "0.56117225", "0.5558509", "0.55523944", "0.5540501", "0.5538701", "0.5514432", "0.5493561", "0.5479326", "0.5466463", "0.54255444", "0.5406836", "0.53810066", "0.53722906", "0.5369337", "0.5356553", "0.53545177", "0.5354342", "0.53497547", "0.5314919", "0.5314595", "0.531289", "0.53106475", "0.53022945", "0.5295111", "0.5293683", "0.52819276", "0.5281667", "0.5277514", "0.5274414", "0.5272656", "0.52668923", "0.5265569", "0.525728", "0.52545923", "0.52475345", "0.52467805", "0.5244576", "0.5235781", "0.52356035", "0.5234999", "0.52341986", "0.5232339", "0.52279496", "0.521624" ]
0.6717176
3
A user should be able to choose from the menu
def menu puts "Please type the menu number for the calculation you'd like to perfrom: " puts " Put 1 for Basic calculator and 2 for Advanced calculator" calculator = gets.chomp.to_i if calculator == 1 basic_calc else calculator == 2 advanced_calc end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main_menu_choose_option(user_input)\n case user_input\n when 'trains'\n manage_trains\n when 'routes'\n manage_routes\n when 'stations'\n manage_stations\n when 'cars'\n manage_cars\n else\n @ui.wrong_input_msg\n end\n end", "def manage_account_menu\n choice = @prompt.select(\"Please choose from the following options:\") do |menu|\n menu.choice 'Change my name'\n menu.choice 'Change my password'\n menu.choice 'Delete my account'.blue\n menu.choice \"Back to Main Menu\"\n end\n\n if choice == \"Change my name\"\n change_name\n elsif choice == \"Change my password\"\n change_password\n elsif choice == \"Delete my account\".blue\n delete_account\n elsif choice == \"Back to Main Menu\"\n start_menu\n end\nend", "def main_menu\n choice = self.prompt.select(\"Hi there, #{self.user.name}! What would you like to do today?\", [\"Create a new post\", \"Find a book\", \"View or edit my posts\", \"Delete my account\", \"Logout\"])\n\n case choice\n when \"Create a new post\"\n self.new_post\n when \"Find a book\"\n self.find_book\n when \"View or edit my posts\"\n self.view_edit_posts\n when \"Delete my account\"\n self.delete_account\n when \"Logout\"\n self.spinner(\" ✌️✌️✌️ \")\n self.greet\n end\n end", "def case_menu(selection)\n case selection\n when 'Playlist'\n @playlist.menu\n when 'Account Details'\n account_details\n when 'Exit'\n p \"Is this exiting?\"\n end\n end", "def menu_selection \nend", "def main_menu\n prompt.select(\"What would you like to do today #{user.name}?\") do |menu|\n menu.choice \"Choose Protein\", -> {choose_protein}\n menu.choice \"Exit!\", -> {exit_helper}\n menu.choice \"Delete Account!?!?\", -> {delete_account_helper}\n end\n end", "def main_menu\n @ui.input_1_change\n @ui.user_input1.downcase\n unless %w[trains routes stations cars].include? @ui.user_input1\n puts 'There is no such option in the main menu.'\n end\n main_menu_choose_option(@ui.user_input1)\n end", "def select_option\n print_menu\n @choice = gets.chomp\n perform_selection\n end", "def op_menu\n loop do\n case Prompts.op_selection\n when '1'\n user = User.new_user_input\n main_menu(user)\n when '2'\n User.user_login\n when '3'\n quit\n end\n end\n end", "def situation_selection\n $prompt.select(\"Welcome to Ticket Master! What would you like to do?\") do |menu|\n menu.choice 'Sign up'\n menu.choice 'Login'\n menu.choice 'Terminate program'\n end\nend", "def selection(choice)\n case choice\n when 1\n view_entries\n when 2\n manual_add_entry\n when 3\n puts 'Awaiting Build...'\n hold_screen\n # search_menu\n when 4\n puts 'Awaiting Build...'\n hold_screen\n # file_selection\n end\n end", "def user_select(items)\n h.choose do |menu|\n menu.index = :number\n menu.prompt = 'Please Choose One:'\n menu.select_by = :index_or_name\n items.each do |item|\n menu.choice item.to_sym do |command|\n ui.msg \"Using: #{command}\"\n selected = command.to_s\n end\n end\n menu.choice :all do return :all end\n menu.choice :exit do exit 1 end\n end\n end", "def booth_main_menu\n prompt.select(\"Welcome Booth Operator, what would you like to do today?\" ) do |menu|\n menu.choice \"View Merchandise\", -> {self.user.check_merchandise}\n menu.choice \"Update Inventory\", -> {self.user.add_to_inventory}\n menu.choice \"List of Customers\", -> {self.user.list_of_attendees}\n menu.choice \"Number of Sales\", -> {self.user.number_of_sales}\n menu.choice \"Items Sold\", -> {self.user.sales_made}\n menu.choice \"Sales Revenue\", -> {self.user.sales_revenue}\n menu.choice \"Exit\", -> {exit!}\n end\n end", "def menu_selection\n PROMPT.select('Please make a selection!'.colorize(:magenta)) do |menu|\n menu.choice({ name: \"Track Today's Mood\", value: '1' })\n menu.choice({ name: 'View Tracked Moods', value: '2' })\n menu.choice({ name: 'Good Vibes Please', value: '3' })\n menu.choice({ name: 'Exit', value: '4' })\n end\n end", "def main_menu\n menu_options = [\"Start exploring\", \"Check Inventory\", \"Check Your Score\", \"Go to Pokemon Center\", \"Quit\"]\n menu_prompt = Interactivity.mainMenu \n \n if user.pokemon == nil\n menu_options.shift()\n menu_options.unshift(\"Choose a Pokemon and start exploring\")\n elsif self.user_current_location\n menu_options.shift()\n menu_options.unshift(\"Keep Exploring\")\n end\n \n choice = prompt.select(menu_prompt, menu_options) \n if choice == \"Start exploring\" || choice == \"Choose a Pokemon and start exploring\" || choice == \"Keep Exploring\"\n self.trainer_chooses_pokemon if user.pokemon == nil \n self.trainer_chooses_town\n self.exploring_town\n elsif choice == \"Check Inventory\"\n puts \"MANAGE INVENTORY - CHANGE POKEMONS AROUND\"\n elsif choice == \"Go to Pokemon Center\"\n self.pokemon_center\n elsif choice == \"Check Your Score\"\n puts \"CHECK YOUR SCORE\"\n else\n Interactivity.quit\n end\n end", "def display_main_menu_choice\n #The disabled choice will be displayed with a cross ✘ character next to it and followed by an explanation:\n menu_choices = [\n 'First Time User, Want To Register',\n 'Already A Registered User, Want To Login',\n # { name: 'Goro', disabled: '(injury)' },\n 'Do Not Wish To Register, Just Browsing',\n 'Looking For Info About The App',\n 'Nothing Really, Spare Me Your @?%#&?|%!'\n ]\n choice_msg = 'What Will It Be, We Offer A Great Many Choices!'\n # system \"say #{choice_msg}\"\n main_menu_choice = prompt.select('What Will It Be, We Offer A Great Many Choices!'.colorize(:color => :light_blue), menu_choices)\nend", "def main_menu\n menu = [\n \"My Stats\",\n \"My Hikes\",\n \"Trails\",\n \"Quit\"]\n choice = nil\n while choice != \"Quit\"\n system 'clear'\n puts \"------MAIN MENU------\"\n choice = @prompt.select(\"What would you like to do #{@current_user.name}?\", menu)\n\n case choice\n when \"My Stats\"\n user_stats\n when \"My Hikes\"\n hike_options\n when \"Trails\"\n trail_options\n end\n end\n end", "def selection(input, user)\n case input\n when 1\n get_number_of_random_recipes(user)\n when 2\n recipe_hash = run_option_find_recipe_by_name\n run_sub_menu_option(user, recipe_hash)\n when 3\n run_option_create(user)\n when 4\n run_option_view_favs(user)\n end\n end", "def check_main_menu_choice(given_choice)\n if given_choice == \"First Time User, Want To Register\"\n choice = 1\n end\n if given_choice == \"Already A Registered User, Want To Login\"\n choice = 2\n end\n if given_choice == \"Do Not Wish To Register, Just Browsing\"\n choice = 3\n end\n if given_choice == \"Looking For Info About The App\"\n choice = 4\n end\n if given_choice == \"Nothing Really, Spare Me Your @?%#&?|%!\"\n choice = 5\n end\n choice\nend", "def menu_choice\n user_input = gets.chomp\n case user_input\n when \"1\"\n # Call function to show all of the doctors by region\n\n # show_all_doctors_by_region\n\n show_all_article_by_with_authors\n return_to_menu\n when \"2\"\n # Call function to show all of the doctors by specialties\n show_all_article_titles_with_content\n return_to_menu\n when \"3\"\n # Call function to show all of the doctors a user has visited\n show_all_authors\n return_to_menu\n when \"4\"\n puts Rainbow(\"Here are all the authors to choose from:\\n\").white.bright\n show_all_authors\n puts Rainbow(\"\\nPlease provide an author name:\").white.bright\n author = gets.chomp\n find_article_titles_by_author(author)\n show_full_list_of_articles(author)\n return_to_menu\n when \"5\"\n show_latest_article\n return_to_menu\n when \"6\"\n quit\n else\n puts Rainbow(\"Invalid option. Please select a number between 1 and 6.\").white.bright\n menu\n menu_choice\n end\n end", "def login_menu\n system(\"clear\")\n prompt = prompt_instance\n prompt.select(\"Select option!\".colorize(:magenta)) do |menu|\n menu.choice \"LOGIN\", -> {login}\n menu.choice \"SIGN UP\", -> {sign_up}\n menu.choice \"BACK\".colorize(:red), -> {start_menu}\n end\nend", "def user_select(items)\n choose do |menu|\n menu.index = :number\n menu.prompt = \"Please Choose One:\"\n menu.select_by = :index_or_name\n items.each do |item|\n menu.choice item.to_sym do |command| \n say \"Using: #{command}\" \n selected = command.to_s\n end\n end\n menu.choice :exit do exit 1 end\n end\n end", "def login_menu_display\n puts \"Welcome to Ticket Search app!\"\n login_choice = @prompt.select(\"What would you like to do?\", [\"Create Account\", \"Login\", \"Exit\"])\n case login_choice\n when \"Create Account\"\n user_create\n system \"clear\"\n when \"Login\"\n account_login\n system \"clear\"\n when \"Exit\"\n exit\n end\n end", "def interface\r\n clear\r\n menu_banner\r\n puts\r\n options = [\r\n { name: 'New Game', value: -> { get_user_selection } },\r\n { name: 'Custom quiz collections', value: -> { custom_collection } },\r\n { name: 'History', value: -> { history_select } },\r\n { name: 'Exit', value: lambda {\r\n clear\r\n exit_banner\r\n exit\r\n } }\r\n ]\r\n option = @prompt.select(\"Please select from the following options.\\n\\n\", options,\r\n help: \"(Select with pressing ↑/↓ arrow keys, and then pressing Enter)\\n\\n\", show_help: :always)\r\n end", "def start_menu\n puts \"\"\n choice = @prompt.select(\"Welcome! Please choose from the following options:\") do |menu|\n menu.choice 'Play'\n menu.choice 'Account Management'\n menu.choice 'Check Scoreboard'\n menu.choice \"Exit\"\n end\n\n if choice == \"Play\"\n if @user\n play\n else\n login\n play\n end\n elsif choice == \"Account Management\"\n manage_account\n elsif choice == \"Check Scoreboard\"\n scoreboard\n elsif choice == \"Exit\"\n system 'killall afplay'\n goodbye\n end\nend", "def user_selection\n menu\n choice = gets.to_i\n case choice\n when 1\n create_contact\n when 2\n view_contacts\n when 3\n delete_contact\n when 4\n edit_contact\n when 5\n puts \"Adios Amigo!\"\n exit\n else\n puts \"Invalid Choice Try Again\"\n end\nend", "def main_menu\n options = [\"View recipe book\", \"Search by ingredient\", \"Quit app\"]\n answer = @prompt.select(\"Choose an option:\".colorize(:color => :blue), (options))\n if answer == options[0]\n select_recipe_from_book(@user.view_recipe_book)\n elsif answer == options[1]\n find_recipe\n elsif answer == options[2]\n puts ''\n puts \"Thanks for using Feed. See you next time!\".colorize(:color => :blue)\n system exit\n end\nend", "def selection_menu\n h = {\n a: :select_all,\n u: :unselect_all,\n s: :toggle_select,\n '*' => 'toggle_multiple_selection',\n 'x' => 'toggle_visual_mode',\n 'm' => 'toggle_selection_mode',\n v: :view_selected_files\n }\n menu 'Selection Menu', h\nend", "def user_selection\n menu\n choice = gets.to_i\n case choice\n when 1\n add_items\n when 2\n view_cart\n when 3\n remove_items\n when 4\n check_out\n when 5\n puts \"Thank you, come again!\"\n exit\n else\n puts \"Invalid Choice Try Again\"\n sleep(2)\n end\nend", "def choose(choices, title)\n res = @dialog.menu(title, choices)\n\n raise CancelPressed.new unless res\n\n res\nend", "def display_menu\n puts \"Choose from the following options: \\n\n to find a candidate, type 'find id' (ex. find 1)\n to view all candidates, type 'all'\n to view all qualified candidates, type 'qualified'\n to exit, type 'quit' \n to view menu, type 'menu' \\n\\n\"\nend", "def options_menu(noteboard)\n @start_prompt = TTY::Prompt.new\n @start_prompt.select(\"What do you want to do now?\") do |menu|\n menu.choice \"Load existing noteboards\", -> {noteboard_menu}\n menu.choice \"Add new note\", -> {Noteboard.noteboard_add(add_note)}\n menu.choice \"Delete note\", -> {Noteboard.noteboard_delete(delete_note)}\n menu.choice \"Back\", -> {StartMenu.new}\n end\nend", "def present_menu_options\n space(1)\n puts \"Choose an option from the list below.\"\n space(1)\n puts '1. Search for events by city'\n puts '2. Search for events by artist or sports team'\n puts '3. See what I have coming up'\n puts '4. Delete my account'\n puts '5. Exit'\n space(1)\n pick_option\nend", "def menu\n selection = gets.chomp.to_i\n case selection\n when 1\n all_tickets = Tickets.new(@zendesk_tickets)\n all_tickets.view_all\n when 2\n single_ticket = Ticket.new(@zendesk_tickets)\n single_ticket.view_all\n when 3\n system 'clear'\n puts \"Goodbye!\"\n exit\n else\n system 'clear'\n puts \"Invalid choice, select between 1, 2 or 3\"\n welcome_message \n menu\n end\n end", "def main_menu\n main_menu_options = {'Interact with Existing Kits' => :list_and_select_kit,\n 'Create a new Kit' => :prompt_kit_params, \n 'Quit' => :quit}\n \n op = @io.select_from_options(\"What would you like to do?\", main_menu_options)\n @operation_stack.unshift op\n \n # return nil, because there's nothing to pass onto the next method\n return\n end", "def secret_menu\n puts \"\"\n options = [\"View Character Dictionary\", \"View Spellbook\", \"View House\", \"View Classmates\", \"Quit\"]\n choice = PROMPT.select(\"Welcome to Hogwarts. Feel free to explore the following:\", options)\n case choice\n when options[0]\n character_dictionary\n when options[1]\n which_user_spellbook_and_path?\n secret_menu_or_quit\n when options[2]\n house_info\n secret_menu_or_quit\n when options[3]\n user_classmates\n when options[4]\n goodbye\n end\n end", "def present_menu\n puts \"-------------------\"\n puts t('select_features')\n puts t('feature_one')\n puts t('feature_two')\n puts t('feature_three')\n puts t('exit_option')\n\n selected_feature = gets.to_i\n\n case selected_feature\n when FEATURE_OPTION_MAJOR_STATES\n print_major_states\n when FEATURE_OPTION_AVERAGE_POP\n print_average_population_for_state\n when FEATURE_OPTION_BOUNDARY_CITIES\n print_boundary_cities_for_state\n when FEATURE_OPTION_EXIT\n return\n else\n puts t('invalid_option', option: selected_feature)\n run\n end\n end", "def run_menu(menu)\n display_menu(menu)\n user_choice = get_user_input(menu.user_pick_one_prompt)\n while !menu.user_input_valid?(user_choice)\n user_choice = get_user_input(menu.user_wrong_choice_prompt)\n end\n if menu.user_wants_to_quit?(user_choice)\n exit 0\n else\n menu.find_menu_item_chosen(user_choice).do_if_chosen\n end\n end", "def wiki_menu_select\n wiki_menu\n prompt = TTY::Prompt.new\n menu_choices = [\n \" [1] Search by Character\",\n \" [2] Search by House\",\n \" [3] Main Menu\",\n \" [4] Exit App\"\n ]\n prompt.select(\" \", menu_choices)\nend", "def action_menu(choice,phonebook)\n case choice\n when \"1\"\n show_cities(phonebook)\n when \"2\"\n show_area_code(phonebook)\n else\n puts \"Invalid choice! Example: Type \\\"1\\\" to list all cities available. \\n\\n\"\n end\nend", "def main_menu(user)\n user = user\n self.clear\n Ascii.image\n menu = [\"See all my plants\",\"Add new plant\",\"Delete my account\",\"Quit\"]\n menu_selection = @@prompt.select(\"What would you like to do?\",menu)\n \n case menu_selection\n when \"See all my plants\"\n my_plant(user)\n when \"Add new plant\"\n add_plant(user)\n when \"Delete my account\"\n answer = @@prompt.yes?(\"Are you sure?\")\n answer == true ? user.destroy : self.main_menu(user)\n when \"Quit\"\n index = 0\n # binding.pry\n color = [\"#7FFF00\",\"#6B8E23\",\"#008000\",\"#2F4F4F\",\"#00008B\"]\n 5.times do\n self.clear\n # binding.pry\n puts Paint[Ascii.goodbye, color[index]] \n index += 1\n sleep(0.7)\n end \n end\n end", "def start_menu\n printf \"\\nPrograma para a disciplina de LPD\\n\"\n printf \"Choose one option\\n\"\n printf \"------------------------------------\\n\"\n printf \"1) Insert user\\n\"\n printf \"2) Login user\\n\"\n printf \"3) Delete user\\n\"\n printf \"0) Exit\\n\"\nend", "def welcome_menu\n prompt = TTY::Prompt.new\n puts\"( ノ ゚ー゚)ノ☀️ Welcome to Weeb Favorites! ☀️ヽ(゚ー゚ヽ)\"\n new = prompt.select(\"Before making modifications, please create a name:\", [\"Create\", \"View Duo List\", \"Modifications\", \"Exit\"])\n\n case new\n\n when 'Create'\n create\n chosen_char\n\n when 'View Duo List'\n find_all_duo\n\n when 'Modifications'\n mods\n\n when 'Exit'\n close_app \n end \nend", "def main_menu\n @@prompt.select(\"What would you like to do today?\".colorize(:yellow)) do |menu|\n menu.choice \"Read Reviews\", -> {self.read_reviews}\n menu.choice \"Write a review\", -> { self.writing }\n menu.choice \"Update a review\", -> { self.update_reviews }\n menu.choice \"Delete a review\", -> { self.deleting }\n menu.choice \"Log Out\", -> { self.log_out }\n end\n end", "def main_menu\n @active = 0\n @prompt.select(\"\\nWhat would you like to do?\\n\".blue) do |menu|\n menu.choice \"Check out what's on today\", -> {today_menu} \n menu.choice \"Check out things to do on the weekend\", -> {weekend_menu}\n menu.choice \"Look at my favourites\", -> {display_favorites}\n menu.choice \"Exit\".red, -> {leave_app} \n end \n end", "def menu_list \n puts \"Please select from the following options: \"\n puts \" Enter '1' to create a new donation!\"\n puts \" Enter '2' to see a list of the organizations accepting donations\"\n puts \" Enter 'exit' if you changed your mind and wish to leave the app\"\n puts \" To see the menu options again, please enter 'menu'\"\nend", "def main_menu\n\tputs \"\\n1 Library\\n2 Staff Members\\n3 Books\\n4 Patrons\\n0 Exit\\n\"\n\tselect = make_selection\n\n\twhile select != \"1\" && select != \"2\" && select != \"3\" && select != \"4\" && select != \"0\"\n\t\tputs \"\\nInvalid choice selected\\n\"\t\t \t\t\n\t\tselect = make_selection\n\tend\n\n\tif select == \"1\"\n\t\tlibrary_choice = \"9\"\n\t\twhile library_choice != \"0\"\n\t\t\tlibrary_choice = select_choice_library\n\t\tend\n\n \telsif select == \"2\"\n\t\tstaff_member_choice = \"9\"\n\t\twhile staff_member_choice != \"0\"\n\t\t\tstaff_member_choice = select_choice_staff_member\n\t\tend\n\n\n\telsif select == \"3\"\n\t\tbook_choice = \"9\"\n\t\twhile book_choice != \"0\"\n\t\t\tbook_choice = select_choice_book\n\t\tend\n\n\n\telsif select == \"4\"\n\t\tpatron_choice = \"9\"\n\t\twhile patron_choice != \"0\"\n\t\t\tpatron_choice = select_choice_patron\n\t\tend\n\n\n\telsif select == \"0\"\n\t\tputs \"\\nGoodbye\"\t\t \t\t\n\tend\n\tselect \nend", "def main_menu\n choice = true\n while choice\n puts \"What would you like to do?\"\n puts \"(C)reate, (L)ist, (U)pdate, (D)elete, or (E)xit \"\n options = gets.chomp.downcase\n\n case options\n when \"c\"\n # runs method create line 101\n create\n when \"l\"\n #runs method list line 144\n list\n when \"u\"\n #runs method update line 161\n update\n when \"d\"\n #runs method delete line 229\n delete\n when \"e\"\n choice = false #exits world\n else\n puts \"Wrong Input. Please input C, L, U, D or E\"\n end\n end\n end", "def menu\n puts \"#{dashes}\\n\n Choose from the following options - using the numbers (1-6) as your input:\\n\n - 1 - Create your user profile\n - 2 - Search for doctors by region\n - 3 - Search for doctors by specialty\n - 4 - Search for the doctors the user has visited\n - 5 - Does something else\n - 6 - Quit the application\n \"\n end", "def choose(choices, title)\n @dialog.title = \"\\\"#{title}\\\"\"\n res = @dialog.menu(title, choices)\n \n raise CancelPressed.new unless res\n \n res\n end", "def menu\n input = gets.strip.downcase\n \n if input == \"hungry\"\n cuisine_list\n menu # return 'menu' don't want my user to get kicked out of application \n elsif input == \"goodbye\"\n goodbye\n else \n invalid_entry\n end \n end", "def print_menu\n output.puts \"Madden's Car Selection Tool-\"\n \n # Print Current Model Info\n print_model_info\n\n # Print Menu Choices\n print_menu_choices\n\n # Get User Choice\n output.print \"Enter choice: \"\n end", "def main_menu_selection\n puts \"\"\n PROMPT.select(\"What would you like to do?\") do |menu|\n menu.choice \"Download this week's quiz\", 1\n menu.choice \"Download last week's quiz\", 2\n menu.choice \"Exit app\", 3\n end\n end", "def menu\n\n puts \"________________\"\n\n puts \"insert the user name to continue\"\n @user_name = gets.chomp\n response = User.find_by(user_name: @user_name)\n\n puts \"________________\"\n\n if response\n \n mainscreen\n else\n puts \"try again\"\n menu\n end\n end", "def menu\n\tputs \"(b)asic, (a)dvanced, or (q)uit\"\n\t$menu_choice = gets.chomp.downcase\nend", "def list_option\n list_politicians\n list_voters\n puts\n puts \"(R)eturn to the main menu?\".center(80).green\n menu_return = gets\n end", "def assigned_menu\n\n end", "def choose\n \n end", "def user_menu\n puts \"1-input data from file\"\n puts \"2-edit data\"\n puts \"3-form groups\"\n puts \"4-list groups\"\n puts \"5-write groups to file\"\n puts \"6-view course information\"\n puts \"0-exit the program\" \n user_selection = gets.chomp\n # case statement calls respective methods based on user's selection.\n # gives error if file is not loaded and returns to menu\n case user_selection\n when \"0\"\n abort\n when \"1\"\n input_data\n when \"2\"\n if @file_loaded\n edit_data\n else\n puts @dash+\"error-file-not-loaded\"+@dash\n user_menu\n end \n when \"3\"\n if @file_loaded\n form_groups\n else\n puts @dash+\"error-file-not-loaded\"+@dash\n user_menu\n end \n when \"4\"\n if @file_loaded\n list_groups\n else\n puts @dash+\"error-file-not-loaded\"+@dash\n user_menu\n end \n when \"5\"\n if @file_loaded\n write_groups\n else\n puts @dash+\"error-file-not-loaded\"+@dash\n user_menu\n end \n when \"6\"\n if @file_loaded\n list_course_info\n else\n puts @dash+\"error-file-not-loaded\"+@dash\n user_menu\n end \n else\n puts @dash+\"error-invalid-selection\"+@dash\n user_menu\n end\n end", "def main_menu(current_user)\n puts \"*****************************************************\"\n puts \"What would you like to choose?\"\n puts \" \"\n puts \"1. Make appointment\"\n puts \"2. My appointments\"\n puts \"3. Change user\"\n puts \"4. Exit\"\n\n input = gets.chomp\n case input\n when \"1\"\n stylists_menu(current_user)\n when \"2\"\n my_appointments_menu(current_user)\n when \"3\"\n puts \"Enter new username\"\n username = gets.chomp\n current_user = User.find_or_create_by(name: username)\n main_menu(current_user)\n when \"4\"\n close_app\n\n else\n puts \"Please choose numbers 1 to 3\"\n main_menu(current_user)\n end\nend", "def login_menu\n\t\tlogin_display\n option = gets.chomp.downcase\n if option == \"1\" || option == \"1.\" || option == \"new user\"\n get_user_info\n elsif option == \"2\" || option == \"2.\" || option == \"returning user\"\n login\n elsif option == \"3\" || option == \"3.\" || option == \"exit\"\n goodbye\n else\n\t\t\tputs \"Check your input and make sure you are selecting a number. \"\n\t\t\tsleep(2)\n login_menu\n end\n end", "def menu_choice(action)\n if action == \"a\"\n @humanplayer.search_weapon\n elsif action == \"s\"\n @humanplayer.search_health_pack\n elsif action == \"1\"\n @humanplayer.attack(@player_1)\n elsif action == \"2\"\n @humanplayer.attack(@player_2)\n elsif action == \"3\"\n @humanplayer.attack(@player_3)\n elsif action == \"4\"\n @humanplayer.attack(@player_4)\n else puts \"Please select option a, s, 1, 2, 3 or 4\"\n end\n\n kill_player\n end", "def settings_menu\n display_settings\n\n case user_input(caps: true)\n when interface[:home] then clear_and_home_navigation\n when interface[:difficulty] then clear_and_set_difficulty\n when interface[:interface] then clear_and_set_interface\n when interface[:markers] then set_markers\n when interface[:names] then set_names\n when interface[:help] then toggle_helper_and_settings_menu\n when interface[:reset]\n if default_settings?\n invalid\n else\n reset_default_settings\n end\n else\n invalid\n end\n end", "def interactive_menu\n loop do\n print_menu\n user_choice(STDIN.gets.chomp)\n end\nend", "def display_menu\n system('clear')\n arr = ['My List', 'Recommendations', 'Playlist', 'Account Details', 'Exit']\n @prompt.select(\"》 MAIN MENU 《\\n\".colorize(:light_green), arr)\n end", "def second_case_menu(selection)\n case selection\n when 'Export To File'\n export_to_file\n when 'Back'\n menu = Menu.new(@user)\n menu.menu_router\n end\n end", "def menu(selected)\n @menu = selected\n end", "def init_menu\n @menus.set_selected(\"teambox\")\n @menus.set_selected(\"licenses\")\n end", "def menu \n prompt = TTY::Prompt.new\n choices = [\"Race🏎️\", \"Go to Garage🧰\", \"Open Shop🔑\", \"Leaderboards📈\", \"Log Out\"]\n choice = prompt.select(\"\", choices) \n if choice == choices[0] && user.user_cars.size > 0 \n system(\"clear\")\n race_meth() #############RACEMETH\n elsif choice == choices[0] && user.user_cars.size == 0 \n system(\"clear\")\n puts \"You have no cars to race. Purchase one from the shop first!\"\n menu()\n elsif choice == choices[1] && user.user_cars.size > 0 \n system(\"clear\")\n garage()\n elsif choice == choices[1] && user.user_cars.size == 0 \n system(\"clear\")\n puts \"You have no cars in your garage. Purchase one from the shop first!\"\n menu()\n elsif choice == choices[2] \n system(\"clear\")\n shop()\n elsif choice == choices[3]\n leaderboards()\n else\n intro() \n end \nend", "def main_menu_prompt\n welcome\n menu = [\n { name: \"View list of Recipes\", value: 1},\n { name: \"Input a new recipe into the recipe book\", value: 2},\n { name: \"Edit a recipe from the recipe book\", value: 3},\n { name: \"Display Help information\", value: 4},\n { name: \"Exit\", value: 5}\n ]\nmm_choice = $prompt.select(\"Please select an option\", menu)\nreturn mm_choice\nend", "def user_menu_input\n menu\n user_menu_selection = gets.strip.to_i\n if valid_menu_selection?(user_menu_selection)\n user_menu_selection\n else\n puts \"\\nInvalid input \\u{1f4a9} !\\n \".colorize(:red).bold\n user_menu_input\n end\n end", "def main_menu\n puts \"===============\"\n puts \"Make a selection\"\n puts \"===============\"\n puts \"1: Command line\"\n puts \"2: Atom\"\n puts \"3: Search?\"\n puts \"4: Quit\"\n puts \"===============\"\n\n case gets.strip\n when \"1\"\n command_line_menu\n when \"2\"\n atom_menu\n when \"3\"\n search_function\n reset\n when \"4\"\n exit 0\n else\n bad_choice\n main_menu\n end\nend", "def main_menu\n while true\n print_main_menu\n user_selected = gets.chomp.to_s\n call_option(user_selected)\n end\n end", "def menu\n system('clear')\n selection = @prompt.select('》 PLAYLIST 《', ['Display', 'Add', 'Remove', 'Export To File', 'Back'])\n case selection\n when 'Display'\n list\n else\n case_menu(selection)\n end\n end", "def house_menu\n puts \"\n ┬ ┬┌─┐┬ ┬┌─┐┌─┐ ┬┌┐┌┌─┐┌─┐\n ├─┤│ ││ │└─┐├┤ ││││├┤ │ │\n ┴ ┴└─┘└─┘└─┘└─┘ ┴┘└┘└ └─┘\n\n Please select an option from below:\n \"\n prompt = TTY::Prompt.new\n menu_choices = [\n \" [1] Find all characters of a house\",\n \" [2] Find largest houses\",\n \" [3] Find all houses of a region\",\n \" [4] Find info of a house\",\n \" [5] Wiki Menu\",\n \" [6] Main Menu\"\n ]\n prompt.select(\" \", menu_choices)\nend", "def menu\n\toption = gets.chomp.downcase\nend", "def show_menu\n\n menu_pick = @prompt.select('Please select a menu option: ') do |menu|\n menu.choice 'Show Events by Country', 'find by country'\n menu.choice 'Show Events by City', 'find by city'\n menu.choice 'Show Events By Date', 'find by date'\n menu.choice 'Get Event Info By Name', 'find by name'\n menu.choice 'Exit', 'exit'\n end\n\n return menu_pick if menu_pick == 'exit'\n\n event = handle_input(menu_pick)\n\n display_info(event) if event\n\n end", "def interactive_menu\n loop do \n print_menu\n user_selection(STDIN.gets.chomp)\n end\nend", "def main_menu\n selection = input(@menu) {|o| (1..2) === o.to_i }.to_i\n \n if 1 == selection\n :continue\n elsif 2 == selection\n :quit\n end\n end", "def run\n welcome\n main_menu_selection #choose to create a character or login to pre-existing character\n player_options #a list of options the selected player from 'selection_menu' can accomplish\nend", "def admin_choice\n @choice = params[:choice]\n end", "def menu\n puts \"\\n************************************************************\".colorize(:magenta).blink\n puts \"Select an option (1-5) from the menu below:\".colorize(:blue).bold\n puts \"------------------------------------------------------------\".colorize(:cyan)\n puts \"1. Don't want to think about what to cook? \\n Spin the RANDOM WHEEL OF RECIPES!\".colorize(:blue)\n puts \"------------------------------------------------------------\".colorize(:cyan)\n puts \"2. Need some inspiration for cooking? \\n Find recipe by name OR \\n if you have leftover ingredients search your ingredients!\".colorize(:blue)\n puts \"------------------------------------------------------------\".colorize(:cyan)\n puts \"3. Feeling creative? \\n Write and save your own recipe!\".colorize(:blue)\n puts \"------------------------------------------------------------\".colorize(:cyan)\n puts \"4. View ALL your favorite recipes in 1 place!\".colorize(:blue)\n puts \"------------------------------------------------------------\".colorize(:cyan)\n puts \"5. You're done? Time to exit...\".colorize(:blue)\n puts \"************************************************************\\n \".colorize(:magenta).blink\n end", "def choice_a_menu\n item_id = @item_list[@index]\n return action_b if item_id.nil?\n return play_buzzer_se if item_id == 0\n play_decision_se\n show_shadow_frame\n # Prepare the choice info\n # Use option\n map_usable = proc { !GameData::Item[item_id].map_usable }\n # Give option\n giv_check = proc { $pokemon_party.pokemon_alive <= 0 || !GameData::Item[item_id].holdable }\n # Unregister / register\n if $bag.shortcuts.include?(item_id)\n reg_id = 14\n reg_meth = method(:unregister_item)\n else\n reg_id = 2\n reg_meth = method(:register_item)\n reg_check = map_usable\n end\n # Throw option\n thr_check = proc { !GameData::Item[item_id].limited }\n # Create the choice\n choices = PFM::Choice_Helper.new(Yuki::ChoiceWindow::But, true, 999)\n choices.register_choice(text_get(22, 0), on_validate: method(:use_item), disable_detect: map_usable)\n .register_choice(text_get(22, 3), on_validate: method(:give_item), disable_detect: giv_check)\n .register_choice(text_get(22, reg_id), on_validate: reg_meth, disable_detect: reg_check)\n .register_choice(text_get(22, 1), on_validate: method(:throw_item), disable_detect: thr_check)\n .register_choice(text_get(22, 7))\n # Show selection : item_name\n @base_ui.show_win_text(parse_text(22, 35, PFM::Text::ITEM2[0] => GameData::Item[item_id].exact_name))\n # Process the actual choice\n y = 200 - 16 * choices.size\n choices.display_choice(@viewport, 306, y, nil, on_update: method(:update_graphics), align_right: true)\n @base_ui.hide_win_text\n hide_shadow_frame\n end", "def main_menu\n puts \"\"\n puts \"-----------------------------------------------\"\n puts \"\"\n puts \"Please select an option:\"\n puts \"\"\n puts \"Enter 'list' for a list characters, 'quote' for a random Stan Lee quote, or 'exit' to bid farewell.\"\n puts \"\"\n input = user_input\n\n if input == 'list'\n list_characters\n elsif input == 'quote'\n stan_lee_quote\n elsif input == 'exit'\n goodbye\n elsif input != 'list' || input != 'exit' # had to add \"input !=\" each time to avoid the string literal warning\n invalid_input\n main_menu\n end\n \n end", "def get_menu_choice\n\t\tchoices = [\"1. Play Hangman\", \"2. Load Saved Game\", \"3. Delete Saved Game\",\n\t\t\t\"4. List Saved Games\", \"5. Quit\"]\n\t\tdisplay_menu choices\n\n\t\twhile true\n\t\t\tprint \"Enter Selection (1 - #{ choices.length }): \"\n\t\t\tchoice = gets.chomp.to_i\n\t\t\treturn choice if choice.between?(1, choices.length)\n\t\tend\n\tend", "def menu\n ([[0, 'Choisir l’icarien…']] + User.values_select(type_icarien => true)).in_my_select(id: 'opuser_user_id', name: 'opuser[user_id]', selected: param_opuser[:user_id])\n end", "def menu\n puts `clear`\n puts Rainbow(\"Welcome to the Happitails Database\\n\\n\").blue\n print 'Choose: (L)ists, (A)nimal Management, (C)lient Management or (Q)uit. '\n gets.chomp.downcase\nend", "def display_options_menu\n prompt = TTY::Prompt.new\n display_options_menu = prompt.select('Please select an option:') do |menu| \n menu.choice 'Add Code'\n menu.choice 'Edit Code'\n menu.choice 'Remove Code'\n menu.choice 'Search'\n menu.choice 'Help'\n menu.choice 'Exit'\n end\nend", "def main_menu(user)\n calories = Calories.new\n loop do\n calories.calorie_intake(user)\n case Prompts.main_selection\n when '1'\n calories.log_daily_meals\n when '2'\n calories.log_daily_intake\n when '3'\n Details.update_weight(user)\n when '4'\n Quotes.inspirational\n when '5'\n quit\n end\n end\n end", "def main_menu\n\tputs \"Welcome to Roy Bank!\"\n\tputs\"Please make a selection:\"\n\tputs \"____________________________\"\n\tputs \"1. Create a new account\"\n\tputs \"2. View Account Information\"\n\tputs \"3. Exit Program\"\n\nprint \"Option: \"\n\noption = gets.chomp.to_i\n\nif option == 1\n\tcreate_account\n\tmain_menu\n\telsif option == 2\n\t\t# some code here\n\t\t#user_login\n\t\taccount_menu\n\telsif option == 3\n\t\tputs \"Thank you for stopping by!\"\n\telse \n\t\tputs \"Invalid entry! Please choose from the available options!\"\n\n\t\tmain_menu\n\n\tend\n\t\t\t\n\t\t\n\n\n\n\nend", "def login_choice\n end", "def store\n user_choice = @view.main_menu_display\n case user_choice\n when 2\n register_user \n when 1 \n login_user\n when 3 \n @view.goodbye \n end \n end", "def main_menu(user_instance)\n user_greeting(user_instance)\n case help\n when \"1\", \"playlist\", \"playlists\"\n system(\"clear\")\n playlists_menu(user_instance)\n when \"2\", \"songs\", \"song\"\n system(\"clear\")\n songs_menu(user_instance)\n # when \"3\", \"artists\", \"artist\"\n # system(\"clear\")\n # artists_menu(user_instance)\n when \"exit\"\n system(\"clear\")\n goodbye\n exit\n else\n system(\"clear\")\n puts \"Please enter a valid command.\".colorize(:red).bold\n main_menu(user_instance)\n end\nend", "def option_select \n require \"tty-prompt\"\n prompt = TTY::Prompt.new\n\n puts \"\\n \\n\"\n\n prompt.select(\"What would you like to do? Choose from the options below:\") do |menu|\n menu.choice 'View my favorite players' #MAIN MENU OPTION 1 - SHOWS USER'S FAVORITE PLAYERS\n menu.choice 'Add a new favorite player to my account' #MAIN MENU OPTION 2\n menu.choice 'Delete a favorite player from my account' #MAIN MENU OPTION 3\n menu.choice 'View all fans of a specifc player' #MAIN MENU OPTION 4\n menu.choice 'View favorite players of another fan' #MAIN MENU OPTION 5\n menu.choice 'View players from a specific club' #MAIN MENU OPTION 6\n menu.choice 'View most expensive player from a specifc premier league team' #MAIN MENU OPTION 7\n menu.choice 'I just got a season ticket. Update my club season ticket status.' #MAIN MENU OPTION 8\n menu.choice 'exit' #MAIN MENU OPTION EXIT\n end\n\nend", "def menu_options\n system \"clear\"\n puts \"~~~ Welcome #{@user.username} to the Main Menu ~~~\\n\\n\" \n puts \"{1} Continue from previous story \"\n puts \"{2} Create new story\"\n puts \"{3} Delete a story\"\n puts \"{4} Tutorial\"\n puts \"{5} End My Session\"\nend", "def main_menu\n\tputs \"Welcome, what would you like to do today?\"\n\tputs \"1) Add Items to Cart\"\n\tputs \"2) View Items in Cart\"\n\tputs \"3) Remove Items from Cart\"\n\tputs \"4) View Total\"\n\tputs \"5) Exit\"\n\tuser_input = gets.strip.to_i\n\n\n\tcase user_input\n\twhen 1\n\t\tadd_items\n\twhen 2\n\t\tview_items\n\twhen 3\n\t\tremove_item\n\twhen 4\n\t\tshow_total\n\twhen 5\n\t\tputs \"Thank you for shopping with DPL Grocery!\"\n\t\texit!\n\telse\n\t\tputs \"Wrong option bruuuh, try again!\"\n\t\t# puts \"Please choose from the options above, try again.\"\n\tmain_menu\n\tend\nend", "def pick_option\n input = get_input\n if input == '1'\n events_array = search_by_city\n display_events_by_city(events_array)\n save_event_or_main_menu(events_array)\n elsif input == '2'\n attractions_array = search_by_keyword\n display_by_keyword(attractions_array)\n save_event_or_main_menu(attractions_array)\n elsif input == '3'\n display_user_events\n elsif input == '4'\n delete_account\n elsif input == '5'\n space(1)\n puts \"#{$logged_in.username}, thanks for checking us out. See ya later!\"\n exit\n else\n space(1)\n invalid_input\n pick_option\n end\nend", "def menu_select(name, values)\n result = false\n say(\"\\n#{name.capitalize} Selection\")\n choose do |menu|\n menu.prompt = \"Please select #{name}: \"\n menu.index = :number\n menu.index_suffix = ') '\n menu.choice(:quit, 'Quit') {result = false}\n menu.choices(*(values.collect{|v| field_name_choice(v)})) do |command, details|\n result = command.split(\" \").first\n end\n end\n result\n end", "def sub_menu(choise)\n case choise\n when '1'\n make_route\n when '2'\n make_station\n when '3'\n make_train\n when '4'\n list_routes\n when '5'\n list_stations\n when '6'\n list_trains\n when '7'\n list_station_trains\n when '8'\n attach_station\n when '9'\n dettach_station\n when '10'\n attach_train\n when '11'\n attach_wagon\n when '12'\n dettach_wagon\n when '13'\n list_train_wagons\n when '14'\n occupy_train_wagon\n when '15'\n move_train\n else\n puts \"Введено некорректное значение меню\\n\\n\"\n end\n end", "def menu_options\n puts \"Good morning, you have two options; you can either\"\n puts \"1. Add students to the directory\\n 2. View a list of students enrolled at Makers Academy\\n 3. Save the list of students to a file\\n 9. Exit the programme.\"\n puts \"Please type the option you would like?\"\nend", "def init_menu\n @menus.set_selected(\"about\")\n end" ]
[ "0.7613777", "0.75420403", "0.7501483", "0.7460398", "0.7355061", "0.7299225", "0.7294461", "0.72457236", "0.7244415", "0.7227641", "0.71914387", "0.71618307", "0.7137189", "0.7116351", "0.71134084", "0.70925593", "0.70901567", "0.7060775", "0.7048038", "0.7033166", "0.7016431", "0.7010345", "0.700338", "0.69731855", "0.6968856", "0.6961114", "0.6959302", "0.69477326", "0.6923203", "0.6917895", "0.69147813", "0.69134694", "0.69133556", "0.6913115", "0.6908398", "0.6906887", "0.6905567", "0.6891005", "0.68700224", "0.6854923", "0.6854266", "0.68514127", "0.6848417", "0.6844254", "0.68431777", "0.6838493", "0.6828721", "0.6795962", "0.679559", "0.67927706", "0.67903703", "0.6787531", "0.6785489", "0.67792636", "0.67786705", "0.67737377", "0.67712194", "0.67653936", "0.6752774", "0.6751364", "0.6746236", "0.6732516", "0.671883", "0.67108405", "0.6704398", "0.66994953", "0.6693646", "0.6681915", "0.6675648", "0.6667774", "0.6666887", "0.66653484", "0.665968", "0.66543436", "0.66540086", "0.6652919", "0.66518205", "0.66477466", "0.66435957", "0.6642266", "0.66407096", "0.66394216", "0.66376716", "0.6629731", "0.6629623", "0.6620911", "0.6610049", "0.6608094", "0.6605678", "0.66050756", "0.66042215", "0.6600229", "0.6597172", "0.659257", "0.65898037", "0.6583015", "0.6579421", "0.6577229", "0.6567691", "0.65645146", "0.65584016" ]
0.0
-1
A user should be able to enter numbers to perform the operation on A user should be shown the result
def basic_calc print "(a)dd, (s)ubtract, (m)ultiply, (d)ivide: " function = gets.chomp.downcase return 'q' if function == 'q' print "Enter first number: " num_1 = gets.chomp.to_i answer = 0 case function when "a" puts "Enter the second number" add_num = gets.chomp.to_i answer = num_1 + add_num when "s" puts "Enter the second number" sub_num = gets.chomp.to_i answer = num_1 - sub_num when "m" puts "Enter the second number" multi_num = gets.chomp.to_i answer = num_1 * multi_num when "d" puts "Enter the second number " divide_num = gets.chomp.to_i answer = num_1 / divide_num else puts "Wrong!" end print "The answer equals: #{answer}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculator \n valid_operations = [\"add\",\"+\",\"subtract\",\"-\",\"multiply\",\"*\",\"divide\",\"/\"]\n \n # ask user for math operations \n # check if operation is valid and if not ask for a new input \n puts \"What is the math operation?\"\n operation = gets.chomp.strip.downcase \n until valid_operations.include?(operation)\n puts \"Please enter a valid operation\"\n operation = gets.chomp\n end \n \n \n # ask user for numbers and input validation \n puts \"What is the first number for the math operation?\"\n number_one = gets.chomp.strip\n number_one = check_number(number_one)\n puts \"What is the seccond number for the math operation?\"\n number_two = gets.chomp.strip\n number_two = check_number(number_two)\n \n # use user input to do math operations \n if operation == \"add\" || operation == \"+\"\n result = number_one + number_two \n operation = \"+\"\n elsif operation == \"subtract\" || operation == \"subtract\"\n result = number_one - number_two \n operation = \"-\"\n elsif operation == \"multiply\" || operation == \"*\"\n result = number_one * number_two \n operation = \"*\"\n elsif operation == \"divide\" || operation == \"/\"\n result = number_one / number_two \n operation = \"/\"\n \n end \n \n \n # display result of calculation to user \n puts \" #{number_one} #{operation} #{number_two} = #{result}\"\nend", "def arithmetic_ops\n puts \"Enter first number:\"\n num1 = gets.to_i\n puts \"Enter the second number:\"\n num2 = gets.to_i\n\n puts \"#{num1} + #{num2} = #{num1 + num2}\" \n puts \"#{num1} - #{num2} = #{num1 - num2}\" \n puts \"#{num1} * #{num2} = #{num1 * num2}\" \n puts \"#{num1} / #{num2} = #{num1 / num2}\" \n puts \"#{num1} % #{num2} = #{num1 % num2}\" \n puts \"#{num1} ** #{num2} = #{num1 ** num2}\"\n \nend", "def request_operations_numbers(user_input, valid_operators)\n puts \"What operation would you like to perform?\"\n operation = gets.chomp\n if valid_operators.values.flatten.include?(operation)\n user_input[:operation] = operation\n else\n puts \"Whoa nelly! You don't make sense. You can add, subtract, multiply, or divide.\"\n exit\n end\n puts \"What's the first number you would like to use?\"\n num_1 = gets.chomp\n user_input[:num_1] = num_1\n\n puts \"What's the second number you would like to use?\"\n num_2 = gets.chomp\n user_input[:num_2] = num_2\nend", "def print_choices\n # A user should be able to enter numbers to perform the operation on\n puts \"========================\"\n puts \"Input number 1 please:\"\n @number_one = gets.chomp.to_i\n puts \"Input number 2 please:\"\n @number_two = gets.chomp.to_i\n puts \"\"\n puts \"What do you want to do with the numbers?\"\n # Calculator should be able to do basic arithmetic (+,-, *, /)\n puts \"1 - addition\"\n puts \"2 - subtraction\"\n puts \"3 - division\"\n puts \"4 - multiplication\"\n puts \"5 - quit\"\n gets.chomp.to_i\nend", "def ask_for_digits\r\n puts (\"Calculator\").colorize(:white).on_green\r\n variables = []\r\n input = @@prompt.ask(\"Enter a number between 1000 and 9999 e.g. 1234:\") do |q|\r\n q.convert -> (input) { input.split(/[\\s]/) }\r\n q.convert(:integer, \"Invalid input. Try again.\")\r\n end\r\n \r\n # Error handling: If they put in a negative number \r\n begin \r\n # Take the input, split by digits, and because that puts them in reverse order it must be reversed again\r\n variables = input.digits.reverse\r\n rescue\r\n system(\"clear\")\r\n puts \"Positive numbers only!\"\r\n ask_for_digits\r\n end \r\n \r\n\r\n if variables.length == 4\r\n numbers = []\r\n numbers += object_to_float(variables)\r\n op = Operations.new\r\n op.calculate(numbers[0], 0, numbers, [])\r\n ask_user_start\r\n \r\n else\r\n system(\"clear\")\r\n puts \"Invalid input\"\r\n ask_for_digits\r\n end\r\n \r\n end", "def number_choice_one\n puts \"Now I need two numbers to use with that operator.\"\n puts \"Type your first number: \"\n gets.chomp.to_i\nend", "def calculator\n #ask user method\n puts \"What calculation would you like to do? (add, sub, mult, div)\"\n calc_type = gets.chomp\n\n #ask for first number\n puts \"What is number 1? where result = num_1 operator num_2\"\n num_1 = gets.chomp\n num_1 = num_1.to_f\n\n #ask for second number\n puts \"What is number 2?\"\n num_2 = gets.chomp\n num_2 = num_2.to_f\n\n # do calculation using num_1, num_2, calc_type\n if calc_type == \"add\"\n result = num_1 + num_2\n elsif calc_type == \"sub\" \n result = num_1 - num_2\n elsif calc_type == \"mult\" \n result = num_1 * num_2\n else\n result = num_1.to_f / num_2.to_f\n end\n #return result\n puts \"#{result}\"\n return result\n\nend", "def add\n #ask for some inputs , after some text\n #turn those inputs into a float, and save it in some variable\n print \"what is your first number? \"\n first_number = gets.to_f\n print \"what is your second number? \"\n second_number = gets.to_f\n # Add the two inputs given togrther and save the result\n result = first_number + second_number\n #print\n puts \"The result is #{result}\"\nend", "def basic_calculator\n print \"Do you wish to add, subtract, multiply or divide?: \"\n operation = gets.chomp.downcase\n\n if operation == \"add\"\n formula\n puts (@first_num + @second_num)\n elsif operation == \"subtract\"\n formula\n puts (@first_num - @second_num)\n elsif operation == \"multiply\"\n formula\n puts (@first_num * @second_num)\n elsif operation == \"divide\"\n formula\n puts (@first_num / @second_num)\n else\n puts \"Invalid selection.\"\n end\n end", "def valid_operation(user_input)\n user_input.downcase!\n \n case user_input\n when \"add\", \"+\"\n puts \"\\n*** ADDING ***\"\n add(*get_numbers)\n when \"subtract\", \"-\"\n puts \"\\n*** SUBTRACTING ***\"\n subtract(*get_numbers)\n when \"multiply\", \"*\"\n puts \"\\n*** MULTIPLYING ***\"\n multiply(*get_numbers)\n when \"divide\", \"/\"\n puts \"\\n*** DIVIDING ***\"\n divide(*get_numbers)\n else\n puts \"\\nERROR, please enter one operator(name or symbol)\"\n print \"=> \"\n valid_operation(gets.chomp)\n end\n \nend", "def add\n# ask for some input , after the text\n#turn those input into a float . and saves it in some variable\n print 'what is your first number?'\n first_number = gets.to_f\n print 'what is your second number?'\n second_number = gets.to_f\n\n # add the two inputs given together and save result\n result = first_number + second_number\n\n# pritn these things out\n puts \"The result is #{result}\"\nend", "def basic_calc\n\tprint \"(a)dd, (s)ubtract, (m)ultiply, (d)ivide:\" \n\tuser_input = gets.chomp\nif user_input == \"a\"\n\tadd\nelsif user_input == \"s\"\n\tsubtract\nelsif user_input == \"m\"\n\tmultiply\nelsif user_input == \"d\"\n\tdivide\n\tend\nend", "def calculator()\n puts \"What would you like to do?\"\n res = gets.chomp\n puts \"First number\"\n first = gets.chomp.to_f\n puts \"Second number\"\n second = gets.chomp.to_f\n if res == \"add\"\n first += second\n elsif res == \"sub\"\n first -= second\n elsif res == \"mult\"\n first *= second\n elsif res == \"div\"\n first /= second\n else \"Please provide correct\"\n end\n puts \"Your result is %s\" % first\nend", "def mult_operation()\n print_message \"Write number and press ENTER to multiply more or press 'r' to show result\"\n result = 0\n mult = gets.chomp\n if mult != 'r'\n result = mult.to_i\n end\n begin\n begin\n mult = gets.chomp\n if mult != 'r'\n result *= mult.to_i\n end\n rescue StandardError => e\n print_error_message \"Invalid number. Ending Multiplication operation.\\n#{e.message}\"\n mult = 'r'\n end\n end while mult.downcase != 'r'\n print_message \"Result of multiplying: #{result.to_s}\"\n end", "def calc\n# print \"Please select (a)dd, (s)ubtract, (m)ultiply, (d)ivide, (p)ower, or (s)quare root: \"\n# operation = gets.chomp.downcase\n case response\n when \"a\"\n \tputs \"You have selected addition. Please enter the first number: \"\n \tnum1 = gets.chomp.to_f\n \tputs \"Please enter the second number: \"\n \tnum2 = gets.chomp.to_f\n \tans = num1 + num2\n \tputs \"#{num1} plus #{num2} equals #{ans}.\"\n when \"s\"\n \tputs \"You have selected subtraction. Please enter the first number: \"\n \tnum1 = gets.chomp.to_f\n \tputs \"Please enter the second number: \"\n \tnum2 = gets.chomp.to_f\n \tans = num1 - num2\n \tputs \"#{num1} minus #{num2} equals #{ans}.\"\n when \"m\"\n \tputs \"You have selected multiplication. Please enter the first number: \"\n \tnum1 = gets.chomp.to_f\n \tputs \"Please enter the second number: \"\n \tnum2 = gets.chomp.to_f\n \tans = num1 * num2\n \tputs \"#{num1} multiplied by #{num2} equals #{ans}.\"\n when \"d\"\n \tputs \"You have selected division. Please enter the first number: \"\n \tnum1 = gets.chomp.to_f\n \tputs \"Please enter the second number: \"\n \tnum2 = gets.chomp.to_f\n \tans = num1 / num2\n \tputs \"#{num1} divided by #{num2} equals #{ans}.\"\n when \"p\"\n \tputs \"You have selected power. Please enter the first number: \"\n \tnum1 = gets.chomp.to_f\n \tputs \"Please enter the power which you would like that to be raised: \"\n \tnum2 = gets.chomp.to_f\n \tans = num1**num2\n \tputs \"#{num1} to the power of #{num2} equals #{ans}.\"\n when \"s\"\n \tputs \"You have selected square root. Please enter the number you would like to know the square root of: \"\n \tnum1 = gets.chomp.to_f\n \tans = Math.sqrt(num1)\n \tputs \"The square root of #{num1} equals #{ans}.\"\n else\n \tputs \"Please try again.\"\n \tcalc\n end\nend", "def user_input\n\tuser_selection = gets.strip.to_i\n\tinput_logic(user_selection)\nend", "def single_input_calc\n puts \"What would you like to calculate? - enter first number then operator then second number.\"\n to_calc = gets.strip\n arr = to_calc.split\n first_num = arr[0].to_i\n op = arr[1].to_s\n second_num = arr[2].to_i\n string_result = first_num.public_send(op, second_num)\n puts \"The result is: #{string_result}\"\n @arr_results << {first_number: first_num, modifier: op, second_number: second_num, result: string_result}\n end", "def calculator()\n\n\tputs \"What kind of operation would you like to do - addition, substraction, multiplication, division\"\n\tchoice = gets.chomp\n\n\tputs \"What is number 1\"\n\tnum_1 = gets.chomp.to_f\n\n\tputs \"What is number 2\"\n\tnum_2 = gets.chomp.to_f\n\n\tcase choice\n\t\twhen \"addition\"\n\t\t\ttotal = num_1 + num_2\n\t\t\tputs \"Your result is #{total}\"\n\t\twhen \"substraction\"\n\t\t \ttotal = num_1 - num_2\n\t\t\tputs \"Your result is #{total}\"\n\t\twhen \"multiplication\"\n\t\t \ttotal = num_1 * num_2\n\t\t\tputs \"Your result is #{total}\"\n\t\telse\n\t\t \ttotal = num_1 / num_2\n\t\t\tputs \"Your result is #{total}\"\n\tend\nend", "def calculator\n puts \"Welcome to the DPL Ruby Calculator!\"\n puts \"Type 'clear' to clear the calculator at anytime\"\n puts \"Type 'exit' to exit the calculator at anytime\"\n first_number\n get_modifier\n second_number\n put_result \nend", "def user_num\n loop do\n prompt(MESSAGES['number_request'])\n num1 = Kernel.gets().chomp()\n num2 = Kernel.gets().chomp()\n if number?(num1) && number?(num2)\n return num1, num2\n else\n prompt(MESSAGES['invalid_numbers'])\n end\n end\nend", "def ask_user\n puts 'enter a number:'\n input = gets.chomp.to_i\n check_num(input)\n end", "def basic_calc\n print \"(a)dd, (s)ubtract, (m)ultiply, (d)ivide: \"\n option_2 = gets.chomp.downcase\n\n if option_2 == \"a\"\n print \"Please enter a number: \"\n number_1 = gets.chomp.to_i\n print \"Please enter a second number to add: \"\n number_2 = gets.chomp.to_i\n puts \"Result: #{number_1} + #{number_2} = #{number_1 + number_2}\"\n elsif option_2 == \"s\"\n print \"Please enter a number: \"\n number_1 = gets.chomp.to_i\n print \"Please enter a second number to subtract: \"\n number_2 = gets.chomp.to_i\n puts \"Result: #{number_1} - #{number_2} = #{number_1 - number_2}\"\n elsif option_2 == \"m\"\n print \"Please enter a number: \"\n number_1 = gets.chomp.to_i\n print \"Please enter a second number to multiply: \"\n number_2 = gets.chomp.to_i\n puts \"Result: #{number_1} x #{number_2} = #{number_1 * number_2}\"\n elsif option_2 == \"d\"\n print \"Please enter a number: \"\n number_1 = gets.chomp.to_i\n print \"Please enter a second number to divide: \"\n number_2 = gets.chomp.to_i\n puts \"Result: #{number_1} ÷ #{number_2} = #{number_1 / number_2}\"\n else\n puts \"That is not a valid option. Please try again.\"\n end\n\nend", "def add\n # ask for some inputs, after some text.\n # turn those inputs into a float, and saves it in some variable.\n print \"What is your first number?\"\n first_number = gets.to_f\n\n print \"What is your second number?\"\n second_number = gets.to_f\n\n # add the two inputs given together and save the result.\n result = first_number + second_number\n\n # Print these things out ot the screen\n puts \"The result is #{result}\"\nend", "def basic_calc\n print \"(a)dd, (s)ubtract, (m)ultiply, (d)ivide: \"\n operation = gets.chomp.downcase\n print \"first number: \"\n a = gets.to_f\n print \"second number: \"\n b = gets.to_f\n \n case operation\n when 'a'\n puts \"#{a + b}\"\n when 's'\n puts \"#{a - b}\"\n when 'm'\n puts \"#{a * b}\"\n when 'd'\n puts \"#{a / b}\"\n else\n puts \"WRONG!!!!!\"\n basic_calc\n end\n\n gets\nend", "def operation_select\n puts \"Which operator would you like to use?\"\n puts \"1. add(+)\"\n puts \"2. subtract(-)\"\n puts \"3. multiply(*)\"\n puts \"4. divide(/)\"\n puts \"5. power(^)\"\n puts \"6. modulo(%)\"\n puts \"Please choose one operator (type name or symbol):\"\n operation = gets.chomp\n numeric_input(operation)\nend", "def request_calculation_type\n puts \"Type 1 to add, 2 to subtract, 3 to multiply, 4 to divide, 5 to power to, or 6 for modulus calculation : \"\n operation_selection = gets.to_i\n\n if operation_selection == 1\n \"add\"\n elsif operation_selection == 2\n \"subtract\"\n elsif operation_selection == 3\n \"multiply\"\n elsif operation_selection == 4\n \"divide\"\n elsif operation_selection == 5\n \"exponent\"\n elsif operation_selection == 6\n \"modulus\"\n else\n \"error\"\n end\nend", "def basic_calc\n puts Rainbow(\"(a)dd, (s)ubtract, (m)ultiply, (d)ivide\").yellow.inverse\n arithmetic_type = gets.chomp.downcase\n\n case arithmetic_type\n \n when 'a' \n puts \"whats your first number?\"\n response_1 = gets.strip.to_f \n puts \"whats your second number?\"\n response_2 = gets.strip.to_f\n result = response_1 + response_2\n puts \"#{response_1}+#{response_2} = #{result}\"\n\n when 's' \n puts \"whats your first number?\"\n response_1 = gets.strip.to_f \n puts \"whats your second number?\"\n response_2 = gets.strip.to_f\n result = response_1 - response_2\n puts \"#{response_1}-#{response_2} = #{result}\"\n when 'm' \n puts \"whats your first number?\"\n response_1 = gets.strip.to_f \n puts \"whats your second number?\"\n response_2 = gets.strip.to_f\n result = response_1 * response_2\n puts \"#{response_1}*#{response_2} = #{result}\"\n when 'd' \n puts \"whats your first number?\"\n response_1 = gets.strip.to_f \n puts \"whats your second number?\"\n response_2 = gets.strip.to_f\n result = response_1 / response_2\n puts \"#{response_1}/#{response_2} = #{result}\"\n\nend\nend", "def add_operation()\n print_message \"Write number and press ENTER to add more or press 'r' to show result\"\n result = 0\n add = gets.chomp\n if add != 'r'\n result = add.to_i\n end\n begin\n begin\n add = gets.chomp\n if add != 'r'\n result += add.to_i\n end\n rescue StandardError => e\n print_error_message \"Invalid number. Ending Add operation.\\n#{e.message}\"\n add = 'r'\n end\n end while add.downcase != 'r'\n print_message \"Result of adding: #{result.to_s}\"\n end", "def input\n\tputs 'What sorta math do ya wanna do?'\n\tputs '1 for addition'\n\tputs '2 for subtraction'\n\tputs '3 for multiplication'\n\tputs '4 for division'\n\tputs '5 for exponent'\n\tputs '6 for squaring'\n\tputs '7 for cubing'\n\tputs '8 for square rooting'\n\tgets.chomp.to_i\nend", "def basic_calc\n print Rainbow(\"\\n(a)dd, (s)ubtract, (m)ultiply, (d)ivide: \\n\").yellow\n basic_choice = gets.chomp.downcase\n\n print \"\\nEnter your first number: \" \n first_number = gets.to_f\n print \"\\nEnter your second number: \"\n second_number = gets.to_f\n\n\n case basic_choice[0]\n when \"a\"\n print \"\\n\\t#{first_number} + #{second_number} = \", first_number + second_number, \"\\n\"\n when \"s\"\n print \"\\n\\t#{first_number} - #{second_number} = \", first_number - second_number, \"\\n\"\n when \"m\"\n print \"\\n\\t#{first_number} * #{second_number} = \", first_number * second_number, \"\\n\"\n when \"d\"\n print \"\\n\\t#{first_number} / #{second_number} = \", first_number / second_number, \"\\n\"\n else Rainbow(\"\\nYou're doing it wrong!\".upcase).red\n end\n gets\nend", "def menu\n puts \"______Calculator_______\"\n puts \"\\t1) Enter first number\"\n puts \"\\t2) Enter modifier\"\n puts \"\\t3) Enter second number\"\n puts \"\\t4) The result is:\"\n return gets.strip.to_i\nend", "def add_or_multiply\n\tputs \"Select a number between 1 and 25\"\n\tinput = gets.chomp.to_i\n\tputs \"Great, now would you like me to add or multiply?\"\n\tarithmetic = gets.chomp.downcase\n\n\tif arithmetic == \"add\"\n\t\tputs \"Everything added up equals... \" \n\t\tsleep(0.5)\n\t\tputs (1..input).inject(:+)\n\telsif arithmetic == \"multiply\"\n\t\tputs \"Everything multiplied together equals...\"\n\t\tsleep(0.5)\n\t\tputs (1..input).inject(:*)\n\tend\n\tagain\nend", "def add_function \n\tputs \"Enter the numbers\"\n\tn1 = gets.to_i\n\tn2 = gets.to_i\n\tputs \"The sum is #{n1+n2}\"\nend", "def do_math(num1, num2)\n prompt_string = PROMPT + \" 1)add 2)subtract 3)multiply 4)divide\"\n puts prompt_string\n action = gets.chomp\n \n # boolean flag to determine if we need to continue\n # in the loop or drop out. false continues\n done = false\n \n # loop until the user performs a valid action or enters 'q' to quit\n # provides Infinity or -Infinity as appropriate for division by zero\n begin\n case action\n when '1'\n puts PROMPT + \"#{num1} added to #{num2} = \" + (num1 + num2).to_s\n done = true\n when '2'\n puts PROMPT + \"#{num1} minus #{num2} = \" + (num1 - num2).to_s\n done = true\n when '3'\n puts PROMPT + \"#{num1} times #{num2} = \" + (num1 * num2).to_s\n done = true \n when '4' #watch out for divide by zero\n if( (num2 == 0 || num2 == 0.0) && num1 >= 0 )\n puts PROMPT + \"#{num1} divided by #{num2} = Infinity\"\n elsif( (num2 == 0 || num2 == 0.0) && num1 < 0 )\n puts PROMPT + \"#{num1} divided by #{num2} = -Infinity\"\n elsif( (num1%num2) != 0 )\n puts PROMPT + \"#{num1} divided by #{num2} = \" + (num1/num2.to_f).to_s\n else\n puts PROMPT + \"#{num1} divided by #{num2} = \" + (num1/num2).to_s\n end\n done = true\n when 'q'\n puts PROMPT + \" Bye.\"\n exit\n else\n puts PROMPT + \"Invalid operation selected. Please try again or [q] to quit\"\n puts prompt_string\n action = gets.chomp\n end\n end while done == false\nend", "def multiplication\n\tputs \"which numbers would you like to multiply\"\n\tmult_number_1 = gets.chomp\n\tmult_number_2 = gets.chomp\n\tputs mult_number_1.to_f * mult_number_2.to_f\nend", "def div_operation()\n print_message \"Write number and press ENTER to divide more or press 'r' to show result\"\n result = 0\n div = gets.chomp\n if div != 'r'\n result = div.to_f\n end\n begin\n begin\n div = gets.chomp\n if div != 'r'\n result /= div.to_f\n end\n rescue StandardError => e\n print_error_message \"Invalid number. Ending Division operation.\\n#{e.message}\"\n div = 'r'\n end\n end while div.downcase != 'r'\n print_message \"Result of dividing: #{result.to_s}\"\n end", "def calculator\n end_op = \"addition\"\n end_product = 0\n puts \"What is your first number?\"\n numb1 = gets.chomp.to_f\n puts \"What is your operation?\"\n op = gets.chomp\n puts \"What is your second number?\"\n numb2 = gets.chomp.to_f\n puts \"Would you like to add an operation?\"\n add_second = gets.chomp.capitalize\n if add_second.upcase == \"YES\"\n puts \"What is your operation?\"\n op2 = gets.chomp\n puts \"What is your third number?\"\n numb3 = gets.chomp.to_f\n# calculator\n else\n end\n\n # This is normalizing the input, so that the operation is only the lowercase word of the op\n if op == \"+\" || op == \"addition\"\n end_op = \"addition\"\n elsif op == \"-\" || op == \"subtraction\"\n end_op = \"subtraction\"\n elsif op == \"*\" || op == \"multiplication\"\n end_op = \"multiplication\"\n elsif op == \"/\" || op == \"division\"\n end_op = \"division\"\n end\n\n # This does the same as the above section, for the 2nd op\n if op2 == \"+\" || op == \"addition\" || op == \"ADDITION\"\n end_op2 = \"addition\"\n elsif op2 == \"-\" || op == \"subtraction\" || op == \"SUBTRACTION\"\n end_op2 = \"subtraction\"\n elsif op2 == \"*\" || op == \"multiplication\" || op == \"MULTIPLICATION\"\n end_op2 = \"multiplication\"\n elsif op2 == \"/\" || op == \"division\" || op == \"DIVISION\"\n end_op2 = \"division\"\n end\n\n # This operates the first 2 numbers\nif end_op == \"addition\"\n end_product = numb1 + numb2\n elsif end_op == \"subtraction\"\n end_product = numb1 - numb2\n elsif end_op == \"multiplication\"\n end_product = numb1 * numb2\n elsif end_op == \"division\"\n end_product = numb1 / numb2\nend\n\n # This calculates for the 2nd operation and 3rd number\n if add_second.upcase == \"YES\"\n if end_op2 == \"addition\"\n end_product = end_product + numb3\n elsif end_op2 == \"subtraction\"\n end_product = end_product - numb3\n elsif end_op2 == \"multiplication\"\n end_product = end_product * numb3\n elsif end_op2 == \"division\"\n end_product = end_product / numb3\n else\nend\nend\n puts \"Your final answer is #{end_product}.\"\nend", "def add\n print \"What is the first number? \"\n first_number = gets.to_f\n\n print \"What is the second number? \"\n second_number = gets.to_f\n\n result = first_number + second_number\n\n puts \"The results is #{result}.\"\nend", "def basic_calc\n print \"(a)dd, (s)ubtract, (m)ultiply, (d)ivide: \"\n command = gets.chomp.downcase\n case command\n when \"a\"\n puts \"Adding, please provide numbers\"\n first_num = inputs\n answer = inputs + first_num\n when \"s\"\n puts \"Subtracting\"\n first_num = inputs\n answer = first - inputs\n when \"m\"\n puts \"Multiplication\"\n first_num = inputs\n answer = first_num * inputs\n when \"d\"\n puts \"Division\"\n first_num = inputs\n answer = first_num/inputs\n else\n print \"(a)dd, (s)ubtract, (m)ultiply, (d)ivide: \"\n command = gets.chomp.downcase\n end\n return answer\nend", "def sum_or_product\n puts \"Enter a number greater than zero:\"\n num = gets.chomp.to_i\n\n puts \"Would you like to determine the sum or product of number from 1 to #{num}?\"\n operation = gets.chomp\n\n if operation == 'sum'\n (1..num).inject { |mem, num| mem + num }\n elsif operation == 'product'\n (1..num).inject { |mem, num| mem * num }\n else\n \"Invalid response\"\n end\nend", "def calc(num1, mathop, num2)\n if mathop == \"+\"\n return num1 + num2\n elsif mathop == \"-\"\n return num1 - num2\n elsif mathop == \"*\"\n return num1 * num2\n elsif mathop == \"/\"\n return num1 / num2\n else\n return \"I did not recognize your input, please try again.\"\n end\nend", "def calculator\n\tputs \"Would you like to use this calculator to 'add', 'subtract', 'multiply' or 'divide'?\"\n\n\tchoice = gets.chomp\n\n\tcase choice\n\t\twhen \"add\"\n\t\t\tputs \"What's your first number to add?\"\n\t\t\tnum1 = gets.chomp.to_f\n\t\t\tputs \"What's your second number to add?\"\n\t\t\tnum2 = gets.chomp.to_f\n\t\t\tnum3 = num1 + num2\n\t\t\tputs \"#{num1} + #{num2} = #{num3}\"\n\t\twhen \"subtract\"\n\t\t\tputs \"What's your first number to subtract?\"\n\t\t\tnum1 = gets.chomp.to_f\n\t\t\tputs \"What's your second number to subtract?\"\n\t\t\tnum2 = gets.chomp.to_f\n\t\t\tnum3 = num1 - num2\n\t\t\tputs \"#{num1} - #{num2} = #{num3}\"\n\t\twhen \"multiply\"\n\t\t\tputs \"What's your first number to multiply?\"\n\t\t\tnum1 = gets.chomp.to_f\n\t\t\tputs \"What's your second number to multiply?\"\n\t\t\tnum2 = gets.chomp.to_f\n\t\t\tnum3 = num1 * num2\n\t\t\tputs \"#{num1} * #{num2} = #{num3}\"\n\t\twhen \"divide\"\n\t\t\tputs \"What's your first number to divide?\"\n\t\t\tnum1 = gets.chomp.to_f\n\t\t\tputs \"What's your second number to divide?\"\n\t\t\tnum2 = gets.chomp.to_f\n\t\t\tnum3 = num1 / num2\n\t\t\tputs \"#{num1} / #{num2} = #{num3}\"\n\t\telse\n\t\t\tputs \"check yo spelling foo ... I said enter 'add', 'subtract', 'multiply' or 'delete':\"\n\t\t\tcalculator\n\tend\nend", "def basic_calculator \n\tputs \"Welcome to the basic calculator.\"\n\tputs \"Please select your operation:\"\n\tputs \"(a) - addition\"\n\tputs \"(s) - subtraction\"\n\tputs \"(d) - division\"\n\tputs \"(m) - multiplication\"\n\n\toperation = gets.chomp\n\tputs \"Enter your first number\"\n\tnum_1 = gets.chomp.to_f\n\tputs \"Enter your second number\"\n\tnum_2 = gets.chomp.to_f\n\n\tcase operation\n\twhen 'a'\n\t\tadd num_1, num_2\n\twhen 's'\n\t\tsubtract num_1, num_2\n\twhen 'd'\n\t\tdivide num_1, num_2\n\twhen 'm'\n\t\tmultiply num_1, num_2\n\tend\nend", "def add()\n puts \"{what numbers do yu want to add?\"\n num1 = gets.chomp\n num2 = gets.chomp\n result =@num1 + @num2\n puts \"your answer is {result = @num1 + @num2}\"\n end", "def basic_calculator\n\tputs \"Welcome to the basic calculator\"\n\tputs \"Please select your operation\"\n\tputs \"(a) - addition\"\n\tputs \"(s) - substraction\"\n\tputs \"(d) - division\"\n\tputs \"(m) - multiplication\"\n\n\toperation = gets.chomp\n\tputs \"Enter your first number\"\n\tnum1 = gets.chomp.to_f\n\tputs \"Enter your second number\"\n\tnum2 = gets.chomp.to_f\n\n\tcase operation \n\twhen 'a'\n\t\tadd num1, num2\n\twhen 's'\n\t\tsubstract num1, num2\n\twhen 'd'\n\t\tdivide num1, num2\n\twhen 'm'\n\t\tmultiply num1, num2\n\tend\nend", "def calculations (operator, num1, num2)\n case operator\n when \"addition\", \"add\", \"+\"\n results = num1 + num2\n puts \"Your answer is: \" + results.to_s\n when \"subtraction\", \"subtract\", \"-\"\n results = num1 - num2\n puts \"Your answer is: \" + results.to_s\n when \"multiplication\", \"multiply\", \"*\"\n results = num1 * num2\n puts \"Your answer is: \" + results.to_s\n when \"division\", \"divide\", \"/\"\n #check to see if user is trying to divide by 0\n if num2 == 0\n #if num2 is 0, then tell user, not possible. That's rude and exit program. \n puts \"Looks like you're trying to divide by 0. You know that's mean. BYE BYE FELICIA!\"\n exit \n #else calculate \n results = num1 / num2\n puts \"Your answer is: \" + results.to_s\n end \n end \nend", "def basic_calculator\n\tputs \"Welcome to the basic calculator.\"\n\tputs \"Please select your operation.\"\n\tputs \"(a) is for addition\"\n\tputs \"(s) is for subtraction\"\n\tputs \"(d) is for division\"\n\tputs \"(m) is for multiplicaiton\"\n\n\toperation = gets.chomp\n\tputs \"Enter your first number\"\n\tnum1 = gets.chomp.to_f\n\tputs \"Enter your second number\"\n\tnum2 = gets.chomp.to_f\n\n\tcase operation\n\twhen 'a'\n\t\tadd num1, num2\n\twhen 's'\n\t\tsubract num1, num2\n\twhen 'd'\n\t\tdivide num1, num2\n\twhen 'm'\n\t\tmultiply num1, num2\n\tend\nend", "def always\n print \"Give me a number: \"\n number = gets.chomp.to_i\n puts ((number+5)*2-4)/2\nend", "def multiply\n puts \"enter first number \"\n a = gets.to_f\n puts \"enter second numb4\ner\"\n b = gets.to_f\n result = a * b\n puts result\nend", "def division(input_number1, input_number2)\n\tquotient = input_number1 / input_number2\n\tputs \"The quotient of #{input_number1} and #{input_number2}th is #{quotient}.\"\n\tputs \"Thank you for using the calculator. Goodbye!\"\nend", "def basic_calc\n\n\n print Rainbow(\"(a)\").green + \"dd, \" + Rainbow(\"(s)\").yellow + \"ubtract, \" + Rainbow(\"(m)\").red + \"ultiply, \" + Rainbow(\"(d)\").cyan + \"ivide: \"\n basic_function = gets.chomp.downcase\n print \"Enter first number: \"\n first_number = gets.chomp.to_f\n print \"Enter second number: \"\n second_number = gets.chomp.to_f\n case basic_function\n when \"a\"\n answer = first_number + second_number\n puts \"Your answer is #{answer}\"\n when \"s\"\n answer = first_number - second_number\n puts \"Your answer is #{answer}\"\n when \"m\"\n answer = first_number * second_number\n puts \"Your answer is #{answer}\"\n when \"d\"\n answer = first_number / second_number\n puts \"Your answer is #{answer}\"\n \n else\n puts \"incorrect\"\n end \n gets\n menu\nend", "def basic_calc\n\n\n print Rainbow(\"(a)\").green + \"dd, \" + Rainbow(\"(s)\").yellow + \"ubtract, \" + Rainbow(\"(m)\").red + \"ultiply, \" + Rainbow(\"(d)\").cyan + \"ivide: \"\n basic_function = gets.chomp.downcase\n print \"Enter first number: \"\n first_number = gets.chomp.to_f\n print \"Enter second number: \"\n second_number = gets.chomp.to_f\n case basic_function\n when \"a\"\n answer = first_number + second_number\n puts \"Your answer is #{answer}\"\n when \"s\"\n answer = first_number - second_number\n puts \"Your answer is #{answer}\"\n when \"m\"\n answer = first_number * second_number\n puts \"Your answer is #{answer}\"\n when \"d\"\n answer = first_number / second_number\n puts \"Your answer is #{answer}\"\n \n else\n puts \"incorrect\"\n end \ngets\nend", "def addition(input_number1, input_number2)\n\tsum = input_number1 + input_number2\n\tputs \"The sum of #{input_number1} and #{input_number2} is #{sum}\"\n\tputs \"Thank you for using the calculator. Goodbye!\"\nend", "def formula\n print \"Enter first number: \"\n @first_num = gets.chomp.to_f\n print \"Enter second number: \"\n @second_num = gets.chomp.to_f\nend", "def advanced_calculator_type\n print \"What would you like to do? Type 1 to find exponents or 2 to find the square root of a number: \"\n selection = gets.to_i\n # puts \"You chose #{selection}\"\n if selection == 1\n \"exponents\"\n elsif selection == 2\n \"square root\"\n else\n \"error\"\n end\nend", "def calculate\n \t@num1 = params[:num1].to_i\n \t@num2 = params[:num2].to_i\n\n \tif params[:addition] then\n @result = @num1 + @num2\n elsif params[:subtraction] then\n @result = @num1 - @num2\n elsif params[:multiplication] then\n @result = @num1 * @num2\n elsif params[:division] then\n @result = @num1/@num2\n else\n \trender \"errorhandling\"\n \tflash[:error] = \"Couldn't calculate!\"\n end\n \t\n end", "def get_input\n puts \"Please enter the 10 digit number :\"\n form_words gets.chomp\n end", "def basic_calculator\n puts \"Welcome to the basic calculator\"\n puts \"Please select your operation\"\n puts \"(a) - addition\"\n puts \"(s) - subtraction\"\n puts \"(d) - division\"\n puts \"(m) - multiplication\"\n\n operation = gets.chomp\n puts \"Enter your first number\"\n num1 = gets.chomp.to_f\n puts \"Enter your second number\"\n num2 = gets.chomp.to_f\n\n case operation\n when 'a'\n add num1, num2\n when 's'\n subtract num1, num2\n when 'd'\n divide num1, num2\n when 'm'\n multiply num1, num2\n end\nend", "def main\n # determine whether to use verbose outpuut\n verbose = false\n if ARGV[0] != nil and ARGV[0].downcase == \"-v\"\n verbose = true\n end\n\n # get input\n puts \"Instructions: enter a mathematical expression using +, -, *, /, **, or (q)uit\"\n puts \"Calculator follows order of operations\"\n puts \"All elements must be separated by spaces\"\n puts \"e.g. ( 4 + 5 ) * 6\"\n print \"Enter an expression: \"\n expr = STDIN.gets.strip\n\n # continue calculating expressions until user quits\n until expr.downcase.start_with?(\"q\")\n # send to calc() and print result\n result = calc(expr, verbose)\n\n if result == nil\n puts \"Please enter a valid expression\"\n puts \"Common error: all elements should be separated by spaces\"\n elsif result % 1 == 0 # print int if result is integer\n puts result.to_i\n else\n puts result\n end\n\n print \"enter another expression, or (q)uit: \"\n expr = STDIN.gets.strip\n end\nend", "def get_user_choice\n #show the available operations\n puts \"(+) - Addition\"\n puts \"(-) - Substraction\"\n puts \"(/) - Division\"\n puts \"(*) - Multiple\"\n puts \"(**) - Exponents\"\n puts \"(sr) - Square Root\"\n puts \"(q) - Quit\"\n\n print \"Enter your selection: \"\n gets.downcase.chomp\nend", "def basic_calc ()\n print \"Please choose from the following options:\n(a)dd, (s)ubtract, (m)ultiply, (d)ivide, (r)eturnt to main menu : \"\n basic_menu_request = gets.chomp.downcase\n case basic_menu_request\n when \"a\"\n print \"What is the first number? \"\n first = gets.chomp.to_f\n print \"What is the second number? \"\n second = gets.chomp.to_f\n answer = first + second\n puts \"The answer is #{answer}\"\n when \"s\"\n print \"What is the first number? \"\n first = gets.chomp.to_f\n print \"What is the second number? \"\n second = gets.chomp.to_f\n answer = first - second\n puts \"The answer is #{answer}\"\n when \"m\"\n print \"What is the first number? \"\n first = gets.chomp.to_f\n print \"What is the second number? \"\n second = gets.chomp.to_f\n answer = first * second\n puts \"The answer is #{answer}\"\n when \"d\"\n print \"What is the first number? \"\n first = gets.chomp.to_f\n print \"What is the second number? \"\n second = gets.chomp.to_f\n answer = first / second\n puts \"The answer is #{answer}\"\n when \"r\"\n puts menu\n else\n print \"That is not a valid command. \"\n puts basic_calc\n end\n\nend", "def basic_calc\n print \"(a)dd, (s)ubtract, (m)ultiply, (d)ivide: \"\n user_input = gets.chomp.downcase\n # \"return user_input\" is implied (Ruby methods ALWAYS returns the last expression)\nend", "def input_process (*args)\n if(args.size == 1)\n input = args[0]\n operation = input.initial\n elsif(args.size == 2)\n input = args[1]\n operation = input[0]\n else\n return\n end\n \n total = get_numbers(input, operation)\n\n if operation == \"+\"\n $totalvalue += addition(*total)\n elsif operation == \"-\"\n $totalvalue += subtraction(*total)\n elsif operation == \"*\"\n $totalvalue = multiplication($totalvalue, *total)\n elsif operation == \"/\"\n $totalvalue = division($totalvalue, *total)\n end\n total.clear\nend", "def sum_difference_product\n # your code goes here\n\n user_response = gets\n\n puts \"#{user_response}\"\n\na = user_response.split(\" \")[0].to_i\nb = user_response.split(\" \")[1].to_i\n\nputs \"#{a+b}\" + \"\\n\" + \"#{a-b}\" + \"\\n\" + \"#{a*b}\" + \"\\n\"\n\nend", "def q1_get_num\n puts \"Enter a number please: \"\n gets.to_i\nend", "def format_userinput_not_including_division(valid_operators, num_1, num_2, user_input)\n if num_1 =~ /^(\\d)*\\.(\\d)+$/\n num_1 = num_1.to_f\n user_input[:num_1] = num_1\n elsif num_1 =~ /^(\\d)+$/\n num_1 = num_1.to_i\n user_input[:num_1] = num_1\n else\n puts \"Whoa nelly! It looks like you entered something other than a number.\"\n exit\n end\n if num_2 =~ /^(\\d)*\\.(\\d)+$/\n num_2 = num_2.to_f\n user_input[:num_2] = num_2\n elsif num_2 =~ /^(\\d)+$/\n num_2 = num_2.to_i\n user_input[:num_2] = num_2\n else\n puts \"Whoa nelly! It looks like you entered something other than a number.\"\n exit\n end\nend", "def product_sign\n puts \"enter an integer\"\n num1 = gets.to_i\n puts \"enter an integer\"\n num2 = gets.to_i\n puts \"enter an integer\"\n num3 = gets.to_i\n\n product = num1 * num2 * num3\n\n if product > 0\n puts \"product is +\"\n elsif product < 0\n puts \"product is - \"\n else\n puts \"product is zero\"\n end\n\nend", "def format_userinput_for_division(operator, valid_operators, num_1, num_2, user_input)\n if num_1 =~ /^(\\d)+$/ && num_2 =~ /^(\\d)+$/\n unless divide_by_zero(num_2.to_i)\n exit\n end\n modulo = (num_1.to_i % num_2.to_i)\n if modulo != 0\n result = (num_1.to_f / num_2.to_f)\n return result\n else\n format_userinput_not_including_division(valid_operators, num_1, num_2, user_input)\n result = division(user_input[:num_1], user_input[:num_2])\n return result\n end\n else\n format_userinput_not_including_division(valid_operators, num_1, num_2, user_input)\n result = division(user_input[:num_1], user_input[:num_2])\n return result\n end\nend", "def basic_calc\n puts \"Give me two numbers\"\n print \"> first:\"\n first = gets.chomp.to_i\n print \"> second:\"\n second = gets.chomp.to_i\n\n #print \"(a)dd, (s)ubtract, (m)ultiply, (d)ivide:\"\n case $selection\n when \"add\"\n puts \"\\nanswer: #{first + second}\"\n when \"subtract\"\n puts \"\\nanswer: #{first - second}\"\n when \"multiply\"\n puts \"\\nanswer: #{first * second}\"\n when \"divide\"\n puts \"\\nanswer: #{first.to_f / second.to_f} \"\n else\n puts \"\\nOh crap...how'd that happen...\"\n puts \"I guess you never told me what maths to do...EMBARASSING\\n\\n\"\n end\n\nend", "def basic_calc\n print \"(a)dd, (s)ubtract, (m)ultiply, (d)ivide: \"\n basic_menu_choice = gets.chomp.downcase\n\n if basic_menu_choice == 'a'\n \tputs \"Enter the first number you want to add:\"\n \tx = gets.chomp.to_i\n \tputs \"Enter the second number you want to add:\"\n \ty = gets.chomp.to_i\n \tputs \"#{x} + #{y} = #{x + y}\"\n\n elsif basic_menu_choice== 's'\n \tputs \"Enter the first number you want to subtract:\"\n \tx = gets.chomp.to_i\n \tputs \"Enter the second number you want to subtract:\"\n \ty = gets.chomp.to_i\n \tputs \"#{x} - #{y} = #{x - y}\"\n\n elsif basic_menu_choice == 'm'\n \tputs \"Enter the first number you want to multiply:\"\n \tx = gets.chomp.to_i\n \tputs \"Enter the second number you want to multiply:\"\n \ty = gets.chomp.to_i\n \tputs \"#{x} x #{y} = #{x * y}\"\n\n elsif basic_menu_choice == 'd'5\n \tputs \"Enter the first number you want to divide:\"\n \tx = gets.chomp.to_i\n \tputs \"Enter the second number you want to divide by:\"\n \ty = gets.chomp.to_i\n \tputs \"#{x} / #{y} = #{x / y}\"\n\n else\n \tputs \"Invalid selection\"\n end\nend", "def add\n puts \"\"\n puts \"what is you forst number\"\n first_num = gets.chomp.to_f\n puts \"what is you forst number\"\n second_num = gets.chomp.to_f\n\n puts \"#{first_num} + #{second_num} = #{first_num+second_num}\"\nend", "def user_picks_an_operation\n puts \"Here's what I can do for you: \\n Add(+) \\n Subtract(-) \\n Multiply(*) \\n Divide(/) \\n Exponentiate(^) \\n Remainder(%) \\nWhich one would you like to do?\"\noperation = gets.chomp\ncase operation.downcase\n when \"add\", \"+\"\n add_it\n when \"subtract\", \"-\"\n subtract_it\n when \"multiply\", \"*\"\n multiply_it\n when \"divide\", \"/\"\n divide_it\n when \"exponentiate\", \"^\"\n exponentiate_it\n when \"remainder\", \"%\"\n modulo_it\n else\n puts \"That's not an available operation! Please try again.\"\n user_picks_an_operation\n end\nend", "def calculator\n\tputs \"Hello and welcome to the calculator. If you do not want to use this application, type exit and click the return key\"\n\tputs \"Would you like to add, subtract, multiply, divide, or use exponents?\"\n\tanswer = gets.chomp\n\tif answer == \"multiply\"\n\t\tmultiplication\n\telsif answer == \"add\"\n\t\taddition\n\telsif answer == \"divide\"\n\t\tdivision\n\telsif answer == \"subtract\"\n\t\tsubtraction\n\telsif answer == \"exponents\"\n\t\texponents\n\telse\n\t\tputs \"I am sorry, that is not a computation. Try re-wording what you said and try again.\"\n\tend\nend", "def numbers()\n puts 'What is the first number: '\n @first_number = gets.to_f\n puts \"What is the second number: \"\n @second_number = gets.to_f\nend", "def basic_calculator_type\n print \"What would you like to do? Type 1 to add, 2 to subtract, 3 to multiply or 4 to divide: \"\n selection = gets.to_i\n # puts \"You chose #{selection}\"\n if selection == 1\n \"add\"\n elsif selection == 2\n \"subtract\"\n elsif selection == 3\n \"multiply\"\n elsif selection == 4\n \"divide\"\n else\n \"error\"\n end\nend", "def add\n# nums()\n puts \"\"\n puts \"What is your first number?\"\n first_num = gets.chomp.to_f\n\n puts \"What is your second number?\"\n second_num = gets.chomp.to_f\n\n result = first_num + second_num\n puts \"#{first_num} + #{second_num} = #{result}\"\nend", "def addition\nprint \"What is your first number? \"\nfirst_num = gets().to_i\n\nprint \"What is the second number? \"\nsecond_num = gets().to_i\n\nresult = first_num + second_num\nputs \"#{first_num} + #{second_num} = #{result}\"\nend", "def prompt_user\n puts \"Please choose a number between 1 and 6\"\nend", "def perform\n puts 'Entrez un nombre :'\n print '> '\n nb = gets.chomp.to_i\n\n puts \"La table de multiplication du chiffre #{nb} est :\"\n \n multiplicationTable(nb).each do |result|\n puts result\n end\nend", "def display_advanced_operators\n puts \"Please select an Advanced operation type: \\n (E)xponent \\n (S)quare root\"\n print \"> \"\n advanced_operation = gets.chomp.downcase\n case advanced_operation\n when 'e'\n puts \"Exponent selected\"\n print \"Please enter the base value that needs to be multiplied: \"\n base = gets.chomp.to_i\n if base > 0\n print \"Please enter the exponent value that needs to be applied to the base: \"\n power = gets.chomp.to_i\n puts \"Total #{base**power}\"\n else\n \"Please enter a value greater than zero for the calculation.\"\n end\n when 's'\n puts \"Square root selected\"\n print \"Please enter a value to determine the square root: \"\n sq_value = gets.chomp.to_f\n puts \"Total #{Math.sqrt(sq_value)}\"\n else\n puts \"I didn't recognise your selection. Please only pick an Advanced operation type: \\n (E)xponent \\n (S)quare root \\n > \"\n end\nend", "def mathy\n print \"what is the first number?\"\n first = gets.chomp.to_i\n\n print \"what is the second number\"\n second = gets.chomp.to_i\n\n puts \"\\n #{first} + #{second} = #{first + second}\\n\n #{first} - #{second} = #{first - second} \\n\n #{first} * #{second} = #{first * second} \\n\n #{first} / #{second} = #{first / second}\"\nend", "def read_and_calculate\n puts 'Insert the equation'\n entry = gets.chomp\n result = calculate(entry)\n puts result\n end", "def get_user_input_for_test\n\t\tno_of_primes = 0\n\t\tprint \"\\n \\t Enter value for the number of primes you want: \"\n\t\tno_of_primes = gets.chomp.to_i\n\t\tif no_of_primes <= 0\n\t\t\tprint \"Please enter a number( > 0 ): \"\n\t\t\tself.no_of_primes = 0\n\t\t\treturn\n\t\tend\n\t\tself.no_of_primes = no_of_primes\n\tend", "def calculate # create calculate function\n begin\n $meters.value = (0.3048*$feet*10000.0).round()/10000.0 # if number has been entered calculate meters from feet if\n rescue\n $meters.value = '' # if no number was entered print nothing\n end\nend", "def Multiplicacion\n print \"Ingrese El numero 1: \"\n numero1 = gets.chomp.to_f\n print \"Ingrese El numeor 2: \"\n numero2 = gets.chomp.to_f\n\n puts \"\\nMultiplicacion: #{numero1 * numero2}\"\n end", "def interact\n begin\n puts 'Welchen Wert wollen Sie umrechnen? [Bsp:100km]'\n puts \"Erlaubte Einheiten: #{@all_units}\"\n first_input = next_input\n until valid_first_input?(first_input)\n puts 'Ungueltige Eingabe. Bitte erneut versuchen [Bsp:50 mm]'\n puts \"Erlaubte Einheiten: #{@all_units}\"\n first_input = next_input\n end\n num = (first_input[/[-\\d.]+/]).to_f\n unit_from = (first_input[/[a-z]+.*/])\n @converter.category!(unit_from)\n\n puts 'Was ist die Zieleinheit, zu der Sie umrechnen wollen?'\n puts \"Erlaubte Einheiten: #{allowed_units}\"\n second_input = next_input\n until valid_second_input?(second_input)\n puts 'Ungueltige Eingabe. Bitte erneut versuchen'\n puts \"Erlaubte Einheiten: #{allowed_units}\"\n second_input = next_input\n end\n unit_to = second_input\n result = @converter.convert(num, unit_from, unit_to)\n if result\n puts \"#{num} #{unit_from} = #{result} #{unit_to}\"\n else\n puts \"Kann nicht von #{unit_from} zu #{unit_to} konvertieren\"\n end\n puts 'Wollen Sie eine andere Konversion machen? [j/ja/nein/n]'\n end while %w[ja j].include?(next_input)\n end", "def sum_or_product\n multiply = 1\n p \">> Please enter an integer greater than 0:\"\n number = gets.chomp.to_i\n p \">> Enter 's' to compute the sum, 'p' to compute the product.\"\n operation = gets.chomp\n if operation == \"s\"\n\n puts \"The sum of the integers between 1 and #{number} is #{(1..number).sum}\"\n elsif operation == \"p\"\n (1..number).each { |num| multiply*=num}\n multiply\n puts \"The product of the integers between 1 and #{number} is #{multiply}\"\n end\nend", "def menu\n puts \"Please type the menu number for the calculation you'd like to perfrom: \"\n puts \" Put 1 for Basic calculator and 2 for Advanced calculator\"\n calculator = gets.chomp.to_i\n\n\n if calculator == 1\n basic_calc\n else calculator == 2\n advanced_calc\n end\nend", "def get_one_number\n\tputs \"What number would you like to use?\"\n # all methods requiring one arg return floats except factorial_calc\n $num1 = gets.chomp.to_f\nend", "def add\n # Ask for some inputs, after some text\n # Turn those inputs into a float, and save it in some variable\n print \"What is your first number? \"\n first_number = gets.to_f\n\n print \"What is your second number? \"\n second_number = gets.to_f\n\n # binding.pry\n\n # Add the two inputs given together and save the result\n result = first_number + second_number\n\n # Print these things out to the screen\n puts \"The result is #{result}\"\nend", "def conversion\n kilos_to_pounds = 2.205\n pounds_to_kilos = 0.454\n\n puts \"1. From kilograms to pounds\"\n puts \"2. From pounds to kilograms\"\n print \"Choose the conversion number (1 or 2) you want to make: \"\n response = gets.chomp.to_i\n\n if response == 1\n print \"Enter a number of kilograms: \"\n user_num = gets.chomp.to_i\n result = user_num * kilos_to_pounds\n user_from = \"kilograms\"\n user_to = \"pounds\"\n\n elsif response == 2\n print \"Enter a number of pounds: \"\n user_num = gets.chomp.to_i\n result = user_num * pounds_to_kilos\n user_from = \"pounds\"\n user_to = \"kilograms\"\n end\n\n puts \"There are #{result} #{user_to} in #{user_num} #{user_from}.\"\nend", "def division\n\tputs \"which numbers would you like to divide\"\n\tdiv_number1 = gets.chomp.to_f\n\tdiv_number2 = gets.chomp.to_f\n\tif div_number2.to_f == 0\n\t\tputs \"That is not possible, you failed fourth grade math.\"\t\t\n\telse\n\t\tputs div_number1.to_f / div_number2.to_f\n\tend\nend", "def sub_operation()\n print_message \"Write number and press ENTER to substract more or press 'r' to show result\"\n result = 0\n sub = gets.chomp\n if sub != 'r'\n result = sub.to_i\n end\n begin\n begin\n sub = gets.chomp\n if sub != 'r'\n result -= sub.to_i\n end\n rescue StandardError => e\n print_error_message \"Invalid number. Ending Substraction operation.\\n#{e.message}\"\n sub = 'r'\n end\n end while sub.downcase != 'r'\n print_message \"Result of substracting: #{result.to_s}\"\n end", "def basic_calc\n print Rainbow(\"\\n(a)\").white+Rainbow(\"dd \").green+Rainbow(\"(s)\").white+Rainbow(\"ubtract \").green+Rainbow(\"(m)\").white+Rainbow(\"ultiply \").green+Rainbow(\"(d)\").white+Rainbow(\"ivide \").green\n choice = gets.chomp.to_s\n print Rainbow(\"\\nfirst number: \").blue\n first = gets.chomp.to_f\n print Rainbow(\"second number: \").blue\n second = gets.chomp.to_f\n case choice[0].downcase\n when \"a\"\n print Rainbow(\"\\n#{first} + #{second} = \").blue + Rainbow(\"#{first + second}\\n\\n\").white\n when \"s\"\n print Rainbow(\"\\n#{first} - #{second} = \").blue + Rainbow(\"#{first - second}\\n\\n\").white\n when \"m\"\n print Rainbow(\"\\n#{first} 8 #{second} = \").blue + Rainbow(\"#{first * second}\\n\\n\").white\n when \"d\"\n print Rainbow(\"\\n#{first} / #{second} = \").blue + Rainbow(\"#{(first / second).rounf(5)}\\n\\n\").white\n when \"q\"\n menu\n else \n print Rainbow(\"\\nYou are doing it \").green + Rainbow(\"WRONG\\n\").red\n basic_calc\n end\nend", "def input_operator()\n\twhile true\n\t\tputs \"What do you want to do?\"\n\t\tputs \"+ -> add\"\n\t\tputs \"- -> subtract\"\n\t\tputs \"* -> multiply\"\n\t\tputs \"/ -> divide\"\n\t\t\n\t\top = gets.strip\n\t\tcase op\n\t\twhen \"+\"\n\t\t\treturn \"+\"\n\t\twhen \"-\"\n\t\t\treturn \"-\"\n\t\twhen \"/\"\n\t\t\treturn \"/\"\n\t\twhen \"*\"\n\t\t\treturn \"*\"\n\t\telse\n\t\t\tputs \"Please enter only + - * or /\"\n\t\tend\n\tend\nend", "def collect(request_array)\n print \"Please enter the first number: \"\n request_array << gets.chomp\n exit if request_array[0].downcase == \"exit\"\n print \"Please enter the second number: \"\n request_array << gets.chomp \n exit if request_array[1].downcase == \"exit\"\n print \"Please select an operation: \\n 1) Addition, 2) Subtraction, 3) Multiplication, 4) Division, 5) Exponential \\n\"\n request_array << gets.chomp.downcase\n exit if request_array[2] == \"exit\"\nend", "def always_three\n \n# ask user to enter a number\nputs \"Please enter a number\"\n\n# get the user number, convert to integer and set to a variable\nnumber = gets.to_i\n\n# add the code that will run when the method is called\nputs \"The final number is always \" + ((((((number) + 5) * 2) - 4) / 2) - number).to_s\n\n# close your method with the end keyword\nend", "def calculation(choice, num1, num2)\n\n if choice == \"add\"\n return num1 + num2\n\n elsif choice == \"subtract\"\n return num1 - num2\n\n elsif choice == \"multiply\"\n return num1 * num2\n\n elsif choice == \"divide\"\n return num1 / num2\n\n elsif choice == \"exponent\"\n return num1 ** num2\n\n elsif choice == \"square\"\n return Math.sqrt(num1)\n end\nend", "def get_user_choice\n # Show the available operations\n puts \"(+) - Addition\"\n puts \"(-) - Subtraction\"\n puts \"(*) - Multiplication\"\n puts \"(/) - Dividation\"\n puts \"(**) - Exponent\"\n puts \"(r) - squareRoots\"\n puts \"(q) - Quit\"\n\n print \"Enter your selection: \"\n gets.downcase.chomp # Implicit return\n end", "def addition\n print \"What is your first number? \"\n first_num = gets().to_i\n\n print \"What is your second number? \"\n second_num = gets().to_i\n\n result = first_num + second_num\n puts \"#{first_num} + #{second_num} = #{result}\"\nend" ]
[ "0.7353776", "0.7261326", "0.7144973", "0.7108331", "0.7084886", "0.70307255", "0.6970599", "0.69213164", "0.69042903", "0.68959683", "0.6826718", "0.6804019", "0.6791891", "0.6767537", "0.6752613", "0.6747193", "0.6741544", "0.6740266", "0.6722096", "0.66933537", "0.668875", "0.6679065", "0.66563296", "0.66453284", "0.66430897", "0.66403425", "0.6628274", "0.66253", "0.660529", "0.6589873", "0.6588995", "0.6588783", "0.6571268", "0.65688246", "0.6568451", "0.6563846", "0.65576124", "0.6545968", "0.65428907", "0.6524078", "0.65166014", "0.6516236", "0.65101486", "0.65060854", "0.6500793", "0.64999986", "0.6487803", "0.6482705", "0.6466282", "0.6464204", "0.6455907", "0.6452161", "0.64471334", "0.6442409", "0.6437057", "0.64287055", "0.6426662", "0.6418621", "0.64182186", "0.63884795", "0.6384732", "0.63846767", "0.6382907", "0.63800997", "0.6375749", "0.63731724", "0.6371802", "0.63649994", "0.6364964", "0.636457", "0.6359642", "0.63557035", "0.6350878", "0.63476235", "0.6345818", "0.6345248", "0.6341977", "0.6341591", "0.63322955", "0.6328099", "0.63215464", "0.6315191", "0.6313062", "0.63106674", "0.63058317", "0.62983644", "0.628211", "0.6277063", "0.62753475", "0.6271543", "0.6269687", "0.62667054", "0.6256064", "0.62540865", "0.6244717", "0.62358916", "0.6231834", "0.62295604", "0.622742", "0.62225753" ]
0.64688903
48
GET /messages_comments/1 GET /messages_comments/1.json
def show @messages_comment = MessagesComment.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @messages_comment } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def comments\n client.get(\"/#{id}/comments\")\n end", "def new\n @messages_comment = MessagesComment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @messages_comment }\n end\n end", "def comments\n @article = Article.find(params[:id])\n @comments = @article.comments\n\n respond_to do |format|\n format.html \n format.json { render json: @comments, status: :ok }\n end\n end", "def comments\n @list.client.get(\"#{url}/comments\")\n end", "def comments\n @list.client.get(\"#{url}/comments\")\n end", "def get_conversation_comments(conversation_id)\n list(\"conversations/#{conversation_id}/comments\")\n end", "def index\n @comments = DiscussionComment.all\n render json: @comments\n end", "def comments; rest_query(:comment); end", "def comments\n render json: @post.comments\n end", "def comments(post_id)\n records \"comment\", \"/msg/comments/#{post_id}\"\n end", "def GetComments id,params = {}\n\n params = params.merge(path: \"tickets/#{id}/comments.json\")\n APICall(params)\n\n end", "def index\n comments = @project.comments\n render json: comments\n end", "def get_comment(comment_id)\n get(\"comments/#{comment_id}\")\n end", "def index\n if params[:comment_id].nil?\n render json: {\n comments: @card.comments.paginate(page: params[:page], per_page: 3)\n }, statues: :ok\n else\n @comment = Comment.find(params[:comment_id])\n render json: {\n comment: @comment,\n replaies: @comment.replaies.paginate(page: params[:page], per_page: 3)\n }, statues: :ok\n end\n end", "def show\n user = User.find_by({token: env['HTTP_TOKEN']})\n render json: user.comments.find(params[:id])\n end", "def comments(options={})\n parse_comments(request(singular(id) + \"comments\", options))\n end", "def index\n @comments = @commentable.comments\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @comments }\n end\n end", "def moment_comments(moment_id)\n get(\"/v1/moments/#{moment_id}/comments\")\n end", "def read\n @message = Message.find(params[:id])\n authorize @message\n @message.comments.each do |comment|\n comment.status = \"read\"\n comment.save\n end\n end", "def list\n comments = Comment.where(post: @post)\n render json: comments, status: 200\n end", "def index\n #@comments = Comment.all\n comments = @blog.comments\n render json: comments, status: :ok\n end", "def show\n # comment = Comment.find_comment\n render json: @comment\n end", "def show\n comment = Comment.find(params[:id])\n render json: comment, status: 200\n end", "def show\n @comment = @commentable.comments.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comment }\n end\n end", "def index\n @post = Post.find_by_id(params[:post_id])\n if @post.nil?\n return render json: { error: \"Post not found\" }, status: :not_found\n end\n render json: @post.comments,status: 200\n end", "def index\n if (params[:comment_id] == nil )\n @replies = Reply.all\n else \n @micomment = Comment.find(params[:comment_id])\n \n @replies = Reply.where(comment_id: params[:comment_id])\n end\n end", "def comments\n Birdman::ApiPaginatedCollection.new(\"movies/#{id}/comments\")\n end", "def index\n @comments = Comment.all\n render json: @comments\n end", "def index\n #@messages = Message.all\n @messages = Message.all.order(:date_message).reverse_order\n @message = Message.new\n## @messages.each do |message|\n#\t@new_comment = Comment.build_from(message, current_user.id, \"\")\n#\t@comment = Comment.build_from(message, current_user.id, \"\")\n# end\n #commentable = commentable_type.constantize.find(commentable_id)\n #@comment = Comment.build_from(commentable, current_user.id, body)\n end", "def show\n comment = Comment.find(params[:id])\n render json: comment, status: :ok\n end", "def all_comments\n render :json => User.find(params[:user_id]).comments\n end", "def get_comment\n @comment = Comment.find(params[:id])\n end", "def show\n comment = Comment.find_by(id: params[:id])\n render json: comment\n end", "def get_comment\n if params[:id].blank?\n render json: { errors: 'answer_id required' }, status: 422\n return\n end\n\n answer = QualityControlAnswer.where(id: params[:id]).first\n\n if answer.blank?\n render json: { errors: 'Answer not found' }, status: 422\n else\n render json: { comment: answer.comment }, status: :ok\n end\n\n end", "def comment(id)\n record \"/msg/comment/#{id}\"\n end", "def get_comments()\n return self.get_all_comments()\n #issues = @issues\n #issues.each do |issue|\n # puts \"Processing issue #{issue['number']}...\"\n # comments = client.issue_comments( REPO, issue.number ) \n # num = issue['number']\n # @comments[num] = comments\n # issue[\"comments\"] = comments\n #end\n #return @comments\n end", "def comment\n Comment.find(params[:id])\n end", "def index\n event = Event.find(params[:event_id])\n render json: event.comments, status: :ok\n end", "def index\n comments = @post.comments\n render json: { comments: comments }\n #loop through comments and find first and last name by user_id\n #User.find....etc\n end", "def show\n @comments = @post.comments\n respond_to do |format|\n format.html\n format.json\n end\n end", "def index\n post = Post.find(params[:post_id])\n comments = post.comments.order(updated_at: :desc)\n @comment = Comment.new\n\n @comments = comments.map do |comment|\n {\n content: comment.content,\n created_at: comment.created_at.strftime('%Y-%m-%d %H:%M:%S')\n }\n end\n\n render json: {\n data: {\n comments: @comments,\n new_comment: @comment,\n }\n }\n end", "def replies\n options = {}\n if params[:per_page]\n options[:limit] = params[:per_page].to_i\n if params[:page] && params[:page].to_i >= 1\n options[:offset] = params[:per_page].to_i * (params[:page].to_i-1)\n end\n end\n options[:conditions] = {:channel_id => @channel.id, :reference_to => @message.id }\n sort_order = 'DESC'\n if params[:sort_order]\n if params[:sort_order] == 'ascending'\n sort_order = 'ASC'\n elsif params[:sort_order] == 'descending'\n sort_order = 'DESC'\n end\n end\n options[:order] = 'updated_at ' + sort_order\n @messages = Message.all(options)\n size = Message.count(:conditions => options[:conditions])\n\n render_json :entry => @messages, :size => size and return\n end", "def show\n \n @my_thread = MyThread.find(params[:id])\n @thread_comments = @my_thread.thread_comments\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @thread_comment }\n end\n end", "def show\n @comment = @song.comments.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comment }\n end\n end", "def index\n @comments = @post.comments.order(created_at: :desc)\n render json: @comments, status: :ok\n\n end", "def comments_for(url)\n get_data(\"comments/show/#{FORMAT}?url=#{url}\")\n end", "def show\n @comment = Comment.find(params[:id])\n render json:@comment\n end", "def comment(options)\n get(\"/content/items/#{options.delete(:item)}/comments/#{options[:id]}\",options)\n end", "def show\n @comment = Comment.new\n @comments = Comment.get_post_comments @post\n if session[:comment_errors]\n session[:comment_errors].each {|error, error_message| @comment.errors.add error, error_message}\n session.delete :comment_errors\n end\n respond_to do |format|\n format.html\n format.json { render :json => {:post => @post, :comments => @comments, :status => 200} }\n end\n end", "def index\n @replies = @comment.replies\n end", "def destroy\n @messages_comment = MessagesComment.find(params[:id])\n @messages_comment.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_comments_url }\n format.json { head :no_content }\n end\n end", "def index\n comments = list.comments.desc(:created_at)\n comments = comments[5, (comments.length-1)]\n\n render json: comments\n end", "def show_comments\r\n @comments = Comment.find_by_sql(\"select * from comments where subject_id order by created_at DESC\")\r\n @replies = []\r\n @comments.each do|c| \r\n Comment.find_all_by_reply(c.id).each do|r|\r\n @replies << r\r\n end\r\n end \r\n end", "def show\n\tif !checklogin? then return end\n\n @message = Message.find(params[:id])\n\t@isme = me? @message\n\t@comment = Comment.new({:message_id => params[:id], :member_id => session[:login].id})\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end", "def comments(options={})\n parse_comments(request(singular(answer_id) + \"/comments\", options))\n end", "def show\n render json: { comment: @comment, replaies: @comment.replaies }, status: :ok\n end", "def show\n render json: comment\n end", "def comments\n expose Challenge.comments(@oauth_token, params[:challenge_id].strip)\n end", "def comments(options={})\n self.class.parse_comments(request(singular(user_id) + \"/comments\", options))\n end", "def get_comments(channel_name)\n uri = create_api_uri(@@base_uri, channel_name, 'getComments')\n return get(uri)\n end", "def index\n logger.info(\"comments got index! #{params}\");\n @comments = Comment.find_by_post_id(params[:post_id])\n respond_with @comments\n end", "def specified_comment(token, action)\n @comment = @graph.get_connections(@post_id, \"comments\",\n :limit=>1,\n :fields => [\"from{name,id,picture}\",\n \"id\",\n \"message\",\n \"created_time\",\n \"like_count\", \n ],\n action => token,\n )\n end", "def show\n @message = Message.find(params[:id])\n render json: @message\n\n end", "def index\n @talk_comments = TalkComment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @talk_comments }\n end\n end", "def show\n @comment1 = Comment1.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comment1 }\n end\n end", "def new\n @comment = @commentable.comments.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment }\n end\n end", "def show\n render json: @comment\n end", "def show\n @post = Post.find(params[:id])\n @comments = Comment.where(:post_id => params[:id]).order(\"id desc\")\n @comments = @comments.page(params[:page]).per(20)\n @comment = Comment.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end", "def details(id, params = {})\n wrike.execute(:get, api_url(\"comments/#{id}\"), params)\n end", "def index\n @comments = Comment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @comments }\n end\n end", "def index\n @comments = Comment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @comments }\n end\n end", "def index\n @comments = Comment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @comments }\n end\n end", "def index\n @comments = Comment.where('user_id = ?', current_user.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @comments }\n end\n end", "def comments\n Comment.query({item_id: _id}, {sort: [[:created_at, -1]]})\n end", "def comments\n @data['comments']\n end", "def comments\n @data['comments']\n end", "def comments\n @data['comments']\n end", "def show\n @comment = @posting.comments.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comment }\n end\n end", "def show\n render json: @comment, status: :ok\n\n end", "def index\n @comments = Comment.paginate(:page => params[:page])\n @ticket = Ticket.find(params[:ticket_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @comments }\n end\n end", "def index\n @comments = @entry.comments\n respond_with(@comments)\n end", "def new\n @comment = @song.comments.new\n \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment }\n end\n end", "def index\n @comments = Comment.order(\"created_at DESC\")\n render json: @comments, status: :ok\n end", "def show\n @new_comment = Comment.build_from(@post, \"\")\n\n render json: @post, status: 200\n\n\n end", "def get_comments(user_name)\n uri = create_api_uri(@@base_uri, user_name, 'getComments')\n return get(uri)\n end", "def conversation\n current_user_id = current_user.id\n other_user_id = params[:id]\n @messages = Message.get_conversation(current_user_id, other_user_id)\n render json: @messages\n end", "def getComment(response)\r\n\t\t\t\r\n\t\t\t\tjsonObject = JSON.parse response\r\n\t\t\t\t\r\n\t\t\t\tcomments = jsonObject[\"comments\"]\r\n\t\t\t\t\t\r\n\t\t\t\treturn jsonToComment(comments[0])\r\n\t\t\t\r\n\t\t\tend", "def comments\n @presentation = Presentation.in_conference(current_conference).\n find(params[:id])\n end", "def show\n @v1_message = V1::Message.find(params[:id])\n\n render json: @v1_message\n end", "def index\n @comments = Comment.where(\n \"auction_id = ? \",\n params[:auction_id])\n\n render json: @comments\n end", "def show\n @message = Message.find(params[:id])\n if user_signed_in?\n @new_comment = Comment.build_from(@message, current_user.id, \"\")\n end\n #@user_who_commented = current_chef\n #@comment = Comment.build_from( @message, @user_who_commented.id, \"\" )\n end", "def comments(options = {})\n urn = options.delete(:urn)\n path = \"/socialActions/#{urn}/comments\"\n get(path, options)\n end", "def show\n @ticket = Ticket.find(params[:id])\n\n # get last five comments\n @comments_per_page = 5\n @comments = @ticket.comments.limit(@comments_per_page)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket }\n end\n end", "def show\n if @comment.nil?\n render json: {error: \"Not Found\"}, status: :not_found\n else\n render json: @comment, status: :ok\n end\n end", "def fetch\n messages = paginate ConversationMessage.where(conversation_id: params[:conversation_id])\n .order('created_at DESC')\n render json: messages.to_json(:include => :user)\n end", "def gist_comments(id)\n get \"/gists/#{id}/comments\"\n end", "def comments\n Comment.where(:article => @id)\n end", "def new\n @discussions = current_user.discussions.order(\"updated_at DESC\")\n #@discussion = Discussion.find(params[:id]) \n @message = @discussion.messages.new\n\n if params[:recipient_id].present?\n @recipient = User.find(params[:recipient_id])\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end", "def index\n @post = Post.find(params[:post_id])\n @comments = @post.comments\n\n render json: @comments, include: ['user']\n end", "def index\n if params[:message_id]\n @messagefacts = Message.find(params[:message_id]).messagefacts\n else\n @messagefacts = Messagefact.all\n end\n respond_to do |format|\n format.json {\n render :json => @messagefacts, :layout => false\n }\n end\n end" ]
[ "0.7700898", "0.69862753", "0.69298095", "0.6915482", "0.6915482", "0.67945457", "0.678092", "0.6692832", "0.6643637", "0.6626985", "0.65854377", "0.65843046", "0.65795463", "0.6535529", "0.65031946", "0.64852715", "0.64826703", "0.64664644", "0.6460586", "0.6449252", "0.64343786", "0.6422463", "0.641559", "0.63787955", "0.637649", "0.63594997", "0.63530135", "0.6350315", "0.6344796", "0.63318706", "0.6330866", "0.6311557", "0.63067883", "0.63038445", "0.6301551", "0.62915766", "0.6289615", "0.62873137", "0.6283433", "0.6280386", "0.6273647", "0.6271209", "0.6263856", "0.6262423", "0.6246371", "0.62398666", "0.62363213", "0.6232706", "0.6218715", "0.62089604", "0.6208565", "0.62032014", "0.620177", "0.6199724", "0.6199667", "0.6198536", "0.6194965", "0.619312", "0.61860037", "0.61858404", "0.6177388", "0.61752695", "0.61726564", "0.6164339", "0.61624134", "0.6159349", "0.6155613", "0.6153567", "0.6149241", "0.6149158", "0.6149158", "0.6149158", "0.6144367", "0.6142744", "0.6132094", "0.6132094", "0.6132094", "0.61316514", "0.61260617", "0.6126011", "0.6124526", "0.612319", "0.6119639", "0.6118508", "0.6116201", "0.61148316", "0.61111987", "0.60960215", "0.6083791", "0.60765105", "0.6076098", "0.6070985", "0.6064235", "0.60594356", "0.6055611", "0.6046013", "0.60456365", "0.60439855", "0.60385484", "0.60371864" ]
0.75209457
1
GET /messages_comments/new GET /messages_comments/new.json
def new @messages_comment = MessagesComment.new respond_to do |format| format.html # new.html.erb format.json { render json: @messages_comment } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @comment = @commentable.comments.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment }\n end\n end", "def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment }\n end\n end", "def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment }\n end\n end", "def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment }\n end\n end", "def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment }\n end\n end", "def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment }\n end\n end", "def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment }\n end\n end", "def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment }\n end\n end", "def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment }\n end\n end", "def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment }\n end\n end", "def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment }\n end\n end", "def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment }\n end\n end", "def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment }\n end\n end", "def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment }\n end\n end", "def new\n @comment = @posting.comments.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment }\n end\n end", "def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @comment }\n end\n end", "def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @comment }\n end\n end", "def new\n load_data\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment }\n end\n end", "def new\n @comment = @parent.comments.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment }\n end\n end", "def new\n @message = Message.new\n\n render json: @message\n end", "def new\n @message = Message.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end", "def new\n @message = Message.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end", "def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end", "def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end", "def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end", "def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end", "def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end", "def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end", "def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end", "def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end", "def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end", "def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end", "def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end", "def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end", "def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end", "def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end", "def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end", "def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end", "def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end", "def new\n @talk_comment = TalkComment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @talk_comment }\n end\n end", "def new\n @comment = @song.comments.new\n \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment }\n end\n end", "def new\n @message = current_user.messages.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end", "def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @message }\n end\n end", "def new\n @message_post = MessagePost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message_post }\n end\n end", "def new\n @comment_relationship = CommentRelationship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment_relationship }\n end\n end", "def new\n @comment = Comment.new :task_id => params[:task_id], :user_id => current_user.id\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment }\n end\n end", "def create\n @messages_comment = MessagesComment.new(params[:messages_comment])\n\n respond_to do |format|\n if @messages_comment.save\n format.html { redirect_to @messages_comment, notice: 'Messages comment was successfully created.' }\n format.json { render json: @messages_comment, status: :created, location: @messages_comment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @messages_comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @post = Post.where(id: params[:post_id]).first\n @comment = @post.comments.build\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment }\n end\n end", "def new\n @comment_node = CommentNode.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @comment_node }\n end\n end", "def new\n comment = Comment.new(comment_params)\n render_ajax locals: {comment: comment}\n end", "def new\n @reply = Reply.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reply }\n end\n end", "def new\n @story_comment = StoryComment.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @story_comment }\n end\n end", "def new\n @project_comment = ProjectComment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @project_comment }\n end\n end", "def new\n @message = Message.new\n @users = User.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end", "def new\n# @task = Task.find(params[:task_id])\n# @task.comments.new(params[:comment]) \n @comment = Comment.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment }\n end\n end", "def new\n @conversation = Conversation.new\n @comment = @conversation.comments.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @conversation }\n end\n end", "def new\n @bug_comment = BugComment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bug_comment }\n end\n end", "def new\n @comment = Comment.new\n if params[:recipe] != nil\n @recipe = Recipe.find(params[:recipe].to_i)\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment }\n end\n end", "def new\n @contact_message = ContactMessage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contact_message }\n end\n end", "def new\n @discussions = current_user.discussions.order(\"updated_at DESC\")\n #@discussion = Discussion.find(params[:id]) \n @message = @discussion.messages.new\n\n if params[:recipient_id].present?\n @recipient = User.find(params[:recipient_id])\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end", "def new\n @comment = @story.comments.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comment }\n end\n end", "def new\n @conversation = Conversation.new\n logger.debug \"In new!\"\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @conversation }\n end\n end", "def new\n @comment = @network.comments.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comment }\n end\n end", "def new\n @comment = Comment.new(options_for_commentable)\n respond_to do |format|\n format.html { render layout: false } # new.html.erb\n format.json { render json: @users }\n end\n end", "def new\n @comment = current_user.comments.build # crea comentario vacío asociado a current_user\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment }\n end\n end", "def new\n unless current_user.try(:admin?)\n redirect_to \"/\"\n end\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment }\n end\n end", "def new\n @comment = Comment.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comment }\n end\n end", "def new\n @dish_comment = @dish.dish_comments.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dish_comment }\n end\n end", "def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comment }\n end\n end", "def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comment }\n end\n end", "def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comment }\n end\n end", "def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comment }\n end\n end", "def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comment }\n end\n end", "def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comment }\n end\n end", "def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comment }\n end\n end", "def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comment }\n end\n end", "def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comment }\n end\n end", "def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comment }\n end\n end", "def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comment }\n end\n end", "def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comment }\n end\n end", "def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comment }\n end\n end", "def new\n @message_link = MessageLink.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message_link }\n end\n end", "def new\n @comment = Comment.new\n @meta[:title] = 'New comment'\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comment }\n end\n end", "def new\n @meetup_comment = MeetupComment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @meetup_comment }\n end\n end", "def new\n @comment = Comment.new(:parent_id => params[:parent_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.js\n format.json { render json: @comment }\n end\n end", "def new\n @message = Message.new(:relation_id => params[:relation_id], :user_id => params[:user_id], :sent => false)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end", "def new\n @conversation = Conversation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @conversation }\n end\n end", "def new\n @conversation = Conversation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @conversation }\n end\n end", "def new\n\n @comment = Comment.new\n @reply_to = nil\n\n # if we're replying to something\n if params.key?('reply_to')\n begin\n # grab comment\n @reply_to = Comment.find(params[:reply_to])\n @comment.reply_to_id = @reply_to.id\n\n # add comment text to the current comment\n @comment.comment = '> '+@reply_to.comment.gsub(/^>(.*?)\\n/m, '').strip.gsub(/\\n\\n+/, \"\\n\\n\").gsub(/\\n/, \"\\n> \")\n rescue\n end\n end\n\n unless cookies[:comment_details].nil?\n begin\n data = JSON.parse(cookies[:comment_details])\n @comment.name = data[\"name\"] unless data[\"name\"].nil?\n @comment.email = data[\"email\"] unless data[\"email\"].nil?\n @comment.website = data[\"website\"] unless data[\"website\"].nil?\n @comment.save_deets = true\n rescue\n end\n end\n\n end", "def new\n @comment = Comment.new\n @task_id = params[:task_id]\n if(@task_id)\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment }\n end\n else\n redirect_to projects_path, notice: \"can't create independent comments\"\n end\n end", "def new\n return false unless authorize(permissions = [\"create_comment\"])\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comment }\n end\n end", "def new\n @comment1 = Comment1.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment1 }\n end\n end", "def new\n # we don't want to use /messages/new, always use root path /\n flash.keep and redirect_to root_path and return unless request.fullpath == root_path\n\n @message = Message.new\n @show_editable_fields = true\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end", "def new\n @comment = Comment.new\n session[:postid] = params[:postid]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment }\n end\n end", "def new\n @pmessage = Pmessage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pmessage }\n end\n end", "def new\n @user = User.find(params[:user_id])\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment }\n end\n end", "def new\n @comment = @complaint.comments.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @comment }\n format.js\n end\n end", "def new\n #@comment = Comment.new\n redirect_to \"/home/index\"\n #respond_to do |format|\n #format.html # new.html.erb\n #format.json { render json: @comment }\n #end\n end", "def new\n @comment = Comment.new(recipe_id: params[:recipe_id])\n render :_ajax_new, layout: false\n end", "def new\n @project_message = ProjectMessage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project_message }\n end\n end" ]
[ "0.78621703", "0.7730281", "0.77216625", "0.77216625", "0.77216625", "0.77216625", "0.77216625", "0.77216625", "0.77216625", "0.77216625", "0.77216625", "0.77216625", "0.77216625", "0.77216625", "0.7663547", "0.7657444", "0.7657444", "0.756381", "0.75368035", "0.7378663", "0.7376998", "0.7376998", "0.73736256", "0.73736256", "0.73736256", "0.73736256", "0.73736256", "0.73736256", "0.73736256", "0.73736256", "0.73736256", "0.73736256", "0.73736256", "0.73736256", "0.73736256", "0.73736256", "0.73736256", "0.73736256", "0.73736256", "0.7371598", "0.73653513", "0.7296738", "0.7294532", "0.7275754", "0.72578335", "0.7238129", "0.7234888", "0.7224755", "0.7224406", "0.7198579", "0.71891755", "0.7188088", "0.7174968", "0.71715117", "0.7139941", "0.7081137", "0.707643", "0.70753986", "0.7065106", "0.7049755", "0.7049141", "0.7037998", "0.6993788", "0.6990898", "0.6985525", "0.6984652", "0.6969928", "0.696652", "0.69615734", "0.69615734", "0.69615734", "0.69615734", "0.69615734", "0.69615734", "0.69615734", "0.69615734", "0.69615734", "0.69615734", "0.69615734", "0.69615734", "0.69602424", "0.6955174", "0.695449", "0.69540596", "0.6945537", "0.69349754", "0.6924867", "0.6924867", "0.6921249", "0.6917972", "0.6917403", "0.6896936", "0.68888724", "0.6886591", "0.6886193", "0.6881223", "0.6879468", "0.6879269", "0.6872815", "0.68724525" ]
0.8366363
0
POST /messages_comments POST /messages_comments.json
def create @messages_comment = MessagesComment.new(params[:messages_comment]) respond_to do |format| if @messages_comment.save format.html { redirect_to @messages_comment, notice: 'Messages comment was successfully created.' } format.json { render json: @messages_comment, status: :created, location: @messages_comment } else format.html { render action: "new" } format.json { render json: @messages_comment.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n\t\t@comment = Comment.new\n\t\t@comment.comment = params[:message] \n\t\t@comment.user = current_user\n\t\t\n\t\t@comment.save\n\t\trespond_with(@comment)\n end", "def create_comment\n @user = User.find(params[:user_id])\n @message = Message.find(params[:message_id])\n @comment = @message.comments.create(params.permit(:content))\n @comment.user = @user\n @comment.user_name = @user.id\n @comment.user_avatar = @user.id\n\n if @comment.save\n response = { \"code\" => 1, \"msg\" => \"Comment Created Successfully\" }\n else\n response = { \"code\" => 0, \"msg\" => \"Comment Can't be created\" }\n end\n\n render json: response\n end", "def create\n @comment = @post.comments.new(comment_params)\n if @comment.save\n render json: @comment, status: :created\n else\n render json: @comment.errors, status: :unprocessable_entity\n end\n\n end", "def new\n @messages_comment = MessagesComment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @messages_comment }\n end\n end", "def create\n @comment = @message.comments.build(params[:comment])\n @comment.user = current_user || nil\n @comment.ip = request.remote_ip\n\n if @comment.save\n flash[:notice] = 'Comment was successfully posted.'\n redirect_to(@message)\n else\n @comments = @message.comments.ham\n render :template => \"messages/show\"\n end\n end", "def create\n @admin_comment = Admin::Comment.new(handle_params)\n\n respond_to do |format|\n if @admin_comment.save\n format.html { redirect_to message_path(Admin::Message.find_by_id(handle_params[:message_id]).title), notice: 'Comment was successfully created.' }\n format.json { render :show, status: :created, location: @admin_comment }\n else\n format.html { render :new }\n format.json { render json: @admin_comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @comment = current_user.comments.build(comment_params)\n\n respond_to do |format|\n if @comment.save\n format.html do\n # @users = User.all\n\n # # Twilio constants – should be moved to config\n # account_sid = 'ACd619abfb51473fa45265088dbf7cbf7d'\n # account_token = 'a5225b03b9cfee05ffcf539bf58c6492'\n\n # @twilio_client = Twilio::REST::Client.new account_sid, account_token\n\n # @users.each do |user|\n # @twilio_client.account.sms.messages.create(\n # :from => '+16463621414',\n # :to => user.phone_number,\n # :body => \"#{current_user.name} just commented on a collude post.\"\n # )\n # logger.info \"Text message sent to #{user.name} at #{user.phone_number}.\"\n # end\n redirect_to root_path, notice: 'Comment was successfully created.'\n end \n format.json { render action: 'show', status: :created, location: @comment }\n else\n format.html { render action: 'new' }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n post = Post.find(params[:post_id])\n @comment = post.comments.new(comment_params)\n if @comment.save\n render json: {\n data: @comment\n }\n else\n render json: {\n errors: @comment.errors\n }\n end\n end", "def create\n @comment = Comment.new(params[:comment])\n \n message = Message.find(params[:message_id]);\n user = current_user\n \n if user.active? && !current_user\n @message.errors.add_to_base(\"Du musst erst den Link in der E-Mail klicken.\")\n\n respond_to do |format|\n format.html { render :action => \"new\"; return }\n format.widget { render :action => \"new\"; return }\n end\n end\n \n @comment.user = user\n @comment.message = message\n \n respond_to do |format|\n if @comment.save\n format.html { redirect_to(message, :notice => '<span class=\"icon yes\">Kommentar hinzugefügt</span>') }\n format.xml { render :xml => @comment, :status => :created, :location => @comment }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end", "def comment_params\n params.require(:comment).permit(:message)\n end", "def comment_params\n params.require(:comment).permit(:message)\n end", "def comment_params\n params.require(:comment).permit(:message)\n end", "def create\n comment = @project.comments.build(comment_params)\n\n if comment.save\n render json: comment \n else\n render json: { message: 'Error: Failed to add comment.'}\n end\n end", "def send_comment(data)\n current_user.comments.create!(content: data['comment'], blog_id: data['blog_id'])\n end", "def create\n @new_comment = post.comments.new(comment_params)\n @new_comment.user = current_user\n\n respond_to do |format|\n if @new_comment.save\n format.html { redirect_to post, notice: I18n.t('controllers.comments.created') }\n format.json { render :show, status: :created, location: post }\n else\n format.html { redirect_to post, alert: I18n.t('controllers.comments.error') }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n comment = Comment.new(comment_params)\n\n post = Post.find(params[:comment][:post_id])\n post.data[\"comments\"] = post.data[\"comments\"] + 1\n\n if comment.save && post.save\n render json: {\n status: \"success\",\n data: {\n comment: comment.as_json(include: {\n user: {\n only: [:id, :name, :avatar]\n }\n }),\n comments: post.data[\"comments\"]\n }\n }, status: :ok\n else\n render json: comment.errors, status: 404\n end\n end", "def create\n puts params.to_json\n @post = Post.find(params[:comment][:post_id])\n @comment = @post.comments.build(comment_params)\n if @comment.save\n redirect_to root_path\n end\n end", "def create\n @comment = Comment.new({user_id: params[:user_id], announcement_id: params[:announcement_id], description: params[:description]})\n @comment.save\n render json:@comment\n end", "def comment options={}\n client.post(\"/#{id}/comments\", options)\n end", "def create_comments\n end", "def create_comments\n end", "def create_comments\n end", "def create\n json_create_and_sanitize(comment_params, Comment)\n end", "def create\n # get the post\n @post = Post.find_by_id(params[:post_id])\n if @post.nil?\n return render json: { error: \"Post not found\" }, status: :not_found\n end\n # create post to comment\n @comment = @post.comments.create(body: params[:body])\n # associate comment before save(comment cannot be saved without user_id)\n @comment.user = @current_user\n # save comment\n if @comment.save\n render json: @comment, status: :ok\n else\n render json: { errors: { status: \"400\",\n title: \"Bad request\",\n details: @comment.errors\n }\n }, status: :bad_request\n end\n end", "def new_comment(name, discussion_id)\n response = self.class.post(\n @@base_uri + @@comments_uri,\n body: {\"comment\":{\"body\":name,\"discussion_id\":discussion_id,\"document_ids\":[]}}.to_json,\n headers: @headers\n )\n return response\n end", "def create\n @comment = Comment.new(comment_params)\n respond_to do |format|\n if @comment.save\n format.json {\n render json: {status:0, msg:\"success\"} \n }\n else\n \tformat.json { \n render json: {status:-1, msg:\"failed\"} \n }\n end\n end\n end", "def create\n @comment = @noticia.comments.create(comment_params)\n\n if @comment.save\n render json: @comment, status: :created\n else\n render json: @comment.errors, status: :unprocessable_entity\n end\n end", "def comment_params\n params.require(:comment).permit(:id, :post_id, :message, :from, :reactions, :comments)\n end", "def create\n \tnew_comment = params.require(:comment).permit(:body)\n \tpost = Post.find(params[:post_id])\n \tcomment = post.comments.create(new_comment)\n\n \tredirect_to post_comment_path(post, comment)\n end", "def create\n #@comment = Comment.new(comment_params)\n @comment = @blog.comments.new(comment_params)\n \n if @comment.save\n render json: @comment, status: :created\n else\n render json: {\n error: @comment.errors.full_messages\n }, status: :unprocessable_entity\n end\n end", "def create\n @comment = @parent.comments.build(comment_params_with_user)\n authorize @comment\n\n if @comment.save\n CommentCreatedMailJob.perform_later(@comment)\n render json: @comment, serializer: CommentSerializer, status: :created\n else\n render_error :unprocessable_entity, @comment.errors\n end\n end", "def create\n session = UserSession.find_by_authentication_token(params[:authentication_token])\n user = session.user\n \n respond_to do |format|\n if user\n @comment = Comment.new(:user_id => user.id, :recipe_id => params[:recipe_id], :text => params[:text])\n \n if @comment.save\n recipe = Recipe.find_by_id([params[:recipe_id]])\n\n @comments = recipe.fetch_comments\n format.json { render :json => { :comments => @comments, :message => \"success\"} }\n else\n format.json { render :status => 500, :json => { :message => \"There was an error uploading your comment.\" }}\n end\n else\n format.json { render :json => { :message => \"Invalid authentication token\"}} \n end\n end\n end", "def create\n @blogpost = Blogpost.find(params[:blogpost_id])\n\n @comment = @blogpost.comments.create(comment_params)\n render json: @comment\n end", "def create\n @comment = current_user.comments.new(comment_params)\n @comment.user_id = current_user.id\n if @comment.save\n render json: @comment\n else\n render :json => @comment.errors\n end\n end", "def create\n @radio = Radio.find(params[:radio_id])\n comment = @radio.comments.create({:body => params[:comment], :user_id => current_user.id});\n respond_to do |format|\n format.json { render :json => to_commentDTO(comment), :status => :ok }\n end\n end", "def create\n @comment = current_user.comments.build(comment_params)\n\n respond_to do |format|\n if @comment.save\n format.html { redirect_to \"/posts/#{@comment.post_id}\" }\n format.json { render :show, status: :created, location: @comment }\n else\n errors = @comment.errors.full_messages.join('! ')\n format.html { redirect_to \"/posts/#{@comment.post_id}\", alert: \"Comment was failly created!\\n#{errors}!\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n\n\n end", "def create\n @reply = @message.replies.build(params[:reply])\n @reply.user_id = user_id\n respond_to do |format|\n if @reply.save\n format.js\n format.html { redirect_to(user_messages_path) }\n format.xml { render :xml => @reply, :status => :created, :location => @reply }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @reply.errors, :status => :unprocessable_entity }\n end\n end\n end", "def comments(post_id)\n records \"comment\", \"/msg/comments/#{post_id}\"\n end", "def comment_params\n params.require(:comment).permit(:message, :parent_id, :task_status)\n end", "def create\n if !current_user\n redirect_to login_path\n end\n @request = Request.find(params[:request_id])\n @comment = Comment.new(comment_params)\n current_user.comments << @comment\n @request.comments << @comment\n if @comment.body.length < 1 \n flash[:Error] = \"Comment length : 1-200 characters. Comment length: Cannot be empty.\"\n redirect_to new_comment_path(params[:request_id])\n end\n if @comment.save\n UserMailer.comment_notification(@comment, @request).deliver_now\n flash[:success] = \"Thanks for responding! The person who posted the request will be notified.\"\n redirect_to request_path(params[:request_id])\n else\n flash[:danger] = \"All fields must be filled in to post a comment.\"\n redirect_to new_comment_path(params[:request_id])\n end\n \n end", "def create\n @comment = @user.comments.build(@json['comment'])\n update_values :@comment, @json['comment']\n end", "def create\n @comment = Comment.new\n @comment.content = params[:content]\n @comment.post_id = params[:post_id]\n @comment.user_id = current_user.id\n\n respond_to do |format|\n if @comment.save\n format.html { redirect_to root_path, notice: \"Comment was successfully created.\" }\n format.json { render :show, status: :created, location: @comment }\n else\n format.html { redirect_to root_path, notice: \"Por favor añada contenido a su comentario.\" }\n end\n end\n end", "def create\n @reply = @comment.replies.new(reply_params)\n @reply.user_id = session[:user_id]\n respond_to do |format|\n if @reply.save\n format.html { redirect_to @post, notice: 'Reply was successfully created.' }\n format.json { render @post, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @reply.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n begin\n @phrase = Phrase.find(params[:id]) # コメント対象のフレーズ\n rescue Exception => e\n flash[:error] = 'コメントを書き込めませんでした。'\n redirect_to root_url\n return\n end\n \n @new_comment = @phrase.comments.new\n @new_comment.content = params[:comment][:content]\n @new_comment.user_id = current_user.id # コメント者のidをセット\n\n respond_to do |format|\n if @new_comment.save\n format.html { redirect_to @phrase, notice: 'コメントを投稿しました。' }\n\n # 「コメントされた」旨のお知らせメール送信(メール配信フラグfalseの人には送られない)\n CommentMailer.notice_mail(@phrase,@new_comment,request.url).deliver if @phrase.user.mail_flg\n else\n format.html { render action: \"show\" }\n end\n end\n end", "def create\n @comment = Comment.new(params[:comment])\n @comment.save\n respond_with(@post, @comment)\n end", "def create_comment(post_id, comment, attachments=[])\n prepare_attachments(attachments)\n record \"/msg/create_comment\", :comment => comment.merge(:post_id => post_id),\n :attachments => attachments\n end", "def create\n @comment = Comment.new comment_params\n @comment.user = current_user\n if @comment.save\n @comments = Comment.where(\n polycomment_type: params[:comment][:polycomment_type],\n polycomment_id: params[:comment][:polycomment_id]\n )\n @comments = @comments.paginate(page: 1, per_page: 10)\n project = Project.find_by(name: params[:comment][:project_name])\n\n notify_followers(project, @comment)\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.js {}\n end\n else\n redirect_to :back\n flash[:alert] = 'Something went wrong, try reposting your comment.'\n end\n end", "def create\n @reply = Reply.new(reply_params)\n\n @reply.user_id = current_user.id\n\n respond_to do |format|\n if @reply.save\n format.html {\n if @reply.reply.present? && @reply.reply.user_id.present?\n message_user(@reply.reply.user_id, \"New reply to your comment #{@reply.lesson_component.title}\", \"#{current_user.firstname} replied to your comment on #{@reply.lesson_component.title} at #{@reply.created_at.strftime(\"%B %-d, %Y at %-l:%M %P\")}\", \"/course/#{@reply.lesson_component.lesson.course.slug}/modules/#{@reply.lesson_component.lesson.slug}/#{@reply.lesson_component.order}#comment-#{@reply.id}\")\n end\n redirect_to \"/course/#{@reply.lesson_component.lesson.course.slug}/modules/#{@reply.lesson_component.lesson.slug}/#{@reply.lesson_component.order}#comment-#{@reply.id}\", notice: \"Comment added\"\n }\n format.json { render :show, status: :created, location: @reply }\n else\n format.html {\n redirect_to \"/course/#{@reply.lesson_component.lesson.course.slug}/modules/#{@reply.lesson_component.lesson.slug}/#{@reply.lesson_component.order}#comment-panel\", notice: @reply.errors\n }\n format.json { render json: @reply.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n comment = Comment.new(:content => params[:content],\n :user_id => current_user.id,\n :image => avatar_url(current_user),\n :commentable => list,\n :cid => params[:cid])\n status = comment.save ? 201 : 400\n\n unless current_user == list.user\n Notification.new_comment(list.user, current_user, list)\n mentions = get_mentions(params[:content])\n Notification.new_mention(mentions, current_user, list) unless mentions.empty?\n end\n\n head status\n end", "def create\n @comment = Comment.new(params[:comment])\n\n respond_to do |format|\n if @comment.save\n format.html { redirect_to comments_url, notice: 'Comment was successfully created.' }\n format.json { render json: @comment, status: :created, location: @comment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.where(id: params[:post_id]).first\n @comment = @post.comments.new(params[:comment])\n\n respond_to do |format|\n if @comment.save\n format.html { redirect_to @post, notice: 'Comment was successfully created.' }\n format.json { render json: @comment, status: :created, location: @comment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @comment = @parent.comments.new(params[:comment])\n @comment.user_id = session[:user_id]\n\n respond_to do |format|\n if @comment.save\n @comment.update_post\n format.html { redirect_to post_path(@comment.post), notice: 'Comment was successfully created.' }\n format.json { render json: @comment, status: :created, location: @comment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @comment = Comment.new :body => params[:comment][:body],\n :issue => false\n @comment.polycomment_type = params[:polycomment_type]\n @comment.polycomment_id = params[:polycomment_id]\n @comment.user_id = current_user.id \n if @comment.save\n #flash[:notice] = 'Your comment was posted!'\n redirect_to :back\n else\n flash[:alert] = 'Something went wrong, try reposting your comment.'\n end\n end", "def create\n comment = Comment.new(create_params)\n comment.post = @post\n if comment.save\n render json: comment, status: 200\n else\n render json: comment.errors, status: 403\n end\n\n end", "def create\n @comment = Comment.new(comment_params)\n\n respond_to do |format|\n if @comment.save\n format.json { render :show, status: :created, location: @comment }\n else\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @reply = Reply.new(params[:reply])\n\n if @reply.save\n render json: @reply, status: :created, location: @reply\n else\n render json: @reply.errors, status: :unprocessable_entity\n end\n end", "def comment_params\n params.permit(:message, :user_id, :course_id)\n end", "def create\n @comment = Comment.new(params[:comment])\n\n respond_to do |format|\n if @comment.save\n format.html { redirect_to admin_comments_url, notice: 'Comment was successfully created.' }\n format.json { render json: @comment, status: :created, location: @comment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #@reply = Reply.new(reply_params)\n @post = Post.find(params[:post_id])\n @comment = Comment.find(params[:comment_id])\n # @reply = Reply.new(reply_params)\n @reply = @comment.replies.create(params[:reply].permit(:body))\n @reply.user_id = current_user.id\n\n respond_to do |format|\n if @reply.save\n format.html { redirect_to post_path(@post), notice: \"Reply was successfully created.\" }\n format.json { render :show, status: :created, location: @reply }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @reply.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # store that comment for later mailer delivery and channel broadcasting\n comment = @post.comments.create! comments_params\n\n # mailer deliver later\n CommentsMailer.submitted(comment).deliver_later\n\n # render to page in real time using websocket channels\n CommentsChannel.broadcast(comment)\n\n redirect_to @post\n end", "def create\n @comment = Comment.new(comment_params)\n\n respond_to do |format|\n if @comment.save\n post_comment(@comment)\n format.html { redirect_to @comment.article, notice: 'Comment was successfully created.' }\n format.json { render action: 'show', status: :created, location: @comment }\n else\n format.html { render action: 'new' }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n message = Message.new(message_params)\n message.message = params[:message_text]\n message.display_name = params[:display_name]\n message.save!\n render json: message\n end", "def add_reply\n \n #find the parent item with ID.\n \n @parent_item = params[:item_type].classify.constantize.find(params[:id])\n \n @reply = Comment.create(params[:comment].merge(:user => @current_user, \n :state => DEFAULT_COMMENT_STATE, \n :commentable_id => params[:id],\n :commentable_type => params[:item_type].classify)) \n @reply.save\n \n if @reply.state == 'validated'\n flash[:error] = \"\"\n flash[:notice] = I18n.t('comment.add_comment.ajax_message_comment_published')\n #else we just send an error message explaining that comment is not validated.\n else\n @error = I18n.t('comment.add_comment.ajax_message_comment_submited')\n end\n \n respond_to do |format|\n \t format.js {render :layout => false}\n \tend\n\tend", "def create\n commentable = commentable_type.constantize.find(commentable_id)\n @comment = Comment.build_from(commentable, current_user.id, body)\n\n respond_to do |format|\n if @comment.save\n make_child_comment\n\n format.html { redirect_to(:back, :notice => 'Comment was successfully added.') }\n format.json { render json: @comment, status: :created, location: @comment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n comment = Comment.new(comment_params)\n\n if comment.save\n flash[:success] = t('flash.comment_added')\n else\n flash[:error] = t('flash.comment_not_added')\n end\n # Publish a message\n current_user.publish(\"Er is een reactie geplaatst\")\n redirect_to :back\n end", "def comment_params\n params.require(:comment).permit(:user_id, :channel_id, :message)\n end", "def create\n flash.notice = I18n.t(\"helpers.notices.created\", model: Comment.model_name.human) if @comment.save\n respond_with @comment, location: @comment.post\n end", "def create\n @comment = Comment.new(params[:comment])\n\n respond_to do |format|\n if @comment.save\n format.html { redirect_to @comment.generic_item, :notice => t('notice.successfully_created') }\n format.json { render :json => @comment, :status => :created, :location => @comment }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @comment = Comment.new(\n name: params[:name],\n content: params[:content],\n post: Post.find(params[:post_id])\n )\n # @comment = Comment.new(comment_params)\n respond_to do |format|\n if @comment.save\n format.html { redirect_to @comment.post, notice: \"comment was created.\" }\n else\n puts @comment.errors\n format.html { redirect_to post_path(params[:post_id]) }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @discussion_comment = DiscussionComment.new(discussion_comment_params)\n\n respond_to do |format|\n if @discussion_comment.save\n format.html { redirect_to @discussion_comment, notice: 'DiscussionComment was successfully created.' }\n format.json { render json: @discussion_comment }\n else\n format.html { render :new }\n format.json { render json: @discussion_comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def comments\n client.get(\"/#{id}/comments\")\n end", "def create\n @comment = @issue.comments.new(comment_params)\n\n respond_to do |format|\n if @comment.save\n format.html { redirect_to @issue_path, notice: 'Comment is succesfully created.' }\n format.json { render :show, status: :created, location: @comment }\n else\n format.html { render :new }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.find(params[:post_id])\n @comment = @post.comments.build(params[:comment])\n respond_to do |format|\n if @comment.save\n format.json { render :json => @comment }\n else\n format.json { render :json => @comment.errors, :status => :unprocessable_entity}\n end\n end\n #respond_with(@post,@post.comments.create(params[:comment]))\n end", "def create\n @conversation = Conversation.find(params[:conversation_id])\n if @conversation.messages.create(sender: current_user,\n content: params[:message][:content])\n redirect_to @conversation\n else\n flash[:error] = \"A problem occured\"\n redirect_to @conversation\n end\n #respond_to do |format|\n # format.js { render json: @message }\n # format.html { redirect_back_or_to :back }\n #end\n end", "def comment #create comment\n comment = Comment.new\n if comment.create_comment(params[:body], params[:video_id])#calling create_comment method of Comment model\n respond_with do |format|\n format.json {render :json => {:success => true, :message => \"comment successfully posted\"}}\n end\n else\n respond_with do |format|\n format.json {render :json => {:success => false}}\n end\n end\n end", "def create\n @comment = Comment.new(params[:comment])\n\n respond_to do |format|\n if @comment.save\n format.html { redirect_to @comment, notice: t(\"wactions.created\", model: t(\"activerecord.models.#{controller_name.singularize.gsub(\" \", \"\")}\"))}\n format.json { render json: @comment, status: :created, location: @comment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @comment = Comment.new(comment_params)\n @comment.user_id = @current_user.json_hash[:id]\n @comment.dinner_id = params[:id]\n if @comment.valid?\n @comment.save\n render json: @comment.comment_info\n else\n puts @comment.errors.messages.inspect\n render status: :bad_request, json: {\n errors: @comment.errors.messages\n }\n end\n end", "def post(content)\n post_to(\"/api/v1/messages/\", {:body => content})\n end", "def create\n @comment = Comment.new(comment_params)\n\n respond_to do |format|\n if @comment.save\n format.html { redirect_to @comment, notice: 'Comment was successfully created.' }\n format.json { render :show, status: :created, location: @comment }\n else\n format.html { render :new }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @comment = Comment.new(comment_params)\n\n respond_to do |format|\n if @comment.save\n format.html { redirect_to @comment, notice: 'Comment was successfully created.' }\n format.json { render :show, status: :created, location: @comment }\n else\n format.html { render :new }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @comment = Comment.new(comment_params)\n\n respond_to do |format|\n if @comment.save\n format.html { redirect_to @comment, notice: 'Comment was successfully created.' }\n format.json { render :show, status: :created, location: @comment }\n else\n format.html { render :new }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @comment = Comment.new(comment_params)\n\n respond_to do |format|\n if @comment.save\n format.html { redirect_to @comment, notice: 'Comment was successfully created.' }\n format.json { render :show, status: :created, location: @comment }\n else\n format.html { render :new }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def do_comment\n\t\t# 发布评论时要知道这个评论属于哪篇文章,所以要在 Article 模型上调用 find 方法查找文章对象。\n\t\t@message = Message.find(params[:message_id])\n\t\tcommenter = session[:username]\n\t comment_message = params[:comment_message]\n\t if comment_message == ''\n\t \tredirect_to \"/show/messages/#{@message.id}\"\n\t else\n\t \t@comment = @message.comments.new\n\t \t@comment.commenter = commenter\n\t \t@comment.comment_message = comment_message\n\t \t@comment.save\n\t \tredirect_to \"/show/messages/#{@message.id}\"\n\t end\n\tend", "def create_comment\n unless user_signed_in?\n render status: 403, json: { message: 'Please sign in to add a comment.' }\n end\n\n comment_params = params.permit(:content, :id)\n new_comment = Comment.create!(\n content: comment_params.require(:content),\n post_id: comment_params.require(:id),\n user_id: current_user.id\n )\n render status: :created, json: new_comment\n end", "def comment_params\n params.require(:comment).permit(:post_id, :user_id, :parent_id, :message, :deleted)\n end", "def create\n @reply = Reply.new(reply_params)\n\n if @reply.save\n render json: @reply, status: :created, location: @reply\n else\n render json: @reply.errors, status: :unprocessable_entity\n end\n end", "def post_comment(action, name, message)\n summary = :\"name_#{action}_comment_summary\".l\n comment = Comment.create!(\n :target => name,\n :summary => summary,\n :comment => message\n )\n Transaction.post_comment(\n :id => comment,\n :target => name,\n :summary => summary,\n :comment => message\n )\n end", "def comments\n render json: @post.comments\n end", "def create\n @comment = current_user.comments.new(comment_params)\n @comment.post_id = params['post_id']\n # @comment.parent_id = params[:parent_id]\n\n respond_to do |format|\n if @comment.save\n flash[:notice] = t('comment.create_success_mesg')\n @post = Post.find(params['post_id'])\n @all_comments = @post.comments.paginate(page: params[:page])\n format.html\n format.json { render :show, status: :created, location: @comment }\n format.js\n else\n flash[:notice] = t('comment.create_unsuccessful_msg')\n format.html\n format.json {\n render json: @comment.errors, status: :unprocessable_entity\n }\n format.js \n end\n end\n end", "def create\r\n\t\t#create new comment\r\n\t\t@comment = Comment.new(comment_params)\r\n\t\tif @comment.save\r\n\t\t\t#if save success send js handles the rest\r\n\t\t\t@post = @comment.post\r\n\t\t\trespond_to :js\r\n\t\telse\r\n\t\t\t# if fails alert user\r\n\t\t\tflash[:alert] = \"Something went wrong\"\r\n\t\tend\r\n\tend", "def destroy\n @messages_comment = MessagesComment.find(params[:id])\n @messages_comment.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_comments_url }\n format.json { head :no_content }\n end\n end", "def create\n if(params[:comment][:tipus] == 'comment')\n\t\t\t@post = Post.find(params[:post_id])\n \t\t@comment = @post.comments.create(params[:comment].permit(:text, :tipus))\n \telse\n \t\t@parent = Comment.find(params[:comment][:parent_id])\n \t\t#@comment = @parent.replies.create(params[:comment].permit(:text, :tipus, :parent_id))\n \t\t@comment = Comment.new(comment_params)\n \t\t@parent.replies << @comment\n \t\t@comment.tipus = 'reply'\n \t\t@comment.post_id = @parent.post.id\n\t\t\t@post = Post.find(@comment.post_id)\n \tend\n\t\t@post.update_attribute(:nComments, @post.nComments + 1)\n \t@comment.user_id = current_user.id\n\n \t@comment.save\n\n \tif @comment.save\n \t\tif @comment.tipus == 'comment'\n \t\t\tredirect_to post_path(@post)\n \t\telse\n \t\t\tredirect_to post_path(@parent.post)\n \t\tend\n \telse\n \t\trender 'new'\n \tend\n end", "def create\n @comment = @secret.comments.build(comment_params)\n @comment.user_id = current_user.id.to_s\n if @comment.save\n comment = CommentModel.new(@comment, current_user)\n render json: comment\n else\n render json: @comment.errors, status: :unprocessable_entity\n end\n end", "def create\n @comment = Comment.new(comment_params)\n @comment.user_id = current_user.id if current_user\n\n #render :json => {status: 0, user: current_user, content: @comment.content}\n if current_user && @comment.save\n receive_user = Share.find_by(id: comment_params['share_id']).user\n ## TODO\n #if receive_user.username != current_user.username\n Notification.create( kind: \"comment\", receive_user_id: receive_user.id, receive_user: receive_user.username, send_user: current_user.username )\n #end\n comment_size = Share.find(comment_params['share_id']).comments.size\n render :json => {status: 0, user: current_user, content: @comment.content, comment_size: comment_size}\n else\n render :json => {status: 1, user: nil}\n end\n end", "def create\n comment = Comment.new(params[:comment])\n @entry.comments << comment if comment.valid?\n respond_with(comment, location: redirect_to_index)\n end", "def create\n @message = Message.new(message_params)\n\n if @message.save\n @user = User.find(@message.user_id)\n @user.messages << @message\n render json: @message, status: :created\n else\n render json: @message.errors, status: :unprocessable_entity\n end\n end", "def comment_params\n params.require(:comment).permit(:content, :user_id, :post_id, :reply_id)\n end", "def create\n #if @user && @user.posts.include(@post)\n @comment = @post.comments.create!(comment_params)\n json_response(@comment, :created)\n end", "def create\n @comment = Comment.new(params[:comment])\n\n respond_to do |format|\n if verify_recaptcha(:mode => @comment, :message => \"Recaptcha error\") && @comment.save\n Notify.comment(@comment).deliver\n format.html { redirect_to post_path(@comment.post, :anchor => \"comment_#{@comment.id}\"), :notice => t(\"messages.comments.created\") }\n format.xml { render :xml => @comment.post, :status => :created, :location => @comment }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end", "def comment(id)\n record \"/msg/comment/#{id}\"\n end" ]
[ "0.69470954", "0.6902832", "0.6787189", "0.6776868", "0.67043555", "0.6638144", "0.66221327", "0.661672", "0.652321", "0.6503006", "0.6503006", "0.6503006", "0.648112", "0.64441323", "0.6440048", "0.6402352", "0.63985837", "0.63964766", "0.6380872", "0.6375054", "0.6375054", "0.6375054", "0.63661563", "0.63634914", "0.634775", "0.6342502", "0.6333865", "0.6298601", "0.62931275", "0.62930936", "0.6283201", "0.62722325", "0.62684536", "0.6262697", "0.62600124", "0.6257669", "0.6246527", "0.62345606", "0.62303966", "0.6218674", "0.6218446", "0.62155366", "0.6212917", "0.620999", "0.62085164", "0.6208341", "0.62082493", "0.61995715", "0.61953026", "0.6180996", "0.6179296", "0.61792517", "0.61745256", "0.6173273", "0.6167573", "0.61671406", "0.6156745", "0.61524165", "0.61514527", "0.6145681", "0.6145559", "0.61446404", "0.61359024", "0.6130822", "0.6129748", "0.61183536", "0.61136496", "0.61056876", "0.6085258", "0.6077339", "0.6077054", "0.6075518", "0.60745674", "0.60673684", "0.6064955", "0.6063845", "0.6063103", "0.6062769", "0.6056134", "0.6056134", "0.6056134", "0.6056134", "0.60542315", "0.60448396", "0.6038346", "0.603573", "0.60334325", "0.6029258", "0.60212636", "0.602064", "0.6012162", "0.60101044", "0.60073817", "0.60055816", "0.6005291", "0.59976774", "0.5996298", "0.59882146", "0.59867686", "0.59856045" ]
0.7440708
0
PUT /messages_comments/1 PUT /messages_comments/1.json
def update @messages_comment = MessagesComment.find(params[:id]) respond_to do |format| if @messages_comment.update_attributes(params[:messages_comment]) format.html { redirect_to @messages_comment, notice: 'Messages comment was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @messages_comment.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n user = User.find_by({token: env['HTTP_TOKEN']})\n comment = user.comments.find(params[:id])\n comment.update(comment_params)\n render json: comment\n end", "def update\n @comment = Comment.find(params[:comment_id])\n @comment.update(comment_params)\n render json: @comment\n end", "def update\n comment = Comment.find(params[:id])\n if comment.update(params_comment)\n render json: comment, status: 200\n else\n render json: comment.errors, status: 422\n end\n\n end", "def update\n if @comment.update(comment_params)\n render json: @comment, status: :ok\n else\n render json: @comment.errors, status: :unprocessable_entity\n end\n end", "def update\n json_update_and_sanitize(comment, comment_params, Comment)\n end", "def update\n @comment = Comment.find(params[:id])\n @comment.user_id = params[:user_id]\n @comment.announcement_id = params[:announcement_id]\n @comment.description = params[:description]\n @comment.save\n render json:@comment\n end", "def update\n\n if @comment.update(comment_params)\n render json: @comment, status: :ok\n else\n render json: @comment.errors, status: :unprocessable_entity\n\n end\n\n\n end", "def update\n if @comment.update(comment_params)\n head :no_content\n else\n render json: @comment.errors, status: :unprocessable_entity\n end\n end", "def update\n if @comment.update(comment_params)\n head :no_content\n else\n render json: @comment.errors, status: :unprocessable_entity\n end\n end", "def update\n if @comment.update(comment_params)\n render json: @comment, serializer: CommentSerializer\n else\n render_error :unprocessable_entity, @comment.errors\n end\n end", "def update\n if @comment.update(comment_params)\n render json: {status: 'Comment was successfully updated.'}, status: :201\n else\n render json: { message: \"Error. Error. Please try again.\"}, status: 400\n end\n end", "def update\n if @comment.update_attributes(comment_params)\n render json: @comment, status: :ok\n else\n render json: {error: \"Not found\"}, status: :not_found\n end\n end", "def update_comment(id, comment, attachments=[])\n prepare_attachments(attachments)\n record \"/msg/update_comment\", :comment_id => id,\n :comment => comment, :attachments => attachments\n end", "def update\n @comment = Comment.find(params[:id])\n if @comment.update(comment_params)\n render json: {status: \"success\", data: {comment: @comment}}, status: :ok\n else\n render json: @comment.errors, status: :unprocessable_entity\n end\n end", "def update\n authorize [:api, :v1, @requesting_object]\n ticket = ServiceTicket.where(\n client_key: params['avatar_key'],\n id: params['id']\n ).first\n if params['comment_text']\n ticket.comments << Comment.new(author: params['avatar_name'],\n text: params['comment_text'])\n end\n ticket.update(status: params['status']) if params['status']\n render json: { message: 'OK' }, status: :ok\n end", "def update\n @comment = Comment.find(params[:id])\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.json { render :json => @comment }\n else\n format.json { render :json => @comment.errors, :status => :unprocessable_entity}\n end\n end\n #respond_with(@post,@post.comments.update(params[:id],params[:comment]))\n end", "def update\n @comment = Comment.find(params[:id])\n authorize @comment\n if @comment.update(comment_params)\n render 'api/v1/comments/show', status: :success\n else\n render json: @comment.errors, status: :unprocessable_entity\n end\n end", "def update\n message = Message.find(params[:id])\n message.update(message_params)\n render json: message\n end", "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_back(fallback_location: root_path, notice: t('comment.update_msg')) }\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render :edit }\n format.json {\n render json: @comment.errors, status: :unprocessable_entity\n }\n end\n end\n end", "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to project_sprint_user_story_comments_path, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, notice: t(\"actions.updated\", model: t(\"activerecord.models.#{controller_name.singularize.gsub(\" \", \"\")}\"))}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @comment.update(comment_params)\n end", "def comments_put(resource, comment)\n merged_options = options.merge({ resource: resource, comment: comment })\n response = RestClient.post endpoint(\"/comments/put\"), merged_options\n parse_response(response)\n end", "def update\n authorize(comment)\n if comment.update(comment_params)\n render json: { message: \"Feedback successfully updated!\", error: false}\n else\n render json: { message: \"Sorry, feedback could was not updated. Please try again.\", error: true }\n end\n end", "def update\n @message = Message.find(params[:id])\n @message.update(text: params[\"_json\"])\n render json: @message\n end", "def update\n\t respond_to do |format|\n\t if @comment.update(comment_params)\n\t format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n\t format.json { head :no_content }\n\t else\n\t format.html { render action: 'comment' }\n\t format.json { render json: @comment.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def update\n\n if @comment.update(comment_params)\n\n render json: @comment,status: :ok\n\n else\n\n render json: {error: true,errors: @comment.errors},status: :unprocessable_entity\n\n end\n\n \t\tend", "def update\n # @comment = Comment.find(params[:id])\n end", "def put_comment(object_id, message, options = {})\n # Writes the given comment on the given post.\n self.put_object(object_id, \"comments\", {:message => message}, options)\n end", "def update\n @item = Item.find(params[:item_id])\n @comment = @item.comments.new(comment_params)\n respond_to do |format|\n push_count(@item.id, @item.comments.count)\n if @comment.update(comment_params)\n format.html { redirect_to [@item, @comment], notice: 'Comment was successfully updated.' }\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render :edit }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n return forbidden unless user_owns_comment\n return bad_request(@comment.errors.full_messages) unless @comment.update_attributes(text: comment_params[:text])\n\n render json: {data: {message: 'The comment has been updated'}}, status: :ok\n end", "def update\n flash.notice = I18n.t(\"helpers.notices.updated\", model: Comment.model_name.human) if @comment.save\n respond_with @comment, location: @comment.post\n end", "def update\r\n @noriskmessage = Noriskmessage.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @noriskmessage.update_attributes(params[:noriskmessage])\r\n format.html { redirect_to @noriskmessage, notice: '您的评论已经修改成功。' }\r\n format.json { head :ok }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @noriskmessage.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { render :json => {:comment => @comment, :status => 200} }\n else\n format.html { render :edit }\n format.json { render :json => {:comment => @comment, :status => 400 } }\n end\n end\n end", "def update\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment.generic_item, :notice => t('notice.successfully_updated') }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { render :show, status: :ok, \tºlocation: @comment }\n else\n format.html { render :edit }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render :edit }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render :edit }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render :edit }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render :edit }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render :edit }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render :edit }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render :edit }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render :edit }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render :edit }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render :edit }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render :edit }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render :edit }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render :edit }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render :edit }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render :edit }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render :edit }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render :edit }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @comment = @network.comments.find(params[:id])\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n flash[:notice] = 'Comment was successfully updated.'\n format.html { redirect_to([:admin, @network, :comments]) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @v1_message = V1::Message.find(params[:id])\n\n if @v1_message.update(message_params)\n render json: @v1_message, status: :ok\n else\n render json: @v1_message.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @issue_path, notice: 'Comment is sucesfully updated.' }\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render :edit }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @comment = current_user.comments.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_comment\n @comment = Comment.find(params[:id])\n @comment.update(params[:comment])\n redirect \"/comments/#{@comment.id}\"\n end", "def update\n if @message.update(message_params)\n render json: @message\n else\n render json: @message.errors, status: :unprocessable_entity\n end\n end", "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.xml { head :ok }\n format.json { head :ok } \n else\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n format.json { render :json => @comment.errors, :status => :unprocessable_entity } \n end\n end\n end", "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, :notice => 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, :notice => 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @api_v1_answer_comment.update(api_v1_answer_comment_params)\n format.html { redirect_to @api_v1_answer_comment, notice: 'Answer comment was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_answer_comment }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_answer_comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment, notice: 'Zmodyfikowano komentarz.' }\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render :edit }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, :notice => 'Comment was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, :notice => 'Comment was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end", "def read\n @message = Message.find(params[:id])\n authorize @message\n @message.comments.each do |comment|\n comment.status = \"read\"\n comment.save\n end\n end", "def comment(id)\n record \"/msg/comment/#{id}\"\n end", "def update_comment(comment, content)\n bucket_id = comment.bucket.id\n\n put(\"/buckets/#{bucket_id}/comments/#{comment.id}\", body: { content: content })\n end", "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to post_path(@comment.post, :anchor => \"comment_#{@comment.id}\"), :notice => t(\"messages.comments.updated\") }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_comment!(session_key, comment_id, body)\n comment = find_comment_by_session_and_id!(session_key, comment_id)\n comment.update!(body: body)\n rescue ActiveRecord::RecordInvalid => ex\n raise Errors::MalformedRequest, ex\n end", "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, notice: 'comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @comment = @task.comments.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n flash[:notice] = 'Comment was successfully updated.'\n format.html { redirect_to(sprint_task_comments_path(@sprint,@task)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment.snippet, notice: 'Comment was successfully updated.' }\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render @comment.snippet }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @comment1.update(comment1_params)\n format.html { redirect_to @comment1, notice: 'Comment1 was successfully updated.' }\n format.json { render :show, status: :ok, location: @comment1 }\n else\n format.html { render :edit }\n format.json { render json: @comment1.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @comment = Comment.find(params[:id])\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to post_comment_path(@post, @comment), notice: \"Comment was successfully updated.\" }\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment, notice: 'Comentario actualizado.' }\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render :edit }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @comment1 = Comment1.find(params[:id])\n\n respond_to do |format|\n if @comment1.update_attributes(params[:comment1])\n format.html { redirect_to @comment1, notice: 'Comment1 was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment1.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @fbcomment = Fbcomment.find(params[:id])\n\n if @fbcomment.update(fbcomment_params) #private section#\n head :no_content\n else\n render json: @fbcomment.errors, status: :unprocessable_entity\n end\n end", "def update\n @comment_q = CommentQ.find(params[:id])\n\n respond_to do |format|\n if @comment_q.update_attributes(params[:comment_q])\n format.html { redirect_to @comment_q, notice: 'Comentario actualizado correctamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment_q.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \t@topic = Topic.find(params[:topic_id])\n \t@comments = @topic.comments\n if @comment.update(comment_params)\n \tflash[:success] = \"Comment was successfuly updated.\"\n \trespond_to do |format|\n \t\tformat.html{ redirect_to board_topic_path(@topic.board.id, @topic.id) }\n \t \tformat.js\n \tend \n else\n \tflash[:warning] = 'Comment cannot be updated.'\n \tredirect_to board_topic_path(@topic.board.id, @topic.id)\n end\n end", "def update_comment(update_key, comment)\n path = \"/people/~/network/updates/key=#{update_key}/update-comments\"\n body = {'comment' => comment}\n post(path, MultiJson.dump(body), \"Content-Type\" => \"application/json\")\n end", "def update\n @comment = @item.comments.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n flash[:notice] = 'Comment was successfully updated.'\n format.html { redirect_to(@comment) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment.article, notice: 'Comment was successfully updated.' }\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render :edit }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment.article, notice: 'Comment was successfully updated.' }\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render :edit }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.70348257", "0.6787702", "0.6676065", "0.6634039", "0.66048676", "0.6600948", "0.65784985", "0.65628254", "0.65628254", "0.6556255", "0.6528029", "0.6518304", "0.6501202", "0.6499012", "0.64843047", "0.64348024", "0.6432864", "0.64287406", "0.6400872", "0.63966185", "0.63624644", "0.6356305", "0.6349873", "0.6319453", "0.6306361", "0.6303991", "0.6303623", "0.6299426", "0.62982225", "0.62976474", "0.6277601", "0.6275402", "0.62714225", "0.6249686", "0.62406236", "0.6221297", "0.62060475", "0.62060475", "0.62060475", "0.62060475", "0.62060475", "0.62060475", "0.62060475", "0.62060475", "0.62060475", "0.62060475", "0.62060475", "0.62060475", "0.62060475", "0.62060475", "0.62060475", "0.62060475", "0.62060475", "0.6205356", "0.6201353", "0.62004113", "0.6196618", "0.61936885", "0.6193588", "0.6193572", "0.6190083", "0.6190083", "0.6186636", "0.61832845", "0.61832845", "0.61832845", "0.61832786", "0.617991", "0.61784023", "0.61784023", "0.6168398", "0.61653423", "0.61605", "0.6159628", "0.61563903", "0.6155565", "0.61464494", "0.61448413", "0.61388636", "0.61366683", "0.613584", "0.61308926", "0.6128212", "0.6128212", "0.6128212", "0.6128212", "0.6128212", "0.6128212", "0.6128212", "0.6128212", "0.6128212", "0.6126244", "0.6124599", "0.6119966", "0.6112374", "0.61118525", "0.6110366", "0.6110366", "0.60943365", "0.60943365" ]
0.7263574
0
DELETE /messages_comments/1 DELETE /messages_comments/1.json
def destroy @messages_comment = MessagesComment.find(params[:id]) @messages_comment.destroy respond_to do |format| format.html { redirect_to messages_comments_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_comment(id)\n record \"/msg/delete_comment/#{id}\"\n end", "def destroy\n @comment.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n\n @comment.destroy\n render json: @comment, status: :ok\n\n end", "def destroy\n # delete a specific message\n end", "def destroy\n @v1_message = V1::Message.find(params[:id])\n @v1_message.destroy\n\n head :no_content\n end", "def destroy\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to :back, :notice => t('successfully_deleted')}\n format.json { head :no_content }\n end\n end", "def destroy\n @comment1 = Comment1.find(params[:id])\n @comment1.destroy\n\n respond_to do |format|\n format.html { redirect_to comment1s_url }\n format.json { head :no_content }\n end\n end", "def delete_comments\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n render json: 'Message was successfully deleted', status: :ok\n end", "def destroy\n # delete a specific message\n end", "def delete\n @client.post('/api/del_msg', id: get_attribute(:name))\n end", "def destroy\n @comment1.destroy\n respond_to do |format|\n format.html { redirect_to comment1s_url, notice: 'Comment1 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message.destroy\n \n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = @commentable.comments.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @chat = Chat.find(params[:id])\n if @chat.users.count > 1\n @chat.users.delete(current_user)\n else\n @chat.messages.each do |msg|\n msg.destroy\n end\n @chat.destroy\n end\n respond_to do |format|\n format.html { redirect_to chats_url, :notice => 'comment deleted' }\n format.js\n\n\n end\n end", "def destroy\n @comment.destroy\n respond_to do |format|\n format.html { redirect_to project_sprint_user_story_comments_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment.destroy\n head :no_content\n end", "def destroy\n @comment.destroy\n head :no_content\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n render json:@comment\n end", "def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment.destroy\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment.destroy\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment.destroy\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "def delete_message(id)\n record \"/msg/delete/#{id}\"\n end", "def destroy\n # delete a specific message\n end", "def destroy\n @comment.destroy\n respond_to do |format|\n format.html { redirect_to comments_url, notice: 'Comentario eliminado.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n \n respond_to do |format|\n format.xml { head :ok }\n format.json { head :ok } \n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @message = @comment.message\n @comment.destroy if current_user == @comment.user\n\n respond_to do |format|\n format.html { redirect_to(@message) }\n format.js do\n render :update do |page|\n page.remove \"comment_#{params[:id]}\"\n end\n end\n format.xml { head :ok }\n end\n end", "def destroy\n @comment.destroy!\n head :no_content\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :ok }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :ok }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :ok }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :ok }\n end\n end", "def destroy\n @comment14.destroy\n respond_to do |format|\n format.html { redirect_to comment14s_url, notice: 'Comment14 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @direct_message.destroy\n \n respond_to do |format|\n format.html { redirect_to DirectMessages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'message.deleted' }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n respond_to do |format|\n format.html { redirect_to noticias_messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = Comment.find(params[:comment_id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n head :no_content\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n head :no_content\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :ok }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :ok }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :ok }\n end\n end", "def destroy\n @comment.destroy\n respond_to do |format|\n format.html { redirect_to comments_url, notice: t(\"actions.destroyed.male\", model: t(\"activerecord.models.#{controller_name.singularize.gsub(\" \", \"\")}\").downcase) }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment.destroy\n respond_to do |format|\n format.html { redirect_to comments_url, notice: 'Usunięto komentarz.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @message_post = MessagePost.find(params[:id])\n @message_post.destroy\n\n respond_to do |format|\n format.html { redirect_to message_posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_message = AdminMessage.find(params[:id])\n @admin_message.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to conversations_url }\n format.json { head :ok }\n end\n end", "def destroy\n if @comment.nil?\n render json: {error: \"Not found\"}, status: :not_found\n else\n @comment.destroy\n render json: @comment, status: :ok\n\n end\n end", "def destroy\n @comments = Comment.where(question_id: @question.id)\n @comments.each do |comment|\n comment.destroy\n end\n @question.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reply = @message.replies.find(params[:id])\n @reply.destroy\n\n respond_to do |format|\n format.html { redirect_to([@user,@message]) }\n format.xml { head :ok }\n end\n end", "def destroy\n @comment.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @visit_comment.destroy\n respond_to do |format|\n format.html { redirect_to visit_comments_url, notice: 'Comentario eliminado con exito' }\n format.json { head :no_content }\n end\n end", "def delete_message(message_id)\n RestClient.delete(\"#{@url}/messages/#{message_id}\")\n end", "def destroy\n if @commentable.comments.find(params[:id]).destroy\n render json: { success: true }\n end\n end", "def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to [@member, :messages] }\n format.json { head :no_content }\n end\n end", "def message_delete(id)\n request(:delete, \"messages/#{id.to_s}\")\n end" ]
[ "0.71931666", "0.71432465", "0.71238524", "0.70616955", "0.70515424", "0.7010227", "0.69748765", "0.6969526", "0.6964472", "0.69637764", "0.6957433", "0.69319874", "0.6931949", "0.6930181", "0.69289327", "0.6913211", "0.6904451", "0.6884654", "0.6884654", "0.6883664", "0.68809134", "0.68809134", "0.68792176", "0.6874483", "0.6874483", "0.6874483", "0.6870587", "0.68678665", "0.68476313", "0.6847446", "0.68350315", "0.6823406", "0.68202686", "0.68202686", "0.68202686", "0.68202686", "0.6814002", "0.6809245", "0.6808262", "0.6808262", "0.6808262", "0.6808262", "0.6808262", "0.6808262", "0.6808262", "0.6808262", "0.6808262", "0.6808262", "0.6808262", "0.6808262", "0.6808262", "0.6808262", "0.6808262", "0.6808262", "0.6808262", "0.6808262", "0.6808262", "0.6808262", "0.6808262", "0.68078387", "0.6802732", "0.6800102", "0.678793", "0.6784258", "0.6779709", "0.6778517", "0.6767288", "0.6767288", "0.6767288", "0.6762426", "0.6750187", "0.6741308", "0.67379105", "0.67378074", "0.6737763", "0.6737763", "0.6737763", "0.6737763", "0.6737763", "0.6737763", "0.6737763", "0.6737763", "0.6737763", "0.6737763", "0.6737763", "0.6737763", "0.6737763", "0.6737763", "0.6737763", "0.67372644", "0.67362607", "0.67347836", "0.6733106", "0.67263526", "0.6724888", "0.6714759", "0.6713764", "0.6712133", "0.6706533", "0.67064774" ]
0.76316255
0
Last week = 6 points, last month = 3 points, etc.
def trend_points_for_creation_date(obj) if obj.created_at > 1.day.ago then 50 elsif obj.created_at > 1.week.ago then 25 elsif obj.created_at > 2.weeks.ago then 10 elsif obj.created_at > 3.weeks.ago then 3 else 0 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def last_week(x = 1)\n\t\tself - (604800 * x)\n\tend", "def fortnights ; self * 2.weeks ; end", "def last_week\n Date.week(Date.today - 7)\n end", "def last\n Koyomi::Week.new(self.koyomi_month.last, self.week_start).last\n end", "def weekly_points\n weekly_crime_points + weekly_suspension_points\n end", "def beginning_of_week; end", "def beginning_of_week; end", "def weeks() 7 * days end", "def bf_sort_point\n point = 0\n\n # recent review worth more points\n self.member_reviews.each do |r|\n point += 10 if r.created_at > 2.weeks.ago\n point += 3 if r.created_at > 6.weeks.ago and r.created_at <= 2.weeks.ago\n point += 1 if r.created_at <= 6.weeks.ago \n end\n\n point\n end", "def last_7_day_kwh_usage_by_day\n usage_data = []\n Time.now.utc.to_date.downto(6.days.ago.utc.to_date).each do |date|\n usage_data << total_day_kwh_usage_on(date).round(2)\n end\n usage_data\n end", "def current_week_kwh_usage\n total_week_kwh_usage_until(Time.now.utc.to_date).round(2)\n end", "def fortnights\n\t\treturn self * 2.weeks\n\tend", "def fortnights\n\t\treturn self * 2.weeks\n\tend", "def weeks ; self * 7.days ; end", "def week_calculations\n\t\t@first_of_month = @beg_range.to_date.beginning_of_month \n\t\t@last_of_month = @beg_range.to_date.beginning_of_month.next_month-1 \n\t\tif (@end_range+7).between?(@first_of_month, @last_of_month) \n\t\t\tif @beg_range.between?(@beg_range.prev_month.end_of_month, @beg_range.beginning_of_month+1) \n\t\t\t\t# <!--1st Week-->\n\t\t\t\t @prev_beg_range = @beg_range.prev_month.beginning_of_month + 4.weeks \n\t\t\t\t @prev_end_range = @end_range.prev_month.end_of_month \n\t\t\t\t\n\t\t\t\t @next_beg_range = @beg_range+7.days \n\t\t\t\t @next_end_range = @end_range+7.days \n\t\t\telse \n\t\t\t\t# <!--Middle Weeks-->\n\t\t\t\t @prev_beg_range = @beg_range-7.days \n\t\t\t\t @prev_end_range = @end_range-7.days \n\t\t\t\t\n\t\t\t\t @next_beg_range = @beg_range+7.days \n\t\t\t\t @next_end_range = @end_range+7.days \n\t\t\tend \n\t\telsif \n\t\t\tif @beg_range.next_week.beginning_of_week.between?(@first_of_month, @last_of_month) \n\t\t\t\t# <!--4th Week-->\n\t\t\t\t @prev_beg_range = @beg_range-7.days \n\t\t\t\t @prev_end_range = @end_range-7.days \n\t\t\t\t\n\t\t\t\t @next_beg_range = @beg_range+7.days \n\t\t\t\t @next_end_range = @end_range.end_of_month \t\t\n\t\t\telse \n\t\t\t\t# <!--5th Week-->\n\t\t\t\t @prev_beg_range = @beg_range-7.days \n\t\t\t\t @prev_end_range = @end_range-2.days \n\t\t\t\t\n\t\t\t\t @next_beg_range = @beg_range.next_month.beginning_of_month \n\t\t\t\t @next_end_range = @end_range.next_week.beginning_of_month+6.days \n\t\t\tend \n\t\tend \n\tend", "def weeks\n lines[2..-1]\n end", "def aging_weeks__c\n if %w(1 true).include?(is_closed.to_s.downcase)\n (last_modified_date.to_i-created_date.to_i)/(60*60*24*7)\n else\n (Time.now.to_i - created_date.to_i)/(60*60*24*7)\n end\n end", "def calc_weeks_till\n (calc_days_till / 7.0).round(2)\n end", "def calculate_timeline_week_count\n ((@course.timeline_end.to_date - @beginning_of_first_week).to_f / 7).ceil\n end", "def ending_of_week\n if current_week.index(day) == 6\n self.class.new(year, month, current_week.last)\n elsif current_week.index(day) < 6\n if self.class == Date\n self + (6 - current_week.index(day))\n elsif self.class == Time\n self + (60 * 60 * 24 * (6 - current_week.index(day)))\n end\n end\n end", "def end_of_week\n if current_week.index(self.day) == 6\n self.class.new(year,month,current_week.last)\n elsif current_week.index(self.day) < 6\n if self.class == Date\n self + (6 - current_week.index(self.day))\n elsif self.class == Time\n self + (60 * 60 * 24 * (6 - current_week.index(self.day)))\n end\n end\n end", "def week; end", "def ops_calendar\n # setup calendar cells\n @today = Date.today - 3\n if @today.strftime(\"%a\") == \"Mon\"\n @start_date = @today\n else\n @start_date = @today\n until @start_date.strftime(\"%a\") == \"Mon\"\n @start_date -= 1\n end\n end\n @end_date = @start_date+21\n @date_range = (@start_date..@end_date)\n @weeks = @date_range.to_a.in_groups_of(3)\n\n\n end", "def date_of_last_week\n current = Time.current\n current -= 1.week\n current.strftime('%Y-%V')\n end", "def get_metrics_latest\n get_metrics_days_back(45)\n end", "def weeks\n self.to_i * 604_800\n end", "def week\n @week ||= (((date-start_of_month)+1)/7.0).ceil\n end", "def end_of_week; self + (6 - wday).days end", "def cutoff_date\n case date.wday\n when 0\n date + (weeks.to_i * 7)\n when 1\n date + (weeks.to_i * 7) - 1\n when 2\n date + (weeks.to_i * 7) - 2\n when 3\n date + (weeks.to_i * 7) - 3\n when 4\n date + (weeks.to_i * 7) - 4\n when 5\n date + (weeks.to_i * 7) - 5\n when 6\n date + (weeks.to_i * 7) + 1\n end\n end", "def date_end # originally date_start\n\tdate = Date.today\n\t(1..7).each do |n|\n\t\tdate = Date.today - n#.days\n\t\tbreak if date.wday == 6 # 0 = Sun, 1 = Mon ... 6 = Sat\n\tend\n\tdate\nend", "def number_of_weeks\n @number_of_weeks ||= cell_row(last_of_month) + 1\n end", "def mweek; (5 - wday + day) / 7 end", "def current_week\n\t\t#TODO\n\tend", "def rank_last_week\n @data['rank_last_week']\n end", "def total_weeks\n ((self.deadline - self.start_date) / 7).to_i\n end", "def planned_duration\n planned_value_by_week.count - 1 \n end", "def all_weeks\n @all_weeks ||=\n data_points.each_with_object(Hash.new(0)) { |feed, all_weeks|\n all_weeks[feed.occurred_on.beginning_of_week(week_start_day)] += feed.send(field)\n }\n end", "def cfp_weeks\n result = 0\n if call_for_papers\n result = call_for_papers.weeks\n end\n result\n end", "def current_week\n standings = Standing.all.order(:wins).reverse\n\n user_standing_index = nil\n standings.each_with_index do |st, index|\n user_standing_index = index if st.user_id == current_user.id\n end\n\n ahead_user_standings = standings[user_standing_index - 1]\n behind_user_standings = standings[user_standing_index + 1]\n\n ahead_user = User.find(ahead_user_standings.user_id)\n behind_user = User.find(behind_user_standings.user_id)\n\n @user_standing = {\n place: user_standing_index + 1,\n wins: standings[user_standing_index].wins\n }\n\n @current_week = Week.last\n games = Game.where(week_id: @current_week.id)\n @games = games.order(:game_finished, :date, :start_time)\n\n if games.order(updated_at: :desc).first\n @last_upd = games.order(updated_at: :desc).first.updated_at\n else\n @last_upd = @current_week.updated_at\n end\n\n @correct = 0\n ahead_correct = 0\n behind_correct = 0\n\n @picks = {}\n @games.each do |g|\n user_pick = g.picks.where(user_id: current_user.id)\n ahead_pick = g.picks.where(user_id: ahead_user.id)\n behind_pick = g.picks.where(user_id: behind_user.id)\n\n pick_count = g.picks.count.to_f\n away_count = g.picks.where(away_home: 'away').count.to_f\n home_count = g.picks.where(away_home: 'home').count.to_f\n\n if away_count > home_count\n field = \"#{g.away} (#{(away_count / pick_count) * 100}%)\"\n elsif home_count > away_count\n field = \"#{g.home} (#{(home_count / pick_count) * 100}%)\"\n else\n field = 'split 50/50'\n end\n\n if user_pick[0] != nil\n if user_pick[0].pick\n @picks[user_pick[0].game_id] = { \n :pick => user_pick[0].pick, \n :away_home => user_pick[0].away_home,\n :field => field\n }\n end\n\n if user_pick[0].tbreak_pts != nil\n @tbreak_pts = user_pick[0].tbreak_pts\n end\n\n if g[:game_finished] == true\n @correct += 1 if user_pick[0].away_home == g.winner\n ahead_correct += 1 if ahead_pick[0].away_home == g.winner\n behind_correct += 1 if behind_pick[0].away_home == g.winner\n end\n end\n end\n\n @ahead = {\n user: ahead_user.username,\n wins: ahead_user_standings.wins,\n correct_this_week: ahead_correct\n }\n\n @behind = {\n user: behind_user.username,\n wins: behind_user_standings.wins,\n correct_this_week: behind_correct\n }\n end", "def previous_week\n if self.class == Date\n self - 7\n elsif self.class == Time\n self - (60 * 60 * 24 * 7)\n end\n end", "def previous_week\n if self.class == Date\n self - 7\n elsif self.class == Time\n self - (60 * 60 * 24 * 7)\n end\n end", "def weeks ; Duration[self * 604800] ; end", "def weeks; self * WEEK; end", "def weeks; self * WEEK; end", "def income_this_week\n Sale.past_week.sum(:total)\n end", "def weeks\n\t\treturn self * 7.days\n\tend", "def weeks\n\t\treturn self * 7.days\n\tend", "def training_sessions_remaining_this_month\n end", "def weekStats()\r\n # Get the first day\r\n curCal = JCalendar::getInstance()\r\n curCal.add(JCalendar::DATE, -7)\r\n weekStatsCount = @daohelper.getVisitAuditDate(curCal)\r\n \r\n # Extract visit stats for the last 7 days\r\n i = -6\r\n statMap = {}\r\n statMapDates = {}\r\n while i <= 0\r\n curCal = JCalendar::getInstance()\r\n curCal.add(JCalendar::DATE, i)\r\n curStat = @daohelper.getVisitAuditOnDate(curCal) \r\n strId = \"stats#{i + 6}\"\r\n statMap[strId] = curStat\r\n statMapDates[strId] = curCal\r\n i += 1\r\n end\r\n\r\n stats = BotListVisitLogStatsForm.new\r\n stats.weekVisits = weekStatsCount\r\n stats.weekStats = statMap\r\n stats.weekStatsDates = statMapDates\r\n return stats\r\n end", "def fortnights_since(date)\n\t\t\t((::Time.zone.today - date) / 14).to_i\n\t\tend", "def last_week\n (Time.zone.today - 7.days).strftime('%d-%b-%Y')\n end", "def last_week( remaining_days )\n pad = DPW - remaining_days.length\n\t\tremaining_days + Array.new( pad )\n end", "def calories_week(db, member_id)\n total_calories= []\n t = DateTime.now\n past_week = ((t-6)..t).map{ |date| date.strftime(\"%m-%d\") }\n past_week.each do |x|\n calories_date= db.execute(\"SELECT * FROM calories WHERE member_id='#{member_id}' AND day='#{x}' \")\n calories_date.each do |cals|\n total_calories << cals['amt_burned']\n end \n end \n total_calories.inject(:+)\nend", "def week\n stamp = params[:stamp].to_i\n interval = (params[:interval] || 10).to_i\n plus_weeks = (params[:plus_weeks] || 0).to_i\n context = (params[:context] || 0).to_i == 1 ? true : false\n time = Time.at(stamp).utc\n\n # Calculate monday from given date\n wday = time.wday\n # Adjust for sunday when we want to start on a monday\n wday = 7 if wday == 0\n\n date = time - (wday.days - 1.days)\n\n date = date + plus_weeks.weeks\n\n # Number of days in week range if we add context, we add the surrounding weeks as well\n days = context ? (7 * 3) - 1 : 6\n\n # If context we'll start at the monday before\n if context\n date -= 7.days\n end\n\n\n\n week_data = []\n week_dates = []\n\n buckets = 0.step((60 * 24) - 1, interval).to_a\n\n (0..days).each do |day|\n interval_data = Hash.new { |h, k| h[k] = [] }\n\n data = GlucoseSensorData.by_day(date.to_date, :field => :timestamp)\n\n data.each do |datum|\n minutes = datum.timestamp.min + (datum.timestamp.hour * 60)\n # At first seems like a no op but this actually buckets minutes into intervals\n bucket = (minutes / interval) * interval\n\n interval_data[bucket] << datum\n end\n\n week_context = nil\n\n if context\n week_number = day / 7\n if week_number == 0\n week_context = \"before\"\n elsif week_number == 1\n week_context = \"current\"\n else\n week_context = \"after\"\n end\n else\n week_context = \"current\"\n end\n\n buckets.each do |bucket|\n datum = {}\n\n datums = interval_data[bucket]\n # Averages glucose values if there are more than one datum for that bucket\n if datums.length > 0\n datum[:glucose] = datums.inject(0.0) { |sum, d| sum + d.glucose } / datums.size\n #datum[:timestamp] = datums[0].timestamp.to_i\n end\n datum[:timestamp] = (date + bucket.minutes).to_i\n datum[:week_context] = week_context\n\n\n datum[:time] = bucket\n datum[:day] = date.strftime(\"%A\").downcase\n datum[:date] = date.to_i\n week_data << datum\n end\n\n week_dates.push({ :week_context => week_context, :day => date.strftime(\"%A\").downcase, :date => date.to_i })\n date += 1.days\n end\n\n render :json => { :data => week_data, :interval => interval, :week_dates => week_dates }\n end", "def get_current_week_from_weeks(weeks)\n now = DateTime.now\n weeks.each { |week|\n if now < week.start_time\n return (week.number - 1)\n end\n }\n return weeks.last.number\n end", "def max_weeks\n return SurvivorEntry::MAX_WEEKS_MAP[self.get_game_type]\n end", "def current_week\n self.week.to_i\n end", "def general_week_of_month\n if week_split.first.first.nil?\n week_of_month - 1\n else\n week_of_month\n end\n end", "def default_latest(earliest = default_earliest)\n earliest + 2.weeks\n end", "def smoked_this_week\n Smoke.by_user(id).this_week(Date.today).sum(:counted) || 0\n end", "def bye_weeks\n Set.new(((1..17).to_a - (cached_home_games.map(&:week) + cached_away_games.map(&:week))))\n end", "def end_of_week\n 6.days.from_now(beginning_of_week).end_of_day\n end", "def weeks_in_month(date_time=Time.now)\n week_number(last_day_of_month(date_time)) - week_number(first_day_of_month(date_time)) + 1\n end", "def nwrug_meet_for year, month\n beginning_of_month = Date.civil(year, month, 1)\n nwrug = beginning_of_month + (18 - beginning_of_month.wday)\n nwrug += 7 if beginning_of_month.wday > 4\n\n # Make sure we skip to the next month if we've gone past this month's meet\n if nwrug < Date.today\n if month == 12\n month = 1\n year += 1\n else\n month += 1\n end\n nwrug = nwrug_meet_for year, month\n end\n\n nwrug\nend", "def cweek\n end", "def this_week(limit: 5, markdown: false, rank: :top) \r\n \r\n coins = sort_coins('7d', limit: limit, rank: rank)\r\n build_table coins, markdown: markdown\r\n\r\n end", "def weeks\n rows = []\n rows << name_of_month.center(20) + \" \"\n rows << \"Su Mo Tu We Th Fr Sa\" + \" \"\n days = format_dates\n (0..7).each {|num|\n fields = days[num * 7, 7]\n rows << fields.join(\" \") + \" \" if fields\n }\n if rows.last.length < 22\n rows.last << \" \" * (22 - rows.last.length)\n end\n until rows.length == 8\n rows << \" \" * 22\n end\n rows\n end", "def days_left_in_week\n 7 - days_past_in_week\n end", "def get_completion_week(total_work, prediction_data)\n# entries = prediction_data.entrySet().iterator(); # TODO - FIX ME!!!\n#\n# # Map.Entry<Integer, Double>\n# xy1 = entries.next()\n# xy2 = entries.next()\n#\n# slope = (xy2.getValue() - xy1.getValue()) / (xy2.getKey() - xy1.getKey())\n# total_work / slope\n end", "def week_from_today\n ::Date.today + 7\n end", "def quality_driven_software_export\n @from = Time.zone.now - 1.week\n @to = Time.zone.now\n end", "def get_base_wages_for_month(month)\n events_worked = Distribution.get_events_worked(self.id)\n \n events_in_month = Event.events_in_month_ids(month)\n\n set_of_events = Event.get_event_ids_from_objects(events_worked)\n \n # This uses \"&\" (intersection) to compare the event ids from the month\n # and the events the employee has worked\n # events_employee_worked_this_month is an Array of event ids\n events_employee_worked_this_month = set_of_events & events_in_month\n \n paid_events = Event.event_ids_to_objects(events_employee_worked_this_month)\n Event.calc_wages_for_set_of_events(paid_events)\n end", "def get_data_minutes_this_week\n minutes_per_day = Array.new( 7, 0 )\n \n # Get the current day of week\n dateCurrent = DateTime.now\n dayCurrent = dateCurrent.wday().to_i\n \n # Get date at the start of the week\n timeStart = Time.utc( dateCurrent.year, dateCurrent.month, dateCurrent.day )\n timeStart = timeStart - 24 * 60 * 60 * dayCurrent\n \n # Get date at the end of the week\n timeEnd = Time.utc( dateCurrent.year, dateCurrent.month, dateCurrent.day )\n timeEnd = timeEnd + 24 * 60 * 60 * ( 7 - dayCurrent )\n \n # Loop through entries and increment totals\n user_entries = Entry.find( :all, :conditions => [\"userid = #{id}\"] )\n \n user_entries.each do |entry|\n if( entry.words.nil? || entry.hours.nil? || entry.minutes.nil? )\n next \n end\n \n dayEntry = entry.starttime.wday().to_i\n timeEntry = Time.utc( entry.starttime.year, entry.starttime.month, entry.starttime.day, entry.starttime.hour, entry.starttime.min )\n \n if( timeStart.to_i <= timeEntry.to_i && timeEnd.to_i >= timeEntry.to_i )\n minutes_per_day[dayEntry] += ( 60 * entry.hours + entry.minutes ) \n end\n end\n \n # Assemble Data String\n data_string = \"\"\n \n (0..(minutes_per_day.length - 1)).each do |i|\n data_string = data_string + minutes_per_day[i].to_s\n if( i < minutes_per_day.length - 1 )\n data_string = data_string + \",\"\n end\n end\n \n return data_string\nend", "def setup_weeks(week_start)\n a_date = self.first\n the_last = self.last\n @weeks = []\n\n while (a_date < the_last)\n @weeks << Koyomi::Week.new(a_date, week_start)\n a_date += WEEK_DAYS\n end\n @weeks\n end", "def pays_players_week\n self.players.inject(0) {|sum, player| sum += player.pay_week}\n end", "def get_last_week(sensor_id, access_token)\n data = get_interval_data(sensor_id, access_token, \"week\")\n return mk_rickshaw_format_localtime(data)\n end", "def current_month_kwh_usage_by_day\n current_date = Time.now.utc.to_date\n num_days_until_yesterday = current_date.day - 1\n usage_data = []\n current_date.downto(num_days_until_yesterday.days.ago.utc.to_date).each do |date|\n usage_data << total_day_kwh_usage_on(date).round(2)\n end\n usage_data\n end", "def income_this_month\n Sale.past_month.sum(:total)\n end", "def calculate_week_power_for\n dates, totals = consolidate_week\n\n weekPowerCount = 0\n\n totals.each do |index, total|\n weekPowerCount+=total\n end\n\n weekPowerCount\n end", "def each_july( n=1); each_monthnum(self.Jul,n); end", "def consolidate_week \n \t#grab last 30 days\n t = Time.zone.local(2012,12,10);\n\n \trefEntry = self.energy_data.where(:month => t.month, :day => t.day).last\n \tputs \"REFENTRY\", refEntry.nil?\n refDay = refEntry.day\n puts \"PASTDAY\"\n tmp_refDay = refDay\n \trefMonth = refEntry.month\n \tcount = (0..30).to_a\n \t@dateCount = Array.new\n \t@weekTotals = Array.new\n \tsubCount = 0\n\n #creating date array for weekTotals, assumes each month has 31 days\n \tcount.each do |var|\n \t\tif (tmp_refDay - subCount) > 0\n \t\t\t@dateCount << [tmp_refDay - subCount, refMonth]\n \t\telse\n tmp_refDay = 30\n \t\t\trefMonth = refMonth - 1\n \t\t\tsubCount = 0\n \t\t\t@dateCount << [tmp_refDay - subCount, refMonth]\n \t\tend\n \t\tsubCount = subCount + 1\n \tend\n\n \tarrayCount = 0\n\n \t@dateCount.each do |day, month|\n puts day, \" \", month\n temp_Obj = self.energy_data.where(:day=>day, :month=>month).last\n \t\tif month== t.month && day == t.day\n @weekTotals[arrayCount] = [Time.utc(2012, temp_Obj.month, temp_Obj.day).to_i*1000, self.energy_data.where(:day => day, :month => month, :hour=>(1..t.hour)).sum(\"power\")/1000]\n else\n @weekTotals[arrayCount] = [Time.utc(2012, temp_Obj.month, temp_Obj.day).to_i*1000, self.energy_data.where(\"day=#{day} AND month=#{month}\").sum(\"power\")/1000]\n \t\tend\n arrayCount = arrayCount + 1\n \tend\n\n # return both because @weekTotals must be 0-indexed, @dateCount has actual dates\n \treturn @dateCount, @weekTotals\n end", "def week\n first_day_of_week = @date.monday\n \n days_of_week = []\n 7.times do |time|\n days_of_week << day_and_types(first_day_of_week + time.days)\n end \n \n days_of_week\n end", "def max\n dates.last \n end", "def date_steps\n @date_steps ||= date_range.count / [date_range.count, 50].min\n end", "def calculate_overall_power_for\n t = Time.zone.now\n\n until_today = self.energy_data.where(:year=>t.year, :month=> (1..(t.month)), :day=>(1..t.day-1)).sum(\"power\") # total in Wh\n today = self.energy_data.where(:year=>t.year, :month=>t.month, :day=>t.day, :hour=>(1..t.hour)).sum(\"power\") # total in Wh\n until_today + today\n end", "def week_date_ranges\n (1..ReportWeeks).map do |week|\n begin_date = @start_date + (7*(week-1))\n begin_date .. (begin_date + 6)\n end\n end", "def w_day; end", "def current_weekly_average\n week_number = Time.now.yday / 7\n @cycling[2] = @cycling[0] / week_number\n @entertainment[2] = @entertainment[0] / week_number\n @programming[2] = @programming[0] / week_number\n @reading[2] = @reading[0] / week_number\n @yoga[2] = @yoga[0] / week_number\n end", "def chart_maximum_date\n [@pv.keys.max,\n @ev.keys.max,\n @ac.keys.max,\n forecast_finish_date(@basis_hours)].max\n end", "def end_of_week\n (beginning_of_week+6).end_of_day\n end", "def weeks\n @weeks ||= days.slice_when do |day|\n Date::DAYNAMES[day.wday] == LAST_DAY_OF_THE_WEEK\n end.to_a\n end", "def events_seven_days()\n events = []\n today = Date.today\n for i in 0..6 do\n events += events_by_date(today + i)\n end\n return events\nend", "def frequency_to_time\n day? ? 1.days.ago.to_date : week? ? 7.days.ago.to_date : month? ? 1.month.ago.to_date : 1.year.ago.to_date\n end", "def frequency_to_time\n day? ? 1.days.ago.to_date : week? ? 7.days.ago.to_date : month? ? 1.month.ago.to_date : 1.year.ago.to_date\n end", "def start_of_week; self - wday.days end", "def best_day\n\n end", "def next_week(x = 1)\n\t\tself + (604800 * x)\n\tend", "def last_full_week(supply)\n friday = self.last_friday_with_readings(supply)\n friday.nil? ? nil : friday - 4.days..friday\n end", "def end_of_week\n @end_of_week ||= (start_of_week + 6)\n end", "def fridays_in_year(year)\n current_week = 1\n current_day = 5\n current_date = DateTime.commercial(year, current_week, current_day)\n fridays_per_month = Array.new(12,0)\n while current_date.year == year\n fridays_per_month[current_date.month - 1] += 1\n current_date += 7\n end\n fridays_per_month\nend" ]
[ "0.68824637", "0.66347146", "0.65889657", "0.6560385", "0.65458685", "0.64930737", "0.64930737", "0.63922644", "0.63708544", "0.6308124", "0.6286398", "0.62782514", "0.62782514", "0.627393", "0.62198424", "0.62009054", "0.6187007", "0.61620647", "0.61537266", "0.61521596", "0.61447924", "0.6133448", "0.6123306", "0.610289", "0.6099411", "0.6089747", "0.6089568", "0.60820544", "0.6073394", "0.60722476", "0.60717595", "0.60673857", "0.6063775", "0.6059614", "0.60357475", "0.601977", "0.5998697", "0.59616154", "0.5946796", "0.59182626", "0.59169024", "0.59149605", "0.5903046", "0.5903046", "0.589015", "0.58896947", "0.58896947", "0.5882376", "0.5881112", "0.5828552", "0.58275086", "0.5804817", "0.5797908", "0.5794785", "0.57643235", "0.57542485", "0.5751011", "0.57345957", "0.5675229", "0.56646174", "0.56511045", "0.56341785", "0.56314987", "0.56275505", "0.56255955", "0.5621346", "0.5612822", "0.5599466", "0.5596652", "0.5595995", "0.559504", "0.5594002", "0.5586108", "0.558381", "0.5576", "0.5570203", "0.5557001", "0.55529493", "0.5541204", "0.55397284", "0.55385995", "0.55304307", "0.55149126", "0.55122757", "0.5512096", "0.55090225", "0.55035615", "0.5497564", "0.54940945", "0.5493536", "0.5486887", "0.5485309", "0.5484969", "0.5484969", "0.5477452", "0.54649925", "0.5455652", "0.54526794", "0.5450612", "0.54474366" ]
0.6347862
9
Name: create Objective: this method create a new session on system. Parameters: email object. Return: render a new page of logged user.
def create user = User.find_by(email: params[:session][:email].downcase) if(user && user.authenticate(params[:session][:password])) log_in(user) redirect_to(root_path) flash[:success] = "Logado com sucesso!" else flash.now[:danger] = 'Combinação inválida de e-mail/senha' render('new') end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\r\n\t\t# find the user based on the email\r\n\t\tuser = User.find_by(email: params[:session][:email].downcase) # all our emails in our database is downcased\r\n\t\t# check if the email is valid\r\n\t\tif user && user.authenticate(params[:session][:password])\r\n\t\t\t# simulate logging in\r\n\t\t\tsession[:user_id] = user.id # saving the user id in the session. The browsers cookies is going to handle this\r\n\t\t\t# saving the users id in the session hash which is backed by the browser\r\n\t\t\t# display a message\r\n\t\t\tflash[:success] = \"You have successfully logged in\"\r\n\t\t\tredirect_to user_path(user)\r\n\t\telse\r\n\t\t\t# give a message since it is not a model back form\r\n\t\t\tflash.now[:danger] = \"There was something wrong with your login information\"\r\n\t\t\t# flash.new persists for one http request. When we redirect the message will display in the next screen\r\n\t\t\t# render the new template to login\r\n\t\t\trender 'new'\r\n\t\tend\r\n\tend", "def create\n\t\t# method interacts with session > new.html.erb view\n\t\tuser = User.where(email: params[:user_email]).first\n\t\tif user && user.authenticate(params[:password])\n\t\t\tsession[:user_id] = user.id.to_s\n\t\t\tredirect_to '/'\n\t\telse\n\t\t\tredirect_to :back\n\t\tend\n\tend", "def create\n email = params[:session][\"email\"] # both will work ->: will use less memory\n password = params[:session][:password]\n user = User.authenticate(email, password)\n \n if user # if auth is successful\n session[:user_id] = user.id # this is a session\n flash[:notice] = \"You are logged in.\"\n redirect_to session[:referrer] || :root # to whatever is the root of your webserver ()\n #:referrer -> send to page that started from (if tried to edit if not logged in)\n else # if wrong credentials\n flash[:error] = \"add to your FAIL blog and Please try again!\"\n render :action => \"new\" # just shows def new end (at the beginning again)\n end\n end", "def create\n \t@user = User.find_by(e_mail: params[:session][:email].downcase)\n \tif @user && @user.authenticate(params[:session][:password])\n \t\t# Login successful, save user_id to session and redirect to user page\n \t\tlog_in @user\n \t\tredirect_to home_path\n \telse\n \t\t# Login unsuccessful, redirect to Log In Page and display an error message\n \t\tflash.now[:danger] = 'Invalid email/password combination'\n render \"new\"\n \tend\n end", "def create_session\n req_params = params[:user]\n unless req_params\n @msg = \"Login details not found\"\n render \"objects/msg.json\", status: :unauthorized and return\n end\n @user = User.find_by_email(req_params[:email])\n if @user && @user.authenticate(req_params[:password])\n session[:user_id] = @user.id\n render 'objects/user.json'\n else\n @msg = \"Email or password is invalid\"\n render \"objects/msg.json\", status: :unauthorized\n end\n end", "def create\n reset_session # prevent session fixation\n par = login_params\n @email = par[:email]\n user = User.find_by(email: par[:email])\n if user && user.authenticate(par[:password])\n # Save the user id in the session\n # rails will take care of setting + reading cookies\n # when the user navigates around our website.\n session[:user_id] = user.id\n redirect_to tasks_path\n else\n @alert = \"Falsche E-Mail Adresse und/oder Passwort\"\n render :new\n # session[:email] = @email\n # redirect_to login_path, alert: 'Falsches Passwort und/oder falsche E-Mail Adresse'\n end\n end", "def create \r\n \t\r\n\r\n \tuser = User.find_by(email: params[:session][:email].downcase)\r\n if user != nil\r\n \tblocked_user = Block.find_by(email: user.email)\r\n end\r\n\r\n if user and user.authenticate(params[:session][:password]) and blocked_user\r\n render blocking_message_path and return\r\n end\r\n\r\n if user && user.authenticate(params[:session][:password]) \r\n\r\n # log_in method located in session_helper\r\n \tlog_in user\r\n Action.create(info: current_user.username + ' has logged in.', user_email: current_user.email)\r\n\r\n # Redirects to an empty page\r\n # To be changed later\r\n \tredirect_to user_path(current_user.id)\r\n\r\n else\r\n\r\n \tflash[:danger] = 'Invalid email/password combination!'\r\n\r\n \tredirect_to :back\r\n end\r\n end", "def create\n \t# the params has has all the information needed to authenticate the user\n \tuser = User.find_by(email: params[:session][:email].downcase)\n\t\t#pulls the user out of the db based on the submitted email address.\n\n \t# params[:session][:email] is a hash for the submitted email\n if user && user.authenticate(params[:session][:password])\n \t# params[:session][:password] is a hast for the submitted password\n\n #Listing 8.13. The completed Sessions controller create action (not yet working). \n # Sign the user in and redirect to the user's show page. \n sign_in user\n\n #Listing 9.19: The Sessions create action with friendly forwarding.\n #redirect_to user\n redirect_back_or user\n #redirect_back_or user defined in /app/helpers/sessions_helper.rb\n else\n #Listing 8.12. Correct code for failed signin. Using flash.now\n flash.now[:error] = 'Invalid email/password combination' # Not quite right! \t\t\n # flash and error message\n render 'new'\n # render the /app/views/sessions/new.html.erb\n end\n end", "def new\n @user_session = UserSession.new(:email => session[:user_real_account_email])\n end", "def create\n\t\tuser = User.find_by_email(params[:session][:email].downcase)\n\t\tif user && user.authenticate(params[:session][:password])\n\t\t\t# login the user\n\t\t\tsign_in user\n\t\t\tflash[:success] = \"Signed in\";\n\t\t\tredirect_to root_path\n\t\telse\n\t\t\t# something went wrong\n\t\t\tflash[:failure] = \"Incorrect email/password\";\n\t\t\trender \"new\"\n\t\tend\n\tend", "def create\n user = User.authenticate(params[:session][:email], params[:session][:password])\n if user.nil?\n flash.now[:error] = \"invalid emails/password combination\"\n render 'new'\n else #user logs in, creates session\n session[:remember_token] = user.id\n @user = User.find_by_id(session[:remember_token]) \n if(@user.email==\"admin@dreamatic.org\") #redirect admin to her page\n redirect_to :controller => 'users', :action => 'index'\n elsif session[:url] == nil\n redirect_to :controller => :users, :action => :show, :id => user.id\n else\n redirect_to session[:url]\n session[:url] = nil\n end\n end \n end", "def create\n\t\t#render 'new'\n\t\tuser = User.find_by(email: params[:session][:email].downcase)\n\t\tif user && user.authenticate(params[:session][:password])\n\t\t\tsession[:user_id] = user.id\n\t\t\tflash[:success] = \"You have successfully logged in!\"\n\t\t\tredirect_to user_path(user)\n\t\telse\n\t\t\t#when u render using flash.now and when u redirect_to using flash.\n\t\t\tflash.now[:danger] = \"There is something wrong with your login information!\"\n\t\t\trender 'new'\n\t\tend\n\tend", "def create\n @user = User.find_by(email: params[:session][:email].downcase)\n @err = nil\n\n # if the information is valid, log the user in and redirect them to their homepage\n if @user && @user.authenticate(params[:session][:password])\n log_in @user\n render '/users/home'\n\n # otherwise notify error that the value is invalid and print it to the log in page\n else\n # user info is incorrect\n @err = 'Invalid email/password combination'\n redirect_to '/sessions/new'\n end\n end", "def create\n\t\t@user = User.find_by_email(params[:email])\n\n\t\tif @user and @user.authenticate(params[:password])\n\n\t\t\t# set session user id\n\t\t\tsession[:user_id] = @user.id\n\n\t\t\trespond_to do |format|\n\t\t\t\tformat.html { redirect_to dashboard_index_path, notice: \"Welcome Back #{@user.full_name}!\" }\n\t\t\tend\n\n\t\telse\n\t\t\trespond_to do |format|\n\t\t\t\tformat.html { redirect_to login_path, alert: \"Sorry wrong username or password\" }\n\t\t\tend\n\t\tend\n\tend", "def create\n user = User.find_by_email( params[:session][:email].downcase )\n\n if user and user.authenticate( params[:session][:password] )\n sign_in user \n redirect_to root_url\n else\n flash[:error] = \"invalid email/password\"\n render :action => 'new' \n end\n end", "def create\n # @developer = search database for email that was typed in\n @developer = Developer.find_by(email: params[:email])\n # if they log in right:\n if @developer && @developer.authenticate(params[:password])\n # need to be remembered as logged in on all pages\n session[:developer_id] = @developer.id\n session[:developer_welcome] = @developer.name\n # session[:its_a_party_key] = \"You logged in dude\"\n # they get a welcome page REDIRECT\n redirect_to root_path, notice: \"Welcome back, #{@developer.name}!\"\n else\n flash[:notice] = 'Password or username wrong. Try again.'\n render :new\n end\n end", "def create\n \tuser = User.find_by(email: params[:session][:email].downcase)\n \tif user and user.authenticate(params[:session][:password])\n \t\tlog_in(user)\n # redirect_to \"/users/#{user.id}\"\n redirect_to '/'\n \telse\n \t\tflash.now[:danger] = \"Invalid email/password confirmation!\"\n \t\trender 'new'\n \tend\n end", "def create\n\t user = AdminUser.authenticate(params[:email], params[:password])\n\t logger.info 'session#create creating session'\n\t if user\n\t \tlogger.info 'session#create user authenticated'\n\t session[:user_id] = user.id\n\t redirect_to admin_category_index_path\n\t else\n\t flash.now.alert = \"Invalid email or password\"\n\t render \"new\", layout: \"login_layout\"\n\t end\n\tend", "def create\n\t\tuser = User.find_by_email(params[:session][:email])\n\t\tif user && user.authenticate(params[:session][:password])\n\t\t\tsign_in user\n\t\t\tredirect_back_or user\n\t\telse\n\t\t\tflash.now[:error] = \"Invalid email/password combination\"\n\t\t\trender 'new'\n\t\tend\n\tend", "def create\n # ログイン時に受け取ったメールアドレスとパスワードを変数@userに代入\n @user = login(params[:email], params[:password])\n\n # @userがtrue(存在する)の時、users_pathにリダイレクト\n # false(存在しない)の時、app/views/user_sessions/new.html.erbファイルを返す\n if @user\n # redirect_back_or_toメソッドは保存されたURLがある場合、そのURLに。ない場合は指定されたURLにリダイレクトする\n flash[:success] = 'ログインに成功しました'\n redirect_back_or_to(new_time_table_path)\n else\n flash.now[:danger] = 'ログインに失敗しました'\n render action: 'new'\n end\n end", "def create\n\n \tuser = User.find_by(email: params[:session][:email].downcase)\n if user && user.authenticate(params[:session][:password])\n log_in user\n remember user\n \n params[:session][:remember_me] == '1' ? remember(user) : forget(user)\n if session[:current_job_application]\n job_id = session[:current_job_application]\n redirect_to controller: 'jobs', action: 'show', id: job_id\n else\n if is_current_user_job_seeker?\n redirect_to controller: 'job_seekers', action: 'show', id: current_user.job_seeker.id\n elsif is_current_user_employer?\n redirect_to controller: 'employers', action: 'show', id: current_user.company.id\n end\n end \n \n else\n\n flash.now[:danger] = 'Invalid email/password combination'\n @messages_rendered = false\n render 'new'\n end\n end", "def create\n @resource = find_authenticatable\n session = build_passwordless_session(@resource)\n\n if session.save\n if Passwordless.config.after_session_save.arity == 2\n Passwordless.config.after_session_save.call(session, request)\n else\n Passwordless.config.after_session_save.call(session)\n end\n end\n\n flash[:notice] = I18n.t(\"passwordless.sessions.create.email_sent_if_record_found\")\n redirect_back(fallback_location: root_path)\n end", "def new\n user = User.not_deleted.find_for_database_authentication(:email => params[:email])\n if user.nil? then\n expose :message=>'User or password incorrect for this site', :error=>true\n return;\n end\n\n # Invalidate any session the user ha now\n # invalidateUserSession user\n\n # Validate the password, as you can see, if the password is wrong, the user seession is already\n # gone, this can improve security.\n if !user.valid_password?(params[:password]) then\n expose :message=>'User or password incorrect for this site', :error=>true\n return;\n end\n\n #Validate the customer id\n if !user.isAdmin? && !user.valid_customer_id(params[:customer_id]) then\n expose :message=>'User, password or customer id incorrect for this site', :error=>true\n return\n end\n\n #Validate the user site\n if user.isSiteLogin? && (params[:site_name].nil? || !user.valid_site?(params[:site_name])) then\n expose :message=>'User, password or customer id incorrect for this site', :error=>true\n return\n end\n\n if params[:user_type] then\n if user.user_type_name.downcase != params[:user_type].downcase\n expose :message=>\"Only '#{params[:user_type].capitalize}' Users are available to use this app\", :error => true\n return\n end\n end\n\n # Create a new session\n site = Site.find_site_by_name params[:site_name]\n customer = Customer.find_by_customer_id params[:customer_id]\n token = generateUserSession(user, site, customer)\n\n setCurrentUser user\n expose :token => token, :role => getCurrentRole.role_id\n end", "def create\n @user = User.find_by(email: params[:session][:email].downcase)\n @as = \"\"\n if params.has_key?(:as) && !params[:as].empty?\n @as = params[:as]\n end\n\n if @user && @user.authenticate(params[:session][:password])\n if @user.activated?\n log_in @user\n params[:session][:remember_me] == '1' ? remember(@user) : forget(@user)\n redirect_back_or root_url\n else\n message = \"Account not activated. \"\n message += \"Check your email for the activation link.\"\n flash[:warning] = message\n redirect_to root_url\n end\n else\n flash[:danger] = 'Invalid email/password combination'\n if @as == \"admin\"\n redirect_to admin_login_path\n else\n redirect_to login_path\n end\n end\n end", "def create\n \tuser = User.find_by(email: params[:session][:email])\n \tif user && user.authenticate(params[:session][:password])\n \t\tlog_in user\n \t\tredirect_back_or user\n \telse\n \t\tredirect_to login_path, notice: \"Invalid email/password combination\"\n \tend\n end", "def create\n # Get submitted email and password\n address = params[:session][:email]\n password = params[:session][:password]\n\n # Pull the user from the db\n user = User.find_by(email: address.downcase)\n\n # User exists and password is correct\n if user && user.authenticate(password)\n # Login user\n create_session user\n\n # Show user profile page\n redirect_to user\n\n # There were invalid credentials\n else\n # Show an error message\n flash.now[:warning] = \"You cocked up. Try again.\"\n\n # Show login page again\n render 'new'\n end\n end", "def create\n email = params[:user][:email]\n @user = User.find_by_email(email)\n if @user.nil?\n @user = User.create(email: email)\n @user.save!\n end\n session[:current_user_id] = @user.id\n redirect_to controller: 'games', action: 'new', game: {user: @user}\n end", "def create\n \t\tuser = User.find_by_email(params[:email])\n \t\tif user && user.authenticate(params[:password])\n\t\t\tsession[:user_id] = user.id\n\t\t\tflash[:success] = \"Logged in\"\n\t\t\tif user.type == 'Student'\n\t\t\t\tredirect_to postings_path \n\t\t\telsif user.type == 'Supervisor'\n\t\t\t\tredirect_to urop_applications_path\n\t\t\tend\n\t\telse\n\t\t\tlogger.info 'incorrect'\n\t\t\tredirect_to :back, :notice => \"Invalid email or password\"\n\t\tend\n\tend", "def create\n email = params[:email]\n password = params[:password]\n\n user = User.find_by(email: email)\n if user && user.authenticate(password)\n session[:user_id] = user.id\n redirect_to root_path\n # logged in!\n else\n # Nope, something went wrong\n redirect_to login_path\n end\n end", "def create\n if user = User.Authenticate(params[:login][:email], params[:login][:password])\n # Save the user ID in the session so it can be used in\n # subsequent requests\n session[:current_user_id] = user.id\n redirect_to root_url\n else\n \tflash[:error] = \"Email ou senha incorreto.\"\n \trender :index\n end\n end", "def create\n @user = User.find_by(email: params[:session][:email].downcase)\n if @user && @user.authenticate(params[:session][:password])\n if @user.activated?\n log_in @user\n params[:session][:remember_me] == '1' ? remember(@user) : forget(@user)\n redirect_back_or @user\n else\n message = \"Account not activated. \\n Check your email for the activation link.\"\n flash[:warning] = message\n redirect_to root_url\n end\n else\n # create an error message.\n flash.now[:danger] = \"Invalid email/password combination!\"\n render 'new'\n end\n end", "def create\n user = User.from_omniauth(env[\"omniauth.auth\"])\n session[:user_id] = user.id\n me=User.find(user.id)\n me.loggedin=true\n me.tutoring=false\n me.request=Request.new(class_name:\"3365f80a5cccb3e76443df3b736b26e8\")\n me.save\n render erb: :'sessions#create'\nend", "def create\n \tuser = User.find_by(email: params[:session][:email])\n\n \tif user && user.authenticate(params[:session][:password])\n \t\trender text: user.auth_token, status: 200\n \t\telse\n \t\t\trender text: \"Invalid email or password\", status: 422\n \t\tend\t\n end", "def create\n user = User.find_by(email: params[:session][:email].downcase)\n if user && user.authenticate(params[:session][:password])\n if user.email_confirmed?\n log_in user\n flash[:success] = 'You are now logged in!'\n # TODO: redirect_or_back\n redirect_to root_path\n else\n flash[:notice] = %Q[Please activate your account by following the instructions in the account confirmation email you received to proceed. Click #{view_context.link_to(\"here\", new_user_email_confirmation_url)} to resend the confirmation email.]\n flash[:notice] = flash[:notice].html_safe\n render 'new'\n end\n else\n flash.now[:danger] = 'Invalid email/password combination'\n render 'new'\n end\n end", "def create\n user = User.authenticate(params[:session][:email],\n params[:session][:password])\n if user.nil?\n redirect_to root_path\n flash[:error] = \"Invalid email/password combination.\"\n @title = \"Sign in\"\n \n else\n # Sign the user in and redirect to the user's show page.\n sign_in user\n redirect_to '/users'\n end\n end", "def new\n @email_field = email_field\n @session = Session.new\n end", "def create\n @user = User.find_by(email: params[:session][:email].downcase)\n if @user && @user.authenticate(params[:session][:password])\n if @user.activated?\n log_in @user\n params[:session][:remember_me] == '1' ? remember(@user) : forget(@user)\n redirect_back_or @user\n else\n message = \"Account not activated. \"\n message += \"Check your email for the activation link.\"\n flash[:warning] = message\n redirect_to root_url\n end\n else\n flash.now[:danger] = 'Invalid email/ password combination'\n render 'new'\n end\n end", "def create\n\t\tuser = User.where(:email => params[:email]).first\n\t\tif user.present? && user.authenticate(params[:password])\n\t\t\tsession[:user_id] = user.id\n\t\t\tredirect_to root_path\n\t\telse \n\t\t\tredirect_to new_session_path\n\t\tend\n\n\tend", "def create\n action = LogUserIn.new :web\n @session = Session.new params[:session]\n\n if user = action.run(@session.login, @session.password)\n previous_path = session[:login_redirect_to]\n set_new_user_session user, @session.remember_me\n\n redirect_to previous_path || root_path\n else\n flash.now[:login_error] = true\n render action: \"new\"\n end\n end", "def create\n user = User.find_by_email(params[:session][:email])\n respond_to do |format|\n if user && user.authenticate(params[:session][:password])\n sign_in user # create a cookie\n format.json { render json: user.active_model_serializer.new(user, {}) }\n format.html { redirect_back_or user }\n else\n #raise SessionsController::InvalidAuth\n render 'new'\n end\n end\n end", "def create\n @user = User.find_by(email: session_params[\"email\"])\n if @user\n login!\n render json: {\n status: :created, \n logged_in: true, \n user: @user,\n profile: @user.profile\n \n }\n # render json: @session, status: :created, location: @session\n else\n render json: { status: 401 }\n # render json: @session.errors, status: :unprocessable_entity\n end\n end", "def create\n user = User.find_by_email(sessions_params[:email])\n if user and user.authenticate(sessions_params[:password])\n login user\n end\n redirect_to rooth_path\n end", "def create\n\n logger.debug \"### Processing new login details\"\n user = User.authenticate(params[:email], params[:password])\n\n if user\n\n logger.debug \"### Login details matched - creating login session\"\n session[:user_id] = user.id\n flash[:notice] = \"Logged in!\"\n redirect_to(session[:return_to] || home_index_path) \n session.delete(:return_to)\n else\n logger.debug \"### User details didn't match - login denied\"\n flash[:error] = \"Invalid email or password\"\n render \"new\"\n end\n\n end", "def create\n Question.create(question_params)\n session[:current_user_email] = question_params[:email]\n redirect_to root_path\n end", "def create\n @user_session = UserSession.new(params[:user_session])\n #@user = User.new\n #@user = User.find_all_by_login(params[:user_session][:email])\n\n respond_to do |format|\n if @user_session.save\n #flash[:notice] = \"Welcome \" + @user + \"!\"\n format.html { redirect_to(:appointments, :notice => 'Welcome!') } #redirection von appointment hier\n format.xml { render :xml => @user_session, :status => :created, :location => @user_session }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user_session.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n # logging in can be done via email or username interchangeably\n user = User.find_by email: params[:session][:username].downcase\n # ||= only runs the find command if the user was not set by the above\n user ||= User.find_by username: params[:session][:username].downcase\n\n if user && user.authenticate(params[:session][:password])\n # Log the user in and redirect to the user's show page\n log_in user\n flash[:success] = \"Logged in as #{user.username}\"\n redirect_to user_url(user)\n else\n # Flash an error message\n flash.now[:danger] = 'Invalid email or password'\n render 'new'\n end\n end", "def create\n @user = User.find_by(email: params[:session][:email].downcase)\n if @user && @user.authenticate(params[:session][:password])\n \t if @user.activated?\n log_in @user\n params[:session][:remember_me] == '1' ? remember(@user) : forget(@user)\n redirect_back_or @user\n \t else\n message = \"Account not activated. \"\n message += \"Check your email for the activation link.\"\n flash[:warning] = message\n redirect_to login_path\n end\n else\n flash.now[:danger] = 'Invalid email/password combination'\n render 'new'\n end\n end", "def create\n # find user from session cookie -> email, then authenticate\n @user = User.find_for_database_authentication(email: session_params[:email])\n if @user && @user.valid_password?(session_params[:password])\n sign_in(@user)\n # after signing in the user, refresh to show most updated saved user\n @user.reload\n render :show\n return\n end\n # return prevents login error\n invalid_login_attempt_error\n end", "def create\n user = Backend::User.authenticate(params[:session][:login],\n params[:session][:password])\n \n if user.nil?\n flash.now[:error] = I18n.translate('sessions.signin.flash.invalid')\n @title = I18n.translate('sessions.signin.title')\n render 'new'\n else \n sign_in_to_backend(user)\n if !user.admin? && !user.staff? && user.partner?\n redirect_to backend_partner_sites_path\n else\n redirect_to backend_dashboard_path\n end\n end \n\n end", "def create\n email = params[:email].downcase\n player = Player.find_by(email: email)\n if player\n session[:player_id] = player.id\n flash[:success] = \"Logged in as \\\"#{player.display_name}\\\"\"\n redirect_to(root_path)\n else\n flash[:danger] = \"No player currently registered with the email: #{email}.\"\n # TODO: Redirect to sign up\n redirect_to(root_path)\n end\n end", "def create\n user = User.find_by(email_address: params[:session][:email_address].downcase)\n if user && user.authenticate(params[:session][:password])\n session[:user_id] = user.id\n log_in user #helper method used here to log in user upon signup before redirect.\n params[:session][:remember_me] == '1' ? remember(user) : forget(user) #using ternary operator to reduce conditional to determine 1 or 0.\n remember user #helper method used to call user.remember generating a rmemeber token and saving its digest to database.\n redirect_to user notice: \"logged in\"\n else\n message = \"Account not activated.\"\n message += \"Check your email for the activation link.\"\n flash.now[:alert] = \"Email or password is invalid\"\n render '/users/new' \n end\n end", "def create\n\t\tuser = User.find_by(email: params[:login][:email])\n\n\t\tif user && user.authenticate(params[:login][:password])\n\t\t\tsession[:user_id] = user.id.to_s\n\t\t\tredirect_to root_path\n\t\telse\n\t\t\trender :new\n\t\tend\n\n\tend", "def create\n if user = User.authenticate_with_credentials(params_for_login)\n # a session cookie is assigned to logged users\n session[:user_id] = user.id\n redirect_to session[:return_to]\n else\n redirect_to session[:return_to], flash: { error: \"Invalid email address\" }\n end\n end", "def create_session\n # byebug\n user = User.find_by(\n email: params[:email],\n password: params[:password]\n )\n\n if (user.nil?)\n redirect_to action: \"sign_in\"\n else\n session[:user_id] = user.id\n\n redirect_to \"/users/#{user.id}\"\n end\n\n end", "def create\n # Find the user\n user = User.find_by(email: params[:session][:email].downcase)\n # Get the password from the parameters\n password = params[:session][:password]\n # Try to authenticate the user\n if user && user.authenticate(password)\n flash[:success] = \"Welcome back #{user.username}\"\n # Store the user id in the session\n session[:user_id] = user.id\n # Redirect the user to its page\n redirect_to user_path(user)\n else\n # Since we are using render, there won't be another request, so we need to use flash.now\n flash.now[:danger] = \"Wrong email or password. Please try again.\"\n render :new\n end\n end", "def create\n user = User.find_by(email: params[:email])\n respond_to do |format|\n if signed_in?\n format.html { redirect_to(root_path, notice: 'Cannot login while already logged in.') }\n format.json { render(errors: 'Cannot login while already logged in', status: :unprocessable_entity) }\n elsif !user.nil? && user.authenticate(params[:password])\n sign_in(user[:id])\n format.html { redirect_to(root_path, notice: 'session was successfully created.') }\n format.json { render :show, status: :created, location: @session }\n else\n\n format.html { redirect_to(login_path, notice: 'Invalid login.') }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n user = User.find_by(email: params[:session][:email].downcase)\n if user && user.authenticate(params[:session][:password])\n log_in user\n redirect_to home_path\n else\n flash.now[:danger] = 'Invalid email/password combination'\n render 'new'\n end\n end", "def create\n @user = User.find_by(email: session_params[:email])\n if @user && @user.authenticate(session_params[:password])\n # Save the user ID in the session so it can be used in\n # subsequent requests\n session[:user_id] = @user.id\n flash[:notice] = \"Welcome, #{@user.email}!\"\n redirect_to statuses_path\n else\n flash[:alert] = \"Please log in again\"\n render \"new\"\n end\n end", "def create\n @user = User.new(signup_params)\n if @user.save\n session[:user_email]=@user.email\n render 'homepage'\n else\n render 'index'\n end\n\n end", "def create\n user = User.find_by_email(params[:email])\n if user && user.authenticate(params[:password])\n session[:user_id] = user.id\n session[:authenticated] = true\n redirect_to root_url, :notice => \"Successfully logged in.\"\n return\n else\n flash.now.alert = \"Invalid email or password\"\n render 'new'\n end\n end", "def create\n\t\t#get the user info\n\t\t\n\t\tauth = request.env[\"omniauth.auth\"]\n\t\tif auth == nil and \n\t\t\tif session[:temp] == true\n\t\t\t auth = {:info => {:email => \"jkoshakow@wesleyan.edu\"} }\n\t\t\telse\n\t\t\t auth = {:info => {:email => \"koshy44@gmail.com\"} }\t\n\t\t\tend\n\t\tend\n\t\t#whitelist \n\t\tif auth[:info][:email].to_s =~ /.+@wesleyan.edu/\n\t\t\tuser = User.find_by_uid(auth[\"uid\"]) || User.createUser(auth)\n\t\t\tsession[:user_id] = user.id \n\t\t\tsession[:admin] = user.admin\n\t\t\tsession[:authenticated] = true\n\t\t\tredirect_to links_path\n\t\telse\n\t\t\tsession[:authenticated] = false\n\t\t\tsession[:error] = \"Must have a wesleyan email address\"\n\t\t\tredirect_to root_path\n\t\tend\t\n\tend", "def create\n user = User.find_by(email: params[:session][:email].downcase)\n \n #if the user was found and the user.authenticate based on enetered password\n if user && user.authenticate(params[:session][:password])\n # we are saving user id into the session so the browsers cookies will handle this\n # this id will be used across sessions\n session[:user_id] = user.id\n \n # flash a success and redirect to the users page\n flash[:success] = \"You have successfully logged in\"\n redirect_to user_path(user)\n else\n # re render the login page, but since this is not a model backed form we wont have validation messages\n # add a message with flash\n flash.now[:danger] = \"Username or Password were incorrect\"\n render 'new'\n end\n end", "def create\n @user = User.find_by(email: params[:session][:email].downcase)\n if @user&.authenticate(params[:session][:password]) # & for safe navigation\n log_in @user\n params[:session][:remember_me] == '1' ? remember(@user) : forget(@user)\n redirect_back_or @user\n else\n flash.now[:danger] = 'Invalid email/password combination'\n render 'new'\n end\n end", "def create\n @current_user = Client.find_by( :email => params[:email] )\n if @current_user.nil?\n @current_user = Trainer.find_by( :email => params[:email] )\n end\n\n if @current_user.present? && @current_user.authenticate( params[:password] )\n session[:user_id] = @current_user.id\n if @current_user.class == Trainer\n session[:type_of_person] = \"Trainer\"\n else\n session[:type_of_person] = \"Client\"\n end\n flash[:success] = \"Successfully logged in\"\n redirect_to @current_user\n else\n flash[:error] = \"Invalid email or password\"\n redirect_to login_path\n end\n end", "def create\n user = User.authenticate(params[:email], params[:password])\n\tif user\n\t session[:user_id] = user.id\n\t redirect_to root_url, :notice => \"Logged in!\"\n\telse\n\t flash.now.alert = \"Invalid email or password\"\n\t render \"new\"\n\tend\n end", "def create\n user = User\n .find_by(email: params[\"user\"][\"email\"])\n .try(:authenticate, params[\"user\"][\"password\"])\n # if the user was created, i.e., found an email password match, set session\n if user\n # sets an encrypted session cookie on the client side\n session[:user_id] = user.id\n render json: {\n status: :created,\n logged_in: true,\n user: user\n }\n else\n render json: { status: 401 }\n end\n end", "def create\n\t# user = User.find_by_email(params[:session][:email])\n\t# if user.authenticate(params[:session][:password])\n\t# \tsign_in user\n\t# \tflash[:message] = \"Successfully logged in!\"\n\t# \tredirect_to feed_path(user.id)\n\t# else\n\t# \tflash[:error] = \"Your email or password is invalid\"\n\t# \tredirect_to signin_path\n\t# end\n\tUser.find(auth).nil? ? @user = User.find(auth) : @user = User.create(auth) \n\tsign_in @user\n\tredirect_to \"/\"\n\n end", "def create\n logger.debug '> Users: create.'\n all_params = params.merge(new_session)\n\n session[:tour] = true\n\n my_account = Accounts.new\n redirect_to(signin_path, flash: { toastr: 'Hey you!, I know you already. Please Signin.' }) && return if my_account.dup?(all_params[:email])\n\n my_account.create(all_params) do\n org_res = Organizations.new.list(all_params).orgs\n session[:org_id] = org_res[0][:id]\n\n sign_in my_account\n if \"#{Ind.notification.email.password}\" != ''\n UserMailer.welcome(my_account).deliver_now\n end\n redirect_to cockpits_path, format: 'html', flash: { alert: \"Welcome #{my_account.first_name}.\" }\n end\n\n if Ind.backup.enable\n\tbackup_client = BackupUser.new(Ind.backup.host, Ind.backup.username, Ind.backup.password)\n storage_acc_res = backup_client.account_create(params['email'],'displayname_accountid')\n session[:storage_access_key] = storage_acc_res['access_key']\n session[:storage_secret_key] = storage_acc_res['secret_key']\n end\nend", "def create\n session[:enable_admin_pages] = false\n user = User.find_by(netid: auth_hash['extra']['netid'])\n if user\n session[:netid] = user.netid\n flash[:success] = \"Signed in as #{user.name}\"\n\n # Check auth for admin paths - in this case they have a user record, so set true\n # In other apps further permissions can be checked e.g. admin user type\n session[:enable_admin_pages] = true\n\n redirect_to session[:return_url] || root_path\n else\n redirect_to not_authorized_path\n end\n end", "def create\n\t \t\tmodule_grand_access = permission_control(\"session\",\"create\")\n\t \t\tif module_grand_access\n\t \t\t\tsession = Session.new(session_params)\n\t \t\t\tsession.created_by = current_user.id\n\t \t\t\tif session.save!\n\t \t\t\t\trender json: session, status: :created\n\t \t\t\telse\n\t \t\t\t\trender json: session.errors,status: :bad_request\n\t \t\t\tend\n\t \t\telse\n \t \t\t\trender json: { error: \"You dont have permission to perform this action,Please contact Site admin\" }, status: :unauthorized\t \t\t\t\n\t\t\tend\n\t \tend", "def create\n if SessionService.authenticate(@user, params[:password])\n # TODO Add successful log in message\n logger.debug \"#{@user.email} is trying to create a API session\"\n root_path\n else\n logger.error \"** Failure** Attempt to login as #{params[:user_name]} - rejected\"\n render text: 'Login failed', status: :unauthorized\n end\n end", "def create\n \n user = User.find_by_email(params[:email])\n Rails.logger.debug(\"Attempting to authenticate: #{user.inspect}\")\n if user && user.authenticate(params[:password])\n session[:user_id] = user.id\n redirect_to root_path, :notice => 'You have been successfully logged in.'\n else\n render 'new'\n end\n\n end", "def create\n if user_name = get_user_email\n user_password = SecureRandom.urlsafe_base64(8)\n if user = create_user(user_name, user_password)\n organization = create_organization(user)\n space = create_space(organization, user)\n end\n end\n\n respond_to do |format|\n if user\n @user_email = user_name\n @user_password = user_password\n @organization_name = organization.name\n @space_name = space.name\n format.html { render action: 'show' }\n else\n format.html { render 'sessions/new' }\n end\n end\n end", "def create\n \tuser = User.find_by :email => params[:email]\n \tif user.present? && user.authenticate(params[:password])\n \t\tsession[:user_id] = user.id\n \t\tredirect_to root_path\n \telse\n \t\tredirect_to login_path\n \tend\n end", "def create\n options = {:remember_me => true}.merge(params[:user_session])\n @user_session = UserSession.new(options)\n if @user_session.save\n redirect_back_or_default root_url\n else\n @failed = true\n render :action => :new\n end\n end", "def create\n\t\t@user = User.find_by(email: user_params[:email])\n if @user && @user.authenticate(user_params[:password])\n\t\t\tsession[:user_id] = @user.id\n\t\t\tredirect_to user_url(@user)\n\t\telse\n\t\t\tflash.notice = \"Login failed. Try again.\"\n \t\tredirect_to root_url\n\t\tend\n\tend", "def create\n reset_session\n params[:user] ||= {}\n username = params[:user][:username].to_s\n password = params[:user][:password].to_s\n user = User.where('username = ? and crypted_password = ?', username, User.encrypt(password)).first\n\n params[:client_uid] = 'Web Platform' if request.format.html?\n \n if user && params[:client_uid]\n session_obj = Session.create(user_id:user.id, client_uid:params[:client_uid])\n session[:app_session_id] = session_obj.id\n session[:user_id] = user.id\n\n if request.format.html?\n redirect_to controller: 'main'\n elsif request.format.json?\n render json: {success: true, session: session_obj.to_json}\n end\n else\n if request.format.html?\n flash[:alert] = \"Cannot login, please try again\"\n render action: 'new'\n elsif request.format.json?\n render json: {success: false, message: 'Cannot login, please try again'}\n end\n end\n end", "def create\n @student_session = StudentSession.new(params[:student_session]) \n student = Student.find_by_email(@student_session.email)\n\n respond_to do |format|\n if @student_session.save\n session[:student_id] = student.id \n session[:student_number] = student.studentid\n session[:student_name] = student.name\n format.html { redirect_to(:bookings, :notice => 'Student session was successfully created. Student '+student.studentid.to_s+' logged in') }\n format.xml { render :xml => @student_session, :status => :created, :location => @student_session }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @student_session.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n # Is email blank?\n if (params[:email].blank?) \n render :new\n flash[:notice] = \"You must enter an email address\"\n else\n \n if (params[:password].blank?) \n render :new\n flash[:notice] = \"What's your password?\"\n else\n # If no, does user exist?\n \n if @user = User.find_by(email: params[:email])\n \n if @user.authenticate(params[:email], params[:password])\n # If authenticated, log in and redirect to /\n puts \"Redirecting to root url\"\n session[:user_id] = @user.id\n\n if @user.role == 'admin' \n redirect_to dashboard_path\n else\n redirect_to user_orders_path(@user.id)\n end\n else\n # If auth fails, render login page with error\n render :new\n flash.now[:error] = \"Password is incorrect\"\n \n end\n end\n end\n end \n end", "def create\n unless current_user_session.nil?\n redirect_to root_url, :notice => \"You are already logged in.\"\n return\n end\n @user_session = UserSession.new(params[:user_session])\n\n if @user_session.save\n redirect_to(@user_session.user, :notice => \"Login successful. Welcome!\") \n else\n render :action => \"new\" \n end\n end", "def create\n @user = User.find_or_create_by(uid: auth['uid']) do |u|\n u.name = auth['info']['name']\n u.email = auth['info']['email']\n end\n\n session[:user_id] = @user.id\n\n render 'welcome/home'\n end", "def create\n puts \"\\n\\n users_controller create: running \\n\\n\"\n # Create a new user\n @user = User.new(params_user)\n if @user.save\n # Change ID session login to true\n @session = Session.new\n # need to make shure there arent more then one\n # need a timmer to delete automaticly in a day or 2\n id = SecureRandom.hex(64)\n key = SecureRandom.hex(64)\n @session.session_id = id\n @session.key = key\n @session.user_id = @user.id\n @session.save\n # Save ID and random temp hash in cookie\n cookies[:session_id] = id\n cookies[:key] = key\n # go to homepage\n redirect_to '/Events/homepage'\n end\n end", "def create\n user = User.authenticate(params[:email], params[:password])\n if user\n # token = (0...20).map { ('a'..'z').to_a[rand(26)] }.join\n #session[:token] = token\n session[:user_id] = user.id\n # user.update(session: token)\n redirect_to root_url, :notice => \"Logged in!\" \n else\n flash.now.alert = \"Invalid credentials.\"\n render \"new\"\n end\n end", "def create\n if user = User.find_by_email(params[:email])\n if user.authenticate(params[:password])\n reset_session\n session[:user_id] = user.id\n\n # Update the user stats\n user.update_sign_in_stats\n\n redirect_to users_dashboard_path, notice: I18n.t(:session_logged_in)\n else\n flash.now.alert = I18n.t(:session_invalid)\n render \"new\"\n end\n else\n flash.now.alert = I18n.t(:session_invalid)\n render \"new\"\n end\n end", "def create\n @session = ::Session.authenticate(session_params)\n\n if @session.save\n render :show, status: :created, location: @session\n else\n render json: @session.errors, status: :unprocessable_entity\n end\n end", "def create\n\t user = User.find_by_email(user_params[:email])\n\t if user && user.authenticate(user_params[:password])\n\t session[:user_id] = user.id\n\t redirect_to profile_path\n\t flash[:notice] = \"Successfully logged in!\"\n\t else\n\t redirect_to login_path\n\t end\n\tend", "def create\n @user = User.new(email:session[:userinfo].info.email,\n name:session[:userinfo].info.name,\n uid:session[:userinfo].uid)\n if @user.save\n @user.save\n redirect_to @user, notice: \"Welcome #{@user.name}!\"\n else\n redirect_to root_path, status: \"Something went wrong. Let's try this again.\"\n end\n end", "def create_session(parms)\n @session = Session.new(parms)\n pp @session\n returnValue = false\n if people = People.auth(@session)\n session[:people] = people.id\n cookies[:people] = people.id\n unless people.id.nil?\n returnValue = true\n end\n end\n returnValue\n end", "def create\n user = User.find_by_email(params[:email])\n if user && user.authenticate(params[:password]) && user.confirm\n session[:user_id] = user.id\n session[:expires_at] = Time.now + 120.minutes\n redirect_to main_url\n else\n flash[:error] = \"Invalid username or password\"\n render \"new\"\n end\n end", "def create\n # Getting the user by mail\n user = User.find_by(email: params[:session][:email].downcase)\n \n # check if we got a user first and then the password is correct\n if user && user.authenticate(params[:session][:password])\n \n # call helper method log_in (se helpers/seesionhelper)\n log_in user\n # Log the user in and redirect to the page with all teams (/teams)\n redirect_to teams_path\n else\n # Create an error message.\n #flash.now is for rendering (lives for the cycle)\n # danger is mapped in the view against bootstraps classes\n flash.now[:danger] = 'Invalid email/password combination'\n # render the layout with the form\n render 'new'\n end\n end", "def create\n # Locate user in database using given email.\n @user = User.find_by(email: params[:session][:email].downcase)\n\n # Did the user enter the correct password?\n if @user && @user.authenticate(params[:session][:password])\n\n log_in @user\n\n # Only remember the user if the checkbox is ticked.\n params[:session][:remember_me] == '1' ? remember(@user) : forget(@user)\n\n # Show success message, and send user to their profile page.\n flash[:success] = \"Welcome back #{@user.name}!\"\n redirect_back_or @user\n else\n flash.now[:danger] = 'Incorrect username and/or password!'\n render 'new'\n end\n end", "def create\n # identifies user by provided email\n user = User.find_by_email(params[:email])\n\n # if the provided passord matches the user, session is established\n if user && user.authenticate(params[:password])\n session[:user_id] = user.id\n redirect_to user, notice: 'You have successfully logged in!'\n else\n # if password doesnt match, session is not established\n redirect_to :root\n end\n end", "def create\n # Try and find the email given in the login view in the customers table using\n # ActiveRecord. Email given by customer is converted to lowercase to do case insensitive\n # string matching.\n customer_logging_in = Customer.find_by(email: params[:session][:email].downcase)\n\n # Check the email address was found and that the password matches the hashed one in the database\n # and if it does, create a session (log them in) and redirect them to the wines index page\n if customer_logging_in && customer_logging_in.authenticate(params[:session][:password])\n log_in(customer_logging_in)\n redirect_to(wines_path)\n else\n # If the customer couldn't be found or the email and password combination was wrong, redirect\n # them to the login page and display an error message explaining what went wrong\n flash[:danger] = 'Customer with that email address and password combination could not be found'\n render 'new'\n end\n end", "def create \n #finds whatever user that is in the system with the email you pass up\n #then it tries to run the authenticate method with whatever password got sent up and if...\n #it all works, store in the variable\n user = User\n .find_by(email: params[\"user\"][\"email\"])\n .try(:authenticate, params[\"user\"][\"password\"])\n\n #if a user is created want to communicate with the session and set the user ID equal to the User ID you just found \n #okay so the user is successfully authenticated, want to make sure they now have a cookie on their system\n if user \n #says store the user id, and it goes encrypted into their client(browser/mobile device)\n session[:user_id] = user.id\n render json: {\n status: :created,\n logged_in: true,\n user: user #pass back the entire user that you have in the database and you can show/use anything\n }\n #if user not able to log in successfully\n #status 401 is the unauthorized code, the universal HTTP code want to use if a user is not authenticated\n else \n render json: {\n status: 401\n }\n end \n end", "def create\n user = User.find_by(email: params[:session][:email].downcase)\n if user&.authenticate(params[:session][:password])\n reset_session\n log_in user\n redirect_to user\n else\n flash.now[:danger] = 'Invalid email password combo'\n render 'new'\n end\n end", "def create\n user = User.find_by_email(params[:email])\n\n if user && user.authenticate(params[:password])\n session[:user_id] = user.id\n redirect_to \"/users/#{user.id}\"\n else\n flash[:errors] = [\"Invalid combination\"]\n redirect_to new_session_path\n end\n\n end", "def create\n @user_session = UserSession.new(params[:user_session])\n if @user_session.save\n record_action!(:login, current_user)\n flash[:notice] = \"Login successful!\"\n redirect_back_or_default after_login_url\n else\n @failed = true\n render :action => :new\n end\n end", "def create\n user = User.authenticate(params[:email], params[:password])\n if user\n session[:user_id] = user.id\n respond_to do |format|\n format.html { redirect_to admin_root_url }\n format.json { render :json => user, :status => :ok}\n end\n else\n flash.now.alert = t('flash.sessions.create.invalid_login')\n respond_to do |format|\n format.html { render :new }\n format.json { render :json => {'base' => t('flash.sessions.create.invalid_login')}, :status => :not_found}\n end\n end\n end", "def create\n @member = Member.find_by(email: params[:session][:email].downcase)\n if @member && @member.authenticate(params[:session][:password])\n if @member.activated?\n # Log in if activated\n puts \"Logging in #{@member.name}\"\n log_in @member\n puts \"Remembering #{@member.name}? if on == #{params[:session][:remember_me]} Bool: #{params[:session][:remember_me] == 'on'}\"\n params[:session][:remember_me] == 'on' ? remember(@member) : forget(@member)\n # Redirect to root\n redirect_back_or root_path\n else\n message = \"Account not activated. \"\n message += \"Check your email for the activation link.\"\n flash[:danger] = message\n puts message\n redirect_to login_path\n end\n else\n # Error when logging in\n flash.now[:danger] = \"Invalid email or password\"\n puts \"Invalid email or password\"\n @temp = params[:session]\n render 'new'\n end\n end", "def create\n account = params[:email]\n user = User.locate(account)\n\n if user && user.valid_password?(params[:password])\n session[:user_id] = user.id\n redirect_to root_url, notice: \"Logged in!\"\n else\n flash.now[:alert] = \"Account or password is invalid\"\n render \"new\"\n end\n end" ]
[ "0.71827555", "0.7137751", "0.7003368", "0.6905353", "0.6875992", "0.6838573", "0.67557836", "0.6720435", "0.66980386", "0.66937447", "0.66278744", "0.6590726", "0.65827316", "0.6578271", "0.65762967", "0.6574897", "0.6570402", "0.65665936", "0.65475833", "0.6541455", "0.6540747", "0.65401465", "0.6539532", "0.6506109", "0.64963156", "0.64930147", "0.6483901", "0.6476771", "0.64632654", "0.6446863", "0.644161", "0.6441516", "0.6438069", "0.6430415", "0.6430286", "0.6424795", "0.6411757", "0.64116", "0.64096403", "0.6407866", "0.64023876", "0.640225", "0.6398674", "0.6395012", "0.63856244", "0.6384467", "0.6358451", "0.63549286", "0.6350781", "0.63453925", "0.6343366", "0.63340515", "0.6332433", "0.6329062", "0.6327849", "0.63276464", "0.6321939", "0.63200015", "0.63147885", "0.6314338", "0.63035643", "0.6278872", "0.6275671", "0.6274454", "0.62712854", "0.626177", "0.6238681", "0.62304616", "0.62269294", "0.62258935", "0.6223926", "0.6217222", "0.6215892", "0.6214378", "0.6213788", "0.6212011", "0.6208474", "0.6202175", "0.6201073", "0.6197535", "0.61961323", "0.6192898", "0.61895263", "0.6179269", "0.61762553", "0.61740285", "0.6172856", "0.61710405", "0.6169083", "0.61688733", "0.61682427", "0.6161844", "0.6160413", "0.61571896", "0.6157159", "0.61491233", "0.61486655", "0.6144847", "0.6138162", "0.6131793" ]
0.64003307
42
Name: destroy Objective: this method destroy a session instance. Parameters: user identifier. Return: redirect to login page.
def destroy if(current_user) log_out else #nothing to do end return redirect_to login_path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n user_session = UserSession.find\n logout_url = user_session.logout_url(params) unless user_session.nil?\n user_session.destroy unless user_session.nil?\n redirect_to user_session_redirect_url(logout_url) unless performed?\n end", "def destroy\n\t\tsession.delete(:user_id)\n\t\tredirect_to login_path\n\tend", "def destroy\n session.delete :user_id\n redirect_to '/'\n end", "def destroy\n session.delete(:user_id) if session[:user_id]\n redirect_to new_session_path\n end", "def destroy\n session[:user_id] = nil\n\n redirect_to \"#{SSOClient.provider_url}/users/sign_out?back=#{URI::encode(main_app.root_url)}\",\n notice: t(\"sso_client.messages.logged_out\")\n end", "def destroy\n @user_session = @current_user_session\n if @user_session\n @user_session.destroy\n end\n redirect_to login_path\n end", "def destroy\n session[:user_id] = nil\n redirect_to new_session_path, notice: 'You have been logged out of Unify.'\n end", "def destroy\n if !current_user.nil?\n @user_session = UserSession.find\n @user_session.destroy\n \n respond_to do |format|\n format.html { redirect_to(:login, :notice => 'Goodbye!') }\n format.xml { head :ok }\n end\n else\n redirect_to(:login)\n end\n end", "def destroy\n session[:user_id] = nil\n redirect_to '/login'\n end", "def destroy\n session[:user_id] = nil\n redirect_to '/login'\n end", "def destroy\n session[:user_id] = nil\n redirect_to '/login'\n end", "def destroy\n session[:user_id] = nil\n @curr_user = nil\n redirect_to :log_in, :notice => \"Logged out\"\n end", "def destroy\n \t#end session and send to login page\n\n \t\tsession[:user_id] = nil\n \t\tredirect_to root_path\n\n end", "def destroy\n\n session.delete(:user_id)\n redirect_to root_path, notice: \"logged out successfully \"\n\n end", "def destroy\n\t\tsession[:user_id] = nil\n\t\tredirect_to '/'\n\tend", "def destroy\n\t\tuser = current_user\n\n\t\tsession.delete(:user_id)\n\t\tdelete_current_user()\n\t\t\n\t\tuser.destroy\n\t\tredirect_to home_path\n\tend", "def destroy\n\t\tsession.delete(:user_id)\n\t\tredirect_to root_url, notice: 'Logged out!'\n\tend", "def destroy\n session.delete :user_id\n redirect_to root_path\n end", "def destroy\n session[:user_id] = nil\n redirect_to root_url, :notice => \"Logged out!\"\n end", "def destroy\n \tsession[:user_id] = nil\n session[:user_name] = nil\n \tredirect_to '/login'\n end", "def destroy\n @current_user = nil\n\n # Remove the hip_session id, since that kind of goes along\n # with login. Yeah, this code is far away from where hip_session\n # gets created making for confusion, sorry.\n #session.delete(:hip_session_id)\n # actually, destroy the whole damn session, why not, we're redirecting\n # them elsewhere anyway.\n reset_session\n\n # Remove shib cookies to log out of local Shib Service Provider.\n # But this doesn't work anyway, not sure why.\n #cookies.keys.find_all {|k| k =~ /^_shibsession_/ || k =~ /^_shibstate_/}.each { |cookie| cookies.delete(cookie) }\n\n redirect_to \"https://login.johnshopkins.edu/cgi-bin/logoff.pl\"\n\n end", "def destroy\n if current_user\n session.delete :user_id\n redirect_to root_url\n end\n end", "def destroy\n UserSession.find.try(:destroy)\n redirect_back_or_default login_url\n end", "def destroy\n\t\tthe_user_id = params[\"id\"]\n \tuser = User.find_by(:id => the_user_id)\n \tuser.destroy\n session.destroy\n \tredirect_to root_url\n\tend", "def destroy\n @user_session = UserSession.find\n @user_session.destroy\n if params[:id] == 'intruder'\n flash[:error] = \"You're not allowed in here!\"\n else\n flash[:notice] = \"Successfully logged out.\"\n end\n redirect_to :action => 'new'\n end", "def destroy\n session[:user_id] = nil\n redirect_to root_url, :notice => \"Logged out\"\n end", "def destroy\n session[:user_id] = nil\n redirect_to :back\n end", "def destroy\n session[:user] = @current_user = nil\n redirect_to :controller => :sessions, :action => :new\n end", "def destroy_session(user)\n session[:user_id] = nil\n end", "def destroy\n if current_user\n session.delete :user_id\n redirect_to root_path\n\n end\n end", "def destroy\n UserSession.find.destroy\n record_action!(:logout, current_user)\n flash[:notice] = \"Logout successful!\"\n redirect_back_or_default login_url\n end", "def destroy\n\t\tsession[:user_id] = nil\n\t\tflash[:notice] = \"You have logged out.\"\n\t\tredirect_to '/'\n\tend", "def destroy\n session[:user_id] = nil\n redirect_to root_url, :notice => \"You have been successfully logged out.\"\n end", "def destroy_session(user)\n session[:user_id] = nil\n end", "def destroy_session(user)\n session[:user_id] = nil\n end", "def destroy_session(user)\n session[:user_id] = nil\n end", "def destroy\n\t\tsession[:user_id] = nil\n\t\tflash[:success] = \"You have successfully logged out!\"\n\t\tredirect_to root_path\n\tend", "def destroy\n session[:user_id] = nil\n redirect_to sessions_path, flash: { info: 'Logged Out' }\n end", "def destroy \n\t\tsession[:user_id] = nil\n\t\tredirect_to root_path\n\tend", "def destroy\n session.delete(:user_id)\n flash[:success] = t('.successfully_logged_out')\n redirect_to login_path\n end", "def destroy\n session[:user_id] = nil\n redirect_to login_path, :notice => \"Successfully logged out\"\n end", "def destroy\n\n # deletes user session\n session[:user_id] = nil\n redirect_to root_path, notice: 'Logged out.'\n end", "def destroy\r\n\t\t# setting the session to nil\r\n\t\tsession[:user_id] = nil\r\n\t\tflash[:success] = \"You have logged out\"\r\n\t\tredirect_to root_path\r\n\tend", "def destroy\n current_user_session.destroy\n flash[:notice] = I18n.t('user_session.logout_successful')\n redirect_back_or_default new_user_session_path\n end", "def destroy\n\t\t#logout method is defined in helper file\n\t\tsession[:user_id] = nil\n\t\tredirect_to root_path\n\tend", "def destroy\n\t\tsession[:user_id] = nil\n\t\tflash[:notice] = \"Logged Out\"\n\t\treturn redirect_to home_path\n\tend", "def destroy\n session[:user_id] = nil\n redirect_to root_url, :notice => \"You have been logged out\"\n end", "def destroy_session(user)\n session[:user_id] = nil\n end", "def destroy_session(user)\n session[:user_id] = nil\n end", "def destroy\n session[:user_id] = nil\n redirect_to root_url, :notice => \"logged out!\"\n end", "def destroy\n session.delete(:user)\n end", "def destroy\n\t\tsession[:user_id]=nil\n\t\tredirect_to root_path\n\tend", "def destroy\n session[:user_id] = nil\n redirect_to root_url, :notice => \"Logged out\"\n end", "def destroy\n Session.destroy(@application_session)\n session[:id] = @user = nil\n flash[:notice] = \"Ta ta Sir! Your logout was successful.\"\n redirect_to(root_url)\n end", "def destroy\n session[:user_id] = nil\n redirect_to root_path\n end", "def destroy\n session[:user_id] = nil\n redirect_to root_path\n end", "def destroy\n session[:user_id] = nil\n redirect_to welcome_path\n end", "def destroy\n session[:user_id] = nil\n redirect_to \"/\"\n end", "def destroy\n session[:user_id] = nil\n redirect_to root_url, :notice => \"Logged out!\"\n end", "def destroy\n session[:user_id] = nil\n redirect_to root_url, :notice => \"Logged out!\"\n end", "def destroy \n session.delete :user_id \n head :no_content \n end", "def destroy\n session[:user_id] = nil\n redirect_to root_path()\n end", "def destroy\n\t\tsession[:user_id] = nil\n\t\tflash[:notice] = \"You have been logged out. Bon Voyage!\"\n\t\tredirect_to root_path\n\tend", "def destroy\n\t\tsession[:current_user_id] = nil\n \t\tredirect_to '/login'\n\tend", "def destroy\n # when session is destroyed, it is empty\n \tsession[:user_id] = nil \n # redirect to root_path which is the homepage\n \tredirect_to root_path, notice:\n \t\"You have successfully logged out!\"\n end", "def destroy\n\t\t session[:user_id] = nil\n render nothing: true, status: 200\n\t end", "def destroy\n session[:user_id] = nil\n render 'new'\n end", "def destroy\n session[:user_id] = nil\n redirect_to root_path, notice: I18n.t(:session_logged_out)\n end", "def destroy\n session[:user_id] = nil\n redirect_to sessions_path\n end", "def destroy\n if @user.id == session[:user_id]\n session[:user_id] = nil\n @user.destroy\n respond_to do |format|\n format.html { redirect_to '/', notice: 'User was successfully deleted.' }\n format.json { head :no_content }\n end\n else\n @user.destroy\n respond_to do |format|\n format.html { redirect_back(fallback_location: '/', notice: 'User was successfully deleted.') }\n format.json { head :no_content }\n end\n end\n end", "def destroy\n session[:user_id] = nil\n redirect_to '/'\n end", "def destroy\n session[:user_id] = nil\n redirect_to(root_path)\n end", "def destroy\n session[:user_id] = nil\n redirect_to root_url\n end", "def destroy\n \tsession[:user_id] = nil #logout standard user\n session[:owner_id] = nil #logout owner\n \tredirect_to login_url\n end", "def destroy\n\t\tsession[:user_id] = nil\n \tredirect_to root_url\n\tend", "def destroy\n \tsession[:user_id] = nil\n @current_user = nil\n \tredirect_to root_url, notice: \"You are now logged out.\"\n end", "def destroy\n # Remove the user id from the session\n session.clear\n redirect_to root_url\n end", "def destroy\n\tputs \"***** TESTING DELETING USER\"\n# set variable to find a specific user by user_id\n\t@user = User.find(params[:id])\n# delete user from database upon clicking link in /show\n\t@user.destroy\n# end session so the current_user method stops looking for their id\n session[:user_id] = nil\n\n# redirect to /index \n\tredirect_to root_path\n\tend", "def destroy\n @session[:user_id] = nil\n @current_user = nil\n end", "def destroy\n log_out_user\n redirect_to new_session_url\n end", "def destroy\n user_session.log_out\n redirect_to root_url\n end", "def destroy\n session[:user_id] = nil\n redirect_to login_path, notice: \"Logged out\"\n end", "def destroy\n session[:user_id] = nil\n redirect_to root_url, notice: 'Logged out!'\n end", "def destroy\n session[:user_id] = nil\n session[:type] = nil\n redirect_to root, alert: \"You have been logged out.\"\n end", "def destroy\n\n\t\t# destroy the user from the database\n\t\t@user.destroy if @user\n\n\t\t# delete current user\t\t\n\t\treset_session\n\n\t\t# we want to redirect to our root element in the application etc\n\t\tredirect_to root_url, :notice => \"Successfully Signed Out\"\n\n\tend", "def destroy\n session[:user_id] = nil\n # flash[:notice] = \"Successfully logged out.\"\n redirect_to root_url, notice: \"Successfully logged out.\"\n end", "def destroy\r\n @user = User.find(params[:id])\r\n if @user.id == session[:user_id]\r\n reset_session\r\n end\r\n @user.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to users_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n session[:user_id] = nil\n redirect_to root_path\n end", "def destroy\n session[:user_id] = nil\n redirect_to root_path\n end", "def destroy\n session[:user_id] = nil\n redirect_to root_path\n end", "def destroy\n session[:user_id] = nil\n redirect_to root_path\n end", "def destroy\n session[:user_id] = nil\n redirect_to root_path\n end", "def destroy\n session[:user_id] = nil\n redirect_to root_path\n end", "def destroy\n current_user_session.destroy\n redirect_to root_url\n end", "def destroy\n current_user_session.destroy if current_user_session \n redirect_back_or_home\n end", "def destroy\n session[:user_id] = nil\n flash[:error] = \"You are successfully logged out\"\n redirect_to root_url\n end", "def destroy\n session[:user_id] = nil\n flash[:info] = \"Logged Out\"\n redirect_to root_path\n end", "def destroy\n #puts \".............>>>>>>>>>> user_session_controller::destroy - removing user session \"+current_user_session.id.to_s\n current_user_session.destroy\n\n # Clean up any old sessions\n #current_user_session.clearOldSessions\n\n # MK - don't need to display this anymore\n flash[:success] = \" You have successfully logged out.\"\n session[:project_id] = nil\n session[:project_title] = nil\n session[:study_id] = nil\n\n # Jump to home page\n redirect_to \"/\"\n end", "def destroy\n session[:user_id] = nil\n redirect_to pages_logout_path\n end", "def destroy\n @user_session = UserSession.find(params[:id])\n if @user_session then @user_session.destroy end\n\n respond_to do |format|\n format.html { redirect_to :back, :notice => \"You have successfully logged out\" }\n format.json { head :ok }\n end\n end", "def destroy\n current_user_session.destroy\n redirect_to(root_url, :notice => \"Logout Successful!\")\n end" ]
[ "0.82049865", "0.8028638", "0.79665333", "0.7947247", "0.7929838", "0.78877896", "0.7836255", "0.7834341", "0.78295714", "0.78295714", "0.78295714", "0.78101003", "0.7810086", "0.7777524", "0.7752483", "0.77423453", "0.7731553", "0.7723651", "0.7722579", "0.7720228", "0.7717822", "0.7716681", "0.7715038", "0.77102506", "0.77099305", "0.7706494", "0.76941717", "0.7691518", "0.7686825", "0.76828915", "0.76814175", "0.7671124", "0.7669357", "0.76625556", "0.76625556", "0.76625556", "0.7661407", "0.76609504", "0.7649568", "0.7636858", "0.76275516", "0.76265574", "0.76220137", "0.7620662", "0.7617894", "0.7616967", "0.76156193", "0.7604258", "0.7604258", "0.76024246", "0.76000917", "0.75965244", "0.75890595", "0.7586181", "0.7581298", "0.7581298", "0.7581187", "0.75810474", "0.75785613", "0.75785613", "0.7572619", "0.75720644", "0.7568298", "0.75600255", "0.7557863", "0.7553169", "0.75513726", "0.75493395", "0.75484854", "0.7547275", "0.75445026", "0.75400114", "0.75359553", "0.7530871", "0.75296354", "0.75274295", "0.7525402", "0.7523548", "0.7514628", "0.7514586", "0.7494393", "0.74862665", "0.7480472", "0.747398", "0.7473566", "0.747184", "0.74684286", "0.7468064", "0.7468064", "0.7468064", "0.7468064", "0.7468064", "0.7468064", "0.74672204", "0.74652916", "0.7464348", "0.7460775", "0.74597114", "0.74558187", "0.74549097", "0.74483776" ]
0.0
-1
aContent can be a String or File eg. 'something' or open('file.txt')
def put_content(aFilename, aContent, aBucketName) AWS::S3::S3Object.store(aFilename, aContent, aBucketName) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_or_content(str)\n return str if str.nil?\n return str unless file_param? str\n\n content = File.read(str[1..-1])\n content\n end", "def content= content\n @file = content\n @content = content.dup\n @content &&= @content.read if @content.respond_to? :read\n @content &&= @content.to_s if @content.respond_to? :read\n end", "def add_content(io_or_filename)\n if io_or_filename.class == String\n File.open(io_or_filename, mode='r') do |f|\n add_content_io f\n end\n else\n add_content_io io_or_filename\n end\n self\n end", "def content\n try(content_type)\n end", "def parse_content(content); end", "def content=(string); end", "def content=(string); end", "def filename_and_content_to_mimetype(filename, content)\n # Try filename\n ret = filename_to_mimetype(filename)\n if !ret.nil?\n return ret\n end\n\n # Otherwise look inside the file to work out the type.\n # Mahoro is a Ruby binding for libmagic.\n m = Mahoro.new(Mahoro::MIME)\n mahoro_type = m.buffer(content)\n mahoro_type.strip!\n #STDERR.puts(\"mahoro\", mahoro_type, \"xxxok\")\n # XXX we shouldn't have to check empty? here, but Mahoro sometimes returns a blank line :(\n # e.g. for InfoRequestEvent 17930\n if mahoro_type.nil? || mahoro_type.empty?\n return nil\n end\n # text/plain types sometimes come with a charset\n mahoro_type.match(/^(.*);/)\n if $1\n mahoro_type = $1\n end\n # see if looks like a content type, or has something in it that does\n # and return that\n # mahoro returns junk \"\\012- application/msword\" as mime type.\n mahoro_type.match(/([a-z0-9.-]+\\/[a-z0-9.-]+)/)\n if $1\n return $1\n end\n # otherwise we got junk back from mahoro\n return nil\nend", "def upload_from_string(content, title = \"Untitled\", params = {})\n media = new_upload_io(StringIO.new(content), params)\n return upload_from_media(media, title, params)\n end", "def content_for(name, content = T.unsafe(nil), options = T.unsafe(nil), &block); end", "def content_type\n %x(file -bi \"#{self.path}\").chomp.scan(/^[a-z0-9\\-_]+\\/[a-z0-9\\-_]+/).first\n end", "def update_from_string(content, params = {})\n media = new_upload_io(StringIO.new(content), params)\n return update_from_media(media, params)\n end", "def process_text(content)\n content\n end", "def content\n @content ||= case\n when @file\n @file.read\n when @text\n @text\n when @url\n raise URI::InvalidURIError, @url unless @url =~ URI::regexp\n response = open(@url)\n html = response.read\n html.encode(\"UTF-16\", \"UTF-8\", :invalid => :replace, :replace => \"\").encode(\"UTF-8\", \"UTF-16\")\n end\n end", "def content_types_provided\n [ [ FILE_EXTENSION_CONTENT_TYPES[file_extension], :file_contents ] ]\n end", "def content_type\n @content_type || file.content_type\n end", "def content_file=(file_path)\n if File.exist?(file_path)\n s = File.size(file_path)\n if s > 0\n self.size = s\n self.content_type = %x[ file -ib \"#{file_path}\" ].strip\n self.filename = File.basename(file_path)\n self.content = File.read(file_path)\n true\n else\n false\n end\n else\n false\n end\n end", "def file_content(path)\n cont = \"\"\n File.open(path) do |fil|\n cont = fil.read\n end\n cont\nend", "def from_string(content, options = {})\n ios = StringIO.new(content)\n file = Paperclip.io_adapters.for(ios)\n\n file.original_filename = options[:filename] || 'download.txt'\n file.content_type = options[:content_type] || 'text/plain'\n\n self.result = file\n save!\n end", "def file_content_return_url(url, text, content_type = nil)\n url = CGI::escape(url)\n text = CGI::escape(text)\n content_type = CGI::escape(content_type) if content_type\n\n return_url = \"#{content_return_url}?return_type=file&url=#{url}&text=#{text}\"\n return_url = \"#{return_url}&content_type=#{content_type}\" if content_type\n\n return return_url\n end", "def format_content(type, args, content)\n Formatter.new(content).apply(type, args)\n end", "def log_content_type(type)\n File.open(Path + \"/content.log\", \"a\") {|f| f << type + \"\\n\"}\nend", "def assert_file_content_match(refFile,resContent, explanationstring=\"\")\n if explanationstring.empty?\n explanationstring=explanationstring + \": \"\n end\n\n refContArr = File.open(refFile,\"r\").read.split(/\\n/)\n resContArr = resContent.split(/\\n/)\n assert_equal(refContArr.size,resContArr.size,explanationstring + \"Line count assertions : asnswer file: #{refFile}: \")\n for count in 0...refContArr.size\n re = refContArr[count]\n assert_match(/#{re}/,resContArr[count],explanationstring + \"At line :\" + count.to_s + \": answer file: #{refFile}\")\n end\n end", "def data_content(name, content)\n DataObject.data_content(name, content)\n end", "def guessed_safe_content_type\n return unless path\n\n type = Marcel::Magic.by_path(original_filename).to_s\n type if type.start_with?('text/') || type.start_with?('application/json')\n end", "def parse(content, base_uri = T.unsafe(nil)); end", "def add_content(content)\n @content = @content + content\n end", "def read_content(name, resource)\n read(name, resource) do |file|\n if file.header.typeflag == \"2\"\n return read_content(name, File.absolute_path(file.header.linkname,File.dirname(resource)))\n end\n if file.header.typeflag != \"0\"\n raise NotAFile.new(\"not a file\", {'path' => resource})\n end\n return file.read\n end\n end", "def initialize(content) \r\n @content = content\r\n end", "def update_file_content(new_content)\n return false if new_content.nil?\n self.file_content = new_content\n self.save\n end", "def update_file_content(new_content)\n return false if new_content.nil?\n self.file_content = new_content\n self.save\n end", "def content_type\n file.try(:content_type)\n end", "def check_seo_file(file_obj, url_host)\n content_actual = nil\n \n # set failure to true and change if test passes\n failed_file = true\n\n ## Get Actual Content from URL\n begin\n f = open(file_obj.targeturl) \n\n ## Check Status Codes\n if(f.status[0] == \"200\" && f.status[1] == \"OK\")\n\n ## Get the content and strip out carriage returns (\\r)\n content_actual = f.readlines.join().gsub(\"\\r\",'')\n\n ## Check the content matches the DB\n if(content_actual == file_obj.valid_content.gsub(\"\\r\",\"\"))\n \n failed_file =false\n else\n\n failed_file = true\n end\n else\n\n failed_file = true\n end\n rescue => e\n begin\n f.close()\n rescue\n\n end\n return [false, content_actual, e.message]\n end\n\n return [failed_file == false, content_actual]\n end", "def read_content(entry)\n entry.rewind if entry.respond_to? :rewind\n case entry\n when File, Tempfile, StringIO then entry.read\n when Dir then (entry.entries - ['.', '..']).collect { |filename| read_content(Pathname.new(File.join(entry.path, filename))) }.compact.sort\n when String then entry\n when Pathname then\n if entry.directory?\n read_content(entry)\n elsif entry.file?\n File.open(entry, 'r:binary').read\n end\n end\nend", "def convert(content); end", "def convert(content); end", "def content\n @content ||= params['content']\n end", "def read_content(dir, magic_dir, matcher); end", "def set_content(content)\n @content = content\n end", "def load(content) # :nodoc:\n Marshal::load(content)\n end", "def content_for?(name); end", "def format_content(old_content)\n file_content = Base64.decode64(old_content) << @content\n return new_file_content = Base64.encode64(file_content)\n end", "def content_matches_file?(content, path)\n file = read_content_from_disk(path)\n content.eql?(file)\n end", "def description_of content_type\n case content_type.to_s.strip\n when \"image/jpeg\"\n \"JPEG graphic\"\n when \"application/vnd.ms-excel\"\n \"Excel worksheet\"\n when \"application/msword\"\n \"Word document\"\n when \"application/pdf\"\n \"PDF file\"\n else \"\"\n end\n end", "def parse(content, object = T.unsafe(nil), handler = T.unsafe(nil)); end", "def content\n @content ||= if valid_attrs?(:content_id, :content_type)\n Object.const_get(content_type).find_by_id(content_id)\n end\n end", "def contentformat(value)\n _contentformat(value) or fail ArgumentError, \"Unknown value for contentformat: #{value}\"\n end", "def contentformat(value)\n _contentformat(value) or fail ArgumentError, \"Unknown value for contentformat: #{value}\"\n end", "def contentformat(value)\n _contentformat(value) or fail ArgumentError, \"Unknown value for contentformat: #{value}\"\n end", "def http_valid_content_types?(http, content_types = ['text/html'])\n content_types = content_types.is_a?(Array) ? content_types : [content_types]\n !content_types.include?(http.response_header[EM::HttpClient::CONTENT_TYPE])\n end", "def initialize(content)\n @content = content\n end", "def initialize(content)\n @content = content\n end", "def parse_file_contents(filename, file_contents, args)\n return file_contents\n end", "def content_tag(type, content, options = {}); end", "def default_file_content_for file_name\n \"#{file_name} content\"\nend", "def replace_file_content(rev, full_path, file_content, _mime_type, expected_revision_int)\n unless file_exists?(rev, full_path)\n raise Repository::FileDoesNotExistConflict, full_path\n end\n # replace content of file in question\n act_rev = get_latest_revision\n if act_rev.revision_identifier != expected_revision_int.to_i\n raise Repository::FileOutOfSyncConflict, full_path\n end\n files_list = rev.files_at_path(File.dirname(full_path))\n rev.__replace_file_content(files_list[File.basename(full_path)], file_content)\n rev\n end", "def createUserContent(url,tag,content) \n #puts \"content: #{content}\"\n document = Hpricot(content) \n DocumentUtil::instance.removeTags document,[\"style\",\"script\"]\n docText = DocumentUtil::instance.textOnly document \n # Write contents for user out to a file... \n #puts \"Write content for user to file...\"\n #File.open(userFile,\"a\") do |outputFile|\n data = \"\" \n docText.each do |line|\n text = line.to_s.strip \n # Write non-empty lines to user file.\n if ! text.empty?\n #outputFile.puts text\n text = DocumentUtil::instance.removePunctuation text\n text = text.downcase\n text.split(/\\b/).each do |term|\n if term.match(/\\w/) && ! DocumentUtil::instance.isStopWord(term)\n data += term + \"\\n\"\n end\n end\n end\n end\n #end\n Content.new(url,tag,data)\n end", "def initialize(content)\n @content = content\n end", "def initialize(content)\n @content = content\n end", "def initialize(content)\n @content = content\n end", "def read(*args)\n if @content\n if args.empty?\n @content\n else\n length, outbuf = args\n raise ArgumentError, \"outbuf argument not supported since the content is already loaded\" if outbuf\n @content[0, length]\n end\n elsif is_path?\n File.open(@file, \"rb\") {|file| file.read(*args)}\n else\n @file.try(:rewind)\n @content = @file.read(*args)\n @file.try(:close) unless @file.class.ancestors.include?(::StringIO) || @file.try(:closed?)\n @content\n end\n end", "def content_type\n type, *parameters = content_type_parse\n type || 'application/octet-stream'\n end", "def assert_file_content_equal(refFile,resContent, explanationstring=\"\")\n if explanationstring.empty?\n explanationstring=explanationstring + \": \"\n end\n\n refContArr = File.open(refFile,\"r\").read.split(/\\n/)\n resContArr = resContent.split(/\\n/)\n assert_equal(refContArr.size,resContArr.size,explanationstring + \"Line count assertions : answer file: #{refFile}: \")\n for count in 0...refContArr.size\n assert_equal(refContArr[count],resContArr[count],explanationstring + \"At line :\" + count.to_s + \": answer file: #{refFile}: \")\n end\n end", "def get_content(content_ref_path)\n puts \" get_content() #{@curl_get_prefix} #{content_ref_path}\" if @debug\n content_details = Jive_ruby_api.cleanse_security_string(`#{@curl_get_prefix} #{content_ref_path}`)\n content_details = JSON.parse(content_details)\n html_string = content_details['content']['text']\n\n return html_string\n\n end", "def modify_content(source, content, replace_value)\n file = File.read(source)\n replace = file.gsub(/#{content}/, replace_value)\n File.open(source, \"w\"){|f|\n f.puts replace \n }\n end", "def initialize(anything)\n @content = anything\n end", "def load(content)\n case content\n when Riakpb::RpbContent, Hash, Riakpb::Content\n last_mod = content[:last_mod]\n last_mod_usecs = content[:last_mod_usecs]\n\n if not (last_mod.blank? or last_mod_usecs.blank?)\n self.last_mod = Time.at \"#{last_mod}.#{last_mod_usecs}\".to_f\n end\n\n @content_type = content[:content_type] unless content[:content_type].blank?\n @charset = content[:charset] unless content[:charset].blank?\n @content_encoding = content[:content_encoding] unless content[:content_encoding].blank?\n @vtag = content[:vtag] unless content[:vtag].blank?\n self.links = content[:links] unless content[:links].blank?\n self.usermeta = content[:usermeta] unless content[:usermeta].blank?\n\n unless content[:value].blank?\n case @content_type\n when /json/\n @value = ActiveSupport::JSON.decode(content[:value]) \n when /octet/\n @value = Marshal.load(content[:value])\n else\n @value = content[:value]\n end\n end\n else raise ArgumentError, t(\"riak_content_type\")\n end\n\n return(self)\n end", "def content\n @content ||= @filename ? pathname.read : BLANK_TEMPLATE\n end", "def content_type\n self.file_content_type\n end", "def behaves_like_io?(obj)\n [IO, Tempfile, StringIO].any? { |klass| obj.is_a? klass } || (defined?(Rack) && obj.is_a?(Rack::Test::UploadedFile))\n end", "def open(uri, text, version); end", "def run(content, args = {})\n current_dir_pathname = Pathname.new(@item[:content_filename]).dirname.realpath\n required_items = []\n content = content.gsub(REQUIRE_RE) do |orig|\n imported_pathname = Pathname.new($1)\n imported_pathname = current_dir_pathname + imported_pathname if imported_pathname.relative?\n if imported_pathname.exist?\n imported_filename = imported_pathname.realpath\n @items.each do |i|\n if !i[:content_filename].nil? &&\n Pathname.new(i[:content_filename]).realpath == imported_filename\n required_items << i\n end\n end\n \"\\n;\" + File.read(imported_filename)\n else\n orig\n end\n end\n depend_on required_items.uniq if required_items.size > 0\n content\n end", "def parser(content_type); end", "def file\n\n content_upload_id = params[:id]\n\n raise \"content upload without id\" if content_upload_id.blank?\n\n # if the id is not numeric, assume it's a link name\n if content_upload_id.to_i == 0\n content_upload = ContentUpload.find_by_link_name(content_upload_id)\n else # assume the id passed is numeric and find it by ID\n content_upload = ContentUpload.find_by_id(content_upload_id)\n end\n\n raise \"content upload not found\" if content_upload.blank?\n\n # send them to the file on the content server\n redirect_to(content_upload.content_server_url, status: :moved_permanently)\n\n end", "def markup_file_contents(contents); end", "def get_content_type(filename)\n ext = File.extname(filename) # get the extension\n type = 'application/octed-stream'\n type = 'text/html' if ext == '.html' || ext == '.htm'\n type = 'text/plain' if ext == '.txt' || ext == '.rb'\n type = 'text/css' if ext == '.css'\n type = 'image/jpeg' if ext == '.jpeg' || ext == '.jpg'\n type = 'image/gif' if ext == '.gif'\n type = 'image/png' if ext == '.png'\n type = 'image/bmp' if ext == '.bmp'\n type = 'text/xml' if ext == '.xml' || ext == '.xsl'\n type # same as: return type\n end", "def update_file_content(new_content)\n return false if new_content.nil?\n self.file_content = new_content\n return self.save\n end", "def attachment_content_type_for(joint)\n case File.extname(joint).downcase\n when '.txt' then 'text/plain'\n when '.html' then 'plain/html'\n when '.pdf' then 'application/octet-stream' #'application/x-pdf'\n when '.jpg', '.jpeg' then 'image/jpeg'\n when '.png' then 'image/png'\n when '.gif' then 'image/gif'\n when '.doc', '.docx' then 'application/msword'\n else \n 'plain/text' # par défaut\n end\nend", "def processar_dados\n if params[:opcao] == 'arquivo'\n @file_content = params[:arquivo].read\n elsif params[:opcao] == 'text-area'\n @file_content = params[:file_content]\n else\n redirect_to :action => \"entrar_arquivo\"\n end\n end", "def open_file(io)\n io.kind_of?(File) ? io : File.open(io)\n end", "def create\n @content = Content.new(params[:content])\n file_size = params[:content][:content_file_file_size]\n\n respond_to do |format|\n if @content.save\n @content_saved = true\n \n @content.user = current_user\n current_user.contents << @content\n \n format.html { redirect_to @content}\n format.json { render json: @content, status: :created, location: @content }\n else\n @content_saved = false\n \n if file_size == nil\n @file_nil = true\n elsif file_size > 1000000\n @file_too_big = true \n end \n \n format.html { redirect_to root_path, notice: \"Content could not be saved - please pick a jpg or png file less than 1 MB\" }\n format.json { render json: @content.errors, status: :unprocessable_entity }\n end\n end\n end", "def content_type(path)\n extension = path.split(\".\").last\n type = CONTENT_TYPE[extension] ||= 'application/octet-stream'\nend", "def convert(content)\n content\n end", "def append_file(fname, content)\n begin\n aFile = File.new(fname,\"a\")\n aFile.puts content\n aFile.close\n rescue Exception=>e\n # logger.error e\n p e.inspect\n end\nend", "def getFileContents(file)\n fileContent = \"\";\n File.open(file).each do |line|\n fileContent += line;\n end\n fileContent;\nend", "def accepts_content?\n !!@ext_params[\"content_return_types\"]\n end", "def file\n\n content_upload_id = params[:id]\n\n raise \"content upload without id\" if content_upload_id.blank?\n\n # if the id is not numeric, assume it's a link name\n if content_upload_id.to_i == 0\n content_upload = ContentUpload.find_by_link_name(content_upload_id)\n else # assume the id passed is numeric and find it by ID\n content_upload = ContentUpload.find_by_id(content_upload_id)\n end\n\n raise \"content upload not found\" if content_upload.blank?\n\n # send them to the file on the content server\n redirect_to(content_upload.content_server_url)\n\n end", "def set_content_type(override=false)\n if override || file.content_type.blank?\n File.open(file.path) do |fd|\n data = fd.read(1024) || \"\"\n new_content_type = filemagic.buffer(data)\n if file.respond_to?(:content_type=)\n file.content_type = new_content_type\n else\n file.instance_variable_set(:@content_type, new_content_type)\n end\n end\n end\n end", "def to_content(type, value)\n Content.new(type: \"text/#{type}\", value: value)\n end", "def impexify_content(content)\n content = content.gsub(' \"', '\"').gsub('\"', '\"\"').gsub(/\\n/, '')\n content.force_encoding('ASCII-8BIT')\n end", "def parse_content_type(str)\n unless str =~ /^Content-Type: (.*?); name=\\\"(.*)\\\"/\n raise \"unparseable content-type declaration: #{str.inspect}\"\n end\n \n {:content_type => $1, :section_name => $2}\n end", "def initialize(path, content)\n @path = path\n @content = content\n end", "def initialize(content); end", "def initialize(content); end", "def accepts_content_type?(content_type)\n accepted_content_types.include? content_type.to_sym\n end", "def initialize(name, content)\n @name = name\n @content = content\n end", "def initialize(name, content)\n @name = name\n @content = content\n end", "def get_content(iFollowRedirections)\n rContentFormat = nil\n rContent = nil\n\n if (File.exists?(@URL))\n rContent = @URL\n rContentFormat = CONTENT_LOCALFILENAME\n else\n rContent = Errno::ENOENT.new(@URL)\n rContentFormat = CONTENT_ERROR\n end\n\n return rContentFormat, rContent\n end", "def content_type=(v) Axlsx::validate_content_type v; @content_type = v end", "def is_binary(content_type)\n if content_type.nil?\n false\n else\n content_type = content_type.downcase\n !(content_type.start_with?(\"text/\") || content_type.include?(\"json\") || content_type.include?(\"xml\"))\n end\n end" ]
[ "0.6534427", "0.5836122", "0.57659453", "0.5691215", "0.5561858", "0.550435", "0.550435", "0.54323554", "0.5423568", "0.5394593", "0.53341824", "0.53096086", "0.52251583", "0.5157046", "0.50730383", "0.5052393", "0.5008223", "0.500723", "0.500304", "0.499282", "0.49864995", "0.49635795", "0.49306747", "0.492573", "0.492157", "0.49120086", "0.48959976", "0.4889605", "0.488649", "0.48846462", "0.48846462", "0.4879805", "0.48742902", "0.48719463", "0.48651424", "0.48651424", "0.48613852", "0.48600763", "0.4852802", "0.48479357", "0.48461536", "0.48391512", "0.4834423", "0.48335278", "0.4828004", "0.48170352", "0.4816492", "0.48159745", "0.48159745", "0.4811875", "0.4809967", "0.4809967", "0.48019177", "0.47989386", "0.47937453", "0.47896624", "0.47884014", "0.47840437", "0.47840437", "0.47840437", "0.47757903", "0.47749507", "0.47730684", "0.4765546", "0.47537544", "0.47353557", "0.47210577", "0.47150093", "0.47113442", "0.4708335", "0.47065654", "0.47034824", "0.47030932", "0.47017702", "0.4701604", "0.46989292", "0.4695964", "0.46936467", "0.46888772", "0.46871817", "0.4685497", "0.46836603", "0.46788684", "0.46781328", "0.4673452", "0.4665719", "0.46653375", "0.46614978", "0.4656407", "0.465259", "0.465256", "0.4650774", "0.46478575", "0.46478575", "0.46468133", "0.4645968", "0.4645968", "0.46421906", "0.46419528", "0.46404085" ]
0.47503465
65
should replace string_to_file with file object
def download(aFilename,aBucketName,aObjectName=nil) aObjectName ||= File.basename(aFilename) #AWS::S3::S3Object.store(aObjectName, MiscUtils.string_from_file(aFilename), aBucketName) MiscUtils.string_to_file(get_content(aObjectName,aBucketName),aFilename) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def string2file(string,filename='string2file.txt',filepath='.')\n File.open(\"#{filepath}/#{filename}\",\"w\") do |f|\n f << string\n end\nend", "def s_to_file file_path_str, new_content_str='' \n File.open(file_path_str, \"w+\") { |f| f.write(new_content_str) }\n end", "def convertStringToFile(text, file_path)\n if (!(!file_path.nil? && !file_path.empty?))\n raise Error.new(Pdfcrowd.create_invalid_value_message(file_path, \"convertStringToFile::file_path\", \"html-to-image\", \"The string must not be empty.\", \"convert_string_to_file\"), 470);\n end\n \n output_file = open(file_path, \"wb\")\n begin\n convertStringToStream(text, output_file)\n output_file.close()\n rescue Error => why\n output_file.close()\n FileUtils.rm(file_path)\n raise\n end\n end", "def put_file_from_string(f, s)\n File.open(f , 'w') do |file|\n file.puts(s)\n end\nend", "def convertStringToFile(text, file_path)\n if (!(!file_path.nil? && !file_path.empty?))\n raise Error.new(Pdfcrowd.create_invalid_value_message(file_path, \"convertStringToFile::file_path\", \"html-to-pdf\", \"The string must not be empty.\", \"convert_string_to_file\"), 470);\n end\n \n output_file = open(file_path, \"wb\")\n begin\n convertStringToStream(text, output_file)\n output_file.close()\n rescue Error => why\n output_file.close()\n FileUtils.rm(file_path)\n raise\n end\n end", "def string_to_file(st,filename)\n f = File.new(filename,\"w\")\n f.puts st\n f.close\n end", "def string_as_file(string, strip_whitespace = true)\n if strip_whitespace\n temp = \"\"\n string.each_line { |line|\n temp += line.sub(/^[ \\t]+/, '')\n }\n string = temp\n end\n file = Tempfile.new(\"ruby.string_as_file.\")\n begin\n file.print(string)\n file.close()\n file.open()\n yield file\n ensure\n file.close(true)\n end\n end", "def encrypt_to_file(string, secure)\n secure.open('wb') { |s| basic_encrypt(StringIO.new(string), s) }\n end", "def file_out(string)\nopen('myfile.json', 'a') { |f|\n f.puts string\n }\nend", "def from_string(content, options = {})\n ios = StringIO.new(content)\n file = Paperclip.io_adapters.for(ios)\n\n file.original_filename = options[:filename] || 'download.txt'\n file.content_type = options[:content_type] || 'text/plain'\n\n self.result = file\n save!\n end", "def to_actual_filename!\n filename = to_actual_filename\n replace(filename) if filename\n end", "def write_file(filename)\n data = convert_to_string\n file = File.open(filename, \"w\")\n file.write(data)\n file.close\n end", "def save_to_file(filename)\n File.open(filename, 'w'){|f| f.write(string)}\n end", "def uri_to_file(uri); end", "def uri_to_file(uri); end", "def to_file\n return @file if @file.is_a?(File)\n File.open(path, \"rb\") if exists?\n end", "def log_string_to_file(string, path)\n cmd = %Q{echo \"#{string}\" >> #{path}}\n system(cmd)\n end", "def convertStreamToFile(in_stream, file_path)\n if (!(!file_path.nil? && !file_path.empty?))\n raise Error.new(Pdfcrowd.create_invalid_value_message(file_path, \"convertStreamToFile::file_path\", \"pdf-to-text\", \"The string must not be empty.\", \"convert_stream_to_file\"), 470);\n end\n \n output_file = open(file_path, \"wb\")\n begin\n convertStreamToStream(in_stream, output_file)\n output_file.close()\n rescue Error => why\n output_file.close()\n FileUtils.rm(file_path)\n raise\n end\n end", "def str_replace(filepath, search_str, replace_str)\n File.write(f = filepath, File.read(f).gsub(search_str, replace_str))\n end", "def save(file)\n case file\n when String\n io = File.open(file, 'wb')\n when IO , StringIO\n io = file\n else\n raise \"must pass io or filename, not #{file}\"\n end\n @object.write io\n io.close\n end", "def save_to_file(obj)\n File.open(@filename, @mode) do |aFile|\n aFile.puts \"#{obj}\"\n end\n end", "def save_to_file(filename)\n File.open(filename, 'w') { |f| f.write(string) }\n end", "def replace!(destination, regexp, string)\n content = File.binread(destination)\n content.gsub!(regexp, string)\n File.open(destination, 'wb') { |file| file.write(content) }\nend", "def convertFileToFile(file, file_path)\n if (!(!file_path.nil? && !file_path.empty?))\n raise Error.new(Pdfcrowd.create_invalid_value_message(file_path, \"convertFileToFile::file_path\", \"pdf-to-text\", \"The string must not be empty.\", \"convert_file_to_file\"), 470);\n end\n \n output_file = open(file_path, \"wb\")\n begin\n convertFileToStream(file, output_file)\n output_file.close()\n rescue Error => why\n output_file.close()\n FileUtils.rm(file_path)\n raise\n end\n end", "def to_file(file)\n Utils::write_file(file, to_s)\n end", "def format_file(str)\n return str unless context.file\n return str.map { |s| format_file(s) } if str.is_a? Array\n context.file.format(str.to_s)\n end", "def file_or_content(str)\n return str if str.nil?\n return str unless file_param? str\n\n content = File.read(str[1..-1])\n content\n end", "def write(string, filename)\n Util::FileMutation.write(string, filename)\n end", "def save_to(filepath)\n File.open(filepath, \"w\") do |fp|\n if @args[:data].is_a?(StringIO)\n fp.write(@args[:data].string)\n else\n #Stream output to avoid using too much memory.\n self.io do |fp_read|\n fp_read.lines do |line|\n fp.write(line)\n end\n end\n end\n end\n end", "def file_open_puts object, filename\n File.open(filename, 'w') do |f|\n f.puts(object)\n end\n\n end", "def convertStreamToFile(in_stream, file_path)\n if (!(!file_path.nil? && !file_path.empty?))\n raise Error.new(Pdfcrowd.create_invalid_value_message(file_path, \"convertStreamToFile::file_path\", \"pdf-to-html\", \"The string must not be empty.\", \"convert_stream_to_file\"), 470);\n end\n \n if (!(isOutputTypeValid(file_path)))\n raise Error.new(Pdfcrowd.create_invalid_value_message(file_path, \"convertStreamToFile::file_path\", \"pdf-to-html\", \"The converter generates an HTML or ZIP file. If ZIP file is generated, the file path must have a ZIP or zip extension.\", \"convert_stream_to_file\"), 470);\n end\n \n output_file = open(file_path, \"wb\")\n begin\n convertStreamToStream(in_stream, output_file)\n output_file.close()\n rescue Error => why\n output_file.close()\n FileUtils.rm(file_path)\n raise\n end\n end", "def convertUrlToFile(url, file_path)\n if (!(!file_path.nil? && !file_path.empty?))\n raise Error.new(Pdfcrowd.create_invalid_value_message(file_path, \"convertUrlToFile::file_path\", \"pdf-to-text\", \"The string must not be empty.\", \"convert_url_to_file\"), 470);\n end\n \n output_file = open(file_path, \"wb\")\n begin\n convertUrlToStream(url, output_file)\n output_file.close()\n rescue Error => why\n output_file.close()\n FileUtils.rm(file_path)\n raise\n end\n end", "def to_file(file)\n Utils.write_file(file, to_s)\n end", "def modify_file(path,document) \n File.open(path,'w') do|file|\n file.write(document) if document\n end\nend", "def replace_file(filename, data)\n remove_file filename\n create_file filename, data\nend", "def replace_file(filename, data)\n remove_file filename\n create_file filename, data\nend", "def modify_string_in_file(target_file, string_to_replace, string_to_replace_with)\n FileUtils.cp_r target_file , \"#{target_file}_tmp\"\n\n text = File.read(\"#{target_file}_tmp\")\n text.gsub!(string_to_replace, string_to_replace_with)\n File.open(target_file, 'w') {|f| f.puts text}\n if (open(target_file).grep(/#{string_to_replace_with}/).length) == 0\n raise \"XML file was NOT modified with correct text: #{target_file}\"\n end\n File.delete \"#{target_file}_tmp\"\n end", "def convertUrlToFile(url, file_path)\n if (!(!file_path.nil? && !file_path.empty?))\n raise Error.new(Pdfcrowd.create_invalid_value_message(file_path, \"convertUrlToFile::file_path\", \"pdf-to-html\", \"The string must not be empty.\", \"convert_url_to_file\"), 470);\n end\n \n if (!(isOutputTypeValid(file_path)))\n raise Error.new(Pdfcrowd.create_invalid_value_message(file_path, \"convertUrlToFile::file_path\", \"pdf-to-html\", \"The converter generates an HTML or ZIP file. If ZIP file is generated, the file path must have a ZIP or zip extension.\", \"convert_url_to_file\"), 470);\n end\n \n output_file = open(file_path, \"wb\")\n begin\n convertUrlToStream(url, output_file)\n output_file.close()\n rescue Error => why\n output_file.close()\n FileUtils.rm(file_path)\n raise\n end\n end", "def new_file(filename)\n return (File.open(filename, \"w\"))\nend", "def convertFileToStream(file, out_stream)\n if (!(File.file?(file) && !File.zero?(file)))\n raise Error.new(Pdfcrowd.create_invalid_value_message(file, \"convertFileToStream::file\", \"pdf-to-text\", \"The file must exist and not be empty.\", \"convert_file_to_stream\"), 470);\n end\n \n @files['file'] = file\n @helper.post(@fields, @files, @raw_data, out_stream)\n end", "def stream_to object, path_or_file, in_blocks_of = 8192\n dstio = case path_or_file\n when String then File.new(path_or_file, \"wb+\")\n when IO then path_or_file\n when Tempfile then path_or_file\n end\n buffer = \"\"\n object.rewind\n while object.read(in_blocks_of, buffer) do\n dstio.write(buffer)\n end\n dstio.rewind\n dstio\n end", "def write_file(newfile, instream)\n File.open(newfile, \"w\") do |f|\n f.write(instream.read)\n end\nend", "def filestring(file, size = 8192)\n return unless file\n return file unless file.is_a?(String) && File.file?(file) && File.size(file) <= size\n File.read(file)\n end", "def convertStreamToFile(in_stream, file_path)\n if (!(!file_path.nil? && !file_path.empty?))\n raise Error.new(Pdfcrowd.create_invalid_value_message(file_path, \"convertStreamToFile::file_path\", \"html-to-pdf\", \"The string must not be empty.\", \"convert_stream_to_file\"), 470);\n end\n \n output_file = open(file_path, \"wb\")\n begin\n convertStreamToStream(in_stream, output_file)\n output_file.close()\n rescue Error => why\n output_file.close()\n FileUtils.rm(file_path)\n raise\n end\n end", "def utf8write(str,f)\n File.open(f,\"wb:utf-8\"){|ff|\n ff.write(str)\n }\nend", "def coerce_file(value, options = {})\n if value.kind_of?(Hash) && !value[:filename].to_s.empty?\n tempfile = value[:tempfile]\n if tempfile.kind_of?(File) || tempfile.kind_of?(Tempfile)\n value\n end\n end\n end", "def convertStreamToFile(in_stream, file_path)\n if (!(!file_path.nil? && !file_path.empty?))\n raise Error.new(Pdfcrowd.create_invalid_value_message(file_path, \"convertStreamToFile::file_path\", \"html-to-image\", \"The string must not be empty.\", \"convert_stream_to_file\"), 470);\n end\n \n output_file = open(file_path, \"wb\")\n begin\n convertStreamToStream(in_stream, output_file)\n output_file.close()\n rescue Error => why\n output_file.close()\n FileUtils.rm(file_path)\n raise\n end\n end", "def to_file\n replace_with_tempfile unless @tempfile_in\n flush\n self\n end", "def convertFileToFile(file, file_path)\n if (!(!file_path.nil? && !file_path.empty?))\n raise Error.new(Pdfcrowd.create_invalid_value_message(file_path, \"convertFileToFile::file_path\", \"pdf-to-html\", \"The string must not be empty.\", \"convert_file_to_file\"), 470);\n end\n \n if (!(isOutputTypeValid(file_path)))\n raise Error.new(Pdfcrowd.create_invalid_value_message(file_path, \"convertFileToFile::file_path\", \"pdf-to-html\", \"The converter generates an HTML or ZIP file. If ZIP file is generated, the file path must have a ZIP or zip extension.\", \"convert_file_to_file\"), 470);\n end\n \n output_file = open(file_path, \"wb\")\n begin\n convertFileToStream(file, output_file)\n output_file.close()\n rescue Error => why\n output_file.close()\n FileUtils.rm(file_path)\n raise\n end\n end", "def convert_to_file(params_array)\n file_data = split_base64(params_array[:data])\n\n filename = \"/tmp/#{params_array[:filename]}\"\n\n File.open(filename, \"w\") do |tempfile|\n tempfile.binmode\n tempfile << Base64.decode64(file_data[:data])\n tempfile.rewind\n end\n\n File.open(filename)\n end", "def mock_io(string)\n# lambda do\n Tempfile.open('bio-og_test') do |tempfile|\n tempfile.puts string\n tempfile.close\n yield File.open(tempfile.path)\n# end\n end\n end", "def json_to_file(object, file_path_and_name)\n open(\"#{file_path_and_name}.json\", \"wb\") do |file| \n file.write(object.to_json)\n true\n end\n end", "def coerce_file(value, _options = {})\n return unless value.is_a?(Hash) && !value[:filename].to_s.empty?\n\n tempfile = value[:tempfile]\n return unless tempfile.is_a?(File) || tempfile.is_a?(Tempfile)\n\n value\n end", "def upload_string_as_file_to_guest(string, guest_path, quiet=false)\n tmp = Tempfile.new('txtfile')\n tmp.write \"#{string}\\n\"\n path = tmp.path\n tmp.rewind\n tmp.close\n\n upload_file_to_guest(path, guest_path, true)\n FileUtils.rm path\n end", "def write(str)\n return if noop?\n FileUtils.mkdir_p(File.dirname(file)) #unless File.file?(file)\n File.open(file, 'w'){ |f| f << str }\n end", "def temp_file(text)\n file = Tempfile.new(\"ari\")\n file << text\n file.close\n file.path\nend", "def make_file filepath, content, options={}\n\n temp_filepath =\n \"#{TMP_DIR}/#{File.basename(filepath)}_#{Time.now.to_i}#{rand(10000)}\"\n\n File.open(temp_filepath, \"w+\"){|f| f.write(content)}\n\n self.upload temp_filepath, filepath, options\n\n File.delete(temp_filepath)\n end", "def write_content_to_file(file_name, content)\n File.open(file_name, 'w') { |file| file.write(content); file.flush }\nend", "def convertStreamToFile(in_stream, file_path)\n if (!(!file_path.nil? && !file_path.empty?))\n raise Error.new(Pdfcrowd.create_invalid_value_message(file_path, \"convertStreamToFile::file_path\", \"image-to-pdf\", \"The string must not be empty.\", \"convert_stream_to_file\"), 470);\n end\n \n output_file = open(file_path, \"wb\")\n begin\n convertStreamToStream(in_stream, output_file)\n output_file.close()\n rescue Error => why\n output_file.close()\n FileUtils.rm(file_path)\n raise\n end\n end", "def uploaded_file=(file_field)\n self.filename = base_part_of(file_field.original_filename)\n\n f_str = Iconv.conv('utf-8', self.encoding, file_field.read)\n\n f = StringIO.new(f_str)\n\n if self.format == 'OBT'\n it = OBNOTextIterator.new(f, self.sentence_delimiter == 'delimiter')\n elsif self.format == 'VRT'\n it = VRTReader.new(f)\n else\n raise RuntimeError\n end\n\n it.each_sentence {|s| sentences << s}\n f.close()\n\n # add postamble stored in iterator after parsing last sentence\n # TODO add support for arbitrary data for OBT format\n if self.format = 'VRT'\n self.postamble = it.postamble\n end\n end", "def replace_string_in_file(filename, regex, replacement = '')\n content = File.read(filename).gsub(/#{regex}$/i, replacement)\n File.open(filename, 'wb') { |file| file.write(content) }\n end", "def to_file(file)\n return Fileset.new if file.nil?\n return Fileset.new(file.map { |f| to_file(f) }) if file.is_a? Array\n return Filepath.new(@workdir.join(file.to_s)) if @workdir\n Filepath.new(file.to_s)\n end", "def save_as(file)\n File.open(file, \"wb\") { |f| f.write to_s }\n end", "def save_as(file)\n File.open(file, \"wb\") { |f| f.write to_s }\n end", "def file(data, path)\n File.open(path, 'w') { |f| f << data }\n end", "def convertFileToFile(file, file_path)\n if (!(!file_path.nil? && !file_path.empty?))\n raise Error.new(Pdfcrowd.create_invalid_value_message(file_path, \"convertFileToFile::file_path\", \"html-to-pdf\", \"The string must not be empty.\", \"convert_file_to_file\"), 470);\n end\n \n output_file = open(file_path, \"wb\")\n begin\n convertFileToStream(file, output_file)\n output_file.close()\n rescue Error => why\n output_file.close()\n FileUtils.rm(file_path)\n raise\n end\n end", "def convertUrlToFile(url, file_path)\n if (!(!file_path.nil? && !file_path.empty?))\n raise Error.new(Pdfcrowd.create_invalid_value_message(file_path, \"convertUrlToFile::file_path\", \"html-to-pdf\", \"The string must not be empty.\", \"convert_url_to_file\"), 470);\n end\n \n output_file = open(file_path, \"wb\")\n begin\n convertUrlToStream(url, output_file)\n output_file.close()\n rescue Error => why\n output_file.close()\n FileUtils.rm(file_path)\n raise\n end\n end", "def open_file(io)\n io.kind_of?(File) ? io : File.open(io)\n end", "def suck_file\n if FileTest.file?(to_s)\n out = \"\"\n File.open(to_s, \"r\") do |file|\n file.each { |line| out << line << \"\\n\" }\n end\n\n out\n else\n nil\n end\n end", "def makeFile filename, message\n making = File.open(filename, \"w\")\n making.puts(message)\n making.close\nend", "def to_s\n file_content.sub( search, eval(replace) )\n end", "def path_to_file(path)\n File.new(self.absolute_path(path))\n end", "def create_file_with_content(file_path: '/tmp/temp_file.ext', content: '')\n File.open(file_path, 'w') { |f| f.write(content) }\n LoggerHelper.print_to_log(\"Created file: #{file_path} with content: #{content}\")\n file_path\n end", "def convertStreamToFile(in_stream, file_path)\n if (!(!file_path.nil? && !file_path.empty?))\n raise Error.new(Pdfcrowd.create_invalid_value_message(file_path, \"convertStreamToFile::file_path\", \"image-to-image\", \"The string must not be empty.\", \"convert_stream_to_file\"), 470);\n end\n \n output_file = open(file_path, \"wb\")\n begin\n convertStreamToStream(in_stream, output_file)\n output_file.close()\n rescue Error => why\n output_file.close()\n FileUtils.rm(file_path)\n raise\n end\n end", "def write(io)\n# tempfile = \"#{file_path}.#{Process.pid}.#{object_id}\"\n# open(tempfile, \"wb\") do |file|\n# while part = io.read(8192)\n# file << part\n# end\n# end\n# File.rename(tempfile, file_path)\n# ensure\n# File.unlink(tempfile) rescue nil\n\n # 同名のファイルができないように\n bson = @collection.find_one({:filename => file_path}) rescue nil\n\n @filesystem.open(file_path, \"w\", :content_type => _content_type(file_path)) { |f| f.write(io) }\n\n # 同名のファイルができないように\n @collection.remove(bson) if bson\n\n end", "def data=(string)\n File.open(@full_path, \"w+\") {|f| f << string }\n end", "def replace_with_file(blob, attributes = {})\n File.binwrite(self.file_path, blob)\n\n pdf = CombinePDF.parse blob\n self.update(num_pages: pdf.pages.length, filename: attributes[:new_filename])\n self.save_cover\n end", "def convertFileToFile(file, file_path)\n if (!(!file_path.nil? && !file_path.empty?))\n raise Error.new(Pdfcrowd.create_invalid_value_message(file_path, \"convertFileToFile::file_path\", \"html-to-image\", \"The string must not be empty.\", \"convert_file_to_file\"), 470);\n end\n \n output_file = open(file_path, \"wb\")\n begin\n convertFileToStream(file, output_file)\n output_file.close()\n rescue Error => why\n output_file.close()\n FileUtils.rm(file_path)\n raise\n end\n end", "def store_file\n # TODO\n # - kick BOM if present\n # - convert to UTF-8 if a different encoding is given\n # - we should check double encoding because the tempfile is always read as utf8\n\n # writes the file binary/raw without taking encodings into account.\n # If we want to convert incoming files this should be done before\n File.open(full_filename, 'wb') do |f| #w:UTF-8\n f.write @uploaded_file.read\n end\n end", "def write(output_to)\n case output_to\n when String, Pathname\n if layer?\n MiniMagick::Tool::Convert.new do |builder|\n builder << path\n builder << output_to\n end\n else\n FileUtils.copy_file path, output_to unless path == output_to.to_s\n end\n else\n IO.copy_stream File.open(path, \"rb\"), output_to\n end\n end", "def save_file_to_disk(new_content, filepath) \n File.open(filepath, 'w') { |f| f.write(new_content)}\n end", "def write(s)\n @file.write(s)\n end", "def convertUrlToFile(url, file_path)\n if (!(!file_path.nil? && !file_path.empty?))\n raise Error.new(Pdfcrowd.create_invalid_value_message(file_path, \"convertUrlToFile::file_path\", \"image-to-pdf\", \"The string must not be empty.\", \"convert_url_to_file\"), 470);\n end\n \n output_file = open(file_path, \"wb\")\n begin\n convertUrlToStream(url, output_file)\n output_file.close()\n rescue Error => why\n output_file.close()\n FileUtils.rm(file_path)\n raise\n end\n end", "def add(file_or_filename)\n if file_or_filename.respond_to?(:to_io)\n add_file file_or_filename.to_io\n elsif file_or_filename.respond_to?(:to_str)\n add_filename file_or_filename\n end\n end", "def convertToFile(file_path)\n if (!(!file_path.nil? && !file_path.empty?))\n raise Error.new(Pdfcrowd.create_invalid_value_message(file_path, \"convertToFile\", \"pdf-to-pdf\", \"The string must not be empty.\", \"convert_to_file\"), 470);\n end\n \n output_file = open(file_path, \"wb\")\n convertToStream(output_file)\n output_file.close()\n end", "def encoded_to_file(encoded_file, file_name = nil)\n extension = file_name ? \".#{file_name.match(/[^\\.]+$/)}\" : ''\n temp_file = Tempfile.new([SecureRandom.hex(3), extension])\n temp_file.binmode\n temp_file.write(Base64.decode64(encoded_file))\n temp_file.close\n temp_file\n end", "def file_open(*args, &block)\n if __transport_connection\n content = __transport_connection.file(args[0]).content\n string_io = StringIO.new content\n yield string_io if block_given?\n string_io\n else\n File.open(*args, &block)\n end\n end", "def force_to_file\n if @data && ! (@file && File.exist?(@file.to_s))\n fh = Tempfile.new([ \"conconv_force_to_file\", @suffix.to_s ])\n @force_to_file = @file = Pathname.new(fh.path)\n fh.write @data\n fh.close\n $stderr.puts \" force_to_file wrote #{@data.size} => #{fh.path.inspect}\" if @verbose\n end\n @file\n end", "def generate(file, substring, destination)\n match = \"<#ROOT_PATH#>\"\n s = get_file_as_string(file)\n s.gsub!(match, substring)\n put_file_from_string(destination, s)\nend", "def convertRawDataToFile(data, file_path)\n if (!(!file_path.nil? && !file_path.empty?))\n raise Error.new(Pdfcrowd.create_invalid_value_message(file_path, \"convertRawDataToFile::file_path\", \"pdf-to-text\", \"The string must not be empty.\", \"convert_raw_data_to_file\"), 470);\n end\n \n output_file = open(file_path, \"wb\")\n begin\n convertRawDataToStream(data, output_file)\n output_file.close()\n rescue Error => why\n output_file.close()\n FileUtils.rm(file_path)\n raise\n end\n end", "def fback (fname)\n fcont = File.read(fname)\n File.new(fcont)\n end", "def to_str\n @filename\n end", "def write_to_file(text)\n open(file_path, 'w') do |f|\n f.write(text)\n end\n file_update\n rescue Errno::ENOENT\n raise InvalidCache\n end", "def file\n FileFactory.new(self)\n end", "def encrypt_file(filename)\n #open the file by passing it the name and ..\n input = File.open(filename, 'r')\n #this is a string now so\n contents = input.read\n encrypted_contents = encrypt_string(contents)\n input.close\n output = File.open(filename + '.encrypted', 'w')\n output.write(encrypted_contents)\n output.close\n\n end", "def save_pdf_file(pdf_content)\n File.open('data/test-generated/pdf/test.pdf', 'wb') { |file| file.puts(pdf_content) }\nend", "def convertFileToFile(file, file_path)\n if (!(!file_path.nil? && !file_path.empty?))\n raise Error.new(Pdfcrowd.create_invalid_value_message(file_path, \"convertFileToFile::file_path\", \"image-to-pdf\", \"The string must not be empty.\", \"convert_file_to_file\"), 470);\n end\n \n output_file = open(file_path, \"wb\")\n begin\n convertFileToStream(file, output_file)\n output_file.close()\n rescue Error => why\n output_file.close()\n FileUtils.rm(file_path)\n raise\n end\n end", "def convertUrlToFile(url, file_path)\n if (!(!file_path.nil? && !file_path.empty?))\n raise Error.new(Pdfcrowd.create_invalid_value_message(file_path, \"convertUrlToFile::file_path\", \"html-to-image\", \"The string must not be empty.\", \"convert_url_to_file\"), 470);\n end\n \n output_file = open(file_path, \"wb\")\n begin\n convertUrlToStream(url, output_file)\n output_file.close()\n rescue Error => why\n output_file.close()\n FileUtils.rm(file_path)\n raise\n end\n end", "def tempfile(string)\n file = Tempfile.new([name, '.html'])\n begin\n file.write(string)\n ensure\n file.close\n end\n yield(file).tap { file.unlink }\n end", "def file=(_); end", "def initialize_from_stringio(stringio)\n raise(ArgumentError, 'Missing `original_filename` for StringIO object') unless @original_filename\n\n @tempfile = stringio\n end" ]
[ "0.751318", "0.7244803", "0.7091236", "0.70541245", "0.69614416", "0.6875502", "0.6748058", "0.60938233", "0.6085724", "0.6036612", "0.6030456", "0.60107046", "0.59898883", "0.5981235", "0.5981235", "0.5934211", "0.59325916", "0.5922589", "0.5892549", "0.58885515", "0.58849186", "0.5877989", "0.5858903", "0.58214706", "0.58161813", "0.5801212", "0.57921284", "0.57877487", "0.5786396", "0.5763392", "0.57492536", "0.5746902", "0.5744492", "0.5729926", "0.5716326", "0.5716326", "0.57158446", "0.5678534", "0.5676317", "0.56748945", "0.5659548", "0.56487805", "0.5646246", "0.5643841", "0.5641114", "0.5639114", "0.56346405", "0.56311995", "0.5621866", "0.56124383", "0.5609018", "0.56055135", "0.5600948", "0.56000465", "0.559287", "0.5567226", "0.55514896", "0.55305773", "0.55287975", "0.5527754", "0.5525162", "0.5514033", "0.5511488", "0.5511488", "0.55066144", "0.5499631", "0.54987967", "0.5498717", "0.54938316", "0.54934675", "0.54931194", "0.5486356", "0.54863214", "0.5483537", "0.54828006", "0.5479292", "0.54765934", "0.54760396", "0.54678166", "0.54466856", "0.5444552", "0.54428947", "0.5441207", "0.5430438", "0.5430164", "0.5418824", "0.5418761", "0.54181", "0.5417803", "0.5417343", "0.5411978", "0.5406714", "0.53994834", "0.5395657", "0.5381799", "0.5380898", "0.53755623", "0.53709644", "0.5356747", "0.5355492", "0.53481674" ]
0.0
-1
Summary: Uploads the given file to the bucket, then gives up permissions to the bucket owner Details : intended to allow files to be uploaded to S3, but not allowing the files to be interfered with should the web server get hacked. In truth, S3 permissions aren't adequate and the best we can do is that the file can't be read, but can be written over. The user also can't get a listing of the bucket S3 won't allow objects (or buckets) to change owner, but we do everything else ie give FULL_CONTROL, and remove it from self, to hand control to the bucket owner This requires the bucket to give WRITE & READ_ACP permissions to this user
def upload_backup(aFileName,aBucketName,aObjectName = nil) aObjectName ||= File.basename(aFileName) AWS::S3::S3Object.store(aObjectName, open(aFileName), aBucketName) bucket_owner = AWS::S3::Bucket.acl(aBucketName).owner policy = AWS::S3::S3Object.acl(aObjectName,aBucketName) policy.grants.clear policy = policy_add(policy,{'id' => bucket_owner.id, 'display_name' => bucket_owner.display_name},'FULL_CONTROL') # replace policy with full control to bucket owner, none to test_user AWS::S3::S3Object.acl(aObjectName,aBucketName,policy) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upload(bucket, file); end", "def bucket_acl_set_for_owner_id?(\r\n s3_client,\r\n bucket_name,\r\n permission,\r\n owner_id\r\n)\r\n s3_client.put_bucket_acl(\r\n access_control_policy: {\r\n grants: [\r\n {\r\n grantee: {\r\n id: owner_id,\r\n type: 'CanonicalUser'\r\n },\r\n permission: permission\r\n }\r\n ],\r\n owner: {\r\n id: owner_id\r\n }\r\n },\r\n bucket: bucket_name\r\n body: \"c:\\\\my-file.txt\",\r\n )\r\n return true\r\nrescue StandardError => e\r\n puts \"Error setting bucket ACL: #{e.message}\"\r\n return false\r\nend", "def upload_file(bucket_name:, key:, file:, **opts)\n if opts[:acl] && opts[:acl]&.to_s == 'public-read'\n opts[:acl] = :public_read\n end\n\n result = get_bucket!(bucket_name).create_file file.path, key, **opts\n return {\n checksum: result.crc32c\n }\n end", "def uploadS3(name, file, prefz)\n return [false, \"S3 misconfigured\"] if prefz[:user].empty? && prefz[:host].empty? && prefz[:path].empty? && prefz[:url].empty? && prefz[:pass].empty?\n s3 = AFAmazonS3Client.alloc.initWithAccessKeyID(prefz[:user].strip, secret: prefz[:pass].strip)\n puts \"#{prefz[:user].strip.inspect} #{prefz[:pass].strip.inspect}\"\n bucket, path = prefz[:path].gsub(/^\\//, '').split('/', 2)\n s3.bucket = bucket\n NSLog(\"S3 bucket #{bucket}\")\n url = path.nil? ? \"https://#{prefz[:host]}/#{bucket}/\" : \"https://#{prefz[:host]}/#{bucket}/#{path}/#{name}\"\n NSLog(\"S3 destinationPath #{url}\")\n params = { \"Content-Type\" => \"image/png\", \"acl\" => \"public-read\" }\n s3.postObjectWithFile(file, destinationPath: \"/\", parameters: params,\n progress: lambda do |bytesWritten, totalBytesWritten, totalBytesExpectedToWrite|\n stats = (totalBytesWritten / (totalBytesExpectedToWrite * 1.0) * 100)\n NSLog(\"S3: #{file} uploaded #{stats}\")\n end,\n success: lambda do |response|\n NSLog(\"S3: #{file} uploaded successfully.\")\n uploadSuccess(url + \"/#{name}\")\n end,\n failure: lambda do |error|\n NSLog(\"S3: #{file} upload error: #{error.localizedDescription}\")\n uploadFailure(\"S3 Error: #{error.localizedDescription}\")\n end\n )\n nil\n end", "def upload_file(bucket, key, data)\n bucket.put(key, data)\nend", "def upload_file(file)\n key_name = @prefix.dup\n key_name << File.basename(file)\n @right_s3_interface.put(@bucket, key_name , File.read(file) ) \n end", "def run_me\r\n bucket_name = 'doc-example-bucket'\r\n object_key = 'my-file.txt'\r\n object_content = 'This is the content of my-file.txt.'\r\n access_level_before = 'private'\r\n access_level_after = 'public-read'\r\n region = 'us-west-2'\r\n s3_client = Aws::S3::Client.new(region: region)\r\n\r\n # Set the initial access level of the bucket to 'private'\r\n # for public access.\r\n if bucket_acl_set?(s3_client, bucket_name, access_level_before)\r\n puts \"1. Initial bucket ACL set to '#{access_level_before}' \" \\\r\n \"for public access.\\n\\n\"\r\n else\r\n puts \"1. Initial bucket ACL not set to '#{access_level_before}' \" \\\r\n 'for public access. Stopping program.'\r\n exit 1\r\n end\r\n\r\n # What happens when you try to access the bucket? (It should be denied.)\r\n puts \"2. After initial bucket ACL set to '#{access_level_before}' \" \\\r\n \"for public access, trying to access the bucket:\\n\\n\"\r\n object_content_by_bucket_unsigned_request(bucket_name, region)\r\n\r\n # Upload an object to the bucket.\r\n if object_uploaded?(s3_client, bucket_name, object_key, object_content)\r\n puts \"3. Object uploaded to bucket.\\n\\n\"\r\n else\r\n puts '3. Object not uploaded to bucket. Stopping program. ' \\\r\n \"Note that the bucket ACL is still set to '#{access_level_before}' \" \\\r\n 'for public access.'\r\n exit 1\r\n end\r\n\r\n # What happens when you try to access the object now?\r\n # (It should still be denied.)\r\n puts \"4. After object uploaded, trying to access the object:\\n\\n\"\r\n object_content_by_object_unsigned_request(bucket_name, object_key, region)\r\n\r\n # Now set the initial access level of the object to 'public-read'\r\n # for public access.\r\n if object_acl_set?(s3_client, bucket_name, object_key, access_level_after)\r\n puts \"5. Object ACL set to '#{access_level_after}' for public access.\\n\\n\"\r\n else\r\n puts \"5. Object ACL not set to '#{access_level_after}' for public \" \\\r\n 'access. Stopping program. ' \\\r\n \"Note that the bucket ACL is still set to '#{access_level_before}' \" \\\r\n 'for public access.'\r\n exit 1\r\n end\r\n\r\n # What happens when you try to access the object now? (It should now work.)\r\n puts \"6. After object ACL set to '#{access_level_after}' for public \" \\\r\n \"access, trying to access the object:\\n\\n\"\r\n object_content_by_object_unsigned_request(bucket_name, object_key, region)\r\n\r\n # Now set the access level for the object to 'private' for public access.\r\n if object_acl_set?(s3_client, bucket_name, object_key, access_level_before)\r\n puts \"7. Object ACL now set to '#{access_level_before}' \" \\\r\n \"for public access.\\n\\n\"\r\n else\r\n puts \"7. Object ACL not set to '#{access_level_before}' \" \\\r\n 'for public access. Stopping program. ' \\\r\n \"Note that the bucket ACL is still set to '#{access_level_before}'.\"\r\n exit 1\r\n end\r\n\r\n # What happens when you try to access the object now?\r\n # (It should now be denied.)\r\n puts \"8. After object ACL set to '#{access_level_before}' \" \\\r\n \"for public access, trying to access the object:\\n\\n\"\r\n object_content_by_object_unsigned_request(bucket_name, object_key, region)\r\n\r\n puts '9. Program ends. Note that the bucket ACL is still set to ' \\\r\n \"'#{access_level_before}' for public access.\"\r\nend", "def file_public_write\n if $item_public_write.variable() == 1\n $s3.client.put_object_acl(acl: ' public-read-write',\n bucket: $bucket,\n key: $bucket_item)\n else\n $s3.client.put_object_acl(acl: 'private',\n bucket: $bucket,\n key: $bucket_item)\n end\n end", "def upload_file\n upload_thumb if Rails.configuration.thumbnails_enabled\n file_s3_obj.write(@file.tempfile.open, content_type: @file.content_type)\n end", "def upload_file(f)\n # grabs the compiled asset from public_path\n full_file_path = File.join(File.dirname(@manifest.dir), f)\n one_year = 31557600\n mime = Rack::Mime.mime_type(File.extname(f)) \n file = {\n :key => f,\n :public => true,\n :content_type => mime,\n :cache_control => \"public, max-age=#{one_year}\",\n :expires => CGI.rfc1123_date(Time.now + one_year) \n }\n\n gzipped = \"#{full_file_path}.gz\" \n\n if File.exists?(gzipped)\n original_size = File.size(full_file_path)\n gzipped_size = File.size(gzipped)\n\n if gzipped_size < original_size\n file.merge!({\n :body => File.open(gzipped),\n :content_encoding => 'gzip'\n })\n log \"Uploading #{gzipped} in place of #{f}\"\n else\n file.merge!({\n :body => File.open(full_file_path)\n })\n log \"Gzip exists but has larger file size, uploading #{f}\"\n end\n else\n file.merge!({\n :body => File.open(full_file_path)\n })\n log \"Uploading #{f}\"\n end\n # put in reduced redundancy option here later if desired\n\n file = bucket.files.create( file )\n end", "def upload(file_path)\n file_name = File.basename(file_path)\n object = @bucket.objects[file_name]\n object.write(:file => file_path)\n object.public_url\n end", "def s3_upload_policy_document(s3_bucket)\r\n\r\n if s3_bucket == \"ted_kennedy_image\" || s3_bucket == \"production_images_1\" #for forms uploading images\r\n\r\n logger.info \"in image bucket, bucketis= \"+s3_bucket.to_s\r\n\r\n\t\t\tBase64.encode64(\r\n\t\t\t\t\t\t {\r\n\t\t\t\t\t\t\texpiration: 30.minutes.from_now.utc.strftime('%Y-%m-%dT%H:%M:%S.000Z'),\r\n\t\t\t\t\t\t\tconditions: [\r\n\t\t\t\t\t\t\t\t\t{ bucket: s3_bucket },\r\n\t\t\t\t\t\t\t\t\t{ acl: 'public-read' },\r\n\t\t\t\t\t\t\t\t\t[\"starts-with\", \"$key\", \"\"],\r\n\t\t\t\t\t\t\t\t\t[\"starts-with\", \"$Content-Type\", \"image\"],\r\n\t\t\t\t\t\t\t\t\t[\"content-length-range\", 0, 1048576],\r\n\t\t\t\t\t\t\t\t\t[\"starts-with\", \"$x-amz-meta-my-file-name\", \"\"],\r\n\t\t\t\t\t\t\t\t\t{ success_action_status: '201' }\r\n\t\t\t\t\t\t\t]\r\n\t\t\t\t\t}.to_json\r\n\t\t\t).gsub(/\\n|\\r/, '')\r\n\r\n\t\telse #for forms loading attachments\r\n\t\t\tBase64.encode64(\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t\texpiration: 30.minutes.from_now.utc.strftime('%Y-%m-%dT%H:%M:%S.000Z'),\r\n\t\t\t\t\t\t\tconditions: [\r\n\t\t\t\t\t\t\t\t\t{ bucket: s3_bucket },\r\n\t\t\t\t\t\t\t\t\t{ acl: 'public-read' },\r\n\t\t\t\t\t\t\t\t\t[\"starts-with\", \"$key\", \"\"],\r\n\t\t\t\t\t\t\t\t\t[\"starts-with\", \"$Content-Disposition\", \"\"],\r\n\t\t\t\t\t\t\t\t\t[\"content-length-range\", 0, 104857600],\r\n\t\t\t\t\t\t\t\t\t[\"starts-with\", \"$x-amz-meta-my-file-name\", \"\"],\r\n [\"starts-with\", \"$Content-Type\", \"\"],\r\n\t\t\t\t\t\t\t\t\t{ success_action_status: '201' }\r\n\t\t\t\t\t\t\t]\r\n\t\t\t\t\t}.to_json\r\n\t\t\t).gsub(/\\n|\\r/, '')\r\n\r\n\t end\r\n\r\n\tend", "def s3_upload( file_name, destination_name )\n #log(\"Uploading #{file_name} to S3 as #{destination_name} ...\")\n #load keys\n json = File.read(S3KEYS)\n ak = JSON.parse(json)\n aws_access_key_id = ak['aws_access_key_id'] \n aws_secret_access_key = ak['aws_secret_access_key']\n\n #establish S3 connection \n s3 = RightAws::S3.new(aws_access_key_id, aws_secret_access_key, {:logger =>Logger.new( File.open( LOG_FILE, 'a' ) )})\n bucket = s3.bucket(IOS_BUILDS_BUCKET)\n #upload file \n file = File.open( file_name )\n bucket.put( destination_name, file ) \nend", "def putAsset(filePath, metadata)\n\n # Calculate the sha256 hash, and use it to form the s3 path\n sha256Sum = Digest::SHA256.file(filePath).hexdigest\n s3Path = \"#{getEnv(\"S3_BINARIES_PREFIX\")}/#{sha256Sum[0,2]}/#{sha256Sum[2,2]}/#{sha256Sum}\"\n\n # If the S3 file is already present, don't re-upload it.\n obj = $s3Bucket.object(s3Path)\n if !obj.exists? || $forceMode\n #puts \"Uploading #{filePath} to S3.\"\n obj.put(body: File.new(filePath),\n metadata: metadata.merge({\n original_path: filePath.sub(%r{.*/([^/]+/[^/]+)$}, '\\1'), # retain only last directory plus filename\n mime_type: MimeMagic.by_magic(File.open(filePath)).to_s\n }))\n end\n\n return sha256Sum\nend", "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 upload_file(s3client,plaintext_key,filename,bucket)\r\n begin\r\n filebody = File.new(filename)\r\n s3enc = Aws::S3::Encryption::Client.new(encryption_key: plaintext_key,\r\n client: s3client)\r\n res = s3enc.put_object(bucket: bucket,\r\n key: filename,\r\n body: filebody)\r\n rescue Aws::S3::Errors::ServiceError => e\r\n puts \"upload failed: #{e}\"\r\n end\r\nend", "def upload_to_s3(info, file_name)\n bucket_name = 'techops-tests'\n\n to_json_file(info, file_name)\n\n s3 = Aws::S3::Resource.new(\n region: 'ap-southeast-2',\n access_key_id: $options[:s3_key],\n secret_access_key: $options[:s3_secret]\n )\n\n file = File.basename file_name\n obj = s3.bucket(bucket_name).object(file)\n\n if obj.upload_file(file)\n puts \"Uploaded #{file} to bucket #{bucket_name}\"\n File.delete(file_name)\n else\n puts \"Could not upload #{file} to bucket #{bucket_name}!\"\n end\nend", "def upload_file(bucket_key,file_location,file_name,access_token)\n file_uploaded = File.new(file_location, 'rb')\n response = RestClient.put(\"#{API_URL}/oss/v2/buckets/#{bucket_key}/objects/#{file_name}\",\n file_uploaded,\n { Authorization: \"Bearer #{access_token}\", content_type:'application/octet-stream'})\n return response\nend", "def bucket_public_write\n if $bucket_public_write.variable() == 1\n $s3.client.put_bucket_acl(acl: 'public-read-write',bucket: $bucket)\n else\n $s3.client.put_bucket_acl(acl: 'private',bucket: $bucket)\n end\n end", "def write(path, file)\n bucket.objects[path].write(:file => file, :acl => :public_read)\n end", "def upload!(acl)\n file_number = 0\n\n total_files = @files.length\n\n @files.each do |file|\n file_number += 1\n\n print \"\\rUploading... [#{file_number}/#{total_files}]\"\n\n next if File.directory? file\n\n # Get the path relative to containing directory\n path = file.gsub(/^#{@folder_path}\\//, '')\n\n options = { :acl => acl }\n\n if MIME::Types.type_for(file).count > 0\n options[:content_type] = MIME::Types.type_for(file).first.to_str\n end\n\n @s3_bucket.object(path).upload_file(file, options)\n end\n\n puts \"\\rUpload complete!\".ljust 80\n end", "def upload\n\t AWS.config(access_key_id: @access_key, secret_access_key: @access_secret)\n\t s3 = AWS::S3.new \n\t key = File.basename(@zipfile_name)\n\t s3.buckets[@bucket_name].objects[key].write(:file => @zipfile_name)\n\t puts \"Uploading file #{@zipfile_name} to bucket #{@bucket_name}.\"\n\t FileUtils.rm_rf @zipfile_name\n\t end", "def putAsset(filePath, metadata)\n\n # Calculate the sha256 hash, and use it to form the s3 path\n md5sum = Digest::MD5.file(filePath).hexdigest\n sha256Sum = Digest::SHA256.file(filePath).hexdigest\n s3Path = \"#{$s3Config.prefix}/binaries/#{sha256Sum[0,2]}/#{sha256Sum[2,2]}/#{sha256Sum}\"\n\n # If the S3 file is already correct, don't re-upload it.\n obj = $s3Bucket.object(s3Path)\n if !obj.exists? || obj.etag != \"\\\"#{md5sum}\\\"\"\n #puts \"Uploading #{filePath} to S3.\"\n obj.put(body: File.new(filePath),\n metadata: metadata.merge({\n original_path: filePath.sub(%r{.*/([^/]+/[^/]+)$}, '\\1'), # retain only last directory plus filename\n mime_type: MimeMagic.by_magic(File.open(filePath)).to_s\n }))\n obj.etag == \"\\\"#{md5sum}\\\"\" or raise(\"S3 returned md5 #{resp.etag.inspect} but we expected #{md5sum.inspect}\")\n end\n\n return sha256Sum\nend", "def upload(file)\n # Upload the given file\n AWS::S3::S3Object.store( file,\n open( file ),\n BUCKET,\n :access => :public_read )\n\n # display the URL of the file just uploaded\n puts AWS::S3::S3Object.url_for((file), BUCKET)[/[^?]+/]\nend", "def save_file_to_s3_bucket(bucket, file)\n\n image_path = \"./public/tmp/#{file}\"\n connect_to_s3()\n s3 = Aws::S3::Resource.new(region: ENV['AWS_REGION'])\n obj = s3.bucket(bucket).object(file)\n\n if obj.exists?\n cleanup_tmp_file(file)\n puts \"File #{file} already exists in the bucket.\"\n url = generate_url(bucket, file)\n else\n obj.upload_file(image_path)\n cleanup_tmp_file(file)\n puts \"Uploaded file (#{file}) to bucket (#{bucket}).\"\n url = generate_url(bucket, file)\n end\n\nend", "def s3_updatefile(filename, filedata)\n s3_deletefile filename\n #AWS::S3::S3Object.store filename, filedata, QBUCKET.to_s, :access => :public_read\n AWS::S3::S3Object.store filename, filedata, IMAGES_BUCKET.to_s, :access => :public_read\n end", "def upload_file(bucket_key, file_location, file_name, access_token)\n file_uploaded = File.new(file_location, 'rb')\n response = RestClient.put(\"#{API_URL}/oss/v2/buckets/#{bucket_key}/objects/#{file_name}\",\n file_uploaded,\n { Authorization: \"Bearer #{access_token}\", content_type:'application/octet-stream'})\n return response\n end", "def tag_and_upload(file, date = Date.current, s3_resource, bucketname,\n storage_class: DEFAULT_STORAGE_CLASS)\n date_tags = Backup.aws_date_tags(date)\n prefix = Backup.s3_backup_bucket_full_prefix(date)\n obj = s3_resource.bucket(bucketname).object(prefix + File.basename(file))\n obj.upload_file(file.path, { tagging: date_tags, storage_class: storage_class })\n end", "def bucket_policy_added?(s3_client, bucket_name, aws_principal, action)\r\n bucket_policy = {\r\n 'Version' => '2012-10-17',\r\n 'Statement' => [\r\n {\r\n 'Effect' => 'Allow',\r\n 'Principal' => {\r\n 'AWS' => aws_principal\r\n },\r\n 'Action' => action,\r\n 'Resource' => \"arn:aws:s3:::#{bucket_name}/*\"\r\n }\r\n ]\r\n }.to_json\r\n s3_client.put_bucket_policy(\r\n bucket: bucket_name,\r\n policy: bucket_policy\r\n )\r\n return true\r\nrescue StandardError => e\r\n puts \"Error adding bucket policy: #{e.message}\"\r\n return false\r\nend", "def upload local_file_path, storage_file_path, encryption_key: nil\n unless @bucket.file storage_file_path\n @bucket.create_file local_file_path, storage_file_path,\n encryption_key: encryption_key\n end\n end", "def upload_job_script(file_path, bucket_resource)\n File.open(file_path) do |file|\n bucket_resource.client.put_object({\n body: file,\n bucket: bucket_resource.name,\n key: file_path\n })\n end\n rescue Aws::S3::Errors::S3UploadFailedError => e\n @logger.error(\"S3 could not upload job script: \\n#{e.message}\")\n raise\n end", "def perform_multipart_upload\n s3o = S3Object.find_by(uri: @params[:s3_object_uri]) || S3Object.new\n s3o.uri = @params[:s3_object_uri]\n s3o.file = @params[:file]\n s3o.bucket = handle_bucket\n s3o.key = @params[:key]\n s3o.content_type = @params[:file].content_type\n s3o.size = File.size(s3o.file.path)\n s3o.md5 = Digest::MD5.file(s3o.file.path).hexdigest\n s3o.save!\n\n [:created, :xml, XmlAdapter.uploaded_object(\"#{@request.host}:#{@request.port}\", s3o)]\n end", "def upload(bucket, key)\n connect_to_s3\n AWS::S3::S3Object.store(key, File.open(temp_file_path, 'r'), bucket, :access => :public_read)\n AWS::S3::S3Object.url_for(key, bucket, :authenticated => false)\n end", "def upload!()\n file_number = 0\n\n total_files = @files.length\n\n @files.each do |file|\n file_number += 1\n\n print \"\\rUploading... [#{file_number}/#{total_files}]\"\n\n next if File.directory? file\n\n # Get the path relative to containing directory\n path = file.gsub(/^#{@folder_path}\\//, '')\n\n options = { :acl => \"authenticated-read\" }\n\n if MIME::Types.type_for(file).count > 0\n options[:content_type] = MIME::Types.type_for(file).first.to_str\n end\n\n @s3_bucket.object(path).upload_file(file, options)\n end\n\n puts \"\\rUpload complete!\".ljust 80\n end", "def save_file_to_s3_bucket(file)\n\n bucket = \"prototype-jv\"\n temp_file = \"./public/swap/#{file}\"\n s3_file_path = \"imageuploader/#{file}\"\n\n connect_to_s3()\n s3 = Aws::S3::Resource.new(region: ENV['AWS_REGION'])\n obj = s3.bucket(bucket).object(s3_file_path)\n\n if obj.exists? # file already exists in bucket\n cleanup_swap_dir(file) # being called by process_photo() in photo_upload, review for Upload to Cloud\n puts \"Image already in bucket!\"\n else\n obj.upload_file(temp_file) # put file in bucket\n cleanup_swap_dir(file) # being called by process_photo() in photo_upload, review for Upload to Cloud\n puts \"Image uploaded to bucket!\"\n end\n\nend", "def save(file_path, bucket_name, key=SecureRandom.uuid)\n bucket_name = env_bucket_name(bucket_name)\n uri = \"urn:openhbx:terms:v1:file_storage:s3:bucket:#{bucket_name}##{key}\"\n begin\n object = get_object(bucket_name, key)\n if object.upload_file(file_path, :server_side_encryption => 'AES256')\n uri\n else\n nil\n end\n rescue Exception => e\n nil\n end\n end", "def run_me\r\n bucket_name = 'doc-example-bucket'\r\n permission = 'READ'\r\n owner_id = 'b380d412791d395dbcdc1fb1728b32a7cd07edae6467220ac4b7c0769EXAMPLE'\r\n region = 'us-west-2'\r\n s3_client = Aws::S3::Client.new(region: region)\r\n\r\n if bucket_acl_set_for_owner_id?(\r\n s3_client,\r\n bucket_name,\r\n permission,\r\n owner_id\r\n )\r\n puts 'Bucket ACL set.'\r\n else\r\n puts 'Bucket ACL not set.'\r\n end\r\nend", "def save(file, path)\n file = File.open(file.path)\n\n directory = connection.directories.get(self.bucket)\n directory ||= connection.directories.create(self.permissions.merge(:key => self.bucket))\n\n directory.files.create(self.options(path).merge(self.permissions.merge(:key => path, :body => file)))\n\n file.close\n end", "def upload(file_name: nil, file_handle: nil, file_path: nil, sync: true)\n if file_path\n key = key_from_filename(file_path)\n puts \"Uploading #{file_path} to s3 with key #{key}\"\n File.open(file_path, 'rb') do |file|\n s3_client.put_object(key: key, body: file, bucket: bucket )\n end\n else\n key = key_from_filename(file_name)\n s3_client.put_object(key: key, body: file_handle.read, bucket: bucket)\n end\n sync_down if sync\n end", "def upload_file_to_aws(file_to_upload, content_type)\n\tputs \"Uploading file: \" + file_to_upload + \" to aws\"\n\tresponse = request_put(file_to_upload, content_type)\n\tputs response\nend", "def upload_to_s3(s3)\n # do some validity checks\n if uploaded?\n logger.warn \"email #{id} already uploaded\"\n return\n end\n email_file = temp_filename\n raise \"missing raw file (#{email_file}) for email #{id}\" unless File.exist?(email_file)\n\n key = gen_s3_key\n if s3.upload(email_file, key)\n update_attributes(:s3_key => key, :size => File.size(email_file))\n FileUtils.rm email_file # Delete file from disk\n end \n end", "def upload_file( id_object, file_to_upload, folder_on_s3 )\n \n file_name = id_object.to_s + \"-\" + file_to_upload.original_filename.to_s\n path_uploaded_files = Rails.root.join('public','uploaded-files')\n uploaded_file = path_uploaded_files.to_s + \"/\" + file_name\n\n unless Dir.exist?(path_uploaded_files)\n FileUtils.mkdir_p(path_uploaded_files)\n end\n\n File.open(uploaded_file, 'wb') do |file|\n file.write(file_to_upload.read)\n end \n\n file_on_s3 = folder_on_s3 + \"/\" + file_name\n upload_file_to_aws_s3(uploaded_file, file_on_s3)\n\n FileUtils.rm(uploaded_file.to_s)\n\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 save(file_path, bucket_name, key=SecureRandom.uuid)\n uri = \"urn:openhbx:terms:v1:file_storage:s3:bucket:<#{bucket_name}>##{key}\"\n begin\n object = get_object(bucket_name, key)\n if object.upload_file(file_path)\n uri\n else\n nil\n end\n rescue Exception => e\n nil\n end\n end", "def s3_upload(item)\n filepath = item.zip_file_path\n s3_key = item.s3_path\n s3_path = \"s3://#{s3_bucket}/#{s3_key}\"\n message = \"Uploading: #{filepath} to #{s3_path}\".color(:green)\n message = \"NOOP: #{message}\" if @options[:noop]\n puts message\n return if @options[:noop]\n\n s3.put_object(\n body: IO.read(filepath),\n bucket: s3_bucket,\n key: s3_key,\n )\n end", "def upload_bucket\n ::AWS::S3.new( { :secure => false } ).buckets['s3.documentcloud.org']\n end", "def aws_put_file(bucket, key, content, **opt)\n meth = opt.delete(:meth) || calling_method\n client = opt.delete(:client)\n client ||= (bucket.client if bucket.is_a?(Aws::S3::Bucket))\n client ||= s3_client(**opt)\n params = { bucket: bucket, key: key }\n # @type [Types::CopyObjectOutput, Types::PutObjectOutput] response\n response =\n if content.is_a?(Aws::S3::Object)\n params[:copy_source] = \"#{content.bucket_name}/#{content.key}\"\n client.copy_object(params, opt)\n else\n # noinspection RubyMismatchedArgumentType\n params[:body] = content.is_a?(String) ? StringIO.new(content) : content\n client.put_object(params, opt)\n end\n Log.debug { \"#{meth}: AWS S3 response: #{response.inspect} \" }\n key\n rescue => error\n set_error(error)\n # noinspection RubyScope\n Log.warn { \"#{meth}: AWS S3 failure: #{error.class}: #{error.message}\" }\n end", "def put(files, bucket) # FILE [FILE...] s3://BUCKET[/PREFIX]\n send_command \"put\", files, bucket\n end", "def make_public(file_name)\n object(file_name).acl.put({acl: \"public-read\"})\n end", "def quick_s3_upload\n end", "def upload_file(source,bucket,key_prefix,source_prefix,item_lookup)\n source_prefix = $1 if not source_prefix and source =~ /^(\\.+\\/*)/\n if File.directory?(source)\n upload_files(Dir[\"#{source}/*\"],bucket,key_prefix,source_prefix,item_lookup)\n else\n key = \"#{key_prefix}#{source[(source_prefix || '').length..-1]}\"\n source_size = File.size(source)\n if (last_size = item_lookup[key]) and last_size == source_size\n puts \"SKIP #{source}\"\n else\n if last_size\n print \"UPDATE #{source} => s3://#{bucket.name}/#{key} (#{last_size} => #{source_size})\"\n else\n print \"ADD #{source} => s3://#{bucket.name}/#{key} (#{source_size})\"\n end\n start_time = Time.now\n File.open(source,'rb') do|file|\n bucket.object(key).put(body: file)\n end\n puts \"... #{(Time.now - start_time).to_i}\"\n end\n end\nend", "def uploadFile(localFilePath, destFilePath, maxAge = 172800) # 2 Days = 1,72,800 seconds \n ext = File.extname(localFilePath).downcase\n msgContentType = \"\"\n cacheControl = \"max-age=#{maxAge}, must-revalidate\"\n if (ext == \"\")\n contentType = 'text/html'\n msgContentType = \"No file-ext: \"\n elsif (Fh5::Config.instance.contentTypes && Fh5::Config.instance.contentTypes.has_key?(ext))\n contentType = Fh5::Config.instance.contentTypes[ext]\n msgContentType = \"Override for '#{ext}':\"\n else \n contentType = MimeMagic.by_path(destFilePath).type\n end\n @log.info(@logPrefix) {\"Upload: '#{destFilePath}' (#{msgContentType}#{contentType}) (#{cacheControl})\"}\n begin\n File.open(localFilePath) do |f|\n content = f.read\n @bucketAdmin.defaultBucket.put(destFilePath, content, {}, 'public-read', \n {'Content-Type' => contentType, 'Cache-Control' => cacheControl})\n end\n rescue\n @log.errorException($!, @logPrefix) {\"Failed to upload to: '#{destFilePath}'\"}\n\n return nil\n end\n \n # comment out stuff related to public links which doesn't seem to work for website bucket.\n # publicLink = @bucketAdmin.endpointBucket.key(destFilePath).public_link\n # @log.debug(@logPrefix) {\"Public link: '#{publicLink}' for file: '#{destFilePath}'\"}\n # return publicLink \n end", "def save_file(upload)\n return false if upload.blank?\n name = self.id.to_s + \".\" + upload.original_filename\n\n self.aws_connect()\n \n # store the file to Amazon S3\n AWS::S3::S3Object.store(name, upload, 'assetmngr', :access => :public_read)\n self.filename = name\n self.save\n end", "def uploadFile(key = \"\")\n key = 0 < key.length ? key : self.dispatched.fileName\n self.bucket.put(key, self.string)\n self.clear\n end", "def bucket_policy_aws_principal_updated?(\r\n s3_client,\r\n bucket_name,\r\n new_aws_principal\r\n)\r\n bucket_policy = s3_client.get_bucket_policy(bucket: bucket_name).policy.read\r\n policy_json = JSON.parse(bucket_policy)\r\n\r\n policy_json['Statement'][0]['Principal']['AWS'] = new_aws_principal\r\n\r\n s3_client.put_bucket_policy(\r\n bucket: bucket_name,\r\n policy: policy_json.to_json\r\n )\r\n return true\r\nrescue StandardError => e\r\n puts \"Error updating bucket policy: #{e.message}\"\r\n return false\r\nend", "def upload_file(file_upload, owner)\n image = MiniMagick::Image.open(file_upload.tempfile.path)\n image.resize \"500x500>\"\n image.format \"jpeg\"\n\n tempfile = Tempfile.new \"item_picture\"\n image.write(tempfile)\n\n owner = \"#{current_user.id}/#{owner}\"\n\n upload = Upload.find_by(owner: owner) || Upload.new(owner: owner)\n\n upload.mime_type = \"image/jpeg\"\n upload.extension = \".jpeg\"\n upload.body = tempfile.read\n\n if upload.save\n StoreUploadToCloudJob.perform_later upload\n\n upload\n end\n end", "def file_public_read\n if $item_public_read.variable() == 1\n $s3.client.put_object_acl(acl: 'public-read',\n bucket: $bucket,\n key: $bucket_item)\n else\n $s3.client.put_object_acl(acl: 'private',\n bucket: $bucket,\n key: $bucket_item)\n end\n end", "def writenc(path, file)\n bucket\n @@mutex.synchronize do\n path = find_available_name(path)\n bucket.objects[path].write(:file => file, :acl => :public_read)\n end\n path\n end", "def test_put_bucket_predefined_acl\n @client.put_bucket(new_bucket_name, :predefined_acl => \"publicRead\")\n end", "def upload(resource, filename)\n _validate_presence_of resource, filename\n\n response = Github::S3Uploader.new(resource, filename).send\n response.body\n end", "def upload\n to_png_file do |png_path|\n File.open(png_path, 'rb') do |file|\n S3.put_object bucket: Giffy::Configuration.aws.bucket, key: key, body: file\n end\n S3.put_object_acl acl: 'public-read', bucket: Giffy::Configuration.aws.bucket, key: key\n end\n end", "def upload\n to_png_file do |png_path|\n File.open(png_path, 'rb') do |file|\n S3.put_object bucket: Giffy::Configuration.aws.bucket, key: key, body: file\n end\n S3.put_object_acl acl: 'public-read', bucket: Giffy::Configuration.aws.bucket, key: key\n end\n end", "def bucket_acl_set?(s3_client, bucket_name, access_level)\r\n s3_client.put_bucket_acl(\r\n bucket: bucket_name,\r\n acl: access_level\r\n )\r\n return true\r\nrescue StandardError => e\r\n puts \"Error setting bucket ACL: #{e.message}\"\r\n return false\r\nend", "def ensure_s3_bucket_policy()\n\n resp = @sts.get_caller_identity({})\n account = resp.to_h[:account]\n\n #TODO: Merge existing policies\n policy = {\n :Version => \"2008-10-17\",\n :Statement => [\n {\n :Sid => \"GiveSESPermissionToWriteEmail\",\n :Effect => \"Allow\",\n :Principal => {\n :Service => [\n \"ses.amazonaws.com\"\n ]\n },\n :Action => [\n \"s3:PutObject\"\n ],\n :Resource => \"arn:aws:s3:::#{@receipt_rule.s3_bucket}/*\",\n :Condition => {\n :StringEquals => {\n 'aws:Referer' => account\n }\n }\n }\n ]\n }\n\n @s3.put_bucket_policy({\n bucket: @receipt_rule.s3_bucket,\n policy: policy.to_json\n })\n end", "def s3_upload_policy_document\n\t return @policy if @policy\n\t ret = {\"expiration\" => 5.minutes.from_now.utc.xmlschema,\n\t \"conditions\" => [ \n\t {\"bucket\" => YOUR_BUCKET_NAME}, \n\t [\"starts-with\", \"$key\", @document.s3_key],\n\t {\"acl\" => \"private\"},\n\t {\"success_action_status\" => \"200\"},\n\t [\"content-length-range\", 0, 1048576]\n\t ]\n\t }\n\t @policy = Base64.encode64(ret.to_json).gsub(/\\n/,'')\n\t end", "def aws_call\n s3_object = AMAZON_S3_CLIENT.bucket(bucket_name).object(renamed_filename)\n s3_object.upload_file(\n file,\n metadata: file_metadata,\n content_type: 'text/csv'\n )\n end", "def upload_multipart(file, opts = {})\n @opts = opts\n\n create_object(*S3Client.s3_params).write(content_length: file.size) do |buffer, bytes|\n buffer.write(file.read(bytes))\n end\n end", "def upload_file(from, to, command)\n vputs \"Uploading #{from} with #{command} on s3\"\n verbose = $verbose ? \"--verbose\" : \"\"\n\n upload_command = [\n \"aws s3 #{command}\",\n \"--acl public-read\",\n \"#{ $active_folder }/#{from} s3://#{ $s3_bucket }#{to}\"\n ]\n\n command upload_command.join(' ')\n end", "def object_uploaded_with_metadata?(\r\n s3_client,\r\n bucket_name,\r\n object_key,\r\n metadata\r\n)\r\n response = s3_client.put_object(\r\n bucket: bucket_name,\r\n body: \"c:\\\\my-file.txt\",\r\n key: object_key,\r\n metadata: metadata\r\n )\r\n if response.etag\r\n return true\r\n else\r\n return false\r\n end\r\nrescue StandardError => e\r\n puts \"Error uploading object: #{e.message}\"\r\n return false\r\nend", "def create_object(bucket_name, key, data, headers = {}, meta_headers = {}, acl = :private)\n headers = headers.dup\n meta_headers.each do |k,v|\n headers[k =~ /^x-amz-meta-/i ? k : \"x-amz-meta-#{k}\"] = v\n end\n headers['x-amz-acl'] = acl.to_s.gsub(/_/, '-')\n\n response = send_s3_request('PUT', :bucket => bucket_name, :key => key, :headers => headers, :data => data)\n response.is_a?(Net::HTTPSuccess)\n end", "def object_uploaded?(s3_client, bucket_name, object_key, object_content)\r\n s3_client.put_object(\r\n bucket: bucket_name,\r\n key: object_key,\r\n body: object_content\r\n )\r\n return true\r\nrescue StandardError => e\r\n puts \"Error uploading object: #{e.message}\"\r\n return false\r\nend", "def upload_file(from_path, file_name, opts={})\n return false unless valid?\n pub = !!opts[:public]\n object(file_name).upload_file(from_path)\n make_public(file_name) if pub\n end", "def upload_key(s3client,newkeyblob,filename,bucket)\r\n keyfile_name= filename+ \".key\"\r\n newkeyblob64 = Base64.encode64(newkeyblob)\r\n s3client.put_object({\r\n body: newkeyblob64,\r\n key: keyfile_name,\r\n bucket: bucket\r\n })\r\nend", "def upload(tempfile, filename)\n Rails.logger.debug \" Uploading filename...\"\n s3_path = File.join(self.full_path_prefix, filename)\n AWS::S3::S3Object.store(s3_path, tempfile.open, AWS_CONFIG['s3']['bucket_name'], :access => :public_read) # reopen the tempfile and write directly to S3\n Rails.logger.debug \" ** Uploaded image to S3: #{s3_path}\"\n ensure\n # tempfile.unlink\n end", "def commit_file\n if @upload.public? && @upload.file_type.public? && @upload.address.blank? && (@upload.creating? || @upload.failed?)\n BlockchainCommitJob.perform_later(@upload.id)\n end\n end", "def upload_zip_to_s3(file_path, filename, connection)\n\tif !filename.include? \".zip\"\n\t\tfilename += \".zip\"\n\tend\n\ts3_key = \"zipped_packages/\" + filename\n\treturn connection.upload(file_path + filename, s3_key, :public_read, content_type=nil, metadata=nil)\nend", "def put_content(aFilename, aContent, aBucketName)\n\t\tAWS::S3::S3Object.store(aFilename, aContent, aBucketName)\n\tend", "def keep_trying_to_upload(file_to_upload,bucket)\n uploaded = false\n until uploaded == true\n begin\n retval = AWS::S3::S3Object.store(\n File.basename(file_to_upload),\n open(file_to_upload),\n bucket,\n :access => :public_read)\n rescue IOError => e\n puts \"IOError happened uploading '#{file_to_upload}' ('#{e.message}'): retrying.\\n\"\n else\n puts \"#{file_to_upload} uploaded.\\n\"\n uploaded = true\n end\n end\n end", "def create_file(bucket_id:, file_id:, file:, permissions: nil, on_progress: nil)\n path = '/storage/buckets/{bucketId}/files'\n .gsub('{bucketId}', bucket_id)\n\n if bucket_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"bucketId\"')\n end\n\n if file_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"fileId\"')\n end\n\n if file.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"file\"')\n end\n\n params = {\n fileId: file_id,\n file: file,\n permissions: permissions,\n }\n \n headers = {\n \"content-type\": 'multipart/form-data',\n }\n\n id_param_name = \"fileId\"\n param_name = 'file'\n\n @client.chunked_upload(\n path: path,\n headers: headers,\n params: params,\n param_name: param_name,\n id_param_name: id_param_name,\n on_progress: on_progress,\n response_type: Models::File\n )\n end", "def upload_with_kms_key bucket_name:, local_file_path:, file_name: nil, kms_key:\n # The ID of your GCS bucket\n # bucket_name = \"your-unique-bucket-name\"\n\n # The path to your file to upload\n # local_file_path = \"/local/path/to/file.txt\"\n\n # The ID of your GCS object\n # file_name = \"your-file-name\"\n\n # The name of the KMS key to manage this object with\n # kms_key = \"projects/your-project-id/locations/global/keyRings/your-key-ring/cryptoKeys/your-key\"\n\n require \"google/cloud/storage\"\n\n storage = Google::Cloud::Storage.new\n\n bucket = storage.bucket bucket_name, skip_lookup: true\n\n file = bucket.create_file local_file_path, file_name, kms_key: kms_key\n\n puts \"Uploaded #{file.name} and encrypted service side using #{file.kms_key}\"\nend", "def save_to_s3(file_name, listing_id)\n connect_to_s3() if ! @s3\n obj = @s3.bucket(S3_BUCKET).object(file_name)\n obj.upload_file('tmp/tmp.jpg')\n end", "def upload_file(task)\n return if bucket.nil? || !task.instance_of?(Task)\n task.upload_files.each { |f|\n begin\n file_ptr = File.exist?(f) ? File.new(f) : \"\"\n bucket.put(f.gsub(/^\\.\\//, ''), file_ptr)\n rescue Exception => e\n puts \"Cannot open file named: #{f} Message: #{e}\"\n end\n\n }\n end", "def upload_to_sandbox(sandbox_filename, sandbox_file_checksum, url)\n \n checksum64 = Base64.encode64([sandbox_file_checksum].pack(\"H*\")).strip\n timestamp = Time.now.utc.iso8601\n file_contents = File.read(sandbox_filename)\n # TODO - 5/28/2010, cw: make signing and sending the request streaming\n sign_obj = Mixlib::Authentication::SignedHeaderAuth.signing_object(\n :http_method => :put,\n :path => URI.parse(url).path,\n :body => file_contents,\n :timestamp => timestamp,\n :user_id => rest.client_name\n )\n headers = { \n 'content-type' => 'application/x-binary', \n 'content-md5' => checksum64, \n :accept => 'application/json'\n }\n headers.merge!(sign_obj.sign(OpenSSL::PKey::RSA.new(rest.signing_key)))\n\n # Don't set inflated_response as S3 (for the Platform) doesn't return JSON.\n # Only Open Source does.\n self.inflated_response = nil\n self.exception = nil\n self.api_response = RestClient::Request.execute(\n :method => :put, \n :url => url, \n :headers => headers, \n :payload => file_contents\n )\nend", "def creator_upload(username, file_name, file)\r\n dir = \"creators/#{username}\"\r\n file.original_filename = file_name + (File.extname file.original_filename)\r\n return write(dir, file)\r\n end", "def store_object(box_file, index_file, object_key, bucket)\n logger.info(\"uploading: #{bucket}/#{object_key}\")\n is_multipart = box_file.size > @size_for_multipart\n io = box_file.stream\n io = save_copy(index_file, io) if index_file\n\n options = {\n key: object_key,\n bucket: bucket,\n data: io\n }.tap do |memo|\n memo.update(part_size: @part_size) if is_multipart\n end\n\n method = is_multipart ? :store_object_multipart : :store_object\n @s3.send(method, options)\n index_file.close if index_file\n end", "def update_file(bucket_id:, file_id:, permissions: nil)\n path = '/storage/buckets/{bucketId}/files/{fileId}'\n .gsub('{bucketId}', bucket_id)\n .gsub('{fileId}', file_id)\n\n if bucket_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"bucketId\"')\n end\n\n if file_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"fileId\"')\n end\n\n params = {\n permissions: permissions,\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'PUT',\n path: path,\n headers: headers,\n params: params,\n response_type: Models::File\n )\n end", "def object_uploaded?(s3_client, bucket_name, object_key, object_content)\r\n response = s3_client.put_object(\r\n bucket: bucket_name,\r\n key: object_key,\r\n body: object_content\r\n )\r\n if response.etag\r\n return true\r\n else\r\n return false\r\n end\r\nrescue StandardError => e\r\n puts \"Error uploading object: #{e.message}\"\r\n return false\r\nend", "def upload_video_at_s3(filename, filepath) \n\t\tbegin\n\t\t\ts3 = Aws::S3::Resource.new\n\t\t\tobj = s3.bucket(ENV['AWS_S3_BUCKET'] || 'tv-guide-s3-bucket').object(filename)\n\t\t\tif obj.upload_file(filepath)\n\t\t\t\tself.update(video_filename: filename) \n\n\t\t\t\tFile.delete(filepath) \n\t\t\tend\n\t\trescue StandardError => e\n\t \tRails.logger.info \"================================================upload_video_at_s3:69\"\n\t \tRails.logger.info e\n\t\tend\n\tend", "def put(path, file, options = {})\n path = format_path(path)\n bucket_path = get_bucket_path(path)\n content_md5 = Digest::MD5.file(file).base64digest\n content_type = options[:content_type] || 'image/jpg'\n date = gmtdate\n url = path_to_url(path)\n auth_sign = sign('PUT', bucket_path, content_md5, content_type, date)\n headers = {\n 'Authorization' => auth_sign,\n 'Content-Md5' => content_md5,\n 'Content-Type' => content_type,\n 'Content-Length' => file.size,\n 'Date' => date,\n 'Host' => @aliyun_upload_host,\n 'Expect' => '100-Continue'\n }\n response = RestClient.put(url, file, headers)\n response.code == 200 ? path_to_url(path) : nil\n end", "def update_file_on_s3(file, objects)\n file_path = s3_file_path(file)\n conn = RedmineS3::Connection.conn\n object = objects[file_path]\n\n # get the file modified time, which will stay nil if the file doesn't exist yet\n # we could check if the file exists, but this saves a head request\n s3_mtime = object.last_modified rescue nil \n\n # put it on s3 if the file has been updated or it doesn't exist on s3 yet\n if s3_mtime.nil? || s3_mtime < File.mtime(file)\n fileObj = File.open(file, 'r')\n RedmineS3::Connection.put(file_path, fileObj.read)\n fileObj.close\n\n puts \"Put file \" + File.basename(file)\n else\n puts File.basename(file) + ' is up-to-date on S3'\n end\n end", "def run_me\r\n bucket_name = 'doc-example-bucket'\r\n object_key = 'my-file.txt'\r\n metadata = {\r\n author: 'Mary Doe',\r\n version: '1.0.0.0'\r\n }\r\n region = 'us-west-2'\r\n s3_client = Aws::S3::Client.new(region: region)\r\n\r\n if object_uploaded_with_metadata?(\r\n s3_client,\r\n bucket_name,\r\n object_key,\r\n metadata\r\n )\r\n puts \"Object '#{object_key}' uploaded to bucket '#{bucket_name}' \" \\\r\n 'with metadata.'\r\n else\r\n puts \"Object '#{object_key}' not uploaded to bucket '#{bucket_name}'.\"\r\n end\r\nend", "def upload(obj, file_path)\n begin\n res = scribd_user.upload(:file => escape(file_path), :access => access_level)\n obj.update_attributes({:ipaper_id => res.doc_id, :ipaper_access_key => res.access_key})\n rescue\n raise ScribdFuUploadError, \"Sorry, but #{obj.class} ##{obj.id} could not be uploaded to Scribd. \"\n end\n end", "def run_me\n bucket_name = 'doc-example-bucket'\n object_key = 'my-file.txt'\n object_content = 'This is the content of my-file.txt.'\n region = 'us-west-2'\n s3_client = Aws::S3::Client.new(region: region)\n\n if upload_file_encrypted_aes256_at_rest?(\n s3_client,\n bucket_name,\n object_key,\n object_content\n )\n puts 'File uploaded and encrypted.'\n else\n puts 'File not uploaded.'\n end\nend", "def object_acl_set?(s3_client, bucket_name, object_key, access_level)\r\n s3_client.put_object_acl(\r\n bucket: bucket_name,\r\n key: object_key,\r\n acl: access_level\r\n )\r\n return true\r\nrescue StandardError => e\r\n puts \"Error setting object ACL: #{e.message}\"\r\n return false\r\nend", "def send_to_s3(img, name)\n s3_directory.files.create({\n key: \"#{name}.jpg\",\n body: img,\n public: true\n })\nend", "def upload_file\n #TODO\n end", "def s3_upload_policy_document\n return @policy if @policy\n ret = {\"expiration\" => 5.minutes.from_now.utc.xmlschema,\n \"conditions\" => [ \n {\"bucket\" => SITE['s3_bucket']}, \n [\"starts-with\", \"$key\", @photo.s3_key],\n {\"acl\" => \"private\"},\n {\"success_action_status\" => \"200\"},\n [\"content-length-range\", 0, 1048576]\n ]\n }\n @policy = Base64.encode64(ret.to_json).gsub(/\\n/,'')\n end", "def upload(config={})\n\n\t\tfile_name = config.delete(:file_name)\n\t\tpath_to_s3_folder = config.delete(:path_to_s3_folder)\n\n\t\tif file_name.nil? || file_name.empty?\n\t\t\traise ArgumentError, \"file_names is either empty or contains no values\"\n\t\telsif file_name==''\n\t\t\traise ArgumentError, \"File Names is passed as empty string. Pass appropriate values\"\n\t\tend\n\n\t\tfile_names = Array.new\n\t\tfile_names = file_name if file_name.is_a? Array\n\n\t\tfile_names.push(file_name) if file_name.is_a? String\n\t\tfile_names.each {|file|\n\t\t\t#raise ArgumentError, \"File name does not exist in the main directory\" if File.exists?(file)==false\n\t\t\tfinal_file_path = path_to_s3_folder + file\n\t\t\t@s3.buckets[@bucket_name].objects[final_file_path].write(:file => file)\n\t\t\tputs \"#{file} successfully uploaded\"\n\t\t} unless file_names.nil?\n\tend", "def upload(file, someone)\n end", "def s3_write(key, value)\n @s3.put_object(bucket: ENV.fetch(\"AWS_BUCKET\"), key: key, body: value,\n content_type: \"text/plain; charset=utf-8\")\n end" ]
[ "0.74061835", "0.7285796", "0.7169991", "0.7007247", "0.69954664", "0.69686705", "0.6748115", "0.67469937", "0.6663613", "0.6625622", "0.662101", "0.66089386", "0.65975314", "0.6584539", "0.65426373", "0.65320307", "0.6520847", "0.6515147", "0.6501233", "0.6493073", "0.6488358", "0.6452454", "0.6444096", "0.64424616", "0.64352083", "0.6431758", "0.64024293", "0.6390144", "0.6383826", "0.63807", "0.63801473", "0.6376709", "0.63748336", "0.6354025", "0.63537097", "0.6342413", "0.6316126", "0.63140833", "0.629587", "0.6294864", "0.6292947", "0.62867635", "0.6281566", "0.62606776", "0.6190462", "0.6180427", "0.6179578", "0.61734945", "0.61640567", "0.6160965", "0.6152098", "0.61416954", "0.6137961", "0.61364645", "0.61257637", "0.6125623", "0.61241156", "0.6117878", "0.6110443", "0.61024106", "0.6100495", "0.6100495", "0.60995895", "0.6056342", "0.6054758", "0.6032967", "0.60286695", "0.6024229", "0.60237604", "0.60023034", "0.59951556", "0.5995098", "0.5991651", "0.5970297", "0.5955719", "0.59512615", "0.5945021", "0.59372735", "0.5936461", "0.5935109", "0.59250367", "0.5924353", "0.59207165", "0.59155446", "0.5913243", "0.5911384", "0.5907619", "0.5895625", "0.5893414", "0.58815145", "0.5878448", "0.58777463", "0.5873014", "0.5867155", "0.58647686", "0.5849058", "0.5840956", "0.5840445", "0.5840038", "0.582109" ]
0.77392226
0
Adds additional semantics to +reject+ by accepting an optional argument.
def reject_with_list_arg(list=nil, &block) if !block_given? && list && list.any? hash = self.dup list.each do |f| case f when Regexp hash.delete_if {|k, v| k.to_s =~ f} when Symbol hash.delete_if {|k, v| k.to_s == f.to_s} when String hash.delete_if {|k, v| k.to_s == f} end end return hash end return reject_without_list_arg(&block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reject(reason: nil, **keyword_args)\n append(Reject.new(reason: reason, **keyword_args))\n end", "def my_reject(&prc)\n end", "def reject(&block)\n @reject = block if block\n @reject\n end", "def reject(&blk); end", "def reject(&block); end", "def reject!(&block); end", "def reject!\n raise RejectMessage\n end", "def call_reject(accpt)\n @accept_model = accpt\n reject!\n end", "def reject( id, reedo = false, do_amt_reject = false )\n connection.put( \"#{resource_uri}/#{id}/reject\", :headers => { \"Content-Length\" => \"0\" }, :body => { :redo => reedo ? \"true\" : \"false\", :do_amt_reject => do_amt_reject ? \"true\" : \"false\" } )\n end", "def reject\n self['reject']||{}\n end", "def reject\n throw :reject\n end", "def without(what)\n God.knows \"without #{what}\"\n what = What.is(what)\n what.reject = true\n what\nend", "def rejects=(*args)\n @rejects = args.flatten.map(&:to_s)\n end", "def reject(id)\n end", "def reject(reason = nil)\n log(2, \"Action: reject: \" + reason.to_s)\n raise DeliveryReject.new(reason.to_s)\n end", "def reject(message_id)\n raise NotImplementedError\n end", "def reject!(response_data={})\n @client.post(\"#{path}/reject\", response_data)\n end", "def reject(*args, &blk) top.reject(*args, &blk) end", "def reject(*)\n super.tap do\n __debug_sim('USER must make change(s) to complete the submission.')\n end\n end", "def reject!(&block)\n @parameters.reject!(&block)\n self\n end", "def reject_with_list_arg!(list, &block)\n self = reject_with_list_arg(list, &block)\n end", "def reject\n return enum_for(:reject) if not block_given?\n select { |item| !yield(item) }\n end", "def reject\n transition_to :rejected\n end", "def reject!(&b)\n a = reject(&b)\n if a.size == size\n nil # no changes, return nil\n else\n replace(a)\n self\n end\n end", "def reject(&block)\n append(Filter.new { |value| ! block.call(value) })\n end", "def reject?(word)\n config.rejects.include?(word)\n end", "def reject(reason)\n Q.reject(@reactor, reason)\n end", "def reject\n @arguments_references.each { |argument_reference| @connection.objects.reject_reference(argument_reference) }\n end", "def reject?\r\n\t\tfalse\r\n\tend", "def my_reject(&prc)\n rejection = []\n i = 0\n while i < self.length\n if !prc.call(self[i])\n rejection << self[i]\n end\n i += 1\n end\n return rejection\n end", "def reject(reason = nil)\n unless @state == PENDING\n fail PromiseAlreadyResolvedException, 'This promise is already resolved, and you\\'re not allowed to resolve a promise more than once'\n end\n @state = REJECTED\n @value = reason\n @subscribers.each do |subscriber|\n invoke_callback(subscriber[0], subscriber[2])\n end\n end", "def flunk(workitem, err_class_or_instance, *err_arguments)\n\n r = remove_workitem('reject', workitem)\n\n return flunk(workitem) if r != nil\n\n workitem.h.delete('_rev')\n\n super(workitem, err_class_or_instance, *err_arguments)\n end", "def reject?(sender)\n false\n end", "def reject?(sender)\n false\n end", "def decline!\n return unless accepted.nil?\n\n update(accepted: false)\n end", "def reject(list, &block)\n list.reject(&block)\nend", "def vuln_exception_reject(input)\n exception_id = input[:exception_id]\n unless exception_id\n raise ArgumentError.new 'Exception Id is required'\n end\n\n xml = make_xml('VulnerabilityExceptionRejectRequest', {'exception-id' => exception_id})\n comment = input[:comment]\n if comment && !comment.empty?\n comment_xml = make_xml('comment', {}, comment, false)\n xml.add_element comment_xml\n end\n\n r = execute xml, '1.2'\n r.success\n end", "def to_reject(value)\r\n only_with_a_string(value) { |value| @rejectable.push(value) }\r\n end", "def reject\n @locale_entry.approved = false\n @locale_entry.reviewer = current_user\n @locale_entry.save!\n\n respond_with @source_entry, @locale_entry, location: glossary_source_locales_url\n end", "def discard=(_arg0); end", "def reject!(&block)\n block or return enum_for(__method__)\n n = size\n delete_if(&block)\n size == n ? nil : self\n end", "def reject! &block\n stash.reject! &block\n end", "def catch(on_reject=nil, &block)\n on_reject = block if block_given?\n return self.then(nil, on_reject)\n end", "def reject!(user_id)\n if self.rejected_at.nil?\n self.update_attributes(rejected_at: Time.now, approved_at: nil, user: user_id)\n end\n self\n end", "def except(*args)\n reject { |k, _v| args.include?(k) }\n end", "def reason(**options, &block)\n self.dup.reason!(**options, &block)\n end", "def reject!\n return enum_for(:reject!) if not block_given?\n each { |n| remove(n) if yield n }\n self\n end", "def reject(&block)\n new_instance_with_inherited_permitted_status(@parameters.reject(&block))\n end", "def reject(&block)\n raise \"Missing block\" unless block\n raise \"filter already called on this experiment\" if @request_filter_block\n\n @request_filter_block = block\n end", "def reject(&block)\n alter do\n @lines = @lines.reject(&block)\n end\n end", "def reject\n copy self.class.reject(@id)\n true\n end", "def reject\n copy self.class.reject(@id)\n true\n end", "def reject( & block )\n\n load_parent_state\n \n return super\n\n end", "def reject_related(rel, ignore: [], &blk)\n reject_embedded(rel, ignore: ignore, &blk).reject_links(rel, ignore: ignore, &blk)\n end", "def exclude=(_arg0); end", "def reject_params\n params.require(:reject).permit(:estado)\n end", "def reject!\n super { |r| yield(r) && orphan_resource(r) }\n end", "def reject\n C.curry.(->(f, xs) { xs - select.(f, xs) })\n end", "def reject\n throw :halt, false\n end", "def reject_message( key, value_1, value_2 )\n puts \"Refused to allow { #{key} => #{value_2} } to overwrite { #{key} => #{value_1} }\"\n end", "def reject_without_hooks!( & block )\n\n @without_hooks = true\n\n reject!( & block )\n \n @without_hooks = false\n\n return return_value\n\n end", "def reject!(user = nil)\n run_callbacks :rejection do\n self.rejected_at = Time.now\n self.rejecter = user if user\n self.status = 'rejected'\n self.save!\n self.order_items.each(&:reject!)\n deliver_rejected_order_email\n end\n end", "def reject(*reasons)\n raise Exception.new(\"A once resolved promise can not be rejected later\") if @state == State::RESOLVED\n raise Exception.new(\"A rejected promise can not be rejected again with a different reason (#{@values}, #{reasons})\") if @state == State::REJECTED && reasons != @values\n return nil unless @state == State::PENDING\n\n # If this promise is rejected with another promise, the final reasons are not yet\n # known, so we we register this promise to be rejected once all reasons are resolved.\n raise(TypeError, 'A promise cannot be rejected with itself.') if reasons.include?(self)\n # TODO: reject should not do unwrapping according to https://github.com/getify/You-Dont-Know-JS/blob/master/async%20%26%20performance/ch3.md\n #if reasons.find{ |r| r.is_a?(Promise) }\n # Promise.all(reasons).then(Proc.new{ |reasons| reject(*reasons) }, method(:reject))\n # return\n #end\n\n # Update the state.\n @values = reasons\n @state = State::REJECTED\n\n # Trigger the queued handlers.\n if @handlers.empty?\n # No \"then\"/\"catch\" handlers have been added to the promise.\n unhandled_rejection(*@values)\n else\n # Otherwise: Potentially handlers are awaiting results.\n # If no catch handler is called, the rejection might get unnoticed, so we emit a warning.\n until @handlers.empty?\n handler = @handlers.shift\n if handler.on_reject.respond_to?(:call)\n handle(handler.on_reject, handler.resolve_next, handler.reject_next)\n else\n # No on_reject handler given: equivalent to identity { |reason| raise(reason) }, so we call reject_next\n # See: https://www.promisejs.org/api/#Promise_prototype_then\n if handler.reject_next.respond_to?(:call)\n handler.reject_next.call(*@values)\n end\n end\n end\n end\n # We must return nil, otherwise if this promise is rejected inside the \n # block of an outer Promise, the block would implicitely return a \n # resolved Promise and cause complicated errors.\n return nil\n end", "def miss_reason=(_arg0); end", "def reject(connection, comment = nil)\n xml = connection.make_xml('VulnerabilityExceptionRejectRequest',\n { 'exception-id' => @id })\n if comment\n cxml = REXML::Element.new('comment')\n cxml.add_text(comment)\n xml.add_element(cxml)\n end\n\n connection.execute(xml, '1.2').success\n end", "def reject(connection, comment = nil)\n xml = connection.make_xml('VulnerabilityExceptionRejectRequest',\n { 'exception-id' => @id })\n if comment\n cxml = REXML::Element.new('comment')\n cxml.add_text(comment)\n xml.add_element(cxml)\n end\n\n connection.execute(xml, '1.2').success\n end", "def reject?(sender)\r\n false\r\n end", "def ignore(*args); end", "def reject\n @company = Company.find(params[:id])\n if @company.reject!\n respond_with @company\n else\n respond_with @company, status: :unprocessable_entity\n end\n end", "def reject(reason)\n @close_error = reason\n close\n end", "def my_reject(&prc)\n arr = []\n self.my_each { |el| arr << el if !prc.call(el) }\n arr\n end", "def reject\n fog_model.reject\n end", "def reject!(person, reason)\n if (in_dispute_period? || contested?) && person_can_respond?(person) && response_for(person) != false\n self.class.transaction do\n BountyClaimEvent::BackerDisputed.create!(\n bounty_claim: self,\n person: person,\n description: reason\n )\n BountyClaimResponse.find_or_create_by_claim_and_person(self, person, false, reason) and reload\n end\n end\n end", "def my_reject(arr,&prc)\n remainders = []\n arr.each {|el| remainders << el if prc.call(el)}\n remainders\nend", "def reject_item(array, item_to_reject)\n # Your code here\nend", "def reject\n email = Email.find(params[:id])\n email.state = \"Rejected\"\n email.reject_reason = params[:reject_reason]\n if email.save!\n head :no_content\n else\n respond_with email, status: :unprocessable_entity\n end\n end", "def reject(delivery_tag, requeue = true)\n @connection.send_frame(Protocol::Basic::Reject.encode(self.id, delivery_tag, requeue))\n\n self\n end", "def events_reject_with_http_info(event_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: EventsApi.events_reject ...'\n end\n # verify the required parameter 'event_id' is set\n if @api_client.config.client_side_validation && event_id.nil?\n fail ArgumentError, \"Missing the required parameter 'event_id' when calling EventsApi.events_reject\"\n end\n # resource path\n local_var_path = '/sample/v1/events/{eventId}/reject'.sub('{' + 'eventId' + '}', event_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/vnd.event+json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'application/xml', 'application/gob', 'application/x-gob'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['jwt']\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 => 'Event')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: EventsApi#events_reject\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def reject\n register_change\n PristinePermission.delete(id) unless id.nil?\n end", "def omit(reason=true)\n if block_given?\n @_omit = reason\n yield\n @_omit = nil\n else\n @_omit = reason\n end\n end", "def update!(**args)\n @decline_reason = args[:decline_reason] if args.key?(:decline_reason)\n end", "def assert_rejects(matcher, target, options = {})\n if matcher.respond_to?(:in_context)\n matcher.in_context(self)\n end\n\n not_match = matcher.respond_to?(:does_not_match?) ? matcher.does_not_match?(target) : !matcher.matches?(target)\n\n if not_match\n assert true\n\n if options[:message]\n assert_match options[:message], matcher.failure_message\n end\n else\n assert false, matcher.failure_message\n end\n end", "def reject\n self.update_attributes(:status => REJECTED)\n end", "def notify_or_raise(ex)\n if should_raise?\n fail ex\n else\n notify_or_ignore_with_options(ex)\n end\n end", "def assert_rejects(matcher, target)\n success = !matcher.matches?(target)\n assert_block(matcher.negative_failure_message) { success }\n end", "def reject!(&block)\n block or return enum_for(__method__) { size }\n n = size\n delete_if(&block)\n self if size != n\n end", "def reject error\n mutex.synchronize{ rejecting(error) }\n end", "def rejected!\n # pending => rejected\n if !pending?\n errors.add(:state, :invalid_transition)\n return false\n end\n\n super\n end", "def reject\n self[:status] = \"Reject\"\n save\n end", "def reject_transfer_away(domain, reason)\n validate_list([ [\"Domain\", domain, :domain_format], [\"Reason\", reason, :presence ] ])\n options = { \"Domain\" => domain, \"Reason\" => reason }\n\n connection = Connection.new\n connection.post(\"Domain/TransferAway/Reject\", options)\n end", "def accept_no_params(opts={})\n accept_params(opts) {}\n end", "def accept_no_params(opts={})\n accept_params(opts) {}\n end", "def missing_option=(_arg0); end", "def missing_option=(_arg0); end", "def missing_option=(_arg0); end", "def missing_option=(_arg0); end", "def missing_option=(_arg0); end", "def missing_option=(_arg0); end", "def my_reject(&prc)\n\t\tnew_array = []\n\n\t\tself.my_each do |ele|\n\t\t\tnew_array << ele if !prc.call(ele)\t\t\t\t\n\t\tend\n\n\t\tnew_array\n\tend", "def reject!\n return false if self.approved == true\n self.destroy\n end", "def reject?(val)\n val.nil?\n end" ]
[ "0.7113229", "0.7048072", "0.65520954", "0.64220786", "0.6386754", "0.62827384", "0.61577344", "0.6134144", "0.61030483", "0.61018914", "0.6076733", "0.60468227", "0.60454667", "0.59868747", "0.5839345", "0.5820302", "0.5819923", "0.5769507", "0.56937534", "0.56717926", "0.558343", "0.55640996", "0.5504374", "0.54564184", "0.54189795", "0.5412499", "0.53754973", "0.5331479", "0.5320445", "0.53124547", "0.5282711", "0.52818125", "0.5157763", "0.5157763", "0.51370627", "0.51159465", "0.50926626", "0.5080642", "0.50733805", "0.5071765", "0.5058698", "0.5049466", "0.50318706", "0.50256205", "0.5002348", "0.4994131", "0.49931845", "0.49675184", "0.49667072", "0.4957745", "0.49560943", "0.49560943", "0.49446732", "0.49359745", "0.49249077", "0.49145508", "0.49057627", "0.49038038", "0.49009883", "0.48898795", "0.48893586", "0.4884421", "0.4867612", "0.48495755", "0.48481303", "0.48481303", "0.48379737", "0.48315686", "0.48264858", "0.4820597", "0.48200136", "0.4817873", "0.47909325", "0.47903773", "0.47878927", "0.47853917", "0.47834355", "0.47829413", "0.47661656", "0.4765846", "0.47564638", "0.4750257", "0.47232747", "0.4722785", "0.47204503", "0.47147378", "0.4711643", "0.47096783", "0.47000062", "0.46831346", "0.46705863", "0.46697173", "0.4666889", "0.4666889", "0.4666889", "0.4666889", "0.4666889", "0.4666889", "0.46578386", "0.4654223", "0.4650465" ]
0.0
-1
Provides a destructive version of the new +reject+ method.
def reject_with_list_arg!(list, &block) self = reject_with_list_arg(list, &block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reject(&block); end", "def reject(&blk); end", "def reject!(&block); end", "def reject\n throw :reject\n end", "def reject(&block)\n @reject = block if block\n @reject\n end", "def reject\n return enum_for(:reject) if not block_given?\n select { |item| !yield(item) }\n end", "def reject!\n return enum_for(:reject!) if not block_given?\n each { |n| remove(n) if yield n }\n self\n end", "def my_reject(&prc)\n end", "def my_reject(&prc)\n rejection = []\n i = 0\n while i < self.length\n if !prc.call(self[i])\n rejection << self[i]\n end\n i += 1\n end\n return rejection\n end", "def reject(*args, &blk) top.reject(*args, &blk) end", "def reject!\n raise RejectMessage\n end", "def reject(list, &block)\n list.reject(&block)\nend", "def reject!\n return Enumerator.new(self, :reject!) unless block_given?\n select! { |key, obj| !yield(key, obj) }\n end", "def reject!(&block)\n @parameters.reject!(&block)\n self\n end", "def reject!\n self.each do |key, value|\n self.delete[key] if yield(key, value)\n end\n return self\n end", "def reject!\n self.each do |key, value|\n self.delete[key] if yield(key, value)\n end\n return self\n end", "def reject(&block)\n append(Filter.new { |value| ! block.call(value) })\n end", "def reject\n @j_del.reject\n end", "def reject\n C.curry.(->(f, xs) { xs - select.(f, xs) })\n end", "def reject(id)\n end", "def lreject(&blk)\n Enumerator.new do |out|\n self.each do |i|\n out.yield i unless blk.call(i)\n end\n end\n end", "def reject!(&block)\n block or return enum_for(__method__)\n n = size\n delete_if(&block)\n size == n ? nil : self\n end", "def reject!(&b)\n a = reject(&b)\n if a.size == size\n nil # no changes, return nil\n else\n replace(a)\n self\n end\n end", "def reject! &block\n stash.reject! &block\n end", "def reject(reason: nil, **keyword_args)\n append(Reject.new(reason: reason, **keyword_args))\n end", "def reject\n copy self.class.reject(@id)\n true\n end", "def reject\n copy self.class.reject(@id)\n true\n end", "def my_reject(&prc)\n arr = []\n self.my_each { |el| arr << el if !prc.call(el) }\n arr\n end", "def reject\n self['reject']||{}\n end", "def reject error\n mutex.synchronize{ rejecting(error) }\n end", "def reject\n fog_model.reject\n end", "def reject\n transition_to :rejected\n end", "def reject(&block)\n alter do\n @lines = @lines.reject(&block)\n end\n end", "def lazy_reject\n lazify.call(S.reject)\n end", "def my_reject(&prc)\n\t\tnew_array = []\n\n\t\tself.my_each do |ele|\n\t\t\tnew_array << ele if !prc.call(ele)\t\t\t\t\n\t\tend\n\n\t\tnew_array\n\tend", "def reject(reason)\n Q.reject(@reactor, reason)\n end", "def reject!\n super { |r| yield(r) && orphan_resource(r) }\n end", "def my_reject(arr,&prc)\n remainders = []\n arr.each {|el| remainders << el if prc.call(el)}\n remainders\nend", "def reject(*reasons)\n raise Exception.new(\"A once resolved promise can not be rejected later\") if @state == State::RESOLVED\n raise Exception.new(\"A rejected promise can not be rejected again with a different reason (#{@values}, #{reasons})\") if @state == State::REJECTED && reasons != @values\n return nil unless @state == State::PENDING\n\n # If this promise is rejected with another promise, the final reasons are not yet\n # known, so we we register this promise to be rejected once all reasons are resolved.\n raise(TypeError, 'A promise cannot be rejected with itself.') if reasons.include?(self)\n # TODO: reject should not do unwrapping according to https://github.com/getify/You-Dont-Know-JS/blob/master/async%20%26%20performance/ch3.md\n #if reasons.find{ |r| r.is_a?(Promise) }\n # Promise.all(reasons).then(Proc.new{ |reasons| reject(*reasons) }, method(:reject))\n # return\n #end\n\n # Update the state.\n @values = reasons\n @state = State::REJECTED\n\n # Trigger the queued handlers.\n if @handlers.empty?\n # No \"then\"/\"catch\" handlers have been added to the promise.\n unhandled_rejection(*@values)\n else\n # Otherwise: Potentially handlers are awaiting results.\n # If no catch handler is called, the rejection might get unnoticed, so we emit a warning.\n until @handlers.empty?\n handler = @handlers.shift\n if handler.on_reject.respond_to?(:call)\n handle(handler.on_reject, handler.resolve_next, handler.reject_next)\n else\n # No on_reject handler given: equivalent to identity { |reason| raise(reason) }, so we call reject_next\n # See: https://www.promisejs.org/api/#Promise_prototype_then\n if handler.reject_next.respond_to?(:call)\n handler.reject_next.call(*@values)\n end\n end\n end\n end\n # We must return nil, otherwise if this promise is rejected inside the \n # block of an outer Promise, the block would implicitely return a \n # resolved Promise and cause complicated errors.\n return nil\n end", "def reject!(&block)\n ensure_loaded\n ret = nil\n each do |key,value|\n if yield(key,value)\n ret = self\n delete(key)\n end\n end\n ret\n end", "def reject(reason = nil)\n log(2, \"Action: reject: \" + reason.to_s)\n raise DeliveryReject.new(reason.to_s)\n end", "def without(what)\n God.knows \"without #{what}\"\n what = What.is(what)\n what.reject = true\n what\nend", "def reject(reason = nil)\n unless @state == PENDING\n fail PromiseAlreadyResolvedException, 'This promise is already resolved, and you\\'re not allowed to resolve a promise more than once'\n end\n @state = REJECTED\n @value = reason\n @subscribers.each do |subscriber|\n invoke_callback(subscriber[0], subscriber[2])\n end\n end", "def test_0270_reject\n @@log.debug \"test_0270_reject starts\" if @@log.debug?\n assert_respond_to(@list, :reject, \"test_0270_reject_respond\")\n # List false returns\n ta = @list.reject {|obj| (obj.ndata % 2) == 0}\n assert_equal([@bsb, @dad], ta, \"test_0270_reject_eq01\")\n\n @@log.debug \"test_0270_reject ends\" if @@log.debug?\n end", "def reject(&block)\n return to_enum :reject unless block\n\n ary = []\n self.each{|*val|\n ary.push(val.__svalue) unless block.call(*val)\n }\n ary\n end", "def reject(message_id)\n raise NotImplementedError\n end", "def reject!( &block ) # :yields: key, value\n\t\trval = @data.reject!( &block )\n\t\treturn rval\n\tensure\n\t\t@modified = true if rval\n\tend", "def reject!\n n = size\n delete_if { |o| yield(o) }\n size == n ? nil : self\n end", "def reject(&block)\n new_instance_with_inherited_permitted_status(@parameters.reject(&block))\n end", "def call_reject(accpt)\n @accept_model = accpt\n reject!\n end", "def reject!(response_data={})\n @client.post(\"#{path}/reject\", response_data)\n end", "def reject!(&block)\n block or return enum_for(__method__) { size }\n n = size\n delete_if(&block)\n self if size != n\n end", "def reject( & block )\n\n load_parent_state\n \n return super\n\n end", "def reject\n throw :halt, false\n end", "def reject!(&b)\n keys = []\n self.each_key{|k|\n v = self[k]\n if b.call(k, v)\n keys.push(k)\n end\n }\n return nil if keys.size == 0\n keys.each{|k|\n self.delete(k)\n }\n self\n end", "def reject\n hsh = ::Archetype::Hash.new\n self.each do |key, value|\n hsh[key] = value unless yield(key, value)\n end\n return hsh\n end", "def reject\n hsh = ::Archetype::Hash.new\n self.each do |key, value|\n hsh[key] = value unless yield(key, value)\n end\n return hsh\n end", "def reject(&block)\n raise \"Missing block\" unless block\n raise \"filter already called on this experiment\" if @request_filter_block\n\n @request_filter_block = block\n end", "def reject!\n return false if self.approved == true\n self.destroy\n end", "def reject?\r\n\t\tfalse\r\n\tend", "def reject(&b)\n h = {}\n self.each_key{|k|\n v = self[k]\n unless b.call(k, v)\n h[k] = v\n end\n }\n h\n end", "def reject error\n env[TIMER].cancel if env[TIMER]\n mutex.synchronize{ rejecting(error) }\n end", "def assertNot value, message = nil\n __reject value, ASSERT_NOT_ERROR, message, {:value=>value}\n end", "def reject(*)\n super.tap do\n __debug_sim('USER must make change(s) to complete the submission.')\n end\n end", "def flunk(workitem, err_class_or_instance, *err_arguments)\n\n r = remove_workitem('reject', workitem)\n\n return flunk(workitem) if r != nil\n\n workitem.h.delete('_rev')\n\n super(workitem, err_class_or_instance, *err_arguments)\n end", "def reject\n register_change\n PristinePermission.delete(id) unless id.nil?\n end", "def to_reject(value)\r\n only_with_a_string(value) { |value| @rejectable.push(value) }\r\n end", "def reject\n @company = Company.find(params[:id])\n if @company.reject!\n respond_with @company\n else\n respond_with @company, status: :unprocessable_entity\n end\n end", "def reject\n @arguments_references.each { |argument_reference| @connection.objects.reject_reference(argument_reference) }\n end", "def reject_item(array, item_to_reject)\n # Your code here\nend", "def do_reject\n InviteRequest.clear_pending_request_activities(self.user, self.wants_to_join)\n end", "def reject_num(numbers)\r\nreturn numbers.reject { |x| x < 5 }\r\nend", "def reject_without_hooks!( & block )\n\n @without_hooks = true\n\n reject!( & block )\n \n @without_hooks = false\n\n return return_value\n\n end", "def remove\n if status == \"pending\"\n reject\n else\n destroy\n end\n end", "def reject(reason)\n @close_error = reason\n close\n end", "def rejects=(*args)\n @rejects = args.flatten.map(&:to_s)\n end", "def test_reject\n assert_equal(%w[1 2 4 7 8 11 13 14],\n @ab.reject { |res| res.include?('Assign') || res.include?('Buzz') })\n end", "def keep_if\n block_given? or return enum_for(__method__)\n reject { |o| yield o }.each { |o| delete(o) }\n self\n end", "def test_reject\n assert_equal(%w[1 2 4 7 8 11 13 14],\n @kbb.reject { |res| res.include?('Bar') || res.include?('Baz') })\n end", "def reject(*paths)\n match = []; traverse(*paths){|f| match << f unless yield f }; match\n end", "def discard!\n # This should be overridden by concrete adapters.\n end", "def mutating_reject(array)\n i = 0\n loop do\n break if i == array.length\n\n if yield(array[i]) # if array[i] meets the condition checked by the block\n array.delete_at(i)\n else\n i += 1\n end\n end\n\n array\nend", "def reject\n @group_user.reject!\n respond_to do |format|\n flash[:notice] = 'Membership rejected.'\n format.html { redirect_to @group_user.group }\n format.xml { head :ok }\n end\n end", "def catch(on_reject=nil, &block)\n on_reject = block if block_given?\n return self.then(nil, on_reject)\n end", "def reject!(user = nil)\n run_callbacks :rejection do\n self.rejected_at = Time.now\n self.rejecter = user if user\n self.status = 'rejected'\n self.save!\n self.order_items.each(&:reject!)\n deliver_rejected_order_email\n end\n end", "def discard; end", "def discard; end", "def consume_each(&block)\r\n @arr = @arr.reject(&block)\r\n end", "def reject(entry_id)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'entryId', entry_id);\n\t\t\tclient.queue_service_action_call('baseentry', 'reject', kparams);\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil;\n\t\t\tend\n\t\t\treturn client.do_queue();\n\t\tend", "def reject( id, reedo = false, do_amt_reject = false )\n connection.put( \"#{resource_uri}/#{id}/reject\", :headers => { \"Content-Length\" => \"0\" }, :body => { :redo => reedo ? \"true\" : \"false\", :do_amt_reject => do_amt_reject ? \"true\" : \"false\" } )\n end", "def reject!\n self.sampling_priority = Sampling::Ext::Priority::USER_REJECT\n end", "def reject(connection, comment = nil)\n xml = connection.make_xml('VulnerabilityExceptionRejectRequest',\n { 'exception-id' => @id })\n if comment\n cxml = REXML::Element.new('comment')\n cxml.add_text(comment)\n xml.add_element(cxml)\n end\n\n connection.execute(xml, '1.2').success\n end", "def reject(connection, comment = nil)\n xml = connection.make_xml('VulnerabilityExceptionRejectRequest',\n { 'exception-id' => @id })\n if comment\n cxml = REXML::Element.new('comment')\n cxml.add_text(comment)\n xml.add_element(cxml)\n end\n\n connection.execute(xml, '1.2').success\n end", "def reject?(sender)\n false\n end", "def reject?(sender)\n false\n end", "def reject\n\t\t@post =Post.find(params[:id])\n\t\t@request =Request.find_by(post_id: @post.id)\n\tend", "def reject_invite(event)\n invite = Invite.where(user: self, event: event)\n invite.reject if invite.present?\n end", "def rejected!\n # pending => rejected\n if !pending?\n errors.add(:state, :invalid_transition)\n return false\n end\n\n super\n end", "def reject_arr(arr)\n arr.reject{|x| x % 3 == 0}\nend", "def reject\n respond_to do |format|\n if @version.reject!\n UserMailer.rejection_notification(current_user, @version.versionable.node, @version.editor, params[:reason], :host => request.host).deliver if @version.editor\n format.xml { head :ok }\n else\n format.xml { head :internal_server_error }\n end\n end\n end" ]
[ "0.8056053", "0.7999276", "0.77571875", "0.7721478", "0.76465046", "0.7601805", "0.75710267", "0.7369114", "0.72596496", "0.71915877", "0.7160614", "0.70874673", "0.70834696", "0.7003528", "0.68517697", "0.68517697", "0.683299", "0.67969996", "0.67536914", "0.6712829", "0.67064744", "0.6696336", "0.6674834", "0.66625714", "0.6617681", "0.66158783", "0.66158783", "0.6584919", "0.65499604", "0.65424925", "0.65151817", "0.6503457", "0.64922416", "0.64578074", "0.64529455", "0.639001", "0.6326418", "0.63147396", "0.62639576", "0.6238817", "0.6237622", "0.6237181", "0.62195957", "0.6216288", "0.62162554", "0.621035", "0.61878896", "0.6176383", "0.6130646", "0.6129025", "0.6114898", "0.607214", "0.6064828", "0.6046675", "0.60303813", "0.59430236", "0.59430236", "0.59414697", "0.59405786", "0.58867073", "0.58524096", "0.58505017", "0.5822182", "0.5795824", "0.57757586", "0.5703048", "0.56902313", "0.5677952", "0.56748486", "0.5664666", "0.5633305", "0.5628944", "0.5623405", "0.56230474", "0.5607914", "0.560529", "0.55786717", "0.5573558", "0.55571216", "0.5493395", "0.54886055", "0.54782933", "0.54620266", "0.5457213", "0.5454281", "0.5421355", "0.5421355", "0.5413557", "0.54045755", "0.5403148", "0.5382251", "0.53652835", "0.53652835", "0.5349091", "0.5349091", "0.5320361", "0.53147453", "0.5291747", "0.52710783", "0.52558875" ]
0.601969
55
GET /businesses GET /businesses.json
def index @businesses = Business.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @businesses = Business.all.offset(offset).limit(limit)\n render json: @businesses\n end", "def index\n @businesses = @user.businesses.all\n end", "def index\n @user_businesses = Business.where({user_id: current_user.id})\n render json: JSONAPI::Serializer.serialize(@user_businesses, is_collection: true)\n end", "def index\n\t\t@businesses = Business.all\n\tend", "def index\n @businesses = Business.all\n render :index\n end", "def index\n @businesses = @pitch.businesses\n end", "def index\n @businesses = Business.includes(:translations).with_locales(I18n.locale).order('business_translations.name')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @businesses }\n end\n end", "def index\n @buses = Bus.order('leaving_from_id')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @buses }\n end\n end", "def fishing_ground_businesses\n @current_resource.body.resources[:\"fishing-ground-businesses\"].map(&:symbolize_keys)\n end", "def index\n @busgroups = Busgroup.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @busgroups }\n end\n end", "def business_json\n @businesses.as_json(only: [:name, :id], include: { industry: { only: [:id, :name] }})\n end", "def index\n @school_businesses = SchoolBusiness.all\n end", "def index\n @cabines = Cabine.all\n render json: @cabines\n end", "def index\n @buses = Bus.all\n end", "def index\n @buses = Bus.all\n end", "def index\n @businesses = Business.where(customer_id:session[:customer_id])\n end", "def index\n @buisinesses = Buisiness.all\n end", "def index\n #@businesses = Business.paginate(page: params[:page])\n @businesses = Business.all;\n ggeojson = []\n @businesses.each do |business|\n \t ggeojson << {\n \t\ttype: \"Feature\",\n \t\tgeometry: {\n \t\t\ttype: \"Point\",\n \t\t\tcoordinates: [ business.longitude, business.latitude]\n \t\t},\n \t\tproperties:{\n \t\t\ttitle: business.name,\n \t\t\tdescription: business.tagline,\n \t\t\t:'marker-color' => \"#00607d\",\n \t\t\t:'maker-symbol' => \"circle\",\n \t\t\t:'marker-size' => \"medium\"\n \t\t}\n \t} \n end\n @geojson = ggeojson\n end", "def index\n @business_processes = BusinessProcess.all\n\n render json: @business_processes\n end", "def index\n @flight= Flight.find(params[:flight_id])\n @businesses = Business.all\n end", "def getbatteries\n puts params\n buildid = params[\"buildingid\"]\n\n batteries = Battery.where(:building_id => buildid)\n\n puts batteries.inspect\n puts \"#################################################\"\n \n respond_to do |format|\n format.json { render json: batteries }\n end\n end", "def index\n\t\tboats = Boat.all\n \trender json: boats, status: 200\n\tend", "def format_businesses_response(json_data, pagination_data)\n data_hash = JSON.parse(json_data) \n new_hash = { \"businesses\" => data_hash, \"pagination\" => pagination_data }\n new_hash.to_json\n end", "def show\n\n @client = Yelp::Client.new\n\n @request = Location.new(\n :term => @event.topPrefs,\n :zipcode => @event.zip,\n :limit => \"3\"\n #:category_filter => @yelp_search.category_filter,\n #:radius_filter => @yelp_search.radius_filter,\n )\n\n @response = @client.search(@request)\n @businesses = @response.to_h[\"businesses\"]\n end", "def index\n \t#Change to make a response flexible from a query method\n \tresponse = HTTP.auth(\"Bearer #{ENV['YELP_API_KEY']}\").get('https://api.yelp.com/v3/businesses/search?term=coffee&location=nyc')\n \t@yelps = response.parse['businesses']\n end", "def show\n @business = @user.businesses.find(params[:id])\n \n end", "def show\n render json: @business\n end", "def index\n @buses = Bus.where(id: params[:id], event_id: params[:event_id])\n end", "def index\n @q = Business.where([\"user_email = ?\", current_user.email]).ransack(params[:q])\n @businesses = @q.result(distinct: true)\n end", "def index\n @service_bookings = ServiceBooking.all\n\n render json: @service_bookings\n end", "def index\n if params[:search]\n @mybusinesses = Mybusiness.search(params[:search]).order(\"created_at DESC\")\n else\n @mybusinesses = Mybusiness.all.order('created_at DESC')\n end\n end", "def index\n @bounties = Bounty.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @bounties }\n end\n end", "def index\n @matched_businesses = BusinessContactPhone.all\n end", "def index\n @brags = Brag.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @brags }\n end\n end", "def index\n @bus_boardings = BusBoarding.all\n end", "def new\n @bus_route = BusRoute.new\n @break_points=BreakPoint.all\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bus_route }\n end\n end", "def get_brandings\n request :get, \"/v3/brandings.json\"\n end", "def get_banks\n HTTParty.get(BASE_URI + 'bank?country=ghana',\n headers: HEADERS).parsed_response\n end", "def index\n @compte_bancaires = CompteBancaire.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json :@compte_bancaires }\n end\n end", "def index\n @biddings = Bidding.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @biddings }\n end\n end", "def index # returns all bikes within a certain radius\n ## TODO: use coordinates later, when more campuses and bikes.\n # # defaults radius to half mile, and coordinate to requesting ip address\n # radius = params[:radius] ? params[:radius] : 0.5\n # coordinates = params[:coordinates] ? params[:coordinates] : request.location\n # puts coordinates\n # @bikes = Coordinate.near(coordinates, radius).joins(:bikes)\n @bikes = Bike.available\n render json: @bikes\n end", "def my_search(input, latitude, longitude)\r\n\tyelp = yelp_search(input, latitude, longitude)\r\n\t\r\n\treturn '\"error\"' if yelp.nil? || yelp['error']\r\n\t\r\n\tresults = yelp['businesses'].map do |business|\r\n\t\t{\r\n\t\t\tname: business['name'],\r\n\t\t\tid: business['id'],\r\n\t\t\turl: business['url'],\r\n\t\t\trating: business['rating'],\r\n\t\t\tprice: business['price'],\r\n\t\t\tdistance: business['distance'],\r\n\t\t\tlatitude: business['coordinates']['latitude'],\r\n\t\t\tlongitude: business['coordinates']['longitude']\r\n\t\t}\r\n\tend\r\n\t\r\n\tJSON.generate(results)\r\nend", "def index\n @bemaps = Bemap.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bemaps }\n end\n end", "def index\n @reservations = @bus.reservations\n end", "def show\n @basin = Basin.find(params[:id])\n\n @client = YahooWeather::Client.new \n @response = @client.fetch_by_location('Massingir, Gaza, Mz','c')\n @reponse2 = @client.fetch_by_location('Louis Trichardt, Limpopo, South Africa','c')\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @basin }\n\n end\n end", "def post_businesses_lookup(opts = {})\n data, _status_code, _headers = post_businesses_lookup_with_http_info(opts)\n data\n end", "def index\n @busstops = Busstop.all\n end", "def index\n @buisnesses = Buisness.all\n\n render json: @buisnesses \n end", "def index\n @businesstypes = Businesstype.all\n end", "def index\n @banks = Bank.all\n render json: @banks\n end", "def index\n @batting_lines = BattingLine.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @batting_lines }\n end\n end", "def all_booking_of_client\n\t\t@bookings = Booking.where(client_id: params[:client_id])\n\t\trender json: @bookings, status: 200\n\tend", "def current_businesses\r\n ct = Localization::localizer.now()\r\n current_date = ::Date.new(ct.year, ct.month, ct.day)\r\n businesses = []\r\n unit_contracts.each do | uc |\r\n if ( (current_date >= uc.start_date) && \r\n ((uc.end_date.nil?) || (current_date < uc.end_date )) )\r\n businesses << uc.business\r\n end\r\n end\r\n \r\n return businesses\r\n end", "def index\n @businesslines = Businessline.all\n end", "def index\n @coasters = Coaster.all\n\n render json: @coasters\n end", "def index\n render json: @places\n end", "def show\n\n @buses = find_buses\n\n if @buses.empty?\n respond_to do |format|\n format.html { redirect_to edit_location_url(@location), notice: \"No buses within #{@location.acceptable_bus_distance} miles of this location!\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n\n end", "def postal_breweries\n render json: BreweryDb::ShowBreweries.new('postal', params[:postal]).results\n end", "def index\n @bill_cargos = @bill.bill_cargos\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bill_cargos }\n end\n end", "def index\n @suggested_businesses = SuggestedBusiness.all\n end", "def buses\n @buses = Bus.search(params[:source_search], params[:destination_search])\n end", "def get_nearby_businesses(email)\n nearby_restaurants = []\n response = RestClient.get \"https://developers.zomato.com/api/v2.1/search?q=#{self.zomato_cuisines}&lat=#{self.location_lat}&lon=#{self.location_lng}&radius=20000\", accept: :json, 'user-key' => Rails.application.config.zomato_key\n if response.code == 200\n response = JSON.parse(response)\n response['restaurants'].each do |item|\n if item['restaurant']['id'] != self.zomato_restaurant_id.to_s\n nearby_restaurants.push item['restaurant']['id']\n secondary_rest = Scenario.new\n secondary_rest = load_scenario secondary_rest, item\n secondary_rest.email = email\n secondary_rest.save\n end\n end\n self.nearby_restaurants = nearby_restaurants.to_s\n true\n end\n false\n end", "def index\n @bookings = Booking.all\n\n render json: @bookings\n end", "def index\n @companies = Company.all\n if @companies\n render json: {\n companies: @companies\n }\n else\n render json: {\n status: 500,\n errors: ['No companies']\n }\n end\n end", "def index\n contacteds = @business.contacteds\n \n render json: contacteds\n end", "def show\n @bus_route = BusRoute.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bus_route }\n end\n end", "def show\n @business = Business.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @business }\n end\n end", "def show\n @business = Business.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @business }\n end\n end", "def show\n @business = Business.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @business }\n end\n end", "def index\n @places = @site.places.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @places }\n end\n end", "def search(term, location)\n url = \"#{API_HOST}#{SEARCH_PATH}\"\n params = {\n term: term,\n location: location,\n limit: SEARCH_LIMIT\n }\n#this takes info from params hash\n response = HTTP.auth(bearer_token).get(url, params: params)\n response.parse[\"businesses\"]\nend", "def postal_beers\n render json: BreweryDb::ShowBeers.new('postal', params[:postal]).results\n end", "def index\n @business_dashes = BusinessDash.all\n end", "def index\n @regiones = Region.all\n\n render json: @regiones\n end", "def index\n @clubs = Club.all\n render json: @clubs\n end", "def fetchRoutes\n\t\t# Bus routes\n\t #http://api.wmata.com/Bus.svc/json/JRoutes?api_key=YOUR_API_KEY\n\t #\n\t # Bus route details...\n\t #\n\t logger.info \"Fetching, fetching...\"\n\t result = fetchUri(\"http://api.wmata.com/Bus.svc/json/JRoutes?api_key=#{@@apiKey}\")\n\n\t # if the hash has 'Error' as a key, we raise an error\n\t logger.info \"Got some data...\"\n\t if result.has_key? 'Error'\n\t \traise \"JSON error\"\n\t end\n\t logger.info \"No error...\"\n\t result['Routes'].each do |route|\n\t \trouteId=route['RouteID']\n\t \tlogger.info \"Processing route #{routeId}...\"\n\t \trouteData = fetchUri(\"http://api.wmata.com/Bus.svc/json/JRouteDetails?routeId=#{URI.escape(routeId)}&api_key=#{@@apiKey}\")\n\t \t#d.keys: [\"Direction0\", \"Direction1\", \"Name\", \"RouteID\"] \n\t \taddRouteData(routeData)\n \t\tend\n\tend", "def index\n @places = Place.all\n\n respond_to do |format|\n format.html\n format.json { render json: @places }\n end\n end", "def index\n @bus_schedules = BusSchedule.all\n end", "def index\n @bussinesses = Bussiness.paginate(page: params[:page], :per_page => 10)\n end", "def index\n\t\t@clubs = Club.all\n\t\trender json: @clubs\n\tend", "def index\n render json: Bill.all\n end", "def index\n @countries = Country.all\n\n render json: @countries\n end", "def index\n @branch_rooms = Room.get_all_rooms(params[:branch_id])\n \n render json: @branch_rooms\n end", "def index\n @brochures = Brochure.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @brochures }\n end\n end", "def business_summary(lat, lon, bname)\n ret = {\n hours: nil,\n formatted_hours: nil\n }\n return ret if @client.nil?\n\n radius = 100 # improve result to get the correct one\n latlng = lat.to_s + ',' + lon.to_s\n response = @client.search_venues(ll: latlng, radius: radius, query: bname)\n if response.venues.length == 0\n response = @client.search_venues(ll: latlng, query: bname)\n end\n\n if response.venues.length > 0\n hours = @client.venue_hours(response.venues[0].id)\n sum = @client.venue(response.venues[0].id)\n\n ret = {\n hours: hours.hours,\n formatted_hours: sum.hours\n } unless hours.nil? || sum.nil?\n end\n ret\n end", "def beacons\n response = request(:get, \"/beacon\")\n response_to_array(response, \"beacons\", KontaktIo::Resource::Beacon)\n end", "def index\n @buses = Bus.order('created_at DESC').paginate(:page => params[:page], :per_page => 20)\n end", "def index\n @boredoms = Boredom.all\n end", "def index\n @businesses = Business.paginate :per_page => 10, :page => params[:page] || 1, :order => [\"updated_at DESC\"], :conditions => ['status = \"Publicado\"']\n respond_to do |format|\n format.html\n end\n end", "def get_batterie_by_building\n @battery = Battery.where(building_id: params[:building_id])\n respond_to do |format| \n format.json { render :json => @battery }\n end\n \n end", "def index\n @bronies = Brony.all\n end", "def index\n @blocks = Block.all\n\n render json: @blocks\n end", "def get_battery\n if params[:building].present?\n @batteries = Building.find(params[:building]).batteries\n else\n @batteries = Building.all\n end\n if request.xhr?\n respond_to do |format|\n format.json {\n render json: {batteries: @batteries}\n }\n end\n end\n end", "def index\n @contracts = Contract.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contracts }\n end\n end", "def index\n @service_schedules = ServiceSchedule.all\n\n render json: @service_schedules\n end", "def index\n @countries = Country.all\n json_response(@countries)\n end", "def index\n @zones = Zone.all\n\n render json: @zones\n end", "def index\n @schedule_blocks = ScheduleBlock.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @schedule_blocks }\n end\n end" ]
[ "0.7400743", "0.7197552", "0.7160107", "0.71516067", "0.68540794", "0.65826195", "0.6515095", "0.6439602", "0.6375034", "0.63264203", "0.62786835", "0.624988", "0.6246235", "0.6220708", "0.6220708", "0.620454", "0.6173559", "0.61406076", "0.61128026", "0.6089432", "0.6082277", "0.6045672", "0.6016622", "0.59896785", "0.5979576", "0.59251857", "0.59250486", "0.5912462", "0.5907026", "0.5905406", "0.5899058", "0.5898644", "0.58811903", "0.58768165", "0.5865645", "0.5862289", "0.5857649", "0.5849697", "0.58489573", "0.5845122", "0.58406264", "0.5836281", "0.58231544", "0.5813216", "0.5802912", "0.5792977", "0.57885224", "0.57851994", "0.5784115", "0.5775166", "0.57726693", "0.57695895", "0.57669985", "0.5750071", "0.5730147", "0.5719594", "0.57121956", "0.5691673", "0.5681778", "0.56767637", "0.56733906", "0.56709254", "0.5664269", "0.5657025", "0.56387407", "0.56382024", "0.5627378", "0.5627378", "0.5627378", "0.5611971", "0.56116235", "0.5600939", "0.5600758", "0.55992585", "0.5593237", "0.55927515", "0.5592737", "0.558752", "0.5580277", "0.55786026", "0.55772614", "0.5574305", "0.55634075", "0.5563017", "0.5562473", "0.5557256", "0.55479985", "0.55418277", "0.5537012", "0.55314314", "0.55309874", "0.5530957", "0.55239046", "0.55227745", "0.5506143", "0.5505386", "0.54987276", "0.54965025" ]
0.71204215
6
PATCH/PUT /businesses/1 PATCH/PUT /businesses/1.json
def update respond_to do |format| if @business.update(business_params) format.html { redirect_to businesses_path, notice: 'Business was successfully updated.' } format.json { render :index, status: :ok } else format.html { render :edit } format.json { render json: @business.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @businesstype = Businesstype.find(params[:id])\n\n respond_to do |format|\n if @businesstype.update_attributes(params[:businesstype])\n format.html { redirect_to @businesstype, notice: 'Businesstype was successfully updated.' }\n format.json { render :show, status: :ok, location: @businesstype }\n else\n format.html { render :edit }\n format.json { render json: @businesstype.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @business = @user.businesses.find(params[:id])\n respond_to do |format|\n if @business.update(business_params)\n format.html { redirect_to edit_user_business_path(@user, @business), notice: 'Business was successfully updated.' }\n format.json { render :show, status: :ok, location: @business }\n else\n format.html { render :edit }\n format.json { render json: @business.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @business = Business.find(params[:id])\n\n respond_to do |format|\n if @business.update_attributes(business_params)\n format.html { redirect_to businesses_path, notice: I18n.t('commons.successfully_updated') }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @business.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bus.update(bus_params)\n format.html { redirect_to bus_owners_bus_path(@bus), notice: 'Bus was successfully updated.' }\n format.json { render :show, status: :ok, location: @bus }\n else\n format.html { render :edit }\n format.json { render json: @bus.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bus.update(bus_params)\n format.html { redirect_to @bus, notice: 'Bus was successfully updated.' }\n format.json { render :show, status: :ok, location: @bus }\n else\n format.html { render :edit }\n format.json { render json: @bus.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @bus_route = BusRoute.find(params[:id])\n \n respond_to do |format|\n if @bus_route.update_attributes(params[:bus_route])\n format.html { redirect_to @bus_route, notice: 'Bus route was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bus_route.errors, status: :unprocessable_entity }\n end\n end\n end", "def putBusiness( name, building_number, branch_name, address1, address2, address3, district, town, county, province, postcode, country, latitude, longitude, timezone, telephone_number, additional_telephone_number, email, website, category_id, category_type, do_not_display, referrer_url, referrer_name, destructive, delete_mode, master_entity_id)\n params = Hash.new\n params['name'] = name\n params['building_number'] = building_number\n params['branch_name'] = branch_name\n params['address1'] = address1\n params['address2'] = address2\n params['address3'] = address3\n params['district'] = district\n params['town'] = town\n params['county'] = county\n params['province'] = province\n params['postcode'] = postcode\n params['country'] = country\n params['latitude'] = latitude\n params['longitude'] = longitude\n params['timezone'] = timezone\n params['telephone_number'] = telephone_number\n params['additional_telephone_number'] = additional_telephone_number\n params['email'] = email\n params['website'] = website\n params['category_id'] = category_id\n params['category_type'] = category_type\n params['do_not_display'] = do_not_display\n params['referrer_url'] = referrer_url\n params['referrer_name'] = referrer_name\n params['destructive'] = destructive\n params['delete_mode'] = delete_mode\n params['master_entity_id'] = master_entity_id\n return doCurl(\"put\",\"/business\",params)\n end", "def update\n\t\trespond_to do |format|\n\t\t\tif @business.update(business_params)\n\t\t\t\tformat.html { redirect_to @business, notice: 'Business Line was successfully updated.' }\n\t\t\t\tformat.json { render json: @business.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def update\n respond_to do |format|\n if @bus.update(bus_params)\n format.html { redirect_to event_bus_path(@bus.event, @bus), notice: 'Bus was successfully updated.' }\n format.json { render :show, status: :ok, location: @bus }\n else\n format.html { render :edit }\n format.json { render json: @bus.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @business = Business.find(params[:id])\n\n respond_to do |format|\n if @business.update_attributes(params[:business])\n format.html { redirect_to aciton: \"index\"}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @business.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 @business = Business.find(params[:id])\n respond_to do |format|\n if @business.update(business_params)\n format.html { redirect_to @business, notice: 'Business was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @business.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @boat.update(boat_params)\n head :no_content\n else\n render json: @boat.errors, status: :unprocessable_entity\n end\n end", "def update\n @business = Business.find(params[:id])\n authorize! :update, @business\n\n respond_to do |format|\n if @business.update_attributes(business_params || {})\n format.html { redirect_to business_path(@business), notice: 'Business was successfully updated.' }\n format.json do\n respond_with_bip(@business.becomes(Business), param: param_key)\n end\n else\n format.html { render action: \"edit\" }\n format.json do\n respond_with_bip(@business.becomes(Business), param: param_key)\n end\n end\n end\n end", "def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end", "def update\n respond_to do |format|\n if @busca.update(busca_params)\n format.html { redirect_to @busca, notice: 'Busca was successfully updated.' }\n format.json { render :show, status: :ok, location: @busca }\n else\n format.html { render :edit }\n format.json { render json: @busca.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @bus_service = BusService.find(params[:id],:include => :students)\n\n respond_to do |format|\n if @bus_service.update_attributes(params[:bus_service])\n format.html { redirect_to(@bus_service, :notice => 'BusService was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bus_service.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @business.update(business_params)\n format.html { redirect_to @business, notice: 'Business was successfully updated.' }\n format.json { render :show, status: :ok, location: @business }\n else\n format.html { render :edit }\n format.json { render json: @business.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @business.update(business_params)\n format.html { redirect_to @business, notice: 'Business was successfully updated.' }\n format.json { render :show, status: :ok, location: @business }\n else\n format.html { render :edit }\n format.json { render json: @business.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @business.update(business_params)\n format.html { redirect_to @business, notice: 'Business was successfully updated.' }\n format.json { render :show, status: :ok, location: @business }\n else\n format.html { render :edit }\n format.json { render json: @business.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @business.update(business_params)\n format.html { redirect_to @business, notice: 'Business was successfully updated.' }\n format.json { render :show, status: :ok, location: @business }\n else\n format.html { render :edit }\n format.json { render json: @business.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @business.update(business_params)\n format.html { redirect_to @business, notice: 'Business was successfully updated.' }\n format.json { render :show, status: :ok, location: @business }\n else\n format.html { render :edit }\n format.json { render json: @business.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @business_object = BusinessObject.find(params[:id])\n\n respond_to do |format|\n if @business_object.update_attributes(params[:business_object])\n format.html { redirect_to @business_object, :notice => 'Business object was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @business_object.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @setbreak.update(setbreak_params)\n format.json { respond_with_bip @setbreak }\n else\n format.json { respond_with_bip @setbreak }\n end\n end\n end", "def update\n @bus_seat_type = BusSeatType.find(params[:id])\n\n respond_to do |format|\n if @bus_seat_type.update_attributes(params[:bus_seat_type])\n format.html { redirect_to @bus_seat_type, notice: 'Bus seat type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bus_seat_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end", "def update\n @bus = Bus.find(params[:id])\n\n respond_to do |format|\n if @bus.update_attributes(params[:bus])\n format.html { redirect_to(@bus, :notice => 'Bus was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bus.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @business = Business.find(params[:id])\n\n respond_to do |format|\n if @business.update_attributes(params[:business])\n format.html { redirect_to admin_business_path(@business), notice: 'Business was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @business.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bussiness.update(bussiness_params)\n format.html { redirect_to current_user, notice: 'Business was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bussiness.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @schedule = Schedule.find(params[:id])\n @client_branches = ClientBranch.where(:client_id => params[:schedule][:client_id])\n respond_to do |format|\n if @schedule.update_attributes(params[:schedule])\n format.html { redirect_to @schedule, notice: 'Schedule was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @businessline.update(businessline_params)\n format.html { redirect_to @businessline, notice: 'Businessline was successfully updated.' }\n format.json { render :show, status: :ok, location: @businessline }\n else\n format.html { render :edit }\n format.json { render json: @businessline.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @businessbook = Businessbook.find(params[:id])\n\n respond_to do |format|\n if @businessbook.update_attributes(params[:businessbook])\n format.html { redirect_to @businessbook, :notice => 'Businessbook was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @businessbook.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bus_boarding.update(bus_boarding_params)\n format.html { redirect_to @bus_boarding, notice: 'Bus boarding was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bus_boarding.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bus_schedule.update(bus_schedule_params)\n format.html { redirect_to @bus_schedule, notice: 'Bus schedule was successfully updated.' }\n format.json { render :show, status: :ok, location: @bus_schedule }\n else\n format.html { render :edit }\n format.json { render json: @bus_schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @boc.update(boc_params)\n format.html { redirect_to @boc, notice: 'Boc was successfully updated.' }\n format.json { render :show, status: :ok, location: @boc }\n else\n format.html { render :edit }\n format.json { render json: @boc.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # { clinic: {id: references, \"license_id\"=>nil, \"name\"=>string } }\n \n if @clinic.update_attributes(params[:clinic].except(:api_license_id))\n head :no_content\n else\n render json: clinic.errors.full_messages, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @busstop.update(busstop_params)\n format.html { redirect_to @busstop, notice: 'Busstop was successfully updated.' }\n format.json { render :show, status: :ok, location: @busstop }\n else\n format.html { render :edit }\n format.json { render json: @busstop.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @agency = Agency.find(params[:id])\n\n if @agency.update(agency_params)\n #head :no_content\n render json: @agency, status: :accepted, location: @agency #sera? status accepted? \n else\n render json: @agency.errors, status: :unprocessable_entity\n end\n end", "def update\n\n respond_to do |format|\n if @company_business.update_attributes(params[:company_business])\n format.html { redirect_to @company_business, notice: 'Company business was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company_business.errors, status: :unprocessable_entity }\n end\n end\n end", "def putBusinessJson( json, country, timezone, master_entity_id, queue_priority)\n params = Hash.new\n params['json'] = json\n params['country'] = country\n params['timezone'] = timezone\n params['master_entity_id'] = master_entity_id\n params['queue_priority'] = queue_priority\n return doCurl(\"put\",\"/business/json\",params)\n end", "def update\n budgets = update_budgets(params[:budgets])\n\n render json: budgets, status: :ok\n end", "def update\n respond_to do |format|\n if @bride.update(bride_params)\n format.html { redirect_to @bride, notice: 'Bride was successfully updated.' }\n format.json { render :show, status: :ok, location: @bride }\n else\n format.html { render :edit }\n format.json { render json: @bride.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n client=Client.find_by_id params[:id]\n if client!= nil\n client.cedula=params[:cedula] ? params[:cedula]: client.cedula\n client.sector=params[:sector] ? params[:sector]: client.sector\n client.nombre=params[:nombre] ? params[:nombre]: client.nombre\n client.telefono=params[:telefono] ? params[:telefono]: client.telefono\n client.pagina=params[:pagina] ? params[:pagina]: client.pagina\n client.direccion=params[:direccion] ? params[:direccion]: client.direccion\n if client.save\n render(json: client, status: 201)\n end \n else\n render(json: client.errors, status: 404)\n end \n end", "def jsonapi_update!(attributes)\n assign_jsonapi_attributes(attributes)\n save!\n end", "def update\n respond_to do |format|\n if @mybusiness.update(mybusiness_params)\n format.html { redirect_to @mybusiness, notice: 'Mybusiness was successfully updated.' }\n format.json { render :show, status: :ok, location: @mybusiness }\n else\n format.html { render :edit }\n format.json { render json: @mybusiness.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @osoba = Osoba.find(params[:id])\n\n if @osoba.update(params[:osoba])\n head :no_content\n else\n render json: @osoba.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @branch.update(branch_params.map{|k,v| {k.to_sym => v.to_s}.except!(:contact_attributes,:address_attributes) }.reduce({}, :merge)) && @branch.address.update(branch_params[:address_attributes]) && @branch.contact.update(branch_params[:contact_attributes])\n format.html { redirect_to @branch, notice: 'Branch was successfully updated.' }\n format.json { render :show, status: :ok, location: @branch }\n else\n format.html { render :edit }\n format.json { render json: @branch.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def update\n respond_to do |format|\n if @business.update(business_params)\n format.html { redirect_to [@pitch, @business], notice: 'Modelo de Negócio Atualizado com Sucesso!' }\n format.json { render :show, status: :ok, location: @business }\n else\n format.html { render :edit }\n format.json { render json: @business.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bourbon.update(bourbon_params)\n format.html { redirect_to @bourbon, notice: 'Bourbon was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bourbon.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @brave_burst.update(brave_burst_params)\n format.html { redirect_to @brave_burst, notice: 'Brave burst was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @brave_burst.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @brony.update(brony_params)\n format.html { redirect_to @brony, notice: 'Brony was successfully updated.' }\n format.json { render :show, status: :ok, location: @brony }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @brony.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bus_type.update(bus_type_params)\n format.html { redirect_to bus_type_path(@bus_type.slug), notice: \"#{_('Bus type')} #{_('was successfully')} #{_('updated')}.\" }\n format.json { render :show, status: :ok, location: @bus_type }\n else\n format.html {\n add_breadcrumb :edit, edit_bus_type_path(@bus_type.slug)\n render :edit\n }\n format.json { render json: @bus_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @broad = Broad.find(params[:id])\n\n respond_to do |format|\n if @broad.update_attributes(params[:broad])\n format.html { redirect_to @broad, notice: 'Broad was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @broad.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n render json: Location.update(params[\"id\"], params[\"location\"])\n end", "def update\n if params[:schedule]\n params[:schedule][:bookings] = Bookings.find(params[:schedule][:bookings])\n else\n params[:schedule] = {}\n params[:schedule][:bookings] = @schedule.bookings\n params[:schedule][:bookings] << Booking.find(params[:add_bookings]) if params[:add_bookings]\n params[:schedule][:bookings].reject! { |e| params[:remove_bookings].include? e.id.to_s } if params[:remove_bookings]\n params[:schedule][:bookings] = params[:schedule][:bookings].flatten\n end\n respond_to do |format|\n if @schedule.update_attributes(params[:schedule])\n format.html { redirect_to @schedule, notice: 'Schedule was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @beacon = Beacon.find(params[:id])\n\n respond_to do |format|\n if @beacon.update_attributes(params[:beacon])\n format.html { redirect_to @beacon, notice: 'Beacon was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @beacon.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @person.seat\n render json: {errors: 'Cannot update a seated person'}, status: 422\n else\n @person.update person_params\n render json: @person\n end\n end", "def update\n respond_to do |format|\n if @boat.update(boat_params)\n format.html { redirect_to @boat, notice: 'Boat was successfully updated.' }\n format.json { render :show, status: :ok, location: @boat }\n else\n format.html { render :edit }\n format.json { render json: @boat.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @boat.update(boat_params)\n format.html { redirect_to @boat, notice: 'Boat was successfully updated.' }\n format.json { render :show, status: :ok, location: @boat }\n else\n format.html { render :edit }\n format.json { render json: @boat.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @boat.update(boat_params)\n format.html { redirect_to @boat, notice: 'Boat was successfully updated.' }\n format.json { render :show, status: :ok, location: @boat }\n else\n format.html { render :edit }\n format.json { render json: @boat.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @buisiness = Buisiness.find(params[:id])\n respond_to do |format|\n if @buisiness.update(buisiness_params)\n format.html { redirect_to @buisiness, notice: 'Buisiness was successfully updated.' }\n format.json { render :show, status: :ok, location: @buisiness }\n else\n format.html { render :edit }\n format.json { render json: @buisiness.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @business_type = BusinessType.find(params[:id])\n\n respond_to do |format|\n if @business_type.update_attributes(params[:business_type])\n format.html { redirect_to @business_type, notice: 'Business type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @business_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @todo = Todo.find(params[:id])\n @todo.update_attributes(params[:todo])\n render :json => @todo\n end", "def update\n respond_to do |format|\n if @ipc_boeing.update(ipc_boeing_params)\n format.html { redirect_to @ipc_boeing, notice: 'Ipc boeing was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ipc_boeing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @boredom.update(boredom_params)\n format.html { redirect_to @boredom, notice: 'Boredom was successfully updated.' }\n format.json { render :show, status: :ok, location: @boredom }\n else\n format.html { render :edit }\n format.json { render json: @boredom.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n put :update\n end", "def update\n respond_to do |format|\n if @business_owner.update(business_owner_params)\n format.html { redirect_to @business_owner, notice: 'Business owner was successfully updated.' }\n format.json { render :show, status: :ok, location: @business_owner }\n else\n format.html { render :edit }\n format.json { render json: @business_owner.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bingo.update(bingo_params)\n format.html { redirect_to @bingo, notice: \"Bingo was successfully updated.\" }\n format.json { render :show, status: :ok, location: @bingo }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @bingo.errors, status: :unprocessable_entity }\n end\n end\n end", "def restobooking\n @buchung = Buchung.find(params[:id])\n @buchung.status='B' \n \n respond_to do |format|\n if @buchung.update_attributes(params[:buchung])\n format.html { redirect_to @buchung, notice: 'Buchung wurde erfolgreich geaendert.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @buchung.errors, status: :unprocessable_entity }\n end\n end \n end", "def update\n @business_sector = BusinessSector.find(params[:id])\n\n respond_to do |format|\n if @business_sector.update_attributes(params[:business_sector])\n format.html { redirect_to @business_sector, notice: 'Business sector was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @business_sector.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @client.update(client_params)\n render json: @client\n end", "def update\n @agency = Agency.find(params[:id])\n\n if @agency.update(agency_params)\n #head :no_content\n render json: @agency, status: :accepted, location: @agency #sera? status accepted? \n else\n render json: @agency.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @billable.update(billable_params)\n format.html { redirect_to @billable, notice: 'Billable was successfully updated.' }\n format.json { render :show, status: :ok, location: @billable }\n else\n format.html { render :edit }\n format.json { render json: @billable.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_by_body\n @person = Person.find(person_update_params[:id])\n\n if @person.update_attributes(person_update_params)\n render json: { status: 'PUT Success' }, status: :ok\n else\n render json: { status: 'Error', message:'Error updating person', person: @person.errors }, status: :unprocessable_entity\n end\n end", "def update\n\trespond_to do |format|\n\tif @precio_boleto.update(precio_boleto_params)\n\t\tformat.html { redirect_to @precio_boleto, notice: 'Precio boleto was successfully updated.' }\n\t\tformat.json { head :no_content }\n\telse\n\t\tformat.html { render action: 'edit' }\n\t\tformat.json { render json: @precio_boleto.errors, status: :unprocessable_entity }\n\tend\n\tend\nend", "def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", {\"passed\" => success}.to_json, :content_type => :json\nend", "def update\n @todo = Todo.find(params[:id])\n if @todo.update_attributes(todo_params)\n render json: @todo, status: :ok\n else\n render json: @todo.errors, status: 422\n end\n end", "def update\n @registro_bovino = RegistroBovino.find(params[:id])\n\n respond_to do |format|\n if @registro_bovino.update_attributes(params[:registro_bovino])\n #format.html { redirect_to @registro_bovino, notice: 'Registro bovino was successfully updated.' }\n format.html { redirect_to action: \"index\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @registro_bovino.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @bruschettum = Bruschettum.find(params[:id])\n @bruschettum.ingredients.clear\n params[:ingredient].each{|ingr|\n @bruschettum.ingredients << Ingredient.find_by_name(ingr)\n }\n\n respond_to do |format|\n if @bruschettum.update_attributes(params[:bruschettum])\n format.html { redirect_to @bruschettum, notice: 'Bruschettum was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bruschettum.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @basin = Basin.find(params[:id])\n\n respond_to do |format|\n if @basin.update_attributes(params[:basin])\n format.html { redirect_to @basin, notice: 'Basin was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @basin.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @address.update(address_params)\n render json: @address\n else\n render json: @address.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @bond.update(bond_params)\n format.html { redirect_to bonds_path, notice: I18n.t('messages.updated_with', item: @bond.company) }\n format.json { render :show, status: :ok, location: @bond }\n else\n format.html { render :edit }\n format.json { render json: @bond.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ball_flight_item = BallFlightItem.find(params[:id])\n\n respond_to do |format|\n if @ball_flight_item.update_attributes(params[:ball_flight_item])\n format.html { redirect_to @ball_flight_item, notice: 'Ball flight item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ball_flight_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @vehicle_boat_part.update(vehicle_boat_part_params)\n format.html { redirect_to @vehicle_boat_part, notice: 'Vehicle boat part was successfully updated.' }\n format.json { render :show, status: :ok, location: @vehicle_boat_part }\n else\n format.html { render :edit }\n format.json { render json: @vehicle_boat_part.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n #@business_segment = BusinessSegment.find(params[:id])\n\n respond_to do |format|\n if @business_segment.update_attributes(params[:business_segment])\n format.html { redirect_to @business_segment, notice: 'Business segment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @business_segment.errors, status: :unprocessable_entity }\n end\n end\n end", "def put!\n request! :put\n end", "def update\n @bb = Bb.find(params[:id])\n\n respond_to do |format|\n if @bb.update_attributes(params[:bb])\n format.html { redirect_to @bb, notice: 'Bb was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bb.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @bowl = Bowl.find(params[:id])\n \n # set bowl modify time\n @bowl.modified = Time.now\n \n respond_to do |format|\n if @bowl.update_attributes(params[:bowl])\n \n Rails.logger.info \"Updating Bowl Contents\"\n \n # remove all contents for this bowl and add new\n @bowl.contents.delete_all(\"bowl_id=\" + @bowl.id)\n \n params.keys.each do |param|\n if param.start_with?(\"input_\") and (params[param] != \"\") \n @bowl.contents.create(:bowl_id => @bowl.id, :dryfruit_id => param[6, 2], :quantity => params[param]) \n end\n end\n\n format.html { redirect_to bowls_path, :notice => 'Bowl was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @bowl.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @boite.update(boite_params)\n format.html { redirect_to @boite, notice: 'Boite was successfully updated.' }\n format.json { render :show, status: :ok, location: @boite }\n else\n format.html { render :edit }\n format.json { render json: @boite.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @serving = Serving.find(params[:id])\n\n respond_to do |format|\n if @serving.update_attributes(params[:serving])\n format.html { redirect_to @serving, notice: 'Serving was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @serving.errors, status: :unprocessable_entity }\n end\n end\n end", "def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end", "def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end", "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end", "def update\n respond_to do |format|\n if @street.update(street_params)\n format.html { redirect_to @street, notice: 'Street was successfully updated.' }\n format.json { render :show, status: :ok, location: @street }\n else\n format.html { render :edit }\n format.json { render json: @street.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n begin\n @busgroup = Busgroup.find(params[:id])\n @busgroup.mypclient_id = session[:client_id]\n @busgroup.busgroupcode = params[:group_code].upcase.strip\n @busgroup.description = params[:description].strip\n @busgroup.lastupdateby = session[:username]\n\n if @busgroup.save \n @@request_result[:success] = true\n @@request_result[:notice] = 'Business Group successfully updated.'\n else\n @@request_result[:errormsg] = @busgroup.errors.full_messages[0]\n end\n rescue Exception => e\n @@request_result[:errormsg] = e.message\n end\n render json: @@request_result\n end", "def update\n respond_to do |format|\n if @bounty.update(bounty_params)\n format.html { redirect_to @bounty, notice: 'Bounty was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bounty.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @location.update(location_params)\n if @location.dt_devolucao.nil?\n else\n @vehicle = Vehicle.find_by(id: @location.vehicle_id)\n @client = Client.find_by(id: @location.client_id)\n \n @vehicle.update_attribute(:status, 'DISPONÍVEL')\n @client.update_attribute(:status, 'DISPONÍVEL')\n end\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 @borrower_request.update(borrower_request_params)\n @borrower_request.update_attributes(place: JSON.parse(params[:borrower_request][:place].gsub('=>', ':')))\n format.html { redirect_to @borrower_request, notice: 'Borrower request was successfully updated.' }\n format.json { render :show, status: :ok, location: @borrower_request }\n else\n format.html { render :edit }\n format.json { render json: @borrower_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bacon.update(bacon_params)\n format.html { redirect_to @bacon, notice: 'Bacon was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bacon.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.66081786", "0.6493838", "0.6349723", "0.633397", "0.6246713", "0.6232901", "0.62016004", "0.6192224", "0.61865616", "0.6159051", "0.6112868", "0.60710156", "0.6051207", "0.60199416", "0.60014904", "0.5925034", "0.59224087", "0.5908766", "0.5908766", "0.5908766", "0.5908766", "0.590804", "0.5894156", "0.5882057", "0.5870551", "0.58686984", "0.58654946", "0.58352315", "0.5820986", "0.581778", "0.58044213", "0.5798796", "0.5747176", "0.57293254", "0.5717755", "0.5690892", "0.5687491", "0.5685036", "0.56831944", "0.5665297", "0.566477", "0.56329644", "0.56132495", "0.5597269", "0.55765647", "0.5574335", "0.5574248", "0.5562272", "0.5560139", "0.5553007", "0.55439097", "0.5541191", "0.55402714", "0.5535056", "0.5528844", "0.5512728", "0.5511421", "0.55071914", "0.55003643", "0.55003643", "0.55003643", "0.5498958", "0.54989505", "0.54950947", "0.5492876", "0.5492391", "0.5490689", "0.54857475", "0.5483063", "0.5481987", "0.5478994", "0.5475652", "0.54737526", "0.5471734", "0.5470134", "0.54649925", "0.5460919", "0.54586816", "0.5457652", "0.54572713", "0.54553986", "0.54544675", "0.54468524", "0.5444971", "0.543981", "0.54360646", "0.54348785", "0.54345983", "0.54335284", "0.5426862", "0.54239106", "0.54234755", "0.54234755", "0.54219174", "0.54197896", "0.54154384", "0.54145575", "0.5410572", "0.5407793", "0.54076993" ]
0.62294775
6
Use callbacks to share common setup or constraints between actions.
def set_business @business = Business.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_handler\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 set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def workflow\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def setup\n # override and do something appropriate\n end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def 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 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 before_action \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 setup_signals; end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n 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 after_set_callback; end", "def initialize(*args)\n super\n @action = :set\nend", "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 around_hooks; 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 save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def call\n setup_context\n super\n end", "def duas1(action)\n action.call\n action.call\nend", "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.6163754", "0.6045816", "0.5944853", "0.59169096", "0.58892167", "0.58342934", "0.5776148", "0.57057375", "0.57057375", "0.56534296", "0.56209534", "0.54244673", "0.54101455", "0.54101455", "0.54101455", "0.53951085", "0.5378493", "0.53563684", "0.53399915", "0.5338049", "0.53307265", "0.5312121", "0.5298173", "0.5296388", "0.52952695", "0.5258086", "0.52430934", "0.5237911", "0.5237911", "0.5237911", "0.5237911", "0.5237911", "0.52335346", "0.5232943", "0.5226392", "0.52221715", "0.5217978", "0.52136153", "0.52076435", "0.52067244", "0.5175402", "0.5174649", "0.5173085", "0.5165201", "0.5162052", "0.5157932", "0.5152905", "0.5152353", "0.5150909", "0.514719", "0.5138596", "0.51333916", "0.51139015", "0.5113431", "0.5113431", "0.5109581", "0.51066816", "0.5091428", "0.5089407", "0.5082971", "0.50822043", "0.50668514", "0.5055155", "0.50525695", "0.50499475", "0.50499475", "0.5034445", "0.50249445", "0.5022226", "0.50167644", "0.5014211", "0.4999924", "0.49996212", "0.49978727", "0.4989682", "0.4989682", "0.49851838", "0.49817684", "0.4979687", "0.49787104", "0.49688423", "0.49664098", "0.49564412", "0.49561828", "0.49547398", "0.4953481", "0.4952925", "0.4946049", "0.494379", "0.49319315", "0.49313048", "0.49269778", "0.49263066", "0.49257493", "0.4924526", "0.49212465", "0.49173486", "0.4915802", "0.49151486", "0.49150333", "0.49147308" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def business_params params.require(:business).permit(:name, :price) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def safe_params\n params.require(:user).permit(:name)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def filtering_params\n params.permit(:email)\n end", "def active_code_params\n params[:active_code].permit\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def list_params\n params.permit(:name)\n end", "def filter_parameters; end", "def filter_parameters; end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def url_whitelist; end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def permit_request_params\n params.permit(:address)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def url_params\n params[:url].permit(:full)\n end", "def backend_user_params\n params.permit!\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "0.6978086", "0.6780264", "0.6742658", "0.6738813", "0.67338693", "0.65908474", "0.6501793", "0.6495506", "0.64796513", "0.64755446", "0.6454826", "0.6437561", "0.6377127", "0.63722163", "0.6364058", "0.63178706", "0.62979764", "0.62968165", "0.62913024", "0.6289789", "0.6289145", "0.62875307", "0.6280997", "0.62420976", "0.62388235", "0.6216686", "0.62122375", "0.6208949", "0.619173", "0.6176307", "0.6173907", "0.6170346", "0.616111", "0.6150513", "0.6150023", "0.61446756", "0.6120429", "0.6112975", "0.6104845", "0.6102966", "0.6087884", "0.6079323", "0.60699135", "0.60602236", "0.60191786", "0.60170597", "0.60100305", "0.6009527", "0.60052776", "0.60052776", "0.600042", "0.5999317", "0.59933805", "0.5991528", "0.5991221", "0.5990094", "0.5979497", "0.5966058", "0.5958738", "0.59579456", "0.5957759", "0.5956938", "0.5951788", "0.59511644", "0.59423065", "0.59373474", "0.59361076", "0.59361076", "0.59331447", "0.5928005", "0.5924882", "0.5924011", "0.59169155", "0.5908037", "0.5907541", "0.59061426", "0.59056246", "0.5897408", "0.58960444", "0.58951247", "0.5893136", "0.5892312", "0.5890385", "0.58853275", "0.58801144", "0.58784765", "0.5872648", "0.58682626", "0.5867028", "0.58661693", "0.586578", "0.58643955", "0.5863193", "0.58609086", "0.5859997", "0.5858935", "0.5858632", "0.5853379", "0.5852741", "0.584806", "0.5847703" ]
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_grade @grade = Grade.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 grade_params params.require(:grade).permit(:assignment_name, :grade, :student_id, :teacher_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n 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
Place an order without requiring a cart.
def place raise CatalogAPI::Error, 'No Items' if items.nil? || items.length.zero? raise CatalogAPI::Error, 'No Socket ID' if items.first.socket_id.nil? raise CatalogAPI::Error, 'No First Name' if first_name.nil? raise CatalogAPI::Error, 'No Last Name' if last_name.nil? raise CatalogAPI::Error, 'No Adress1' if address_1.nil? raise CatalogAPI::Error, 'No City' if city.nil? raise CatalogAPI::Error, 'No State' if state_province.nil? raise CatalogAPI::Error, 'No Postal Code' if postal_code.nil? raise CatalogAPI::Error, 'No Country' if country.nil? raise CatalogAPI::Error, 'No Items' if items.nil? request = CatalogAPI.request.new(:order_place) request.post(place_params(request)) json = request.json.dig(:order_place_response, :order_place_result) request.data = CatalogAPI::Order.new(json) request end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def place_order!()\n if has_order_items?\n order_template = order_object\n order_template = yield order_object if block_given?\n\n @virtual_server.softlayer_client[:Product_Order].placeOrder(order_template)\n end\n end", "def place_buy_order(price, amount)\n @log.info \"placing buy order for price: #{price}, amount: #{amount}\"\n @api.place_order('buy', amount, price, @couple)\n end", "def create_order(order)\n build_persisted_order(\n post('/market/orders', order.symbolize_keys.merge(side: SIDES_MAP.fetch(order.fetch(:side))))\n )\n end", "def place_sell_order(price, amount)\n @log.info \"placing sell order for price: #{price}, amount: #{amount}\"\n @api.place_order('sell', amount, price, @couple)\n end", "def place_order\n @order = Order.new(order_params)\n @basket.line_items.map do |line_item|\n @order.line_items << line_item\n item.basket_id = nil\n\n dish = Dish.find(line_item.dish_id)\n dish.inventory -= line_item.quantity\n dish.save\n end\n @order.save\n @basket.destroy\n render Dish.all, status: :ok\n end", "def create_order(order)\n @queue.enqueue(order)\n end", "def place_order\n @browser.div(:id, \"checkout-step-review\").button(:text, \"Place Order\").click\n seconds = 0.10\n until @browser.text.include?(\"Your order has been received\") do\n sleep 0.10\n seconds += 0.5\n end\n puts \"I waited #{seconds} seconds\"\n #final code dependant assertion\n assert(@browser.button(:title,'Continue Shopping').enabled?)\n # assert_section 'success'\n end", "def create_order(order)\n # response = post(\n # 'peatio/market/orders',\n # {\n # market: order.market.downcase,\n # side: order.side.to_s,\n # volume: order.amount,\n # price: order.price\n # }\n # )\n\n return if order.amount < 1e-8\n od = build_order(order)\n return if od.nil?\n\n# Arke::Log.debug \"Skip order creation #{od.to_json}\\n#{order.inspect}\"\n Ordering.new(od).submit\n @open_orders.add_order(order, od.id) if od.id\n Arke::Log.debug \"Order created #{od.to_json}\"\n\n # @open_orders.add_order(order, response.env.body['id']) if response.env.status == 201 && response.env.body['id']\n\n # response\n end", "def dummy_order\n order = spree_line_item ? spree_line_item.order.dup : ::Spree::Order.create\n order.ship_address = subscription.shipping_address || subscription.user.ship_address if subscription\n order.bill_address = subscription.billing_address || subscription.user.bill_address if subscription\n\n order.freeze\n end", "def place_order\n wait_for_place_order_btn\n place_order_btn.click\n\n return error_message.text if has_error_message?(wait: 5)\n ConfirmationATG.new\n end", "def create\n @order = Order.new(params[:order])\n @order.user_id = current_user.id\n @order.add_line_items_from_cart(current_cart)\n #logger.debug \"New order: #{@order.attributes.inspect}\"\n #logger.debug \"Order should be valid: #{@order.valid?}\"\n\n respond_to do |format|\n if @order.save\n Cart.destroy(session[:cart_id])\n session[:cart_id] = nil\n format.html { redirect_to(store_url, :notice =>\n 'Thank you for your order.') }\n format.xml { render :xml => @order, :status => :created,\n :location => @order }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @order.errors,\n :status => :unprocessable_entity }\n end\n end\n end", "def add_order(order_id, carrier)\n @carrier = carrier\n @order = Spree::Order.find(order_id)\n @ship_carrier = Settings['supported_carriers'].include?(carrier) ? ENV[\"#{carrier.upcase}_CARRIER_ID\"] : nil\n @ship_carrier.present? && @order.shipment.present? ? create_shipment : return_error\n end", "def create\n @order = current_user.orders.new(params[:order])\n @order.add_line_items_from_cart(current_cart)\n respond_to do |format|\n if @order.save\n Cart.destroy(session[:cart_id])\n session[:cart_id] = nil\n format.html { redirect_to(\"http://cs410.cs.ualberta.ca:42001/paybuddy/payment.cgi?grp=5&amt=#{@order.total_price}&tx=#{@order.id}&ret=#{paid_url}\") }\n format.json { render json: @order, status: :created, location: @order }\n else\n @cart = current_cart\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n params = order_params.merge(cart_items: @cart.cart_items)\n @order = Order.new(params)\n\n respond_to do |format|\n if @order.save\n session[:order] = @order.id\n @cart.destroy\n format.html { redirect_to active_order_path, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render 'carts/show' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def placeBuyOrder(epic:,size:,price:,params: {} )\n\n buy_order_params = {\n :\"epic\" => epic,\n :\"size\" => size,\n :\"level\" => price,\n :\"type\" => \"STOP\"\n }\n\n placeOrder(params: buy_order_params.merge(params))\n\n end", "def place_guest_order(payment_method)\n put_wrapper(\"/V1/guest-carts/#{guest_cart_key}/order\",\n { payment_method: payment_method }.to_json, default_headers)\n end", "def create\n #@order = Order.new(params[:order])\n\n cart = session[:cart]\n\n @order.add_line_items_to_order_from_cart(cart)\n\n @order.user = current_user\n\n respond_to do |format|\n if @order.save\n #Send an email to admin\n UserMailer.order_created_to_admin(@order).deliver\n #empty cart\n session.delete(:cart)\n \n format.html { redirect_to :dashboard, notice: \"L'ordine è stato creato correttamente.\" }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cart = current_user.cart \n unless current_user.cart.nil? || @cart.empty?\n @order = @cart.create_order\n @order.user = current_user\n @order.save\n redirect_to checkout_order_path(@order)\n else\n flash[:notice] = \"There is nothing in your cart.\"\n redirect_to products_path\n end\n end", "def create\n @order = Order.new(order_params)\n\n # delivery_price get from session, not from hidden input\n @order.delivery_price = session[:delivery_price]\n @order.total_price = @cart.total_price\n @order.status = 0\n @user = current_user\n\n respond_to do |format|\n if @order.save\n # delete session data\n clear_delivery_session\n @user.orders << @order\n @order.add_item_from_cart(@cart)\n format.html { redirect_to private_office_path, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def save_order\n @order = Order.new(params[:order]) \n @order.line_items << @cart.items \n if @order.save \n @cart.empty!\n redirect_to_index('Thank you for your order.')\n else\n render(:action => 'checkout') \n end\n end", "def create\n @order = Order.new(order_params)\n @order.add_line_items_from_cart(@cart)\n\n respond_to do |format|\n if @order.save \n Cart.destroy(session[:cart_id])\n session[:cart_id] = nil\n format.html { redirect_to store_index_url, notice: 'Thank you come again!'}\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if order_params[:status] == \"completed\"\n @current_order.update_order(session[:order], order_params)\n if @current_order.save_order(current_user)\n session[:order] = {}\n session[:cart] = {}\n # delete user current cart record\n current_user.current_cart.destroy\n flash[:success] = \"Your order has been successfully placed.\"\n redirect_to root_path\n else\n flash[:error] = \"An error occured while saving your order. Please try again.\"\n redirect_to cart_checkout_path\n end\n end\n end", "def create\n @order = Order.new(order_params)\n @order.add_line_items_from_cart(current_cart)\n @order.user_id = session[:user_id]\n\n respond_to do |format|\n if @order.save\n destroy_cart\n OrderNotifier.received(@order).deliver\n format.html { redirect_to store_url, notice: I18n.t('.thanks') }\n format.json { render action: @order, status: :created, location: @order }\n else\n @cart = current_cart\n format.html { render action: 'new' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @order = Order.new(order_params)\n @order.cart = @cart\n OrderMailer.demandelocation(Order.first).deliver_now\n\n\n respond_to do |format|\n if @order.save\n session.delete(:cart_id)\n format.html { redirect_to order_validations_path}\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def place_order!()\n order_template = virtual_guest_template\n order_template = yield order_template if block_given?\n\n virtual_server_hash = @softlayer_client[:Virtual_Guest].createObject(order_template)\n SoftLayer::VirtualServer.server_with_id(virtual_server_hash['id'], :client => @softlayer_client) if virtual_server_hash\n end", "def create_order\n @order = Order.create\n end", "def execute\n guest.cart.order_items.create product: product\n end", "def place_order\n \n @job = Job.find(params[:job_id])\n fetch_decrypted(@job)\n \n if @logged_user.credits > 0\n render(:action => \"confirm_order\")\n return\n else\n #place order will have our paypal buttons\n render(:action => \"place_order\")\n return\n end\n \n rescue ActiveRecord::RecordNotFound\n flash[:alert] = \"Buying credits for fun?\"\n redirect_to :action => \"profile\"\n end", "def create\n @order, @errors = Order.create_from_cart(@cart, order_params)\n\n if @order\n render json: @order, status: :created, location: @order\n else\n render json: @errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.find(session[:user_id])\n @order = Order.new(params[:order])\n @order[:User_order] = @user[:id]\n @order.add_line_items_from_cart(current_cart)\n if @order.save\n UserMailer.order_confirmation(@order).deliver\n UserMailer.order_admin(@order).deliver\n render \"_good\"\n end\n end", "def create\n # Invokes action in cart.rb that checks whether the cart is empty\n if @cart.is_cart_empty?\n # If the cart is empty, set flash error and redirect to My Basket page\n flash[:item_error] = \"Your cart is empty.\"\n redirect_to cart_path\n return\n end\n\n # Create order and redirect to orders#confirm_order\n @order = Order.create user_id: @current_user.id\n redirect_to confirm_order_path\n end", "def insert_order(order, opts = {})\n data, _status_code, _headers = insert_order_with_http_info(order, opts)\n data\n end", "def create_empty_record\n $hostfull=request.protocol + request.host_with_port\n\n @cart=Cart.get_cart(\"cart\"+session[:session_id])\n \n @order = Order.new\n @order.add_line_items_from_cart(@cart, $hostfull)\n @order.user = User.find_by_id(session[:user_id])\n @order.ip_address = request.remote_ip\n # @order.email = @order.user.name\n @order.save\n \n redirect_to(:controller=>:orders, :action=>:edit, :id=>@order)\n end", "def mapp_integration_for_order_placed(order, user_id)\n response = HTTParty.post(\"#{Rails.application.secrets.mapp_integration[:api_endpoint]}\"+\"/message/sendTransactionalWithEventDetails\", headers: headers, query: order_placed_api_query(order, user_id), body: order_placed_api_body(order, user_id))\n end", "def insert_order\n order = Order.for_remote_insert(params[:customer_id], params[:order_id], params[:lid], request.remote_ip)\n payment = Payment.new(:order => order, :customer => order.customer, :payment_method => 'Customer Service',\n :amount => '0.0', :complete => 1, :successful => 1)\n Order.transaction do\n order.save!\n payment.save!\n end\n render :text => '1'\n rescue => e\n render :text => e.to_s\n end", "def create\n @order = Order.new(params[:order])\n @order.add_line_items_from_cart(current_cart)\n\n respond_to do |format|\n if @order.save\n destroy_cart\n OrderNotifier.received(@order).deliver\n format.html { redirect_to store_path, notice: 'ご注文ありがとうございます' }\n format.json { render json: @order, status: :created, location: @order }\n else\n @cart = current_cart\n format.html { @disabled = true; render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def ensure_cart\n @cart = Order.find_by(id: session[:order_id])\n\n if @cart.nil?\n @cart = Order.make_cart\n session[:order_id] = @cart.id\n end\n\n if @cart.nil?\n flash[:error] = \"A problem occurred. The shopping cart could not be found.\"\n redirect_to root_path\n end\n\n @cart.status = \"pending\"\n @cart.save\n end", "def create\n @order = Order.new(:user => current_user)\n respond_to do |format|\n if @order.save\n session[:payment_method] = nil\n @cart = current_user.cart\n Cache.put 'user_' + current_user.id.to_s + '_cart', @cart\n @cart_products = @cart.cart_products\n Cache.put 'cart_' + @cart.id.to_s, @cart_products\n format.html { redirect_to(@order, :notice => 'Order was successfully processed.') }\n format.xml { render :xml => @order, :status => :created, :location => @order }\n else\n format.html { flash[:notice] = \"Sorry, we experienced a problem. Please try again.\" \n redirect_to(:controller => :checkout, :action => \"new\") }\n format.xml { render :xml => @order.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @order = Order.new\n @order.add_line_items_from_cart(@cart)\n\n respond_to do |format|\n if @order.save\n session[:cart_id] = nil\n OrderNotifier.received(@order).deliver\n redirect_to preorder_confirmation_path\n=begin\n format.html { redirect_to root_path, notice: 'Thank you for your order.' }\n format.json { render action: 'show', status: :created, location: @order }\n=end\n else\n format.html { render action: 'new' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\t@customer = current_customer\n @order = Order.new(params[:order].merge!({:customer_id => @customer.id}))\n\t\t@order.add_line_items_from_cart(current_cart)\n\t\n respond_to do |format|\n if @order.save\n\t\t\t\tCart.destroy(session[:cart_id])\n\t\t\t\tsession[:cart_id] = nil\n\t\t\t\tNotifier.order_received(@order).deliver\n format.html { redirect_to(store_url, :notice => I18n.t('.thanks')) }\n format.xml { render :xml => @order, :status => :created, :location => @order }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @order.errors, :status => :unprocessable_entity }\n end\n end\n end", "def collect_order(shop_id, order)\n request(:post, \"shops/#{shop_id}/orders\", body: order).tap do |response|\n raise InvalidResponse, response.body unless response.status == 201\n end\n end", "def create\n\n @order = Order.new(order_params)\n @shopping_cart = ShoppingCart.find(params[:shopping_cart_id])\n @order.shopping_cart_id = @shopping_cart.id\n @order.fulfilled = false\n @order.in_transit = false\n\n if(user_signed_in?)\n @order.user_id = current_user.id\n else\n @order.user_id = -1\n end\n\n Stripe.api_key = ENV[\"STRIPE_API_KEY\"]\n token = params[:stripeToken]\n\n begin\n charge = Stripe::Charge.create(\n :amount => (@shopping_cart.total * 100).floor,\n :currency => \"eur\",\n :card => token\n )\n flash[:notice] = \"We're on our way!\"\n rescue Stripe::CardError => e\n flash[:danger] = e.message\n end\n\n session[:shopping_cart_id] = ShoppingCart.new.id\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to root_url}\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def place_order(amount)\n if params[:card_number].present? && params[:expiration_month].present? && params[:expiration_year].present? && params[:cvv].present?\n @credit_card = Payment.validate_credit_card(current_user.try(:first_name),current_user.try(:last_name),params[:card_number],params[:expiration_month],params[:expiration_year],params[:cvv])\n response = GATEWAY.purchase(amount, @credit_card)\n return response\n else\n return false\n end\n end", "def create\n @cart = current_cart\n @usr = current_user\n @order = @usr.orders.new(order_params)\n @order.add_line_items_from_cart(current_cart)\n respond_to do |format|\n if @order.save\n Cart.destroy(session[:cart_id])\n session[:cart_id] = nil\n\n Notifier.order_received(@order).deliver\n\n format.html { redirect_to(store_url, :notice => 'Thank you for your order.' ) }\n format.xml { render :xml => @order, :status => :created, :location => @order }\n\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @order.errors,:status => :unprocessable_entity }\n end\n end\n end", "def set_order\n @order = ShopOrder.find(params[:id])\n end", "def order\n @order ||= if session['order']\n OrderBasket.load(session['order']).tap(&:apply_promotions!)\n else\n OrderBasket.new\n end\n end", "def create\n cart = Cart.find_by(user_id: @current_user.id)\n order = Order.new(user_id: @current_user.id,\n date: DateTime.now,\n delivery_address: @current_user.role == \"user\" ? @current_user.addresses.find_by(delivery_address: true).address : \"Walk-in-customer\",\n is_cancel: false,\n total_amount: cart.cart_items.sum(:temp_price))\n if (order.save!)\n cart.cart_items.all.each do |cart_item|\n OrderItem.create!(\n order_id: order.id,\n menu_item_id: cart_item.menu_item_id,\n menu_item_name: cart_item.menu_item_name,\n menu_item_price: cart_item.menu_item_price,\n quantity: cart_item.quantity,\n )\n end\n cart.cart_items.destroy_all\n end\n redirect_to customer_order_details_path(order.id)\n end", "def create\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n\n if params[:commit] == \"save\"\n format.html { redirect_to edit_order_path(@order) }\n format.json { render action: 'edit', status: :created, location: @order }\n else\n format.html { redirect_to @cart }\n format.json { render action: 'show', status: :created, location: @cart }\n end\n else\n format.html { render action: 'new' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_new_cart_upon_submit()\n new_order = Order.create()\n return new_order\n end", "def create\n @order = Order.new(order_params)\n respond_to do |format|\n if @order.save\n persist_order_address\n format.html { redirect_to [:admin, @order], notice: 'Order was successfully created.' }\n format.json { render action: 'show', status: :created, location: @order }\n else\n format.html { render action: 'new' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def order\n @purchase.order!\n redirect_to purchase_path(@purchase), :notice => t(:ordered)\n end", "def create \n order_params = (place_order_params)\n order_params[:customer_id] = current_user.customer_id\n @order = Order.new(order_params)\n if @order.recurring?\n if((Time.now + 1.hour).strftime('%H:%M:%S') <= (Time.parse(@order.place_date + ' ' + @order.timeslot.start)).strftime('%H:%M:%S') && !@order.completed? )\n # Add the auto generated entry\n @order.category = 'single'\n @order.created_by = 'auto'\n @order.save!\n end\n # Improve this\n if Order.create!(order_params)\n render json: @order, status: 201\n else\n render json: {'errors': ['Order can no be placed']}, status: :unprocessable_entity\n end\n else\n if (Time.now + 1.hour <= Time.parse(@order.place_date + ' ' + @order.timeslot.start)) && @order.save!\n render json: @order, status: 201\n else\n render json: {'errorrs': ['Order can not be placed']}, status: :unprocessable_entity\n end\n end \n end", "def buy!(amount, price)\n add_order!(:buy, amount, price)\n end", "def place_order!(pair_name, method, price, size)\n print [self.class.name, pair_name, method, price, size].inspect\n\n response = OpenStruct.new(code: 400)\n\n if PLACE_ORDER_ENABLED\n # PLACE REAL ORDER HERE\n while response.code != 200\n body = {\n nonce: Time.now.to_f * 1000,\n market: pair_name,\n side: method,\n volume: size,\n price: price,\n ord_type: \"limit\",\n }\n\n response = HTTParty.post(\n 'https://max-api.maicoin.com/api/v2/orders',\n headers: generate_header(body),\n query: body,\n )\n print \".\"\n end\n\n print \"success\"\n end\n\n puts\n ap JSON.parse(response.body)\n end", "def initialize(order_trying_to_create)\n @order_trying_to_create = order_trying_to_create\n end", "def create_web_order(cart, options = {})\n \n order = Order.new(WEB_ORDER_DEFAULTS.merge(options[:order])) \n billing_address = Address.new(options[:billing_address])\n \n # piece-meal validation so user sees validation in steps\n \n # shipping address?\n shipping_same = true unless options[:address_choice].nil?\n unless shipping_same\n shipping_address = Address.new(options[:shipping_address])\n else\n shipping_address = billing_address.clone\n end\n \n order.shipping_address = shipping_address \n order.billing_address = billing_address\n\n # CC validation \n credit_card = CreditCard.new(options[:credit_card])\n credit_card.require_verification_value = true\n order.credit_card = credit_card\n valid = cart.valid? && credit_card.valid? && order.valid? &&\n billing_address.valid? && shipping_address.valid?\n if valid\n order.credit_card_display = order.credit_card.display_number\n \n order.shipping_method_id = options[:active_shipping_method_id]\n order.region_id = options[:active_shipping_region_id]\n order.add_order_items_from_cart(cart)\n promo = PromoCode.find_by_code(options[:order][:promo_code])\n promo.apply(order) if promo\n order.calculate_order_costs\n else\n order.invalid = true\n end\n order\n end", "def set_order\n @order = Order.find(params[:id])\n redirect_to root_path unless @order.user_id == current_user.id\n end", "def create\n @order = Order.new(order_params)\n @order.user_id = current_user.id if @order.user_id == 0\n @order.price = @order.product.price\n another_order = current_user.orders.in_cart.where(product_id: @order.product_id).first\n logger.debug(\"----------------#{@order.price}..........\")\n if another_order\n another_order.quantity += @order.quantity\n another_order.price += (@order.quantity*@order.price)\n logger.debug(\"----------------#{@order.price}..........\")\n @order = another_order\n end\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: t('Order was successfully created') }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def build\n my_order = nil\n if cart = user && user.cart\n Order.transaction do\n my_order = Order.create(user: user)\n my_order.products = cart.products\n cart.destroy\n end\n else\n error = Struct.new(:full_messages).new\n error.full_messages = [\"No cart to create order from\"]\n @errors = error\n end\n my_order\n end", "def create\n @order = current_order\n # if there already is an order_item with that product_id, then just update the quantity of the order_item\n # if product_in_cart?, redirect to the edit method\n unless product_in_cart?\n @item = @order.order_items.new(item_params)\n @item.save\n @order.save\n session[:order_id] = @order.id\n redirect_to cart_path\n else\n edit\n end\n end", "def create_order(options)\n request :account, :post, 'order', options\n end", "def prepare_store\n order = SwaggerClient::Order.new(\"id\" => 10002,\n\t\t \"petId\" => 10002,\n\t\t \"quantity\" => 789,\n\t\t \"shipDate\" => \"2015-04-06T23:42:01.678Z\",\n\t\t \"status\" => \"placed\",\n\t\t \"complete\" => false)\n SwaggerClient::StoreApi.place_order(:body => order)\nend", "def buy!(qty, price)\n order = Fyb::Order.new qty, price, :buy\n order.perform\n end", "def prepare_new_order\n @order = Order.new(order_params)\n @order.user_id = current_user.id\n @product = Product.find(params[:orders][:product_id])\n @order.product = @product\n @order.price_cents = @product.price_cents\n end", "def create\n @cart = current_cart\n @product = Product.find(params[:product_id])\n @order = Order.add_product(@product, @cart)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render action: 'show', status: :created, location: @order }\n else\n format.html { render action: 'new' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def order!(type, amount, price)\n order = {:type => order_type(type), :amount_int => intify(amount, :btc)}\n order[:price_int] = intify(price, :usd) if price != :market\n post('/api/1/BTCUSD/order/add', order)\n end", "def submit_order\n @order = current_order(session)\n\n # Set customer, if any\n if customer_signed_in?\n @order.customer = current_store_customer\n else\n if params[:create_new_account]\n @order.customer = create_customer(@order, params[:new_account_password], store)\n end\n end\n\n @order.update_attributes params[:order] # SHouldn't need this as well as save below\n @order.billing_status_id = Breeze::Commerce::OrderStatus.where(:type => :billing, :name => \"Payment in process\").first.id\n\n\n if @order.save \n # Process payment with PxPay\n @payment = create_payment(@order, store)\n if @payment.save and redirectable?\n redirect_to @payment.redirect_url and return\n else\n Rails.logger.debug @payment.errors.to_s\n @payment.errors.each { |attrib, err| Rails.logger.debug attrib.to_s + ': ' + err.to_s }\n flash[:error] = \"Sorry, we can't reach the payment gateway right now.\" # This error message might not be accurate!\n redirect_to breeze.checkout_path and return\n end\n else\n @customer = current_store_customer || Breeze::Commerce::Customer.new\n render :action => \"checkout\"\n end\n end", "def build_order\n @order ||= ManagementCenter::Order.new\n end", "def submit_order!\n @customer_order.transaction do\n cache_addresses!\n mark_deliveries_as_pending!\n cache_billing_address! unless @customer_order.anon_billing_address?\n update_subtotal_items!\n assign_submitted_at!\n submitted!\n end\n end", "def add_to_cart\n order = Cart.create(customer_id: @customer.id, hotel_id: params[:cart][:hotel_id], item_id: params[:cart][:item_id],\n item_quantity: params[:cart][:item_quantity], item_name: params[:cart][:item_name], item_price: params[:cart][:item_price], total_price: params[:cart][:total_price] )\n if order\n render json: {\n messages: \"Successfully added to cart!\",\n is_success: true,\n orders: order\n }, status: :created\n else\n render json: {\n messages: \"Unable to add\",\n is_success: false,\n orders: {}\n }, status: :internal_server_error\n end\n end", "def create\n @order = Order.new(params[:order])\n\n @order.price = 0\n @order.tax_total = 0\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @spree_order = Spree::Order.new(spree_order_params)\n\n respond_to do |format|\n if @spree_order.save\n format.html { redirect_to @spree_order, notice: t(\"activerecord.models.spree/order\") + t(\"messages.successfully_created\") }\n format.json { render :show, status: :created, location: @spree_order }\n else\n format.html { render :new }\n format.json { render json: @spree_order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # 前端傳回的資料,呼叫 order_params 過濾前端傳回來的資料,用 new 創出一個 Order 的物件 (此時還是 ruby 物件喔)\n @order = Order.new(order_params)\n\n respond_to do |format|\n # save 是指把該筆 物件裡的資料存入資料庫內\n if @order.save\n # 若儲存成功,就導回該筆資料的 show 頁面\n format.html { redirect_to order_path(@order), notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n # 若儲存失敗,就導回新增的頁面重新填寫資料\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #set order and user differs slightly from majority of actions\n @order = Order.new(order_params)\n if @order.save\n @this_user.orders.push(@order)\n redirect_to @this_user, notice: \"Order saved\"\n else\n render action: 'new'\n end\n end", "def create\n @order = Order.new(params[:order])\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: \"Don't think you're going to be there when we deliver? Leave cash in an envelope outside your door. Otherwise, we'll see you in person!\" }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def order_present\n if order.nil?\n errors.add(:order, \"is not a valid order.\")\n end\n end", "def create\n @order = Order.new(params[:order])\n end", "def place\n @order = Order.find(params[:id])\n if(@order.status == \"DRAFT\")\n if(LineItem.where(:order_id => params[:id]).count > 0)\n @order.status = \"PLACED\"\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully upgraded to PLACED.' }\n format.json { render json: @order, status: :accepted, location: @order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n else\n respond_to do |format|\n format.html { redirect_to @order, notice: 'You must have a single line item in this order first.' }\n format.json { render json: @order.errors, status: :method_not_allowed }\n end\n end\n end\n end", "def orders_add\n\t\t@product_id = params[:product_id].to_i\n\t\t@quantity = params[:quantity].to_i\n\t\t\n\t\tfound = false\n\t\tsession[:orders].each do |order|\n\t\t\tif (order[\"table\"][\"product_id\"]==@product_id and not found) #session-ized variable uses [table]\n\t\t\t\trespond_to do |format|\n\t\t\t\t\tformat.json { render json: { error: \"Product already ordered. Please check your cart.\"} }\n\t\t\t\tend\n\t\t\t\tfound = true\n\t\t\t\treturn\n\t\t\tend\n\t\tend\n\t\t\n\t\tif (not found)\n\t\t\tif (@quantity>0)\n\t\t\t\tneworder = OpenStruct.new product_id: @product_id, quantity: @quantity\n\t\t\t\tsession[:orders] << neworder\n\t\t\t\t\n\t\t\t\trespond_to do |format| #success\n\t\t\t\t\tformat.json { render json: {} }\n\t\t\t\tend\n\t\t\telse\n\t\t\t\trespond_to do |format|\n\t\t\t\t\tformat.json { render json: { error: \"Invalid quantity to be added to cart.\"} }\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\treturn nil\n\tend", "def prepare_store(store_api)\n order_id = 5\n order = Petstore::Order.new(\"id\" => order_id,\n \"pet_id\" => 123,\n \"quantity\" => 789,\n \"ship_date\" => \"2015-04-06T23:42:01.678Z\",\n \"status\" => \"placed\",\n \"complete\" => false)\n store_api.place_order(order)\n order_id\nend", "def test_create_order\n setup_new_order()\n @o.order_line_items << OrderLineItem.for_product(items(:small_stuff))\n assert @o.save\n end", "def use_cart(cart)\n cart.cart_items.each do |cart_item|\n order_items.build(item_id: cart_item.item.id, price: cart_item.item.send(item_price_method_name), quantity: cart_item.quantity) if cart_item.quantity.to_i > 0\n end\n end", "def send_order(_trade_type, _price, _quantity)\n raise 'self subclass responsibility'\n end", "def execute_order_on_cart user\n # Purchased at should always be nil when we get here...otherwise raise an exception so we can\n # track it and fix it\n raise Exceptions::AssertionFailed unless self.purchased_at.nil?\n\n # Update the cart to indicate that its actually been purchased\n self.update_attribute(:purchased_at, Time.zone.now)\n\n # Go ahead and execute the order. For example, in the case of a credit sku, this would mean\n # granting the user credits\n for line in self.line_items\n line.sku.execute_order_line user, line\n end\n end", "def create\n @order = Order.new(order_params)\n \n if @order.save\n\n redirect_to(:action=>'new',:orderId=>@order.id)\n\n else\n render :new\n\n end\n end", "def set_order\n @cart = current_cart\n @order = Order.find(params[:id])\n @orders = Order.where(\"cart_id=? AND id<>?\", @cart.id, params[:id])\n end", "def perform(\n market:,\n side:,\n ord_type:,\n volume:,\n price: nil,\n uuid: UUID.generate\n )\n order = create_order(\n market: market,\n side: side,\n ord_type: ord_type,\n price: price.to_d,\n volume: volume.to_d,\n uuid: uuid\n )\n order = submit_and_return_order(order)\n success(data: order)\n rescue ::Order::InsufficientMarketLiquidity => e\n trigger_amqp_and_failure(\n error_message: 'market.order.insufficient_market_liquidity',\n uuid: uuid\n )\n rescue ::Account::AccountError => e\n trigger_amqp_and_failure(\n error_message: 'market.account.insufficient_balance',\n uuid: uuid\n )\n rescue ActiveRecord::RecordInvalid => e\n trigger_amqp_and_failure(\n error_message: 'market.order.invalid_volume_or_price',\n uuid: uuid\n )\n rescue StandardError => e\n report_exception(e, true)\n trigger_amqp_and_failure(\n error_message: e.message,\n uuid: uuid\n )\n end", "def add_product_to_order\n prod_id = params[:id].to_i\n qty_to_order = params[:qty].to_i\n\n add_or_update_product_qty(prod_id, qty_to_order)\n\n flash[:notice] = 'Product added to cart'\n redirect_back(fallback_location: root_path)\n end", "def order_placed(name, email)\n @name = name\n @email = email\n mail( :to => email,\n :subject => \"Your Order from Oasis Books\")\n end", "def generate_order\n clean_order!\n\n attrs = attributes(:json).reject do |key, _|\n [:adjustments, :state, :order_id, :shipping_method_id].include?(key)\n end\n\n %w(billing shipping).each do |addr|\n attrs[:\"#{ addr }_address_attributes\"] =\n attrs.delete(:\"#{ addr }_address\")\n end\n\n unless use_another_address_for_shipping\n attrs[:shipping_address_attributes] =\n attrs[:billing_address_attributes]\n end\n\n # Append shipping method id after addresses so the latters are present\n # when shipping adjustment is processed on order\n attrs[:shipping_method_id] = shipping_method_id\n\n attrs[:discount_code] = discount_code\n\n self.order = Glysellin::Order.create!(attrs)\n end", "def create_empty_record\n @order_item = OrderItem.new\n @order_item.save\n \n redirect_to(controller: :order_items, action: :edit, id: @order_item)\n end", "def create\n @order = Order.new(order_params)\n @cart = Cart.find(@order.cart_id)\n\n # @store_products = StoreProduct.all\n # @products = Product.all\n #\n # @store_product = StoreProduct.find(params[:store_product_id])\n # @product = Product.find(params[:product_id])\n #\n # @order.product_id = @product.id\n # @order.store_product_id = @store_product.id\n\n @order.store_product_id = @cart.line_items { |item| item.store_product.store_product_id}\n\n # respond_to do |format|\n if @order.save\n\n session[:cart_id] = nil\n\n # @cart.destroy\n # format.html { redirect_to @order, notice: 'Order was successfully created.' }\n # format.json { render :show, status: :created, location: @order }\n redirect_to '/'\n flash[:notice] = \"Order was successfully created.\"\n\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n # end\n end\n end", "def create_order(order, save = true)\n wait_until_bus_section_load\n # fill shipping address section\n\n if order.name.nil?\n name_tb.type_text('')\n elsif order.name != 'keep the same'\n name_tb.type_text(order.name)\n end\n\n if order.address_1.nil?\n address1_tb.type_text('')\n elsif order.address_1 != 'keep the same'\n address1_tb.type_text(order.address_1)\n end\n\n address2_tb.type_text(order.address_2)\n\n if order.city.nil?\n city_tb.type_text('')\n elsif order.city != 'keep the same'\n city_tb.type_text(order.city)\n end\n\n if order.state.nil?\n state_tb.type_text('')\n elsif order.state != 'keep the same'\n state_tb.type_text(order.state)\n end\n\n country_select.select(order.country) unless order.country.nil?\n\n if order.zip.nil?\n zip_tb.type_text('')\n elsif order.zip != 'keep the same'\n zip_tb.type_text(order.zip)\n end\n\n if order.phone.nil?\n phone_tb.type_text('')\n elsif order.phone != 'keep the same'\n phone_tb.type_text(order.phone)\n end\n\n power_adapter_select.select(order.adapter_type) unless order.adapter_type.nil?\n\n next_btns[0].click # click next and goto\n #go_to_create_order_section\n wait_until_bus_section_load\n\n unless order.adapter_type.nil?\n # fill create order section\n if order.key_from == \"available\"\n # Add key from available keys\n add_available_key.click\n elsif !order.key_from.match(/[0-9A-Z]{20}/).nil?\n # add key for fixed data (product key)\n filter_key_input.type_text(order.key_from)\n filter_button.click\n wait_until_bus_section_load\n add_first_key.click\n elsif !(order.key_from.match(/^\\d* available$/).nil?)\n # Add certain number keys on current page\n number = order.key_from.match(/\\d+/)[0].to_i\n number.times {\n add_first_key.click\n wait_until_bus_section_load\n }\n elsif order.key_from == \"new\"\n add_new_key.click\n elsif !order.key_from.match(/[0-9A-Z]{20}/).nil? # filter key\n filter_key_input.type_text(order.key_from)\n filter_button.click\n wait_until_bus_section_load\n add_first_key.click\n else\n raise \"Please order key from either available keys or add a new key\"\n end\n wait_until_bus_section_load\n\n os_tb.select(order.os) unless order.os.nil?\n # update quota for more than one key records\n if !order.quota.nil?\n quota_arr = order.quota.split(\"\\;\")\n quota_arr.each_with_index do |value, index|\n order_quota_tb(index).type_text(value)\n end\n end\n order.license_key = get_added_keys\n order_assign_to_tb.type_text(order.assign_to) unless order.assign_to.nil?\n drive_type_select.select(order.drive_type) unless order.drive_type.nil?\n\n wait_until_bus_section_load\n next_btns[1].click\n\n wait_until_bus_section_load\n\n #seperate from error/success message\n order.notification_msg = order_notification_p.text unless locate(:xpath, \"//div[@class='show-details']/p\").nil?\n\n # fill summary section\n if messages.empty?\n discount_tb.type_text(order.discount) unless order.discount.nil?\n # focus out of discount text box, make sure discount amount changes\n page.trigger_html_event(discount_tb.id, \"change\")\n num_win_drivers_tb.type_text(order.num_win_drivers) unless order.num_win_drivers.nil?\n num_mac_drivers_tb.type_text(order.num_mac_drivers) unless order.num_mac_drivers.nil?\n is_ship_driver_cb.check unless order.ship_driver.nil?\n if save\n submit_order_btn.click\n end\n end\n wait_until_bus_section_load\n end\n end", "def create\n @order = Order.new(order_params)\n if @order.save\n @order.add_line_items_from_cart(@cart)\n @paypal = PaypalInterface.new(@order)\n @paypal.express_checkout\n if @paypal.express_checkout_response.success?\n @paypal_url = @paypal.api.express_checkout_url(@paypal.express_checkout_response)\n redirect_to @paypal_url\n else\n flash[:notice] = \"Habido un problema con Paypal\"\n render :new\n end\n\n else\n flash[:notice] = \"Hubo un problema con el formulario\"\n render :new\n end\n end", "def create\n product = Product.find(params[:product_id])\n qty=params[:quantity].to_i \n @ordered_product = @cart.add_product(product.id,qty)\n @ordered_product.save\n respond_to do |format|\n format.html { redirect_to store_index_url, notice: 'Order placed successfully' }\n format.json { head :no_content }\n end\n end", "def create\n @order = order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def process_order\n @order.process!\n redirect_to root_path\n end", "def create\n @order = current_user.orders.build(order_params)\n\n respond_to do |format|\n if @order.save_with_items(current_user)\n format.json { render json: @order, status: :created }\n format.html { redirect_to @order }\n else\n format.html do\n set_feed_back\n set_addresses_add_express_fee\n\n set_wx_cards\n\n flash.now[:error] = @order.errors.full_messages.join(', ')\n\n render :confirmation, status: :unprocessable_entity\n end\n\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_order(options)\n Order.create(@current_user, options)\n end", "def add_order(xml, options)\n order = options[:order]\n return unless order\n\n xml.tag!('order') do\n # Merchant-assigned invoice number for the subscription (optional)\n xml.tag!('invoiceNumber', order[:invoice_number])\n # Description of the subscription (optional)\n xml.tag!('description', order[:description])\n end\n end" ]
[ "0.73740715", "0.68440413", "0.64735687", "0.640894", "0.6368956", "0.63323236", "0.63211626", "0.6303132", "0.6273557", "0.6263134", "0.62284905", "0.61651814", "0.6055347", "0.6046078", "0.6007279", "0.5968888", "0.5967344", "0.5952569", "0.59455806", "0.59429735", "0.59397614", "0.5928795", "0.59244716", "0.5900433", "0.5899735", "0.58989435", "0.5894938", "0.5892988", "0.58895487", "0.58686966", "0.58439803", "0.58350104", "0.5829038", "0.5804554", "0.57803744", "0.5777052", "0.577363", "0.5773191", "0.5767668", "0.5753983", "0.57238626", "0.57236636", "0.5722362", "0.57157576", "0.56864583", "0.56811017", "0.5674597", "0.5659684", "0.5648098", "0.5641819", "0.5639967", "0.5636927", "0.5632685", "0.56294537", "0.5608075", "0.56057805", "0.5601997", "0.5593627", "0.55833095", "0.55831754", "0.5579653", "0.5577092", "0.5569607", "0.5561076", "0.5560982", "0.55601794", "0.5555994", "0.55467486", "0.5538356", "0.5538315", "0.55379534", "0.55182636", "0.55131924", "0.55100775", "0.5507273", "0.5503447", "0.5502873", "0.5502343", "0.5497661", "0.5496306", "0.5491658", "0.54829013", "0.54804677", "0.5472941", "0.547268", "0.54716825", "0.5471035", "0.54634565", "0.54624623", "0.5461759", "0.54612833", "0.54607207", "0.5458369", "0.54575163", "0.54568887", "0.5449585", "0.5446828", "0.5431901", "0.54305375", "0.542398" ]
0.5656783
48
creates a new book
def initWithType(typeName, error:outError) super @unzipPath = Dir.mktmpdir(UNZIP_DIRECTORY_PREFIX) @container = Container.new(@unzipPath) @issues = [] self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n\t\t@book = Book.new(book_params)\n\t\t@book.save\n\t\tredirect_to books_path\n\tend", "def create\n @book = params[:book]\n add(@book)\n end", "def create\n #raise params.inspect\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n flash[:notice] = t('book.title2')+\" \"+t('created')\n format.html { redirect_to(@book) }\n format.xml { render :xml => @book, :status => :created, :location => @book }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n\t\t@book = Book.new\n\tend", "def create\n\t@book = Book.new(book_params)\n\tif @book.save\n\t\tredirect_to root_path\n\telse\n\t\trender 'new'\n\tend\nend", "def create\n @book = Book.create( params[:book] )\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to books_path, notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \n Book.create(\n title: params[:book][:title],\n author: params[:book][:author],\n description: params[:book][:description],\n image_url: params[:book][:image_url]\n )\n\n redirect_to books_path\n end", "def new\n @book = Book.new\n end", "def new\n @book = Book.new\n end", "def create\n @book = Book.new(book_params)\n\n if @book.save\n redirect_to root_path, notice: 'Book was successfully created.'\n else\n render :new, status: :unprocessable_entity\n end\n end", "def new\n @book = Book.new\n \n end", "def create\n book = Book.create(params[:book])\n redirect_to(book)\n end", "def create\n # params[:book] --> inspect the html file then you can see the name as name=book[title] and name=book[author]\n # Book.create(params[:book]) # create and save it in db\n @book=Book.new(book_params)# create instant or copy \n # it take book_params method to checked\n \n # save it to database\n if @book.save \n redirect_to books_path # go to books path\n else\n render action: \"new\" # back to the action new\n end\n end", "def create\n logger.debug \"#{book_params}\"\n @book = Book.new(book_params)\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.new(book_params)\n @book.save\n redirect_to root_path\n end", "def create\n @book = Book.new(params[:book])\n \n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.new(book_params)\n if @book.save\n flash[:notice] = \"Book record successfully created\"\n redirect_to books_url\n else\n render \"new\"\n end\n end", "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to books_path }\n else\n format.html { render :new, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n flash[:notice] = 'Book was successfully created.'\n format.html { redirect_to book_url(@book) }\n format.xml { head :created, :location => book_url(@book) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @book.errors.to_xml }\n end\n end\n end", "def create\n\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to \"/books\", notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\t@book = Book.new(params[:book])\n\t\t@book.title = @book.title.titleize\n\t\t@book.author_first = @book.author_first.titleize\n\t\t@book.author_last = @book.author_last.titleize\n\t\t@all_categories = get_all_categories\n\t\n\t\trespond_to do |format|\n\t\t\tif @book.save\n\t\t\t\tflash[:notice] = 'Book was successfully created.'\n\t\t\t\tformat.html { redirect_to(:action => 'index', :choice => ' ') }\n\t\t\telse\n\t\t\t\tflash[:notice] = 'Book was not created. Please try again.'\n\t\t\t\tformat.html { render :action => \"new\" }\n\t\t\tend\n\t\tend\n\tend", "def add_book(book_title)\n @books << {\n title: book_title,\n rental_details: {\n student_name: \"\",\n date: \"\"\n }\n }\n end", "def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to manage_books_path, notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to(@book, :notice => 'Book was successfully created.') }\n format.xml { render :xml => @book, :status => :created, :location => @book }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to(@book, :notice => 'Book was successfully created.') }\n format.xml { render :xml => @book, :status => :created, :location => @book }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.new(get_book_with_api(book_params[:title]))\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: '本を新規登録しました。' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n flash[:notice] = 'Book was successfully created.'\n format.html { redirect_to(@book) }\n format.xml { render :xml => @book, :status => :created, :location => @book }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n flash[:notice] = 'Book was successfully created.'\n format.html { redirect_to(@book) }\n format.xml { render :xml => @book, :status => :created, :location => @book }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n flash[:notice] = 'Book was successfully created.'\n format.html { redirect_to(@book) }\n format.xml { render :xml => @book, :status => :created, :location => @book }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n\t\t@book = Book.new(params[:book])\n\t\t@book.user = current_user\n\n\t\trespond_to do |format|\n\t\t\tif @book.save\n\t\t\t\tformat.html { redirect_to @book, :notice => 'Book was successfully created.' }\n\t\t\t\tformat.json { render :json => @book, :status => :created, :location => @book }\n\t\t\telse\n\t\t\t\tformat.html { render :action => \"new\" }\n\t\t\t\tformat.json { render :json => @book.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n # BookMailer.creation_email(@book).deliver_now\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n add_title_to_book\n end", "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: t('common.message.created_success')}\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n rewriteParams\n @book = Book.new(params[:book])\n @book.authors << Author.find(params[:author][:name]) if not params[:author][:name].empty?\n @book.book_types << BookType.find(params[:book_type][:name]) if not params[:book_type][:name].empty?\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to(@book, :notice => 'Book was successfully created.') }\n format.xml { render :xml => @book, :status => :created, :location => @book }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @book = Book.new\n end", "def new\n @book = Book.new\n end", "def new\n @book = Book.new\n end", "def new\n @book = Book.new\n end", "def new\n @book = Book.new\n end", "def new\n @book = Book.new\n end", "def new\n @book = Book.new\n end", "def new\n @book = Book.new\n end", "def create\n\t\t@books = Book.new(params [:book])\n\n\t\t@books.save\n\n\t\t#redirects to \"show\" method\n\t\tredirect_to @books\n\tend", "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book = @collection.books.build(params[:book])\n #original: @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to book_series_collection_books_url(@book_series, @collection), notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.xml { head :ok }\n format.json { render json: @book, status: :created, location: @book }\n\n else\n format.html { render action: \"new\" }\n format.xml { render xml: @book.errors, status: :unprocessable_entity}\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.new(book_params)\n if @book.save\n redirect_to book_path(@book)\n #based on the routes (@ localhost.../routes, or rakes route, we can use the defined path as opposed to a link)\n else\n render 'new'\n #goes back to the new method if the book is not saved\n end\n end", "def create\n @book = Book.new(book_params_create)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: '添加成功!' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.new(book_params)\n puts \"*** From create: \" \n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @book = Book.new(book_params)\r\n\r\n respond_to do |format|\r\n if @book.save\r\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\r\n format.json { render :show, status: :created, location: @book }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @book.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @book = Book.new(book_params)\n\n if @book.save\n redirect_to @book, notice: 'Book was successfully created.'\n else\n render :new\n end\n end", "def booker_new\n end", "def create\n @book = Book.new(params[:book])\n \n respond_to do |format|\n if @book.save_and_index\n flash[:notice] = 'Book was successfully created.'\n format.html { redirect_to(@book) }\n format.xml { render :xml => @book, :status => :created, :location => @book }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book }\n format.json { render action: 'show', status: :created, location: @book }\n else\n format.html { render action: 'new' }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book = current_user.books.build(book_params)\n if @book.save\n flash[:notice] = \"Book Created Succesfully\"\n redirect_to @book\n else\n redirect_to new_book_path\n flash[:alert] = \"Something wrong with your book parameters.\"\n end\n end", "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render action: 'show', status: :created, location: @book }\n else\n format.html { render action: 'new' }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @library_book = LibraryBook.new(params[:library_book])\n\n respond_to do |format|\n if @library_book.save\n format.html { redirect_to @library_book, notice: 'Library book was successfully created.' }\n format.json { render json: @library_book, status: :created, location: @library_book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @library_book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @title = \"Create New Book\"\n\n process_publisher\n\n all_book_params= params[:book]\n\n @book = Book.new(params[:book])\n\n process_authors\n\n process_subjects\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to edit_book_path(@book), notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: \"Book was successfully created.\" }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: \"Book was successfully created.\" }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_book\n\tputs \"\\nTo add a new book please enter the following requested information:\\n\"\n\tprint \"Book Title \"\n\ttitle = gets.chomp\n\tprint \"Book Author \"\n\tauthor = gets.chomp\n\tprint \"Book ISBN \"\n\tisbn = gets.chomp\n\tprint \"Book Home Library \"\n\tlibrary_id = gets.chomp.to_i\n\tlibrary_id = verify_library_exists(library_id)\n\tBook.create(title: title, author: author, isbn: isbn, library_id: library_id)\nend", "def addBook(book)\n\t\tinventories.create(book_id: book.id)\n\tend", "def create\n \n \n @booktitle = Book.find_by_title(book_params[:title])\n if Book.where(:title => book_params[:title]).present?\n @book = Book.find(@booktitle.id)\n @book.count = @book.count + book_params[:count].to_i\n else\n if !(Author.where(:name => book_params[:author_name]).present?)\n @author = Author.create(:name => book_params[:author_name],\n :category => book_params[:category])\n end\n @book = Book.new(book_params)\n @book.author_id = Author.find_by_name(book_params[:author_name]).id\n end\n\n \n respond_to do |format|\n if @book.save\n \n format.json { render json: @book, status: :created, location: @book }\n else\n \n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @addbook = Addbook.new(params[:addbook])\n\n respond_to do |format|\n if @addbook.save\n flash[:notice] = 'Addbook was successfully created.'\n format.html { redirect_to(@addbook) }\n format.xml { render :xml => @addbook, :status => :created, :location => @addbook }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @addbook.errors, :status => :unprocessable_entity }\n end\n end\n end", "def add_new_library_book\n\t\tputs \"To add new book to library, You need to enter book name and book's author name\"\n\t\tprint \"\\tEnter New Book name:\"\n\t\tnew_book_name=gets.chomp\n\t\tprint \"\\tEnter Author name:\"\n\t\tnew_book_author_name=gets.chomp\n\t\t@last_book_id=@last_book_id+1\n\t\tbook=Book.new(@last_book_id,new_book_name,new_book_author_name,-1)\n\t\t@books.push(book)\n\t\tputs \"New book '#{new_book_name}' has been added to library with book ID #{@last_book_id}\"\n\tend", "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book}\n format.json { render action: 'show', status: :created, location: @book }\n else\n format.html { render action: 'new' }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @librarybook = Librarybook.new(params[:librarybook])\n\n respond_to do |format|\n if @librarybook.save\n format.html { redirect_to(@librarybook, :notice => 'Librarybook was successfully created.') }\n format.xml { render :xml => @librarybook, :status => :created, :location => @librarybook }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @librarybook.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n if is_admin?\n @book = get_book\n else\n go_home\n end\n\n go_home if !@book\n\n respond_to do |format|\n if @book.save\n flash[:notice] = 'Book was successfully created.'\n format.html { redirect_to(@book) }\n format.xml { render :xml => @book, :status => :created, :location => @book }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.new(book_params)\n Rails.logger = Logger.new(STDOUT)\n logger.debug \"params passed is #{book_params}\"\n @book.is_deleted = false\n\n if !@current_librarian.nil?\n @book[:library_id] = @current_librarian.library_id\n @book[:associated_library] = @current_librarian.library.name\n end\n\n respond_to do |format|\n if @book.save\n logger.debug \"Book saved with id #{@book.id}\"\n format.html { redirect_to @book, notice: 'Book was successfully added.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @library_book = current_user.books.new(library_book_params)\n\n respond_to do |format|\n if @library_book.save\n format.html { redirect_to @library_book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @library_book }\n else\n format.html { render :new }\n format.json { render json: @library_book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n flash[:success] = 'Added new Book...!'\n redirect_to :new_user_book, {user_id: @current_user}\n # @book = Book.new(book_params)\n #\n # respond_to do |format|\n # if @book.save\n # format.html { redirect_to @book, notice: 'Book was successfully created.' }\n # format.json { render action: 'show', status: :created, location: @book }\n # else\n # format.html { render action: 'new' }\n # format.json { render json: @book.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def create\n @mybook = Mybook.new(params[:mybook])\n\n respond_to do |format|\n if @mybook.save\n flash[:notice] = 'Mybook was successfully created.'\n format.html { redirect_to(@mybook) }\n format.xml { render :xml => @mybook, :status => :created, :location => @mybook }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @mybook.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create \n epub = params[:file]\n logger.debug(epub.inspect)\n new_book = Book.new()\n new_book.epub = epub\n new_book.user_id = current_user.id\n new_book.import_metadata\n\n if new_book.title.blank? && new_book.epub\n new_book.title = File.basename(new_book.epub.url, '.epub')\n end\n \n new_book.save\n\n respond_to do |format| \n format.html { render :nothing => true }\n format.xml { render :xml => books_url, :status => :created, :location => books_url }\n end\n end", "def add_book(title)\n new_book = {\n title: title,\n rental_details: {\n student_name: \"\",\n date: \"\"\n }\n }\n @books.push(new_book)\n return @books.length\n end", "def create\n @library_book = LibraryBook.new(library_book_params)\n\n respond_to do |format|\n if @library_book.save\n format.html { redirect_to @library_book, notice: 'Library book was successfully created.' }\n format.json { render :show, status: :created, location: @library_book }\n else\n format.html { render :new }\n format.json { render json: @library_book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.find_by_id(params[:book_id])\n # check to see if there is enough copies of the book\n if @book.total_in_library > 0\n @reservation = @user.reservations.new\n @reservation.user_id = @user.id\n @reservation.book_id = @book.id\n if @reservation.save && @book.update(total_in_library: @book.total_in_library - 1)\n redirect_to reservations_path, notice: \"#{@book.title} has been reserved\"\n else\n redirect_to book_path(@book), notice: \"Problems reserving #{@book.title}\"\n end\n else # if not enough copies return back to the show page of the book\n redirect_to book_path(@book), notice: \"Not enough copies of #{@book.title} to reserve\"\n end\n end", "def create\n @book = Book.new(book_params)\n\n if @book.save\n render json: @book, status: :created, location: @book\n else\n render json: @book.errors, status: :unprocessable_entity\n end\n end", "def create\n # Check if this book is in the system\n @book = Book.find_by(id: book_item_params[:book_id])\n if @book == nil \n # Meaning this book is not added to database and \n # book_item_params[:id] is Goodread id\n @book = save_goodreads_book(book_item_params[:book_id])\n book_item_params[:book_id] = @book.id\n end\n # Check if this book_item already in this shelf\n shelf = Shelf.find(book_item_params[:shelf_id])\n @book_item = shelf.book_items.new(book_item_params)\n \n if shelf.save!\n flash[:success] = \"Book item was successfully created.\"\n redirect_to current_user\n else\n flash[:error] = \"Cannot add book to Bookshelf\"\n redirect_to current_user\n end\n end", "def create\n @my_book = MyBook.new(my_book_params)\n\n respond_to do |format|\n if @my_book.save\n format.html { redirect_to @my_book, notice: 'My book was successfully created.' }\n format.json { render :show, status: :created, location: @my_book }\n else\n format.html { render :new }\n format.json { render json: @my_book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book_params = params[:book]\n @date = Date.new(@book_params[\"published_date(1i)\"].to_i, @book_params[\"published_date(2i)\"].to_i, @book_params[\"published_date(3i)\"].to_i)\n @book = Book.new(title: @book_params[:title], author: @book_params[:author], genre: @book_params[:genre], price: @book_params[:price], published_date: @date)\n \n if @book.save\n redirect_to root_path, notice: \"The book \\\"#{@book.title}\\\" has been ADDED!\"\n else\n render :new\n end\n end", "def create\n @cook_book = CookBook.new(params[:cook_book])\n\n respond_to do |format|\n if @cook_book.save\n format.html { redirect_to @cook_book, notice: 'Cook book was successfully created.' }\n format.json { render json: @cook_book, status: :created, location: @cook_book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cook_book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.new(params[:book])\n @book.user_id = current_user.id\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to(@book) }\n format.xml { render :xml => @book, :status => :created, :location => @book }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n byebug\n @book = Book.new(book_params)\n respond_to do |format|\n if @book.save\n format.html { redirect_to [:admin, @book], notice: 'Book was successfully created.' }\n format.json { render action: 'show', status: :created, location: @book }\n else\n load_data\n format.html { render action: 'new' }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n begin\n @book = current_user.writings.create!(params[:book])\n rescue Exception => e\n render 'new', error: @book.errors.full_messages\n end\n\n redirect_to @book\n end" ]
[ "0.7764643", "0.7717482", "0.7546675", "0.75023097", "0.7478946", "0.74436086", "0.74318075", "0.7416036", "0.7416036", "0.740435", "0.73903453", "0.7389598", "0.738658", "0.73805344", "0.7374629", "0.7365513", "0.7362937", "0.7328084", "0.73181134", "0.73014843", "0.7301215", "0.73007715", "0.72794515", "0.7277402", "0.7277402", "0.7274203", "0.7274055", "0.7274055", "0.7274055", "0.72710264", "0.72696096", "0.72678137", "0.7257147", "0.7257147", "0.7257147", "0.7257147", "0.7257147", "0.72359854", "0.7218601", "0.7218601", "0.7218601", "0.7218601", "0.7218601", "0.7218601", "0.7218601", "0.71999896", "0.7194526", "0.718969", "0.718969", "0.718969", "0.718969", "0.718969", "0.718969", "0.718969", "0.718969", "0.718969", "0.718969", "0.718969", "0.718969", "0.718969", "0.71883696", "0.71818304", "0.7169326", "0.71641773", "0.71634483", "0.7160733", "0.71430045", "0.71313953", "0.7131314", "0.71304834", "0.7128696", "0.7126921", "0.7124425", "0.71101785", "0.71025103", "0.7098415", "0.7098415", "0.70916367", "0.70894295", "0.708597", "0.7080576", "0.70785254", "0.707403", "0.7061327", "0.7057837", "0.702774", "0.7011746", "0.69913346", "0.69836986", "0.6978483", "0.6965331", "0.6957456", "0.69538766", "0.6946981", "0.6946812", "0.69401395", "0.6928051", "0.69252896", "0.692223", "0.6916358", "0.6913819" ]
0.0
-1
opens an existing book
def readFromURL(absoluteURL, ofType:inTypeName, error:outError) progressController = ProgressController.alloc.init progressController.showWindowWithTitle("Opening...") do |progressBar| @unzipPath = Dir.mktmpdir(UNZIP_DIRECTORY_PREFIX) progressBar.doubleValue = 10 runCommand("unzip -q -d '#{@unzipPath}' \"#{absoluteURL.path}\"") progressBar.doubleValue = 50 @container = Container.load(@unzipPath, progressBar) progressBar.doubleValue = 100 @issues = [] true end rescue StandardError => exception info = { NSLocalizedDescriptionKey => "The book \"#{absoluteURL.lastPathComponent}\" could not be opened.", NSLocalizedRecoverySuggestionErrorKey => exception.message } outError.assign(NSError.errorWithDomain(NSOSStatusErrorDomain, code:1, userInfo:info)) close false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addBook(book)\n\t\tinventories.create(book_id: book.id)\n\tend", "def book\n fetch('harry_potter.books')\n end", "def book\n response = request(:book, {\n \"currentInvoiceHandle\" => handle.to_hash\n })\n\n # Find the created Invoice\n session.invoices.find(response[:number])\n end", "def add_read_book(book)\n self.read_books.create(:read_book_id => book.id)\n end", "def open\n object.open\n end", "def set_book\n if Book.exists?(params[:id])\n @book = Book.find(params[:id])\n else\n redirect_to \"/books\", alert: \"there's no SUCH book\"\n end\n end", "def new\n unless session[:textbook_id]\n redirect_back fallback_location: root_path, notice: '无法找到指定的图书'\n return\n end\n @textbook = Textbook.find_by(id: session[:textbook_id])\n @booklist = Booklist.new\n end", "def new\n @book = current_user.books.build if signed_in?\n end", "def new\n\t\t@book = Book.new\n\tend", "def create \n epub = params[:file]\n logger.debug(epub.inspect)\n new_book = Book.new()\n new_book.epub = epub\n new_book.user_id = current_user.id\n new_book.import_metadata\n\n if new_book.title.blank? && new_book.epub\n new_book.title = File.basename(new_book.epub.url, '.epub')\n end\n \n new_book.save\n\n respond_to do |format| \n format.html { render :nothing => true }\n format.xml { render :xml => books_url, :status => :created, :location => books_url }\n end\n end", "def booker_new\n end", "def set_library_book\n @library_book = Library::Book.find(params[:id])\n end", "def add_book\n\tputs \"\\nTo add a new book please enter the following requested information:\\n\"\n\tprint \"Book Title \"\n\ttitle = gets.chomp\n\tprint \"Book Author \"\n\tauthor = gets.chomp\n\tprint \"Book ISBN \"\n\tisbn = gets.chomp\n\tprint \"Book Home Library \"\n\tlibrary_id = gets.chomp.to_i\n\tlibrary_id = verify_library_exists(library_id)\n\tBook.create(title: title, author: author, isbn: isbn, library_id: library_id)\nend", "def create\n if is_admin?\n @book = get_book\n else\n go_home\n end\n\n go_home if !@book\n\n respond_to do |format|\n if @book.save\n flash[:notice] = 'Book was successfully created.'\n format.html { redirect_to(@book) }\n format.xml { render :xml => @book, :status => :created, :location => @book }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end", "def open_new_object\n save_state\n oid = open_object\n close_object\n add_object(oid)\n reopen_object(oid)\n oid\n end", "def new\n @book = Book.new\n \n end", "def load_book\n @book = Book.find(params[:id])\n end", "def create\n @book = Book.new(book_params)\n if @book.save\n redirect_to book_path(@book)\n #based on the routes (@ localhost.../routes, or rakes route, we can use the defined path as opposed to a link)\n else\n render 'new'\n #goes back to the new method if the book is not saved\n end\n end", "def opening; end", "def opening; end", "def opening; end", "def add_new_library_book\n\t\tputs \"To add new book to library, You need to enter book name and book's author name\"\n\t\tprint \"\\tEnter New Book name:\"\n\t\tnew_book_name=gets.chomp\n\t\tprint \"\\tEnter Author name:\"\n\t\tnew_book_author_name=gets.chomp\n\t\t@last_book_id=@last_book_id+1\n\t\tbook=Book.new(@last_book_id,new_book_name,new_book_author_name,-1)\n\t\t@books.push(book)\n\t\tputs \"New book '#{new_book_name}' has been added to library with book ID #{@last_book_id}\"\n\tend", "def new\n @book = Book.new\n end", "def new\n @book = Book.new\n end", "def new\n\n\t \t@book = Book.new\n\t \tif params[:book]\n\n\t \t\t@book = Book.new(book_params)\n\n\t \t\t# lay id nguoi dang logi ngan vao owner_id de xac nhan chinh chu\n\t \t\t@book[:owner_id] = current_user.id\n\n\t \t\tif @book.save\n\n\t \t\t\tflash[:success] = \"Saved book!\"\n\t \t\t\tredirect_to '/books'\n\t \t\tend\n\t \tend\n \tend", "def create\n book = Book.create(params[:book])\n redirect_to(book)\n end", "def set_library_book\n @library_book = LibraryBook.find(params[:id])\n end", "def edit\n\t\t@book = Book.find(params[:id])\n\tend", "def set_lib_book\n @lib_book = LibBook.find(params[:id])\n end", "def create\n\t\t@book = Book.new(book_params)\n\t\t@book.save\n\t\tredirect_to books_path\n\tend", "def new_book(image_url)\n Book.new(\n title: \"My book title\",\n author: \"Ipsum\",\n description: \"Lorum\",\n price: 1,\n image_url: image_url)\n end", "def create\n\t\t@books = Book.new(params [:book])\n\n\t\t@books.save\n\n\t\t#redirects to \"show\" method\n\t\tredirect_to @books\n\tend", "def write_book(title,num_pages)\n # THIS PARTICULAR author\n # self\n # WRITE A NEW book\n book = Book.new(title,self,num_pages)\n #code\n end", "def new\n @book = Book.new\n end", "def new\n @book = Book.new\n end", "def new\n @book = Book.new\n end", "def new\n @book = Book.new\n end", "def new\n @book = Book.new\n end", "def new\n @book = Book.new\n end", "def new\n @book = Book.new\n end", "def create\n # Check if this book is in the system\n @book = Book.find_by(id: book_item_params[:book_id])\n if @book == nil \n # Meaning this book is not added to database and \n # book_item_params[:id] is Goodread id\n @book = save_goodreads_book(book_item_params[:book_id])\n book_item_params[:book_id] = @book.id\n end\n # Check if this book_item already in this shelf\n shelf = Shelf.find(book_item_params[:shelf_id])\n @book_item = shelf.book_items.new(book_item_params)\n \n if shelf.save!\n flash[:success] = \"Book item was successfully created.\"\n redirect_to current_user\n else\n flash[:error] = \"Cannot add book to Bookshelf\"\n redirect_to current_user\n end\n end", "def new\n @book = Book.new\n end", "def open\n ensure!\n open_in_editor\n end", "def edit\n @book = Book.find(params[:id])\n end", "def edit\n @book = Book.find(params[:id])\n end", "def load_inventory(library, book, stock)\n inventory = Inventory.add_book_to_library(library, book, stock)\n puts \"#{library.name} has a stock of #{stock} of #{book.title}\"\nend", "def create\n @library_book = current_user.books.new(library_book_params)\n\n respond_to do |format|\n if @library_book.save\n format.html { redirect_to @library_book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @library_book }\n else\n format.html { render :new }\n format.json { render json: @library_book.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n @book = Book.find(params[:id])\n end", "def edit\n @book = Book.find(params[:id])\n end", "def edit\n @book = Book.find(params[:id])\n end", "def add(num)\n #item = '9781133049791'\n item = num.fetch(\"isbn\")\n if !Book.pluck(:isbn).include?(item)\n @res = Amazon::Ecs.item_search(item, { :search_index => 'All', :response_group => 'Medium' })\n @res.items.each do |book|\n @db = Book.create\n @db.isbn = item\n @db.author = book.get('ItemAttributes/Author')\n @db.name = book.get('ItemAttributes/Title')\n @db.edition = book.get('ItemAttributes/Edition').to_i\n @db.retail_price = ((book.get('ItemAttributes/ListPrice/Amount').to_f/100)*3.65).to_i\n @db.description = book.get('EditorialReviews/EditorialReview/Content')\n @db.photo = book.get('LargeImage/URL')\n @db.save\n end\n end\n @thisBook = Book.find(:all, :conditions => {:isbn => item})\n redirect_to @thisBook\n end", "def checkout_book(title)\n # find book instance by title\n searched_book = Book.find_by(title: title)\n # change book.available to false\n searched_book.update_column(:available, false)\n # create Checkout instance with student id, book id, due date, checked_out defaults to true\n Checkout.create(student_id: self.id, book_id: searched_book.id, due_date: ((Date.today)+7))\n end", "def book\n @library_location = 2\n super\n end", "def createNewBook(path)\n puts \"Create New Book\"\n\n #1 Call encryptor\n runEncryptor(path+\"output/ihtml/\",@book_prod_folder)\n \n #2 Copy searchDB.sql to root path\n copyFile(path+\"output/searchDB.sql\", @book_prod_folder)\n \n #3 Validate info.plist\n validateInfoPlist(path+\"info.plist\")\n \n #4 Copy info.plist to root path\n copyFile(path+\"info.plist\", @book_prod_folder)\n \n #5 Copy balloons folder\n copyZipContents(\"balloons_images.zip\", @book_prod_folder+\"images/\")\n copyZipContents(\"balloons_script.zip\", @book_prod_folder+\"script/\") \n if !File::directory?(@book_prod_folder+\"icons/\")\n if File::directory?(path+\"/icons/\")\n Dir.mkdir(@book_prod_folder+\"icons/\")\n end\n end\n copyFolderContents(path+\"icons/\",@book_prod_folder+\"icons/\");\n \n #6 Verify Folders\n verifyFolders(@book_prod_folder)\n \n #7 Update time stamp\n changeTimestamp(@book_prod_folder,@new_book_timestamp)\n \n #8 Create Zip\n createZip(@book_prod_folder,@book_zip_generated_folder+@book_full_name+\".zip\",1)\n \n puts \"New Book Generated -\"+@book_full_name\nend", "def show\n @library = Library.find(Book.find(params[:id]).library_id)\n end", "def create\n # params[:book] --> inspect the html file then you can see the name as name=book[title] and name=book[author]\n # Book.create(params[:book]) # create and save it in db\n @book=Book.new(book_params)# create instant or copy \n # it take book_params method to checked\n \n # save it to database\n if @book.save \n redirect_to books_path # go to books path\n else\n render action: \"new\" # back to the action new\n end\n end", "def set_book\r\n @book = Book.find(params[:id])\r\n end", "def start_book(attributes)\n id = Hash[attributes]['id']\n unless IGNORE_BOOK_IDS.include?(id)\n @book_num += 1\n @book_id = id\n @mode = 'book'\n @book = ''\n end\n end", "def set_book\n @book = Book.find(params[:id])\n end", "def book_with_number(number)\n response = request(:book_with_number, {\n \"currentInvoiceHandle\" => handle.to_hash,\n \"number\" => number\n })\n\n # Find the created Invoice\n session.invoices.find(response[:number])\n end", "def set_book\n @book = Book.find(params[:id])\n end", "def set_book\n @book = Book.find(params[:id])\n end", "def set_book\n @book = Book.find(params[:id])\n end", "def set_book\n @book = Book.find(params[:id])\n end", "def set_book\n @book = Book.find(params[:id])\n end", "def set_book\n @book = Book.find(params[:id])\n end", "def set_book\n @book = Book.find(params[:id])\n end", "def set_book\n @book = Book.find(params[:id])\n end", "def set_book\n @book = Book.find(params[:id])\n end", "def set_book\n @book = Book.find(params[:id])\n end", "def set_book\n @book = Book.find(params[:id])\n end", "def set_book\n @book = Book.find(params[:id])\n end", "def set_book\n @book = Book.find(params[:id])\n end", "def set_book\n @book = Book.find(params[:id])\n end", "def set_book\n @book = Book.find(params[:id])\n end", "def set_book\n @book = Book.find(params[:id])\n end", "def set_book\n @book = Book.find(params[:id])\n end", "def set_book\n @book = Book.find(params[:id])\n end", "def set_book\n @book = Book.find(params[:id])\n end", "def set_book\n @book = Book.find(params[:id])\n end", "def set_book\n @book = Book.find(params[:id])\n end", "def set_book\n @book = Book.find(params[:id])\n end", "def set_book\n @book = Book.find(params[:id])\n end", "def set_book\n @book = Book.find(params[:id])\n end", "def set_book\n @book = Book.find(params[:id])\n end", "def set_book\n @book = Book.find(params[:id])\n end", "def set_book\n @book = Book.find(params[:id])\n end", "def set_book\n @book = Book.find(params[:id])\n end", "def set_book\n @book = Book.find(params[:id])\n end", "def set_book\n @book = Book.find(params[:id])\n end", "def set_book\n @book = Book.find(params[:id])\n end", "def set_book\n @book = Book.find(params[:id])\n end", "def set_book\n @book = Book.find(params[:id])\n end", "def set_book\n @book = Book.find(params[:id])\n end", "def set_book\n @book = Book.find(params[:id])\n end", "def set_book\n @book = Book.find(params[:id])\n end", "def set_book\n @book = Book.find(params[:id])\n end", "def set_book\n @book = Book.find(params[:id])\n end", "def set_book\n @book = Book.find(params[:id])\n end", "def set_book\n @book = Book.find(params[:id])\n end", "def set_book\n @book = Book.find(params[:id])\n end" ]
[ "0.60611194", "0.60306656", "0.6000759", "0.5888902", "0.5861752", "0.58355224", "0.5831696", "0.58066", "0.5806328", "0.5798352", "0.5788571", "0.5778525", "0.5766758", "0.57602376", "0.57599753", "0.57362884", "0.571981", "0.5717504", "0.57125825", "0.57125825", "0.57125825", "0.57113934", "0.57085675", "0.57085675", "0.57073087", "0.570085", "0.56921077", "0.56917155", "0.56881106", "0.56798327", "0.56779", "0.5673192", "0.56508905", "0.56349266", "0.56349266", "0.56349266", "0.56349266", "0.56349266", "0.56349266", "0.56349266", "0.5611013", "0.5603359", "0.56000125", "0.55850357", "0.55850357", "0.55820924", "0.5579594", "0.5576872", "0.5576872", "0.5576872", "0.5544778", "0.5535158", "0.55083776", "0.55078226", "0.55001813", "0.54945225", "0.54908067", "0.54875004", "0.5487137", "0.5483024", "0.5481289", "0.5479945", "0.5479945", "0.5479945", "0.5479945", "0.5479945", "0.5479945", "0.5479945", "0.5479945", "0.5479945", "0.5479945", "0.5479945", "0.5479945", "0.5479945", "0.5479945", "0.5479945", "0.5479945", "0.5479945", "0.5479945", "0.5479945", "0.5479945", "0.5479945", "0.5479945", "0.5479945", "0.5479945", "0.5479945", "0.5479945", "0.5479945", "0.5479945", "0.5479945", "0.5479945", "0.5479945", "0.5479945", "0.5479945", "0.5479945", "0.5479945", "0.5479945", "0.5479945", "0.5479945", "0.5479945", "0.5479945" ]
0.0
-1
validation issues not specific to a manifest item are assigned to book
def addIssue(issue) @issues << issue if issue end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_manifest_inventory(moab_version)\n manifest_file_path = \"#{moab_version.version_pathname}/#{MANIFESTS}/#{MANIFESTS_XML}\"\n parse_verification_subentities(moab_version.verify_manifest_inventory)\n rescue Nokogiri::XML::SyntaxError\n results.add_result(AuditResults::INVALID_MANIFEST, manifest_file_path: manifest_file_path)\n rescue Errno::ENOENT\n results.add_result(AuditResults::MANIFEST_NOT_IN_MOAB, manifest_file_path: manifest_file_path)\n end", "def valid_embedded_item\n return unless embedded_item && !embedded_item.errors.empty?\n\n embedded_item.errors.each do |k, v|\n errors.add k, v\n end\n end", "def validate_item( x )\n fail 'not implemented!'\n end", "def checkListingAttributeRequirements\n @mandatory_attributes_from_db.each do |mand_attr|\n @listing_data.each do |listing|\n if listing[mand_attr[:name].to_sym] == nil\n listing[mand_attr[:name].to_sym] = \"#mand_attr_missing\"\n listing[:invalid] = \"Mandatory attribute #{mand_attr[:name]} missing!\"\n @invalid_rows = true\n end\n\n # handle title\n if listing[:type] == \"renting\"\n end\n end\n end\n end", "def check_book_availability\n if self.book.book_copies.unassigned_copies.where(is_active: true).count < 1\n errors.add(:base, \"Book out of stock\")\n end\n end", "def validate_pkg_manifest\n log.info(log_key) { \"Validating package manifest\" }\n shellout!(\"pkglint -c /tmp/lint-cache -r http://pkg.oracle.com/solaris/release #{pkg_manifest_file}.5.res\")\n end", "def validate\n if self.line_item_problem_type.form_tag == 'wrong_dvd' && self.wrong_copy_id.nil?\n errors.add_to_base(\"Barcode number is required\")\n end\n end", "def valid_isbn\n errors.add(:isbn, \"This is not a valid ISBN.\") unless ISBN_Tools.is_valid?(self.isbn) \n end", "def mods_assets_update_validation\n i = 0\n desc_metadata = params[:asset][:descMetadata]\n unless desc_metadata.nil?\n while desc_metadata.has_key? \"person_#{i}_computing_id\".to_sym\n if desc_metadata[\"person_#{i}_first_name\".to_sym][\"0\"].blank? or desc_metadata[\"person_#{i}_last_name\".to_sym][\"0\"].blank?\n flash[:error] = \"The First and Last names are required for all authors.\"\n return false\n end\n i += 1\n end\n end\n return true\n end", "def file_checks\n errors = []\n errors << 'There are no entries in the manifest file.' if @current_package.manifest.count == 0\n errors\n end", "def validate\n\tvalidate_unexpected_assets_not_present && validate_expected_asset_present && validate_snippet_and_description\nend", "def validate( _x )\n msg = 'ERROR: Item.validate() not implemented!'\n msg += \"\\nTODO: cover common type-based validations?\"\n msg += \"\\nTODO: Offer validation objects?\"\n fail msg\n end", "def create\n @book = Book.new(params[:book])\n respond_to do |format|\n begin\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n #This will take care of duplicate book entry in the scope of same authors only. \n rescue InvalidBook => e\n @book.errors[:base] << e.to_s\n format.html { render action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def validate_ownership\n buyer_items.each { |item| item.validate_owner seller }\n seller_items.each { |item| item.validate_owner buyer }\n end", "def users_presence\n errors.add(:users, \"You must add at least one book\") unless books.present?\n end", "def error_handling(cookbook, item_to_make)\n unless cookbook.has_key?(item_to_make)\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\")\n end\nend", "def error_handling(cookbook, item_to_make)\n unless cookbook.has_key?(item_to_make)\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\")\n end\nend", "def consistent?\n (manifest_files | tagmanifest_files).each do |mf|\n # get the algorithm implementation\n File.basename(mf) =~ /manifest-(.+).txt$/\n type = Regexp.last_match(1)\n algo = manifest_type(type)\n # Check every file in the manifest\n File.open(mf) do |io|\n io.each_line do |line|\n expected, path = line.chomp.split(/\\s+/, 2)\n file = File.join(bag_dir, decode_filename(path))\n\n next unless File.exist? file\n actual = algo.file(file).hexdigest\n errors.add :consistency, \"expected #{file} to have #{algo}: #{expected}, actual is #{actual}\" if expected.downcase != actual\n end\n end\n end\n\n errors.on(:consistency).nil?\n end", "def validate\n if( title =~ /^hc12/ || title =~ /^bthfck2/ )\n errors.add_to_base(\"Titles which begin with 'hc12' or 'bthfck2' are reserved!\" )\n end\n \n if( title =~ /[^\\s^_A-Z^a-z^0-9^-]/ )\n errors.add_to_base(\"Only digits, characters, '-' and blanks are allowed for the title!\")\n end\n\n if( ( bundle = Bundle.find_by_title(title) ) != nil )\n if( bundle.created_by_user_id != user_id )\n errors.add_to_base(\"This title is already used! Choose another one.\")\n end\n end\n \n if content_type\n unless( content_type =~ /^image\\/(png)|(jpeg)|(gif)/i )\n errors.add_to_base(\"Images must have the format jpg, png or gif\")\n end\n \n unless was_upload_successful\n errors.add_to_base(\"Image file is too big. It must be smaller then 300K\")\n end\n \n end\n \n end", "def validate_version(_item)\n nil\n end", "def has_invalid_items?\n unless @offer[:items].empty? || @offer[:items].select { |item_name|\n !Inventory.items_and_values.include?(item_name)}.empty?\n add_error(:offer, :items, \"There is an invalid item in the list\")\n error = true\n end\n unless @for[:items].empty? || @for[:items].select { |item_name|\n !Inventory.items_and_values.include?(item_name)}.empty?\n add_error(:for, :items, \"There is an invalid item in the list\")\n error = true\n end\n\n error ||= false\n end", "def valid?(entry)\n true\n end", "def create\n # Check if this book is in the system\n @book = Book.find_by(id: book_item_params[:book_id])\n if @book == nil \n # Meaning this book is not added to database and \n # book_item_params[:id] is Goodread id\n @book = save_goodreads_book(book_item_params[:book_id])\n book_item_params[:book_id] = @book.id\n end\n # Check if this book_item already in this shelf\n shelf = Shelf.find(book_item_params[:shelf_id])\n @book_item = shelf.book_items.new(book_item_params)\n \n if shelf.save!\n flash[:success] = \"Book item was successfully created.\"\n redirect_to current_user\n else\n flash[:error] = \"Cannot add book to Bookshelf\"\n redirect_to current_user\n end\n end", "def validate_manifest_file manifest_dir\n manifest_file = \"#{manifest_dir}/Manifest.txt\"\n raise \"#{manifest_file} does not exist\" unless test ?f, manifest_file\n manifest = File.new(manifest_file).readlines.map { |x| x.strip }\n manifest -= perforce_ignore\n\n exclusions = with_config do |config, _|\n config[\"exclude\"]\n end\n\n local_manifest = []\n\n Dir.chdir manifest_dir do\n system 'rake clean'\n Find.find '.' do |f|\n next if f =~ exclusions\n local_manifest << f.sub(/^\\.\\//, '') if File.file? f\n end\n end\n\n local_manifest -= perforce_ignore\n\n extra_files = local_manifest - manifest\n missing_files = manifest - local_manifest\n\n msg = []\n\n unless extra_files.empty? then\n msg << \"You have files that are not in your manifest\"\n msg << \" #{extra_files.inspect}\"\n end\n\n unless missing_files.empty? then\n msg << \"You have files that are missing from your manifest\"\n msg << \" #{missing_files.inspect}\"\n end\n\n raise msg.join(\"\\n\") unless msg.empty?\n end", "def ensure_not_referenced\n errors[:base] << \"Student has bookings\" if !bookings.count.zero?\n errors[:base] << \"Student has marks\" if !marks.count.zero?\n\n if errors[:base].length > 0\n return false\n else\n return true\n end\n end", "def valid?\n @errors << :title if !@title.is_a?(String) || @title.empty?\n @errors << :author if !@author.is_a?(String) || @author.empty?\n @errors << :release_date unless @release_date.is_a?(Date)\n @errors << :publisher if !@publisher.is_a?(String) || @publisher.empty?\n @errors << :isbn unless @isbn.is_a?(Integer) && @isbn < 10**10 && @isbn >= 10**9\n \n @errors.empty?\n end", "def validateInfoPlist(file_path)\n puts \"Validating info.plist\"\n\txmldoc = XmlSimple.xml_in(file_path)\n\txmlkeys= xmldoc['dict']\n\tkey=[\"a\"]\n\tvalue=[\"a\"]\n\ti=0;\t\n\txmlkeys[0].each do |data|\n\t if i==0\n\t\tkey=data\n\t elsif i==1\n\t\tvalue=data\n\t end\n\t i=i+1\n\tend\n\tkey=key[1]\n\tvalue=value[1]\n\ti=0;\n\tkey.each do |key_data|\n\t\tif key_data==\"bookDirectory\" || key_data==\"bookID\"\n\t\t\ttemp=value[i].split(\"com.medhand.books.\").last\n\t\t\tif temp.include?\".\"\n\t\t\t\tputs \"info.plist: Invalid value for \"+key_data + \"\\n\"+value[i]\n\t\t\t\texit\n\t\t\tend\n\t\t\tif !(value[i]==@book_full_name)\n\t\t\t puts key_data+\" value mismatch- \"+value[i]\n\t\t\t puts \"Expected: \"+@book_full_name\n\t\t\t exit\n\t\t\tend\n\t\tend\n\t\ti=i+1\n\tend\nend", "def create\n if book_item_params[:quantity].to_i > 0 \n @book = Book.find(book_item_params[:book_id]) if !book_item_params[:book_id].blank?\n if @book.blank? \n @book = Book.find_or_create_by(goodreads_id: book_item_params[:goodreads_id])\n @book.update_goodreads_info\n end\n # Check if this book_item already in this shelf\n @book_item = BookItem.find_or_create_by(shelf_id: book_item_params[:shelf_id], book_id: @book.id)\n @book_item.quantity = book_item_params[:quantity]\n @book_item.available_count = book_item_params[:quantity]\n \n if @book_item.save!\n flash[:success] = \"You got a book.\"\n else\n flash[:error] = \"Something wrong.\"\n flash[:error] = @book_item.errors.full_messages.to_sentence\n end\n else \n book_id = (book_item_params[:book_id] || Book.find_by(goodreads_id: book_item_params[:goodreads_id].to_i).presence.try(:id))\n @book_items = BookItem.where(\"shelf_id = ? AND book_id = ?\", book_item_params[:shelf_id], book_id) if book_id.present?\n if @book_items.present?\n @book_items.destroy_all \n flash[:warning] = \"Book removed.\"\n else\n flash[:warning] = \"Mission impossible.\"\n end\n end\n redirect_to :back\n end", "def ensure_not_referenced_by_any_item\n\t\tunless items.empty?\n\t\t\terrors.add(:base, 'Na stanie są sztuki tego produktu')\n\t\t\tthrow :abort\n\t\tend\n\tend", "def check_resource_semantics!; end", "def valid_edit_entry_reqs\n if !params[:edit_entry_req].nil?\n edit_reqs_vals = params[:edit_entry_req].values\n edit_reqs_vals.each_slice(3) do |grade, info, remove|\n if grade.empty?\n return false\n end\n end\n end\n return true\n end", "def verify_integrity(object, entry)\n base_name = remove_dot_json(entry.name)\n if object[\"raw_data\"][\"id\"] != base_name\n yield(\"ID in #{entry.path_for_printing} must be '#{base_name}' (is '#{object[\"raw_data\"][\"id\"]}')\")\n elsif RESERVED_NAMES.match?(entry.parent.name)\n yield(\"Data bag name ('#{entry.parent.name}') must not match #{RESERVED_NAMES.inspect}\")\n end\n end", "def validate_books\r\n csv_text = open(file.url)\r\n csv = CSV.parse(csv_text, :headers => true)\r\n csv.each do |row|\r\n book_hash = Book.new\r\n book_hash.title = row[\"Book title\"]\r\n book_hash.author = Author.find_or_create_by(name: row[\"Book author\"])\r\n book_hash.published_at = Date.parse(row[\"Date published\"])\r\n book_hash.uuid = row[\"Unique identifier for the book\"]\r\n book_hash.publisher_name = row[\"Publisher name\"]\r\n book_hash.user_id = user_id\r\n unless book_hash.valid?\r\n self.errors[:base] << \"UUID Already exist for #{row[\"Unique identifier for the book\"]}\"\r\n end\r\n end\r\n end", "def valid?\n @errors = []\n \n if !item_id.nil? && item_id !~ GUID_REGEX\n @errors << ['line_item_id', 'must be blank or a valid Xero GUID']\n end\n \n unless description\n @errors << ['description', \"can't be blank\"]\n end\n \n @errors.size == 0\n end", "def my_valid?\n application_events.each { |ev| ev.my_valid? }\n\n ap_nos = application_events.collect { |ap| ap.application_number }\n # XXX - use a case?\n if application_event_count > application_events.count\n diff = self._ap_nos - ap_nos\n if diff == []\n warn \"WARNING in #{report.class.name.inspect} report, missing application events for page #{number}: #{application_event_count} > #{application_events.count} #{(self._ap_nos - ap_nos).inspect} (probably because there was a duplicate application event on this page - i.e. not *our* fault.)\"\n else\n warn \"ERROR in #{report.class.name.inspect} report, missing application events for page #{number}: #{application_event_count} > #{application_events.count} #{(self._ap_nos - ap_nos).inspect}\"\n end\n elsif application_events.count > application_event_count \n warn \"ERROR in #{report.class.name.inspect} report, extra application events for page #{number}: #{application_events.count} > #{application_event_count} #{(ap_nos - self._ap_nos).inspect}\"\n elsif application_event_count == application_events.count\n true\n else\n raise \"ERROR unreachable\"\n end\n end", "def invalid_items\n items.select { |item| item.errors.present? }\n end", "def validate_cookbook\n path = File.expand_path(File.join(target, 'metadata.rb'))\n unless File.exists?(path)\n raise Berkshelf::NotACookbook.new(path)\n end\n end", "def ensure_not_referenced_by_any_line_item\nif line_items.count.zero?\nreturn true\nelse\nerrors[:base] << \"Line Items present\"\nreturn false\nend\nend", "def not_a_duplicate\n book = Book.find_by(title: title, author: author)\n if !!book && book != self\n errors.add(:book, 'is already in the book index.')\n end\n end", "def validate_item(item)\n if item.to_s.empty?\n raise NameError.new \"Item name is required. No item name provided.\"\n end\n items = [item]\n [\"\", \".json\", \".rb\", \".xml\", \".yaml\", \".yml\"].each do |extension|\n items += [\n File.join(\n config.fetch(\n :sfn_parameters, :directory, \"stacks\"\n ),\n \"#{item}#{extension}\"\n ),\n File.join(\n config.fetch(\n :sfn_parameters, :directory, \"infrastructure\"\n ),\n \"#{item}#{extension}\"\n ),\n ]\n end\n items = items.map { |item| File.expand_path(item) }.uniq\n valid = items.find_all do |file|\n File.exist?(file)\n end\n if valid.empty?\n raise ArgumentError.new \"Failed to locate item `#{item}`!\"\n elsif valid.size > 1\n raise ArgumentError.new \"Multiple matches detected for item `#{item}`. \" \\\n \"(Matches: #{valid.join(\", \")})\"\n else\n valid.first\n end\n end", "def ensure_not_referenced_by_any_line_item\n\nif line_items.count.zero?\nreturn true\nelse\nerrors[:base] << \"Line Items present\"\nreturn false\nend\nend", "def validate(entry)\n\tputs \"----------\"\n\tputs entry\n\treturn false if not validate_year(entry[\"byr\"], \"byr\", 1920, 2002)\n\treturn false if not validate_year(entry[\"iyr\"], \"iyr\", 2010, 2020)\n\treturn false if not validate_year(entry[\"eyr\"], \"eyr\", 2020, 2030)\n\treturn false if not validate_hgt(entry[\"hgt\"])\n\treturn false if not validate_color(entry[\"hcl\"])\n\treturn false if not validate_ecl(entry[\"ecl\"])\n\treturn false if not validate_pid(entry[\"pid\"])\n\tputs \"valid\"\n\treturn true\nend", "def validate_line_items\n \n end", "def validate\n validate_resources_defined\n validates_unique(:resource_id, :message => \"ARK must point to a unique Resource\")\n validates_unique(:archival_object_id, :message => \"ARK must point to a unique Archival Object\")\n super\n end", "def ensure_not_referenced_by_any_line_item\n\tif line_items.count.zero?\nreturn true\nelse\nerrors[:base] << \"Line Items present\"\nreturn false\nend\nend", "def bookkept_validation?\n !(bookkept_by_id_was.nil? || id.nil?)\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 verify_integrity(object, entry)\n if entry.org != object[\"name\"]\n yield(\"Name must be '#{entry.org}' (is '#{object[\"name\"]}')\")\n end\n end", "def test_appellation_invalidity\n assert !@invalid_appellation.valid?\n attributes = [:name, :apptype_id]\n attributes.each do |attribute|\n assert @invalid_appellation.errors.invalid?(attribute)\n end\n end", "def ensure_not_referenced_by_any_line_item\n\n if line_items.count.zero?\n return true\n else\n errors[:base] << \"Line Items present\"\n return false\n\nend\nend", "def validate_essential_attributes #:nodoc:\n if @month.to_i.zero? || @year.to_i.zero?\n errors.add :month, \"is required\" if @month.to_i.zero?\n errors.add :year, \"is required\" if @year.to_i.zero?\n else\n errors.add :month, \"is not a valid month\" unless valid_month?(@month)\n errors.add 'card', \"has expired\" if expired?\n errors.add :year, \"is not a valid year\" unless valid_expiry_year?(@year)\n end\n end", "def report_invalid_config_items\n buf = []\n AppConfig.validate.each do |field, value|\n unless AppConfig.validate[field].call(AppConfig.config[field])\n buf << field\n end\n end\n unless buf.empty?\n say 'The following config items are not valid and need to be changed:'\n buf.each {|line| say \" #{line}\"}\n end\n end", "def ensure_not_referenced_by_any_line_item\n\tif line_items.count.zero?\nreturn true\nelse\nerrors.add(:base, 'Line Items present' )\nreturn false\n end\nend", "def ensure_not_referenced_by_any_item_line\n if item_lines.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\nend", "def valid_item?\n # PCP Items can only be created by Commenting Group\n return 1 if pcp_step.in_presenting_group?\n\n # scenario without comments; note that I can safely assume that there are at\n # least two steps ... because it is not allowed to add PCP Items to the first\n # PCP Step (0), hence the current step is at least PCP Step (1).\n ps = pcp_subject.current_steps\n if pcp_comments.count == 0 then\n if pcp_step == ps[ 0 ] # newly created?\n return ( pub_assmt.nil? && new_assmt == assessment ) ? 0 : 2\n elsif pcp_step == ps[ 1 ] # new item released\n return ( pub_assmt == new_assmt && new_assmt == assessment ) ? 0 : 3\n else\n # inconsistent: there should be comments in the previous step\n return 4\n end\n end\n # we have comments here ( pcp_comments.count > 0 )\n \n # if PCP Item was newly created for step, last public comment -\n # if existing - determines current assessment, else assessment\n if pcp_step == ps[ 0 ]\n return 5 unless pub_assmt.nil?\n na = assessment\n pcp_comments.each do | c |\n return 6 unless c.pcp_step == pcp_step\n na = c.assessment if c.is_public\n end\n return ( new_assmt == na ) ? 0 : 7\n end\n\n # PCP Item was created for earlier step, determine current assessment\n # from current comments: default is last, most recent comment, look\n # for any public comments which then override new_assmt\n pc = pcp_comments.for_step( ps[ 0 ])\n if pc.count == 0 \n # no comments for current step (yet - or if closed)\n return 8 unless ( pub_assmt == new_assmt )\n elsif ps[ 0 ].in_commenting_group?\n na = pc.last.assessment\n pc.each do | c |\n na = c.assessment if c.is_public\n end\n return 9 unless ( new_assmt == na )\n else\n # no assessment changes allowed by presenting group\n pc.each do | c |\n return 10 if assessment_changed?( c.assessment )\n end\n end\n\n # now check if pub_assmt is correctly computed from previous step:\n # determine last released assessment, if any\n\n if ps[ 1 ].in_presenting_group?\n # there should be no changes at all\n pc = pcp_comments.for_step( ps[ 1 ])\n pc.each do | c |\n return 11 unless ( pub_assmt == c.assessment )\n # note: new_assmt could be different now due to new comments\n # in current step ...\n end\n else # in_commenting_group?\n pc = pcp_comments.is_public.for_step( ps[ 1 ])\n if pc.count > 0\n return 12 unless ( pub_assmt == pc.last.assessment )\n else # no public comments, assessment comes from item\n return 13 unless ( pub_assmt == new_assmt && new_assmt == assessment )\n end\n end\n\n return 0\n end", "def invalid_item(node)\n false\n end", "def ensure_not_referenced_by_any_line_item\nif line_items.empty?\nreturn true\nelse\nerrors.add(:base, 'Line Items present')\nreturn false\nend\nend", "def ensure_not_referenced_by_any_line_item\nif line_items.empty?\nreturn true\nelse\nerrors.add(:base, 'Line Items present')\nreturn false\nend\nend", "def ensure_not_referenced_by_any_line_item\nif line_items.empty?\nreturn true\nelse\nerrors.add(:base, 'Line Items present')\nreturn false\nend\nend", "def ensure_not_referenced_by_any_line_item\nif line_items.empty?\nreturn true\nelse\nerrors.add(:base, 'Line Items present')\nreturn false\nend\nend", "def ensure_not_referenced_by_any_line_item\nunless line_items.empty?\nerrors.add(:base, 'Line Items present')\nthrow :abort\nend\nend", "def ensure_not_referenced_by_any_line_item\nunless line_items.empty?\nerrors.add(:base, 'Line Items present')\nthrow :abort\nend\nend", "def ensure_not_referenced_by_any_line_item\nunless line_items.empty?\nerrors.add(:base, 'Line Items present')\nthrow :abort\nend\nend", "def ensure_not_referenced_by_any_line_item \n if readings.count.zero? \n return true \n else \n errors[:base] << \"Readings present\" \n return false \n end \n end", "def validate_items\n [buyer_items, seller_items].each do |items|\n fail InvalidItemsError unless items.kind_of?(Enumerable)\n end\n end", "def validate!\n validate_patches!\n validate_new_branch_name! if new_branch?\n validate_permissions!\n end", "def validate_embargo(env, intention, attributes, template)\n return true unless intention.wants_embargo?\n\n embargo_release_date = parse_date(attributes[:embargo_release_date])\n # Deepblue::LoggingHelper.bold_debug [ Deepblue::LoggingHelper.here,\n # Deepblue::LoggingHelper.called_from,\n # \"before test\",\n # \"attributes=#{attributes}\",\n # \"embargo_release_date=#{embargo_release_date}\" ]\n\n valid_embargo_release_date = DeepBlueDocs::Application.config.embargo_enforce_future_release_date ? valid_future_date?(env, embargo_release_date) : true\n # valid_template_embargo_date = valid_template_embargo_date?(env, embargo_release_date, template)\n # valid_template_visibility_after_embargo = valid_template_visibility_after_embargo?(env, attributes, template)\n # Deepblue::LoggingHelper.bold_debug [ Deepblue::LoggingHelper.here,\n # Deepblue::LoggingHelper.called_from,\n # \"after test\",\n # \"valid_embargo_release_date=#{valid_embargo_release_date}\",\n # \"valid_template_embargo_date=#{valid_template_embargo_date}\",\n # \"valid_template_visibility_after_embargo=#{valid_template_visibility_after_embargo}\" ]\n\n # When embargo required, date must be in future AND matches any template requirements\n return true if valid_embargo_release_date &&\n valid_template_embargo_date?(env, embargo_release_date, template) &&\n valid_template_visibility_after_embargo?(env, attributes, template)\n\n env.curation_concern.errors.add(:visibility, 'When setting visibility to \"embargo\" you must also specify embargo release date.') if embargo_release_date.blank?\n false\n end", "def valid?\n return false if @class_id.nil?\n class_id_validator = EnumAttributeValidator.new('String', [\"aaa.AuditRecord\", \"aaa.RetentionConfig\", \"aaa.RetentionPolicy\", \"access.Policy\", \"adapter.ConfigPolicy\", \"adapter.ExtEthInterface\", \"adapter.HostEthInterface\", \"adapter.HostFcInterface\", \"adapter.HostIscsiInterface\", \"adapter.Unit\", \"adapter.UnitExpander\", \"appliance.AppStatus\", \"appliance.AutoRmaPolicy\", \"appliance.Backup\", \"appliance.BackupPolicy\", \"appliance.CertificateSetting\", \"appliance.DataExportPolicy\", \"appliance.DeviceCertificate\", \"appliance.DeviceClaim\", \"appliance.DeviceUpgradePolicy\", \"appliance.DiagSetting\", \"appliance.ExternalSyslogSetting\", \"appliance.FileGateway\", \"appliance.FileSystemStatus\", \"appliance.GroupStatus\", \"appliance.ImageBundle\", \"appliance.NodeInfo\", \"appliance.NodeStatus\", \"appliance.ReleaseNote\", \"appliance.RemoteFileImport\", \"appliance.Restore\", \"appliance.SetupInfo\", \"appliance.SystemInfo\", \"appliance.SystemStatus\", \"appliance.Upgrade\", \"appliance.UpgradePolicy\", \"asset.ClusterMember\", \"asset.Deployment\", \"asset.DeploymentDevice\", \"asset.DeviceClaim\", \"asset.DeviceConfiguration\", \"asset.DeviceConnectorManager\", \"asset.DeviceContractInformation\", \"asset.DeviceRegistration\", \"asset.Subscription\", \"asset.SubscriptionAccount\", \"asset.SubscriptionDeviceContractInformation\", \"asset.Target\", \"bios.BootDevice\", \"bios.BootMode\", \"bios.Policy\", \"bios.SystemBootOrder\", \"bios.TokenSettings\", \"bios.Unit\", \"bios.VfSelectMemoryRasConfiguration\", \"boot.CddDevice\", \"boot.DeviceBootMode\", \"boot.DeviceBootSecurity\", \"boot.HddDevice\", \"boot.IscsiDevice\", \"boot.NvmeDevice\", \"boot.PchStorageDevice\", \"boot.PrecisionPolicy\", \"boot.PxeDevice\", \"boot.SanDevice\", \"boot.SdDevice\", \"boot.UefiShellDevice\", \"boot.UsbDevice\", \"boot.VmediaDevice\", \"bulk.Export\", \"bulk.ExportedItem\", \"bulk.MoCloner\", \"bulk.MoMerger\", \"bulk.Request\", \"bulk.SubRequestObj\", \"capability.AdapterUnitDescriptor\", \"capability.Catalog\", \"capability.ChassisDescriptor\", \"capability.ChassisManufacturingDef\", \"capability.CimcFirmwareDescriptor\", \"capability.EquipmentPhysicalDef\", \"capability.EquipmentSlotArray\", \"capability.FanModuleDescriptor\", \"capability.FanModuleManufacturingDef\", \"capability.IoCardCapabilityDef\", \"capability.IoCardDescriptor\", \"capability.IoCardManufacturingDef\", \"capability.PortGroupAggregationDef\", \"capability.PsuDescriptor\", \"capability.PsuManufacturingDef\", \"capability.ServerSchemaDescriptor\", \"capability.SiocModuleCapabilityDef\", \"capability.SiocModuleDescriptor\", \"capability.SiocModuleManufacturingDef\", \"capability.SwitchCapability\", \"capability.SwitchDescriptor\", \"capability.SwitchManufacturingDef\", \"certificatemanagement.Policy\", \"chassis.ConfigChangeDetail\", \"chassis.ConfigImport\", \"chassis.ConfigResult\", \"chassis.ConfigResultEntry\", \"chassis.IomProfile\", \"chassis.Profile\", \"cloud.AwsBillingUnit\", \"cloud.AwsKeyPair\", \"cloud.AwsNetworkInterface\", \"cloud.AwsOrganizationalUnit\", \"cloud.AwsSecurityGroup\", \"cloud.AwsSubnet\", \"cloud.AwsVirtualMachine\", \"cloud.AwsVolume\", \"cloud.AwsVpc\", \"cloud.CollectInventory\", \"cloud.Regions\", \"cloud.SkuContainerType\", \"cloud.SkuDatabaseType\", \"cloud.SkuInstanceType\", \"cloud.SkuNetworkType\", \"cloud.SkuRegionRateCards\", \"cloud.SkuVolumeType\", \"cloud.TfcAgentpool\", \"cloud.TfcOrganization\", \"cloud.TfcWorkspace\", \"comm.HttpProxyPolicy\", \"compute.BiosPostPolicy\", \"compute.Blade\", \"compute.BladeIdentity\", \"compute.Board\", \"compute.Mapping\", \"compute.PhysicalSummary\", \"compute.RackUnit\", \"compute.RackUnitIdentity\", \"compute.ServerPowerPolicy\", \"compute.ServerSetting\", \"compute.Vmedia\", \"cond.Alarm\", \"cond.AlarmAggregation\", \"cond.HclStatus\", \"cond.HclStatusDetail\", \"cond.HclStatusJob\", \"connectorpack.ConnectorPackUpgrade\", \"connectorpack.UpgradeImpact\", \"convergedinfra.HealthCheckDefinition\", \"convergedinfra.HealthCheckExecution\", \"convergedinfra.Pod\", \"crd.CustomResource\", \"deviceconnector.Policy\", \"equipment.Chassis\", \"equipment.ChassisIdentity\", \"equipment.ChassisOperation\", \"equipment.DeviceSummary\", \"equipment.ExpanderModule\", \"equipment.Fan\", \"equipment.FanControl\", \"equipment.FanModule\", \"equipment.Fex\", \"equipment.FexIdentity\", \"equipment.FexOperation\", \"equipment.Fru\", \"equipment.IdentitySummary\", \"equipment.IoCard\", \"equipment.IoCardOperation\", \"equipment.IoExpander\", \"equipment.LocatorLed\", \"equipment.Psu\", \"equipment.PsuControl\", \"equipment.RackEnclosure\", \"equipment.RackEnclosureSlot\", \"equipment.SharedIoModule\", \"equipment.SwitchCard\", \"equipment.SystemIoController\", \"equipment.Tpm\", \"equipment.Transceiver\", \"ether.HostPort\", \"ether.NetworkPort\", \"ether.PhysicalPort\", \"ether.PortChannel\", \"externalsite.Authorization\", \"fabric.AppliancePcRole\", \"fabric.ApplianceRole\", \"fabric.ConfigChangeDetail\", \"fabric.ConfigResult\", \"fabric.ConfigResultEntry\", \"fabric.ElementIdentity\", \"fabric.EstimateImpact\", \"fabric.EthNetworkControlPolicy\", \"fabric.EthNetworkGroupPolicy\", \"fabric.EthNetworkPolicy\", \"fabric.FcNetworkPolicy\", \"fabric.FcUplinkPcRole\", \"fabric.FcUplinkRole\", \"fabric.FcoeUplinkPcRole\", \"fabric.FcoeUplinkRole\", \"fabric.FlowControlPolicy\", \"fabric.LinkAggregationPolicy\", \"fabric.LinkControlPolicy\", \"fabric.MulticastPolicy\", \"fabric.PcMember\", \"fabric.PcOperation\", \"fabric.PortMode\", \"fabric.PortOperation\", \"fabric.PortPolicy\", \"fabric.ServerRole\", \"fabric.SwitchClusterProfile\", \"fabric.SwitchControlPolicy\", \"fabric.SwitchProfile\", \"fabric.SystemQosPolicy\", \"fabric.UplinkPcRole\", \"fabric.UplinkRole\", \"fabric.Vlan\", \"fabric.Vsan\", \"fault.Instance\", \"fc.PhysicalPort\", \"fc.PortChannel\", \"fcpool.FcBlock\", \"fcpool.Lease\", \"fcpool.Pool\", \"fcpool.PoolMember\", \"fcpool.Universe\", \"feedback.FeedbackPost\", \"firmware.BiosDescriptor\", \"firmware.BoardControllerDescriptor\", \"firmware.ChassisUpgrade\", \"firmware.CimcDescriptor\", \"firmware.DimmDescriptor\", \"firmware.Distributable\", \"firmware.DistributableMeta\", \"firmware.DriveDescriptor\", \"firmware.DriverDistributable\", \"firmware.Eula\", \"firmware.FirmwareSummary\", \"firmware.GpuDescriptor\", \"firmware.HbaDescriptor\", \"firmware.IomDescriptor\", \"firmware.MswitchDescriptor\", \"firmware.NxosDescriptor\", \"firmware.PcieDescriptor\", \"firmware.PsuDescriptor\", \"firmware.RunningFirmware\", \"firmware.SasExpanderDescriptor\", \"firmware.ServerConfigurationUtilityDistributable\", \"firmware.StorageControllerDescriptor\", \"firmware.SwitchUpgrade\", \"firmware.UnsupportedVersionUpgrade\", \"firmware.Upgrade\", \"firmware.UpgradeImpact\", \"firmware.UpgradeImpactStatus\", \"firmware.UpgradeStatus\", \"forecast.Catalog\", \"forecast.Definition\", \"forecast.Instance\", \"graphics.Card\", \"graphics.Controller\", \"hcl.CompatibilityStatus\", \"hcl.DriverImage\", \"hcl.ExemptedCatalog\", \"hcl.HyperflexSoftwareCompatibilityInfo\", \"hcl.OperatingSystem\", \"hcl.OperatingSystemVendor\", \"hcl.SupportedDriverName\", \"hyperflex.Alarm\", \"hyperflex.AppCatalog\", \"hyperflex.AutoSupportPolicy\", \"hyperflex.BackupCluster\", \"hyperflex.CapabilityInfo\", \"hyperflex.CiscoHypervisorManager\", \"hyperflex.Cluster\", \"hyperflex.ClusterBackupPolicy\", \"hyperflex.ClusterBackupPolicyDeployment\", \"hyperflex.ClusterBackupPolicyInventory\", \"hyperflex.ClusterHealthCheckExecutionSnapshot\", \"hyperflex.ClusterNetworkPolicy\", \"hyperflex.ClusterProfile\", \"hyperflex.ClusterReplicationNetworkPolicy\", \"hyperflex.ClusterReplicationNetworkPolicyDeployment\", \"hyperflex.ClusterStoragePolicy\", \"hyperflex.ConfigResult\", \"hyperflex.ConfigResultEntry\", \"hyperflex.DataProtectionPeer\", \"hyperflex.DatastoreStatistic\", \"hyperflex.DevicePackageDownloadState\", \"hyperflex.Drive\", \"hyperflex.ExtFcStoragePolicy\", \"hyperflex.ExtIscsiStoragePolicy\", \"hyperflex.FeatureLimitExternal\", \"hyperflex.FeatureLimitInternal\", \"hyperflex.Health\", \"hyperflex.HealthCheckDefinition\", \"hyperflex.HealthCheckExecution\", \"hyperflex.HealthCheckExecutionSnapshot\", \"hyperflex.HealthCheckPackageChecksum\", \"hyperflex.HxapCluster\", \"hyperflex.HxapDatacenter\", \"hyperflex.HxapDvUplink\", \"hyperflex.HxapDvswitch\", \"hyperflex.HxapHost\", \"hyperflex.HxapHostInterface\", \"hyperflex.HxapHostVswitch\", \"hyperflex.HxapNetwork\", \"hyperflex.HxapVirtualDisk\", \"hyperflex.HxapVirtualMachine\", \"hyperflex.HxapVirtualMachineNetworkInterface\", \"hyperflex.HxdpVersion\", \"hyperflex.License\", \"hyperflex.LocalCredentialPolicy\", \"hyperflex.Node\", \"hyperflex.NodeConfigPolicy\", \"hyperflex.NodeProfile\", \"hyperflex.ProtectedCluster\", \"hyperflex.ProxySettingPolicy\", \"hyperflex.ServerFirmwareVersion\", \"hyperflex.ServerFirmwareVersionEntry\", \"hyperflex.ServerModel\", \"hyperflex.ServiceAuthToken\", \"hyperflex.SoftwareDistributionComponent\", \"hyperflex.SoftwareDistributionEntry\", \"hyperflex.SoftwareDistributionVersion\", \"hyperflex.SoftwareVersionPolicy\", \"hyperflex.StorageContainer\", \"hyperflex.SysConfigPolicy\", \"hyperflex.UcsmConfigPolicy\", \"hyperflex.VcenterConfigPolicy\", \"hyperflex.VmBackupInfo\", \"hyperflex.VmImportOperation\", \"hyperflex.VmRestoreOperation\", \"hyperflex.VmSnapshotInfo\", \"hyperflex.Volume\", \"hyperflex.WitnessConfiguration\", \"iaas.ConnectorPack\", \"iaas.DeviceStatus\", \"iaas.DiagnosticMessages\", \"iaas.LicenseInfo\", \"iaas.MostRunTasks\", \"iaas.ServiceRequest\", \"iaas.UcsdInfo\", \"iaas.UcsdManagedInfra\", \"iaas.UcsdMessages\", \"iam.Account\", \"iam.AccountExperience\", \"iam.ApiKey\", \"iam.AppRegistration\", \"iam.BannerMessage\", \"iam.Certificate\", \"iam.CertificateRequest\", \"iam.DomainGroup\", \"iam.EndPointPrivilege\", \"iam.EndPointRole\", \"iam.EndPointUser\", \"iam.EndPointUserPolicy\", \"iam.EndPointUserRole\", \"iam.Idp\", \"iam.IdpReference\", \"iam.IpAccessManagement\", \"iam.IpAddress\", \"iam.LdapGroup\", \"iam.LdapPolicy\", \"iam.LdapProvider\", \"iam.LocalUserPassword\", \"iam.LocalUserPasswordPolicy\", \"iam.OAuthToken\", \"iam.Permission\", \"iam.PrivateKeySpec\", \"iam.Privilege\", \"iam.PrivilegeSet\", \"iam.Qualifier\", \"iam.ResourceLimits\", \"iam.ResourcePermission\", \"iam.ResourceRoles\", \"iam.Role\", \"iam.SecurityHolder\", \"iam.ServiceProvider\", \"iam.Session\", \"iam.SessionLimits\", \"iam.System\", \"iam.TrustPoint\", \"iam.User\", \"iam.UserGroup\", \"iam.UserPreference\", \"inventory.DeviceInfo\", \"inventory.DnMoBinding\", \"inventory.GenericInventory\", \"inventory.GenericInventoryHolder\", \"inventory.Request\", \"ipmioverlan.Policy\", \"ippool.BlockLease\", \"ippool.IpLease\", \"ippool.Pool\", \"ippool.PoolMember\", \"ippool.ShadowBlock\", \"ippool.ShadowPool\", \"ippool.Universe\", \"iqnpool.Block\", \"iqnpool.Lease\", \"iqnpool.Pool\", \"iqnpool.PoolMember\", \"iqnpool.Universe\", \"iwotenant.TenantStatus\", \"kubernetes.AciCniApic\", \"kubernetes.AciCniProfile\", \"kubernetes.AciCniTenantClusterAllocation\", \"kubernetes.AddonDefinition\", \"kubernetes.AddonPolicy\", \"kubernetes.AddonRepository\", \"kubernetes.BaremetalNodeProfile\", \"kubernetes.Catalog\", \"kubernetes.Cluster\", \"kubernetes.ClusterAddonProfile\", \"kubernetes.ClusterProfile\", \"kubernetes.ConfigResult\", \"kubernetes.ConfigResultEntry\", \"kubernetes.ContainerRuntimePolicy\", \"kubernetes.DaemonSet\", \"kubernetes.Deployment\", \"kubernetes.Ingress\", \"kubernetes.NetworkPolicy\", \"kubernetes.Node\", \"kubernetes.NodeGroupProfile\", \"kubernetes.Pod\", \"kubernetes.Service\", \"kubernetes.StatefulSet\", \"kubernetes.SysConfigPolicy\", \"kubernetes.TrustedRegistriesPolicy\", \"kubernetes.Version\", \"kubernetes.VersionPolicy\", \"kubernetes.VirtualMachineInfraConfigPolicy\", \"kubernetes.VirtualMachineInfrastructureProvider\", \"kubernetes.VirtualMachineInstanceType\", \"kubernetes.VirtualMachineNodeProfile\", \"kvm.Policy\", \"kvm.Session\", \"kvm.Tunnel\", \"license.AccountLicenseData\", \"license.CustomerOp\", \"license.IwoCustomerOp\", \"license.IwoLicenseCount\", \"license.LicenseInfo\", \"license.LicenseReservationOp\", \"license.SmartlicenseToken\", \"ls.ServiceProfile\", \"macpool.IdBlock\", \"macpool.Lease\", \"macpool.Pool\", \"macpool.PoolMember\", \"macpool.Universe\", \"management.Controller\", \"management.Entity\", \"management.Interface\", \"memory.Array\", \"memory.PersistentMemoryConfigResult\", \"memory.PersistentMemoryConfiguration\", \"memory.PersistentMemoryNamespace\", \"memory.PersistentMemoryNamespaceConfigResult\", \"memory.PersistentMemoryPolicy\", \"memory.PersistentMemoryRegion\", \"memory.PersistentMemoryUnit\", \"memory.Unit\", \"meta.Definition\", \"network.Element\", \"network.ElementSummary\", \"network.FcZoneInfo\", \"network.VlanPortInfo\", \"networkconfig.Policy\", \"niaapi.ApicCcoPost\", \"niaapi.ApicFieldNotice\", \"niaapi.ApicHweol\", \"niaapi.ApicLatestMaintainedRelease\", \"niaapi.ApicReleaseRecommend\", \"niaapi.ApicSweol\", \"niaapi.DcnmCcoPost\", \"niaapi.DcnmFieldNotice\", \"niaapi.DcnmHweol\", \"niaapi.DcnmLatestMaintainedRelease\", \"niaapi.DcnmReleaseRecommend\", \"niaapi.DcnmSweol\", \"niaapi.FileDownloader\", \"niaapi.NiaMetadata\", \"niaapi.NibFileDownloader\", \"niaapi.NibMetadata\", \"niaapi.VersionRegex\", \"niatelemetry.AaaLdapProviderDetails\", \"niatelemetry.AaaRadiusProviderDetails\", \"niatelemetry.AaaTacacsProviderDetails\", \"niatelemetry.ApicAppPluginDetails\", \"niatelemetry.ApicCoreFileDetails\", \"niatelemetry.ApicDbgexpRsExportDest\", \"niatelemetry.ApicDbgexpRsTsScheduler\", \"niatelemetry.ApicFanDetails\", \"niatelemetry.ApicFexDetails\", \"niatelemetry.ApicFlashDetails\", \"niatelemetry.ApicNtpAuth\", \"niatelemetry.ApicPsuDetails\", \"niatelemetry.ApicRealmDetails\", \"niatelemetry.ApicSnmpClientGrpDetails\", \"niatelemetry.ApicSnmpCommunityAccessDetails\", \"niatelemetry.ApicSnmpCommunityDetails\", \"niatelemetry.ApicSnmpTrapDetails\", \"niatelemetry.ApicSnmpTrapFwdServerDetails\", \"niatelemetry.ApicSnmpVersionThreeDetails\", \"niatelemetry.ApicSysLogGrp\", \"niatelemetry.ApicSysLogSrc\", \"niatelemetry.ApicTransceiverDetails\", \"niatelemetry.ApicUiPageCounts\", \"niatelemetry.AppDetails\", \"niatelemetry.CommonPolicies\", \"niatelemetry.DcnmFanDetails\", \"niatelemetry.DcnmFexDetails\", \"niatelemetry.DcnmModuleDetails\", \"niatelemetry.DcnmPsuDetails\", \"niatelemetry.DcnmTransceiverDetails\", \"niatelemetry.Epg\", \"niatelemetry.FabricModuleDetails\", \"niatelemetry.FabricPodProfile\", \"niatelemetry.FabricPodSs\", \"niatelemetry.Fault\", \"niatelemetry.HttpsAclContractDetails\", \"niatelemetry.HttpsAclContractFilterMap\", \"niatelemetry.HttpsAclEpgContractMap\", \"niatelemetry.HttpsAclEpgDetails\", \"niatelemetry.HttpsAclFilterDetails\", \"niatelemetry.Lc\", \"niatelemetry.MsoContractDetails\", \"niatelemetry.MsoEpgDetails\", \"niatelemetry.MsoSchemaDetails\", \"niatelemetry.MsoSiteDetails\", \"niatelemetry.MsoTenantDetails\", \"niatelemetry.NexusDashboardControllerDetails\", \"niatelemetry.NexusDashboardDetails\", \"niatelemetry.NexusDashboardMemoryDetails\", \"niatelemetry.NexusDashboards\", \"niatelemetry.NiaFeatureUsage\", \"niatelemetry.NiaInventory\", \"niatelemetry.NiaInventoryDcnm\", \"niatelemetry.NiaInventoryFabric\", \"niatelemetry.NiaLicenseState\", \"niatelemetry.PasswordStrengthCheck\", \"niatelemetry.PodCommPolicies\", \"niatelemetry.PodSnmpPolicies\", \"niatelemetry.PodTimeServerPolicies\", \"niatelemetry.SiteInventory\", \"niatelemetry.SnmpSrc\", \"niatelemetry.SshVersionTwo\", \"niatelemetry.SupervisorModuleDetails\", \"niatelemetry.SyslogRemoteDest\", \"niatelemetry.SyslogSysMsg\", \"niatelemetry.SyslogSysMsgFacFilter\", \"niatelemetry.SystemControllerDetails\", \"niatelemetry.Tenant\", \"notification.AccountSubscription\", \"ntp.Policy\", \"oprs.Deployment\", \"oprs.SyncTargetListMessage\", \"organization.Organization\", \"os.BulkInstallInfo\", \"os.Catalog\", \"os.ConfigurationFile\", \"os.Distribution\", \"os.Install\", \"os.OsSupport\", \"os.SupportedVersion\", \"os.TemplateFile\", \"os.ValidInstallTarget\", \"pci.CoprocessorCard\", \"pci.Device\", \"pci.Link\", \"pci.Switch\", \"port.Group\", \"port.MacBinding\", \"port.SubGroup\", \"power.ControlState\", \"power.Policy\", \"processor.Unit\", \"rack.UnitPersonality\", \"recommendation.CapacityRunway\", \"recommendation.PhysicalItem\", \"recovery.BackupConfigPolicy\", \"recovery.BackupProfile\", \"recovery.ConfigResult\", \"recovery.ConfigResultEntry\", \"recovery.OnDemandBackup\", \"recovery.Restore\", \"recovery.ScheduleConfigPolicy\", \"resource.Group\", \"resource.GroupMember\", \"resource.LicenseResourceCount\", \"resource.Membership\", \"resource.MembershipHolder\", \"resource.Reservation\", \"resourcepool.Lease\", \"resourcepool.LeaseResource\", \"resourcepool.Pool\", \"resourcepool.PoolMember\", \"resourcepool.Universe\", \"rproxy.ReverseProxy\", \"sdcard.Policy\", \"sdwan.Profile\", \"sdwan.RouterNode\", \"sdwan.RouterPolicy\", \"sdwan.VmanageAccountPolicy\", \"search.SearchItem\", \"search.TagItem\", \"security.Unit\", \"server.ConfigChangeDetail\", \"server.ConfigImport\", \"server.ConfigResult\", \"server.ConfigResultEntry\", \"server.Profile\", \"server.ProfileTemplate\", \"smtp.Policy\", \"snmp.Policy\", \"software.ApplianceDistributable\", \"software.DownloadHistory\", \"software.HclMeta\", \"software.HyperflexBundleDistributable\", \"software.HyperflexDistributable\", \"software.ReleaseMeta\", \"software.SolutionDistributable\", \"software.UcsdBundleDistributable\", \"software.UcsdDistributable\", \"softwarerepository.Authorization\", \"softwarerepository.CachedImage\", \"softwarerepository.Catalog\", \"softwarerepository.CategoryMapper\", \"softwarerepository.CategoryMapperModel\", \"softwarerepository.CategorySupportConstraint\", \"softwarerepository.DownloadSpec\", \"softwarerepository.OperatingSystemFile\", \"softwarerepository.Release\", \"sol.Policy\", \"ssh.Policy\", \"storage.Controller\", \"storage.DiskGroup\", \"storage.DiskSlot\", \"storage.DriveGroup\", \"storage.Enclosure\", \"storage.EnclosureDisk\", \"storage.EnclosureDiskSlotEp\", \"storage.FlexFlashController\", \"storage.FlexFlashControllerProps\", \"storage.FlexFlashPhysicalDrive\", \"storage.FlexFlashVirtualDrive\", \"storage.FlexUtilController\", \"storage.FlexUtilPhysicalDrive\", \"storage.FlexUtilVirtualDrive\", \"storage.HitachiArray\", \"storage.HitachiController\", \"storage.HitachiDisk\", \"storage.HitachiHost\", \"storage.HitachiHostLun\", \"storage.HitachiParityGroup\", \"storage.HitachiPool\", \"storage.HitachiPort\", \"storage.HitachiVolume\", \"storage.HyperFlexStorageContainer\", \"storage.HyperFlexVolume\", \"storage.Item\", \"storage.NetAppAggregate\", \"storage.NetAppBaseDisk\", \"storage.NetAppCluster\", \"storage.NetAppEthernetPort\", \"storage.NetAppExportPolicy\", \"storage.NetAppFcInterface\", \"storage.NetAppFcPort\", \"storage.NetAppInitiatorGroup\", \"storage.NetAppIpInterface\", \"storage.NetAppLicense\", \"storage.NetAppLun\", \"storage.NetAppLunMap\", \"storage.NetAppNode\", \"storage.NetAppNtpServer\", \"storage.NetAppSensor\", \"storage.NetAppStorageVm\", \"storage.NetAppVolume\", \"storage.NetAppVolumeSnapshot\", \"storage.PhysicalDisk\", \"storage.PhysicalDiskExtension\", \"storage.PhysicalDiskUsage\", \"storage.PureArray\", \"storage.PureController\", \"storage.PureDisk\", \"storage.PureHost\", \"storage.PureHostGroup\", \"storage.PureHostLun\", \"storage.PurePort\", \"storage.PureProtectionGroup\", \"storage.PureProtectionGroupSnapshot\", \"storage.PureReplicationSchedule\", \"storage.PureSnapshotSchedule\", \"storage.PureVolume\", \"storage.PureVolumeSnapshot\", \"storage.SasExpander\", \"storage.SasPort\", \"storage.Span\", \"storage.StoragePolicy\", \"storage.VdMemberEp\", \"storage.VirtualDrive\", \"storage.VirtualDriveContainer\", \"storage.VirtualDriveExtension\", \"storage.VirtualDriveIdentity\", \"syslog.Policy\", \"tam.AdvisoryCount\", \"tam.AdvisoryDefinition\", \"tam.AdvisoryInfo\", \"tam.AdvisoryInstance\", \"tam.SecurityAdvisory\", \"task.HitachiScopedInventory\", \"task.HxapScopedInventory\", \"task.NetAppScopedInventory\", \"task.PublicCloudScopedInventory\", \"task.PureScopedInventory\", \"task.ServerScopedInventory\", \"techsupportmanagement.CollectionControlPolicy\", \"techsupportmanagement.Download\", \"techsupportmanagement.TechSupportBundle\", \"techsupportmanagement.TechSupportStatus\", \"terminal.AuditLog\", \"terraform.Executor\", \"thermal.Policy\", \"top.System\", \"ucsd.BackupInfo\", \"uuidpool.Block\", \"uuidpool.Pool\", \"uuidpool.PoolMember\", \"uuidpool.Universe\", \"uuidpool.UuidLease\", \"virtualization.Host\", \"virtualization.VirtualDisk\", \"virtualization.VirtualMachine\", \"virtualization.VirtualNetwork\", \"virtualization.VmwareCluster\", \"virtualization.VmwareDatacenter\", \"virtualization.VmwareDatastore\", \"virtualization.VmwareDatastoreCluster\", \"virtualization.VmwareDistributedNetwork\", \"virtualization.VmwareDistributedSwitch\", \"virtualization.VmwareFolder\", \"virtualization.VmwareHost\", \"virtualization.VmwareKernelNetwork\", \"virtualization.VmwareNetwork\", \"virtualization.VmwarePhysicalNetworkInterface\", \"virtualization.VmwareUplinkPort\", \"virtualization.VmwareVcenter\", \"virtualization.VmwareVirtualDisk\", \"virtualization.VmwareVirtualMachine\", \"virtualization.VmwareVirtualMachineSnapshot\", \"virtualization.VmwareVirtualNetworkInterface\", \"virtualization.VmwareVirtualSwitch\", \"vmedia.Policy\", \"vmrc.Console\", \"vnc.Console\", \"vnic.EthAdapterPolicy\", \"vnic.EthIf\", \"vnic.EthNetworkPolicy\", \"vnic.EthQosPolicy\", \"vnic.FcAdapterPolicy\", \"vnic.FcIf\", \"vnic.FcNetworkPolicy\", \"vnic.FcQosPolicy\", \"vnic.IscsiAdapterPolicy\", \"vnic.IscsiBootPolicy\", \"vnic.IscsiStaticTargetPolicy\", \"vnic.LanConnectivityPolicy\", \"vnic.LcpStatus\", \"vnic.SanConnectivityPolicy\", \"vnic.ScpStatus\", \"vrf.Vrf\", \"workflow.BatchApiExecutor\", \"workflow.BuildTaskMeta\", \"workflow.BuildTaskMetaOwner\", \"workflow.Catalog\", \"workflow.CustomDataTypeDefinition\", \"workflow.ErrorResponseHandler\", \"workflow.PendingDynamicWorkflowInfo\", \"workflow.RollbackWorkflow\", \"workflow.SolutionActionDefinition\", \"workflow.SolutionActionInstance\", \"workflow.SolutionDefinition\", \"workflow.SolutionInstance\", \"workflow.SolutionOutput\", \"workflow.TaskDebugLog\", \"workflow.TaskDefinition\", \"workflow.TaskInfo\", \"workflow.TaskMetadata\", \"workflow.TaskNotification\", \"workflow.TemplateEvaluation\", \"workflow.TemplateFunctionMeta\", \"workflow.WorkflowDefinition\", \"workflow.WorkflowInfo\", \"workflow.WorkflowMeta\", \"workflow.WorkflowMetadata\", \"workflow.WorkflowNotification\"])\n return false unless class_id_validator.valid?(@class_id)\n return false if @object_type.nil?\n object_type_validator = EnumAttributeValidator.new('String', [\"aaa.AuditRecord\", \"aaa.RetentionConfig\", \"aaa.RetentionPolicy\", \"access.Policy\", \"adapter.ConfigPolicy\", \"adapter.ExtEthInterface\", \"adapter.HostEthInterface\", \"adapter.HostFcInterface\", \"adapter.HostIscsiInterface\", \"adapter.Unit\", \"adapter.UnitExpander\", \"appliance.AppStatus\", \"appliance.AutoRmaPolicy\", \"appliance.Backup\", \"appliance.BackupPolicy\", \"appliance.CertificateSetting\", \"appliance.DataExportPolicy\", \"appliance.DeviceCertificate\", \"appliance.DeviceClaim\", \"appliance.DeviceUpgradePolicy\", \"appliance.DiagSetting\", \"appliance.ExternalSyslogSetting\", \"appliance.FileGateway\", \"appliance.FileSystemStatus\", \"appliance.GroupStatus\", \"appliance.ImageBundle\", \"appliance.NodeInfo\", \"appliance.NodeStatus\", \"appliance.ReleaseNote\", \"appliance.RemoteFileImport\", \"appliance.Restore\", \"appliance.SetupInfo\", \"appliance.SystemInfo\", \"appliance.SystemStatus\", \"appliance.Upgrade\", \"appliance.UpgradePolicy\", \"asset.ClusterMember\", \"asset.Deployment\", \"asset.DeploymentDevice\", \"asset.DeviceClaim\", \"asset.DeviceConfiguration\", \"asset.DeviceConnectorManager\", \"asset.DeviceContractInformation\", \"asset.DeviceRegistration\", \"asset.Subscription\", \"asset.SubscriptionAccount\", \"asset.SubscriptionDeviceContractInformation\", \"asset.Target\", \"bios.BootDevice\", \"bios.BootMode\", \"bios.Policy\", \"bios.SystemBootOrder\", \"bios.TokenSettings\", \"bios.Unit\", \"bios.VfSelectMemoryRasConfiguration\", \"boot.CddDevice\", \"boot.DeviceBootMode\", \"boot.DeviceBootSecurity\", \"boot.HddDevice\", \"boot.IscsiDevice\", \"boot.NvmeDevice\", \"boot.PchStorageDevice\", \"boot.PrecisionPolicy\", \"boot.PxeDevice\", \"boot.SanDevice\", \"boot.SdDevice\", \"boot.UefiShellDevice\", \"boot.UsbDevice\", \"boot.VmediaDevice\", \"bulk.Export\", \"bulk.ExportedItem\", \"bulk.MoCloner\", \"bulk.MoMerger\", \"bulk.Request\", \"bulk.SubRequestObj\", \"capability.AdapterUnitDescriptor\", \"capability.Catalog\", \"capability.ChassisDescriptor\", \"capability.ChassisManufacturingDef\", \"capability.CimcFirmwareDescriptor\", \"capability.EquipmentPhysicalDef\", \"capability.EquipmentSlotArray\", \"capability.FanModuleDescriptor\", \"capability.FanModuleManufacturingDef\", \"capability.IoCardCapabilityDef\", \"capability.IoCardDescriptor\", \"capability.IoCardManufacturingDef\", \"capability.PortGroupAggregationDef\", \"capability.PsuDescriptor\", \"capability.PsuManufacturingDef\", \"capability.ServerSchemaDescriptor\", \"capability.SiocModuleCapabilityDef\", \"capability.SiocModuleDescriptor\", \"capability.SiocModuleManufacturingDef\", \"capability.SwitchCapability\", \"capability.SwitchDescriptor\", \"capability.SwitchManufacturingDef\", \"certificatemanagement.Policy\", \"chassis.ConfigChangeDetail\", \"chassis.ConfigImport\", \"chassis.ConfigResult\", \"chassis.ConfigResultEntry\", \"chassis.IomProfile\", \"chassis.Profile\", \"cloud.AwsBillingUnit\", \"cloud.AwsKeyPair\", \"cloud.AwsNetworkInterface\", \"cloud.AwsOrganizationalUnit\", \"cloud.AwsSecurityGroup\", \"cloud.AwsSubnet\", \"cloud.AwsVirtualMachine\", \"cloud.AwsVolume\", \"cloud.AwsVpc\", \"cloud.CollectInventory\", \"cloud.Regions\", \"cloud.SkuContainerType\", \"cloud.SkuDatabaseType\", \"cloud.SkuInstanceType\", \"cloud.SkuNetworkType\", \"cloud.SkuRegionRateCards\", \"cloud.SkuVolumeType\", \"cloud.TfcAgentpool\", \"cloud.TfcOrganization\", \"cloud.TfcWorkspace\", \"comm.HttpProxyPolicy\", \"compute.BiosPostPolicy\", \"compute.Blade\", \"compute.BladeIdentity\", \"compute.Board\", \"compute.Mapping\", \"compute.PhysicalSummary\", \"compute.RackUnit\", \"compute.RackUnitIdentity\", \"compute.ServerPowerPolicy\", \"compute.ServerSetting\", \"compute.Vmedia\", \"cond.Alarm\", \"cond.AlarmAggregation\", \"cond.HclStatus\", \"cond.HclStatusDetail\", \"cond.HclStatusJob\", \"connectorpack.ConnectorPackUpgrade\", \"connectorpack.UpgradeImpact\", \"convergedinfra.HealthCheckDefinition\", \"convergedinfra.HealthCheckExecution\", \"convergedinfra.Pod\", \"crd.CustomResource\", \"deviceconnector.Policy\", \"equipment.Chassis\", \"equipment.ChassisIdentity\", \"equipment.ChassisOperation\", \"equipment.DeviceSummary\", \"equipment.ExpanderModule\", \"equipment.Fan\", \"equipment.FanControl\", \"equipment.FanModule\", \"equipment.Fex\", \"equipment.FexIdentity\", \"equipment.FexOperation\", \"equipment.Fru\", \"equipment.IdentitySummary\", \"equipment.IoCard\", \"equipment.IoCardOperation\", \"equipment.IoExpander\", \"equipment.LocatorLed\", \"equipment.Psu\", \"equipment.PsuControl\", \"equipment.RackEnclosure\", \"equipment.RackEnclosureSlot\", \"equipment.SharedIoModule\", \"equipment.SwitchCard\", \"equipment.SystemIoController\", \"equipment.Tpm\", \"equipment.Transceiver\", \"ether.HostPort\", \"ether.NetworkPort\", \"ether.PhysicalPort\", \"ether.PortChannel\", \"externalsite.Authorization\", \"fabric.AppliancePcRole\", \"fabric.ApplianceRole\", \"fabric.ConfigChangeDetail\", \"fabric.ConfigResult\", \"fabric.ConfigResultEntry\", \"fabric.ElementIdentity\", \"fabric.EstimateImpact\", \"fabric.EthNetworkControlPolicy\", \"fabric.EthNetworkGroupPolicy\", \"fabric.EthNetworkPolicy\", \"fabric.FcNetworkPolicy\", \"fabric.FcUplinkPcRole\", \"fabric.FcUplinkRole\", \"fabric.FcoeUplinkPcRole\", \"fabric.FcoeUplinkRole\", \"fabric.FlowControlPolicy\", \"fabric.LinkAggregationPolicy\", \"fabric.LinkControlPolicy\", \"fabric.MulticastPolicy\", \"fabric.PcMember\", \"fabric.PcOperation\", \"fabric.PortMode\", \"fabric.PortOperation\", \"fabric.PortPolicy\", \"fabric.ServerRole\", \"fabric.SwitchClusterProfile\", \"fabric.SwitchControlPolicy\", \"fabric.SwitchProfile\", \"fabric.SystemQosPolicy\", \"fabric.UplinkPcRole\", \"fabric.UplinkRole\", \"fabric.Vlan\", \"fabric.Vsan\", \"fault.Instance\", \"fc.PhysicalPort\", \"fc.PortChannel\", \"fcpool.FcBlock\", \"fcpool.Lease\", \"fcpool.Pool\", \"fcpool.PoolMember\", \"fcpool.Universe\", \"feedback.FeedbackPost\", \"firmware.BiosDescriptor\", \"firmware.BoardControllerDescriptor\", \"firmware.ChassisUpgrade\", \"firmware.CimcDescriptor\", \"firmware.DimmDescriptor\", \"firmware.Distributable\", \"firmware.DistributableMeta\", \"firmware.DriveDescriptor\", \"firmware.DriverDistributable\", \"firmware.Eula\", \"firmware.FirmwareSummary\", \"firmware.GpuDescriptor\", \"firmware.HbaDescriptor\", \"firmware.IomDescriptor\", \"firmware.MswitchDescriptor\", \"firmware.NxosDescriptor\", \"firmware.PcieDescriptor\", \"firmware.PsuDescriptor\", \"firmware.RunningFirmware\", \"firmware.SasExpanderDescriptor\", \"firmware.ServerConfigurationUtilityDistributable\", \"firmware.StorageControllerDescriptor\", \"firmware.SwitchUpgrade\", \"firmware.UnsupportedVersionUpgrade\", \"firmware.Upgrade\", \"firmware.UpgradeImpact\", \"firmware.UpgradeImpactStatus\", \"firmware.UpgradeStatus\", \"forecast.Catalog\", \"forecast.Definition\", \"forecast.Instance\", \"graphics.Card\", \"graphics.Controller\", \"hcl.CompatibilityStatus\", \"hcl.DriverImage\", \"hcl.ExemptedCatalog\", \"hcl.HyperflexSoftwareCompatibilityInfo\", \"hcl.OperatingSystem\", \"hcl.OperatingSystemVendor\", \"hcl.SupportedDriverName\", \"hyperflex.Alarm\", \"hyperflex.AppCatalog\", \"hyperflex.AutoSupportPolicy\", \"hyperflex.BackupCluster\", \"hyperflex.CapabilityInfo\", \"hyperflex.CiscoHypervisorManager\", \"hyperflex.Cluster\", \"hyperflex.ClusterBackupPolicy\", \"hyperflex.ClusterBackupPolicyDeployment\", \"hyperflex.ClusterBackupPolicyInventory\", \"hyperflex.ClusterHealthCheckExecutionSnapshot\", \"hyperflex.ClusterNetworkPolicy\", \"hyperflex.ClusterProfile\", \"hyperflex.ClusterReplicationNetworkPolicy\", \"hyperflex.ClusterReplicationNetworkPolicyDeployment\", \"hyperflex.ClusterStoragePolicy\", \"hyperflex.ConfigResult\", \"hyperflex.ConfigResultEntry\", \"hyperflex.DataProtectionPeer\", \"hyperflex.DatastoreStatistic\", \"hyperflex.DevicePackageDownloadState\", \"hyperflex.Drive\", \"hyperflex.ExtFcStoragePolicy\", \"hyperflex.ExtIscsiStoragePolicy\", \"hyperflex.FeatureLimitExternal\", \"hyperflex.FeatureLimitInternal\", \"hyperflex.Health\", \"hyperflex.HealthCheckDefinition\", \"hyperflex.HealthCheckExecution\", \"hyperflex.HealthCheckExecutionSnapshot\", \"hyperflex.HealthCheckPackageChecksum\", \"hyperflex.HxapCluster\", \"hyperflex.HxapDatacenter\", \"hyperflex.HxapDvUplink\", \"hyperflex.HxapDvswitch\", \"hyperflex.HxapHost\", \"hyperflex.HxapHostInterface\", \"hyperflex.HxapHostVswitch\", \"hyperflex.HxapNetwork\", \"hyperflex.HxapVirtualDisk\", \"hyperflex.HxapVirtualMachine\", \"hyperflex.HxapVirtualMachineNetworkInterface\", \"hyperflex.HxdpVersion\", \"hyperflex.License\", \"hyperflex.LocalCredentialPolicy\", \"hyperflex.Node\", \"hyperflex.NodeConfigPolicy\", \"hyperflex.NodeProfile\", \"hyperflex.ProtectedCluster\", \"hyperflex.ProxySettingPolicy\", \"hyperflex.ServerFirmwareVersion\", \"hyperflex.ServerFirmwareVersionEntry\", \"hyperflex.ServerModel\", \"hyperflex.ServiceAuthToken\", \"hyperflex.SoftwareDistributionComponent\", \"hyperflex.SoftwareDistributionEntry\", \"hyperflex.SoftwareDistributionVersion\", \"hyperflex.SoftwareVersionPolicy\", \"hyperflex.StorageContainer\", \"hyperflex.SysConfigPolicy\", \"hyperflex.UcsmConfigPolicy\", \"hyperflex.VcenterConfigPolicy\", \"hyperflex.VmBackupInfo\", \"hyperflex.VmImportOperation\", \"hyperflex.VmRestoreOperation\", \"hyperflex.VmSnapshotInfo\", \"hyperflex.Volume\", \"hyperflex.WitnessConfiguration\", \"iaas.ConnectorPack\", \"iaas.DeviceStatus\", \"iaas.DiagnosticMessages\", \"iaas.LicenseInfo\", \"iaas.MostRunTasks\", \"iaas.ServiceRequest\", \"iaas.UcsdInfo\", \"iaas.UcsdManagedInfra\", \"iaas.UcsdMessages\", \"iam.Account\", \"iam.AccountExperience\", \"iam.ApiKey\", \"iam.AppRegistration\", \"iam.BannerMessage\", \"iam.Certificate\", \"iam.CertificateRequest\", \"iam.DomainGroup\", \"iam.EndPointPrivilege\", \"iam.EndPointRole\", \"iam.EndPointUser\", \"iam.EndPointUserPolicy\", \"iam.EndPointUserRole\", \"iam.Idp\", \"iam.IdpReference\", \"iam.IpAccessManagement\", \"iam.IpAddress\", \"iam.LdapGroup\", \"iam.LdapPolicy\", \"iam.LdapProvider\", \"iam.LocalUserPassword\", \"iam.LocalUserPasswordPolicy\", \"iam.OAuthToken\", \"iam.Permission\", \"iam.PrivateKeySpec\", \"iam.Privilege\", \"iam.PrivilegeSet\", \"iam.Qualifier\", \"iam.ResourceLimits\", \"iam.ResourcePermission\", \"iam.ResourceRoles\", \"iam.Role\", \"iam.SecurityHolder\", \"iam.ServiceProvider\", \"iam.Session\", \"iam.SessionLimits\", \"iam.System\", \"iam.TrustPoint\", \"iam.User\", \"iam.UserGroup\", \"iam.UserPreference\", \"inventory.DeviceInfo\", \"inventory.DnMoBinding\", \"inventory.GenericInventory\", \"inventory.GenericInventoryHolder\", \"inventory.Request\", \"ipmioverlan.Policy\", \"ippool.BlockLease\", \"ippool.IpLease\", \"ippool.Pool\", \"ippool.PoolMember\", \"ippool.ShadowBlock\", \"ippool.ShadowPool\", \"ippool.Universe\", \"iqnpool.Block\", \"iqnpool.Lease\", \"iqnpool.Pool\", \"iqnpool.PoolMember\", \"iqnpool.Universe\", \"iwotenant.TenantStatus\", \"kubernetes.AciCniApic\", \"kubernetes.AciCniProfile\", \"kubernetes.AciCniTenantClusterAllocation\", \"kubernetes.AddonDefinition\", \"kubernetes.AddonPolicy\", \"kubernetes.AddonRepository\", \"kubernetes.BaremetalNodeProfile\", \"kubernetes.Catalog\", \"kubernetes.Cluster\", \"kubernetes.ClusterAddonProfile\", \"kubernetes.ClusterProfile\", \"kubernetes.ConfigResult\", \"kubernetes.ConfigResultEntry\", \"kubernetes.ContainerRuntimePolicy\", \"kubernetes.DaemonSet\", \"kubernetes.Deployment\", \"kubernetes.Ingress\", \"kubernetes.NetworkPolicy\", \"kubernetes.Node\", \"kubernetes.NodeGroupProfile\", \"kubernetes.Pod\", \"kubernetes.Service\", \"kubernetes.StatefulSet\", \"kubernetes.SysConfigPolicy\", \"kubernetes.TrustedRegistriesPolicy\", \"kubernetes.Version\", \"kubernetes.VersionPolicy\", \"kubernetes.VirtualMachineInfraConfigPolicy\", \"kubernetes.VirtualMachineInfrastructureProvider\", \"kubernetes.VirtualMachineInstanceType\", \"kubernetes.VirtualMachineNodeProfile\", \"kvm.Policy\", \"kvm.Session\", \"kvm.Tunnel\", \"license.AccountLicenseData\", \"license.CustomerOp\", \"license.IwoCustomerOp\", \"license.IwoLicenseCount\", \"license.LicenseInfo\", \"license.LicenseReservationOp\", \"license.SmartlicenseToken\", \"ls.ServiceProfile\", \"macpool.IdBlock\", \"macpool.Lease\", \"macpool.Pool\", \"macpool.PoolMember\", \"macpool.Universe\", \"management.Controller\", \"management.Entity\", \"management.Interface\", \"memory.Array\", \"memory.PersistentMemoryConfigResult\", \"memory.PersistentMemoryConfiguration\", \"memory.PersistentMemoryNamespace\", \"memory.PersistentMemoryNamespaceConfigResult\", \"memory.PersistentMemoryPolicy\", \"memory.PersistentMemoryRegion\", \"memory.PersistentMemoryUnit\", \"memory.Unit\", \"meta.Definition\", \"network.Element\", \"network.ElementSummary\", \"network.FcZoneInfo\", \"network.VlanPortInfo\", \"networkconfig.Policy\", \"niaapi.ApicCcoPost\", \"niaapi.ApicFieldNotice\", \"niaapi.ApicHweol\", \"niaapi.ApicLatestMaintainedRelease\", \"niaapi.ApicReleaseRecommend\", \"niaapi.ApicSweol\", \"niaapi.DcnmCcoPost\", \"niaapi.DcnmFieldNotice\", \"niaapi.DcnmHweol\", \"niaapi.DcnmLatestMaintainedRelease\", \"niaapi.DcnmReleaseRecommend\", \"niaapi.DcnmSweol\", \"niaapi.FileDownloader\", \"niaapi.NiaMetadata\", \"niaapi.NibFileDownloader\", \"niaapi.NibMetadata\", \"niaapi.VersionRegex\", \"niatelemetry.AaaLdapProviderDetails\", \"niatelemetry.AaaRadiusProviderDetails\", \"niatelemetry.AaaTacacsProviderDetails\", \"niatelemetry.ApicAppPluginDetails\", \"niatelemetry.ApicCoreFileDetails\", \"niatelemetry.ApicDbgexpRsExportDest\", \"niatelemetry.ApicDbgexpRsTsScheduler\", \"niatelemetry.ApicFanDetails\", \"niatelemetry.ApicFexDetails\", \"niatelemetry.ApicFlashDetails\", \"niatelemetry.ApicNtpAuth\", \"niatelemetry.ApicPsuDetails\", \"niatelemetry.ApicRealmDetails\", \"niatelemetry.ApicSnmpClientGrpDetails\", \"niatelemetry.ApicSnmpCommunityAccessDetails\", \"niatelemetry.ApicSnmpCommunityDetails\", \"niatelemetry.ApicSnmpTrapDetails\", \"niatelemetry.ApicSnmpTrapFwdServerDetails\", \"niatelemetry.ApicSnmpVersionThreeDetails\", \"niatelemetry.ApicSysLogGrp\", \"niatelemetry.ApicSysLogSrc\", \"niatelemetry.ApicTransceiverDetails\", \"niatelemetry.ApicUiPageCounts\", \"niatelemetry.AppDetails\", \"niatelemetry.CommonPolicies\", \"niatelemetry.DcnmFanDetails\", \"niatelemetry.DcnmFexDetails\", \"niatelemetry.DcnmModuleDetails\", \"niatelemetry.DcnmPsuDetails\", \"niatelemetry.DcnmTransceiverDetails\", \"niatelemetry.Epg\", \"niatelemetry.FabricModuleDetails\", \"niatelemetry.FabricPodProfile\", \"niatelemetry.FabricPodSs\", \"niatelemetry.Fault\", \"niatelemetry.HttpsAclContractDetails\", \"niatelemetry.HttpsAclContractFilterMap\", \"niatelemetry.HttpsAclEpgContractMap\", \"niatelemetry.HttpsAclEpgDetails\", \"niatelemetry.HttpsAclFilterDetails\", \"niatelemetry.Lc\", \"niatelemetry.MsoContractDetails\", \"niatelemetry.MsoEpgDetails\", \"niatelemetry.MsoSchemaDetails\", \"niatelemetry.MsoSiteDetails\", \"niatelemetry.MsoTenantDetails\", \"niatelemetry.NexusDashboardControllerDetails\", \"niatelemetry.NexusDashboardDetails\", \"niatelemetry.NexusDashboardMemoryDetails\", \"niatelemetry.NexusDashboards\", \"niatelemetry.NiaFeatureUsage\", \"niatelemetry.NiaInventory\", \"niatelemetry.NiaInventoryDcnm\", \"niatelemetry.NiaInventoryFabric\", \"niatelemetry.NiaLicenseState\", \"niatelemetry.PasswordStrengthCheck\", \"niatelemetry.PodCommPolicies\", \"niatelemetry.PodSnmpPolicies\", \"niatelemetry.PodTimeServerPolicies\", \"niatelemetry.SiteInventory\", \"niatelemetry.SnmpSrc\", \"niatelemetry.SshVersionTwo\", \"niatelemetry.SupervisorModuleDetails\", \"niatelemetry.SyslogRemoteDest\", \"niatelemetry.SyslogSysMsg\", \"niatelemetry.SyslogSysMsgFacFilter\", \"niatelemetry.SystemControllerDetails\", \"niatelemetry.Tenant\", \"notification.AccountSubscription\", \"ntp.Policy\", \"oprs.Deployment\", \"oprs.SyncTargetListMessage\", \"organization.Organization\", \"os.BulkInstallInfo\", \"os.Catalog\", \"os.ConfigurationFile\", \"os.Distribution\", \"os.Install\", \"os.OsSupport\", \"os.SupportedVersion\", \"os.TemplateFile\", \"os.ValidInstallTarget\", \"pci.CoprocessorCard\", \"pci.Device\", \"pci.Link\", \"pci.Switch\", \"port.Group\", \"port.MacBinding\", \"port.SubGroup\", \"power.ControlState\", \"power.Policy\", \"processor.Unit\", \"rack.UnitPersonality\", \"recommendation.CapacityRunway\", \"recommendation.PhysicalItem\", \"recovery.BackupConfigPolicy\", \"recovery.BackupProfile\", \"recovery.ConfigResult\", \"recovery.ConfigResultEntry\", \"recovery.OnDemandBackup\", \"recovery.Restore\", \"recovery.ScheduleConfigPolicy\", \"resource.Group\", \"resource.GroupMember\", \"resource.LicenseResourceCount\", \"resource.Membership\", \"resource.MembershipHolder\", \"resource.Reservation\", \"resourcepool.Lease\", \"resourcepool.LeaseResource\", \"resourcepool.Pool\", \"resourcepool.PoolMember\", \"resourcepool.Universe\", \"rproxy.ReverseProxy\", \"sdcard.Policy\", \"sdwan.Profile\", \"sdwan.RouterNode\", \"sdwan.RouterPolicy\", \"sdwan.VmanageAccountPolicy\", \"search.SearchItem\", \"search.TagItem\", \"security.Unit\", \"server.ConfigChangeDetail\", \"server.ConfigImport\", \"server.ConfigResult\", \"server.ConfigResultEntry\", \"server.Profile\", \"server.ProfileTemplate\", \"smtp.Policy\", \"snmp.Policy\", \"software.ApplianceDistributable\", \"software.DownloadHistory\", \"software.HclMeta\", \"software.HyperflexBundleDistributable\", \"software.HyperflexDistributable\", \"software.ReleaseMeta\", \"software.SolutionDistributable\", \"software.UcsdBundleDistributable\", \"software.UcsdDistributable\", \"softwarerepository.Authorization\", \"softwarerepository.CachedImage\", \"softwarerepository.Catalog\", \"softwarerepository.CategoryMapper\", \"softwarerepository.CategoryMapperModel\", \"softwarerepository.CategorySupportConstraint\", \"softwarerepository.DownloadSpec\", \"softwarerepository.OperatingSystemFile\", \"softwarerepository.Release\", \"sol.Policy\", \"ssh.Policy\", \"storage.Controller\", \"storage.DiskGroup\", \"storage.DiskSlot\", \"storage.DriveGroup\", \"storage.Enclosure\", \"storage.EnclosureDisk\", \"storage.EnclosureDiskSlotEp\", \"storage.FlexFlashController\", \"storage.FlexFlashControllerProps\", \"storage.FlexFlashPhysicalDrive\", \"storage.FlexFlashVirtualDrive\", \"storage.FlexUtilController\", \"storage.FlexUtilPhysicalDrive\", \"storage.FlexUtilVirtualDrive\", \"storage.HitachiArray\", \"storage.HitachiController\", \"storage.HitachiDisk\", \"storage.HitachiHost\", \"storage.HitachiHostLun\", \"storage.HitachiParityGroup\", \"storage.HitachiPool\", \"storage.HitachiPort\", \"storage.HitachiVolume\", \"storage.HyperFlexStorageContainer\", \"storage.HyperFlexVolume\", \"storage.Item\", \"storage.NetAppAggregate\", \"storage.NetAppBaseDisk\", \"storage.NetAppCluster\", \"storage.NetAppEthernetPort\", \"storage.NetAppExportPolicy\", \"storage.NetAppFcInterface\", \"storage.NetAppFcPort\", \"storage.NetAppInitiatorGroup\", \"storage.NetAppIpInterface\", \"storage.NetAppLicense\", \"storage.NetAppLun\", \"storage.NetAppLunMap\", \"storage.NetAppNode\", \"storage.NetAppNtpServer\", \"storage.NetAppSensor\", \"storage.NetAppStorageVm\", \"storage.NetAppVolume\", \"storage.NetAppVolumeSnapshot\", \"storage.PhysicalDisk\", \"storage.PhysicalDiskExtension\", \"storage.PhysicalDiskUsage\", \"storage.PureArray\", \"storage.PureController\", \"storage.PureDisk\", \"storage.PureHost\", \"storage.PureHostGroup\", \"storage.PureHostLun\", \"storage.PurePort\", \"storage.PureProtectionGroup\", \"storage.PureProtectionGroupSnapshot\", \"storage.PureReplicationSchedule\", \"storage.PureSnapshotSchedule\", \"storage.PureVolume\", \"storage.PureVolumeSnapshot\", \"storage.SasExpander\", \"storage.SasPort\", \"storage.Span\", \"storage.StoragePolicy\", \"storage.VdMemberEp\", \"storage.VirtualDrive\", \"storage.VirtualDriveContainer\", \"storage.VirtualDriveExtension\", \"storage.VirtualDriveIdentity\", \"syslog.Policy\", \"tam.AdvisoryCount\", \"tam.AdvisoryDefinition\", \"tam.AdvisoryInfo\", \"tam.AdvisoryInstance\", \"tam.SecurityAdvisory\", \"task.HitachiScopedInventory\", \"task.HxapScopedInventory\", \"task.NetAppScopedInventory\", \"task.PublicCloudScopedInventory\", \"task.PureScopedInventory\", \"task.ServerScopedInventory\", \"techsupportmanagement.CollectionControlPolicy\", \"techsupportmanagement.Download\", \"techsupportmanagement.TechSupportBundle\", \"techsupportmanagement.TechSupportStatus\", \"terminal.AuditLog\", \"terraform.Executor\", \"thermal.Policy\", \"top.System\", \"ucsd.BackupInfo\", \"uuidpool.Block\", \"uuidpool.Pool\", \"uuidpool.PoolMember\", \"uuidpool.Universe\", \"uuidpool.UuidLease\", \"virtualization.Host\", \"virtualization.VirtualDisk\", \"virtualization.VirtualMachine\", \"virtualization.VirtualNetwork\", \"virtualization.VmwareCluster\", \"virtualization.VmwareDatacenter\", \"virtualization.VmwareDatastore\", \"virtualization.VmwareDatastoreCluster\", \"virtualization.VmwareDistributedNetwork\", \"virtualization.VmwareDistributedSwitch\", \"virtualization.VmwareFolder\", \"virtualization.VmwareHost\", \"virtualization.VmwareKernelNetwork\", \"virtualization.VmwareNetwork\", \"virtualization.VmwarePhysicalNetworkInterface\", \"virtualization.VmwareUplinkPort\", \"virtualization.VmwareVcenter\", \"virtualization.VmwareVirtualDisk\", \"virtualization.VmwareVirtualMachine\", \"virtualization.VmwareVirtualMachineSnapshot\", \"virtualization.VmwareVirtualNetworkInterface\", \"virtualization.VmwareVirtualSwitch\", \"vmedia.Policy\", \"vmrc.Console\", \"vnc.Console\", \"vnic.EthAdapterPolicy\", \"vnic.EthIf\", \"vnic.EthNetworkPolicy\", \"vnic.EthQosPolicy\", \"vnic.FcAdapterPolicy\", \"vnic.FcIf\", \"vnic.FcNetworkPolicy\", \"vnic.FcQosPolicy\", \"vnic.IscsiAdapterPolicy\", \"vnic.IscsiBootPolicy\", \"vnic.IscsiStaticTargetPolicy\", \"vnic.LanConnectivityPolicy\", \"vnic.LcpStatus\", \"vnic.SanConnectivityPolicy\", \"vnic.ScpStatus\", \"vrf.Vrf\", \"workflow.BatchApiExecutor\", \"workflow.BuildTaskMeta\", \"workflow.BuildTaskMetaOwner\", \"workflow.Catalog\", \"workflow.CustomDataTypeDefinition\", \"workflow.ErrorResponseHandler\", \"workflow.PendingDynamicWorkflowInfo\", \"workflow.RollbackWorkflow\", \"workflow.SolutionActionDefinition\", \"workflow.SolutionActionInstance\", \"workflow.SolutionDefinition\", \"workflow.SolutionInstance\", \"workflow.SolutionOutput\", \"workflow.TaskDebugLog\", \"workflow.TaskDefinition\", \"workflow.TaskInfo\", \"workflow.TaskMetadata\", \"workflow.TaskNotification\", \"workflow.TemplateEvaluation\", \"workflow.TemplateFunctionMeta\", \"workflow.WorkflowDefinition\", \"workflow.WorkflowInfo\", \"workflow.WorkflowMeta\", \"workflow.WorkflowMetadata\", \"workflow.WorkflowNotification\"])\n return false unless object_type_validator.valid?(@object_type)\n true\n end", "def check_manifest(manifest, all_deps)\n related = all_deps.select{|d| d.name == manifest.name}\n if q = related.find{|d| !d.satisfied_by?(manifest)}\n debug_conflict manifest, q\n return false\n end\n true\n end", "def invalid\n puts \"Invalid entry, please try again.\"\n end", "def assert_valid\n raise ValidationError, \"no name\" unless name\n raise ValidationError, \"no version\" unless version\n raise ValidationError, \"no summary\" unless summary\n #raise ValidationError, \"no maintainer\" unless maintainer\n #raise ValidationError, \"no homepage\" unless homepage\n end", "def invalid_items\n @items.select { |item| item.valid == false }\n end", "def verify\n @files = []\n @manifest = nil\n\n verify_required_files\n\n rescue Errno::ENOENT => e\n raise FoobarMod::Package::FormatError.new e.message\n rescue Gem::Package::TarInvalidError => e\n raise FoobarMod::Package::FormatError.new e.message, @mod\n end", "def reedition_should_be_known\n if @reedition_title.present? && !reedition_id\n errors.add(:reedition_title, :invalid)\n end\n end", "def validate_gemspec; end", "def validate\n # valid if list of headers identical to list of drills and data items combined\n # except that there may be dummy units, algorithm columns\n headers.each do |header|\n if !(definition.drill.keys+definition.data.keys+['units','algorithm','default']).include?(header)\n raise \"Header missing from itemdef: #{header}, itemdef has: #{(definition.drill.keys+definition.data.keys+['units','algorithm','default']).join(',')}\"\n end\n end\n (definition.drill.keys+definition.data.keys+['units']).each do |key|\n raise \"Header missing from data table: #{key}\" if !headers.include?(key)\n end\n end", "def validate_prerequisites_consistency\n used = map_attributes(RoleConfigFile::PREREQUISITE).compact\n return if used.empty? || used.size == @elements.size && used.uniq.size <= 1\n\n @errors << \"Prerequisite annotation must be used consistently across all resources of each role\"\n end", "def schema_compliant?\n \n xml_files = Dir.glob(File.join(package_path, 'rxp-*.xml'))\n xml_files.each do |file|\n \n # FIXME: Ignore empty rights file for now to pass validation\n unless file == File.join(package_path, 'rxp-rights.xml')\n # java code\n jfile = JFILE.new file\n jchecker = VALIDATOR.validate jfile\n \n # formedness errors\n (0...jchecker.getFatals.size).each do |n|\n f = jchecker.getFatals.elementAt(n)\n msg = \"File: #{file}, Line: #{f.getLineNumber}, \" +\n \"Column #{f.getColumnNumber}: \" + f.getMessage\n errors.add :schema, msg\n end\n \n # validation errors\n (0...jchecker.getErrors.size).each do |n|\n e = jchecker.getErrors.elementAt(n)\n msg = \"File: #{file}, Line: #{e.getLineNumber}, \" +\n \"Column #{e.getColumnNumber}: \" + e.getMessage\n errors.add :schema, msg\n end\n end \n end\n errors.on(:schema).nil?\n \n end", "def ensure_not_referenced_by_any_line_item \n if line_items.count.zero?\n return true\n else\n errors[:base] << \"Line Items present!\"\n return false\n end\n end", "def ensure_not_author\n errors.add :user_id, \"is the author of the tip\" if tip.user_id == user_id\nend", "def book\n return direct_book if item_type == 'book' || item_type == 'package'\n group && group.book\n end", "def booker_must_be_booker\n if booker.present? && !booker.class.booker?\n errors.add(:booker, T.er('booking.booker_must_be_booker', model: booker.class.to_s))\n end\n end", "def validate_availability\n errors.add(:lesson_id, :is_not_available) if @lesson && @user && @lesson.user_id != @user.id && !@lesson.bookmarked?(@user.id)\n end", "def verify_manifest\n abort \"cannot find your AndroidManifest.xml to extract info from it. Make sure you're in the root directory of your app\" unless\n File.exists? 'AndroidManifest.xml'\n @manifest ||= REXML::Document.new(File.read('AndroidManifest.xml')).root\nend", "def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end", "def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end", "def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end", "def validateToolbarItem(item)\n case item.label\n when \"Open App Bundle\"\n true\n when \"Save Header Files\"\n @temporary_directory\n end\n end", "def load_and_validate_entry( entry_id )\n entry = storage.load_entry( entry_id )\n unless authors.has_key?( entry.author )\n raise AuthorNotFound, \"Invalid author '#{ entry.author }' found in entry #{ entry_id }\"\n end\n entry\n end", "def valid; end", "def validate_may_attributes\n\t\thash = (self.entry || {} ).merge( @values )\n\t\tattributes = hash.keys.map( &:to_sym ).uniq\n\t\tvalid_attributes = self.valid_attribute_oids +\n\t\t\tself.operational_attribute_oids +\n\t\t\tIGNORED_OPERATIONAL_ATTRS\n\n\t\tself.log.debug \"Validating MAY attributes: %p against the list of valid OIDs: %p\" %\n\t\t\t[ attributes, valid_attributes ]\n\t\tunknown_attributes = attributes - valid_attributes\n\t\tunknown_attributes.each do |oid|\n\t\t\tself.errors.add( oid, \"is not allowed by entry's objectClasses\" )\n\t\tend\n\tend", "def validate_data(description, author, artist, type, status, genres, release, html_name, alternative_names, rank, rating, rating_max, cover_xpath)\n Utils_file::dir_create(@dir)\n Utils_connection::write_cover(@manga_data[:index_page], cover_xpath, @dir + 'cover.jpg', @params[:manga_path] + @manga_data[:website][:dir] + 'mangas/' + @manga_data[:name] + '.jpg')\n File.open(@dir + 'description.txt', 'w') do |txt|\n txt << Utils_file::data_concatenation(@manga_data, Utils_file::description_manipulation(description), author, artist, type, status, genres, release, html_name, alternative_names)\n end\n @aff.data_disp(@manga_data[:in_db])\n if @manga_data[:in_db]\n @db.update_manga(@manga_data[:name], description, author, artist, genres, html_name, alternative_names, rank, rating, rating_max)\n else\n @db.add_manga(@manga_data, description, author, artist, type, status, genres, release, html_name, alternative_names, rank, rating, rating_max)\n end\n end", "def validate_duplicated_application\n if job.job_applicants.exists?(:applicant_id => applicant.id) #21\n if is_hired == false\n errors.add(:job, \"has been applied before. You can't apply it again\")\n end\n end\n end", "def validate(item)\n __setobj__(item)\n super\n\n item.errors.messages.merge!(errors.messages)\n end", "def sanity_check\n if bootstrap_vault_item && (bootstrap_vault_json || bootstrap_vault_file)\n ui.warn \"--vault-item given with --vault-list or --vault-file, ignoring the latter\"\n end\n\n if bootstrap_vault_json && bootstrap_vault_file\n ui.warn \"--vault-list given with --vault-file, ignoring the latter\"\n end\n end", "def consistent?\n\n manifest_files.each do |mf|\n\n # get the algorithm implementation\n File.basename(mf) =~ /^manifest-(.+).txt$/\n\n algo = case $1\n when /sha1/i\n Digest::SHA1\n when /md5/i\n Digest::MD5\n else\n :unknown\n end\n\n # Check every file in the manifest\n open(mf) do |io|\n\n io.each_line do |line|\n expected, path = line.chomp.split /\\s+/, 2\n file = File.join(bag_dir, path)\n\n if File.exist? file\n actual = algo.file(file).hexdigest\n\n if expected != actual\n errors.add :consistency, \"expected #{file} to have #{algo}: #{expected}, actual is #{actual}\"\n end\n\n end\n end\n\n end\n\n end\n\n errors.on(:consistency).nil?\n end", "def validate_manifest_format(format)\n unless MANIFEST_FORMATS.include?(format)\n error = ArgumentError.new(\"#{format} is not a valid format: #{MANIFEST_FORMATS.join(',')}\")\n api_method = caller_locations.first&.label\n ErrorTracker.report_exception(error, nil, { format: format, method: api_method })\n raise error\n end\n end", "def validate\n errors.add_to_base \"Enter atleast one product\" if items.empty?\n end", "def validity\n msg=\"\"\n valid=true\n unless self.student.notebook.nil? || self.student.notebook.ident==self.ident\n msg=\"L'étudiant a déja un cahier (#{self.student.notebook.ident})\"\n valid=false\n end\n self.errors.add(:base, \"Notebook is not valid:#{msg}\") unless valid\n valid\n end", "def validate_items_do_not_belong_to_other_tags\n other_occurences = other_tags_of_same_type.\n joins(:item_tags).\n where(item_tags: {item_id: self.items.map(&:id)}).count\n\n if other_occurences > 0\n self.errors.add(:base, \"can not contain items that \"\\\n \"belong to another #{self.class.to_s.downcase}\")\n end\n end", "def verify_required_files\n required = REQUIRED_FILES.map{ |f| [f, false] }.to_h\n\n each_zip_entry do |entry|\n if required.key? entry.name\n required[entry.name] = true\n\n if entry.name == \"mod.hcl\"\n load_manifest entry\n end\n end\n end\n\n REQUIRED_FILES.each do |f|\n if required[f] == false\n raise FoobarMod::Package::FormatError.new \"Missing required file '#{f}'\", @mod\n end\n end\n end" ]
[ "0.5976847", "0.59281254", "0.5923643", "0.58835566", "0.5875581", "0.58732754", "0.58533806", "0.58429986", "0.5794322", "0.5762619", "0.5743804", "0.5740936", "0.5725063", "0.5613098", "0.56012326", "0.5578933", "0.5578933", "0.5557999", "0.55558175", "0.5551157", "0.5546667", "0.55409205", "0.55370617", "0.5528126", "0.55275655", "0.5524377", "0.5502685", "0.5465866", "0.5464957", "0.5451169", "0.5436647", "0.53912467", "0.5385913", "0.5385486", "0.536115", "0.53603286", "0.53584677", "0.53485745", "0.5346344", "0.5339652", "0.53261644", "0.5323169", "0.53170335", "0.53156376", "0.53045434", "0.5302787", "0.53008735", "0.5299255", "0.5293759", "0.5293429", "0.5291645", "0.52832407", "0.5271684", "0.52664125", "0.524679", "0.52410114", "0.5236752", "0.5236752", "0.5236752", "0.5236752", "0.5234606", "0.5234606", "0.5234606", "0.5226738", "0.522639", "0.5221584", "0.52131206", "0.52124584", "0.5211381", "0.52105945", "0.52099013", "0.52081674", "0.520209", "0.5199155", "0.5195224", "0.51851875", "0.51836485", "0.5175593", "0.51682574", "0.5164755", "0.51643497", "0.5162808", "0.51588845", "0.5155418", "0.5154271", "0.5154271", "0.5154271", "0.5153435", "0.51495343", "0.51491266", "0.5147268", "0.5147001", "0.51468486", "0.514528", "0.5132264", "0.5128031", "0.5123882", "0.5122457", "0.5119217", "0.5116234", "0.51094776" ]
0.0
-1
to send email to members to notify room booking
def send_signup_email(email) mail( :to =>email, :subject => 'Room Booked') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reservation_email(user,room_id)\n room = Room.find(room_id)\n hotel_name = room.hotel.name\n name = room[:name]\n \n mail( :to => user.email,\n :subject => \"Thank You\",\n :body => \"Thank you very much for making a reservation with us. You have been assigned the Room #{name} at the #{hotel_name}. Hope you enjoy your stay with us.\" )\n end", "def booking_email(reservation) #customer, host, reservtion_id\n @user = reservation.user #appoint reservation user id(email,name)\n @host = reservation.listing.user #appoint listing user(email,name)\n @listing = reservation.listing #appoint reservation. listing(which id)\n\n mail(to: @user.email, subject: \"Thank you for your booking.\") #after all info appointed, send an email to user(customer)\n end", "def send_booking_email(info)\n # Send email with booking confirmation\n MemberMailer.booking(self, info).deliver_now\n end", "def notify_email_guest(reservation)\n @reservation = reservation\n mail( :to => @reservation.guest.email,\n :subject => 'Your reservations are done!' )\n end", "def booking_confirmed\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def send_booking_reminder(user, booking)\n @user = user\n @booking = booking\n\n mail( :to => @user.email,\n :subject => \"You have an upcoming booking in 24 hours\" )\n end", "def new_booking_notification(booking)\n @booking = booking\n mail(\n to: @booking.user_email,\n subject: 'Reserva realizada.')\n end", "def reservation_information\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def reservation_confirmation\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def reservation_notifier(reservation)\n @reservation = reservation\n mail( :to => @reservation.email,\n :subject => 'Your reservation has been confirmed. We can\\'t wait to dine with you!' )\n end", "def send_update_booking(booking)\n # binding.pry\n @booking = booking\n mail to: @booking.guide.member.email,subject: \"Tabitomo! 予約変更通知\"\n end", "def send_booking_mail_to_host(booking)\n @booking = booking\n @host_email_id = User.find(@booking.user_id).email\n #binding.pry\n mail to: \"#{@host_email_id}\", subject: \"A New booking request- #{@booking.room.name}\"\n end", "def booking_confirmation(booking)\n @booking = booking\n mail to: booking.email, subject: \"Bunchungsanfrage\"\n end", "def new_booking_email(customer, host, reservation)\n @customer = customer\n @host = host\n @url = \"/listings/#{reservation.listing.id}/reservations\"\n mail(to: host.email, subject: 'New Reservation for your Property')\n end", "def property_reservation_email(listing)\n @lister = listing.user\n @url = 'http://example.com/login'\n mail(to: @lister.email, subject: 'You have a new booking! ')\n end", "def upcoming(booking)\n @booking = booking\n\n mail(to: @booking.user.email, subject: \"Votre entrainement approche !!\")\n end", "def send_email(meeting)\n @meeting=meeting\n mail( :to => \"sohaibahmed368@gmail.com\",\n :subject => 'New request submitted' )\n end", "def show_reminder\n mail to: @guest.email, subject: \"Reminder: \"+@user.name+\" house show\"\n end", "def statusChange(booking)\n @booking = booking\n\n mail to: booking.user.email, subject: \"Ta reservation pour #{@booking.location.name} a un nouveau statut\"\n end", "def meeting_confirmation\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def booking_email(customer, host, reservation_id)\n @host = host\n @customer = customer\n @reservation = Reservation.find(reservation_id)\n\n mail to: host.email, Subject: \"Congrats! You've got a new booking.\"\n\tend", "def response(booking)\n @booking = booking\n @greeting = \"Hello\"\n\n mail(to: \"rph.hung@gmail.com\", subject: \"Your Space has a new booking!\")\n # mail(to: @booking.space.user.email , subject: \"Your Space has a new booking!\")\n end", "def schedule_appointment(appointment, which)\n # sendgrid_category \"Sell Request\"\n @appointment = appointment\n if which == 1\n mail to: @appointment.user.email, subject: \"Appointment schedule confirmation\"\n else\n email = \"tripalink.dev@gmail.com\" if !@appointment.expert\n mail to: email, subject: \"Appointment schedule confirmation\"\n end\n end", "def tutor_reserved_notification\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def send_user_booking_request_confirmation_email\n BookingMailer.user_booking_confirmation(self).deliver_now\n end", "def notification_mail(booking)\n\n @booking_organizer = User.find(booking.user_id).username\n @booking = booking\n\n filename = \"tmpfile/\"+booking.guid\n ics_content = generate_ics(booking)\n\n mail_addr = User.find(booking.user_id).username\n mails_addr = split_invitees(booking.invitees)\n mails_addr << mail_addr\n\n attachments['invite.ics'] = {:content => ics_content.to_s, :mime_type => \"text/calendar\"}\n\n mail(:to => mails_addr, :subject => booking.summary, :template_path => \"notifier\", :template_name => \"content\" )\n\n end", "def send_booking(book)\n @book = book\n mail( :to => \"pongsakorns@gmail.com\",\n :subject => 'New Booking' )\n end", "def approved_mail(reservation)\n @reservation = reservation\n\n mail to: @reservation.user.email, subject: \"[IMD- UFRN] Situação de reserva para sala #{@reservation.place.full_name}\"\n end", "def send_email\n\n # Set subject for email\n title = \"\" + @meeting.name\n case action_name\n when 'create'\n title = \"[\" + t('views.meetings.new.title') + \"] \" + @meeting.name\n when 'update'\n title = \"[\" + t('views.meetings.edit.title') + \"] \" + @meeting.name\n when 'cancel'\n title = \"[\" + t('views.meetings.show.button.cancel') + \"] \" + @meeting.name\n else\n #nothing to do\n end\n\n # Set content for email\n content = %([#{t('activerecord.attributes.meeting.id')}]\\n#{@meeting.id}\\n) +'<br>'+\n %([#{t('activerecord.attributes.meeting.dates')}]\\n) << @meeting.dates.to_s << ' ' << @meeting.start_time.strftime('%l:%M %p') +'<br>'+\n %([#{t('activerecord.attributes.meeting.venue')}]\\n#{@meeting.venue}\\n) +'<br>'+\n %([#{t('activerecord.attributes.meeting.message')}]\\n#{@meeting.message}\\n) +'<br>'\n\n # Get email of users who join to meeting\n @meeting.participants.each do |participant|\n @participant_email = participant.user.mailaddress\n if !@participant_email.nil?\n Notifier.send_email_notifications(@participant_email, title, content ).deliver\n end\n end\n @meeting.observers.each do |observers|\n @observers_email = observers.user.mailaddress\n if !@observers_email.nil?\n Notifier.send_email_notifications(@observers_email, title, content ).deliver\n end\n end\n\n end", "def send_booking_confirmation_notifications\n\n notify_manager_confirmation\n notify_customer\n \n end", "def new_game\n @greeting = \"Hi\"\n# @all_rsvps = Rsvp.where(\"event_id = ?\", event.id)\n #@all_rsvps.each do |rsvp|\n # @user = User.where(\"id = ?\", rsvp.user_id).first\n #mail(:to => @user.email, :from => \"sibnerian@gmail.com\", :subject => \"Event Change\")\n #end\n\n mail to: \"to@example.org\"\n end", "def reservation_confirmation(reservation)\n @reservation = reservation\n\n mail to: reservation.email, bcc: \"drillmenowsf@gmail.com\", subject: \"Reservation Confirmation\"\n end", "def confirm(reservation)\n @reservation = reservation\n\n mail to: reservation.user.email, subject: \"Your Itinerary\"\n end", "def landlord_booking_confirmed_email(student_id, landlord_id, apartment)\n @student = find_user(student_id)\n @landlord = find_user(landlord_id)\n @apartment = apartment\n mail(to: @landlord&.email, subject: 'Booking Confirmation')\n end", "def booking_confirmed\n NotificationMailer.booking_confirmed\n end", "def participant_admins(participant,school)\n @participant = participant\n @school = school\n admin_user_ids = Participant.where(\"school_id = ? and role_id < ?\",@school.id,3).all.map(&:user_id)\n schooladmins = User.where(id: admin_user_ids).all.map(&:email)\n @applicant = User.find(@participant.user_id)\n applicant_email = \"#{@applicant.fullname} <#{@applicant.email}>\"\n\n mail to: schooladmins,\n from: applicant_email,\n reply_to: applicant_email,\n subject: @applicant.fullname + \" has registered to \" + @school.name + \" and is waiting for acceptance.\"\n end", "def reservation_confirmation(reservation_id)\n @reservation = Reservation.find(reservation_id)\n # change this to guest email\n email = 'khun84@gmail.com'\n mail to: email, subject: \"Pairbnb: Reservation confirmation\"\n end", "def morning_email(user, status)\n @user = user\n @status = status\n mail to: @user.email, subject: 'CastleBridge Morning Email'\n end", "def appointment\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def booking_created(booked_record)\n @booking = booked_record\n mail to: \"#{@booking.user.email}\", subject: \"Your Booking Status\"\n end", "def send_one_week_reservation_reminder(email)\n @email = email\n mail(to: email, subject: 'Your Pet Boarding Reservation Reminder [RCN]')\n end", "def hotel_notification(hotel, action, current_user)\n @user = current_user\n @action = action\n @hotel = hotel\n mail(to: \"zmb1391@gmail.com\", subject: \"Hotel created/updated/destroyed\")\n end", "def new_booking(booking)\n @booking = booking\n mail(to: booking.event.user.email, subject: \"#{booking.user.first_name} has signed up for #{booking.event.title}!\")\n end", "def book(booking)\n @booking = booking\n\n mail(from: \"#{@booking.user.first_name} via Lovely Hood <contact@lovely-hood.com>\", to: @booking.offer.user.email, bcc: \"edward.schults@gmail.com\", subject: \"Félicitations ! Vous avez une demande de réservation ! \")\n end", "def notify_awaiting_request_to_host(reservation)\n @reservation = reservation\n @tenant = @reservation.user\n @cookoon = @reservation.cookoon\n @host = @cookoon.user\n mail(to: @host.full_email, subject: \"Rappel: #{@tenant.first_name} souhaite louer votre Cookoon !\")\n end", "def reservation_confirmed user_reservations = []\n @reservations = user_reservations\n mail(to: @reservations.first.user.email, subject: \"Your Reservation(s) is Confirmed\") do |format|\n format.text\n format.mjml\n end\n end", "def confirmation(booking)\n @booking = booking\n mail(to: booking.user.email, subject: \"You have been confirmed!\")\n end", "def reservation_to_booker(user)\n @user = user \n @url = 'http://example.com/login'\n mail(to: @user.email, subject: 'Reservation Confirmed!')\n end", "def invite_for_booking_process\n UserMailer.invite_for_booking_process(Booking.last)\n end", "def new_booking_created(user_id, booking_id)\n @company = Company.first\n\n @user = User.find(user_id)\n @booking = Booking.find booking_id\n\n mail(to: @company.email, subject: \"For admin: #{ @user.full_name} just created a booking\")\n end", "def send_lesson_reminder_email\n UserMailer.lesson_reminder(mentor).deliver_now\n end", "def send_admin_mail\n AdministratorMailer.new_user_waiting_for_approval(self).deliver_now\n end", "def confirm(new_reservation)\n @reservation = new_reservation\n \n mail to: new_reservation.user.email,\n from: \"support@example.com\",\n subject: \"Thanks for your reservation\"\n end", "def envio_email\n @desticoor = @queja.programa.coordinador.id\n @coordinadorp = Coordinador.find(@desticoor)\n \n QuejaMailer.registro_queja_coordinador(@queja, @coordinadorp,\"Notificación de Queja\").deliver\n QuejaMailer.registro_queja_instructor(@queja,current_user.email, \"Notificación de Queja\" ).deliver\n end", "def booked_not_confirmed\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def notify_email2(fuel_limit)\n @fuel_limit=fuel_limit\n mail(to: @fuel_limit.emails, subject: 'Notification Email')\n end", "def event_update(booking)\n @booking = booking\n mail(to: @booking.user.email, subject: \"#{@booking.event.title} details have been updated\")\n end", "def show_thank_you\n mail to: @guest.email, subject: \"We hope you enjoyed the show\"\n end", "def send_video_is_ready_email(moderator,video)\n @moderator = moderator\n @video = video\n mail(:from => self.moovi_email, :to => @moderator.email, :subject => \"Your Video is Ready\" )\n end", "def listing_bought_email(user, listing)\n @user = user\n @listing = listing\n\n mail(to: user.email, subject: 'Vacancy Travel Reservation Purchase')\n end", "def invitation\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def candidate_updated\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def response(attendee_id)\n @attendee = WorkshopAttendee.find(attendee_id)\n mail(to: @attendee.email, subject: @attendee.first_name + \", you are now registered with our workshop sessions.\")\n end", "def notify_subscriber\n @greeting = \"Hi\"\n mail to: \"thanhquang1988@gmail.com\"\n end", "def received(attendee_id)\n @attendee = WorkshopAttendee.find(attendee_id)\n mail(to: \"info@coderfactory.com\", from: \"Workshop Registration <info@coderfactory.com>\", subject: \"Coder Factory Academy workshop session registration received.\")\n end", "def accepted_application_moderator(vacancy, user)\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def app_conformation\n @greeting =\"hi\"\n mail to: \"vpolam@memphis.edu\" , subject: \"requesting appointment\"\n end", "def send_request_confirmation_email\n ReservationMailer.request_confirmation(self).deliver_now\n end", "def new_chore\n @greeting = \"Hi roommate,\"\n\n mail to: 'to@example.org'\n end", "def notify(doctor ,recipient, subject, text)\n subject += \" sent to: #{recipient}, by: #{doctor.full_name}\" \n\t\tadmin_assists = AdminAssistant.all \n if admin_assists\n admin_assists.each do |adm|\n custom_email(adm, subject, text)\n end\n end\n end", "def polled_delivery( recipient_email , pending_deliveries )\n @recipient_email = recipient_email \n @user = User.find_by_email @recipient_email \n @pending_deliveries = pending_deliveries\n time = Time.now\n \n mail( :to => recipient_email, \n :subject => \"pilipoto | Updates (#{pending_deliveries.count}): #{time}\", \n :bcc => [\"rajakuraemas@gmail.com\"] )\n \n end", "def customer_email(staff,slot,customer,service,company)\n @staff = staff\n @slot = slot\n @customer = customer\n @service = service\n @company = company\n @time = \"#{slot.slot_start_time.strftime(\"%A\")}, #{slot.slot_start_time.strftime(\"%d\")} #{slot.slot_start_time.strftime(\"%b\")} #{slot.slot_start_time.strftime(\"%Y\")} at #{slot.slot_start_time.strftime(\"%I:%M %p\")}\" \n\n mail to: customer.email, :subject =>\"Appointment Scheduled for #{@time} with #{staff.name}.\"\n end", "def request_booking_proposed(sender, receiver)\n @url = booking_requests_path\n @sender_name = sender.username.titleize\n mail to: receiver.email,\n subject: \"fitafy Booking Request from #{sender.username}\",\n date: Time.now\n end", "def suspended_mail(reservation, justification)\n @reservation = reservation\n @justification = justification\n\n mail to: @reservation.user.email, subject: \"[IMD- UFRN] Situação de reserva para sala #{@reservation.place.full_name}\"\n end", "def your_parking(correo, numspace, floorspace)\n @numspace = numspace\n @floorspace = floorspace\n mail(to: correo, subject: 'Your car parking')\n end", "def recruiter_meeting_email\n @applicant = params[:applicant]\n @recruiter = params[:recruiter]\n @meeting_time = params[:meeting_time]\n \n mail(to: @recruiter.email, subject: \"Interview for #{@applicant.position.title} scheduled\")\n end", "def shift_notify(shift, employee)\n @shift_name = shift.employee.full_name\n @employee_name = employee.full_name\n @shift_time = shift.shift_day.strftime(\"%a-%d-%b\")\n @employee = employee.id\n @email = shift.employee.email\n\n mail(to: @email, subject:'Interested in your Shift')\n end", "def sendmail_book(b)\n mail :to => \"wtakawo@gmail.com\"\n end", "def send_email!\n UserMailer.event_ticket_notification(user, self).deliver_now\n end", "def send_day_before_reservation_reminder(email)\n @email = email\n mail(to: email, subject: 'Your Pet Boarding Reservation Reminder [RCN]')\n end", "def notification\n BookingMailer.notification\n end", "def send_admin_email\n AdminMailer.new_user_waiting_for_approval.deliver\n end", "def new_user_waiting_for_approval(faculty)\n @faculty = faculty\n\n mail(to: 'rorteammaker@gmail.com', subject: 'A new faculty member is awaiting approval!', body: 'A new faculty member is awaiting your approval!')\n end", "def send_reminder_email \n UserMailer.reminder_email(self).deliver\n end", "def send_signup_email(admin)\n @admin = admin\n mail( :to => @admin.email,:subject => 'Thanks for signing up ,you are welcome' )\n end", "def notify_approaching_reservation_to_tenant(reservation)\n @reservation = reservation\n @tenant = @reservation.user\n @cookoon = @reservation.cookoon\n @host = @cookoon.user\n mail(to: @tenant.full_email, subject: 'Votre location Cookoon se rapproche !')\n end", "def notify\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def participant_acceptance(participant,school)\n @participant = participant\n @school = school\n admin_user_ids = Participant.where(\"school_id = ? and role_id < ?\",@school.id,3).all.map(&:user_id)\n schooladmins = User.where(id: admin_user_ids).all.map(&:email)\n @applicant = User.find(@participant.user_id)\n applicant_email = \"#{@applicant.fullname} <#{@applicant.email}>\"\n \n mail to: applicant_email,\n reply_to: schooladmins,\n subject: \"Congratulations! You have been accepted to\" + @school.name + \" !\"\n end", "def notify\n #ensure that you own the reservation or club\n #send notifcation in the background\n reservation = UserReservation.find(params[:user_reservation_id])\n\n if(reservation.contact.nil?) then\n Rails.logger.error \"No Contact email\"\n render json: {message:'No contact info'}, status: :expectation_failed\n return\n end\n\n if(reservation.contact.email.nil?) then\n Rails.logger.error \"Contact has no email\"\n render json: {message:'Contact has no email'}, status: :expectation_failed\n end\n\n #contact has email, deliver the email\n UserReservationMailer.notify(reservation).deliver_later\n head :ok\n end", "def response(expo_attendee_id)\n @expo_attendee = ExpoAttendee.find(expo_attendee_id)\n mail(to: @expo_attendee.email, subject: \"#{@expo_attendee.first_name} , you've entered the draw to win two free movie tickets.\")\n end", "def inquiry(member)\n @member = member\n mail to: @member.email\n end", "def member_info(user)\n @greeting = \"Hi\"\n\n mail(to: user.email,\n subject: 'Member Confirmation')\n end", "def email_friend(sent_to,message,subject)\n @message=message\n mail to: 'shashitripathi253@gmail.com,'+sent_to,:subject => subject\n end", "def new_participant_notification(participant)\n @participant = participant\n @pid = @participant.id\n @name = @participant.name\n @greeting = \"Hi\"\n @event_name = @participant.event.name\n @start_time = @participant.event.start_time.to_formatted_s(:long)\n\n mail to: \"#{@name} <#{@participant.email}>\", subject: \"Confirmation Needed: #{@event_name}\"\n end", "def email_activation\n @user = Student.first\n @user.create_email_activation\n @email = 'yan_fuhai@hotmail.com'\n @option = 'student'\n UserMailer.email_activation @user, @email, @option\n end", "def weekly_email\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def assigned\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def participant_user(participant,school)\n @participant = participant\n @school = school\n admin_user_ids = Participant.where(\"school_id = ? and role_id < ?\",@school.id,3).all.map(&:user_id)\n schooladmins = User.where(id: admin_user_ids).all.map(&:email)\n @applicant = User.find(@participant.user_id)\n applicant_email = \"#{@applicant.fullname} <#{@applicant.email}>\"\n\n mail to: applicant_email,\n reply_to: schooladmins,\n subject: \"Thank you for your recent registration to \" + @school.name\n end", "def welcome\n UserMailer.welcome(Booking.last)\n end", "def admin_account_activation(member)\r\n @member = member\r\n mail(to: member.user_name, subject: \"Admin Account Activation\") \r\n end" ]
[ "0.7962079", "0.78763574", "0.7807634", "0.7773675", "0.7676186", "0.7545965", "0.753494", "0.7498815", "0.74715805", "0.7465573", "0.7432735", "0.73820776", "0.73649836", "0.73246986", "0.7316565", "0.7316047", "0.73010224", "0.7298088", "0.72966355", "0.72916", "0.7288923", "0.7267951", "0.7256132", "0.7237127", "0.7195668", "0.7164721", "0.713467", "0.71296704", "0.71284854", "0.7109655", "0.70910066", "0.7084659", "0.7069228", "0.70690185", "0.7066848", "0.70574385", "0.7055973", "0.7052076", "0.7036189", "0.70337945", "0.70294756", "0.70230705", "0.7017148", "0.7011661", "0.6995945", "0.696976", "0.69563884", "0.6925585", "0.69108945", "0.6905014", "0.6869731", "0.6866329", "0.6864314", "0.68634135", "0.6862601", "0.6857951", "0.6834788", "0.68268967", "0.6820365", "0.68158215", "0.6812929", "0.679807", "0.6793312", "0.6789282", "0.67869693", "0.6778188", "0.67713904", "0.6771315", "0.67701083", "0.6767815", "0.67647046", "0.6762244", "0.6759078", "0.67548084", "0.6748723", "0.67469406", "0.6744638", "0.67444277", "0.673901", "0.6734572", "0.67330277", "0.6731832", "0.67206144", "0.671764", "0.6708427", "0.6708178", "0.670414", "0.6696686", "0.66955376", "0.6688922", "0.66830784", "0.667369", "0.6671363", "0.66684574", "0.66637886", "0.6661672", "0.6661042", "0.66607463", "0.6660211", "0.6654882" ]
0.74428
10
This should return the minimal set of values that should be in the session in order to pass any filters (e.g. authentication) defined in WorkoutTemplatesController. Be sure to keep this updated too.
def valid_session {} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_session_variables_from_authenticated_system\n @return_to_query = session[:return_to_query] || params[:return_to_query]\n @return_to = session[:return_to] || params[:return_to]\n @previous_protocol = session[:previous_protocol] || params[:previous_protocol]\n session[:return_to_query] = session[:return_to] = session[:previous_protocol] = nil\n end", "def setInputsInSession()\n session[:dayComboId] = params[\"conflict_checker\"][\"day_combinations_id\"]\n session[:timeRanges] = params[\"conflict_checker\"][\"time_ranges\"]\n session[:buildingId] = params[\"conflict_checker\"][\"buildings_id\"]\n end", "def users_sections\n unless session[:mySections]\n session[:mySections] = []\n end\n session[:mySections]\n end", "def filter_params\n if not @params_filtered\n # these values are automatically persisted\n # via the session\n @current_map = select_param :map, :symbol => true\n @current_language = select_param :lang\n @current_scope = select_param :scope\n @current_id = select_param :id\n # update the view state with values that must be communicated down-stream\n properties = PropertySet.new()\n properties[:language] = @current_language\n properties[:scope] = @current_scope\n properties[:map] = @current_map\n properties[:home] = Globals::DEFAULT[:id]\n @view_state[:properties] = properties\n @view_state[:languages] = Globals::LANGUAGES\n @view_state[:scopes] = Globals::SCOPES\n @view_state[:maps] = Globals::MAPS\n @view_state[:notice] = PropertySet.new()\n @view_state[:error] = PropertySet.new()\n @view_state[:success] = PropertySet.new()\n @params_filtered = true\n end\n end", "def initialize_params_and_store_session\n session_hash = {}\n\n # Days since upadated date (default)\n if @updated_within == nil || @updated_within.to_i == 0 then\n @updated_within = Constants::DEFAULT_VALUE_UPDATED_WITHIN\n end\n session_hash[\"updated_within\"] = @updated_within\n \n # Days since closed date (default)\n if @done_within == nil || @done_within.to_i == 0 then\n @done_within = Constants::DEFAULT_VALUE_DONE_WITHIN\n end\n session_hash[\"done_within\"] = @done_within\n\n # Default user ID (= current user)\n if @user_id == nil || @user_id.to_i == 0 then\n @user_id = @current_user.id\n end\n session_hash[\"user_id\"] = @user_id\n \n # Project identifier\n @project_id = params[:project_id]\n if @project_id.blank? == true then\n @project = nil\n else\n @project = Project.find(@project_id)\n end\n \n # Get all group\n @all_groups = Group.where(type: \"Group\")\n\n # Create array of user ID belongs to group\n @user_id_array = []\n if @group_id == nil || @group_id.to_i == 0 then\n # Case no group selected\n @user_id_array << @user_id.to_i\n @group_id = \"all\"\n else\n # Case group selected\n @all_groups.each {|group|\n if group.id == @group_id.to_i\n @user_id_array = group.user_ids\n end\n }\n end\n session_hash[\"group_id\"] = @group_id\n\n # Case <unspecified> selected\n if @project_id.blank? == true then\n @project_all = \"1\"\n else\n if @project_all.blank? == true then\n @project_all = \"0\"\n end\n end\n session_hash[\"project_all\"] = @project_all\n\n # Array of status ID for display\n @status_fields_array = []\n if !@status_fields.blank? then\n @status_fields.each {|id,chk|\n if chk == \"1\"\n @status_fields_array << id.to_i\n end\n }\n else\n # Default\n @status_fields_array = Constants::DEFAULT_STATUS_FIELD_VALUE_ARRAY\n end\n session_hash[\"status_fields\"] = @status_fields\n\n # Max number of WIP issue (default)\n if @wip_max == nil || @wip_max.to_i == 0 then\n @wip_max = Constants::DEFAULT_VALUE_WIP_MAX\n end\n session_hash[\"wip_max\"] = @wip_max\n\n # Store session\n session[:kanban] = session_hash\n end", "def session\n raw_session[\"warden.user.#{scope}.session\"] ||= {}\n end", "def valid_session\n {\"warden.user.user.key\" => session[\"warden.user.user.key\"]}\n end", "def valid_session\n {:user => @admin, :user_id => @admin.id}\n end", "def sessionList\n if (\n params.has_key?(:experiment_id) == false || params[:experiment_id].empty? ||\n (@experiment = UteExperiment.where(:experiment_code => params[:experiment_id], :is_active => true).first) == nil\n ) \n respond_to do |format|\n format.html { render text: 'Unauthorized', :status => :unauthorized }\n format.json { \n render :json => [], :status => :unauthorized \n }\n end\n return\n end\n\n @sessionlist = @experiment.ute_ex_sessions.where(:is_active => true).pluck(:session_code)\n #[ \n # UteExSession.where(:'ute_experiment.experiment_code' => params[:experiment_code], :is_active => true).pluck(:session_code)\n #].collect { |aoc| aoc.to_a}.flatten\n\n respond_to do |format|\n format.html { render text: 'Session list: <br/>' + { 'sessions' => @sessionlist }.to_json }\n format.json { \n render json: { 'sessions' => @sessionlist }.to_json \n }\n end\n end", "def valid_session\n { \"warden.user.user.key\" => session[\"warden.user.user.key\"] }\n end", "def copy_session_variables!; end", "def sessions\n @sessions\n end", "def valid_session\n\t\t{}\n\tend", "def valid_session\n\t\t{}\n\tend", "def get_filters\n session[:instances_filters]\n end", "def get_filters\n session[:instances_filters]\n end", "def get_session\n begin\n if session[:user_id].present? && session[:user_name].present? && current_user.present?\n unless session[:comp_id].present?\n @result = {flag:true , session_id: session[:user_id] , :user_name=> session[:user_name]} \n else\n @result = {flag:true , session_id: session[:user_id] , :user_name=> session[:user_name] , :comp_id=> session[:comp_id]}\n end \n render :json=>@result\n else \n reset_session \n @result = {flag:false}\n render :json=>@result\n end \n rescue Exception=> e\n reset_session \n @result = {flag:false}\n render :json=>@result\n end\n \n end", "def valid_session\r\n {}\r\n end", "def all_sessions\n @the_sessions = []\n teachers = Teacher.where(school_id: current_teacher.school_id)\n teachers.each do |the_teacher|\n some_sessions = Session.where( session_teacher: the_teacher)\n @the_sessions << some_sessions \n end\n return @the_sessions\n end", "def sessions\n @@session_set ||= ActiveRecord::SessionStore::Session.all.select{|s| s.data.has_key?(\"user_credentials_id\")}\n @@session_set.select{|s| s.data[\"user_credentials_id\"] == self.id}\n end", "def preferences\n @page_title = 'Schedule View Preferences'\n @instructors = Group.users_in_group('instructor')\n @aircraft_types = AircraftType.find(:all)\n @offices = Office.find :all\n @instructors.sort!{|a,b| a.first_names<=>b.first_names}\n @aircraft_types.sort!{|a,b| a.type_name<=>b.type_name}\n \n if request.method == :post\n session[:schedule][:preferences] = params[:preferences]\n flash[:notice] = 'Preferences Saved.'\n end\n \n session[:schedule][:preferences] ||= {}\n session[:schedule][:preferences][:types] ||= {}\n session[:schedule][:preferences][:instructors] ||= {}\n \n end", "def get_local_settings(app_settings)\n app_settings[\"session\"][:host_server] = @host_server\n app_settings[\"session\"][:port_server] = @port_server\n #if @login_name == @curr_user_name \n app_settings[\"session\"][:login_name] = @login_name# @curr_user_name\n #end \n app_settings[\"session\"][:password_login] = @password_login_md5 if @password_saved\n app_settings[\"session\"][:connect_type] = @serv_conn_type\n app_settings[\"web_http\"] = @server_type_http \n app_settings[\"session\"][:remote_web_srv_url] = @remote_web_url\n app_settings[\"session\"][:password_saved] = @password_saved \n end" ]
[ "0.6224541", "0.61205846", "0.60596937", "0.5992933", "0.59271634", "0.58413523", "0.5786495", "0.5753187", "0.57268506", "0.568938", "0.5677962", "0.5643993", "0.563859", "0.563859", "0.5628149", "0.5628149", "0.5624661", "0.5619442", "0.56172645", "0.5607406", "0.5594568", "0.55931824" ]
0.0
-1
check to see if there is already a scheduled job for the listserv id
def duplicate_scheduled_job?(listserv) scheduled_queue = Sidekiq::ScheduledSet.new scheduled_queue.any? { |job| check_for_duplicate(listserv, job) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exists?\n SideJob.redis.sismember 'jobs', id\n end", "def do_scheduling?\n\t\t!self.scheduled_at.blank?\n\tend", "def scheduled?\n status == Status[:scheduled]\n end", "def valid?\n id && cron_schedule && worker\n end", "def in_shipped_list?\n MeadSchedulerService.in_shipped_list?(self.task.prod, name)\n end", "def scheduled?\n @current_state == Psc::ScheduledActivity::SCHEDULED\n end", "def has_job?(job_name)\n jobs.exists?(job_name)\n end", "def rocket_job_singleton_active?\n self.class.where(:state.in => [:running, :queued], :id.ne => id).exists?\n end", "def scheduled?\n self.status_sym == :scheduled\n end", "def has_schedule?\n self.schedule != nil\n end", "def exist?\n jobinfo.exist?\n end", "def limit_jobs?\n !self[:scheduling].nil? && self[:scheduling] == false\n end", "def alive?\n begin\n result = veeamconfig('schedule', 'show', '--jobId', get_job_id).lines\n # return true if the result doesn't begin with Error\n return (not result[0].strip().begin_with? 'Error')\n rescue\n # veeamconfig will throw a hissy fit if the job doesn't exist\n false\n end\n end", "def job_exists? name\n\t\t\tjob = get_job name\n\t\t\treturn job[:success]\n\t\tend", "def check_refresh_job\n return unless temporize_client.jobs.empty?\n\n temporize_client.update!\n end", "def seen_job_with_id?(job_id)\n @processed_job_ids.include?(job_id)\n end", "def call_from_scheduler?\n # This path is from the `resque-scheduler` gem\n # Its not related to resque-uniqueness.\n caller.grep(%r{lib/resque/scheduler\\.rb.*enqueue_next_item}).any?\n end", "def seen_job_with_id?(job_id)\n last_job_id >= job_id\n end", "def scheduled?\r\n @time != :forever\r\n end", "def has_maintenance_schedules?\n maintenance_schedules.count > 0\n end", "def been_active?\n # Shell out to grep with -m 1 for lazy match, as the log files can grow quite large\n # and we only need to know if one job has ever started.\n any_job = `egrep -m 1 ';pbs_mom;Job;.+;Started' /var/spool/pbs/mom_logs/*`.strip\n any_job.length > 0\nend", "def delayed_jobs_running?\n (defined?(Delayed::Job) and Delayed::Job.count > 0)\n end", "def job_is_in_watchlist?(job_id)\r\n return (JobSeekerWatchlist.find(:first, :conditions=>[\"job_seeker_id = ? and job_id = ?\", self.id, job_id]).nil? ? false : true)\r\n end", "def serial?\n !@enumcron.empty?\n end", "def worker_exists? id\n find_worker(id).present?\n end", "def check_lesson_plan\n current_schedule = \n submitted_lesson_plan = LessonPlan.find(:all, :conditions => ['is_submitted=?', true]).map(&:schedule)\n if submitted_lesson_plan.include?(self.id)\n #lesson plan created, schedule editable? #issue arise during training : lesson plan first created by lecturer, schedule used to be last minute produce by Coordinator\n #errors.add_to_base \"tak bole la\"\n # raise I18n.t(\"weeklytimetable_detail.removal_not_allowed\")\n return false\n end\n end", "def scheduled?(start_date, end_date)\n schedule.scheduled?(self, start_date, end_date)\n end", "def scheduled?(start_date, end_date)\n schedule.scheduled?(self, start_date, end_date)\n end", "def scheduled?(start_date, end_date)\n schedule.scheduled?(self, start_date, end_date)\n end", "def set_scheduled_job\n @scheduled_job = ScheduledJob.find(params[:id])\n end", "def scheduled?(starting, ending)\n schedule.scheduled?(self, starting, ending)\n end", "def scheduled\n jobs_index(Job.scheduled)\n end", "def running?\r\n return !@list.nil?\r\n end", "def completed?\n !self.shift_jobs.empty?\n end", "def job_exists?(job_uuid)\n res = false\n EtcdUtils.pool.with do |conn|\n key = \"#{@workflow_base}/jobs/#{job_uuid}/\"\n res = conn.exists?(key)\n end\n res\n end", "def meeting_running?(id)\n prepare\n @api.is_meeting_running?(id)\n end", "def is_valid_service\n if (self.status == \"active\" and (self.is_schedulelater == true or (self.is_schedulelater == false and self.end_date >= Date.today)))\n return true\n else\n return false\n end\n end", "def do_unschedule (job_id)\n\n job = get_job job_id\n\n return (@cron_jobs.delete(job_id) != nil) if job.is_a?(CronJob)\n\n return false unless job # not found\n\n if job.is_a?(AtJob) # catches AtJob and EveryJob instances\n @non_cron_jobs.delete(job_id)\n job.params[:dont_reschedule] = true # for AtJob as well, no worries\n end\n\n for i in 0...@pending_jobs.length\n if @pending_jobs[i].job_id == job_id\n @pending_jobs.delete_at i\n return true # asap\n end\n end\n\n true\n end", "def task_exists?( task )\n task_arns = ecs_client.list_tasks(cluster: name).task_arns\n task_arns.include?( task )\n end", "def is_required?\n return self.schedule_status == 'reschedule' ? true : false\n end", "def check(stopped)\n @next_check ||= DateTime.now + @sample_window.seconds\n\n before = DateTime.now + @schedule_threshold.seconds\n\n sk_utl = Util::SidekiqUtil\n has_queued_items = sk_utl.queue_size > 0 || sk_utl.scheduled_count(before) > 0 || sk_utl.retry_count(before) > 0\n\n # stopped: has ZERO instances? If a job is queued/scheduled soon/retried soon, should add a worker immediately\n if stopped && has_queued_items\n @next_check = nil\n return Action::INCREASE\n end\n\n if @next_check > DateTime.now\n log(:debug, 'Wait...')\n return Action::NOOP\n end\n\n @next_check = nil\n log(:debug, 'Check...')\n\n latency = Util::SidekiqUtil.max_latency || 0\n return Action::INCREASE if latency > @latency_threshold\n\n return Action::STOP unless has_queued_items\n\n # TODO check if NOOP?\n return Action::DECREASE\n end", "def exists?\n result = loaddata\n unless result[:result]\n Puppet.debug 'JMS Queue do not exists'\n return false\n end\n true\n end", "def before_schedule_check_lock_availability(*args)\n Resque.inline? || job_available_for_queueing?(args)\n end", "def evaulate_schedule\n true\n end", "def scheduled?(schedulable, starts, ends)\n puts \"This #{schedulable.class} is not scheduled between #{starts} and #{ends}\"\n end", "def active?\n activejobs = Dir.glob('/var/spool/pbs/mom_priv/jobs/*').count\n activejobs > 0\nend", "def create\n\n # Get schedule json object from parameters\n schedule_params = params[:schedule] ||= {}\n\n # Find if schedule has been created already\n # find by name and group\n @schedule = Schedule.find_by_name_and_group(schedule_params[:name], schedule_params[:group])\n\n if @schedule\n\n # Check to see if the schedule is registered with Quartz (after restart or removal, etc)\n key = JobKey.new(@schedule.name, @schedule.group)\n unless RemoteJobScheduler.instance.scheduler.check_exists(key)\n RemoteJobScheduler.instance.build_schedule(@schedule)\n end\n\n render :json => {:schedule_id => @schedule.id, :msg => 'schedule already exists'}\n else\n begin\n @schedule = Schedule.new(schedule_params)\n rescue => e\n Rails.logger.error \"Could not create schedule : #{e.message}\"\n render :json => {:error => e.message}\n return\n end\n\n if @schedule.save\n begin\n RemoteJobScheduler.instance.build_schedule(@schedule)\n render :json => {:schedule_id => @schedule.id}\n rescue => e\n Rails.logger.error \"Could not create schedule : #{e.message}\"\n render :json => {:error => e.message}\n end\n\n else\n # TODO : We need error codes for this\n render :json => {:error => \"Error : #{@schedule.errors.first[0]} #{@schedule.errors.first[1]}\",\n :content_type => 'text/plain',\n :status => :unprocessable_entity}\n\n end # end (if @schedule.save)\n\n end # end (if @schedule)\n\n end", "def active?\n schedule.active?\n end", "def unscheduled?\n state == :unscheduled\n end", "def delete_job job_id\n @schedule_list.delete_if {|x| x.id == job_id }\n end", "def task_schedule_status(task)\n\t\tstatus = []\n\tend", "def functional?\n not self.schedules.empty? and self.schedules.first.is_pickup_stop? and self.schedules.last.is_drop_stop?\n end", "def service_with_id_exists?(app, id)\n app = getTableValue(app)\n id = getTableValue(id)\n json = CC.CLI.get_json(\"%{serviced} service list -v\")\n json.each do |service|\n return true if service[\"Name\"] == app && service[\"DeploymentID\"] == id\n end\n return false\n end", "def scheduled? at\n if @previous_start.nil? || (at - at.sec).to_i > (@previous_start - @previous_start.sec).to_i\n s, m, h, day, mon, year, wd = at.to_a\n\n td = Date.new(year, mon, day) # at.to_date # Doesn't work with current JRuby\n wom = ((td - td.day + 1).wday + td.day - 1) / 7 + 1\n last_day = (td + 1).month > td.month\n\n (@schedule[:years].nil? || @schedule[:years].has_key?(year)) &&\n (@schedule[:months].nil? || @schedule[:months].has_key?(mon)) &&\n (@schedule[:weekdays].nil? || [true, wom].include?(@schedule[:weekdays][wd])) &&\n (@schedule[:days].nil? || @schedule[:days].has_key?(day) || (last_day && @schedule[:days].has_key?(-1)) ) &&\n (@schedule[:hours].nil? || @schedule[:hours].has_key?(h)) &&\n (@schedule[:minutes].nil? || @schedule[:minutes].has_key?(m))\n else\n false\n end\n end", "def schedule(guest)\n currentday = Time.now.strftime(\"%A\")\n currenttime = Time.now.strftime(\"%H:%M:%S\")\n\n goodtogo = false\n\n guest.schedules.each do |schentry|\n if schentry.day == currentday && schentry.start_time.strftime(\"%H:%M:%S\") < currenttime && schentry.stop_time.strftime(\"%H:%M:%S\") > currenttime\n goodtogo = true\n end\n end\n\n return goodtogo\n end", "def exists?\n queue_exists?(@name)\n end", "def has_pending?(job, batch)\n sql = \"Select count(*) from #{@schema_name}.job_runs where job_id = '#{job.id}' and batch = '#{batch.to_json}' and ( status = 'queued' or status = 'running' );\"\n r = exec_sql(sql)\n count = r.first[\"count\"].to_i\n count > 0\n end", "def watches?(task_list)\n watched_task_lists.include?(task_list)\n end", "def eop?\n @jobs.empty?\n end", "def executing_job?\n @executing_job == true\n end", "def is_scheduling_enabled\n return @is_scheduling_enabled\n end", "def all_jobs_hve_been_processed?(queue)\n (job_count(queue) == 0) && (working_job_count(queue) <= 1)\n end", "def list; @schedule_lock.synchronize { @schedule.dup } end", "def can_create_schedule?\n kit_schedule = KitSchedule.new\n kit_schedule.current_user = User.current_user\n return kit_schedule.can_create?(self.center_ids)\n end", "def can_schedule?\n conditions.any?\n end", "def running?\n #result = ActiveRecord::Base.connection.execute('SELECT time FROM bus_history ORDER BY time DESC LIMIT 1')\n #if result.first.nil?\n # return false\n #end\n #minutesSinceLastRun = (((Time.now.to_i - DateTime.parse(result.first['time']).to_i).abs)/60).round\n #return minutesSinceLastRun < 5\n\n pidLocation = \"/tmp/gather.pid\"\n\n File.exists?(pidLocation)\nend", "def trigger_condition_met?(_job)\n true\n end", "def check_queue\n # The interesting options hash for our new work query\n check = {\n :deliver_at => {'$lte' => Time.now.utc},\n :result => {'$exists' => false},\n :locked => {'$exists' => false}\n }\n Candygram.queue.find(check).to_a\n end", "def has_pending?\n self.class.job_run_class.has_pending?(@job, @batch)\n end", "def set_db_scheduled_job\n @db_scheduled_job = DbScheduledJob.find(params[:id])\n end", "def create_schedule_conflict(rname,day,stime,etime)\r\n #flag=false\r\n @statuss=Status.find(:all,:conditions => [\"room_name = ? AND schedule_day = ?\",rname,day])\r\n if @statuss\r\n @statuss.each do |s|\r\n if time_conflict(stime,etime,s[\"start_time\"],s[\"end_time\"])\r\n return true\r\n end\r\n end\r\n end\r\n return false\r\n end", "def executable?\n \n # Return false if picked up by another WQ instance\n if id\n old_lock_version = lock_version\n self.reload\n return false if old_lock_version != lock_version\n end\n \n # Return true we can sill be executed\n return WorkerQueue.available_tasks.include?(self) && !completed? && !running? \n end", "def getScheduledJobObjName\r\n\t\t return \"mfiforce__Scheduled_Job__c\"\r\n\t\tend", "def working?\n job_working?\n end", "def job_ended?\n FINAL_JOB_TASK_STATUSES.include?(@task_status)\n end", "def populating?\n self.sidekiq_workers.each do |job_id|\n status = Sidekiq::Status::status(job_id)\n \n if status == :queued || status == :working\n return true\n else # status either :complete, :failed, or nil\n self.sidekiq_workers.delete(job_id)\n self.save\n end\n end\n\n return false\n end", "def job_status_expired?\n if self.expired?\n return true\n else\n return false\n end\n end", "def room_running?(bbb_id)\n bbb_server.is_meeting_running?(bbb_id)\n end", "def exist?(service)\n !service_list[service].nil?\n end", "def rocket_job_restart_new_instance\n return unless cron_schedule\n super\n end", "def rocket_job_restart_new_instance\n return unless cron_schedule\n super\n end", "def startable?\n status.to_sym.in? [:pending]\n end", "def has_job_progress?\n !job_progress_queue.empty?\n end", "def scheduler_agent_job(agent)\n scheduler_agent_jobs.find { |job|\n job.scheduler_agent_id == agent.id\n }\n end", "def completed_task_id?(task_id)\n completed_task_ids.include? task_id\n end", "def service_list_running\n\t\tif session_has_services_depend?\n\t\t\t#meterpreter_service_list_running\n\t\t\tNOTIMP\n\t\telse\n\t\t\tshell_service_list_running\n\t\tend\n\tend", "def run_list?(item)\n run_list.detect { |r| r == item } ? true : false\n end", "def is_scheduled_to_be_off\n offset_to_pdt = -25200\n current_time = Time.now.utc + offset_to_pdt\n current_time_minutes = (current_time.hour * 60) + current_time.min\n self.schedules.each do |schedule|\n return true if (current_time_minutes > schedule.start_time) && (current_time_minutes < schedule.end_time)\n end\n false\n end", "def time_in_schedule?(schedule, time)\n return schedule.occurring_at? time\n end", "def fetch_is_running?\n server = BigbluebuttonRails.configuration.select_server.call(self, :is_meeting_running)\n server.api.is_meeting_running?(self.meetingid)\n end", "def schedule_jobs(job_list)\n Jobbr::Ohm.models(Jobbr::Scheduled).each do |job|\n if job.every\n job_list.every job.every[0], job.every[1] do\n job_list.jobbr job.task_name\n end\n end\n end\n end", "def live?\n (uid && self.class.started_uids.include?(uid)) ? true : false\n end", "def is_job_running_on_host(finished_job_task_status_counters)\n finished_job_task_status_counters.active_count > 0\n end", "def start_periodic_status_check(duration: 600)\n check_status_on_schedule(duration: duration)\n end", "def include?(job)\n jobs.keys.include?(job.key)\n end", "def next_availability\n if job = jobs.detect { |k, v| v['reserved_at'].nil? }\n job.first\n end\n end", "def check_full_schedule\n has_full_schedule = true\n schedules = self.schedules\n schedules.each_with_index do |schedule, index|\n if(index != 0 && index != schedules.length-1)\n #if(schedule[:plan].length == 0 || schedule[:hotel].length == 0)\n if(schedule[:plan].strip.length == 0)\n has_full_schedule = false\n break\n end\n end\n end\n\n return has_full_schedule\n end", "def batch_exist?(id)\n mutex(id) do |bid|\n redis.exists(bid)\n end\n end", "def create\n @scheduler = Scheduler.new(scheduler_params)\n @scheduler.job_id = @job.id\n if @scheduler.scheduler_event_type_id == 5\n @scheduler.check_manager(@job)\n end\n\n respond_to do |format|\n if @scheduler.save\n @job.track 'Scheduler Created', current_user, @scheduler\n format.html { redirect_to job_path(@job), notice: 'Scheduler was successfully created.' }\n format.json { render :show, status: :created, location: @scheduler }\n else\n format.html { redirect_to job_path(@job), errors: @scheduler.errors }\n format.json { render json: @scheduler.errors, status: :unprocessable_entity }\n end\n end\n end", "def before_enqueue_check_lock_availability(*args)\n # Second condition handles the case when the job is already queueing\n # (was allowed to put in queue at the moment of scheduling), and now scheduler moves it\n # from future schedule to queue; if we'll not allow this, job will be lost.\n Resque.inline? || call_from_scheduler? || job_available_for_queueing?(args)\n end" ]
[ "0.67153364", "0.6387039", "0.63815665", "0.63321555", "0.6285404", "0.62040794", "0.6186232", "0.61440206", "0.61372703", "0.61194336", "0.6050787", "0.60322905", "0.5997739", "0.5981781", "0.59495723", "0.5930317", "0.59269184", "0.5874908", "0.5836512", "0.5805794", "0.57474345", "0.57442653", "0.5710191", "0.57067925", "0.5703314", "0.5700266", "0.56452984", "0.56452984", "0.56452984", "0.56368333", "0.5632945", "0.5616526", "0.55995196", "0.55986595", "0.5580228", "0.55568254", "0.5550575", "0.55379385", "0.55281246", "0.55274147", "0.5522957", "0.5515969", "0.55118495", "0.5507327", "0.55064714", "0.54975975", "0.5491054", "0.54751855", "0.5467942", "0.54626447", "0.5426478", "0.54170746", "0.54014266", "0.53945786", "0.53894424", "0.53834116", "0.53806275", "0.5378396", "0.53733593", "0.5370508", "0.5367536", "0.53611696", "0.5357759", "0.5350946", "0.53489023", "0.5344098", "0.5329701", "0.5329048", "0.53241163", "0.53192383", "0.5314153", "0.5311362", "0.52983826", "0.52970207", "0.5292024", "0.529178", "0.5284123", "0.5278062", "0.5276764", "0.5272365", "0.5272365", "0.52721006", "0.5268237", "0.52657884", "0.52629894", "0.526036", "0.52576774", "0.52509886", "0.52413934", "0.5234794", "0.5218421", "0.52174795", "0.5211592", "0.5211427", "0.5208119", "0.52069414", "0.5205343", "0.5204897", "0.5204194", "0.5201264" ]
0.8337974
0
define a fonction for Email et le password.
def send_email_line() #define a variable gmail. gmail = Gmail.connect("email","password") #define a variable email with a loop. email = gmail.deliver do to ws subject "Présentation The hacking poject" html_part do content_type'text/html; charset=UTF8' body send_email_text end end #show email acount loggin. puts gmail.logged_in? #desconnecte after work. gmail.logout end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def email_login\n end", "def email\n login\n end", "def login_valido email, password\n $helper.preencher_web_edit(txt_EmailAddress(), email)\n $helper.preencher_web_edit(txt_Password(), password)\n $helper.clicar_objeto(btn_SigIn())\n end", "def password; end", "def password; end", "def password; end", "def password; end", "def password; end", "def password; end", "def password\n end", "def password\n end", "def password\n\n end", "def email; end", "def email; end", "def email; end", "def email; end", "def edit_password; end", "def email_otp\n end", "def password=(_arg0); end", "def password=(_arg0); end", "def password=(_arg0); end", "def password=(_arg0); end", "def password\n UserMailer.password\n end", "def enter_password\n end", "def email\n end", "def password_field; end", "def enter_password \n\nend", "def password=(should); end", "def public_forgot_password\n end", "def set_password_field(password)\n end", "def valid_password?; end", "def fCheckCredentials (email, pwd)\n @users.checkCredentials(email,pwd)\n end", "def password \n @password \n end", "def standard_password\n \"!@Cd5678\"\n end", "def kirim_email(email=\"default@yahoo.com\", pesan=\"Ini pesan default dari parameter\")\n puts email\n puts pesan\nend", "def restablecer_password\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def password_rest\n UserMailer.password_rest\n end", "def forgot_password_mail\n Accounts.forgot_password_mail\n end", "def forgot_password\n\t\t\n\tend", "def user_password(user)\n\n @user = user\n mail(:to => user.email,\n :subject => \"Your PCB Design Tracker login id and password\",\n :cc => [],\n :bcc => [] #override default\n )\n\n end", "def do_something account, login, password\nend", "def password_required?; end", "def send_password(terapeuta, password)\n @password = password\n @terapeuta = terapeuta\n mail(:to => @terapeuta.email, :subject => \"Bienvenido a BuscoTerapia.cl\") do |format|\n format.html\n end\n end", "def welcome_email(user,password)\n \t@user = user[\"name\"]\n \t@email = user[:email]\n \t@password=password\n \t@url = \"http://localhost:3000/users/sign_in\"\n \tmail(to: @email, subject:\"Login your account\")\n end", "def send_password\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def passwd(*) end", "def passwd(*) end", "def login_correctly\r\n\t\tuserid = \"correct_user@email.com\"\r\n\t\tpassword = \"correct_password\"\r\n\tend", "def password_change\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def account_password\n get_account_password\n end", "def tentarlogar(email, senha)\n campo_email.set email\n campo_senha.set senha\n botao_entrar.click\n end", "def get_password(password)\n password\n end", "def password(config, email, name, password)\r\n\t\t@subject = \"Your new #{config[:application][:name][:value]} password\"\r\n\t\t@recipients = email\r\n\t\t@from = \"#{config[:application][:name][:value]} <#{config[:emails][:password_reset][:value]}>\"\r\n\t\t@sent_on = Time.now\r\n\t\t@body['name'] = name\r\n\t\t@body['password'] = password\r\n\t\t@body['team_name'] = config[:application][:team_name][:value]\r\n\tend", "def send_signup_email(correo, password)\n @pass=password\n #delivery_options = { user_name: \"backinblack83@gmail.com\", password: \"slash123\", address: \"smtp.gmail.com\" }\n mail(to: correo,\n subject: \"Solicitud de contraseña\"\n #, delivery_method_options: delivery_options\n )\n \n \n end", "def change_password\r\n \r\n end", "def forgot_password\n end", "def password_send (user)\n @user = user\n\n mail to: @user.email, subject: 'Sua senha de acesso =D'\n end", "def password\n\t@password\n\tend", "def initialize(email, password) \n\t\t@email = email \n\t\t@password = password \n\t\t#puts\n\tend", "def forgot_password\n\t\tend", "def password(user)\n @user = user\n headers={:to => user.email1,:subject => \"#{CFG['domain']} - Dados\"}\n headers['bcc']=user.email2 if user.email2\n\n mail(headers)\n end", "def password_reset\n #@greeting = \"Pershendetje\"\n\n #mail to: \"to@example.org\"\n end", "def password\n\t\t@password\n\tend", "def password\n\t\t@password\n\tend", "def email; @email; end", "def password\r\n @password\r\n end", "def get_mail\n \n end", "def user_created_mail(user, password)\n @email = user.email\n @password = password\n mail to: @email\n end", "def valid_password?(password); end", "def set_password; nil; end", "def password=(new_password); end", "def email_required?\n not password.nil?\n end", "def password\n@password\nend", "def password\n@password\nend", "def initialize(email, password)\n @email = email\n @password = password\n end", "def initialize(email, password)\n @email = email\n @password = password\n end", "def initialize(email, password)\n @email = email\n @password = password\n end", "def initialize(email, password)\n @email = email\n @password = password\n end", "def initialize(email, password)\n @email = email\n @password = password\n end", "def update_users_password_by_e_mail(args = {}) \n put(\"/users.json/backoffice/email/#{args[:email]}/password/#{args[:password]}\", args)\nend", "def update_users_password_by_e_mail(args = {}) \n put(\"/users.json/backoffice/email/#{args[:email]}/password/#{args[:password]}\", args)\nend", "def enter_password_shared\n end", "def password\n super\n end", "def fetch(password)\r\n end", "def set_functions\n # Login as a given user.\n # @param username [String] The username to use.\n # @return [Boolean] Whether the login process succeeded.\n function(:login) {|as_who = 'ole-khuntley'| raise OLE_QA::Framework::Error,\"Login field not present on this page: #{self.class.name}\" unless login_field.present? ; login_field.set(as_who) ; login_button.click ; if login_confirmation.present? then login_confirmation.text.match(/#{as_who}/) ? true : false else false end}\n # Logout from previous login.\n # @return [Boolean] Whether the logout process succeeded.\n function(:logout) { logout_button.click ; login_confirmation.present? ? false : true}\n end", "def new_password; nil; end", "def check_if_password_and_email_provided!\n\n unless @user_credential_params[:email].blank? || @user_credential_params[:password]\n fail_immediately(:no_email_or_pwd_provided)\n end\n\n end", "def sign_in_with_email\n tap_signin_email_phone_btn\n tap_sign_in_email_btn\n set_email_txtfield(TestData.use_data('credentials', 'verified_email'))\n set_pwd_txtfield(TestData.use_data('credentials', 'verified_password'))\n end", "def password\n @password\n end", "def password\n @password\n end", "def password\n @password\n end", "def password\n @password\n end", "def password\n @password\n end", "def password\n @password\n end", "def password\n @password\n end", "def password\n @password\n end", "def password\n @password\n end", "def password\n @password\n end", "def password\n @password\n end", "def password\n @password\n end", "def password\n @password\n end" ]
[ "0.75093555", "0.70577794", "0.70352787", "0.697476", "0.697476", "0.697476", "0.697476", "0.697476", "0.697476", "0.6838461", "0.6838461", "0.67972976", "0.6744937", "0.6744937", "0.6744937", "0.6744937", "0.6651562", "0.6625391", "0.6613267", "0.6613267", "0.6613267", "0.6613267", "0.6599682", "0.65926087", "0.6547976", "0.6507499", "0.6457798", "0.6377347", "0.63598835", "0.6331439", "0.6323154", "0.62945306", "0.62224406", "0.6211906", "0.6189384", "0.6184396", "0.61774397", "0.6172733", "0.61412203", "0.6139046", "0.61345255", "0.6120847", "0.6120088", "0.6117554", "0.61007714", "0.609318", "0.609318", "0.6089313", "0.6085688", "0.60781735", "0.60683304", "0.6064982", "0.60549057", "0.60519576", "0.6051002", "0.60450435", "0.6030977", "0.602802", "0.6014911", "0.6014287", "0.600966", "0.60082", "0.6001095", "0.6001095", "0.5999964", "0.59903014", "0.5986955", "0.59620005", "0.5960711", "0.59439903", "0.59301174", "0.5926885", "0.59263813", "0.59263813", "0.59225965", "0.59225965", "0.59225965", "0.59225965", "0.59225965", "0.59210646", "0.59210646", "0.5917477", "0.5903206", "0.58976823", "0.5892661", "0.58778495", "0.58746624", "0.58616257", "0.5859389", "0.5859389", "0.5859389", "0.5859389", "0.5859389", "0.5859389", "0.5859389", "0.5859389", "0.5859389", "0.5859389", "0.5859389", "0.5859389", "0.5859389" ]
0.0
-1
define fonction for the texte.
def send_email_text(cities) #text a return return"<h2>Bonjour</h2> <p>Je m'appelle Charles Dacquay, je suis co-fondateur de lorganisme The Hacking Project qui propose une formation de dévelopeur web gratuite, ouverte à tous, sans restriction géographique, ni restriction de niveau.<br> Voici le lien de la formation s'appelle The Hacking Project (http://thehackingproject.org/).<br> la foramtion des baser sur la méthode du peer-learning : les étudiants sont répartie en petit groupes ou nous leur proposons la réaliation de projets concrets qui leur sont assignés chaque jours, sur lesquel ils travaillent et cherches des solution . Le projet du jour est d'envoyer des emails à nos élus locaux pour qu'ils nous aident à faire de The Hacking Project un nouveau format d'éducation gratuite.</p> <p>Nous vous contactons pour vous parler du projet, et vous dire que vous pouvez ouvrir une cellule à #{cities}, où vous pouvez former gratuitement 6 personnes (ou plus), qu'elles soient débutantes, ou confirmées.<br> Le modèle d'éducation de The Hacking Project n'a pas de limite en terme de nombre de moussaillons (c'est comme cela que l'on appelle les élèves), donc nous serions ravis de travailler avec #{cities} !</p> <p>Charles, co-fondateur de The Hacking Project pourra répondre à toutes vos questions : 06.95.46.60.80</p>" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def text text\n end", "def text; end", "def text; end", "def text; end", "def text; end", "def text; end", "def text; end", "def text; end", "def text; end", "def text; end", "def text; end", "def text; end", "def text; end", "def text; end", "def text; end", "def text=(_arg0); end", "def text(*)\n super\n end", "def texts; end", "def add_text(text); end", "def text?; end", "def text?; end", "def text?; end", "def draw_text(*args)\n raise \"not implemented\"\n end", "def text(string); end", "def text(string); end", "def recuperationEtape()\n\t\tstring=@techniqueObjet.etape(@etapeEnCours)\n\t\t@texteContenu.set_text(string)\n\tend", "def recuperationEtape()\n\t\tstring=@techniqueObjet.etape(@etapeEnCours)\n\t\t@texteContenu.set_text(string)\n\tend", "def process_text text, color = \"#000000\"\n end", "def italic; end", "def italic; end", "def tvText _args\n \"tvText _args;\" \n end", "def Text(x, y, txt)\n\t\t#Output a string\n\t\ts=sprintf('BT %.2f %.2f Td (%s) Tj ET', x * @k, (@h-y) * @k, escapetext(txt));\n\t\tif (@underline and (txt!=''))\n\t\t\ts += ' ' + dolinetxt(x, y, txt);\n\t\tend\n\t\tif (@color_flag)\n\t\t\ts='q ' + @text_color + ' ' + s + ' Q';\n\t\tend\n\t\tout(s);\n\tend", "def objfn(txt)\n raise 'not implemented'\n end", "def display_text\n\t\t\t#specifying font to be used\n\t\t\t#text_font @font, 16\n\t\t\t#text \"Mmmmm ... Strings .... \", 10, 100\n\t\tend", "def text_urgent(text); text_green(text);end", "def handle_text(name, attrs)\n \n end", "def text\n #just returns view\n end", "def text_area; end", "def lbText _obj, _args\n \"_obj lbText _args;\" \n end", "def textMethod\n\t\traise \"Ceci est une methode abstraite. This is an abstact method.\";\n\tend", "def text(str); end", "def text_position\n end", "def set_text(text); end", "def lnbText _obj, _args\n \"_obj lnbText _args;\" \n end", "def ajouterTexte(font,texte,couleur,position)\r\n\t\ttexte = GLib.convert(texte, \"ISO-8859-15\", \"UTF-8\") #Conversion de l'UTF8 vers ISO-8859-15\r\n\t\tposition = @justification[position]\r\n\t\t\r\n\t\tr = couleur.red.to_i / 256\r\n\t\tv = couleur.green.to_i / 256\r\n\t\tb = couleur.blue.to_i / 256\r\n\t\t\r\n\t\tvaleur = ((b * 256) + v) * 256 + r\t\r\n\t\t\r\n\t\t\r\n\t\tf = font.split()\r\n\t\t\r\n\t\ttaille = f.pop().to_i\r\n\t\tstylePolice = f.pop() if f.include?(\"Bold\") || f.include?(\"Italic\") || f.include?(\"Bold Italic\")\r\n\t\tpolice = f.join(\" \")\r\n\t\t\r\n\t\ttailleDefaut = taille\r\n\t\t\r\n\t\ttab = []\r\n\t\t\r\n\t\tr = %r{(<big>.*</big>)|(<small>.*</small>)|(<span size=.*>.*</span>)}\r\n\t\ttexte.split(r).each do |c|\r\n\t\t\tif %r{<big>(.*)</big>}.match(c)\r\n\t\t\t\ttexte = $1\r\n\t\t\t\ttaille = tailleDefaut + 2\r\n\t\t\telsif %r{<small>(.*)</small>}.match(c)\r\n\t\t\t\ttexte = $1\r\n\t\t\t\ttaille = tailleDefaut - 2\r\n\t\t\telsif %r{<span size=\\\"(x{1,2})-large\\\">(.*)</span>}.match(c)\r\n\t\t\t\tcase $1\r\n\t\t\t\t\twhen \"x\"\r\n\t\t\t\t\t\ttaille = 22\r\n\t\t\t\t\twhen \"xx\"\r\n\t\t\t\t\t\ttaille = 26\r\n\t\t\t\tend\r\n\t\t\t\ttexte = $2\r\n\t\t\telse\r\n\t\t\t\ttaille = tailleDefaut\r\n\t\t\t\ttexte = c\r\n\t\t\tend\r\n\t\t\ttab << [texte,taille]\r\n\t\tend\r\n\t\r\n\t\tre = %r{(<u>.*</u>)|(<b>.*</b>)|(<i>.*</i>)|(<s>.*</s>)}\r\n\t\ttab.each do |t|\r\n\t\t\tt[0].split(re).each do |d|\r\n\t\t\t\tif %r{<u>(.*)</u>}.match(d)\r\n\t\t\t\t\ts = $1\r\n\t\t\t\t\t@word.Selection.Font.Underline = true\r\n\t\t\t\telsif %r{<b>(.*)</b>}.match(d)\r\n\t\t\t\t\ts = $1\r\n\t\t\t\t\t@word.Selection.Font.Bold = true\r\n\t\t\t\telsif %r{<i>(.*)</i>}.match(d)\r\n\t\t\t\t\ts = $1\r\n\t\t\t\t\t@word.Selection.Font.Italic = true\r\n\t\t\t\telsif %r{<s>(.*)</s>}.match(d)\r\n\t\t\t\t\ts = $1\r\n\t\t\t\t\t@word.Selection.Font.StrikeThrough = true\r\n\t\t\t\telse\r\n\t\t\t\t\ts = d\r\n\t\t\t\t\t@word.Selection.Font.Underline = false\r\n\t\t\t\t\t@word.Selection.Font.Bold = false\r\n\t\t\t\t\t@word.Selection.Font.Italic = false\r\n\t\t\t\t\t@word.Selection.Font.StrikeThrough = false\r\n\t\t\t\tend\r\n\t\t\t\t\r\n\t\t\t\t@word.Selection.Font.Bold = true if stylePolice == \"Bold\" || stylePolice == \"Bold Italic\"\r\n\t\t\t\t@word.Selection.Font.Italic = true if stylePolice == \"Italic\" || stylePolice == \"Bold Italic\"\r\n\t\t\t\t@word.Selection.Font.Name = police\r\n\t\t\t\t@word.Selection.Font.Size = t[1]\r\n\t\t\t\t@word.Selection.Font.Color = valeur\r\n\t\t\t\t@word.Selection.ParagraphFormat.Alignment = position\r\n\t\t\t\t@word.Selection.TypeText(s)\r\n\t\t\t\t\r\n\t\t\tend\r\n\t\tend\r\n\tend", "def text=(text); end", "def triggerText _args\n \"triggerText _args;\" \n end", "def getText _args\n \"getText _args;\" \n end", "def print\n puts \"Mencetak : #{@text}\" \n end", "def text _args\n \"text _args;\" \n end", "def text _args\n \"text _args;\" \n end", "def text(node); end", "def text(node); end", "def paragraph; end", "def send_text\n\nend", "def text= text\n @text = text\n @w,@h = @font.size_text text\n @surface = @font.render_blended text, @color\n render\n @text\n end", "def create_texts\n add_text(TEXT_OX, 0, DELTA_X - TEXT_OX, DELTA_Y, text_get(32, 0)) # Attack !\n add_text(TEXT_OX + DELTA_X, 0, DELTA_X - TEXT_OX, DELTA_Y, text_get(32, 1)) # Bag\n add_text(TEXT_OX, DELTA_Y, DELTA_X - TEXT_OX, DELTA_Y, text_get(32, 2)) # Pokemon\n add_text(TEXT_OX + DELTA_X, DELTA_Y, DELTA_X - TEXT_OX, DELTA_Y, text_get(32, 3)) # Flee\n end", "def Com1\n @type = \"Texte\"\n @commande_window.deactivate\n if console_texte\n @x = 0\n @y = 0\n @commande_window.hide\n @window_command_command = Window_CommandTextSelect.new(@texte,@x,@y)\n @window_command_command.set_handler(:CT1, method(:ComText1))\n @window_command_command.set_handler(:CT2, method(:ComText2))\n @window_command_command.set_handler(:CT3, method(:ComText3))\n @window_command_command.set_handler(:cancel, method(:ComText4))\n @window_command_command.activate\n else\n @commande_window.activate\n end\n end", "def sentence; end", "def normal_line(text)\n end", "def text(text_input_handle)\n end", "def add_text! (text, xoff, yoff, width, height, font, size, html_color, align=:left)\n color = Color::RGB.from_html(html_color)\n cmd = (align == :center) ? \"ZC\" : \"ZA\"\n parts = [URI.escape(text), xoff, yoff, width, height, font, size].map {|x| x.to_s} +\n [color.r, color.g, color.b].map {|c| (c*255).to_i }\n cmd << parts.join(\",\")\n @transforms << cmd\n self\n end", "def text(*args)\n if args.size.zero?\n @text = ''\n else\n @text = args.first\n end\n end", "def text(*args)\n if args.size.zero?\n @text = ''\n else\n @text = args.first\n end\n end", "def e_words(str)\r\n \r\nend", "def h(text); end", "def h(text); end", "def retornar_text_prazo\n text_prazo.greenify\n text_prazo.text\n end", "def draw_text_cs(x, y, w, h, t, a = 0)\r\n original_color = self.font.color.clone\r\n self.font.color = Color.new(0,0,0,100)\r\n draw_text(x + 2, y + 2, w, h, t, a)\r\n self.font.color = original_color\r\n draw_text(x, y, w, h, t, a) \r\n end", "def textMethod\n\t\tif(@step == nil)\n\t\t\tstatutMethod(false)\n\t\t\t@step = 0\n\t\t\t@type = \"textMethod\"\n\t\t\tSudokuAPI.API.assistantMessage=(\"Dans le cas où un candidat est unique dans une unité, on peut en\\ndéduire que la case où il est présent contient bien ce candidat car\\nil ne peut être nul part ailleurs. (Appuyez sur Suivant)\")\n\t\telsif(@step == 1)\n\t\t\tSudokuAPI.API.assistantMessage=(\"Bonjour, je suis l'assistant, je suis là pour vous aider\")\n\t\t\tstatutMethod(false)\n\t\tend\n\t\t@step+=1\n\tend", "def lnbSetText _args\n \"lnbSetText _args;\" \n end", "def text=(text)\n\t\tend", "def bold; end", "def bold; end", "def bold(*args); end", "def gritar(texto = \"Ahhhh\")\n\t\ttexto\n\tend", "def text\n \"STRAT\"\n end", "def text(text)\n @text = text\n end", "def w texte\n STDOUT.write \"<p>#{texte}</p>\"\nend", "def visit_Text(text, *rest)\n end", "def show_text_popup\n draw_icon(@icona,0,0)\n @icona == 0 ? d = 0 : d = 24\n self.contents.font.name = H87_Popup::FontName\n self.contents.font.size = H87_Popup::FontSize\n self.contents.font.outline = H87_Popup::FontOutline\n text = convert_escape_characters(@testo)\n text.gsub!(/\\eC\\[(\\d+)\\]/i,\"\")\n self.contents.draw_text(d,0,self.width-(self.padding*2)-d,line_height,text)\n end", "def text(_content)\n raise NotImplementedError\n end", "def set_text\n @text_field.text = @str\n @formats.each do |start, n, style|\n case style\n when FoxTextFormatter::STYLE_BOLD\n @text_field.changeStyle(start, n, 2)\n when FoxTextFormatter::STYLE_H1\n @text_field.changeStyle(start, n, 3)\n when FoxTextFormatter::STYLE_H2\n @text_field.changeStyle(start, n, 4)\n when FoxTextFormatter::STYLE_H3\n @text_field.changeStyle(start, n, 5)\n when FoxTextFormatter::STYLE_TELETYPE\n @text_field.changeStyle(start, n, 6)\n when FoxTextFormatter::STYLE_CODE\n @text_field.changeStyle(start, n, 7)\n when FoxTextFormatter::STYLE_EMPHASIS\n @text_field.changeStyle(start, n, 8)\n when FoxTextFormatter::STYLE_CLASS\n @text_field.changeStyle(start, n, 9)\n else\n @text_field.changeStyle(start, n, 1)\n end\n\n end\n end", "def WFSideText _args\n \"WFSideText _args;\" \n end", "def setText _obj, _args\n \"_obj setText _args;\" \n end", "def new_text=(value)\n @new_text = value\n end", "def drawText(x,y,text,fontSize = 14, fontFamily = :times, color = \"black\") \n @device.drawText(x,y,text,fontSize, fontFamily, color) ;\n end", "def text(txt=\"A\", x=0, y=0)\n txt = txt.to_s unless txt.kind_of?(String)\n if @registration == :center\n width = textwidth(txt)\n x = x - width / 2\n y = y + @fsize / 2\n end\n CGContextShowTextAtPoint(@ctx, x, y, txt, txt.length)\n end", "def display_text word\n raise \"word should be string\" unless word.is_a? String\n w = @form.by_name[\"tv\"]; \n lines = get_data word\n #file = `ri -f bs #{word}`\n #lines = convert_man_to_ansi file\n return if lines.nil? || lines.size == 0\n # ansi can have overflow\n w.add_content(lines, :content_type => :ansi, :title => word)\n\n # Since i am trying without border, so need to put class on top right\n header = @form.by_name[\"header\"]; \n header.text_right(word)\n\n $visited << word unless $visited.index(word)\n #w.add_content(lines, :title => word)\n w.buffer_last\nend", "def new_text_input\n end", "def text text\n \n text = text.strip\n GRES_CGMLDebugger.writedebugstring(\"GRES_CityGMLParser: text of CityGMLParser current tag ist \" + @currenttag + \"and text is _\" + text + \"_\\n\")\n if(text == \"\")\n return\n end\n if((@currenttag == \"gml:pos\" or @currenttag == \"gml:posList\") and @translX == 0)\n coords = text.split(\" \")\n @translX = coords[0].to_f\n @translY = coords[1].to_f\n @translZ = coords[2].to_f\n GRES_CGMLDebugger.writedebugstring(\"GRES_CityGMLParser: found Position, init Translation \" + @translX.to_s + \" \" + @translY.to_s + \" \" + @translZ.to_s + \"\\n\")\n\n end\n if(@isInSubhandler == true and @currentObjectParser != nil)\n @currentObjectParser.text(text)\n return\n end\n if(@isInAppSubHandler == true and @currentAppearanceParser != nil)\n @currentAppearanceParser.text(text)\n return\n end\n\n\n end", "def text_input; end", "def get_text\n raise NotImplementedError\n end", "def text(*args)\n Text.new(self, *args)\n end", "def\n \nend\n\n\n# 6. sentence_maker refactored solution", "def ctrlText _args\n \"ctrlText _args;\" \n end", "def add_text(x, y, text, size = nil, angle = 0, word_space_adjust = 0)\n if text.kind_of?(Numeric) and size.kind_of?(String)\n text, size = size, text\n warn PDF::Writer::Lang[:add_text_parameters_reversed] % caller[0]\n end\n\n if size.nil? or size <= 0\n size = @font_size\n end\n\n select_font(\"Helvetica\") if @fonts.empty?\n\n text = text.to_s\n\n # If there are any open callbacks, then they should be called, to show\n # the start of the line\n @callbacks.reverse_each do |ii|\n info = ii.dup\n info[:x] = x\n info[:y] = y\n info[:angle] = angle\n info[:status] = :start_line\n\n info[:tag][self, info]\n end\n if angle == 0\n add_content(\"\\nBT %.3f %.3f Td\" % [x, y])\n else\n rad = PDF::Math.deg2rad(angle)\n tt = \"\\nBT %.3f %.3f %.3f %.3f %.3f %.3f Tm\"\n tt = tt % [ Math.cos(rad), Math.sin(rad), -Math.sin(rad), Math.cos(rad), x, y ]\n add_content(tt)\n end\n\n if (word_space_adjust != 0) or not ((@word_space_adjust.nil?) and (@word_space_adjust != word_space_adjust))\n @word_space_adjust = word_space_adjust\n add_content(\" %.3f Tw\" % word_space_adjust)\n end\n\n pos = -1\n start = 0\n loop do\n pos += 1\n break if pos == text.size\n font_change = true\n tag_size, text, font_change = quick_text_tags(text, pos, font_change)\n\n if tag_size != 0\n if pos > start\n part = text[start, pos - start]\n tt = \" /F#{find_font(@current_font).font_id}\"\n tt << \" %.1f Tf %d Tr\" % [ size, @current_text_render_style ]\n tt << \" (#{PDF::Writer.escape(part)}) Tj\"\n add_content(tt)\n end\n\n if font_change\n current_font!\n else\n add_content(\" ET\")\n xp = x\n yp = y\n tag_size, text, font_change, xp, yp = text_tags(text, pos, font_change, true, xp, yp, size, angle, word_space_adjust)\n\n # Restart the text object\n if angle.zero?\n add_content(\"\\nBT %.3f %.3f Td\" % [xp, yp])\n else\n rad = PDF::Math.deg2rad(angle)\n tt = \"\\nBT %.3f %.3f %.3f %.3f %.3f %.3f Tm\"\n tt = tt % [ Math.cos(rad), Math.sin(rad), -Math.sin(rad), Math.cos(rad), xp, yp ]\n add_content(tt)\n end\n\n if (word_space_adjust != 0) or (word_space_adjust != @word_space_adjust)\n @word_space_adjust = word_space_adjust\n add_content(\" %.3f Tw\" % [word_space_adjust])\n end\n end\n\n pos += tag_size - 1\n start = pos + 1\n end\n end\n\n if start < text.size\n part = text[start..-1]\n\n tt = \" /F#{find_font(@current_font).font_id}\"\n tt << \" %.1f Tf %d Tr\" % [ size, @current_text_render_style ]\n tt << \" (#{PDF::Writer.escape(part)}) Tj\"\n add_content(tt)\n end\n add_content(\" ET\")\n\n # XXX: Experimental fix.\n @callbacks.reverse_each do |ii|\n info = ii.dup\n info[:x] = x\n info[:y] = y\n info[:angle] = angle\n info[:status] = :end_line\n info[:tag][self, info]\n end\n end", "def insert_text\n self.frame(:id=>\"elm1_ifr\").body(:id=>\"tinymce\").fire_event(\"onclick\")\n end", "def inqtext(x, y, string)\n inquiry [{ double: 4 }, { double: 4 }] do |tbx, tby|\n super(x, y, string, tbx, tby)\n end\n end", "def markerText _args\n \"markerText _args;\" \n end", "def has_text?; end" ]
[ "0.7315133", "0.6906378", "0.6906378", "0.6906378", "0.6906378", "0.6906378", "0.6906378", "0.6906378", "0.6906378", "0.6906378", "0.6906378", "0.6906378", "0.6906378", "0.6906378", "0.6906378", "0.67930114", "0.6764332", "0.66713053", "0.65442693", "0.6533853", "0.6533853", "0.6533853", "0.65093744", "0.65005463", "0.65005463", "0.6430622", "0.6430622", "0.6397678", "0.63826853", "0.63826853", "0.6368849", "0.6368802", "0.6276975", "0.62764686", "0.62699527", "0.6267133", "0.62506354", "0.624779", "0.62404156", "0.62390816", "0.6238034", "0.62136865", "0.619994", "0.6175309", "0.6138894", "0.61369884", "0.6130051", "0.6128216", "0.61189455", "0.6082996", "0.6082996", "0.60670435", "0.60670435", "0.6061763", "0.6055642", "0.6051542", "0.6037094", "0.6028183", "0.60274476", "0.59994984", "0.59964716", "0.59914225", "0.59843755", "0.59843755", "0.5973168", "0.5955303", "0.5955303", "0.5947832", "0.5944745", "0.593878", "0.59324867", "0.5920762", "0.59204006", "0.59204006", "0.59185344", "0.5896548", "0.5892212", "0.5879437", "0.5873455", "0.5864635", "0.58569276", "0.58437043", "0.5840639", "0.5840018", "0.5822863", "0.5812893", "0.58042234", "0.58016723", "0.58012605", "0.57975477", "0.5795097", "0.57799405", "0.57712656", "0.5758622", "0.57432526", "0.5742589", "0.57307756", "0.5717047", "0.5713932", "0.57129705", "0.5705567" ]
0.0
-1
define a fonction email list
def list_email() session = GoogleDrive::Session.from_config("config.json") ws = session.spreadsheet_by_key("1v7XEnpGDtgjgRom3bp7OwzaK99zlUQIfKuW3QdawXBc").worksheets[0] #define a lopp with each for the spreadsheet. (1..w_sheet.num_rows).each do |list| mail = ws[list, 2] city = ws[list, 1] list_email("email","password",mail, city) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def email_list\n end", "def email_list\n @entries.collect do |line|\n name, email = line.split(\",\")\n format_email_address name, email.chomp\n end.join(\", \")\n end", "def mail_list\n str =\"\"\n self.users.each do |person|\n str << \"#{person.login} <#{person.email}> \\n\"\n end\n str\n end", "def getEmailList()\n emailListFile = File.dirname(File.dirname(__FILE__)) + \"/config/\" +\n \"email_recepients.txt\"\n lines = IO.readlines(emailListFile)\n\n lines.each do |line|\n if line.match(/^EMAIL_RESULTS/)\n temp = line.gsub(/EMAIL_RESULTS=/, \"\")\n temp.strip!\n @resultRecepients = temp.split(\",\")\n elsif line.match(/^EMAIL_ERRORS/)\n temp = line.gsub(/EMAIL_ERRORS=/, \"\")\n temp.strip!\n @errorRecepients = temp.split(\",\") \n elsif line.match(/^EMAIL_CAPTURE/)\n temp = line.gsub(/EMAIL_CAPTURE=/, \"\")\n temp.strip!\n @captureRecepients = temp.split(\",\") \n end\n end\n end", "def add_to_email_list(emails = \"\", email_to_add = \"\")\n if emails.class == String\n emails << \", #{email_to_add}\"\n elsif emails.class == Array\n emails << email_to_add\n end\n emails\n end", "def index\n @mailing_lists = MailingList.all\n @email = @mailing_lists.collect(&:email).join(\"; \")\n end", "def importing_update( email_list )\n @failed_registrations = FailedRegistration.all \n # email_list.each do | email | \n mail( :to => email_list, \n :subject => \"potoSchool | Tarumanegara Failed Registration #{Time.now}\" )\n # end\n end", "def get_email_list\n return get_townhall_list_and_url.map{|town, url| {town => get_townhall_email(url)}}\n end", "def email_list\n self.readers.map do |reader_instance|\n reader_instance.email\n end.join(\";\")\n end", "def add_email(e)\n emails << e\n end", "def getEmailList\n\t\tdata = index()\n\t\temailList = []\n\t\tdata.each do |person|\n\t\t\temailList.push(\"#{person[\"email_address\"]}\")\n\t\tend\n\t\treturn emailList\n\tend", "def admin_1099_received_list\n %w( tt_1099_received_list@booktrope.com )\n end", "def emails\n email.split(/[, ]/)\n end", "def list\n @mailing_list.contacts(limit: 10000).map{|contact| contact.email}\n end", "def recipient_list(r)\n @recipients = []\n @failed_recipients = []\n r.gsub(\",\", \" \").split(\" \").each do |a|\n a.strip!\n if valid_email(a)\n @recipients << a\n else\n @failed_recipients << a\n end\n end\n end", "def generateSubmitterMailList()\n\tsubmitter_map = {}\n\t# Handle duplicate users\n\t@submit_changes.each do |item|\n\t\tsubmitter_map[item.user_id] = item.user_email\n\tend\n\temail_to = \"\"\n\tsubmitter_map.each do |user_id, user_email|\n\t\temail_to = \"#{user_email}, #{email_to}\"\n\tend\n\t#Remove if exist\n\tif (File.exists?(\"email_to.txt\")) then\n\t\tFile.delete(\"email_to.txt\")\n\tend\n\tFile.open(\"email_to.txt\", File::WRONLY|File::CREAT) { |f|\n\t\tf.puts email_to\n\t}\nend", "def all_email(email)\n content = \"\"\n address = email\n Membership.where(email: email).each do |membership|\n Task.where(group_id: membership.group_id).each do |task|\n content << \"#{task.title}\\n\"\n end\n Subtask.where(group_id: membership.group_id).each do |subtask|\n content << \"#{subtask.task.title}: #{subtask.title}\\n\"\n end\n end\n unless content.empty?\n mail(to: address, subject: \"Your Tasks\", body: content)\n end\n end", "def get_emails(emails,incidente)\n return ['informatica@botica.com.py'] if RAILS_ENV.include?'development'\n area_id=incidente.funcionario.cargo.area_id\n cargo_ids=Cargo.find(:all,:select=>'id',:conditions=>{:area_id=>area_id,:recibe_mails_hechos=>true}).map(&:id)\n mails1=Usuario.activos.find(:all,:select=>'email',:conditions=>{:cargo_id=>cargo_ids}).map(&:email)\n mails2=case true\n when (!emails[:parametro].blank? and !emails[:direcciones].blank?)\n Parametro.destinatarios(emails[:parametro]).concat(emails[:direcciones]).uniq\n when !emails[:parametro].blank?\n Parametro.destinatarios(emails[:parametro])\n when !emails[:direcciones].blank?\n emails[:direcciones].uniq \n else\n [\"no-responder@botica.com.py\"]\n end\n mails1.concat(mails2).uniq\n end", "def email; end", "def email; end", "def email; end", "def email; end", "def user_email_list\n @email_list = []\n\n EmailList.all.each do |email|\n if email.creator_id == current_user.id\n @email_list << email \n end\n end\n @email_list\n end", "def fNotificationListFrom (email)\n @users.notificationListFrom(email)\n end", "def get_emails\n emails = [self.email1, self.email2, self.email3]\n emails.compact!\n emails.delete('')\n return emails\n end", "def proms_mailing_list_email\n \"#{gadz_tabagns}#{gadz_ans}@gadz.org\"\n end", "def mailing\n gb = Gibbon.new\n @lists = Hash.new\n for i in 1..gb.lists['total'] do\n list_id = gb.lists['data'][i - 1]['id']\n name = gb.lists['data'][i - 1]['name']\n @lists[name] = []\n members = gb.list_members({:id => list_id})\n members['data'].map { |m| @lists[name].push(m['email']) }\n end\n end", "def emails\n self[\"gd$email\"] ? self[\"gd$email\"].map { |e| e.address } : []\n end", "def build_email(user, list, todo)\n {\n :from => user.email,\n :to => list.title,\n :subject => todo.title,\n :text => todo.description\n }\n end", "def legal_emails\n %w[stmm.confirmation@kristoffs.com\n stmm.confirmationa@aol.com\n paul@kristoffs.com\n paul.kristoff@kristoffs.com\n retail@kristoffs.com\n justfaith@kristoffs.com\n financial@kristoffs.com]\n end", "def emails(text)\n scan(text, EMAIL, :email)\n end", "def get_mail\n \n end", "def jobs_notifier(email_list)\n @listed_jobs = JobPosting.where(created_at: (Time.now.midnight-5.days)..(Time.now))\n @greeting = \"Hi\"\n headers['X-SMTPAPI'] = { :to => email_list.to_a }.to_json\n mail(\n :to => \"info@ourcompany.com\",\n :subject => \"New Job Posted!\"\n )\n \n end", "def emails\n Array(@emails)\n end", "def member_emails\n ASF::Member.emails(members_txt)\n end", "def email_addresses\n emails.map(&:address)\n end", "def complete_email_list\n #Email.select(:email).map{|email_record| email_record.email}\n User.all.map(&:email)\n end", "def staff\n [\n \"jessicacroysdale@yahoo.com\", \n \"margynewton@comcast.net\", \n \"brantallen@earthlink.net\", \n \"ksunmark@yahoo.com\", \n \"gorakr@comcast.net\", \n \"lhpilcher@frontier.com\", \n \"mmr@brantallen.com\", \n \"manbeardo@gmail.com\", \n \"jcermak53@gmail.com\"\n ]\nend", "def staff\n [\n \"jessicacroysdale@yahoo.com\", \n \"margynewton@comcast.net\", \n \"brantallen@earthlink.net\", \n \"ksunmark@yahoo.com\", \n \"gorakr@comcast.net\", \n \"lhpilcher@frontier.com\", \n \"mmr@brantallen.com\", \n \"manbeardo@gmail.com\", \n \"jcermak53@gmail.com\"\n ]\nend", "def get_email_list(email)\n mail_list_array = []\n response = get_emails(email)\n if !response.blank?\n json_body = JSON.parse(response.body)\n if !json_body[\"items\"].blank?\n Rails.logger.info \"Total Emails: #{json_body[\"items\"].count}\"\n json_body[\"items\"].each do |item|\n Rails.logger.info \"Subject: #{item['message']['headers']['subject']}\"\n Rails.logger.info \"Storage Url: #{item['storage']['url']}\"\n mail_list_array.push(item['storage']['url'])\n end\n end\n end\n mail_list_array\n end", "def admin_final_cover_approval_list\n %w( tt_final_cover_approval_list@booktrope.com )\n end", "def contacts_gmail_email(contacts)\n @hash_contactos = Hash.new\n \t\t@contact_email = []\n contacts.each {|lista|\n lista.each {|key,value|\n if (key == :email)\n @contact_email << value\n end\n }\n }\n return @contact_email\n\tend", "def town_mail\n\turl_array = get_townhall_urls \n\t url_array.each do |townhall_url| #/ pour chaque URL d'une ville du Val d'Oise, on associe l'adresse mail de la mairie\n\tget_townhall_email(townhall_url)\n\tend\nend", "def maillist_prod\n maillist_parse(maillist_prod_file)\n end", "def set_email(email, vars = {}, lists = {}, templates = {})\n data = {:email => email}\n data[:vars] = vars unless vars.empty?\n data[:lists] = lists unless lists.empty?\n data[:templates] = templates unless templates.empty?\n self.api_post(:email, data)\n end", "def email_all\n wc = Incoming::Workcamp.find(params[:id])\n addresses = wc.participants.map { |p| p.organization.email.to_s.strip }\n redirect_to \"mailto:#{addresses.join(',')}\"\n end", "def get_all_email\r\n\turl_array = get_townhall_urls #définir une array équivalente au résultat de la méthode qui a permis de créer l'array\r\n\turl_array.each do |townhall_url| \r\n\t\tget_townhall_email(townhall_url) # pour chaque URL d'une ville du Val d'Oise, on associe l'adresse mail de la mairie via la méthode get_townhall_email\r\n\tend\r\nend", "def initialize_emails\n @emails = MailingList.first.emails\n end", "def new_message(obj)\n @obj = obj\n @admin_recipients = User.role_users(:admin).map(&:email)\n @author_recipients = User.role_users(:author).map(&:email)\n @recipients = @admin_recipients\n emails = @recipients.join(\",\")\n m = [\"pr.cr_pmcbl@hotmail.com\",\"rhcsa2012@gmail.com\",\"dilokvilas@gmail.com\",\"natthaphon.v@pmcblueline.com\",\"prajak.o@pmcblueline.com\",\"chayant.m@hotmail.com\",\"thinrachwansa@hotmail.com\",\"naruemit.k@gmail.com\"].join(\",\")\n mail to: m\n end", "def add_new_contacts(emails)\n\t\t@list_email = []\n\t\temails.each {|email|\n\t\t\t@list_email << email if !already_exits?(email)\n\t\t}\n\t\treturn @list_email\n\tend", "def email\n @email ||= select { |type,value| type == :email }.map do |(type,value)|\n value\n end\n end", "def recipient_list(workgroup)\n list = Array.new\n wrkgrpusrs = WorkgroupUser.find(:all, :conditions => {:workgroup_id => workgroup})\n wrkgrpusrs.each do |usr|\n s = User.find(:first, :conditions => {:id => usr.user_id})\n list << s.email unless s.email.nil? || s.email == \"\"\n end\n if list.length < 1\n list << \"blank@example\" #duct-tape-uber-hack an empty array of recipients breaks the mailer and cause the referral to not be sent...\n end\n return list\n end", "def set_email_list\n @email_list = EmailList.find(params[:id])\n end", "def email\n end", "def admin_proofread_final_manuscript_list\n %w( tt_proofed_manuscript_list@booktrope.com )\n end", "def email(text_array)\n email = nil\n text_array.each do |t|\n if t.match(/.{1,}[@].{1,}[.].{1,}/)\n email = t\n end\n end\n return email\nend", "def list_test_dispatch(list)\n list.subscribers.each do |subscriber|\n mail(\n :to => \"#{subscriber.name} <#{subscriber.email}>\",\n :subject => \"[#{list.name}] Test Mailing\",\n :date => Time.zone.now\n )\n end\n end", "def subscribe_to_lists(list_names, email)\n walk_recipients(list_names, email) do |lr, list_id, contact_id|\n if lr.nil?\n ::Mailjet::Listrecipient.create(list_id: list_id, contact_id: contact_id, is_unsubscribed: 'false')\n elsif lr.is_unsubscribed\n lr.update_attributes(is_unsubscribed: 'false', unsubscribed_at: nil)\n end\n end\n rescue ::Mailjet::ApiError\n # ignore\n end", "def recipients\n notified_users.collect(&:mail)\n end", "def add_email_addresses!(list_of_email_addresses)\n email_addresses = Expect.normalize_string_to_array(list_of_email_addresses)\n \n email_addresses.each do |email_address|\n add_email_address!(email_address)\n end\n end", "def convert_email\n %w[paul@kristoffs.com paul.kristoff@kristoffs.com retail@kristoffs.com justfaith@kristoffs.com financial@kristoffs.com]\n end", "def article_email( title, author, content )\n @user_emails = []\n @users = User.all\n @users.each do |user|\n if user.newletter\n @user_emails << user.email\n end\n\n end\n\n @user_emails.each do |user_email|\n @greeting = \"Newest Article: #{title}\n By: #{author},\n\n #{content}\n \"\n\n mail to: user_email, bcc: \"dave.jones@scc.spokane.edu\", subject: title\n end\n\n end", "def all_without_email\n\n end", "def participants_email_list(exclude_email=nil)\n participants(exclude_email).collect{ |p| \"#{p[0]} <#{p[1]}>\" }.join(\", \")\n end", "def email_ids\n []\n end", "def email_addresses\n begin\n @email_addresses ||= xmlrpc_client.call(\"list_emails\", session_id)\n rescue Timeout::Error => e\n raise \"Error during connection. Please try again later.\" \n end\n end", "def get_email(dpt, url)\n mairies = []\n tab_link = get_all_the_urls_of_mairie(url)# appel de la methode pour les urls\n i = 0\n tab_link.each do \n |link|\n mairie = Nokogiri::HTML(open(link)).css('main h1')[0].text.split(\" \")[0] # On scrap le nom\n # On push le tout dans mairies\n mairies.push({\n :name => mairie,\n :email => get_the_email_of_a_townhal_from_its_webpage(link),\n :departement => dpt\n })\n \n puts mairies\n end\n puts \"#################################################################################################\"\n puts \" RESULTAT\"\n puts \"#################################################################################################\"\n mairies\nend", "def add_to_allowed_list(email)\n send_contact_command email, 'ADL', '2'\n end", "def initialize(emails) # accepts strings of unformatted emails (sting of multiple emails )\n @emails = emails # set the instance varibale email to the value for emails passed in arguement\n end", "def inbound_email; end", "def inbound_email; end", "def admin_approve_cover_art_list\n %w( tt_approve_cover_art_list@booktrope.com )\n end", "def auto_link_email_addresses(text)\n text.gsub(/([\\w\\.!#\\$%\\-+.]+@[A-Za-z0-9\\-]+(\\.[A-Za-z0-9\\-]+)+)/) do\n text = $1\n text = yield(text) if block_given?\n mail_to $1, text, :encode => \"javascript\"\n end\n end", "def notifyRecipients (statusMsgAddress, statusMsgPassword, recipientList, downTitle, downMessage)\n recipientList.length.times do |i|\n msg = \"Subject: #{downTitle}\\n\\n#{downMessage}\"\n smtp = Net::SMTP.new 'smtp.gmail.com', 587\n smtp.enable_starttls\n smtp.start(\"gmail\", statusMsgAddress, statusMsgPassword, :login) do\n smtp.send_message(msg, statusMsgAddress, recipientList[i])\n end\n end\nend", "def parse\n emails = @email_list.scan(/\\w+@\\w+.\\w+/)\n emails.uniq\n end", "def maillist_parse(file)\n maillist = []\n\n # if file doesn't exist, just return empty array, otherwise, parse for emails\n if File.exist?(file)\n File.readlines(file).each do |line|\n if index = (line =~ /\\#/)\n # line contains some kind of comment\n # check if there is any useful info, ignore it not\n unless line[0, index].strip.empty?\n maillist << Origen::Users::User.new(line[0, index].strip).email\n end\n else\n # if line is not empty, generate an email\n unless line.strip.empty?\n maillist << Origen::Users::User.new(line.strip).email\n end\n end\n end\n end\n maillist\n end", "def recipients_list\n to.split(/\\s*,\\s*/)\n end", "def list\n perform_request(Entities::MarketingEmail, 'newsletter/list.json')\n end", "def email_addresses\n\t\treturn [self]\n\tend", "def list_by_email(email)\n params = Hash.new\n params[:email] = email\n self.list(params)\n end", "def curator_list\n users.map(&:email)\n end", "def refresh_mailing_list\n emails = MassEmail.all.map{|m|m.email_address}\n File.open(File.join(Rails.root, 'config', 'mailing_list.txt')).each_line do |e|\n e = e.chomp\n unless emails.include?(e)\n url_code = new_random_url_code\n m = MassEmail.new(email_address: e, url_code: url_code)\n m.save!\n end\n end\n\n emails = MassEmail.all.map{|m|m.email_address}\n User.all.map{|u| u.email}.each do |e| \n unless emails.include?(e)\n url_code = new_random_url_code\n m = MassEmail.new(email_address: e, url_code: url_code)\n m.save!\n end\n end\nend", "def refresh_mailing_list\n emails = MassEmail.all.map{|m|m.email_address}\n File.open(File.join(Rails.root, 'config', 'mailing_list.txt')).each_line do |e|\n e = e.chomp\n unless emails.include?(e)\n url_code = new_random_url_code\n m = MassEmail.new(email_address: e, url_code: url_code)\n m.save!\n end\n end\n\n emails = MassEmail.all.map{|m|m.email_address}\n User.all.map{|u| u.email}.each do |e| \n unless emails.include?(e)\n url_code = new_random_url_code\n m = MassEmail.new(email_address: e, url_code: url_code)\n m.save!\n end\n end\nend", "def invite_by_email\n\n @errors = ''\n emails = params[:emails].split(',')\n servicelisting = Servicelisting.find(params[:servicelisting_id])\n no_of_guests = servicelisting.no_of_guests.to_i\n invites = GuestList.where(:user_id => current_user.id, :product => params[:order_id])\n\n if(invites.size + emails.size <= no_of_guests)\n emails.each do |email|\n guest_list = GuestList.new({\n :email => email.strip,\n :user_id => current_user.id,\n :product => params[:order_id]\n })\n\n if guest_list.save\n Notifier.invite_friend_party(guest_list.email, params[:subject], params[:message], current_user.email).deliver\n end\n end\n else\n @errors = \"You can only invite #{no_of_guests} friends.\"\n end\n\n respond_to do |format|\n format.js\n end\n end", "def get_email (ville_names)\n\n # Loop on each cities in the array to get the email\n for n in 0...ville_names.length\n\n # get each link to the depute\n page_url_ville = \"https://www.annuaire-des-mairies.com/95/#{ville_names[n]}.html\"\n\n ville_page = Nokogiri::HTML(open(page_url_ville))\n\n # If any bug when trying to get any email\n begin\n\n # Put each email in an array \"ville_email_array\"\n @ville_email_array << ville_page.xpath(\"//html/body/div/main/section[2]/div/table/tbody/tr[4]/td[2]/text()\").to_s\n rescue => e\n\n @ville_email_array << \" \"\n end\n end\n\n # This value as to be returned.\n # If not this not show email in the json file for the function save_as_json\n return @ville_email_array\n end", "def email_projects\n\n myemails = Array.new\n params[:project_check_all].split(\",\").map do |can_id|\n if can_id == 'on' \n \t\t next\n\t \t end\n @contact = Contact.find(:first,:conditions => [\"id LIKE ?\",can_id.to_i] )\n myemails.push(@contact.email)\n end\n @email_projects = Array.new\n params[:mailed_projects].split(\",\").map do |id|\n @email_projects << ProjectType.find_by_id(id)\n end\n emails = myemails.join(\",\") if myemails.any?\n StatusMailer.email_project_transactions(@email_projects,emails,params[:msg]).deliver\n render :partial => \"success\", :layout => false\n\nend", "def sendemailtoattendees\n \t@users = User.where(:role_id => Role.find_by_title(:attendee))\n \t@sub = params[:emailbody]\n\n @array = []\n\n @users.each do |u|\n @getname = @sub.sub(\"@@Name@@\", \"#{u.first_name} #{u.last_name}\" )\n @array << @getname\n UserMailer.delay.attendee_mail(u, @getname)\n end\n #render :text => @array.to_json\n respond_to do |format|\n \tformat.js\n end\n\n\n end", "def admin_edited_manuscript_list\n %w( tt_edited_manuscript_list@booktrope.com )\n end", "def initialize(emails = [])\n @personal = []\n @issues = []\n @projects = []\n @ucern = []\n emails.each do |email|\n personal = true\n if issue_email?(email)\n @issues << email\n personal = false\n end\n if project_email?(email)\n @projects << email\n personal = false\n end\n if ucern_email?(email)\n @ucern << email\n personal = false\n end\n if personal\n @personal << email\n end\n end\n end", "def order_recieved(order)\n @order = order\n\n emails = []\n Admin.find_all_by_receive_emails(true).each do |a|\n emails << a.email\n end\n\n mail :to => emails, :subject => \"venki-spb.ru Новый заказ\"\n end", "def email_sub(emails)\n subs = self.config[:sub]\n if subs.nil? || subs.empty?\n emails\n else\n emails.map do |email|\n # Apply substitutions to and return a copy of the email\n email_sub = email.slice(0..-1)\n subs.each { |sub| email_sub.gsub!(sub[0], sub[1]) }\n email_sub\n end\n end\n end", "def address_list_for(emails, retried = false)\n emails = emails * \", \"\n list = Mail::AddressList.new(self.class.unescape(emails))\n addrs = list.addresses.each { |a| a.decoded }\n addrs.uniq!\n addrs\n rescue Mail::Field::ParseError\n if retried\n raise\n else\n address_list_for(emails.scan(EMAIL_REGEX), true)\n end\n end", "def admin_accept_team_member_list\n %w( tt_accept_team_member_list@booktrope.com )\n end", "def build_user_emails_for_edit\n @edit[:user_emails] = {}\n to_email = @edit[:new][:email][:to] || []\n users_in_current_groups = User.with_groups(User.current_user.miq_groups).distinct.sort_by { |u| u.name.downcase }\n users_in_current_groups.each do |u|\n next if u.email.blank?\n next if to_email.include?(u.email)\n\n @edit[:user_emails][u.email] = \"#{u.name} (#{u.email})\"\n end\n end", "def parse_email_address(emails,check_for_shared_netids=nil)\n emails = check_for_shared_netid(emails,1) if check_for_shared_netids\n emails = emails.split(\"|\") if emails =~ /|/\n if emails.class.to_s == \"String\"\n parsed_emails = emails + \"@\" + @configuration[:domain] if emails !~ /@/\n elsif emails.class.to_s == \"Array\"\n # this is ugly\n emails_string = \"\"\n emails.each do |address|\n address = address + \"@\" + @configuration[:domain] if address !~ /@/\n emails_string += \"#{address}, \"\n end\n emails_string.chomp(\", \")\n end\n end", "def test_emails\n end", "def emails_send_to\n (emails + [cc.presence]).compact.uniq.to_sentence\n end", "def emails\n \"#{candidate_sheet.candidate_email}, #{candidate_sheet.parent_email_1},#{candidate_sheet.parent_email_2}\"\n end", "def admin_original_manuscript_list\n %w( tt_original_manuscript_list@booktrope.com )\n end", "def email_params\n params.require(:email).permit(:user_id, :subject, :content, :list_ids => [])\n end" ]
[ "0.8491395", "0.75682986", "0.7467314", "0.72210306", "0.7167031", "0.7070096", "0.70440525", "0.69833934", "0.69553554", "0.69419616", "0.68911684", "0.6841979", "0.6816934", "0.6803366", "0.67704386", "0.67364573", "0.6730073", "0.6723742", "0.6701323", "0.6701323", "0.6701323", "0.6701323", "0.66727376", "0.6646778", "0.66344017", "0.66247296", "0.6619037", "0.6608368", "0.65507334", "0.65494597", "0.6539465", "0.6537213", "0.65247476", "0.65186095", "0.650756", "0.6501851", "0.6498806", "0.64919615", "0.64919615", "0.64796585", "0.64735526", "0.6453762", "0.64447814", "0.6439828", "0.6438316", "0.64332336", "0.6430186", "0.642274", "0.63926417", "0.63733387", "0.6368277", "0.6350961", "0.6322574", "0.63204116", "0.6309937", "0.63086486", "0.62966925", "0.62837976", "0.6281237", "0.6275352", "0.62702143", "0.62697214", "0.62636566", "0.6260779", "0.62496465", "0.62472856", "0.62458426", "0.6242219", "0.62391037", "0.6238955", "0.6238955", "0.62318265", "0.6231475", "0.621778", "0.6209943", "0.62080044", "0.62055355", "0.61853874", "0.6184898", "0.6184449", "0.617903", "0.617703", "0.617703", "0.61760557", "0.6171421", "0.6170584", "0.6128082", "0.6127831", "0.6127171", "0.61246294", "0.61245227", "0.6123173", "0.61184007", "0.6117049", "0.6116848", "0.6105702", "0.6102365", "0.61001754", "0.6095933", "0.6093932" ]
0.62810117
59
GET /pagemasters GET /pagemasters.json
def index @pagemasters = Pagemaster.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @masters = Master.all.paginate(page: params[:page], per_page: 200)\n end", "def index\n @pharmaceutical_masters = PharmaceuticalMaster.page(params[:page])\n # @pharmaceutical_masters = PharmaceuticalMaster.all\n end", "def index\n @sites = current_user.sites.page(params[\"page\"])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end", "def index\n @masters = Master.all\n end", "def index\n @pages = Page.all\n render json: @pages\n end", "def index\n @pages = current_site.pages\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end", "def index\n @sites = Site.paginate(:page=>params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end", "def index\n @hot_masters = HotMaster.page(params[:page])\n # @hot_masters = HotMaster.all\n end", "def index\n @pages = Page.paginate(page: params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: Page.roots.map{|r| r.node}}\n end\n end", "def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end", "def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end", "def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end", "def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end", "def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end", "def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end", "def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end", "def index\n @masterservices = Masterservice.all\n end", "def index\n @town_masters = TownMaster.all\n end", "def index\n @concept_maps = ConceptMap.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json:@concept_maps }\n end\n end", "def index\n @parsed_sites = ParsedSite.all\n\n render json: @parsed_sites\n end", "def index\n @pages = Page.page params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end", "def index\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end", "def index\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end", "def index\n respond_to do |format|\n format.html do \n @sites = Site.all\n end\n format.json do\n render json: Site.all\n end\n end\n end", "def show\n render json: @page\n end", "def index\n @urls = @site.urls.paginate(:page => params[:page])\n render json: @urls\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end", "def index\n @coasters = Coaster.all\n\n render json: @coasters\n end", "def index\n @servers = getmydata(\"Server\")\n\tpagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @servers }\n end\n end", "def index\n @payment_site_masters = PaymentSiteMaster.all\n end", "def index\n @landmasters = Landmaster.all\n end", "def index\n\t\t@pages = Page.order('created_at DESC').all\n\n\t\trespond_to do |format|\n\t\t\tformat.html #index.html.erb\n\t\t\tformat.json { render json: @pages }\n\t\tend\n\tend", "def masters\n @masters ||= {}\n \n if @masters.empty?\n master_links.each do |master_link|\n master_class_name = master_link.master_type\n master_class = master_class_name.constantize\n @masters[master_class_name] ||= []\n @masters[master_class_name] << master_class.where(id: master_link.master_id).limit(1)\n end\n end\n\n return @masters\n end", "def index\n @pages = Page.all\n \n respond_to do |format|\n format.json { render :json => @pages }\n format.xml { render :xml => @pages }\n end\n end", "def index\n @mirrors = Mirror.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mirrors }\n end\n end", "def index\n @document_masters = DocumentMaster.all\n end", "def get_page\n render_page_sections_json\n end", "def index\n @distros = getmydata(\"Distro\")\n pagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @distros }\n end\n end", "def index\n @site_setups = SiteSetup.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @site_setups }\n end\n end", "def index\n render json: @links\n end", "def index\n @about_pages = AboutPage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @about_pages }\n end\n end", "def index\n @pages = Page.all\n\n respond_with @pages\n end", "def index\n @servers = Server.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @servers.to_json(:include => { :websites => {:include => :plugins } }) }\n end\n end", "def index\n @mercado_meta = MercadoMetum.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mercado_meta }\n end\n end", "def index\n @static_pages = StaticPage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @static_pages }\n end\n end", "def index\n @static_pages = StaticPage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @static_pages }\n end\n end", "def index\n @pages = Page.all\n\n respond_to do |format|\n format.json { render json: @pages }\n format.xml { render xml: @pages }\n end\n end", "def index\r\n set_data_from_param\r\n @page_info = resources_with_pagination(@boards)\r\n render formats: :json\r\n end", "def index\n @crawl_requests = CrawlRequest.all\n \n render json: @crawl_requests\n end", "def index\n @djrmasters = Djrmaster.all\n end", "def index\n @series_has_manifestations = SeriesHasManifestation.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @series_has_manifestations }\n end\n end", "def lookup\n # gets a page (Hash) or a FB error\n page = @key_master.get_page(params[:name])\n respond_to do |format|\n format.json do\n render json: page, status: (page.is_a?(Hash) ? :ok : :not_found)\n end\n end\n end", "def get_bundles(options = nil)\n @client.raw('get', '/content/pages', options)\n end", "def index\n @ac_masters = AcMaster.all\n end", "def index\n @publishers = Publisher.order(\"id DESC\").page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @publishers }\n end\n end", "def index\n @movers = Mover.all\n\n render json: @movers\n end", "def index\n @pages = Page.all\n respond_with(@pages)\n end", "def index\n @pages = Page.all\n respond_with(@pages)\n end", "def show_domains\n render json: dme.show_domains\n end", "def index\n @society_masters = SocietyMaster.all\n end", "def index\n @majors = majors\n respond_to do |format|\n format.json{\n return render json: ret\n }\n end\n end", "def index\n @source_masters = SourceMaster.all\n end", "def index\n if params[:q].present?\n @q = CelloMaster.ransack(params[:q])\n @cello_masters = @q.result.order('created_at')\n else\n @q = CelloMaster.ransack(params[:q])\n @cello_masters = CelloMaster.all.order('created_at').paginate(page: params[:page], per_page: 15)\n end\n end", "def index\n @pages = @club.all_pages\n \n @page_title = \"Page Listing\"\n @site_section = \"clubs\"\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @pages }\n end \n end", "def show\n @deck = Deck.find(params[:id])\n @masters = @deck.masters\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @deck }\n end\n end", "def index\n respond_with(pages)\n end", "def index\n @families = Family.all.paginate(page: params[:page])\n render json: @families\n end", "def index\n @dor_masters = DorMaster.all\n \n end", "def index\n @reserve_stat_has_manifestations = ReserveStatHasManifestation.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @reserve_stat_has_manifestations }\n end\n end", "def create\n @pagemaster = Pagemaster.new(pagemaster_params)\n\n respond_to do |format|\n if @pagemaster.save\n format.html { redirect_to @pagemaster, notice: 'Pagemaster was successfully created.' }\n format.json { render :show, status: :created, location: @pagemaster }\n else\n format.html { render :new }\n format.json { render json: @pagemaster.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @pages = Page.all\n respond_with(@pages)\n end", "def index\n set_user\n @sites = Site.all\n respond_to do |format|\n format.html { render :index }\n format.json { render json: @sites.to_json }\n end\n end", "def get_page_contents()\n JSON.parse( \n @client.api.get(\"#{@client.base_uri.path}/api.php?#{URI.encode_www_form({\n :action => 'query',\n :prop => 'info|revisions',\n :titles => BAN_PAGE,\n :rvprop => 'content',\n :intoken => 'edit',\n :indexpageids => 1,\n :format => 'json',\n :cb => rand(1000000)\n })}\", @headers).body,\n :symbolize_names => true\n )[:query]\n end", "def index\n @mush_crawlers = MushCrawler.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @mush_crawlers }\n end\n end", "def index\n @enq_pages = EnqPage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @enq_pages }\n end\n end", "def masteries(summoner_ids)\n neated_param = neat_params(summoner_ids)\n masteries = get(resource_path_by_id('masteries', neated_param), @version)\n masteries.map do |mastery|\n RiotGamesApi::LOL::Model::Summoner::MasteryPageList.new(mastery.last)\n end\n# { masteries.keys.first.to_i => ) }\n end", "def index\n @service_type_masters = ServiceTypeMaster.all\n end", "def index\n @accident_masters = AccidentMaster.all\n end", "def index\n @late_mark_masters = LateMarkMaster.all\n end", "def index\n @supplysites = Supplysite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @supplysites }\n end\n end", "def index\n @core_machines = Core::Machine.scoped\n\n respond_to do |format|\n format.html { @core_machines = @core_machines.page(params[:page]) }\n format.json { render json: @core_machines }\n end\n end", "def index\n @cmms = Cmm.all\n render json: @cmms\n end", "def show\n @admin_agency = Admin::Agency.where(:id => params[:id]).includes(:pages)[0]\n \n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_agency }\n end\n end", "def index\n @phones = Phone.all\n json_response(@phones)\n end", "def get_pages(options = nil)\n @client.raw('get', '/content/pages', options)\n end", "def index\n @book_pages = @book.book_pages\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @book_pages }\n end\n end", "def index\n\n # find all pages\n @pages = Page.all\n\n # send data in different format\n respond_to do |format|\n format.html{render :template => 'mcms_pages/admin/pages/index'}# index.html.erb\n format.json { render json: @pages }\n end # end respond_to\n\n end", "def index\n @title = t('view.customers_groups.index_title')\n @customers_groups = CustomersGroup.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @customers_groups }\n end\n end", "def index\n @title = t('view.customers_groups.index_title')\n @customers_groups = CustomersGroup.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @customers_groups }\n end\n end", "def show\n if admin?\n @page = Page.find_by_slug(params[:id]) \n else\n @page = Page.published.find_by_slug(params[:id]) \n end\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page, :only => [:title, :content] }\n end\n end", "def index\n #Page.all is fine for small sets of data, for larger sets pagination would be best\n @pages = data_cache('pages', 10.minutes) do\n Page.all\n end\n respond_to do |format|\n format.json { render action: 'index', status: :ok, location: api_pages_url(@pages) }\n format.xml { render xml: @pages, location: api_pages_url(@pages) }\n end\n end", "def index\n\t\t\t@landing_pages = LandingPage.all\n\n\t\t\trespond_to do |format|\n\t\t\t\tformat.html # index.html.erb\n\t\t\t\tformat.json { render json: @landing_pages }\n\t\t\tend\n\t\tend", "def index\n @map_nodes = Map::Node.paginate(:page => params[:page], :per_page => 64)\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end", "def show\n @manga = Manga.find(params[:id])\n @chapters = @manga.ordered_chapters.page(params[:page]).per 15\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @manga }\n end\n end", "def movie_data\n response = RestClient.get(\"critics.api.mks.io/movie-genres\")\n JSON.parse(response)\nend", "def show\n # TODO: this is a placeholder for logic using Sentence\n render :json => { :index => params[:id],\n :contents => \"SERVER: this would be the contents of page \" + params[:id]\n }\n end", "def index\n @service_master = ServiceMaster.new\n @service_masters = ServiceMaster.all\n end", "def index\n @crawler_templates = CrawlerTemplate.order(\"mall_id asc, updated_at desc\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @crawler_templates }\n end\n end", "def index\n @links = Link.paginate(page: params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @links }\n end\n end", "def show\n @page = Page.friendly.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\n end" ]
[ "0.7053716", "0.667946", "0.66463715", "0.65678316", "0.6535094", "0.64710444", "0.6429073", "0.62397164", "0.62287617", "0.6213205", "0.6213205", "0.6213205", "0.6213205", "0.6213205", "0.6213205", "0.6213205", "0.6211827", "0.61739004", "0.615255", "0.6136375", "0.61148226", "0.60932326", "0.60932326", "0.60823596", "0.60760486", "0.60757047", "0.6057643", "0.6024202", "0.6016256", "0.6012544", "0.59900635", "0.5973804", "0.59729767", "0.5963408", "0.59584785", "0.5956501", "0.59543306", "0.5947463", "0.59350806", "0.5920628", "0.5913731", "0.58921766", "0.58814824", "0.588051", "0.5874787", "0.5874787", "0.58716404", "0.58403796", "0.5836649", "0.58364844", "0.5830686", "0.58252466", "0.58190054", "0.581422", "0.5810543", "0.5805892", "0.57989395", "0.57989395", "0.5790433", "0.5790391", "0.57837635", "0.57619756", "0.57608724", "0.5745062", "0.5744792", "0.5744119", "0.57388675", "0.5736182", "0.57294947", "0.5728091", "0.57268894", "0.5726346", "0.57259554", "0.5718286", "0.57127994", "0.5711715", "0.57099295", "0.5709625", "0.5707641", "0.56972134", "0.56971455", "0.56930184", "0.5690065", "0.56874436", "0.56843185", "0.567524", "0.56745756", "0.56744456", "0.56744456", "0.5667221", "0.5654738", "0.56518406", "0.56515354", "0.5650128", "0.56480926", "0.5646899", "0.5641793", "0.56381184", "0.562627", "0.562388" ]
0.72797215
0
GET /pagemasters/1 GET /pagemasters/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @pagemasters = Pagemaster.all\n end", "def index\n @masters = Master.all.paginate(page: params[:page], per_page: 200)\n end", "def index\n @pharmaceutical_masters = PharmaceuticalMaster.page(params[:page])\n # @pharmaceutical_masters = PharmaceuticalMaster.all\n end", "def index\n @pages = Page.all\n render json: @pages\n end", "def index\n @sites = current_user.sites.page(params[\"page\"])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end", "def show\n render json: @page\n end", "def index\n @pages = current_site.pages\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end", "def index\n @concept_maps = ConceptMap.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json:@concept_maps }\n end\n end", "def index\n @sites = Site.paginate(:page=>params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end", "def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end", "def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end", "def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end", "def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end", "def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end", "def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end", "def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end", "def index\n @pages = Page.page params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end", "def index\n @masters = Master.all\n end", "def index\n @hot_masters = HotMaster.page(params[:page])\n # @hot_masters = HotMaster.all\n end", "def index\n @pages = Page.paginate(page: params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: Page.roots.map{|r| r.node}}\n end\n end", "def get_page\n render_page_sections_json\n end", "def lookup\n # gets a page (Hash) or a FB error\n page = @key_master.get_page(params[:name])\n respond_to do |format|\n format.json do\n render json: page, status: (page.is_a?(Hash) ? :ok : :not_found)\n end\n end\n end", "def show\n @page = Page.friendly.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\n end", "def show\n @page = Page.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\n end", "def show\n @page = Page.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\n end", "def show\n @page = Page.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\n end", "def show\n @page = Page.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\n end", "def show\n @page = Page.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\n end", "def show\n @page = Page.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\n end", "def show\n @page = Page.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end", "def show\n @Page = Page.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @Page }\n end\n end", "def index\n @servers = getmydata(\"Server\")\n\tpagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @servers }\n end\n end", "def show\n @page = Page.find(params[:id])\n @version = @page.versions.last\n @author = User.all\n page = {\n :version => @version.changeset,\n :body => @page.body,\n :author => @author\n }\n respond_to do |format|\n format.html\n format.json { render json: page.to_json }\n end\n end", "def show\n @sync_page = SyncPage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sync_page }\n end\n end", "def show\n # TODO: this is a placeholder for logic using Sentence\n render :json => { :index => params[:id],\n :contents => \"SERVER: this would be the contents of page \" + params[:id]\n }\n end", "def index\n @distros = getmydata(\"Distro\")\n pagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @distros }\n end\n end", "def show\n @structure_page = Structure::Page.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @structure_page }\n end\n end", "def show\n @oasis_page = OasisPage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @oasis_page }\n end\n end", "def show\n @page = @chapter.pages.find_by_number(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\n end", "def show\n @admined_page1 = AdminedPage1.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admined_page1 }\n end\n end", "def show\n @admin_agency = Admin::Agency.where(:id => params[:id]).includes(:pages)[0]\n \n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_agency }\n end\n end", "def index\n @publishers = Publisher.order(\"id DESC\").page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @publishers }\n end\n end", "def show\n if admin?\n @page = Page.find_by_slug(params[:id]) \n else\n @page = Page.published.find_by_slug(params[:id]) \n end\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page, :only => [:title, :content] }\n end\n end", "def index\n @pages = Page.all\n \n respond_to do |format|\n format.json { render :json => @pages }\n format.xml { render :xml => @pages }\n end\n end", "def index\n @urls = @site.urls.paginate(:page => params[:page])\n render json: @urls\n end", "def index\n @mirrors = Mirror.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mirrors }\n end\n end", "def show\n @page = Admin::Component.page.by_agency(@current_agency.id).by_permalink(params[:permalink])[0]\n raise ActiveRecord::RecordNotFound, 'Page not found' if @page.nil?\n \n @agency = @current_agency\n \n respond_to do |format|\n format.html { render :layout => false}\n format.json { render json: @page }\n end\n end", "def index\n @core_machines = Core::Machine.scoped\n\n respond_to do |format|\n format.html { @core_machines = @core_machines.page(params[:page]) }\n format.json { render json: @core_machines }\n end\n end", "def index\n @coasters = Coaster.all\n\n render json: @coasters\n end", "def index\n @static_pages = StaticPage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @static_pages }\n end\n end", "def index\n @static_pages = StaticPage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @static_pages }\n end\n end", "def show\n @mypage = Mypage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mypage }\n end\n end", "def show\n @search_page = SearchPage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @search_page }\n end\n end", "def index\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end", "def index\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end", "def index\n @mercado_meta = MercadoMetum.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mercado_meta }\n end\n end", "def index\n @about_pages = AboutPage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @about_pages }\n end\n end", "def index\n render json: @links\n end", "def show\n @comic_page = ComicPage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comic_page }\n end\n end", "def get_page_contents()\n JSON.parse( \n @client.api.get(\"#{@client.base_uri.path}/api.php?#{URI.encode_www_form({\n :action => 'query',\n :prop => 'info|revisions',\n :titles => BAN_PAGE,\n :rvprop => 'content',\n :intoken => 'edit',\n :indexpageids => 1,\n :format => 'json',\n :cb => rand(1000000)\n })}\", @headers).body,\n :symbolize_names => true\n )[:query]\n end", "def index\n\t\t@pages = Page.order('created_at DESC').all\n\n\t\trespond_to do |format|\n\t\t\tformat.html #index.html.erb\n\t\t\tformat.json { render json: @pages }\n\t\tend\n\tend", "def index\n @pages = Page.all\n\n respond_to do |format|\n format.json { render json: @pages }\n format.xml { render xml: @pages }\n end\n end", "def index\n @series_has_manifestations = SeriesHasManifestation.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @series_has_manifestations }\n end\n end", "def index\n respond_to do |format|\n format.html do \n @sites = Site.all\n end\n format.json do\n render json: Site.all\n end\n end\n end", "def show\n @static_page = StaticPage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @static_page }\n end\n end", "def show\n @static_page = StaticPage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @static_page }\n end\n end", "def index\n @reserve_stat_has_manifestations = ReserveStatHasManifestation.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @reserve_stat_has_manifestations }\n end\n end", "def index_master\n page = params[:page] || 1\n @riders = Rider.master.page(page)\n end", "def show\n @test_page = TestPage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test_page }\n end\n end", "def index\n @phones = Phone.all\n json_response(@phones)\n end", "def index\r\n set_data_from_param\r\n @page_info = resources_with_pagination(@boards)\r\n render formats: :json\r\n end", "def new\n @page = current_site.pages.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end", "def index\n @pages = Page.all\n\n respond_with @pages\n end", "def index\n @site_setups = SiteSetup.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @site_setups }\n end\n end", "def index\n @masterservices = Masterservice.all\n end", "def index\n @town_masters = TownMaster.all\n end", "def index\n @pages = Page.all\n\n respond_to do |format|\n format.html {render :layout => \"layout_1\"}\n format.json { render json: @pages }\n end\n end", "def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page, :only => [:title, :content] }\n end\n end", "def index\n @manifestation_checkout_stats = ManifestationCheckoutStat.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @manifestation_checkout_stats }\n end\n end", "def show\n @childmaster = Childmaster.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @childmaster }\n end\n end", "def index\n @enq_pages = EnqPage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @enq_pages }\n end\n end", "def show\n @words_page = WordsPage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @words_page }\n end\n end", "def index\n @parsed_sites = ParsedSite.all\n\n render json: @parsed_sites\n end", "def show\n @page_type = PageType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page_type }\n end\n end", "def show\n @manga = Manga.find(params[:id])\n @chapters = @manga.ordered_chapters.page(params[:page]).per 15\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @manga }\n end\n end", "def index\n @teams = Team.page(params[:page])\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @teams }\n end\n end", "def show\n @mini_pago = MiniPago.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mini_pago }\n end\n end", "def show\n @page = Page.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @page }\n format.xml { render xml: @page }\n end\n end", "def index\n @landmasters = Landmaster.all\n end", "def index\n @machines = Machine.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @machines }\n end\n end", "def new\n @page = Page.new\n @page.build_business\n @business = Business.select('id, title')\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end", "def index\n @genotypes = Genotype.paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @genotypes }\n end\n end", "def index\n @payment_site_masters = PaymentSiteMaster.all\n end", "def index\n @book_pages = @book.book_pages\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @book_pages }\n end\n end", "def index\n @links = Link.paginate(page: params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @links }\n end\n end", "def show\n @page_template = PageTemplate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page_template }\n end\n end", "def show\n @about_page = AboutPage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @about_page }\n end\n end", "def show\n @mall = Mall.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mall }\n end\n end", "def index\n @materias = Materia.paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @materias }\n end\n end", "def show\n @deck = Deck.find(params[:id])\n @masters = @deck.masters\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @deck }\n end\n end" ]
[ "0.70652896", "0.6898956", "0.67192096", "0.6697065", "0.6681186", "0.6590563", "0.65252167", "0.64541876", "0.6452271", "0.64078385", "0.64078385", "0.64078385", "0.64078385", "0.64078385", "0.64078385", "0.64078385", "0.6387668", "0.63579065", "0.6301785", "0.6293287", "0.6283617", "0.626323", "0.62587583", "0.6233955", "0.6233955", "0.6233955", "0.6233955", "0.6233955", "0.6233955", "0.6233955", "0.62145364", "0.6186868", "0.6179726", "0.61785454", "0.6167504", "0.61621976", "0.61433035", "0.61414427", "0.6138907", "0.6125215", "0.6120388", "0.61153936", "0.6088287", "0.6082477", "0.6079802", "0.6077301", "0.60694563", "0.60670316", "0.6060071", "0.60590106", "0.6047205", "0.6047205", "0.6043638", "0.6036879", "0.6030344", "0.6030344", "0.60294247", "0.60253733", "0.6020707", "0.6020529", "0.6001748", "0.5992899", "0.5974298", "0.5968593", "0.5965176", "0.5963259", "0.5963259", "0.59427875", "0.5941296", "0.59322196", "0.59284794", "0.59258175", "0.5914445", "0.59114903", "0.59055346", "0.5903027", "0.59000945", "0.59000146", "0.5897151", "0.5892061", "0.5889255", "0.5887714", "0.5885278", "0.58754665", "0.5870996", "0.586426", "0.5861728", "0.5860627", "0.5850378", "0.58488226", "0.5847437", "0.583968", "0.58389896", "0.58381456", "0.5836921", "0.5834051", "0.58319527", "0.58313906", "0.5829589", "0.58281714", "0.58270884" ]
0.0
-1
POST /pagemasters POST /pagemasters.json
def create @pagemaster = Pagemaster.new(pagemaster_params) respond_to do |format| if @pagemaster.save format.html { redirect_to @pagemaster, notice: 'Pagemaster was successfully created.' } format.json { render :show, status: :created, location: @pagemaster } else format.html { render :new } format.json { render json: @pagemaster.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @pagemasters = Pagemaster.all\n end", "def create\n @page = Page.new(page_params)\n\n if @page.save\n render json: @page, status: :created, location: @page\n else\n render json: @page.errors, status: :unprocessable_entity\n end\n end", "def create\n @page = Page.new(params[:page])\n if @page.save\n respond_with(@page, location: api_pages_url)\n else\n respond_with(@page)\n end\n end", "def create\n @payment_site_master = PaymentSiteMaster.new(payment_site_master_params)\n\n respond_to do |format|\n if @payment_site_master.save\n format.html { redirect_to @payment_site_master, notice: 'Payment site master was successfully created.' }\n format.json { render 'show', status: :created, location: @payment_site_master }\n else\n format.html { render 'new' }\n format.json { render json: @payment_site_master.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n params[:page].except!(:map_info) unless params[:page][:map_info].present?\n @page = current_user.pages.new(params[:page])\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render json: @page, status: :created, location: @page }\n else\n @business = Business.select('id, title')\n format.html { render action: \"new\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @page = Page.new(page_params)\n respond_to do |format|\n if @page.save\n self.build_pages_tree\n format.html { redirect_to @pages_tree[@page.id], notice: 'Page was successfully created.' }\n format.json { render :show, status: :created, location: @page }\n else\n format.html { render :new }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @page = current_site.pages.new(params[:page])\n @site = @page.site\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render json: @page, status: :created, location: @page }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @suburb_master = SuburbMaster.new(suburb_master_params)\n\n respond_to do |format|\n if @suburb_master.save\n @city_town_masters = CityTownMaster.all.paginate(:page => params[:page], :per_page => 5).order('id desc')\n format.js { flash.now[:notice] = \"Suburb was successfully created\"}\n format.html { redirect_to @suburb_master, notice: 'Suburb master was successfully created.' }\n format.json { render :show, status: :created, location: @suburb_master }\n else\n @city_town_masters = CityTownMaster.all\n format.js {render :new }\n format.html { render :new }\n format.json { render json: @suburb_master.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @page = Page.new(params[:page])\n\n respond_to do |format|\n if @page.save\n format.json { render json: @page, status: :created, location: [:api, @page] }\n format.xml { render xml: @page, status: :created, location: [:api, @page] }\n else\n format.json { render json: @page.errors, status: :unprocessable_entity }\n format.xml { render xml: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @master = Master.new(master_params)\n\n respond_to do |format|\n if @master.save\n format.html { redirect_to @master, notice: 'Master was successfully created.' }\n format.json { render :show, status: :created, location: @master }\n else\n format.html { render :new }\n format.json { render json: @master.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @site_page = SitePage.new(site_page_params)\n\n respond_to do |format|\n if @site_page.save\n format.html { redirect_to @site_page, notice: 'Site page was successfully created.' }\n format.json { render action: 'show', status: :created, location: @site_page }\n else\n format.html { render action: 'new' }\n format.json { render json: @site_page.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @masters = Master.all.paginate(page: params[:page], per_page: 200)\n end", "def create\n response = @page.parse_url\n render json: response\n end", "def create\n @maker_master = MakerMaster.new(maker_master_params)\n\n respond_to do |format|\n if @maker_master.save\n format.html { redirect_to @maker_master, notice: 'Maker master was successfully created.' }\n format.json { render :show, status: :created, location: @maker_master }\n else\n format.html { render :new }\n format.json { render json: @maker_master.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n respond_to do |format|\n begin\n @page = Page.create_page!\n format.html { redirect_to \"/#{@page.request_id}/inspect\", notice: t('pages.create.success') }\n format.json { render action: 'show', status: :created, location: @page }\n rescue => e\n format.html { render action: 'index' }\n format.json { render json: {:message => \"create page error\"}, status: :unprocessable_entity }\n end\n end\n end", "def create\n @test_page = TestPage.new(params[:test_page])\n\n respond_to do |format|\n if @test_page.save\n format.html { redirect_to @test_page, notice: 'Test page was successfully created.' }\n format.json { render json: @test_page, status: :created, location: @test_page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @test_page.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @key_master.to_page params['page'][:external_id] if params['page'][:external_id].present?\n\n redirect_to root_path\n end", "def create\n @page = Page.new(admin_page_params)\n respond_to do |format|\n if @page.save\n format.html { redirect_to admin_pages_url, notice: 'page was successfully created.' }\n format.json { render :show, status: :created, location: @page }\n else\n format.html { render :new }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_page\n puts 'params = ' + params.inspect\n puts params[:content_page].inspect\n puts params[:content_page['name']].inspect\n @page = ContentPage.new(params[:content_page])\n puts '@page = ' + @page.inspect\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to show_content_pages_path(@page.id), notice: 'Page was successfully created.' }\n format.json { render json: @page, status: :created }\n else\n format.html { render :controller => 'content_pages', action: \"new\", alert: 'There were Errors. Could not Create a New Page.' }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @page = Page.new(params[:page])\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to pages_path, notice: 'Page was successfully created.' }\n format.json { render json: @page, status: :created, location: @page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @page_page = PagePage.new(page_page_params)\n\n respond_to do |format|\n if @page_page.save\n format.html { redirect_to @page_page, notice: 'Page page was successfully created.' }\n format.json { render :show, status: :created, location: @page_page }\n else\n format.html { render :new }\n format.json { render json: @page_page.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @nested_page = Nested::Page.new(params[:nested_page])\n\n respond_to do |format|\n if @nested_page.save\n format.html { redirect_to @nested_page, notice: 'Page was successfully created.' }\n format.json { render json: @nested_page, status: :created, location: @nested_page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @nested_page.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @search_page = SearchPage.new(params[:search_page])\n\n respond_to do |format|\n if @search_page.save\n format.html { redirect_to @search_page, notice: 'Search page was successfully created.' }\n format.json { render json: @search_page, status: :created, location: @search_page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @search_page.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @story = Story.find(params[:story_id])\n @page = @story.pages.build(page_params)\n\n @parent = Page.find(params[:parent_id]);\n\n if @page.save!\n if(params[:parent_id] && params[:choice_text])\n @parent = Page.find(params[:parent_id]);\n @branch = @parent.branches.build(destination_id: @page.id, choice_text: params[:choice_text], story_id: @story.id)\n\n if !@branch.save\n render json: { error: \"Error saving page\", status: 400 }, status: 400\n end\n\n if !@parent.save\n render json: { error: \"Error saving page\", status: 400 }, status: 400\n end\n end\n\n render json: @parent, status: 201\n end\n end", "def create\n @page = current_site.pages.new(params[:page])\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to quick_page_path(@page), notice: 'Page was successfully created.' }\n format.json { render json: @page, status: :created, location: @page }\n format.js\n else\n format.html { render action: \"new\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end", "def create\n @page = Page.new\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to [:admin, @page], notice: 'Page was successfully created.' }\n format.json { render json: @page, status: :created, location: @page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cms_page = CmsPage.new(cms_page_params)\n\n respond_to do |format|\n if @cms_page.save\n format.html { redirect_to @cms_page, notice: 'Cms page was successfully created.' }\n format.json { render :show, status: :created, location: @cms_page }\n else\n format.html { render :new }\n format.json { render json: @cms_page.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @page = Page.new(params[:page])\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render json: @page, status: :created, location: @page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @page = Page.new(params[:page])\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render json: @page, status: :created, location: @page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @page = Page.new(params[:page])\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render json: @page, status: :created, location: @page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @page = Page.new(params[:page])\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render json: @page, status: :created, location: @page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @page = Page.new(params[:page])\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render json: @page, status: :created, location: @page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @page = Page.new(params[:page])\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render json: @page, status: :created, location: @page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @page = Page.new(params[:page])\n \n if @page.save\n respond_to do |format|\n format.json { render :json => @page, :status => :created }\n format.xml { render :xml => @page, :status => :created }\n end\n else\n respond_to do |format|\n format.json { raise Palani::Api::InvalidRecordJSONException }\n format.xml { raise Palani::Api::InvalidRecordXMLException }\n end\n end\n end", "def create\n @childmaster = Childmaster.new(params[:childmaster])\n\n respond_to do |format|\n if @childmaster.save\n format.html { redirect_to @childmaster, notice: 'Childmaster was successfully created.' }\n format.json { render json: @childmaster, status: :created, location: @childmaster }\n else\n format.html { render action: \"new\" }\n format.json { render json: @childmaster.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @page = Page.new(params[:page])\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to [:admin, @page], notice: 'Страница успешно создана.' }\n format.json { render json: @page, status: :created, location: @page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @page = Page.new(params[:page])\n\n if @page.save\n respond_to do |format|\n format.json {render json: @page, status: :created }\n format.xml {render xml: @page, status: :created}\n end\n \n else\n respond_to do |format|\n format.json {render json: @page.errors, status: :unprocessable_entity}\n format.xml {render xml: @page.errors, status: :unprocessable_entity}\n end\n end\n end", "def create\n @page = Page.new(page_params)\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render :show, status: :created, location: @page }\n else\n format.html { render :new }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @page = Page.new(page_params)\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render :show, status: :created, location: @page }\n else\n format.html { render :new }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @page = Page.new(page_params)\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render :show, status: :created, location: @page }\n else\n format.html { render :new }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @memorizationpage = Memorizationpage.new(memorizationpage_params)\n\n respond_to do |format|\n if @memorizationpage.save\n format.html { redirect_to @memorizationpage, notice: 'Memorizationpage was successfully created.' }\n format.json { render :show, status: :created, location: @memorizationpage }\n else\n format.html { render :new }\n format.json { render json: @memorizationpage.errors, status: :unprocessable_entity }\n end\n end\n end", "def pagemaster_params\n #params.require(:pagemaster).permit(:\n params.fetch(:pagemaster, {})\n end", "def create\n @landmaster = Landmaster.new(landmaster_params)\n \n respond_to do |format|\n if @landmaster.save\n format.html { redirect_to landmasters_path, notice: 'Landmaster was successfully created.' }\n format.json { render :show, status: :created, location: @landmaster }\n else\n format.html { render :new }\n format.json { render json: @landmaster.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @page = current_site.pages.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end", "def create\n @page = Page.new(page_params)\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render action: 'show', status: :created, location: @page }\n else\n format.html { render action: 'new' }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @page = Page.new(page_params)\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render action: 'show', status: :created, location: @page }\n else\n format.html { render action: 'new' }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @page = Page.new(params[:page])\n\n respond_to do |format|\n if @page.save\n @contribution = @page.contributions.build(:user_id => current_user.id)\n @contribution.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render json: @page, status: :created, location: @page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n # retrieve page part attributes from params and assign it to a variable\n page_parts = params[:page][:page_parts_attributes]\n\n # sort the page_parts and reassign it to the params\n params[:page][:page_parts_attributes] = Hash[page_parts.sort]\n\n #creating the page object with its own and child attributes\n @page = Page.new(params[:page])\n\n #retrieving layout id from params and assigning to a variable\n @layout = params[:page][:layout_id]\n\n # calling method to find all pages and page parts\n find_pages_and_parts(@layout)\n\n # sends the data in different formats\n respond_to do |format|\n\n if @page.save #page saved successfully\n\n format.html { redirect_to admin_pages_path, notice: 'Page was successfully created.' }\n format.json { render json: @page, status: :created, location: @page }\n\n else #page saving failed, re-render the form\n\n format.html { render action: \"new\", :template => 'mcms_pages/admin/pages/new' }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n\n end # end if\n\n end # end respond_to block\n\n end", "def set_pagemaster\n @pagemaster = Pagemaster.find(params[:id])\n end", "def create\n @admin_page = Admin::Page.new(admin_page_params)\n\n respond_to do |format|\n if @admin_page.save\n format.html { redirect_to edit_admin_page_path(@admin_page), notice: 'Page was successfully created.' }\n format.json { render :show, status: :created, location: @admin_page }\n else\n format.html { render :new }\n format.json { render json: @admin_page.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @page = Page.new(page_params)\n\n # TwitterUser.create(\n # @users_array.map do |u|\n # { username: u.username, display_name: u.name }\n # end\n # )\n # puts @page.components.first\n # puts format.json {page_params}\n # @page.components do |comp|\n # @page.components.build(comp)\n # end\n # @component = Component.new(page_id: @page.id, component: {name:page_params.component.name})\n # @component = Component.new(page_id: @page.id)\n # @page = Page.find(params[:page_id])\n # @page.save\n # @page.update_attributes(@page.components)\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render :show, status: :created, location: @page }\n else\n format.html { render :new }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @page = @club.pages.new(params[:page])\n @page.parent_id = params[:page][:parent_id];\n @page.bns_parent_id = params[:page][:parent_id];\n respond_to do |format|\n if @page.save\n flash[:notice] = 'Pages was successfully created.'\n\t format.html { redirect_to(admin_club_page_path(@club, @page)) }\n format.xml { render :xml => @page, :status => :created, :location => @page }\n else\n @pagelist = @club.all_pages\n \n @page_title = \"New Page\"\n @site_section = \"admin\"\n format.html { render :action => \"new\" }\n format.xml { render :xml => @page.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @customermaster = Customermaster.new(customermaster_params)\n\n respond_to do |format|\n if @customermaster.save\n format.html { redirect_to customermasters_url, notice: 'Customermaster was successfully created.' }\n format.json { render :show, status: :created, location: @customermaster }\n else\n format.json { render json: @customermaster.errors, status: :unprocessable_entity }\n format.html { redirect_to customermasters_url, notice: 'Customermaster Not successfully created.' }\n\n end\n end\n end", "def create\n megam_rest.post_node(to_hash)\n end", "def create\n respond_with(@page = Page.create(params[:page]), :status => :created)\n end", "def new\n @page = @chapter.pages.build\n\n gon.manga_id = @manga.slug\n gon.chapter_id = @chapter.number\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end", "def create\n @cms_page = current_portal.pages.build(cms_page_params)\n\n respond_to do |format|\n if @cms_page.save\n format.html { redirect_to @cms_page, notice: 'Page was successfully created.' }\n format.json { render :show, status: :created, location: @cms_page }\n else\n format.html { render :new }\n format.json { render json: @cms_page.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render json: @page, status: :created, location: @page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #Each Page could be tied to an ApiKey or set of ApiKeys for security\n @page = Page.new(page_params)\n #Render the object created or errors\n respond_to do |format|\n if @page.save\n #Cache bust pages\n Rails.cache.delete(\"pages\")\n format.json { render action: 'show', status: :created, location: api_page_url(@page) }\n else\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @page = current_user.pages.new(page_params)\n\n @page.slug = @page.title.parameterize\n\n if Page.exists?(slug: @page.slug, site_id: @site.id)\n pages = Page.where(title: @page.title, site_id: @site.id).count\n @page.slug = @page.title.parameterize + \"-\" + (pages + 1).to_s\n end\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to edit_page_path(@page), notice: 'Saved' }\n format.json { render action: 'show', status: :created, location: @page }\n else\n format.html { render action: 'new' }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @microsite = Microsite.new(microsite_params)\n\n respond_to do |format|\n if @microsite.save\n format.html { redirect_to @microsite, notice: 'Microsite was successfully created.' }\n format.json { render action: 'show', status: :created, location: @microsite }\n else\n format.html { render action: 'new' }\n format.json { render json: @microsite.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @info_page = InfoPage.new(params[:info_page])\n\n respond_to do |format|\n if @info_page.save\n format.html { redirect_to admin_info_pages_path, notice: 'Info page was successfully created.' }\n format.json { render json: @info_page, status: :created, location: @info_page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @info_page.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @structure_page = Structure::Page.new(params[:structure_page])\n\n respond_to do |format|\n if @structure_page.save\n format.html { redirect_to @structure_page, notice: 'Page was successfully created.' }\n format.json { render json: @structure_page, status: :created, location: @structure_page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @structure_page.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @words_page = WordsPage.new(params[:words_page])\n\n respond_to do |format|\n if @words_page.save\n format.html { redirect_to @words_page, notice: 'Words page was successfully created.' }\n format.json { render json: @words_page, status: :created, location: @words_page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @words_page.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @master = Master.new(master_params)\n respond_to do |format|\n if @master.save\n session[:last_master_id] = @master.id\n format.html { redirect_to master_url(@master), notice: \"Master was successfully created.\" }\n format.json { render :show, status: :created, location: @master }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @master.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @story_page = StoryPage.new(story_page_params)\n\n respond_to do |format|\n if @story_page.save\n format.html { redirect_to @story_page, notice: 'Story page was successfully created.' }\n format.json { render action: 'show', status: :created, location: @story_page }\n else\n format.html { render action: 'new' }\n format.json { render json: @story_page.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pharmaceutical_master = PharmaceuticalMaster.new(pharmaceutical_master_params)\n\n respond_to do |format|\n if @pharmaceutical_master.save\n format.html { redirect_to @pharmaceutical_master, notice: CREATE_NOTICE }\n format.json { render :show, status: :created, location: @pharmaceutical_master }\n else\n format.html { render :new }\n format.json { render json: @pharmaceutical_master.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pageinfo = Pageinfo.new(pageinfo_params)\n\n respond_to do |format|\n if @pageinfo.save\n format.html { redirect_to @pageinfo, notice: 'Pageinfo was successfully created.' }\n format.json { render :show, status: :created, location: @pageinfo }\n else\n format.html { render :new }\n format.json { render json: @pageinfo.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @pharmaceutical_masters = PharmaceuticalMaster.page(params[:page])\n # @pharmaceutical_masters = PharmaceuticalMaster.all\n end", "def create\n @cinema = current_member.cinemas.build(cinema_params)\n @page = Page.create(:pageable => @cinema)\n respond_to do |format|\n if @cinema.save\n format.html { redirect_to manage_cinema_cinemas_path, notice: 'Cinema was successfully created.' }\n format.json { render action: 'show', status: :created, location: @cinema }\n else\n format.html { render action: 'new' }\n format.json { render json: @cinema.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @page = ContentPage.new\n @blocks = nil\n #@newBlock = PageBlock.new\n @form_action = \"create_page\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end", "def create\n @regions = RegionMaster.all\n @districts = DistrictMaster.all\n\n @town_master = TownMaster.new(town_master_params)\n prefix = @town_master.name\n @town_master.town_id = TownMaster.gen_assigned_code(prefix)\n town_idd = @town_master.town_id\n\n respond_to do |format|\n if @town_master.save\n format.html { redirect_to @town_master, notice: \"Town master was successfully created.\" }\n format.json { render :show, status: :created, location: @town_master }\n else\n logger.info \"Here ===== #{@town_master.errors.messages.inspect}\"\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @town_master.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @page = @parent_page.children.new(params[:page])\n \n @page.site = @site\n @page.created_by = @page.updated_by = current_user\n\n respond_to do |format|\n if @page.save\n flash[:notice] = \"Page was successfully created.\"\n format.html { redirect_to(@parent_page ? admin_site_page_child_path(@site, @parent_page, @page) : admin_site_page_path(@site, @page))}\n format.xml { render :xml => @page, :status => :created, :location => @page }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @page.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_master\n @rider = Rider.new(rider_params)\n @rider.rider_type = 'master'\n\n respond_to do |format|\n if @rider.save\n format.html { redirect_to master_rider_path(@rider), notice: 'Rider was successfully created.' }\n format.json { render :show_master, status: :created, location: @rider }\n else\n format.html { render :new_master }\n format.json { render json: @rider.errors, status: :unprocessable_entity }\n end\n end\n end", "def publish\n @page.publish\n respond_with(@page, location: published_api_pages_url)\n end", "def create\n @page = Page.new(page_params)\n\n respond_to do |format|\n if @page.save\n Rails.application.reload_routes!\n format.html { redirect_to admin_page_path(@page), notice: 'Page was successfully created.' }\n format.json { render :show, status: :created, location: @page }\n else\n format.html { render :new }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n # log\n fields = @page.fields.each do |f| f.inspect end\n register_log \"Page created: #{@page.inspect} -- Custom type fields: #{fields}\\n\"\n end", "def create\n @page = current_cms.pages.new(params[:big_cms_page])\n respond_to do |format|\n if @page.save\n format.html { redirect_to(@page, :notice => 'Page was successfully created.') }\n format.xml { render :xml => @page, :status => :created, :location => @page }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @page.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n @pages = Page.all\n render json: @pages\n end", "def create\n @society_master = SocietyMaster.new(society_master_params)\n\n respond_to do |format|\n if @society_master.save\n format.html { redirect_to @society_master, notice: 'Society master was successfully created.' }\n format.json { render :show, status: :created, location: @society_master }\n else\n format.html { render :new }\n format.json { render json: @society_master.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @oasis_page = OasisPage.new(params[:oasis_page])\n\n respond_to do |format|\n if @oasis_page.save\n format.html { redirect_to @oasis_page, notice: 'Oasis page was successfully created.' }\n format.json { render json: @oasis_page, status: :created, location: @oasis_page }\n format.js\n else\n format.html { render action: \"new\" }\n format.json { render json: @oasis_page.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @town_masters = TownMaster.all\n end", "def create\n @page = Page.new(page_params)\n respond_to do |format|\n if @page.save\n format.html { redirect_to page_path(@page), notice: 'Page was successfully created.' }\n format.json { render action: 'show', status: :created, location: @page }\n else\n flash[:notice] = @page.errors.full_messages.to_sentence\n format.html { render action: 'new' }\n format.json { render json: [@page.errors.full_messages.to_sentence], status: :unprocessable_entity }\n end\n end\n end", "def create\n @masterservice = Masterservice.new(masterservice_params)\n\n respond_to do |format|\n if @masterservice.save\n format.html { redirect_to @masterservice, notice: 'Masterservice was successfully created.' }\n format.json { render :show, status: :created, location: @masterservice }\n else\n format.html { render :new }\n format.json { render json: @masterservice.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @mypage = Mypage.new(params[:mypage])\n\n respond_to do |format|\n if @mypage.save\n format.html { redirect_to @mypage, notice: 'Mypage was successfully created.' }\n format.json { render json: @mypage, status: :created, location: @mypage }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mypage.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @static_page = StaticPage.new(params[:static_page])\n\n respond_to do |format|\n if @static_page.save\n format.html { redirect_to @static_page, notice: 'Static page was successfully created.' }\n format.json { render json: @static_page, status: :created, location: @static_page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @static_page.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @static_page = StaticPage.new(params[:static_page])\n\n respond_to do |format|\n if @static_page.save\n format.html { redirect_to @static_page, notice: 'Static page was successfully created.' }\n format.json { render json: @static_page, status: :created, location: @static_page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @static_page.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @page = Page.new(params[:page])\n flash[:notice] = \"Page successfully created\" if @page.save\n respond_with(@page)\n end", "def create\n @page = Page.new(params[:page])\n flash[:notice] = \"Page successfully created\" if @page.save\n respond_with(@page)\n end", "def create\n url = params['url']\n doc = Crawl::PageHandler.fetch_page(url)\n page_data = Crawl::PageHandler.parse_page(url, doc)\n page = Page.create(url: url,\n chksum: Zlib.crc32(url),\n parsed: page_data.to_json)\n render json: { url: page[:url],\n chksum: page[:chksum],\n parsed: page[:parsed] }\n end", "def create\n @pages_group = PagesGroup.new(pages_group_params)\n respond_to do |format|\n if @pages_group.save\n format.html { redirect_to @pages_group, notice: 'Pages group was successfully created.' }\n format.json { render :show, status: :created, location: @pages_group }\n else\n format.html { render :new }\n format.json { render json: @pages_group.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @enq_page = EnqPage.new(params[:enq_page])\n\n respond_to do |format|\n if @enq_page.save\n format.html { redirect_to @enq_page, notice: 'Enq page was successfully created.' }\n format.json { render json: @enq_page, status: :created, location: @enq_page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @enq_page.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @page = Page.new(page_params)\n\n respond_to do |format|\n if @page.save\n# format.html { redirect_to @page, notice: 'Page was successfully created.' }\n# format.json { render :show, status: :created, location: @page }\n format.html { redirect_to edit_page_path(@page), notice: 'Page was successfully created.' }\n format.json { render :show, status: :created, location: edit_page_path(@page) }\n else\n format.html { render :new }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\r\n @page = Page.new\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @page }\r\n end\r\n end", "def create\n #@parent_page = Page.find(params[:page][:parent_id])\n \n @page = Page.new(params[:page])\n #@page.move_to_child_of(@parent_page)\n \n respond_to do |wants|\n if @page.save\n flash[:notice] = 'Страница успешно создана.'\n wants.html { redirect_to(admin_pages_url) }\n wants.xml { render :xml => @page, :status => :created, :location => @page }\n else\n wants.html { render :action => \"new\" }\n wants.xml { render :xml => @page.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n @masters = Master.all\n end", "def site_page_params\n\n params.require(:site_page).permit(:title, :slug, :content, :status, :metatitle, :metakeywords, :metadescription, :api_key)\n end", "def create\n @page = Page.new(params[:page])\n\n respond_to do |format|\n if @page.save\n # format.html { redirect_to @page, notice: 'Page was successfully created.' }\n # format.json { render json: @page, status: :created, location: @page }\n\n format.html { redirect_to action: \"edit\", id: @page.id, notice: 'Page was successfully created.' }\n format.json { head :no_content }\n\n\n else\n format.html { render action: \"new\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @page = Page.new(page_params)\n respond_to do |format|\n begin\n if @page.save\n flash[:success] = 'Page was successfully created.'\n format.html { redirect_to admin_page_url(@page) }\n format.json { render :show, status: :created, location: @page }\n else\n format.html { render :new }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n rescue Exception => e \n flash[:danger] = \"Oops! Something went wrong: #{e.message}\"\n format.html { render :new }\n end\n end\n end", "def create\n @long_page = LongPage.new(long_page_params)\n\n respond_to do |format|\n if @long_page.save\n format.html { redirect_to @long_page, notice: 'Long page was successfully created.' }\n format.json { render :show, status: :created, location: @long_page }\n else\n format.html { render :new }\n format.json { render json: @long_page.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @page = Page.new(params[:page])\n \n\n respond_to do |format|\n if @page.save\n @page.update_attribute('published_at', Time.now) if params[:commit] == 'Publish'\n \n if params[:commit] == 'Publish'\n format.html { redirect_to root_page_path(@page), notice: 'Page was successfully published.' }\n else\n format.html { redirect_to edit_page_path(@page), notice: 'Page was successfully created.' }\n end\n format.json { render json: @page, status: :created, location: @page, :only => [:title, :content] }\n else\n format.html { render action: \"new\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6266468", "0.60528743", "0.5970794", "0.58868665", "0.5836367", "0.5770931", "0.57577395", "0.5746898", "0.569049", "0.5682702", "0.56336886", "0.56322575", "0.5621664", "0.55991244", "0.5586411", "0.5579931", "0.55636925", "0.55626917", "0.55606896", "0.55377597", "0.55294836", "0.55176693", "0.55172294", "0.5512264", "0.5508557", "0.5505683", "0.55016917", "0.5501632", "0.5501632", "0.5501632", "0.5501632", "0.5501632", "0.5501632", "0.5501318", "0.54987884", "0.54935634", "0.54753757", "0.5473665", "0.5473665", "0.5473665", "0.547084", "0.54694325", "0.54664725", "0.54512733", "0.54473746", "0.54473746", "0.5446267", "0.5441593", "0.5436484", "0.54245716", "0.5421903", "0.5413541", "0.54123056", "0.54076", "0.54070646", "0.5405854", "0.5400634", "0.53903204", "0.5376888", "0.5374864", "0.5374359", "0.5350978", "0.5348867", "0.5343431", "0.53421545", "0.5339065", "0.53370583", "0.533624", "0.53352785", "0.5314928", "0.5304081", "0.52954036", "0.52805185", "0.52792966", "0.52685875", "0.5265848", "0.5259504", "0.5256935", "0.52562356", "0.5247127", "0.5236191", "0.52306175", "0.522028", "0.521123", "0.52058315", "0.52058315", "0.5205439", "0.5205439", "0.51997733", "0.5168516", "0.51654524", "0.515426", "0.51377815", "0.51332057", "0.5128903", "0.51140225", "0.5109067", "0.51090384", "0.5108099", "0.51058656" ]
0.7136485
0
PATCH/PUT /pagemasters/1 PATCH/PUT /pagemasters/1.json
def update respond_to do |format| if @pagemaster.update(pagemaster_params) format.html { redirect_to @pagemaster, notice: 'Pagemaster was successfully updated.' } format.json { render :show, status: :ok, location: @pagemaster } else format.html { render :edit } format.json { render json: @pagemaster.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @page = Page.find(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.json { head :no_content }\n format.xml { head :no_content }\n else\n format.json { render json: @page.errors, status: :unprocessable_entity }\n format.xml { render xml: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @page = current_cms.pages.find(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:big_cms_page])\n format.html { render :action => \"edit\" }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @page.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @page = current_site.pages.find(params[:id])\n @site = @page.site\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to(@page, :notice => 'Page was successfully updated.') }\n format.json { respond_with_bip(@page) }\n else\n format.html { render :action => \"edit\" }\n format.json { respond_with_bip(@page) }\n end\n end\n end", "def update\n @page = Page.find(params[:page][:id])\n if current_user.id != @page.owner_id\n not_found\n end\n @page.partial_update(params)\n respond_to do |format|\n format.json {\n render partial: 'pages/page.json'\n }\n end\n end", "def update\n @sync_page = SyncPage.find(params[:id])\n\n respond_to do |format|\n if @sync_page.update_attributes(params[:sync_page])\n format.html { redirect_to @sync_page, notice: 'Sync page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sync_page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @page = Page.find(params[:id])\n @page.update_attributes(params[:page])\n respond_with(@page)\n end", "def update\n @page = Page.find(params[:id])\n @page.update_attributes(params[:page])\n respond_with(@page, :status => :updated)\n end", "def update\n @page = Page.friendly.find(params[:id])\n\n respond_to do |format|\n if @page.update(page_params)\n format.html { redirect_to [:admin, @page], notice: 'Page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @page = Page.find(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to pages_path, sucess: 'Page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @page.update(page_params)\n format.html { redirect_to all_pages_path(:magazine_id=>@page.magazine_id), notice: 'Page was successfully updated.' }\n format.json { render :show, status: :ok, location: @page }\n else\n format.html { render :edit }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @page = current_site.pages.find_by_permalink(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to quick_page_path(@page), notice: 'Page was successfully updated.' }\n format.json { head :no_content }\n format.js\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end", "def update\n # @page = Page.new(page_params)\n\n # @page.components.build\n # @page.update\n respond_to do |format|\n if @page.update(page_params)\n format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n format.json { render :show, status: :ok, location: @page }\n else\n format.html { render :edit }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @page = Page.find(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @page = Page.find(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @nested_page = Nested::Page.find(params[:id])\n\n respond_to do |format|\n if @nested_page.update_attributes(params[:nested_page])\n format.html { redirect_to @nested_page, notice: 'Page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @nested_page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @page.update_attributes(params[:page])\n respond_with(@page)\n else\n respond_with(@page)\n end\n end", "def update\n @page = Page.find(params[:id])\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @page = Page.find(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to pages_path, notice: 'Page was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @page = Page.find(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @page = Page.find(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if page_params[:body]\n @page.versions << Version.new(body: page_params[:body], title: page_params[:title]).save\n page_params.delete :body\n end\n respond_to do |format|\n if @page.update(page_params)\n format.html { redirect_to controller: \"pages\", action: \"show\", slug: @page[:page_slug], notice: 'Page was successfully updated.' }\n format.json { render :show, status: :ok, location: @page }\n else\n format.html { render :edit }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @page = Page.find(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to page_path(@page), notice: 'Page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @page.update(page_params)\n format.html { redirect_to admin_subject_pages_path, notice: 'Page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @page = Page.find(params[:id])\n respond_to do |format|\n if @page.update(page_params)\n format.html { redirect_to @page, notice: \"Page was successfully updated. #{undo_link}\" }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n #find the page with given id\n @page = Page.find(params[:id])\n\n #use updated_at manually, it will update the page table if user hits update button.\n # This may not be trivial, so it may change.\n @page.updated_at = Time.now\n\n #retrieving layout id from params and assigning to a variable\n @layout = @page[:layout_id]\n\n # calling method to find all pages and page parts\n find_pages_and_parts(@layout)\n\n #sends in data in different format\n respond_to do |format|\n\n if @page.update_attributes(params[:page]) #page updated successfully\n\n format.html { redirect_to admin_pages_path, notice: 'Page was successfully updated.' }\n format.json { head :no_content }\n\n else #page saving failed, re-renders edit template\n\n format.html { render action: \"edit\", :template => 'mcms_pages/admin/pages/edit' }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n\n end # end if\n\n end # end respond_to block\n\n end", "def update\n @page = Page.find(params[:id])\n\n if @page.update_attributes(params[:page])\n respond_to do |format|\n format.json {render json: @page, status: :created }\n format.xml {render xml: @page, status: :created}\n end\n \n else\n respond_to do |format|\n format.json {render json: @page.errors, status: :unprocessable_entity}\n format.xml {render xml: @page.errors, status: :unprocessable_entity}\n end\n end\n end", "def update\n respond_to do |format|\n if @master.update(master_params)\n format.html { redirect_to @master, notice: 'Master was successfully updated.' }\n format.json { render :show, status: :ok, location: @master }\n else\n format.html { render :edit }\n format.json { render json: @master.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @page = Page.find(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to [:admin, @page], notice: 'Страница успешно создана.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @page = ContentPage.find(params[:id])\n respond_to do |format|\n if @page.update_attributes(params[:content_page])\n @editingPage = false\n format.html { redirect_to show_content_pages_path(@page.id), notice: 'Page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { redirect_to edit_content_pages_path(@page.id), alert: 'Unable to update Page successfully.'}\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @page = Page.find(params[:id])\n @testimonials = Testimonial.all\n \n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @page = Page.find(params[:id])\n @page.section_id = params[:section_id] unless params[:section_id].nil? \n @page.title = params[:title] unless params[:title].nil? \n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n #ormat.json { head :no_content }\n format.js\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @patch_jobs = args[:patch_jobs] if args.key?(:patch_jobs)\n end", "def update\n respond_to do |format|\n if @suburb_master.update(suburb_master_params)\n @suburb_masters = SuburbMaster.all.paginate(:page => params[:page], :per_page => 5).order('id desc')\n format.js { flash.now[:notice] = \"Suburb was successfully updated\"}\n format.html { redirect_to @suburb_master, notice: 'Suburb master was successfully updated.' }\n format.json { render :show, status: :ok, location: @suburb_master }\n else\n @city_town_masters = CityTownMaster.all\n format.js { render :edit }\n format.html { render :edit }\n format.json { render json: @suburb_master.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @structure_page = Structure::Page.find(params[:id])\n\n respond_to do |format|\n if @structure_page.update_attributes(params[:structure_page])\n format.html { redirect_to @structure_page, notice: 'Page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @structure_page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n #Render the object created or errors\n respond_to do |format|\n if @page.update(page_params)\n #Cache bust pages and updated page. With pagination we would only bust the cache of the page that was updated.\n Rails.cache.delete(\"pages\")\n Rails.cache.delete(\"page-#{@page.id}\")\n format.json { render action: 'show', status: :ok, location: api_page_url(@page) }\n else\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @page = Page.find(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n # format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n format.html { redirect_to action: \"edit\", id: params[:id], notice: 'Page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @test_page = TestPage.find(params[:id])\n\n respond_to do |format|\n if @test_page.update_attributes(params[:test_page])\n format.html { redirect_to @test_page, notice: 'Test page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @test_page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize @page_content.page, :update?\n\n respond_to do |format|\n if @page_content.update(page_content_params)\n format.json { render :show, status: :ok, location: @page_content }\n else\n format.json { render json: @page_content.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @page = @club.pages.find(params[:id])\n @page.parent_id = params[:page][:parent_id];\n @page.bns_parent_id = params[:page][:parent_id];\n respond_to do |format|\n if @page.update_attributes(params[:page])\n flash[:notice] = 'Pages was successfully updated.'\n format.html { redirect_to(admin_club_page_path(@club, @page)) }\n format.xml { head :ok }\n else\n @pagelist = @club.all_pages\n @pagelist = @club.all_pages\n @pagelist -= @page.all_children << @page\n \n @page_title = \"Editing \" + @page.title\n @site_section = \"admin\"\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @page.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @oasis_page = OasisPage.find(params[:id])\n\n respond_to do |format|\n if @oasis_page.update_attributes(params[:oasis_page])\n format.html { redirect_to @oasis_page, notice: 'Oasis page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @oasis_page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @admined_page1 = AdminedPage1.find(params[:id])\n\n respond_to do |format|\n if @admined_page1.update_attributes(params[:admined_page1])\n format.html { redirect_to @admined_page1, notice: 'Admined page1 was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admined_page1.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @crawler_template = CrawlerTemplate.find(params[:id])\n\n respond_to do |format|\n if @crawler_template.update_attributes(params[:crawler_template])\n @crawler_template.sync_mall_shop\n format.html { redirect_to crawler_templates_url, notice: 'Crawler template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @crawler_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @page = Page.find_by_slug(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n @page.update_attribute('published_at', Time.now) if params[:commit] == 'Publish'\n @page.update_attribute('published_at', nil) if params[:commit] == 'Unpublish'\n \n if params[:commit] == 'Publish'\n format.html { redirect_to root_page_path(@page), notice: 'Page was successfully published.' }\n else\n format.html { redirect_to edit_page_path(@page), notice: 'Page was successfully updated.' }\n end\n \n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @patch_deployments = args[:patch_deployments] if args.key?(:patch_deployments)\n end", "def update\n expire_page :action => :show\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cms_page.update(cms_page_params)\n format.html { redirect_to @cms_page, notice: 'Page was successfully updated.' }\n format.json { render :show, status: :ok, location: @cms_page }\n else\n format.html { render :edit }\n format.json { render json: @cms_page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @page.update(page_params)\n format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @page.update(page_params)\n format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @cms_page = CmsPage.find(params[:id])\n params[:cms_page][:parent_id] = 0 if params[:cms_page][:parent_id].blank?\n respond_to do |format|\n if @cms_page.update_attributes(params[:cms_page])\n expire_page \"/#{@cms_page.path}\"\n flash[:notice] = 'CMS Page was successfully updated.'\n format.html { redirect_to(['admin', @cms_page]) }\n format.xml { head :ok }\n else\n\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @cms_page.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cms_page.update(cms_page_params)\n format.html { redirect_to @cms_page, notice: 'Cms page was successfully updated.' }\n format.json { render :show, status: :ok, location: @cms_page }\n else\n format.html { render :edit }\n format.json { render json: @cms_page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @payment_site_master.update(payment_site_master_params)\n format.html { redirect_to @payment_site_master, notice: 'Payment site master was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render 'edit' }\n format.json { render json: @payment_site_master.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @page.update(page_params)\n format.html { redirect_to @pages_tree[(@page.id).to_s], notice: 'Page was successfully updated.' }\n format.json { render :show, status: :ok, location: @page }\n else\n format.html { render :edit }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @pharmaceutical_master.update(pharmaceutical_master_params)\n format.html { redirect_to @pharmaceutical_master, notice: UPDATE_NOTICE }\n format.json { render :show, status: :ok, location: @pharmaceutical_master }\n else\n format.html { render :edit }\n format.json { render json: @pharmaceutical_master.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @mypage = Mypage.find(params[:id])\n\n respond_to do |format|\n if @mypage.update_attributes(params[:mypage])\n format.html { redirect_to @mypage, notice: 'Mypage was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mypage.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @extra_page.update(extra_pages_params)\n format.html { redirect_to @extra_page, notice: 'Your Extra Pages were successfully updated.' }\n format.json { render :show, status: :ok, location: @extra_page }\n else\n format.html { render :edit }\n format.json { render json: @extra_page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cello_master.update(cello_master_params)\n format.html { redirect_to @cello_master, notice: 'Cello master was successfully updated.' }\n format.json { render :show, status: :ok, location: @cello_master }\n else\n format.html { render :edit }\n format.json { render json: @cello_master.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @master.update(master_params)\n session[:last_master_id] = @master.id\n format.html { redirect_to master_url(@master), notice: \"Master was successfully updated.\" }\n format.json { render :show, status: :ok, location: @master }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @master.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @pages_feature = Page.where(site_id: @site.id, published: true, feature_on_homepage: true).all\n @page_root = Page.where(site_id: @site.id).roots.all\n @title = @page.title\n respond_to do |format|\n session[:return_to] ||= request.referer\n if @page.update(page_params)\n format.html { redirect_to session.delete(:return_to), notice: 'Saved' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @page = Page.find(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to admin_pages_path, notice: 'Page bien modifiée.' }\n else\n format.html { render action: \"edit\" }\n end\n end\n end", "def update\n respond_to do |format|\n if @maker_master.update(maker_master_params)\n format.html { redirect_to @maker_master, notice: 'Maker master was successfully updated.' }\n format.json { render :show, status: :ok, location: @maker_master }\n else\n format.html { render :edit }\n format.json { render json: @maker_master.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @info_page = InfoPage.find(params[:id])\n\n respond_to do |format|\n if @info_page.update_attributes(params[:info_page])\n format.html { redirect_to admin_info_pages_path, notice: 'Info page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @info_page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @patch_job_instance_details = args[:patch_job_instance_details] if args.key?(:patch_job_instance_details)\n end", "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end", "def update\n @document_page = DocumentPage.find(params[:id])\n\n respond_to do |format|\n if @document_page.update_attributes(params[:document_page])\n format.html { redirect_to @document_page, notice: 'Document page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @document_page.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch!\n request! :patch\n end", "def update\n head :no_content\n end", "def update\n head :no_content\n end", "def update\r\n @page = Page.find(params[:id])\r\n respond_to do |format|\r\n if @page.update_attributes(params[:page])\r\n format.html { redirect_to @page, notice: 'Page was successfully updated.' }\r\n format.json { head :no_content }\r\n target = \"#{Rails.public_path}/#{@page.project_id}/#{@page.page_name}.html\"\r\n File.open(target, \"w\") do |f|\r\n f.write(@page.html)\r\n end\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @page.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n @search_page = SearchPage.find(params[:id])\n\n respond_to do |format|\n if @search_page.update_attributes(params[:search_page])\n format.html { redirect_to @search_page, notice: 'Search page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @search_page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @page_page.update(page_page_params)\n format.html { redirect_to @page_page, notice: 'Page page was successfully updated.' }\n format.json { render :show, status: :ok, location: @page_page }\n else\n format.html { render :edit }\n format.json { render json: @page_page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @page.update(admin_page_params)\n format.html { redirect_to admin_pages_url, notice: 'page was successfully updated.' }\n format.json { render :show, status: :ok, location: @page }\n else\n format.html { render :edit }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n head :ok\n end", "def update\n @book_page = @book.book_pages.find(params[:id])\n\n respond_to do |format|\n if @book_page.update_attributes(params[:book_page])\n format.html { redirect_to book_series_collection_book_book_page_url(@book_series, @collection, @book, @book_page), notice: 'Book page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book_page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @species = Species.find(params[:id])\n @species.update_attributes(params[:species])\n \n respond_with(@species, :location => admin_species_path(@species))\n end", "def update\n if @page.update_attributes(params[:page])\n respond_to do |format|\n format.json { render :json => @page }\n format.xml { render :xml => @page }\n end\n else\n respond_to do |format|\n format.json { raise Palani::Api::InvalidUpdateOfRecordJSONException }\n format.xml { raise Palani::Api::InvalidUpdateOfRecordXMLException }\n end\n end\n end", "def update\n @page = Page.find_by_slug(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n flash[:notice] = 'Page was successfully updated.'\n format.html { redirect_to @page.get_page_path }\n # format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @page.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n put :update\n end", "def update\n restrict('allow only admins') or begin\n @page = Page.find_by_stub(params[:stub]) || Page.find_by_id(params[:id])\n respond_to do |format|\n if @page.update_attributes(params[:page])\n flash[:notice] = 'Page was successfully updated.'\n format.html { redirect_to manage_pages_path }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @page.errors.to_xml }\n end\n end\n end\n end", "def update\n @mini_pago = MiniPago.find(params[:id])\n\n respond_to do |format|\n if @mini_pago.update_attributes(params[:mini_pago])\n format.html { redirect_to @mini_pago, notice: 'Mini pago was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mini_pago.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @childmaster = Childmaster.find(params[:id])\n\n respond_to do |format|\n if @childmaster.update_attributes(params[:childmaster])\n format.html { redirect_to @childmaster, notice: 'Childmaster was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @childmaster.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n #Mercury update for PageChunk (instead of the Page update stuff)\n @page_chunk = PageChunk.find(params[:page_chunk_id])\n #TODO: Not sure why \"undefined\" is a key.\n @page_chunk.content = params[:content][:undefined][:value]\n @page_chunk.save!\n\n render text: \"\"\n end", "def update\n respond_to do |format|\n if @page.update(update_page_params)\n format.html {}\n format.json {}\n\n render \"show\"\n else\n format.html { render \"show\", status: :not_acceptable }\n format.json { render json: @page.errors, status: :not_acceptable }\n end\n end\n end", "def update_master\n respond_to do |format|\n if @rider.update(rider_params)\n format.html { redirect_to master_rider_path(@rider), notice: 'Rider was successfully updated.' }\n format.json { render :show_master, status: :ok, location: @rider }\n else\n format.html { render :edit_master }\n format.json { render json: @rider.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @homepage.update(homepage_params)\n format.html { redirect_to [:phone, @homepage], notice: 'Homepage was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @homepage.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @page.update(page_params)\n Rails.application.reload_routes!\n format.html { redirect_to admin_page_path(@page), notice: 'Page was successfully updated.' }\n format.json { render :show, status: :ok, location: @page }\n else\n format.html { render :edit }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n # log\n fields = @page.fields.each do |f| f.inspect end\n register_log \"Page updated: #{@page.inspect} -- Custom type fields: #{fields}\\n\"\n end", "def update\n @page = Page.find(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to(pages_path, :notice => 'Page was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @page.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @page_chunk = PageChunk.find(params[:id])\n #TODO: Not sure why \"undefined\" is a key.\n #TODO: multiple editable section on one page not working; the content for the last\n # is always \n @page_chunk.content = params[:content][:undefined][:value]\n @page_chunk.save!\n\n render text: \"\"\n=begin\n respond_to do |format|\n if @page_chunk.update(page_chunk_params)\n format.html { redirect_to @page_chunk, notice: 'Page chunk was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @page_chunk.errors, status: :unprocessable_entity }\n end\n end\n=end\n end", "def update\n\n respond_to do |format|\n if @page_object.update_attributes(params[:page_object])\n flash[:notice] = 'PageObject was successfully updated.'\n format.html { redirect_to(@page_object) }\n format.xml { head :ok }\n format.tson { head :ok }\n else\n render_to_page_object\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @page_object, :status => :unprocessable_entity }\n format.tson { render :json => @page_object, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @page.update(page_params)\n format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n format.json { render :show, status: :ok, location: @page }\n else\n format.html { render :edit }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @page.update(page_params)\n format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n format.json { render :show, status: :ok, location: @page }\n else\n format.html { render :edit }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @page.update(page_params)\n format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n format.json { render :show, status: :ok, location: @page }\n else\n format.html { render :edit }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @page.update(page_params)\n format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n format.json { render :show, status: :ok, location: @page }\n else\n format.html { render :edit }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @pageinfo.update(pageinfo_params)\n format.html { redirect_to @pageinfo, notice: 'Pageinfo was successfully updated.' }\n format.json { render :show, status: :ok, location: @pageinfo }\n else\n format.html { render :edit }\n format.json { render json: @pageinfo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @page = Page.find(params[:id])\n \n Rails.logger.info \"ID: #{params[:id]}\"\n Rails.logger.info \"BODY: #{params[:page][:body].inspect}\"\n\n # Convert <div> line breaks to <p>\n params[:page][:body] = params[:page][:body].gsub(/\\<div\\>/, '<p>')\n params[:page][:body] = params[:page][:body].gsub(/\\<\\/div\\>/, '</p>')\n params[:page][:body] = params[:page][:body].gsub(/\\<p\\>\\<br\\>\\<\\/p\\>/, '')\n params[:page][:body] = params[:page][:body].gsub(/\\<br\\>/, '')\n \n respond_to do |format|\n if @page.update_attributes(params[:page])\n Rails.logger.info \"UPDATED PAGE!\"\n format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n format.json { render :json => @page }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @processes = args[:processes] if args.key?(:processes)\n end", "def update!(**args)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @processes = args[:processes] if args.key?(:processes)\n end", "def update\n @enq_page = EnqPage.find(params[:id])\n\n respond_to do |format|\n if @enq_page.update_attributes(params[:enq_page])\n format.html { redirect_to @enq_page, notice: 'Enq page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @enq_page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @service_type_master.update(service_type_master_params)\n format.html { redirect_to @service_type_master, notice: 'Service type master was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @service_type_master.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @page = Page.find(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to(@page, :notice => 'Page was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @page.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @page = Page.find(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to(@page, :notice => 'Page was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @page.errors, :status => :unprocessable_entity }\n end\n end\n end" ]
[ "0.62844384", "0.6203034", "0.6201689", "0.6175606", "0.61736435", "0.615435", "0.61402535", "0.60688686", "0.6041272", "0.6027496", "0.6021571", "0.602073", "0.59844893", "0.59844893", "0.59843415", "0.59802234", "0.5979805", "0.59676296", "0.5962027", "0.5962027", "0.5957186", "0.5956346", "0.5954438", "0.5928764", "0.59133744", "0.5913155", "0.591093", "0.5901548", "0.5892986", "0.58769476", "0.5856969", "0.5850356", "0.58501077", "0.584357", "0.5838507", "0.58383155", "0.58255166", "0.5817772", "0.5801525", "0.57985485", "0.57905346", "0.57830495", "0.57817763", "0.5781217", "0.57788277", "0.57751954", "0.5770511", "0.5770511", "0.5765973", "0.575467", "0.5749562", "0.574407", "0.572655", "0.57241994", "0.5708476", "0.57056725", "0.56959873", "0.5692067", "0.56861734", "0.56829625", "0.568218", "0.5661463", "0.56532633", "0.56407773", "0.56286806", "0.5623612", "0.5623612", "0.56194466", "0.5614381", "0.5605621", "0.55978304", "0.5595034", "0.5593625", "0.559262", "0.5587608", "0.5584735", "0.5583456", "0.5582073", "0.55803347", "0.55766064", "0.55756474", "0.557154", "0.5568933", "0.5561581", "0.55594903", "0.5540052", "0.55396336", "0.55315137", "0.5530109", "0.5530109", "0.5530109", "0.5530109", "0.5525333", "0.5521451", "0.5519286", "0.5519286", "0.5518927", "0.55161726", "0.55100435", "0.55100435" ]
0.68065405
0
DELETE /pagemasters/1 DELETE /pagemasters/1.json
def destroy @pagemaster.destroy respond_to do |format| format.html { redirect_to pagemasters_url, notice: 'Pagemaster was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @pharmaceutical_master.destroy\n respond_to do |format|\n format.html { redirect_to pharmaceutical_masters_url, notice: DELETE_NOTICE }\n format.json { head :no_content }\n end\n end", "def delete_page(id)\n @client.raw('delete', \"/content/pages/#{id}\")\n end", "def destroy\n @page = Page.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_pages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sync_page = SyncPage.find(params[:id])\n @sync_page.destroy\n\n respond_to do |format|\n format.html { redirect_to sync_pages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @page = Page.friendly.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_pages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admined_page1 = AdminedPage1.find(params[:id])\n @admined_page1.destroy\n\n respond_to do |format|\n format.html { redirect_to admined_page1s_url }\n format.json { head :ok }\n end\n end", "def destroy\n return if new_record?\n \n @api.delete \"/items/#{shortcode_url}.json\"\n end", "def destroy\n @page.destroy\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @page = Page.find_by_slug(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { head :ok }\n end\n end", "def destroy\n @page = Page.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n format.xml { head :no_content }\n end\n end", "def destroy\n @childmaster = Childmaster.find(params[:id])\n @childmaster.destroy\n\n respond_to do |format|\n format.html { redirect_to childmasters_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @hot_master.destroy\n respond_to do |format|\n format.html { redirect_to hot_masters_url, notice: DELETE_NOTICE }\n format.json { head :no_content }\n end\n end", "def destroy\n @page.destroy\n respond_to do |format|\n format.html { redirect_to all_pages_path(:magazine_id=>@page.magazine_id), notice: 'Page was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @payment_site_master.destroy\n respond_to do |format|\n format.html { redirect_to payment_site_masters_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_page = TestPage.find(params[:id])\n @test_page.destroy\n\n respond_to do |format|\n format.html { redirect_to test_pages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @oasis_page = OasisPage.find(params[:id])\n @oasis_page.destroy\n\n respond_to do |format|\n format.html { redirect_to oasis_pages_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @page = current_site.pages.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to edit_site_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @structure_page = Structure::Page.find(params[:id])\n @structure_page.destroy\n\n respond_to do |format|\n format.html { redirect_to structure_pages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @page = Page.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to pages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @page = Page.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to pages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @page = Page.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to pages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @page = Page.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to pages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @page = Page.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to pages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @page = Page.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to pages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @page = Page.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to pages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @page = Page.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to pages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cms_page.destroy\n respond_to do |format|\n format.html { redirect_to cms_pages_url, notice: \"#{@cms_page.title} has been deleted.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @page = Page.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to pages_url }\n format.json { head :ok }\n end\n end", "def destroy\n @page = Page.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to pages_url }\n format.json { head :ok }\n end\n end", "def destroy\n @page = Page.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to pages_url }\n format.json { head :ok }\n end\n end", "def destroy\n @page.destroy\n respond_to do |format|\n format.html { redirect_to pages_url, :notice => \"Successfully deleted page. #{undo_link}\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @page = Page.find(params[:id])\n @page.destroy\n\n head :no_content\n end", "def destroy\n @microsite.destroy\n respond_to do |format|\n format.html { redirect_to microsites_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @page.destroy\n respond_to do |format|\n format.html { redirect_to pages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @page.destroy\n respond_to do |format|\n format.html { redirect_to pages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @page.destroy\n respond_to do |format|\n format.html { redirect_to pages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @page.destroy\n respond_to do |format|\n format.html { redirect_to pages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mypage = Mypage.find(params[:id])\n @mypage.destroy\n\n respond_to do |format|\n format.html { redirect_to mypages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cms_page.destroy\n respond_to do |format|\n format.html { redirect_to cms_pages_url, notice: 'Cms page was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @service_type_master.destroy\n respond_to do |format|\n format.html { redirect_to service_type_masters_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @page = current_cms.pages.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to(big_cms_pages_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @nested_page = Nested::Page.find(params[:id])\n @nested_page.destroy\n\n respond_to do |format|\n format.html { redirect_to nested_pages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_metum.destroy\n respond_to do |format|\n format.html { redirect_to test_meta_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cms_page.destroy\n respond_to do |format|\n format.html { redirect_to cms_pages_url, notice: 'Page was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @page = @chapter.pages.find_by_number(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to manga_chapter_url(@manga, @chapter) }\n format.json { head :no_content }\n end\n end", "def destroy\n @metum.destroy\n respond_to do |format|\n format.html { redirect_to meta_url }\n format.json { head :no_content }\n end\n end", "def delete\n urlMaster = Urlmaster.find(params[:id])\n urlMaster.destroy\n\n if urlMaster\n redirect_to crawler_path\n end\n end", "def destroy\n @master.destroy\n\n respond_to do |format|\n format.html { redirect_to masters_url, notice: \"Master was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @consultant_master = ConsultantMaster.find(params[:id])\n @consultant_master.destroy\n\n respond_to do |format|\n format.html { redirect_to consultant_masters_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @page.destroy\n respond_to do |format|\n format.json { render :json => @page }\n format.xml { render :xml => @page }\n end\n end", "def destroy\n @page.destroy\n respond_to do |format|\n format.html { redirect_to admin_pages_url, notice: 'Страница успешно удалена!' }\n format.json { head :no_content }\n end\n end", "def destroy\n @charge_master = ChargeMaster.find(params[:id])\n @charge_master.destroy\n\n respond_to do |format|\n format.html { redirect_to charge_masters_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @landing_page.destroy\n respond_to do |format|\n format.html { redirect_to admin_landing_pages_url, error: I18n.t('admin.basic.messages.deleted', model: 'Landing Page') }\n format.json { head :no_content }\n end\n end", "def destroy\n @static_page = StaticPage.find(params[:id])\n @static_page.destroy\n\n respond_to do |format|\n format.html { redirect_to static_pages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @static_page = StaticPage.find(params[:id])\n @static_page.destroy\n\n respond_to do |format|\n format.html { redirect_to static_pages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @static_page = StaticPage.find(params[:id])\n @static_page.destroy\n\n respond_to do |format|\n format.html { redirect_to static_pages_url }\n format.json { head :ok }\n end\n end", "def destroy\n @master_memorial.destroy\n respond_to do |format|\n format.html { redirect_to master_memorials_url, notice: 'Memorial was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @master.destroy\n respond_to do |format|\n format.html { redirect_to masters_url, notice: 'Master was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_page.destroy\n respond_to do |format|\n format.html { redirect_to admin_pages_url, notice: 'Page was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n\n # find the page with with\n @page = Page.find(params[:id])\n\n # calling class method of PagePart model to delete page parts of a page\n PagePart.delete_page_parts(@page)\n\n #destroy the page\n @page.destroy\n\n #sends in data in different format to index action\n respond_to do |format|\n\n format.html { redirect_to admin_pages_url }\n format.json { head :no_content }\n\n end # end respond_to block\n\n end", "def destroy\n @test_meta_datum.destroy\n respond_to do |format|\n format.html { redirect_to test_meta_data_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @metum = Metum.find(params[:id])\n @metum.destroy\n\n respond_to do |format|\n format.html { redirect_to meta_url }\n format.json { head :ok }\n end\n end", "def destroy\n @page_page.destroy\n respond_to do |format|\n format.html { redirect_to page_pages_url, notice: 'Page page was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @page_chunk.destroy\n respond_to do |format|\n format.html { redirect_to page_chunks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @pageview.destroy\n respond_to do |format|\n format.html { redirect_to pageviews_url }\n format.json { head :no_content }\n end\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def destroy\n @manga = Manga.find(params[:id])\n @manga.destroy\n\n respond_to do |format|\n format.html { redirect_to mangas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_page = Page.find(params[:id])\n @admin_page.destroy\n\n respond_to do |format|\n format.html { redirect_to(pages_url) }\n end\n end", "def destroy\n @cms_page_section.destroy\n respond_to do |format|\n format.html { redirect_to cms_page_sections_url, notice: 'Page section was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @town_master.destroy\n respond_to do |format|\n format.html { redirect_to town_masters_url, notice: \"Town master was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def delete; rest_delete(link('self')); end", "def delete; rest_delete(link('self')); end", "def destroy\n @mini_pago = MiniPago.find(params[:id])\n @mini_pago.destroy\n\n respond_to do |format|\n format.html { redirect_to mini_pagos_url }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @page = Page.find(params[:id])\r\n @page.destroy\r\n File.delete(\"#{Rails.public_path}/#{@page.project_id}/#{@page.page_name}.html\")\r\n respond_to do |format|\r\n format.html { redirect_to pages_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def delete\n delete_from_server single_url\n end", "def destroy\n @testmonial.destroy\n\n head :no_content\n end", "def destroy\n @childmaster = Childmaster.find(params[:id])\n @childmaster.destroy\n\n respond_to do |format|\n format.html { redirect_to(childmasters_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @page.destroy\n respond_to do |format|\n format.html { redirect_to pages_url, notice: 'Page was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @page.destroy\n respond_to do |format|\n format.html { redirect_to pages_url, notice: 'Page was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @page.destroy\n respond_to do |format|\n format.html { redirect_to pages_url, notice: 'Page was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @page.destroy\n respond_to do |format|\n format.html { redirect_to pages_url, notice: 'Page was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @page.destroy\n respond_to do |format|\n format.html { redirect_to pages_url, notice: 'Page was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @page.destroy\n respond_to do |format|\n format.html { redirect_to pages_url, notice: 'Page was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @page.destroy\n respond_to do |format|\n format.html { redirect_to pages_url, notice: 'Page was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @page.destroy\n respond_to do |format|\n format.html { redirect_to pages_url, notice: 'Page was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @page = Page.find(params[:id])\n @page.destroy\n respond_with(@page, :status => :deleted, :location => pages_path)\n end", "def delete\n client.delete(url)\n @deleted = true\nend", "def destroy\n @memorizationpage.destroy\n respond_to do |format|\n format.html { redirect_to memorizationpages_url, notice: 'Memorizationpage was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @page_fetch = PageFetch.find(params[:id])\n @page_fetch.destroy\n\n respond_to do |format|\n format.html { redirect_to(page_fetches_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @nodo.destroy\n respond_to do |format|\n format.html { redirect_to nodos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ac_master.destroy\n respond_to do |format|\n format.html { redirect_to ac_masters_url, notice: 'Ac master was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @crawl_request = CrawlRequest.find(params[:id])\n @crawl_request.destroy\n\n head :no_content\n end", "def destroy\n @crawl_request = CrawlRequest.find(params[:id])\n @crawl_request.destroy\n\n head :no_content\n end", "def destroy\n @cephalopod.destroy\n respond_to do |format|\n format.html { redirect_to cephalopods_url }\n format.json { head :no_content }\n end\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end" ]
[ "0.71098185", "0.70382106", "0.69768494", "0.6946361", "0.69462955", "0.6938194", "0.6883078", "0.6880598", "0.6878404", "0.6878228", "0.6860168", "0.6841834", "0.68235165", "0.6822673", "0.68214947", "0.6820508", "0.6813039", "0.6797299", "0.67955667", "0.6789765", "0.6789765", "0.6789765", "0.6789765", "0.6789765", "0.6789765", "0.6789765", "0.6789765", "0.6786078", "0.6785002", "0.6785002", "0.6785002", "0.6779362", "0.677411", "0.675888", "0.6757704", "0.6757704", "0.6757704", "0.6757704", "0.67451006", "0.67440385", "0.6720238", "0.6719961", "0.6717575", "0.6715804", "0.67156637", "0.67106473", "0.67064667", "0.6703588", "0.6671865", "0.6668684", "0.66686225", "0.6667089", "0.66634035", "0.66598624", "0.66567236", "0.66567236", "0.6651416", "0.66513723", "0.6645956", "0.66424286", "0.6640296", "0.6628974", "0.66252583", "0.6604291", "0.66026026", "0.65975314", "0.659584", "0.659584", "0.659584", "0.659584", "0.65928614", "0.6590063", "0.65862", "0.6585384", "0.65799224", "0.65799224", "0.6579856", "0.65780574", "0.6574258", "0.65722495", "0.65713394", "0.6571139", "0.6571139", "0.6571139", "0.6571139", "0.6571139", "0.6571139", "0.6571139", "0.6571139", "0.65686524", "0.6567442", "0.65655935", "0.65644485", "0.6563883", "0.6559861", "0.6559769", "0.6559769", "0.65569675", "0.65548605", "0.65548605" ]
0.7490353
0
Use callbacks to share common setup or constraints between actions.
def set_pagemaster @pagemaster = Pagemaster.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 pagemaster_params #params.require(:pagemaster).permit(: params.fetch(:pagemaster, {}) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def valid_params_request?; end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def safe_params\n params.require(:user).permit(:name)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def active_code_params\n params[:active_code].permit\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def filtering_params\n params.permit(:email)\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def filter_parameters; end", "def filter_parameters; end", "def list_params\n params.permit(:name)\n end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def url_whitelist; end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def permit_request_params\n params.permit(:address)\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def 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 backend_user_params\n params.permit!\n end", "def url_params\n params[:url].permit(:full)\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "0.6980629", "0.67819995", "0.67467666", "0.67419875", "0.67347664", "0.65928614", "0.6504013", "0.6498014", "0.64819515", "0.64797956", "0.64562726", "0.64400834", "0.6380117", "0.6377456", "0.63656694", "0.6320543", "0.63002014", "0.62997127", "0.629425", "0.6293866", "0.62909746", "0.62904227", "0.62837297", "0.6240993", "0.6239739", "0.6217764", "0.6214983", "0.62112504", "0.6194765", "0.6178", "0.61755055", "0.61729854", "0.61636627", "0.6153461", "0.6151674", "0.61478525", "0.6122671", "0.61188513", "0.61075556", "0.6105721", "0.6092412", "0.6081011", "0.6071054", "0.6064436", "0.6022111", "0.6018135", "0.60151577", "0.60108894", "0.60070235", "0.60070235", "0.6000806", "0.6000464", "0.5998811", "0.59926987", "0.5992257", "0.5991173", "0.5980311", "0.59660876", "0.59596545", "0.5959415", "0.59589994", "0.5957478", "0.5953214", "0.5952233", "0.5944033", "0.59396756", "0.59396756", "0.59386414", "0.59345603", "0.5931261", "0.5926345", "0.5925795", "0.59174526", "0.59108645", "0.5909469", "0.5908263", "0.59053195", "0.58980685", "0.5897738", "0.589657", "0.5895971", "0.58942044", "0.5892847", "0.588742", "0.58834344", "0.5880024", "0.58739793", "0.5868253", "0.5867907", "0.58670515", "0.58668053", "0.5865756", "0.5863549", "0.5863236", "0.5862728", "0.5861283", "0.58591247", "0.5855159", "0.5854291", "0.58512247", "0.58498096" ]
0.0
-1
Save current user information
def current_user @current_user = User.find(session[:user_id]) if session[:user_id] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_user_info\n if current_user\n cookies[:provider] = current_user.provider\n cookies[:current_institution] = current_institution.code.downcase\n end\n end", "def set_user_info\n @user_info = UserInfo.find_by_user_id(session[:user_id])\n if (@user_info == nil)\n @user_info = UserInfo.new(:user_id =>session[:user_id]).save\n end\n end", "def store_user\n data = load_data\n user_details = {\n 'id' => @user.uid.to_s,\n 'username' => @user.username,\n 'password' => @user.password,\n 'playlist' => @user.playlist,\n 'mylist' => @user.mylist\n }\n data << user_details\n write_user(data)\n end", "def save\n\t\t\tis_new = params[:user][:id].blank?\n\n # Get user\n\t\t\tuser = is_new ? User.new : User.find(params[:user][:id])\n\n # Author\n if is_new\n authorize! :create, User\n else\n authorize! :edit, user\n end\n\n # Save\n\t\t\tresult = user.save_with_params params[:user]\n\t\t\t\n\t\t\t# If error\n\t\t\treturn render json: result if result[:status] != 0\n\n\t\t\t# If signup\n\t\t\tif is_new\n\t\t\t\t# session_info = SessionInfo.find session[:session_info_id]\n\t\t\t\t# session_info.leave_infos ||= []\n\t\t\t\t# session_info.leave_infos << ['user', user.id]\n\t\t\t\t# session_info.save\n\n\t\t\t\t# Log\n\t\t\t\tLog.create(\n\t\t\t\t\tobject_type: 'user',\n\t\t\t\t\tobject_id: user.id,\n\t\t\t\t\taction: 'create'\n\t\t\t\t)\n\t\t\t\t\n\t\t\t\t# Delete contact\n\t\t\t\t# if contact.present?\n\t\t\t\t# \tcontact.update is_deleted: true\n\t\t\t\t# end\n\t\t\tend\n\n\t\t\t# Send active mail\n\t\t\tcase user.active_status\n\t\t\twhen 1\n\t\t\t\tUserMailer.active_account(user).deliver_later\n\t\t\twhen 2\n\t\t\t\tUserMailer.active_old_email(user).deliver_later\n\t\t\tend\n\n\t\t\trender json: { status: 0, result: user.id, email_changed: result[:email_changed] }\n\t\tend", "def set_user\n UserInfo.current_user = session[:user]\n end", "def update_current_user(user)\n @current_user = user\n @current_user\n end", "def save_information\n\t\t#Is user logged in?\n\t\trender :json=>{:success=>false, :msg=>'User not logged in.'} and return if @user.nil?\n\t\t\n\t\t#Check information\n\t\trender :json=>{:success=>false, :msg=>'Data error. Please refresh the page and try again.'} and return if (!params.has_key?(:information))\n\t\t\n\t\t#Set user information\n\t\tparams[:information].each do |keyval|\n\t\t\t@user[(keyval[0].to_sym)] = keyval[1]\n\t\tend\n\t\t@user.save\n\t\t\n\t\t#Change password?\n\t\tif (params.has_key?(:password))\n\t\t\tif (!params[:password][:old_password].empty? || !params[:password][:new_password].empty?)\n\t\t\t\t#Check old password\n\t\t\t\tuser = User.check_credentials({:email=>@user.email, :password=>params[:password][:old_password]})\n\t\t\t\trender :json=>{:success=>false, :msg=>'Your old password does not match.'} and return if user.nil?\n\t\t\t\t\n\t\t\t\t@user.set_password(params[:password][:new_password])\n\t\t\t\t\n\t\t\t\trender :json=>{:success=>true, :msg=>'Password changed.'} and return\n\t\t\tend\n\t\tend\n\t\t\n\t\trender :json=>{:success=>true, :msg=>'Information saved.'}\n\tend", "def update_current_user(user)\n @current_user = user if user\n end", "def save\n REDIS.set @user.delete(:key), @user.to_json\n @user # NOTE: SET can't fail (http://redis.io/commands/set)\n end", "def current_user=(user)\n session[:user_uid] = user.uid\n session[:user_nickname] = user.nickname\n end", "def current_user=(user)\n session[:user_uid] = user.uid\n session[:user_nickname] = user.nickname\n end", "def save\n vals = to_h\n vals.delete(:username)\n vals.delete_if { |_k, v| v.nil? || v.to_s.empty? }\n vals[:password] = vals.delete(:newpassword) if vals[:newpassword]\n payload = Gyoku.xml(user: vals)\n response = CoachClient::Request.put(url, username: @username,\n password: @password,\n payload: payload,\n content_type: :xml)\n unless response.code == 200 || response.code == 201\n fail CoachClient::NotSaved.new(self), 'Could not save user'\n end\n @password = vals[:password]\n @newpassword = nil\n self\n end", "def save\n\t\tbegin\n\t\t\tuser_profile = self.profile\n\t\t\tUser.create(\n\t\t\t\t:user_id => id,\n\t\t\t\t:login_name => username,\n\t\t\t\t:email => email,\n\t\t\t\t:join_tsz => created,\n\t\t\t\t:transaction_buy_count => user_profile.transaction_buy_count,\n\t\t\t\t:transaction_sold_count => user_profile.transaction_sold_count,\n\t\t\t\t:is_seller => user_profile.is_seller,\n\t\t\t\t:location => user_profile.lon ? [user_profile.lon, user_profile.lat] : nil,\n\t\t\t\t:image_url => user_profile.image,\n\t\t\t\t:country_id => user_profile.country_id,\n\t\t\t\t:gender => user_profile.gender,\n\t\t\t\t:oauth_token => nil,\n\t\t\t\t:oauth_token_secret => nil,\n\t\t\t\t:authenticated => false,\n\t\t\t\t:shop_id => @shop_id\n\t\t\t)\n\t\trescue NoMethodError\n\t\t\t# fairly rare at this point.\n\t\t\tputs \"associated_profile bug\"\n\t\tend\n\tend", "def current_user=(user)\n\t\t@current_user = user\n \tend", "def serialiaze\n Logger.d(\"Serializing the User object\")\n save_to_shared_prefs(@context, self.class, self)\n end", "def current_user=(user)\r\n @current_user = user\r\n end", "def cdb_save\n cdb_set_password( @new_password, @confirm_new_password ) if @new_password\n @new_password, @confirm_new_password = nil, nil # Just to ensure that we don't save them!\n results = couchdb.store(\"webui_user\", @name, self)\n @couchdb_rev = results[\"rev\"]\n results\n end", "def save_finish_registration\n if current_user.update(params.require(:user).permit(:birthdate, :biography, :sex, :phone_number, :country, :country_code).merge(is_newbie: false))\n extract_hash_tags_from_params\n flash['notice_persist'] = \"Hello #{current_user.full_name}, welcome to our community. Please check your inbox.\"\n redirect_to news_feed_dashboard_users_path\n else\n render 'finish_registration'\n end\n end", "def save_user(user)\n contact = find(user.id)\n\n mapper.save(contact, user.attributes)\n end", "def current_user=(user)\n @current_user = user\n end", "def save\n # Convert hash to JSON\n self_json = {email: @email, name: @name, permissions: @permissions}.to_json\n #Open the file and append the JSON to the file\n open('users.json', 'a') do |file|\n file.puts self_json\n end\n end", "def hubssolib_current_user=(new_user)\n hubssolib_set_user_data(new_user)\n end", "def current_user=(user)\n @current_user = user \n end", "def save(user)\n if valid?\n user.update(Hash[ATTRIBUTES.map { |attribute_name| [attribute_name, send(attribute_name.to_sym)] }])\n end\n end", "def saveDataToDisk\n # Save the values of each input\n [:loginInput, :passwordInput].each do |attr|\n self.user.send(attr, self.instance_variable_get(\"@\"+attr.to_s).stringValue)\n end\n self.user.updateEvery = Controller.getOptionValue(@updateEvery.titleOfSelectedItem)\n self.user.menuBarCheckbox = @menuBarCheckbox.state == NSOnState\n \n print \"Saving user data to disk: #{self.user.getData.inspect}\\n\"\n NSKeyedArchiver.archiveRootObject_toFile_(self.user.getData, pathForDataFile)\n end", "def current_user=(user)\n \t#sets an instance variable @current_user, effectively storing the user for later use\n @current_user = user\n end", "def current_user=(user)\n @current_user = user\n\tend", "def current_user=(user)\n\t\t@current_user = user\n end", "def set_user\r\n @user = current_user\r\n end", "def current_user=(new_user)\n session[:user_id] = new_user.id\n @current_user = new_user\n end", "def current_user=(user)\n @current_user = user\n session[:user_id] = user.id\n end", "def current_user=(user)\n\t\t@current_user = user\n\tend", "def current_user=(user)\n\t\t@current_user = user\n\tend", "def current_user=(user)\n\t\t@current_user = user\n\tend", "def current_user=(user)\n\t\t@current_user = user\n\tend", "def current_user=(user)\n\t\t@current_user = user\n\tend", "def current_user=(user)\n\t\t@current_user = user\n\tend", "def current_user=(user)\n\t\t@current_user = user\n\tend", "def current_user=(user)\n\t\t@current_user = user\n\tend", "def current_user=(user)\n\t\t@current_user = user\n\tend", "def current_user=(user)\n\t\t@current_user = user\n\tend", "def set_user\n @user = current_user \n end", "def current_user=(user)\n @current_user = user \n end", "def current_user=(user)\n @current_user = user\n end", "def current_user=(user)\n @current_user = user\n end", "def current_user=(user)\n @current_user = user\n end", "def current_user=(user)\n @current_user = user\n end", "def current_user=(user)\n @current_user = user\n end", "def current_user=(user)\n @current_user = user\n end", "def current_user=(user)\n @current_user = user\n end", "def current_user=(user)\n @current_user = user\n end", "def current_user=(user)\n @current_user = user\n end", "def current_user=(user)\n @current_user = user\n end", "def current_user=(user)\n @current_user = user\n end", "def current_user=(user)\n @current_user = user\n end", "def current_user=(user)\n @current_user = user\n end", "def current_user=(user)\n @current_user = user\n end", "def current_user=(user)\n @current_user = user\n end", "def current_user=(user)\n @current_user = user\n end", "def current_user=(user)\n @current_user = user\n end", "def current_user=(user)\n @current_user = user\n end", "def current_user=(user)\n @current_user = user\n end", "def current_user=(user)\n @current_user = user\n end", "def current_user=(user)\n @current_user = user\n end", "def current_user=(user)\n @current_user = user\n end", "def current_user=(user)\n @current_user = user\n end", "def current_user=(user)\n @current_user = user\n end", "def current_user=(user)\n @current_user = user\n end", "def current_user=(user)\n @current_user = user\n end", "def current_user=(user)\n @current_user = user\n end", "def current_user=(user)\n @current_user = user\n end", "def current_user=(user)\n @current_user = user\n end", "def current_user=(user)\n @current_user = user\n end", "def current_user=(user)\n @current_user = user\n end", "def current_user=(user)\n session[:user_id] = user.id\n @current_user = user\n end", "def save(current_user)\n return false unless valid?\n\n save_claim(current_user)\n end", "def submit\r\n\t\t@user = @first_name, @last_name, @username, @password, @email\r\n\tend", "def save\r\n @@users.push self\r\n end", "def set_user\n @cUser = current_user\n puts \"***#{@cUser}\"\n end", "def current_user=(new_user)\n @current_user = new_user\n end", "def current_user= (user)\n\t\t@current_user = user\n\tend", "def set_current_user(user)\n if user.new_record?\n set_unlogged_in_user(user)\n else\n set_logged_in_user(user)\n end\n end", "def set_current_user(user_data)\n session[:current_user_id] = user_data\n end", "def new_user\n account_make = self\n # assign storing of information to a variable\n account_store = YAML::Store.new 'users.store'\n # store the object into a file\n account_store.transaction do\n account_store[username.to_s] = account_make\n end\n end", "def current_user=(user) # assignment to current_user, method current_user= with arg as (user) \n\t@current_user = user \n end", "def set_connected_user_info(info)\n session[:sos_note_usr_info] = info\n end", "def current_user=(new_user)\n current_session.user = new_user\n end", "def set_user\n @user = User.find(current_user.id)\n end", "def set_current_user\n \t\tif session[:user_id]\n \t\t\tCurrent.user = User.find_by(id: session[:user_id])\n \t\tend\n \tend", "def save_omniauth_details\n authentication = @user.authentications.find_or_create_by(\n provider: auth_info.provider,\n uid: auth_info.uid\n )\n\n authentication.update_attributes!(\n email: auth_email,\n nickname: auth_nickname,\n image: auth_info.image,\n raw_info: @auth.to_json\n )\n end", "def user_saved(user)\n \n self.logged_user = user\n flash[:notice] = l(:notice_account_activated)\n redirect_to :controller => \"my\", :action => \"account\"\nend", "def save\r\n SystemConfig.set :auth, to_h, true\r\n end", "def update_user_if_save_version\n self.user = User.current if save_version?\n end", "def set_current_user\n User.current = current_user\n end", "def set_user_info\n @user_info = UserInfo.find(params[:id])\n end", "def set_user\n @user = current_user\n end", "def set_user\n @user = current_user\n end", "def set_user\n @user = current_user\n end", "def set_user\n @user = current_user\n end", "def set_user\n @user = current_user\n end", "def set_user\n @user = current_user\n end" ]
[ "0.7337099", "0.72821903", "0.7010088", "0.69120586", "0.68439937", "0.67950225", "0.679166", "0.66993386", "0.6687807", "0.66836864", "0.66836864", "0.66497755", "0.66264516", "0.65870184", "0.6584568", "0.6563492", "0.6540971", "0.6536809", "0.65148044", "0.6514691", "0.65054864", "0.65034616", "0.65013814", "0.6500948", "0.648928", "0.648641", "0.6479796", "0.64788866", "0.6466085", "0.64602894", "0.64599925", "0.64506865", "0.64506865", "0.64506865", "0.64506865", "0.64506865", "0.64506865", "0.64506865", "0.64506865", "0.64506865", "0.64506865", "0.6450034", "0.6447822", "0.6441342", "0.6441342", "0.6441342", "0.6441342", "0.6441342", "0.6441342", "0.6441342", "0.6441342", "0.6441342", "0.6441342", "0.6441342", "0.6441342", "0.6441342", "0.6441342", "0.6441342", "0.6441342", "0.6441342", "0.6441342", "0.6441342", "0.6441342", "0.6441342", "0.6441342", "0.6441342", "0.6441342", "0.6441342", "0.6441342", "0.6441342", "0.6441342", "0.6441342", "0.6441342", "0.6438214", "0.64246804", "0.64135414", "0.6412325", "0.6411712", "0.6406018", "0.64056885", "0.64012796", "0.6384773", "0.6382763", "0.6379754", "0.6370524", "0.6358167", "0.63449436", "0.6343173", "0.6339915", "0.63352865", "0.63343936", "0.6331578", "0.63196844", "0.63162386", "0.631496", "0.63112503", "0.63112503", "0.63112503", "0.63112503", "0.63112503", "0.63112503" ]
0.0
-1
Create a word with the given string
def initialize(word) @word = word @letters = unique_letters_in(word) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_word(word)\n \n end", "def new_word(s)\n\ts[0] = ''\n\treturn s\nend", "def add_word(word)\r\n \r\n end", "def create_word_one(word)\n index = find_last_vowel(word)\n result = word.slice(0, index)\n return result\n end", "def add_letter(word, index, let)\n word.split(\"\").insert(index,let).join\nend", "def initialize(word)\n @word = word\n @result_str = \"_\" * @word.length\n end", "def make_word(key)\n num_sylls = rand(self.minsyll..self.maxsyll)\n word = ''\n keys = []\n\n # If a key is defined, then select one of the syllables\n # to have a morpheme of that type.\n keys[rand(num_sylls)] = key\n num_sylls.times { |i| word << get_morpheme(keys[i]) }\n\n word\n end", "def create_title (word)\n\tp_title = word + ' '\n\tindex = 0\n\t#do until word key does not exist\n\twhile mcw(word) != -1\n\t\tp_array = p_title.split\n\t\tword = mcw(word)\n\t\t#If the sentence already contains word, break\n\t\tbreak if p_array.include? word\n\t\tp_title = p_title + word + ' ' #Concatenate new word to sentence\n\t\tindex += 1\n\tend\n\tp_title.gsub!(/\\s$/, '') #remove trailing whitespace\n\treturn p_title\nend", "def single_word(word)\n if word[0] =~ /[aeiou]/i\n word + \"way\"\n else\n # nueva condicionante para palabras de puras consonantes sin vocales. ej: by\n if word.split(/([aeiou].*)/).length > 1\n # Parte palabra en 2 y lo mete en un array. 1er elemento es de consonat(es) iniciales, 2o la parte restante de la palabra a partir de e incluyendo la primera vocal\n word.split(/([aeiou].*)/)[1] + word.split(/([aeiou].*)/)[0] + \"ay\"\n else\n word.split(/([aeiou].*)/)[0]\n end\n end\nend", "def sentence_maker(string)\n\tsentence = \"\"\n\tstring.each do |word|\n\t\tsentence += word.to_s + \" \"\n\tend\n\treturn full_sentence(sentence)\nend", "def code_name(word)\n#set a new word to an empty string, we are going to fill it using the rest of the loop:\n\tnew_word = \"\"\n#start index at 0\n\ti = 0\n#loop through the string:\n\twhile i < word.length\n#letter is going to be the index of the word put in, starting at the 0 position until the end of the word's length\n\tletter = word[i]\n#if a space is found, add a space to the new word\n\t\tif letter == ' '\n\t\tnew_word += ' '\n#everything else, find the next letter or the next vowel or next edge case, and add it to the new word\n\t\telse\n\t\t letter == letter.downcase\n\t\tnew_word += vowels_and_edges(letter)\n \t\tend\n \t\ti += 1\n end\n#should result in a new word, when all strings are pieced together \n new_word\nend", "def initialize (string)\n self.word = string.downcase\n end", "def construct(w)\n @word = \"~#{w}\" # Assimilate!\n @length = @word.length - 1 # Do not count the ~.\n @back = Array.new\n @back << 0 \n @back << 0\n s = 0\n (2..@length).each do |i|\n s = step(s,@word[i - 1])\n @back << s\n end\n end", "def generate_lyric word1 , word2\n # Store the lyric sentence as variable\n lyric = \"This place is a #{word1}. And these people aren't your #{word2}.\"\n\n # return the variable so it can be used later\n return lyric\nend", "def setsecretword word\r\n\t\t @secretword = word\r\n\t\t templ = createtemplate\r\n\t\t\t\t\tword_templ = templ.gsub(\"[\",\"\").gsub(\"]\",\"\")\r\n\t\t\t\t\ti=0\r\n\t\t\t\t\tsec_word_array=@secretword.chars\r\n\t\t\t\t\twhile i < sec_word_array.length do\r\n\t\t\t\t\t\tif sec_word_array[i] == \" \"\r\n\t\t\t\t\t @resulta[i] = \" \"\r\n\t\t\t\t\t else\r\n\t\t\t\t\t \t@resulta[i] = \"_\"\r\n\t\t\t\t end\r\n\t\t\t\t i+=1\r\n\t\t\t\t end\r\n\t\t end", "def create_word_two(word)\n index = find_first_vowel(word)\n result = word.slice(index, word.length)\n return result\n end", "def add_word_default(w)\n add_word(w, \"#{w}r\", \"#{w}p\", \"#{w}m\")\n \n end", "def make_tags(tag, word)\n \"<#{tag}>#{word}</#{tag}>\"\n end", "def word_string_short(word)\n \"#{word.morphword} #{word.input}->#{word.output}\"\n end", "def replace_word(template, replaced_word, new_word)\r\n template.gsub(/#{replaced_word}/, new_word)\r\n end", "def translate(word)\n if starts_with_vowel?(word) == true\n @translated_phrase << (word + \"way\")\n elsif consonant_letter?(word) == true\n letter = word.split('')\n letters = []\n @count.times do\n letters << letter.shift\n end\n new_word = letters.join('') + \"ay\"\n @translated_phrase << (letter.join('') + new_word)\n end\n end", "def add_word(word)\n chars = word.chars\n current = @root\n\n chars.each do |c|\n current = add_character(c, current)\n current.word_count += 1\n end\n current.is_word = true\n end", "def translate(word)\n\tvowels = %w{a e i o u}\n\n\t@word = word\n\n\tif vowels.include?(@word[0])\n\t\t@word += \"w\"\n\telse\n\t\tuntil vowels.include?(@word[0])\n\t\t\t# adjust for \"qu\"\n\t\t\t@word[0] == \"q\" ? @word += @word.slice!(0..1) : @word += @word.slice!(0)\n\t\t\t# stop if y\n\t\t\tbreak if @word[0] == \"y\"\n\t\tend\n\tend\n\n\t@word += \"ay\"\nend", "def new_word(sax, author_id, offset = 0)\n Word.new.tap do |word|\n word.id = offset + sax.id[/\\d+/].to_i\n word.author_id = author_id\n word.word = sax.word\n word.grammar = sax.grammar\n word.accents = sax.accents\n word.uris = sax.uris\n end\nend", "def create_title2(word)\n\treturn_title = word\n\ttemp = word\n\t# Use randomness to create a title\n\twhile rand_word(temp) != nil\n\t\treturn_title += \" \" + rand_word(temp)\n\t\ttemp = rand_word temp\n\tend\n\treturn return_title\nend", "def set_Word(value)\n set_input(\"Word\", value)\n end", "def set_Word(value)\n set_input(\"Word\", value)\n end", "def set_Word(value)\n set_input(\"Word\", value)\n end", "def set_Word(value)\n set_input(\"Word\", value)\n end", "def set_Word(value)\n set_input(\"Word\", value)\n end", "def set_Word(value)\n set_input(\"Word\", value)\n end", "def set_Word(value)\n set_input(\"Word\", value)\n end", "def set_Word(value)\n set_input(\"Word\", value)\n end", "def set_Word(value)\n set_input(\"Word\", value)\n end", "def add(word, w)\n if word != \"\" \n cur = self\n word.downcase.each_char do |character|\n modified_char = @@vowels.include?(character) ? '*' : character\n cur.kids[modified_char] = SpellingTrie.new if not cur.kids.has_key? modified_char\n cur = cur.kids[modified_char]\n end\n cur.words_here.add(w)\n end\n end", "def message_maker( string )\n message = string.upcase.scan(/[A-Z]*/).join\n message << \"X\" while (message.length%5 != 0)\n message.gsub!(/\\w{5}/){|word| word + \" \"}\n message.rstrip! \n \n message\nend", "def generate\n while chars_left > 0\n word << sample_syllable\n normalize! if normalize\n end\n return @word.capitalize\n ensure\n cleanup!\n end", "def sub_word(string)\n array = string.split\n array.each do |word|\n word.gsub!(/\\bt[oo]\\b/, \"2\")\n #word.gsub!(\"too\", \"2\")\n word.gsub!(\"for\", \"4\")\n word.gsub!(\"four\", \"4\")\n word.gsub!(\"you\", \"u\")\n word.gsub!(\"at\", \"/@\")\n word.gsub!(\"and\", \"&\")\n end\nend", "def makes_word (base, word)\n\ttemp = base.dup\n\tword.chars.each do |char|\n\t\tif base[char]\n\t\t\ttemp.sub!(char, '')\n\t\telse \n\t\t\treturn false\n\t\tend\n\tend\n\ttrue\nend", "def insertions word\n n = word.length\n new_words = []\n (n+1).times {|i| ('a'..'z').each {|l| new_words << word[0...i]+l.chr+word[i..-1] } }\n new_words\n end", "def create_word(board, *coords)\n coords.map { |coord| board[coord.first][coord.last]}.join(\"\")\n end", "def create_word(board, *coords)\n coords.map { |coord| board[coord.first][coord.last]}.join(\"\")\n end", "def create_word(board, *coords)\n coords.map { |coord| board[coord.first][coord.last]}.join(\"\")\n end", "def create_word(board, *coords)\n coords.map { |coord| board[coord.first][coord.last]}.join(\"\")\n end", "def create_word(board, *coords)\n coords.map { |coord| board[coord.first][coord.last]}.join(\"\")\n end", "def create_word(board, *coords)\n coords.map { |coord| board[coord.first][coord.last]}.join(\"\")\n end", "def create_word(board, *coords)\n coords.map { |coord| board[coord.first][coord.last]}.join(\"\")\n end", "def start_of_word(input, letter_count)\n # Create new word using indexes of orginal\n input[0..(letter_count-1)]\nend", "def create_title(word)\n\tcurrent = word\n\tword_num = 1 # begin word number at one\n\ttitle = \"\" # title begins as empty\n\ttitle += word # add current word\n\twhile word_num !=20 # while we have less than 20 words...\n\t\t\tif ($bigrams.has_key?(current)) # if the word exists in the bigram\n\t\t\t\tif (mcw(current) == nil)\n\t\t\t\t\t# do nothing and exit\n\t\t\t\t\tword_num = 20\n\t\t\t\telse\n\t\t\t\t\taddition = mcw(current) # thing to add is mcw\n\t\t\t\t\ttitle += \" \" # add space for readability\n\t\t\t\t\ttitle += addition # add addition to the title\n\t\t\t\t\tcurrent = addition # set current to the new wordtitle += addition # add the mcw\n\t\t\t\t\tword_num += 1 # increment by one and then go throuh\n\t\t\t\tend\n\t\t\telse word_num = 20 # otherwise, we exit\n\t\t\tend\n\t\tend\n\t\treturn title\nend", "def create_title(start_word)\n\tcount = 1\n\tnext_word = start_word\n\ttitle = \"\"\n\twhile not title.include? next_word\n\t# while count <= 20\n\t\ttitle += next_word + \" \"\n\t\tnext_word = mcw(next_word)\n\t\tcount += 1\n\tend\n\n\treturn title.chomp(\" \")\nend", "def create_word(board, *coords)\n @boggle_board = board\n coords.map { |coord| board[coord.first][coord.last]}.join(\"\")\n end", "def typoglycemiaWord(input)\n if input.length <= 3\n input\n end\n letters = input.chars\n last = letters.pop\n first = letters.shift\n letters.shuffle!\n letters << first\n letters.rotate!(-1)\n letters << last\n letters.join\nend", "def create_title(word)\n\t\t#prevents Nil.class errors\n\t\tsongTitle = ''\n\t\t#sets first word in title\n\t\tsongTitle = songTitle + word\n\t\tinWord = ''\n\t\tinWord = word\n\t\t#while loop set to 100000 to create a loop as a failsafe, but a song title should never get anywhere close to that large.\n\t\t(0..100000).each do\n\t\t\t#determines the word returned when calling mcw\n\t\t\tinWord = mcw(inWord)\n\t\t\t#checks if songTitle starts repeating itself: .scan() function discovered on stackoverflow\n\t\t\tif songTitle.scan(/#{inWord}/).length == 1\n\t\t\t\treturn songTitle\n\t\t\tend\n\t\t\t#in mcw returns '', then ends the function\n\t\t\tif inWord == ''\n\t\t\t\treturn songTitle\n\t\t\t#concatenates returned mcw() word to the song title\n\t\t\telse\n\t\t\t\tsongTitle = songTitle + \" \" + inWord\n\t\t\tend\n\t\tend\n\t\treturn songTitle\n\tend", "def add_target(string)\n clean_string = string.downcase.gsub(/[^a-z ]/i, ' ')\n clean_string.split(' ').each { |word| @word_counter.add_word(word) }\n end", "def word_break(str, dict)\n\nend", "def add_letter(letter, locations)\n # for each occurrence of a letter, add the letter to the correct location in $build-word\n locations.each { |location| $build_word[location] = letter }\n word_test() # then run word_test()\nend", "def replacements word\n n = word.length\n new_words = []\n n.times {|i| ('a'..'z').each {|l| new_words << word[0...i]+l.chr+word[i+1..-1] } }\n new_words\n end", "def create_word(board, *coords)\n\tcoords.map { |coord| board[coord.first][coord.last]}.join(\"\")\nend", "def create_word(board, *coords)\n\tcoords.map { |coord| board[coord.first][coord.last]}.join(\"\")\nend", "def add_random_words(string, count = 5)\n string = string.dup\n ipsum = %w[lorem ipsum dolor sit amet consectetur adipiscing elit]\n count.times do\n string << \" #{ipsum[Random.rand(ipsum.length)]}\"\n end\n string\nend", "def add_random_words(string, count = 5)\n string = string.dup\n ipsum = %w(lorem ipsum dolor sit amet consectetur adipiscing elit)\n count.times do\n string << \" #{ipsum[Random.rand(ipsum.length)]}\"\n end\n string\nend", "def make_string(s)\n s.scan(/\\b\\w/).join\nend", "def add(word)\n end", "def add_word!(a_string_param, an_array_param)\n a_string_param << \" rutabaga\"\n an_array_param << \"rutabaga\"\nend", "def process_word word\n const_match = /^[BCDFGHIJKLMNPQRSTVWXYZbcdfhhtjklmnpqrstvwxyz]+/.match(word)\n letter_match = /^[a-zA-Z]+/.match(word) #Match letters only\n other_chars = word[letter_match.to_s.length..-1]\n if const_match.to_s.length > 0\n return const_trans(letter_match.to_s, const_match) + other_chars\n else\n return vowel_trans(letter_match.to_s) + other_chars \n end\n \n end", "def word=(_arg0); end", "def make_a_sentence(words)\n words.join(' ') + \"!\"\nend", "def hipsterfy(word)\n\nend", "def word; end", "def word; end", "def word; end", "def word; end", "def word; end", "def create\n new_word = Dinosaurus.new\n \n end", "def current_word()\n current = $build_word.join(\" \") # return a string of placeholder underscores + correctly guessed letters\nend", "def shell_single_word(str)\n if str.empty?\n \"''\"\n elsif %r{\\A[0-9A-Za-z+,./:=@_-]+\\z} =~ str\n str\n else\n result = ''\n str.scan(/('+)|[^']+/) {\n if $1\n result << %q{\\'} * $1.length\n else\n result << \"'#{$&}'\"\n end\n }\n result\n end\n end", "def kacokadekame(word)\n 'ka' + word.gsub(/([aeiouy])(?=[^aeiouy])/i, '\\1ka')\nend", "def sentence_maker(words)\n\tstring = \"\"\n\twords.each do |x|\n\t\tstring = string + x.to_s + \" \"\n\tend\n\treturn string.capitalize.strip + \".\"\nend", "def word_pattern(pattern, input)\n \nend", "def start_of_word (string, number)\n number = number - 1\n string[0..number]\nend", "def add_word(word, definition)\r\n @word << {Word: word, Definition: definition}\r\n # puts \"This is @word: #{@word}\"\r\n end", "def scream(word)\n words = words + \"!!!!\"\nend", "def add_word(word)\n sym = word.to_sym\n wdup = word.dup\n for i in 0...word.length\n wdup[i] = 0\n @steps[wdup] << sym\n wdup[i] = word[i]\n end\n @words[word] = sym # for allow_shorter and each_word\n end", "def create_phrase\n @phrase_text = add_text(base_x, base_y, 0, 16, @phrase)\n end", "def add_word(word)\n node = root\n word.chars.each do |c|\n node.children[c] = TrieNode.new unless node.children.key?(c)\n node = node.children[c]\n end\n node.word = true\n end", "def word_yeller(sentence)\n\n\nend", "def wikify(word)\n begin\n word = word.gsub(/^[a-z]|\\s+[a-z]/) { |a| a.upcase }\n word = word.gsub(/\\s/, '')\n word.underscore\n rescue => e\n puts e.inspect\n puts e.backtrace\n end\n end", "def pig_latin_word(word)\r\n\tif word[0].downcase =~ /[aeiou]/\r\n\t\tword << \"way\" \r\n\telse\r\n\t\tn = /[aeiou]/.match word.downcase\r\n\t\tn.to_s + n.post_match + n.pre_match + \"ay\"\r\n\tend\r\nend", "def wordz(string)\n if string.length > 10\n string.upcase\n else\n string\n end\nend", "def create_word(board, *coords) \n\tcoords.map { |coord| board[coord.first][coord.last]}.join(\"\") \nend", "def shout(word)\n\treturn word.upcase\nend", "def index_word(word)\n wordArray = word.split('')\n add_child(@root, wordArray, word)\n end", "def typoglycemiaSentence(input)\n words = input.split(' ')\n words.map! { |x| typoglycemiaWord(x) }\n words.join(\" \")\nend", "def yell word4\n word4.upcase + \"!\"\nend", "def rotn(n, word)\n n.times do\n word.tr!('abcdefghijklmnopqrstuvwxyz',\n 'bcdefghijklmnopqrstuvwxyza')\n end\n word\nend", "def replace(word, letter, ind)\n (word[0...ind] || '') << letter << (word[ind+1..-1] || '')\nend", "def sentence_maker(word_array)\n\tsentence = word_array.join(\" \")\n\treturn sentence.capitalize + \".\"\nend", "def translate s\n \n words = s.split.map{|word|\n if %w(a e i o u).include?(word[0])\n word << \"ay\"\n elsif %w(thr sch squ).include?(word[0..2])\n word[3..-1] << (word[0..2] << \"ay\")\n elsif %w(ch qu br th).include?(word[0..1])\n word[2..-1] << word[0..1] << \"ay\" \n else\n word[1..-1] << (word[0] << \"ay\") \n end\n }\n words.join(\" \")\n\nend", "def hackerSpeak(word)\n\tnew_word=''\n\tword.each_char do |c|\n\t\tif c.downcase=='a'\n\t\t\tnew_word=new_word+'4'\n\t\telsif c.downcase=='e'\n\t\t\tnew_word=new_word+'3'\n\t\telsif c.downcase=='i'\n\t\t\tnew_word=new_word+'1'\n\t\telsif c.downcase=='o'\n\t\t\tnew_word=new_word+'0'\n\t\telsif c.downcase=='s'\n\t\t\tnew_word=new_word+'5'\n\t\telse\n\t\t\tnew_word=new_word+ c\t\t\t\t\t\t\n\t\tend\t\n\tend\n\tnew_word\nend", "def start_of_word(a, b)\n return a.chars.first(b).join\nend", "def make_word\n @secret_word = File.readlines('dictionary.txt').sample.chomp.downcase.split('')\n @working_word = Array.new(@secret_word.length) { \"_\" }\n end" ]
[ "0.6986271", "0.6919456", "0.68202907", "0.67290735", "0.65936077", "0.65819746", "0.6505832", "0.6479408", "0.6464417", "0.64395213", "0.6403397", "0.62902457", "0.6249584", "0.62478864", "0.6228439", "0.6208239", "0.6188045", "0.6180487", "0.61770433", "0.6171708", "0.616927", "0.61391056", "0.61145276", "0.6111702", "0.6097952", "0.60678595", "0.60678595", "0.60678595", "0.60678595", "0.60678595", "0.60678595", "0.60678595", "0.60678595", "0.60678595", "0.60613465", "0.60304236", "0.5988017", "0.59786415", "0.5976545", "0.5973098", "0.5970194", "0.5970194", "0.5970194", "0.5970194", "0.5970194", "0.5970194", "0.5970194", "0.5969305", "0.5953595", "0.5950548", "0.59499264", "0.59454536", "0.59403425", "0.5939191", "0.59357107", "0.5934096", "0.59321344", "0.58873636", "0.58873636", "0.5875706", "0.5872997", "0.5865781", "0.58642", "0.5857383", "0.5852761", "0.5836545", "0.5835859", "0.5835566", "0.58292156", "0.58292156", "0.58292156", "0.58292156", "0.58292156", "0.58282584", "0.5825794", "0.5817969", "0.58111006", "0.58095056", "0.5804047", "0.5794741", "0.57890815", "0.57840115", "0.5775978", "0.5775676", "0.57713103", "0.5769086", "0.5767824", "0.5764102", "0.5763103", "0.5758737", "0.57586926", "0.57552993", "0.57504153", "0.5750087", "0.5749992", "0.57497966", "0.5741753", "0.5741663", "0.5737474", "0.5736599", "0.5731645" ]
0.0
-1
Add one word to the dictionary
def add(word) change_wordlist(@words + [ Word.new(word) ] ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_word word #Function shovels individual strings into the dictionary array\n @dictionary << word\n end", "def add(word)\n\t\tif word.class == String\n\t\t\tword = {word => nil}\n\t\tend\n\n\t\tword.each do |key, value|\n\t\t\t@entries[key] = value\n\t\tend\n\tend", "def add_word(word)\n \n end", "def addword(word)\n if @graph.words[word].nil? then\n @graph.words[word] = {}\n end\n end", "def add(word)\n end", "def add(word)\n @words[@words.size] = word\n end", "def add(entry) \r\n if entry.is_a? String\r\n @@words[entry] = nil\r\n else \r\n learn = entry.to_a \r\n learnit = learn[0]\r\n @@words[learnit[0]] = learnit[1]\t\r\n end\r\nend", "def add(word, nextWord)\r\n @words[word] = Hash.new(0) if !@words[word]\r\n @words[word][nextWord] += 1\r\n end", "def add_word(word)\n if word.length == 0\n @isend = true\n else\n @childs[word[0]] ||= WordDictionary.new\n @childs[word[0]].add_word(word[1..-1])\n end\n nil\n end", "def add_word(word)\r\n \r\n end", "def add_word(word)\n sym = word.to_sym\n wdup = word.dup\n for i in 0...word.length\n wdup[i] = 0\n @steps[wdup] << sym\n wdup[i] = word[i]\n end\n @words[word] = sym # for allow_shorter and each_word\n end", "def add_word(word, definition)\r\n @word << {Word: word, Definition: definition}\r\n # puts \"This is @word: #{@word}\"\r\n end", "def add_word(word)\n @word_counts[word] ||= 0\n current_count = @word_counts[word] += 1\n @total_word_count += 1\n # If this word is new for this Group, it might be new for the entire Groupie\n @groupie.add_word(word) if current_count == 1\n nil\n end", "def add(word)\n word.scan(/./) do |l|\n if ('a'..'z') === l\n @map[l] = Array.new unless @map.has_key? l\n @map[l] = @map[l] << word\n end\n end \n end", "def add(word, w)\n if word != \"\" \n cur = self\n word.downcase.each_char do |character|\n modified_char = @@vowels.include?(character) ? '*' : character\n cur.kids[modified_char] = SpellingTrie.new if not cur.kids.has_key? modified_char\n cur = cur.kids[modified_char]\n end\n cur.words_here.add(w)\n end\n end", "def add(word)\n Hunspell.Hunspell_add(self,word.to_s)\n end", "def add_word(word)\n chars = word.chars\n current = @root\n\n chars.each do |c|\n current = add_character(c, current)\n current.word_count += 1\n end\n current.is_word = true\n end", "def add_adjective!(word)\n new_word = Unicode.downcase(word)\n new_word[-2..-1] = \"ая\"\n @redis.rpush(\"store:adjectives\", new_word) \n end", "def add(word)\n \t\tif word.length > 0 # there was a zero length char after this, idk\n if @children[word[0,1]] # if current letter exists in hash, add to it\n\t @children[word[0,1]].add(word[1, word.length])\n\t\t\t\t@children[word[0,1]].word = true if (word.length == 1)\n\t else # if the letter doesn't exist, create it\n\t @children[word[0,1]] = LetterTree.new(word[1, word.length])\n\t\t\t\t@children[word[0,1]].word = true if (word.length == 1)\n\t end\n\t\tend\n\tend", "def add(word)\n node = @root\n word.downcase!\n word.each_char do |letter|\n node[letter] ||= Hash.new\n node = node[letter]\n end\n node[:end] = true\n end", "def updateWord(word)\n\n\t\tword = remove_punctuation(word)\n\n\t\t# If we have an entry then increment its count\n\t\tif @a.has_key?(word)\n\t\t\t@a[word] += 1\n\t\telse \n\t\t\t@a[word] = 1\n\t\tend\n\n\n\t\tcount = @a[word]\n\t\tdeleteWord(word, count)\n\t\taddWord(word, count)\n\tend", "def add_word(word)\n sorted_word = word.lsort\n @data[sorted_word] ||= []\n @data[sorted_word] << word\n if (@max_word_size==nil) || (word.size > @max_word_size)\n @max_word_size = word.size\n end\n end", "def add_noun!(word)\n @redis.rpush(\"store:nouns\", Unicode.downcase(word))\n end", "def add(word)\n return if word.nil? || word.strip == ''\n\n @words.push(word)\n end", "def add word\n super word.clone\n end", "def add_at!(word)\n new_word = \"#{Unicode.downcase(word)}а\"\n @redis.rpush(\"store:ats\", new_word)\n end", "def add_ata!(word)\n @redis.rpush(\"store:atas\", Unicode.downcase(word))\n end", "def add_word(word)\n node = root\n word.chars.each do |c|\n node.children[c] = TrieNode.new unless node.children.key?(c)\n node = node.children[c]\n end\n node.word = true\n end", "def add_word_to_result(word, line_num)\n return if word == ''\n if @result[word].nil?\n h = Hash.new\n h[:count] = 1\n h[:line_nums] = [line_num]\n @result[word] = h\n else\n @result[word][:count] += 1\n @result[word][:line_nums] << line_num\n end\n end", "def <<(word)\n @words << word\n end", "def <<(word)\n @words << word\n end", "def <<(word)\n @words << word\n end", "def add_to_set(set, word)\n\tif !(set.key?(word))\n\t\tset.merge!(word => 1)\n\telse\n\t\tset[word] += 1\n\tend\nend", "def insert(word)\n pnt = @r\n word.chars.each do |x|\n if ! pnt[x]\n pnt[x] = {}\n end\n pnt = pnt[x]\n end\n if ! pnt['end']\n pnt['end'] = {}\n end\n end", "def store_valid_word(word)\n @words << word\n @word_index[word] = @last_letter\n end", "def add_word_pair(start, stop, name)\n @am.add_word_pair(start, stop, name)\n end", "def add_word(word)\n word_hash = Digest::SHA1.hexdigest(word)\n word_file_path = ROOT_DATA_FOLDER + word_hash\n word_file = File.open(word_file_path, 'a+')\n words = word_file.readlines\n words.each {|word| word.sub! \"\\n\", ''} # remove trailing \\n\n word_index = words.index(word)\n\n if word_index.nil? # add new word to end of file with count = 1\n add_line_to_file(word_file_path, word)\n add_line_to_file(word_file_path, '1')\n else # add count to existing word by replacing count line in file\n word_count = words[word_index + 1].to_i\n add_line_to_file(word_file_path, (word_count + 1).to_s, word_index + 1)\n end\n word_file.close\n end", "def add_word(word)\n node = @root\n word.each_char do |c|\n node.children[c] ||= TrieNode.new\n node = node.children[c]\n end\n node.is_end = true\n end", "def addWord(word, count)\n\t\tif !@b[count]\n\t\t\t@b[count] = []\n\t\tend\n\t\t@b[count] << word\n\tend", "def add_word_pair(start, stop, name)\n @attribute_manager.add_word_pair(start, stop, name)\n end", "def add_word_pair(start, stop, name)\n @attribute_manager.add_word_pair(start, stop, name)\n end", "def add_word(new_word, categories)\r\n categories.each do |category|\r\n fandom = fetch_fandom(category)\r\n fandom << new_word unless fandom.include? new_word\r\n end\r\n end", "def add_letter(letter, locations)\n # for each occurrence of a letter, add the letter to the correct location in $build-word\n locations.each { |location| $build_word[location] = letter }\n word_test() # then run word_test()\nend", "def train!(word)\n #create @dictionary, an attribute of type Hash mapping words to their count in the text {word => count}. Default count should be 0 (argument of Hash constructor).\n if !@dictionary.has_key?(word) then @dictionary[word] = 1 else @dictionary[word] += 1 end\n\n end", "def add_translation(first, second)\r\n @dictionary[second] = first\r\n @dictionary[first] = second\r\n end", "def add(word)\n word.scan(/./) {|l| @hist[l] = @hist[l] + 1 if ('a'..'z') === l}\n @total_letters += word.size\n end", "def modified_word(word)\n idx = rand(-1...word.length)\n str = word[idx]\n tmp_word = if idx.even?\n word.insert(idx,str)\n else\n word.delete(str)\n end\n return tmp_word unless dictionary.dict.include?(tmp_word)\n modified_word(word)\n end", "def add_to_doc_hash(doc_id, word, count)\n if $doc_hash.key?(doc_id)\n $doc_hash[doc_id][:size] += count\n if $doc_hash[doc_id].key?(word)\n $doc_hash[doc_id][word] += count\n else\n $doc_hash[doc_id][word] = count\n end\n else\n $doc_hash[doc_id] = {}\n $doc_hash[doc_id][:size] = count\n $doc_hash[doc_id][word] = count\n end\nend", "def add( toAdd )\n if toAdd.is_a?(Hash) # if toAdd is a hash\n toAdd.each do |keyWord, value|\n @entries[ keyWord ] = value # add as hash\n end\n else\n @entries[ toAdd ] = nil # if toAdd is NOT a hash, use keyword, as toAdd, to add a nil value\n end\n end", "def add_word_default(w)\n add_word(w, \"#{w}r\", \"#{w}p\", \"#{w}m\")\n \n end", "def insert(word)\n node = @root\n word.each_char do |c|\n node[c] ||= {}\n node = node[c]\n end\n node[END_OF_WORD] = END_OF_WORD\n end", "def add(word)\n build(@tree, word)\n end", "def append(phrase, translation)\n phrase.strip!\n translation.strip!\n if @value_hash[phrase].nil?\n @value_hash[phrase] = [translation]\n else\n @value_hash[phrase] << translation\n end\n end", "def add_word_to_trie(word)\n chars = word.downcase.split('')\n crawl = root\n\n chars.each do |char|\n child = crawl.children\n if child.keys.include?(char)\n crawl = child[char]\n else\n temp = TrieNode.new(char)\n child[char] = temp\n crawl = temp\n end\n end\n crawl.is_end = true\n end", "def submit_word(word)\n letters_present_for(word) && @dictionary.include?(word)\n end", "def add_keyword\n @item.keywords = @bib.keyword.map(&:content).join(\", \") if @bib.keyword.any?\n end", "def add_to_dict(event, dict, string)\r\n if nil==string or \"\"==string then return 2 end\r\n message = string.strip\r\n\r\n # Open and add the dictionary to the list of open dictionaries if not yet open.\r\n if dict && !@openDicts[dict.filename] then\r\n if File.exists?('./dict/' + dict.filename + \".txt\")\r\n @openDicts[dict.filename] = File.open('./dict/' + dict.filename + \".txt\", \"a\")\r\n end\r\n elsif not dict\r\n return 1\r\n end\r\n\r\n dict.parse_source(message, false)\r\n\r\n # Log chat to that open dictionary txt as normal.\r\n file = @openDicts[dict.filename]\r\n if dict.is_punctuated?(string) or string == \"\"\r\n file.print(\"\\r\\n\" + message )\r\n else\r\n file.print(\"\\r\\n\" + message + \".\" )\r\n end\r\n file.flush\r\n return 0\r\n end", "def dictionary(word)\n words = {\n \"hello\": 'hi',\n \"to\": '2',\n \"two\": '2', \n \"too\": '2',\n \"for\": '4',\n \"be\": 'b',\n \"you\": 'u',\n \"at\": '@',\n \"and\": '&'\n }\n words[word.downcase.to_sym]\nend", "def add(string)\n \tstring + \"only in America!\"\n end", "def add(key, value); end", "def word_substituter(string)\n# dictionary.has_key(\"hello\") == true\n replace= []\n \n replace << string.split.each do |word| \n if dictionary.has_key?(\"#{word}\") == true\n word.replace(dictionary[\"#{word}\"])\n else word\n \n end\n \n end \n replace.flatten.join(\" \")\nend", "def add_words(new_words)\n new_words.each do |word|\n add(word)\n end\n end", "def store_word(word)\n existing_index = @lemmas[word]\n\n if !existing_index\n @lemmas[word] = @index\n elsif @index > existing_index\n @lemmas[word] = @index\n end\n end", "def add_letter(letter)\n char_list = @word.split(\"\")\n\n char_list.each_with_index do |character, index|\n if letter == character\n @display[index] = letter\n end\n end\n end", "def dictionary()\n word_list = {\n \"hello\" => \"hi\",\n \"to\" => \"2\",\n \"two\" => \"2\",\n \"too\" => \"2\",\n \"for\" => \"4\",\n \"four\" => \"4\",\n \"be\" => \"b\",\n \"you\" => \"u\",\n \"at\" => \"@\",\n \"and\" => \"&\"\n }\nend", "def add(word)\n @root.create_final_path(word.chars.reverse + [Path::DELIMITER])\n\n Word.new(word.chars).to_delimited_paths.each do |path|\n @root.create_final_path(path.letters)\n end\n\n self\n end", "def dictionary\n\t#recieve word not sentence. already split\n\t#find word from dictionary\n dictionary = {\n \"hello\" => \"hi\",\n \"to\" => \"2\",\n \"two\" => \"2\",\n \"too\" => \"2\",\n \"for\" => \"4\",\n \"For\" => \"4\",\n \"four\" => \"4\",\n \"be\" => \"b\",\n \"you\" => \"u\",\n \"at\" => \"@\",\n \"and\" => \"&\"\n }\nend", "def add_modification(word)\n\t\t@modifications[@modifications.length-1] = word\n\tend", "def create\n cache.set(word, 1)\n end", "def set_worker_word(worker, word)\n # puts \"######### #{worker} ######## #{word}\"\n\n # Load hash of who has done what\n worker_words = YAML::Store.new(AMT_WORKER_WORD_LIST)\n worker_words.transaction do\n # Set to array if she be not exist and add the word to the list\n worker_words[worker] = [] unless worker_words[worker]\n worker_words[worker] << word if(!worker_words[worker].include?(word))\n end\n end", "def insert(word)\n curr = @root\n word.each_char do |char|\n curr = (curr[char] ||= TrieNode.new)\n end\n curr[:_] = true\n end", "def save\n\t\tNg2::HashDb.add(@word, serialize)\n\tend", "def setWord(word, value)\n @bits[word] = value\n end", "def add(*words)\n words.flatten.each do |word|\n add_word(word)\n end\n nil\n end", "def save_word(word)\n id = MinWords::DB[:words].insert word_text: word[:word_text]\n save_definition(id, word[:definition_text])\n id\n end", "def add_key(key,value) \n\t\tSCHOOL[key]=[value]\n\tend", "def insert(word)\n node=@root\n i=0\n while i <word.length \n char=word[i]\n order=char.ord-97\n if node[order].nil?\n node[order]=Hash.new(nil)\n node[order][\"value\"]=false\n end\n node=node[order]\n i+=1\n end\n node[\"value\"]=true\n end", "def word_substituter(string)\ntweet=string.split(\" \")\ni = 0 \nwhile i < tweet.length \nif dictionary.keys.include?(tweet[i].downcase)\ntweet[i] = dictionary[tweet[i].downcase]\nend \ni+=1\nend\ntweet.join(\" \")\nend", "def add_a_key_value_pair\nsummer_olympics = {\n \"Sydney\" => \"2000\",\n \"athens\" => \"2004\",\n \"beijing\" => \"2008\",\n \"London\" => \"2012\"}\n \n summer_olympics[\"atlanta\"] = 1996\n puts summer_olympics\n puts \"\"\n end", "def random_word\n\t\tnumber = rand(@modified_dictionary.length)\n\t\t@modified_dictionary[number]\n\tend", "def add_item(str,list)\n list[str]=1\n list\nend", "def is_word?(string, dictionary = Dictionary.new)\n dictionary.include?(string)\nend", "def insert(word)\n tmp = self\n word.split(\"\").each do |char|\n tmp.childs[char] ||= Trie.new\n tmp = tmp.childs[char]\n end\n tmp.isend = true\n nil\n end", "def add_word!(a_string_param, an_array_param)\n a_string_param << \" rutabaga\"\n an_array_param << \"rutabaga\"\nend", "def augment_from_dict(dict)\n path = DICTS[dict.to_sym] || raise(InvalidDictionaryName, dict)\n @word_file = File.open path\n puts \"#{self.class} will augment AppleSpell with words from #{path}\"\n augment!\n end", "def decorate_word(word)\n word_multiplier = 1\n\n # Word looks something like:\n # { word: \"ha\", indices: [[0, 0], [0, 1]] }\n # Return the word's score, while also checking for any word multipliers.\n score = word[\"indices\"].reduce(0) do |word_value, index|\n y, x = index\n\n this_letter = self.as_two_dimensional_array[y][x]\n\n # Is there a bigger word multiplier?\n if this_letter.word_multiplier > word_multiplier\n word_multiplier = this_letter.word_multiplier\n end\n\n # Return the value of the decorated letter at this index.\n word_value += this_letter.value\n end\n\n word.merge(\n base_score: score,\n multiplier: word_multiplier,\n score: score * word_multiplier\n )\n end", "def add_s(array)\n array.map do |word|\n if word == word\n word \n else \n word + \"s\"\n end\n end \nend", "def insert(word)\n w = word.chars\n w.push('end')\n node = @root\n # Add 'bridge' for each element.\n w.each do |key|\n node[key] ||= {}\n node = node[key]\n end\n \n end", "def extra_letter( dict_word, word )\n\n\tnum = word.length - 1\n\n\t# Remove a letter from the test word to see if a match results\n\tnum.times do |i|\n\n\t\ttest_word = word[0, i+1] + word[i+2, num]\n\n\t\t# Match made\n\t\treturn true if @dictionary[test_word]\t\n\tend\n\n\t# No match found\n\treturn false\nend", "def word_substituter(tweet)\n short_tweet = tweet.split.map do |word|\n if dictionary.keys.include?(word)\n dictionary[word]\n else\n word\n end\n end\n short_tweet.join(\" \")\nend", "def build_dict(dict)\n dict.each do |word|\n sz = word.size\n @words[sz][word] = true\n end\n end", "def insert(word)\n node = self\n\n word.each_char do |char|\n\n unless node.children.has_key?(char)\n node.children[char] = WordTree.new\n end\n\n node = node.children[char]\n end\n\n node.instance_variable_set(:@word, word)\n\n self\n end", "def add_s(words)\n words_plural = []\n words.each_index do |index|\n unless index == 1\n words_plural << words[index] + \"s\"\n end\n end\n words_plural.insert(1, words[1])\nend", "def add_word(word)\r\n if word.length == 0\r\n # handle separately\r\n @empty_string_exist = true\r\n end\r\n\r\n prev = nil\r\n n = @root\r\n\r\n word.chars.each_with_index do |chr, i|\r\n node = search_node_or_insert_node(n, chr)\r\n #puts \"chr=#{chr}, node=#{node}, letter=#{node.nil? ? '' : node.letter}\"\r\n\r\n if node.nil?\r\n #n is nil, otherwise it will return \r\n if prev.nil?\r\n # root is nil\r\n @root = Node.new(chr)\r\n\r\n prev = @root\r\n n = @root.next\r\n #if i == word.length - 1\r\n # prev.is_end = true\r\n #end\r\n else\r\n prev.next = Node.new(chr)\r\n prev = prev.next\r\n n = prev.next\r\n #if i == word.length - 1\r\n # prev.is_end = true\r\n #end\r\n end\r\n elsif node.letter == chr\r\n # I found it\r\n prev = node\r\n n = prev.next\r\n\r\n #if i == word.length - 1\r\n # prev.is_end = true\r\n #end\r\n else\r\n # I found the insert position\r\n if chr.ord < node.letter.ord\r\n # insert to left\r\n node.left = Node.new(chr)\r\n prev = node.left\r\n n = prev.next\r\n else\r\n # insert to right\r\n node.right = Node.new(chr)\r\n prev = node.right\r\n n = prev.right\r\n end\r\n\r\n end\r\n\r\n if i == word.length - 1\r\n prev.is_end = true\r\n end\r\n end\r\n end", "def dictionary\n @dictionary ||= Dictionary.new(@word)\n end", "def word_substituter(tweet)\n tweet.split.map { |word| \n dictionary[word.downcase] || word }.join(\" \")\n end", "def +(other_word)\n CombinedNoun.new([word, other_word])\n end", "def create_title (word)\n\tp_title = word + ' '\n\tindex = 0\n\t#do until word key does not exist\n\twhile mcw(word) != -1\n\t\tp_array = p_title.split\n\t\tword = mcw(word)\n\t\t#If the sentence already contains word, break\n\t\tbreak if p_array.include? word\n\t\tp_title = p_title + word + ' ' #Concatenate new word to sentence\n\t\tindex += 1\n\tend\n\tp_title.gsub!(/\\s$/, '') #remove trailing whitespace\n\treturn p_title\nend", "def insert(word)\n current_node = @root\n word.chars.each do |char|\n node = current_node.children[char]\n if !node\n node = TrieNode.new();\n current_node.children[char] = node\n end\n current_node = node\n end\n current_node.end_of_word = true\n end", "def scream(word)\n words = words + \"!!!!\"\nend" ]
[ "0.8524028", "0.8147995", "0.7814593", "0.76858705", "0.76194024", "0.75758594", "0.74321216", "0.7424859", "0.7394087", "0.7360386", "0.7339526", "0.7331375", "0.72518903", "0.71986586", "0.71597856", "0.7137131", "0.7130073", "0.7094894", "0.69974625", "0.696708", "0.69319534", "0.6926016", "0.6921205", "0.6865369", "0.6828741", "0.6817959", "0.68006945", "0.6764342", "0.66441447", "0.6613448", "0.6613448", "0.66071403", "0.65697616", "0.65619546", "0.6517797", "0.6490221", "0.64670575", "0.6466723", "0.6463956", "0.64426595", "0.64426595", "0.642814", "0.64228785", "0.6420159", "0.6396697", "0.6384433", "0.635795", "0.6326874", "0.62826556", "0.6278391", "0.62564033", "0.6214612", "0.6199328", "0.6175582", "0.61590624", "0.61483806", "0.6139341", "0.61254627", "0.60835713", "0.6073736", "0.60623753", "0.60591584", "0.60495263", "0.6034887", "0.6025143", "0.60214615", "0.60122985", "0.5991279", "0.59861016", "0.59789956", "0.5978396", "0.59778625", "0.5968655", "0.5965065", "0.59610194", "0.59584457", "0.5954405", "0.59410447", "0.5929199", "0.59195566", "0.59160227", "0.5908722", "0.59019476", "0.5899331", "0.5886696", "0.5873315", "0.586893", "0.5863979", "0.5848104", "0.58410746", "0.5834942", "0.5827369", "0.5826252", "0.58239836", "0.5822804", "0.5816271", "0.57926077", "0.579238", "0.57865053", "0.5757823" ]
0.6930533
21
Load all words from a text file (one word per line) Keep only words that are 5 ascii letters or more Words all all lower case
def load(file) words = File.readlines(file) words = words.collect {|word| Word.new(word.chomp.downcase) } change_wordlist(words.select {|word| word.word.length >= 5 && word.word =~ /^([a-z])+$/ }) self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_words\n return @valid_words if @valid_words && @valid_words.length > 0\n\n @valid_words = Set.new\n @io.each_line do |l|\n l.encode!('UTF-8', 'UTF-8', invalid: :replace, undef: :replace, replace: '')\n # Funny story, in place methods are faster.\n l.gsub!(/[^[:alnum:]^[:blank:]]/, \"\")\n l.downcase!\n l.strip!\n # Only 'short' words (discard numbers only)\n l.split(\" \").reject{|w| /\\A\\d+\\z/.match(w) || w.length < 3 || w.length > 10}.each do |w|\n @valid_words.add(w)\n end\n end\n @valid_words\n end", "def load_words(file_name)\n words_loaded = []\n File.open(file_name).readlines.each do |line|\n words_loaded << line if line.length.between?(5, 12)\n end\n words_loaded\n end", "def load_dict\n words = []\n File.open(\"dict.txt\").each do |line| # Hard code for now\n if line.length.between?(5, 12)\n words << line.rstrip.downcase\n end\n end\n words\n end", "def prepare_words(filename)\n @words = []\n File.readlines(filename).each do |line|\n line.split.each {|word| @words << word}\n end\n end", "def words_from_file(text_file)\n File.read(text_file).downcase.gsub(/[^a-z]/, \" \").split\nrescue\n puts \"Please provide the following file: #{text_file}\"\n exit\nend", "def get_the_word\n words = File.readlines(\"5desk.txt\")\n words = words.map do |word|\n word.strip\n end\n words = words.select do |word|\n (word.length > 4) && (word.length < 13)\n end\n words.sample.upcase.split(\"\")\n end", "def words_file(words)\n File.read(words).lines.select do |l|\n (3..9).cover?(l.strip.size)\n end\n end", "def sample_word file\n words = []\n File.open(file).readlines.each do |line|\n words << line\n end\n\n words = words.select{ |word| word.length.between?(5,12) }\n words.sample.chomp\n end", "def word_list\n @word_list ||= Set.new File.read(\"dictionary.txt\").split(\"\\n\").map(&:downcase)\n end", "def load_word_list\n @word_list = []\n puts \"Loading word list...\"\n File.readlines(WORDLIST_FILE).each{|word|\n word.gsub!(/[\\r\\n]+/,\"\")\n if valid_word?(word, @inner_letter, @outer_letters)\n @word_list << word\n end\n }\n @word_list.sort!\n puts \"Word list loaded.\"\n end", "def words_from_file(text_file)\n File.read(text_file).downcase.gsub(/[^a-z]/, \" \").split\nrescue\n puts \"Give me #{text_file} and let's get the party started!\"\n exit\nend", "def initialize(dictionary)\n @words, @maxwords = [], []\n File.open(dictionary).each do |line|\n l = line.strip.downcase\n @words << l if (l.length >= MINCHARACTERS && l.length <= MAXCHARACTERS)\n @maxwords << l if l.length == MAXCHARACTERS\n end\n end", "def analyse(file_path)\n fixed = 0\n words = []\n File.open(file_path, \"r:iso-8859-1\") do |f|\n words = f.readlines(sep=\" \")\n words.dup.each_with_index do |word, i|\n word.delete!(\" \")\n match, dist = @tree.best word.downcase\n if !match.nil? && dist != 0\n fixed+=1\n words[i] = capitalize_if_needed(word, match)\n # puts \"#{word} - #{match}\"\n end\n end\n end\n # print \"file: #{file_path}\\nwords: #{words.size}\\nfixed words:#{((fixed.to_f/(words.size).to_f)*100).round(2)}%\\n\"\n save words, file_path\n end", "def words_from_file(text_file)\n File.read(text_file).downcase.gsub(/[^a-z]/,\" \").split\nrescue\n puts \"Give me #{text_file} and let's get the party started\"\n exit\nend", "def textualed\n list = File.readlines(file_name)\n full_list = list.sort_by { |x| x.downcase }\n while a = full_list.shift\n puts a unless nil? \n end\n end", "def load_words\n File.readlines(\"#{WORD_DIR}/#{language}.txt\").map(&:strip)\n end", "def initialize file\n word_set = Set.new\n\n File.open(file, \"r\") do |f|\n f.each_line do |raw_line|\n line = raw_line.strip.upcase\n\n if HangmanGame.acceptable_word? line\n word_set.add line\n end\n end\n end\n\n @words = word_set.to_a.freeze\n\n Random.srand\n end", "def set_word\n dic = File.read(\"dic.txt\").downcase.split\n dic.reject! {|word| word.length<5 || word.length>12}\n word = dic.sample\n end", "def get_word_list\n @word_list = @lines.reject do |line|\n line.length < 5 || line.length > 12\n end\n end", "def initialize(word_list_file_path)\n word_list = ::File.readlines(word_list_file_path).map(&:chomp)\n @words = word_list.map(&:downcase)\n end", "def get_spelling_words(file)\n lines = IO.readlines(file).map(&:chomp)\n review_word = false\n challenge_word = false\n words = []\n lines.each do |line|\n if md=line.match(/\\A(\\d+)\\.\\s+(\\w+)\\Z/)\n (num, word) = md.captures\n words << SpellingWord.new(num, word, review_word, challenge_word)\n elsif line.match(/\\AReview Words/)\n review_word = true\n challenge_word = false\n elsif line.match(/\\AChallenge Words/)\n challenge_word = true\n review_word = false\n end\n end\n words\nend", "def get_word\n words = File.readlines(\"lib/5desk.txt\")\n words.each { |word| word.chomp! }\n words_list = words.select { |word| word.length.between?(5, 12)}\n\n words_list.sample.downcase.split(\"\")\n end", "def ReadFromFile()\n wordArray = Array.new\n File.open(\"mastermindWordList.txt\", \"r\") do |file| # Uncomment this to have a larger list (466000+ words)\n # Note: Only use if in original repository that contains words.txt\n # File.open(\"mastermindWordList.txt\", \"r\") do |file| # Comment this if previous line is uncommented\n file.each_line do |word|\n if CheckValidWord(word) == true\n wordArray.push(word.chomp.downcase)\n end\n end\n end\n return wordArray\nend", "def set_word_list\n word_list = []\n min_length = 5\n max_length = 12\n # Fixed external word_list file has only one word per line\n if File.exist? \"../word_list.txt\"\n File.open(\"../word_list.txt\").each do |line|\n line_clean = line.chomp\n if (line_clean.length >= min_length && line_clean.length <= max_length)\n word_list.push(line_clean)\n end\n end\n else\n word_list.push(\"FileWordListTextDoesNotExist\")\n end\n return word_list\n end", "def words_from_file( f )\n result = Array.new\n File.foreach( f ) do | line |\n result << self.words_from_string( line )\n end\n result.flatten\n end", "def to_check file_to_check\n #Opens the file to check\n file = File.open(file_to_check, 'r')\n #Reads until the end of the file\n until file.eof?\n #For each line check the spelling of each word\n file.each_line do |line|\n line.chomp!.downcase!\n #cleans punctuation\n line.gsub!($remove_punctuation, \"\")\n #Removes numbers since they can't be spelled wrong\n line.gsub!(/\\d/, \"\")\n line.split.each do |word|\n $words[word] = false\n end\n end\n end\nend", "def read_word_file(file)\n\t\tFile.foreach(file) do |line|\n\t\t\tif(@@word.legal?(line.chomp)) # Check if current line/word is legal\n\t\t\t\tLEGAL_WORDS << line.chomp # Add line/word to array of legal words\n\t\t\tend\n end\n LEGAL_WORDS.freeze # Freeze LEGAL_WORDS to make it immutable\n\tend", "def words\n scrabble_words = File.readlines(\"words.txt\")\n scrabble_words.map { |x| x.delete(\"\\n\") }\nend", "def bannedWords(inputFile)\n\t\ttext = File.open(inputFile).read\n\t\twords = []\n\t\ttext.each_line do |line|\n\t\t\twords.push(line.gsub(\"\\r\\n\",\"\"))\n\t\tend\n\t\treturn words\n\tend", "def initialize\n @words_set = Set.new\n words_file = File.expand_path(File.dirname(__FILE__) + '/words.txt')\n File.readlines(words_file).each do |line|\n @words_set.add(line.to_s.strip)\n end\n end", "def init_word_array(plaintext_file)\n ary = File.read(plaintext_file).split(\" \").map do |word|\n word.downcase.gsub(/[^a-z]/, '')\n end\n return ary\n end", "def get_random_word(filename)\n dictFile = File.open filename\n words = dictFile.readlines.reduce([]) do |words, word|\n if word.strip!.length >= 8\n words << word\n end\n words\n end\n words[(rand words.length)]\nend", "def initialize(filename=\"data/dictionary.txt\")\n file = File.new(filename, \"r\")\n @data = {}\n while (word = file.gets)\n if (word)\n word = word.chomp.upcase\n add_word(word)\n end\n end\n # @max_word_size = 4\n end", "def word_picker\n dictionary = File.readlines('lib/5desk.txt')\n word = dictionary.sample(1)[0].chomp.downcase\n word = dictionary.sample(1)[0].chomp.downcase until word.length.between?(5, 12)\n word\n end", "def valid_words(rack)\n # Load the words\n list_of_words = load_words\n array_of_valid_words = []\n # for each word check if all the letters of word are in rack\n list_of_words.each do |word|\n array_of_valid_words << word if check_word(word, rack)\n end\n array_of_valid_words\nend", "def load_words\n File.read(\"../scrabble word cheat/words.txt\").split(\"\\n\")\nend", "def add_words_from_text_file(file_path)\n words = []\n\n File.open(file_path, 'r') do |file|\n file.each do |line|\n words.push(line.chomp)\n end\n end\n\n add_words(words)\n end", "def proper_length_words\n proper_length = lambda { |line| line.length.between?(5, 12) }\n words = @file_contents.select(&proper_length)\n end", "def wordlist(filename)\n wordlist = []\n File.foreach(filename) { |x| wordlist << x.delete!(\"\\r\\n\") }\n wordlist\nend", "def words\n word_list = @lines.map do |line|\n line.split(\" \")\n end\n word_list.uniq\n end", "def words_to_skip_capitalization_of\n\t\t[ \n\t\t'of','a','the','and','an','or','nor','but','if','then','else','when','up','at','from','by','on',\n\t\t'off','for','in','out','over','to'\n\t\t]\n\tend", "def read_word_file\n File.open(\"5desk.txt\").each { |line| @text_file << line }\n end", "def humongous_sort\n list = File.readlines(file_name)\n full_list = list.sort_by { |x| x.downcase }\n end", "def choose_word\n words = File.readlines(\"5desk.txt\")\n words.map! { |word| word.chomp } # Remove newline characters from the file\n words.select! { |word| (word.size >= 5) && (word.size <= 12) }\n words.sample\n end", "def words_from(chars)\n words = Word.where(\"kanji SIMILAR TO ?\", '[' + chars.join('|') +']+' ).\n\t\t\t\treject{|w| has_duplicate_char?(w.kanji)}\n end", "def get_word_from_dictionary(filename)\n words = File.readlines(filename, chomp: true) # read in dictionary\n # get only valid length words\n valid_words = words.select do |word|\n word.length >= 5 && word.length <= 12\n end\n # choose a random valid_word\n valid_words.sample\n end", "def createWordArray(text, wordArray)\n text = File.read(text)\n newText = text.gsub(/\\W/, ' ')\n\n splitText = newText.split(' ').map(&:downcase);\n splitText.each do |word|\n wordArray << word\n end\n # puts wordArray\n return wordArray\nend", "def words_to_skip_capitalization_of\n [\n 'of','a','the','and','an','or','nor','but','if','then','else','when','up','at','from','by','on',\n 'off','for','in','out','over','to'\n ]\n end", "def scrub_dictionary(dictionary)\n dictionary.each do |word|\n word.downcase\n unless word.length >= 5 && word.length <= 12\n dictionary.delete(word)\n end\n end\n end", "def normalized_words\n self.split(/\\s+/).map { |word|\n Iconv.iconv('ascii//translit//ignore', 'utf-8', word).first.downcase.gsub(/\\W/,'')\n }.\n delete_if(&:empty?).\n map { |word|\n \"**#{word}\"\n }\n end", "def read_words(dictionary)\n unless FileTest.file?(dictionary)\n p \"Provided #{dictionary} is not a filepath or such file doesn't exist.\"\n return []\n end\n\n words = []\n IO.foreach(dictionary) { |line| words << line.strip }\n words\n end", "def select_word\n words = File.readlines(\"5desk.txt\").select { |word| word.length.between?(5, 12) }\n words[rand(words.length)].strip\n end", "def scan\n $stderr.print \"[words] \"\n\n files.each do |file|\n if $DEBUG\n $stderr.print \"\\n[scan] #{file}\"\n else\n $stderr.print \".\"\n end\n\n text = File.read(file).gsub(\"\\n\", \" \")\n states = text.split(/[.,:;?!()\"]\\s*/)\n\n states.each do |state|\n state.scan(WORD) do |word|\n word = normalize(word)\n if valid_word?(word)\n\t\t self[word] ||= Word.new(word)\n\t\t self[word].file!(file)\n end\n end\n end\n end\n\n $stderr.puts\n end", "def generate_secret_word\n dictionary = File.open('5desk.txt', 'r').readlines\n legal_words = []\n\n dictionary.each do |line|\n word = line.chomp\n legal_words << word if legal_word?(word)\n end\n\n legal_words.sample\n end", "def unixWords(inputFile)\n\t\ttext = File.open(inputFile).read\n\t\twords = []\n\t\ttext.each_line do |line|\n\t\t\twords.push(line.gsub(\"\\n\",\"\"))\n\t\tend\n\t\treturn words\n\tend", "def make_list\n file = File.new(\"dictionary.txt\")\n dict_list = Array.new\n # add all the words that are the same length as the user's word to an array\n while (line = file.gets)\n if (line.length - 1 == @word1.length)\n dict_list.push line.chomp\n end\n end\n dict_list\n end", "def get_appropriate_words(dictionary)\n\t\tnew_dictionary = []\n\t\tdictionary.each do |word|\n\t\t\tword.gsub!(\"\\r\\n\",\"\")\n\t\t\tif word.length >= 5 and word.length <= 12\n\t\t\t\tnew_dictionary << word\n\t\t\tend\n\t\tend\n\t\tnew_dictionary\n\tend", "def generate_words\n ret = []\n\n File.open('enable.txt').each do |line|\n new_line = line\n # We don't care for the new line character in the game of hangman.\n new_line = new_line.delete(\"\\n\")\n ret << new_line\n end\n\n return ret\nend", "def get_word\n dictionary_file = '5desk.txt'\n dictionary = File.readlines(dictionary_file)\n until @secret_word.length > 5 && @secret_word.length < 12\n @secret_word = dictionary.sample.rstrip.downcase\n end\n @secret_word\n end", "def find_words(words, dict)\n return nil if words.nil? || dict.nil?\n return [] if words.empty? || dict.empty?\n\n size = -1\n list = Set.new\n\n words.each do |w|\n if dict.include? w.downcase\n break if w.length < size\n\n size = w.length\n list << w\n end\n end\n list\n end", "def words( strict = false )\n splits = split( /\\b/ )\n splits.reject! { |w| !(w =~ /\\w/) } if strict\n splits\n end", "def all_caps(words)\n\t\twords = words.to_s\n\t\tif words.length < 10\n\t\t\tputs \"not 10 chars\"\n\t\telse\n\t\t\tputs words.upcase\n\t\tend\n\tend", "def secret_word\n\t\tselected_text = []\n\t\ttext = File.open('5desk.txt').each do |line|\n\t\t\tif line.strip.size >=5 && line.strip.size <=12\n\t\t\t\tselected_text << line.strip\n\t\t\tend\n\t\tend\n\t\tselected_text[rand(selected_text.size)].downcase.chomp\n\tend", "def words\n file = File.open(\"words.txt\")\n words = file.read.split(\",\").map { |x| x.gsub(\"\\\"\", \"\") }\n file.close\n words\nend", "def import\n print 'Import filename: '\n $stdout.flush\n file = gets.chomp\n fd = File.new(file, \"r\")\n itecky = file.rindex('.')\n raise 'missing dot in filename' if itecky == nil\n fname = file[0,itecky]\n fname.upcase!\n puts\n fd.each do\n |row|\n if row.strip.length == 0 or row[0,1] == '*' or row[0,1] == '#'\n next\n end\n row.chomp!\n items = row.split # deleni row na polozky oddelene mezerou\n nitems = items.length # pocet polozek\n raise \"only one word on the line\\n[#{row}]\" if nitems == 1\n if nitems == 2 # slovicka bez oddelovaci carky\n en = items[0]\n cz = items[1]\n else # slovicka a fraze s oddelovaci carkou\n i = row.index(' - ') # oddelovac anglickeho a ceskeho vyrazu\n raise \"missing ' - ' between English and Czech phrases\\n[#{row}]\" if i == nil\n en = row[0,i+1].strip # prvni cast radku - anglicka\n cz = row[i+3..-1].strip # druha cast radku - ceska\n end\n flag = false\n for iw in 0 ... $words.length do\n if $words[iw].fname == fname and\n ($words[iw].english == en or $words[iw].czech == cz) then\n flag = true\n break\n end\n end\n if flag == true then next end\n $words << Word.new(fname,0,0,en,cz)\n w = konverze($words.last.english + ' | ' + $words.last.czech)\n puts w\n end\n puts\n $stdout.flush\nend", "def filter_term_list(term_list)\n (term_list.map(&:downcase) - IGNORED_WORDS).reject { |t| t.size < 3 }\n end", "def choose_word\n input = File.open(\"words.txt\", 'r')\n words = []\n input.readlines.each do |line|\n words.push(line.strip().downcase)\n end\n input.close()\n words[rand(words.length)]\n end", "def autocomplete(input, dictionary)\n results = []\n sanitized_input = input.gsub(/[^A-Za-z]/, '')\n\n dictionary.each do |word|\n break if results.length >= 5\n next unless word.downcase.start_with?(sanitized_input)\n results << word\n end\n results\nend", "def save_ambigious_words(file_name)\n File.open(file_name, 'w') do |f|\n sentences.each do |s|\n s.words.each do |w|\n tag_strings = w.get_correct_tags().collect { |t| t.clean_out_tag }\n f.puts w.string + \"\\t\" + tag_strings.sort.join(\"\\t\") if tag_strings.count > 1\n end\n end\n end\n\n nil\n end", "def choose_code_word\n dictionary = []\n File.readlines(\"word_list.txt\").each do |word|\n if word.length > 4 && word.length < 13\n dictionary.push(word.strip.downcase)\n end\n end\n @code_word = dictionary[rand(dictionary.length)]\n end", "def read_file(path)\n lines = []\n count = 0\n vocab = Set.new\n File.open(path, \"r:ISO-8859-1\").each do |line|\n line = line.strip\n vocab.merge(parse_vocab(line))\n lines << line\n count += 1\n end\n return lines, vocab\nend", "def initialize(dictionary_file_name)\n @dictionary = Set.new(File.open(dictionary_file_name).readlines.map(&:chomp))\n @current_words = []\n @all_seen_words = {}\n end", "def insert_words\n #Large words only insert length > 5\n # TODO: refine with loop\n File.open(@config['words_config'][0]['name'], 'r') do |file|\n insert_list = []\n file.each do |line|\n # Filter letters\n if /^[a-z-]+$/ =~ (line)\n line.chop!\n line = line.gsub('-', '')\n if line.length > 5\n insert_list.push(line.downcase)\n end\n insert_list.push(line.downcase)\n end\n # Too much insert values will got error, so insert in bucket\n if insert_list.length >= @config['insert_bucket'].to_int\n insert_values(insert_list)\n insert_list = []\n end\n end\n insert_values(insert_list)\n end\n\n #Tiny words only insert length <= 5\n File.open(@config['words_config'][1]['name'], 'r') do |file|\n insert_list = []\n file.each do |line|\n # Filter letters\n if /^[a-z-]+$/ =~ (line)\n line.chop!\n line = line.gsub('-', '')\n if line.length <= 5\n insert_list.push(line.downcase)\n end\n end\n # Too much insert values will got error, so insert in bucket\n if insert_list.length >= @config['insert_bucket'].to_int\n insert_values(insert_list)\n insert_list = []\n end\n end\n insert_values(insert_list)\n end\n end", "def get_possible_words(file_path, known_anagram)\n possible_words = {}\n possible_chars = {}\n known_anagram.each_char do |c|\n possible_chars[c] = possible_chars.key?(c) ? possible_chars[c] + 1 : 1;\n end\n\n IO.foreach(file_path).each do |word|\n word.chomp!\n chars = {}\n word.each_char do |c|\n chars[c] = chars.key?(c) ? chars[c] + 1 : 1;\n end\n\n is_possible_word = true\n chars.keys.each do |c|\n if !possible_chars.key?(c) || chars[c] > possible_chars[c]\n is_possible_word = false\n break\n end\n end\n\n possible_words[word] = 1 if is_possible_word\n end\n\n possible_words\nend", "def words(string)\n return [] if string.nil?\n allowed = [' ', 'a-z', 'A-Z', '0-9'] + String::LATIN_MAP.values\n disallowed = ['¿', '¡'] # Add some disallowed chars that cannot be catched. TODO: Improve!\n match = /[^#{allowed.join('')}]/\n string.\n gsub(/\\s+/mu, ' ').\n gsub(/[#{disallowed.join}]/u, '').\n gsub(/#{match}+ /u, ' ').\n gsub(/ #{match}+/u, ' ').\n gsub(/#{match}+$/u, '').\n gsub(/^#{match}+/u, '').\n split(/ /)\n end", "def words(text)\n text.downcase.scan(/[a-z]+/)\nend", "def remove_words(line)\n line.split(' ').map do |word|\n rand <= 0.3 ? '_' * word.size : word\n end.join(' ')\nend", "def calculate_nice_words (users)\n\thappy_word = Hash.new(0)\n\tfile_name = \"happywords.txt\"\n\tyour_happy_Words = []\n\tFile.open(file_name, \"r\").each_line do |line|\n\t\tline.strip.split(' ' || '\\t').each do |s|\n\t\t\thappy_word[s] = 1\n\t\tend \n\tend\n\thappy_count = 0\n\tusers.each do |user|\n\t\tuser[\"text\"].strip.split(' ').each do |s|\n\t\t\tif happy_word[s] == 1 then\n\t\t\t\tnewWordObj= Word.new(s, user[\"text\"])\n\t\t\t\tyour_happy_Words.push(newWordObj)\n\t\t\tend\n\t\tend\n\tend\n\tyour_happy_Words\nend", "def words (text)\n return text.downcase.scan(/[a-z]+/) #find all matches of this simple regular expression\n end", "def words (text)\n return text.downcase.scan(/[a-z]+/) #find all matches of this simple regular expression\n end", "def words (text)\n return text.downcase.scan(/[a-z]+/) #find all matches of this simple regular expression\n end", "def seed_file(file, adjective)\n text=File.open(file).read\n text.each_line do |line|\n if Word.where(word: line.chomp).empty?\n Word.create(word: line.chomp, adjective: adjective)\n end\n end\nend", "def unique_words(text)\n normalize(text).uniq\nend", "def unique_words(text)\n normalize(text).uniq\nend", "def create(filename, word_input_1)\n \t@@start_word = word_input_1\n\tFile.open(filename) { |file| file.each_line { |line| @data_base << line.chomp.downcase } }\n\t# Delete every element of @data_base for which word.length != @start_word.length .\n\t@data_base = @data_base.keep_if { |word| word.length == @@start_word.length }\n\t# if there are two or more equal words in @data_base , they are deleted\n\t@data_base = @data_base.uniq\n\t@data_base\n end", "def filter_invalid_word(word)\n # Define a string which includes all valid letter\n letters = \"abcdefghijklmnopqrstuvwxyz\"\n # Define return variable and give a default value\n valid = true\n # transfer the word to lowercase and take out off \\r\\n\n word = word.chomp.downcase\n # set return value as false if the length of word not exactly equal 5\n if (word.split(//).size != 5)\n valid = false\n end\n # loop each word\n word.split(//).each do |letter|\n # If the letter occurs more than once in the word, set return value to false\n if (word.count(letter.to_s)) > 1 \n valid = false\n end\n # If the letter does not included in valid letter, set return value to false\n if (letters.include?(letter) == false) \n valid = false\n end\n end\n # return a bool value to method\n return valid\n end", "def get_valid_words(word)\n [word, word.downcase, word.capitalize, word.pluralize].uniq\n end", "def remove_punc(text)\n word_list = []\n\n\n # Checking for correct encoding and reencoding the string if necessary\n if ! text.valid_encoding?\n text = text.encode(\"UTF-16be\", :invalid=>:replace, :replace=>\"?\").encode('UTF-8')\n end\n \n # Removing puctuation\n words = text.split(/[ ,;{}`~!@#$%^&*<>.:\"'|?\\\\()_+=\\/\\[\\]\\-]/)\n \n # Looping though the list, checking for valid words, and changing their case\n for word in words\n word = word[/\\w*/]\n word.downcase!\n word_list.push(word)\n end\n\n # Deleting blanks\n word_list.delete(\"\")\n\n return word_list\n\nend", "def processed_content\n scan(/[a-z]/i).join.downcase\n\n # self.letters.downcase\n end", "def gensecretword \n @wordtable.sample.gsub(/\\s+/, \"\") # revoving all whitespaces as wordfile has phrases as possible secret words\nend", "def words\n scan(/\\w[\\w'\\-]*/)\n end", "def pick_secret_word(filename = 'word_list')\n secret_word = nil\n if File.exist? filename\n words = File.readlines filename\n suitable_words = words.select { |word| word.size.between?(5, 12) }\n secret_word = suitable_words.sample.downcase.chomp\n else\n puts 'file does not exist'\n end\n secret_word\n end", "def pick_secret_word\n\t\tFile.read(\"5desk.txt\").lines.select {|word| (4..9).cover?(word.size)}.sample.strip\n\tend", "def words\n @words ||= dictionary.select { |word| word.length > 3 }\n end", "def generate_words\r\n words = Hash.new\r\n\r\n # TODO - add error handling\r\n dictionary = \"bigdict.txt\"\r\n dictionary = \"test.txt\" if DEBUG\r\n \r\n # for benchmarking purposes, we search 80k records in about 1 second. mindblowing increase in computing power since 1980!\r\n time = Time.new\r\n\r\n File.foreach dictionary do |word|\r\n word.chomp!\r\n words[word] = score_word(word) if valid_word?(word)\r\n end #end file.each\r\n\r\n time = Time.new - time\r\n\r\n # output all words in descending score value\r\n words.sort_by { |word, score| score }.reverse.each do |result|\r\n puts \"#{result[0]} - #{result[1]}\"\r\n end\r\n\r\n puts \"Found #{words.length} words in #{time} seconds\"\r\nend", "def unique_words(text)\n split_normalise(text).uniq\nend", "def munge(name)\n infile = name + \".txt\"\n outfile = name + \".out\"\n line = File.open(infile) {|f| f.read}\n #i1 points at the first character in a word.\n #i2 points at the first character after a word.\n i1 = i2 = 0;\n while i1 < line.length || i2 < line.length\n i2 += 1 while i2 < line.length && line[i2, 1] =~ /[[:alpha:]]/ #in a word\n line[i1...i2] = permute_word(line[i1...i2])\n i1 = i2\n i1 += 1 while i1 < line.length && line[i1, 1] !~ /[[:alpha:]]/ #not in a word\n i2 = i1\n end\n File.open(outfile, \"w\") {|f| f.write(line)}\n# line\nend", "def profanity\n\t\tputs \"Please, enter the name of the censored file...\"\n\t\tnewName = gets.chomp + \".srt\"\n\t\tnewFile = File.new(newName, \"w\")\n\t\ttext = @inputFile.read\n\t\tputs \"Please, enter the name of the censored words... (or press enter to use 'swearWords.txt' by default)\"\n\t\tbanWordsName = gets.chomp\n\t\tif banWordsName == \"\"\n\t\t\tbanWordsName = \"swearWords\"\n\t\tend\n\t\tarrWords = self.bannedWords(\"./\" + banWordsName + \".txt\")\n\t\tcounter = 0\n\t\tprotect = true\n\t\ttext.each_line do |line|\n\t\t\tcounter += 1\n\t\t\tif line == \"\\r\\n\"\n\t\t\t\tcounter = 0\n\t\t\tend\n\t\t\tif counter == 2 && line[(3..4)].to_i >= 30 && line[(20..21)].to_i >= 30\n\t\t\t\t#if it's not protected time\n\t\t\t\tprotect = false\n\t\t\tend\n\t\t\tif counter > 2 && protect == true\n\t\t\t\t#/\\W|\\d/ regular expresion to exclude non digit and non letter\n\t\t\t\twords = line.split(/\\W|\\d/)\n\t\t\t\tfor i in words\n\t\t\t\t\tif arrWords.include?(i.downcase) && i != \"\"\n\t\t\t\t\t\tline = line.gsub(i, \"CENSORED\")\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\tnewFile.puts(line)\n\t\tend\n\t\tnewFile.close\n\t\tputs newName + \" created at: \" + Time.now.to_s\n\t\treturn nil\n\tend", "def all_excluded_words\n (excluded_words + (lazy? ? LAZY_WORDS : [])).map(&:downcase)\n end", "def new_game\n dictonary = File.new('dictonary.txt', 'r')\n cleaned_dictonary = dictonary.readlines(chomp: true).select { |word| word.length >= 5 && word.length <= 12 }\n dictonary.close\n word = cleaned_dictonary.sample\n set_up_game(word, '_' * word.length)\n end" ]
[ "0.7316448", "0.7250181", "0.716863", "0.7066948", "0.70191926", "0.6926973", "0.679912", "0.67781585", "0.6740626", "0.67250496", "0.668779", "0.66851044", "0.6638561", "0.6616625", "0.655909", "0.6550625", "0.6515035", "0.64642227", "0.6454608", "0.6449782", "0.64079714", "0.63618755", "0.6335169", "0.63256925", "0.6309564", "0.6286874", "0.6267682", "0.62555665", "0.62380403", "0.6217308", "0.6186052", "0.6183066", "0.6181717", "0.6176951", "0.6163433", "0.6148594", "0.6120455", "0.6107316", "0.60969543", "0.6059159", "0.60385203", "0.60384375", "0.60277164", "0.600143", "0.5994647", "0.597549", "0.59568083", "0.5951169", "0.5944733", "0.5906907", "0.5884935", "0.586784", "0.5865013", "0.58452225", "0.58232415", "0.5823228", "0.58223736", "0.5794879", "0.57829994", "0.57817584", "0.5768292", "0.57643783", "0.574453", "0.5706346", "0.5705028", "0.5689419", "0.56850404", "0.5682952", "0.5672224", "0.56715417", "0.563589", "0.5623759", "0.5621568", "0.5619511", "0.56118256", "0.5607614", "0.5599461", "0.55992943", "0.55971223", "0.55971223", "0.55971223", "0.5589705", "0.5588523", "0.5588523", "0.5581828", "0.5572044", "0.55661136", "0.556271", "0.5560097", "0.55514264", "0.5544406", "0.5543905", "0.5543881", "0.5541949", "0.5541706", "0.55096674", "0.5507711", "0.55006963", "0.54989165", "0.5481449" ]
0.74152505
0
Return a new Dictionary with only the words of the given length
def with_only_words_of_size(len) other = Dictionary.new @dictionary_per_size[len] ||= @words.select{|word| word.word.length == len } words = @dictionary_per_size[len] other.add_words(words) other end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def collect_words_of_length\n\t\t@dictionary.select! { |el| el.length == @word_length + 1 }\n\t\tmake_smart_dictionary\n\tend", "def narrow_search_by_length\n self.dictionary.select { |word| word.length == self.word_length }\n end", "def keep_only_words_of_length(len)\n change_wordlist(@words.select{|word,letters| word.word.length == len })\n end", "def dictionary_select(length)\n @dictionary = File.readlines('dictionary.txt').map(&:chomp)\n @new_list = @dictionary.select { |word| word.length == length }\n dictionary_narrow\n end", "def prepare_dictionary(dictionary, length)\n result = IO.readlines(dictionary).map(&:chop)\n result.delete_if { |word| word.length > length }\n result.sort_by!(&:length).reverse!\n end", "def length_finder(words)\n lengths = {}\n words.each do |word|\n lengths[word] = word.length\n end\n lengths.values\nend", "def words(init, length)\n @words[init].select { |w| w.size == length }\n end", "def filter_lengths(strings, length = 5)\n words = []\n strings.each do |word|\n if word.length >= length\n words << word\n end\n end\n return words\nend", "def filter_lengths(strings, length=5)\n big_words = []\n strings.each { |ele| big_words << ele if ele.length >= length }\n return big_words\nend", "def words_of_length(length)\n @generated_word_lengths ||= [0]\n @words_by_length ||= {0 => ['']}\n\n while @generated_word_lengths[-1] < length \n last_length = @generated_word_lengths[-1] \n next_length = last_length + 1\n @words_by_length[next_length] = @words_by_length[last_length].collect{|word| next_words_for word }.flatten\n @generated_word_lengths << next_length\n end\n\n @words_by_length[length]\n end", "def words\n @words ||= dictionary.select { |word| word.length > 3 }\n end", "def cut_words(length)\n @words = @words.select do |word|\n word.length == length\n end\n end", "def dictionary\n hash = {}\n @length_indexed_dict.each do |len, words_of_same_length|\n hash.merge! words_of_same_length\n end\n hash\n end", "def group_words_by_length\n words = [\"alice\", \"tony\", \"steve\", \"carlos\", \"rick\", \"martin\", \"chris\", \"tom\", \"david\", \"megan\", \"sue\"]\n\n #=> {5 => [\"alice\", \"steve\", \"carlos\", \"chris\", \"david\", \"megan\"], 4 => [\"tony\", \"rick\"], 3 => [\"sue\", \"tom\"]}\nend", "def guess_word(word_length)\n self.sample(dict.select { |word| word.length == word_length } )\n end", "def get_appropriate_words(dictionary)\n\t\tnew_dictionary = []\n\t\tdictionary.each do |word|\n\t\t\tword.gsub!(\"\\r\\n\",\"\")\n\t\t\tif word.length >= 5 and word.length <= 12\n\t\t\t\tnew_dictionary << word\n\t\t\tend\n\t\tend\n\t\tnew_dictionary\n\tend", "def pick_a_word(length)\n #remove sandwich code and change into map after it gets working\n words = get_words.split(\" \")\n filtered_wrds_by_length = []\n \n words.each do |wrd| #or select method\n if wrd.size == length.to_i\n filtered_wrds_by_length << wrd\n end\n end\n\n chosen_word = filtered_wrds_by_length.sample\n\nend", "def group_words_by_length\n words = [\"alice\", \"tony\", \"steve\", \"carlos\", \"rick\", \"martin\", \"chris\", \"tom\", \"david\", \"megan\", \"sue\"]\n\n # words.group_by { |word| word.size }\n words.group_by(&:size)\n #=> {5 => [\"alice\", \"steve\", \"carlos\", \"chris\", \"david\", \"megan\"], 4 => [\"tony\", \"rick\"], 3 => [\"sue\", \"tom\"]}\nend", "def word_sizes(words)\n length_arr = []\n hash_words = {}\n words.gsub(/[^[:word:]\\s]/, '').split(' ').each do |word| \n length_arr << word.length\n end\n length_arr.uniq.each do |element|\n hash_words[element] = length_arr.count(element)\n end\n hash_words\nend", "def word_lengths(str)\n hsh = {}\n str.split(' ').each { |k| hsh[k] = k.length }\n hsh\nend", "def proper_length_words\n proper_length = lambda { |line| line.length.between?(5, 12) }\n words = @file_contents.select(&proper_length)\n end", "def scrub_dictionary(dictionary)\n dictionary.each do |word|\n word.downcase\n unless word.length >= 5 && word.length <= 12\n dictionary.delete(word)\n end\n end\n end", "def filter_lengths(strings, length=5)\n strings.select { |string| string.length >= length }\nend", "def receive_secret_length\n puts \"How long is your word?\"\n word_length = gets.chomp.to_i\n dictionary.select! { |dictionary_word| dictionary_word.length == word_length }\n nil\n end", "def find_unique_by_size(size=DEFAULT_SIZE)\n matches = {}\n \n @dictionary.rewind if @dictionary.respond_to?(:rewind)\n \n @dictionary.each do |w|\n target_word = w.chomp\n word = w.chomp\n word.gsub!( /\\W/, '' ) if ignore_non_word_chars\n \n next if word.length < size\n \n index = 0\n while (substring = word[index,size]) && substring.length == size\n substring.downcase! if ignore_case\n \n if matches.key? substring\n # There's already a word. We'll set it to nil and filter out nils later.\n matches[substring] = nil\n else\n matches[substring] = target_word\n end\n index += 1\n end \n \n end\n \n matches.delete_if{ |k,v| v.nil? }\n end", "def word_lengths(str)\n new_arr = str.split(\" \")\n hsh = {}\n new_arr.each do |ele|\n hsh[ele] = ele.length \n end\n hsh\nend", "def filter_lengths(strings, length=5)\n strings.select { |each| each.length >= length }\nend", "def word_length(list)\n hash = {}\n list.each { |w| hash[w] = w.size }\n hash\nend", "def word_lengths(str)\n hashed = str.split(\" \").map {|word| [word, word.length]}.flatten\n return Hash[*hashed]\nend", "def select_long_words(words)\n i = 0\n newArr = []\n while i < words.length\n if words[i].length > 4\n newArr << words[i]\n end\n i += 1\n end\n return newArr\n end", "def counts_by_length(counts)\n counts_by_length = {}\n counts.each do |key, value|\n l = key.length.to_s\n if counts_by_length.has_key?(l)\n counts_by_length[l] << value\n else\n counts_by_length[l] = [value] \n end\n end\n counts_by_length\nend", "def word_sizes(str)\n length_hsh = {}\n\n str.split(' ').each do |word|\n if length_hsh.key?(word.length)\n length_hsh[word.length] += 1\n else\n length_hsh[word.length] = 1\n end\n end\n\n length_hsh\nend", "def tell_secret_word_length\n @secret_word = @dictionary.sample\n @secret_word.length\n end", "def words(length)\n WORDS.sample(length)\nend", "def get_words_of_length(x)\n arr = []\n self.each do |w|\n if w.length == x\n arr << w\n end\n end\n return arr\n end", "def select_long_words(words)\n long_words = []\n \n i = 0\n while i < words.length\n if words[i].length > 4\n long_words << words[i]\n end\n \n i += 1\n end\n \n return long_words\nend", "def word_lengths(str)\n hash = {}\n str.split.each do |word|\n hash[word] = word.length\n end\n hash\nend", "def word_sizes(string)\n keys =[]\n words = string.split.each do |word|\n keys << word.length\n end\n keys = keys.uniq\n size = {}\n keys.each do |key|\n size[key] = words.count{|wordies| key == wordies.length}\n end\n size\nend", "def word_lengths(str)\n words = str.split(\" \")\n word_lengths = {}\n\n words.each do |word|\n word_lengths[word] = word.length\n end\n\n word_lengths\nend", "def word_lengths(sentence)\n\twords = sentence.split(\" \")\n \thash = {}\n words.each {|word| hash[word] = word.length}\n return hash\n \nend", "def word_sizes(words)\n result_hash = Hash.new(0)\n words.split.each do |word| \n word = word.gsub(/[^a-z]/i,\"\")\n result_hash[word.length] += 1\n end\n result_hash\nend", "def select_long_words(words)\n\n new_arr = []\n\n i = 0\n while i < words.length\n if words[i].length > 4\n new_arr << words[i]\n else \n end \n i += 1\n end \n return new_arr\n\nend", "def word_lengths(str)\n result = {}\n str.split.each {|word| result[word] = word.length}\n result\nend", "def select_long_words(words)\n\tnew_array = []\n \n\ti = 0\n\twhile i < words.length\n\t\tif words[i].length > 4\n \t\tnew_array << words[i]\n end\n \ti += 1\n end\n \n return new_array\nend", "def word_lengths(str)\n ans = Hash.new\n str.split.each do |word|\n ans[word] = word.length\n end\n ans\nend", "def words_of_same_length(word)\n\treturn $words[word.length]\nend", "def word_lengths(sentence)\n split = sentence.split(\" \")\n hash = {}\n\n split.each do |word|\n hash[word] = word.length\n end\n\n return hash\nend", "def select_long_words(words)\n\ti = 0\n arry = []\n \twhile i < words.length\n if words[i].length > 4\n arry << words[i]\n end\n i += 1\n end\n return arry\nend", "def pick_dictionary_word(options={})\n min_length = (options[:exact] || options[:min] || 1).to_i\n max_length = (options[:exact] || options[:max] || 5).to_i\n \n language = (options[:language] || @@default_language).to_s\n validate_language(language)\n \n dictionary = options[:dictionary] || @@dictionaries[language] ||= load_dictionary(language)\n validate_dictionary(dictionary)\n \n sized_words = dictionary.select do |word|\n min_length <= word.length && word.length <= max_length\n end\n if !sized_words.empty?\n return sized_words[rand(sized_words.length)] \n else\n # TODO: How should an empty sized_words be handled?\n return \"\"\n end\n end", "def word_lengths(str)\n hsh = Hash.new\n str.split.each do |word|\n hsh[word] = word.length\n end\n hsh\nend", "def filter_long_words(sentence, n)\n #your code here\n words = []\n for word in sentence.split(\" \")\n words << word if word.length > n\n end\n words\nend", "def word_lengths(str)\n words = str.split(\" \")\n word_length = Hash.new(0)\n words.each {|ele| word_length[ele] = ele.length}\n word_length\nend", "def word_lengths(str)\n str.split.reduce({}) do |acc, word|\n acc[word] = word.length\n acc\n end\nend", "def select_long_words(words)\n long = []\n\n i = 0\n\n while i < words.length\n word = words[i]\n if word.length > 4\n long << word\n end\n i += 1\n end\n\n return long\nend", "def word_lengths(sentence)\n words = sentence.split(\" \")\n lengths = {}\n\n words.each { |word| lengths[word] = word.length}\n\n return lengths\nend", "def long_words(words, length)\n # TODO\nend", "def edgy_words(hash)\n return hash if hash.keys.size <= 15\n\n h = hash.dup\n h.each do |word, prob|\n h[word] = 1.0 - h[word] if h[word] >= 0.5\n end\n arr = h.to_a.sort{|x, y| x[1] <=> y[1]}\n words = arr[0, 15].collect{|x| x.first}\n\n result = words.inject({}){|h, w| h[w] = hash[w]; h}\n end", "def find_words_of_length(w_len, phone_number)\n pn_len = phone_number.length\n index = 0\n\n while (index <= (pn_len - w_len)) do\n seq = phone_number[index...(index + w_len)]\n num_key = seq.to_i\n\n if ((seq[0] != '0') && @word_seq[num_key])\n yield index, @word_seq[num_key]\n end\n index += 1\n end\n\n end", "def big_words(str)\n # split my string into individual words\n # loop over my words\n # check the length of each word\n # if the length of the word is >= 5, keep it. \n # else delete it.\n # return joined words\n\n words = str.split(' ')\n long_words = []\n i = 0\n while i < words.length\n if words[i].length >= 5 #=> words[i] < 5\n # words.delete_at(i) # be careful of delete_at in loops.\n long_words << words[i]\n end\n i += 1\n end\n return long_words.join(' ')\nend", "def word_sizes(words_string)\n\n # We create a new hash, but we have to initialize is this way vs hash = {}\n # Because the first time we go to count[word.size] += 1, the element doesn't\n # exist yet, and returns nil. Since nil can't be added to 1, we have to do it this way\n counts = Hash.new(0)\n\n # Next we're going to split the string into words, then iterate over each word.\n # We assign a new variable clean_word equal to the word that we're iterating on\n # and delete anything that's not a letter using a simple REGEX.\n\n # We will then be counting the length of each word (based on the new variable clean_word)\n # that we're iterating, and storing that in our hash, counts.\n\n words_string.split.each do |word|\n clean_word = word.delete('^A-Za-z')\n counts[clean_word.size] += 1\n end\n # Return our hash\n counts\nend", "def word_sizes(sentence)\n hash = Hash.new(0)\n words = sentence.split(\" \")\n words.map! { |word| word.gsub(/[^a-zA-Z]/, ' ')}\n words.map! { |word| word.delete(\" \")}\n words.each { |word| hash[word.length] += 1 }\n hash\nend", "def word_lengths(str)\n # nested = []\n # str.split.each do |word|\n # nested << [word, word.length]\n # end\n # nested.to_h\n\n lengths = {}\n str.split.each {|word| lengths[word] = word.length}\n lengths\nend", "def get_word_list\n @word_list = @lines.reject do |line|\n line.length < 5 || line.length > 12\n end\n end", "def secret_word(length)\n @nodes.each do |node|\n word = find_word(node, '', length)\n return word if word.length == length\n end\n end", "def word_lengths(sentence)\n hassh = Hash.new(0)\n sentence.split(\" \").each {|w| hassh[w] = w.length }\n return hassh\nend", "def word_sizes(string)\n cleaned_string = string.gsub(/[^\\w\\s]/, '') \n #cleaned_string = string.delete('^A-Za-z ')\n # puts cleaned_string\n result = Hash.new(0)\n cleaned_string.split.each do |word| \n result[word.size] += 1\n end\n result\nend", "def threshold(text, threshold: false)\n thresh = (word_frequency(text).select { |k, v| v > 4})\n threshold ? thresh.reject {|k,v| k.length < 6} : thresh.reject {|k,v| k.length < 4}\nend", "def select_long_words(words)\n longWords = []\n\tfor i in 0..words.length-1\n word = words[i]\n if word.length > 4\n longWords << word\n end\n end\n return longWords\nend", "def dictionary()\n word_list = {\n \"hello\" => \"hi\",\n \"to\" => \"2\",\n \"two\" => \"2\",\n \"too\" => \"2\",\n \"for\" => \"4\",\n \"four\" => \"4\",\n \"be\" => \"b\",\n \"you\" => \"u\",\n \"at\" => \"@\",\n \"and\" => \"&\"\n }\nend", "def word_sizes(words)\n word_count = Hash.new(0)\n words = words.delete \"^a-zA-Z \"\n\n words.split.each do |word|\n word_count[word.length] += 1\n end\n\n word_count.sort.to_h\nend", "def word_sizes(string)\n keys = string.split(\" \").map { |word| word.delete('^A-Za-z') }.map(&:size)\n values = keys.map { |n| keys.count(n) }\n Hash[keys.zip values]\nend", "def word_sizes(string)\n split_string_array = string.split(\" \")\n keys = []\n results = {}\n\n split_string_array.each do |word|\n keys << word.length\n end\n\n keys.each do |key|\n results[key] = keys.count(key)\n end\n\n results.sort_by {|k,v| k}.to_h\nend", "def get_word_from_dictionary(filename)\n words = File.readlines(filename, chomp: true) # read in dictionary\n # get only valid length words\n valid_words = words.select do |word|\n word.length >= 5 && word.length <= 12\n end\n # choose a random valid_word\n valid_words.sample\n end", "def substrings words, dictionary\n hits = Hash.new\n dictionary.each do |lookup|\n hits[lookup] = words.scan(/#{lookup}/i).length\n end\n hits.delete_if {|k,v| v == 0} # squeeze out the empties\nend", "def word_sizes2(string)\n frequency = Hash.new(0) #set the default value to 0\n string.split.each do |word| \n frequency[word.length] += 1\n end\n frequency\nend", "def word_sizes(string)\n result = {}\n string.split().map do |value|\n result[value] = value.size\n end\n result\nend", "def most_common(text, length: 3)\n new_instances = word_instances(text).delete_if {|k,v| k.length < length}\n new_instances.max_by {|k,v| v}\nend", "def select_long_words(words) # Define method\n i = 0 # Set starting index value\n new_array = [] # Create new empty array to shovel values into\n \n while i < words.length # Length of word argument array must be less than index value of current iteration\n if words[i].length > 4 # Character length of words of index value must be greater than 4\n new_array << words[i] # Words of i value then is allowed to be put into array\n end\n i += 1 # Increase by 1 per iteration til condition no longer logical\n end\n return new_array \n\nend", "def find_words(words, dict)\n return nil if words.nil? || dict.nil?\n return [] if words.empty? || dict.empty?\n\n size = -1\n list = Set.new\n\n words.each do |w|\n if dict.include? w.downcase\n break if w.length < size\n\n size = w.length\n list << w\n end\n end\n list\n end", "def word_sizes(str)\n hsh = {}\n new_str = str.gsub(/[^a-z ]/i, '')\n arry = new_str.split.map(&:size)\n arry.map { |word| hsh[word] = arry.count(word) }\n hsh\nend", "def word_sizes(word_string)\n word_sizes = Hash.new(0)\n array = word_string.split.each { |string| string.slice!(/[^a-zA-Z]/) }\n array.each { |word| word_sizes[word.size] += 1 }\n word_sizes\nend", "def word_sizes(words)\n count_hash = Hash.new(0)\n words.split.each do |word|\n clean_word = word.delete('^a-zA-Z')\n count_hash[clean_word.size] += 1\n end\n count_hash\nend", "def select_long_words(words)\n\tlongWords = []\n\n\ti = 0\n\twhile i <= words.length\n\t\ttemp = words[i]\n\n\t\tif temp.length > 4\n\t\t\tlongWords << temp\n\t\tend\n\n\t\ti += 1\n\tend\n\n\treturn longWords\nend", "def possible_words\n\t\t\t@dictionary.grep to_r\n\t\tend", "def new(options= {})\n password = \"\"\n total_length = (options[:length] || 12).to_i\n word_count = (options[:words] || 2).to_i\n digit_length = (options[:digits] || 2).to_i\n word_options = options.slice(:language, :dictionary)\n length_variance = 3\n \n validate_word_count(word_count)\n \n total_digits = digit_length * (word_count - 1)\n avg_word_length = (total_length - total_digits) / word_count\n \n validate_avg_word_length(avg_word_length)\n\n word_count.downto(1) do |n|\n length_needed = total_length - password.length\n break if length_needed <= 0\n\n if n == 1 # this is the last word\n word_options[:exact] = length_needed\n else # not the last word\n word_options[:min] = [1, avg_word_length - length_variance].max\n # max_length = total remaining length - remaining digits and words\n word_options[:max] = length_needed - ((n-1) * (digit_length + avg_word_length))\n end\n password << pick_dictionary_word(word_options)\n password << pick_random_number(digit_length).to_s if digit_length > 0 && n > 1\n end\n\n return password\n end", "def word_sizes(str)\n ary = str.split\n # Create array of word lengths\n num_array = ary.map do |word|\n word.length\n end\n rtn_hsh = ary.each_with_object({}) do |word, hsh|\n hsh[word.length] = num_array.count(word.length)\n end\n rtn_hsh\nend", "def initialize(dictionary)\n @words, @maxwords = [], []\n File.open(dictionary).each do |line|\n l = line.strip.downcase\n @words << l if (l.length >= MINCHARACTERS && l.length <= MAXCHARACTERS)\n @maxwords << l if l.length == MAXCHARACTERS\n end\n end", "def filter_attempt_hash( hash, threshold = 1 )\n keepers = {}\n hash.each do |k,v|\n keepers[k] = v if v.length >= threshold\n end\n keepers\nend", "def illegal_words\n @words.select{ |word| word.length > @width }\n end", "def word_sizes(str)\n str.gsub!(/[^A-Za-z0-9 ]/, '')\n hash = {}\n str = str.split(\" \")\n str.each_index {|i| str[i] = str[i].length}\n str.each {|v| hash[v] = str.count(v)}\n hash\nend", "def load_dict\n words = []\n File.open(\"dict.txt\").each do |line| # Hard code for now\n if line.length.between?(5, 12)\n words << line.rstrip.downcase\n end\n end\n words\n end", "def receive_secret_length(board)\n\t\t@board = board\n\t\t@valid_words = @dictionary.dup\n\t\t\t.reject{|word| word.length != board.bar.length }\n\t\t@guessed_letters = []\n\tend", "def word_sizes(str)\n str = str.gsub(/[^a-zA-Z ]/,\"\")\n h1 = Hash.new(0)\n str.split.each do |element|\n h1[element.size] += 1\n end\n h1\nend", "def word_lengths(str)\n counter = Hash.new(0)\n str.split(\" \").each do |x|\n counter[x] = x.length\n end\n counter\nend", "def build_dict(dict)\n dict.each do |word|\n sz = word.size\n @words[sz][word] = true\n end\n end", "def word_sizes(str)\n hash = {}\n str = str.split(\" \")\n str.each_index {|i| str[i] = str[i].length}\n str.each {|v| hash[v] = str.count(v)}\n hash\nend", "def word_sizes(text)\n word_size = Hash.new(0)\n text.split.map do |word|\n word.delete \"^A-Za-z\"\n word_size[word.size] += 1\n end\n word_size\nend", "def word_sizes(str)\n arr = str.split(' ')\n hsh = Hash.new(0)\n \n arr.each {|word|\n hsh[word.delete('^A-Za-z').length] += 1\n }\n \n hsh\nend", "def substrings text,dictionary\n\ttext.downcase!\n\thash = {}\n\tdictionary.each do |word|\n\t\tcount = text.scan(word.downcase).length\n\t\thash[word] = count if count > 0\n\tend\n\thash\nend", "def word_sizes(sentence)\n cleaned = sentence.gsub(/[^0-9a-z]/i, ' ')\n grouped = cleaned.split.group_by {|x| x.length }\n results = grouped.each {|x, i| grouped[x] = i.length}\n end" ]
[ "0.84181213", "0.77309114", "0.7625024", "0.7382154", "0.73415136", "0.72445273", "0.72357553", "0.7179031", "0.71778965", "0.714575", "0.71394193", "0.70540893", "0.6883865", "0.6879563", "0.68610084", "0.6850231", "0.65873605", "0.6499255", "0.64796543", "0.638994", "0.63720644", "0.63624436", "0.6312796", "0.62821776", "0.6272413", "0.62597394", "0.6258221", "0.62444246", "0.62148905", "0.61995167", "0.6191353", "0.61896193", "0.6181287", "0.6178949", "0.61700517", "0.6169494", "0.6163908", "0.61435944", "0.6131584", "0.61230266", "0.611089", "0.6091338", "0.60818905", "0.60811925", "0.6074321", "0.60544366", "0.60510284", "0.6045609", "0.6036328", "0.6019025", "0.60169655", "0.6002738", "0.59997", "0.599879", "0.5997638", "0.5996052", "0.5991846", "0.5971527", "0.5952103", "0.59397525", "0.5937115", "0.59369314", "0.59353095", "0.5934542", "0.59140867", "0.5906283", "0.5898552", "0.5876128", "0.5875414", "0.5863656", "0.5836333", "0.58362037", "0.58334094", "0.5831684", "0.582241", "0.58222026", "0.5815169", "0.5812997", "0.5806955", "0.5799438", "0.5797642", "0.579409", "0.5776143", "0.5765248", "0.575486", "0.57530147", "0.5751281", "0.5741547", "0.5740682", "0.57336444", "0.5729133", "0.5721872", "0.5721709", "0.5716637", "0.5710709", "0.5688088", "0.56779295", "0.56643176", "0.5649875", "0.56340545" ]
0.85993326
0
Access each Word individually
def [](index) @words[index].word end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_words\n words = self.dictionary.map do |dictionary_entry|\n dictionary_entry.word.lexical_item\n end\n words \n end", "def in_a_word\n WORDS[self]\n end", "def idx_get_word(i)\n @tparses[i][:word]\n end", "def word\n @word\n end", "def word\n @word\n end", "def word\n @word\n end", "def word\n end", "def each_word(data=nil)\n\t\t\tself.words(data).each {|word| yield word }\n\t\tend", "def each\n words.each { |word| yield( word ) }\n end", "def [](word_index)\n word_list[word_index]\n end", "def each\n words.each { |word| yield(word) }\n end", "def words\n grid.words.map {|word| decorate_word(word) }\n end", "def word\n\t\t\t@word.set(buffer.index, find_eow)\n\t\tend", "def get_words(text) #no!, two methods named get_words, see word_search.rb\n \twords = text.split('')\n \twords.each do |word|\n \t\t#how to check if word is correct or not?\n \t\tWord.new(name: word, ngsl: false, list: self.id )\n \t\t# example = Wordnik.word.get_top_example(word)['text']\n \tend\n end", "def words\n self.scan(WORD_PATTERN)\n end", "def words\n @words\n end", "def words\n @words\n end", "def get_word\r\n return_word\r\n end", "def each(&block)\n @words.each(&block)\n end", "def words\n @content.split\n end", "def words\n @content.split\n end", "def get_word\n dictionary.get_word\n end", "def get_word_value_array(word)\n html = RestClient.get(\"http://www.thesaurus.com/browse/#{word}\")\n word_string = Nokogiri::HTML(html).css(\"div.relevancy-list ul li a\").to_a\n part_of_speech = Nokogiri::HTML(html).css(\"div.mask ul li a em\")[0].text\n word_definition = Nokogiri::HTML(html).css(\"div.mask ul li a strong\")[0].text\n [word_string, \"(#{part_of_speech}) #{word_definition}\"]\n end", "def word; end", "def word; end", "def word; end", "def word; end", "def word; end", "def word()\r\n\t\treturn @word\r\n\tend", "def find_word(lexical_item)\n \n end", "def each_word(&block)\n @words.each_key(&block)\n end", "def words(*args); data(2, *args); end", "def words\n words = @phrase.split(\" \")\n words.each do |word|\n translate(word)\n end\n end", "def words\n @phrase = @phrase.split(' ')\n end", "def each\n word_array = words\n index = 0\n while index < word_array.size\n yield( word_array[index] ) # pass parameter to block.\n index+=1\n end\n end", "def word_list\n @word_list\n end", "def words\n @words ||= Array(@grpc.words).map do |b|\n Word.from_grpc b\n end\n end", "def [](index)\r\n words[index]\r\n end", "def words\n @words_array = @phrase.split(' ')\n end", "def get_words\n @sentences.each_index do |i|\n s = @sentences[i]\n words = s.split(' ')\n words.each do |w|\n word = w.gsub(WORD_SANITIZE, '').downcase\n if belongs_to_known_abbreviations? word\n add_word_to_result(word, i)\n else\n add_word_to_result(word.gsub(DOT_SANITIZE, ''), i)\n end\n end\n end\n end", "def each_v1\n words.each { |word| yield(word) }\n end", "def words\n terms.collect { |t| t.word }\n end", "def index\n @mnemonics = @word.mnemonics.all\n end", "def word_list\n # Returning only the terms of each definition as an array.\n list_of_terms = @words.map do |key, definition_instance|\n definition_instance.term\n end\n end", "def next_word\n start = @optr\n len = @txt.length\n\n while @optr < len && @txt[@optr].char != \" \"\n @optr += 1\n end\n\n while @optr < len && @txt[@optr].char == \" \"\n @optr += 1\n end\n\n @txt[start...@optr]\n end", "def adv\n @words1 = Word.all.sample(1)[0].word\n @words2 = Word.all.sample(1)[0].word\n end", "def extract_word_index\n self.word_index = self.title[0].upcase\n end", "def output_word\n end", "def read_word\n @words[@read_index += 1]\n end", "def word_selector\n\t\t@game_word = @word.sample\n\tend", "def words(data=nil, &block)\n\t\t\t#\tsequence the phrases\n\t\t\t#\t\t*sigh* verb and a noun\n\t\t\tnodes = sequence(data, &block)\n\n\t\t\t#\tcomposite the words\n\t\t\t#\t\teach node contains an array of words\n\t\t\tnodes.collect {|node| node.words }.flatten\n\t\tend", "def idxv_get_word(v)\n v.collect {|x| @tparses[x][:word]}\n end", "def words\n %w(this array has five words)\nend", "def list\n @words=Word.find(:all)\n end", "def index\n @words = Word.all\n end", "def index\n @words = Word.all\n end", "def words\n return @words if @words\n @words = []\n charno = self.charno\n text.scan(/(\\s*)(\\S*)/)[0..-2].each { |spaces, word|\n charno += spaces.size\n @words << [charno, word] if word != \"\"\n charno += word.size\n }\n @words\n end", "def plays\n return @array_of_words\n end", "def word\n Word.find_by(text: params[:text])\n end", "def lookup_word(word)\n h = self.lookup_entry(word)\n [ h[:pronounce], h[:meaning] ]\n end", "def word\n @word.downcase\n end", "def show\n @words = @word_list.words.limit\n end", "def list\n @list ||= Vidibus::Words.words(input)\n end", "def lookup(word)\n word.gsub!(/\\s/, \"+\")\n meaning_file = initialize_files(word)[0]\n f = File.open(meaning_file)\n begin\n extract_text(f)\n rescue Exception\n raise\n end\n\n end", "def word_values\n return @words.values\n end", "def process_words\n reset_counts\n # iterate through radlib_array and add counts\n self.each do |w|\n Rails.logger.debug(w.inspect)\n case w[\"type\"]\n when \"word\"\n @num_words += 1\n if w[\"selectable\"] && w[\"selected\"]\n @num_blanks += 1\n # fix for old radlibs\n unless w[\"user_pos\"]\n w[\"user_pos\"] = w[\"predicted_pos\"]\n end\n type = w[\"user_pos\"].gsub(\"-\", \"_\").to_sym\n Rails.logger.debug(type)\n @num_blanks_by_type[type] += 1\n end\n when \"whitespace\"\n # don't need to do anything here\n when \"punc\"\n @num_sentences += 1 if w[\"text\"] == \".\" || w[\"text\"] == \"!\" || w[\"text\"] == \"?\"\n end\n end\n end", "def words\n\t\tscan(/\\w[\\w\\'\\-]*/)\n\tend", "def index\n @ms_words = MsWord.all\n end", "def [](word)\n @index[word]\n end", "def e_words(str)\r\n \r\nend", "def load_words\n case @strategy\n when :user\n @words = twitter_user.status.text.split(/\\s/) \n when :search\n @words = twitter_search(@term).statuses.map(&:text).join(\" \").split(/\\s/)\n end\n end", "def getWord\n return RandomWord.adjs.next\nend", "def dictionary()\n return @data[:words]\n end", "def word\n @word.downcase\n end", "def possible_words\n\t\t\t@dictionary.grep to_r\n\t\tend", "def _word\n\n _save = self.pos\n while true # choice\n _tmp = apply(:_atom)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_quoted_string)\n break if _tmp\n self.pos = _save\n break\n end # end choice\n\n set_failed_rule :_word unless _tmp\n return _tmp\n end", "def words\n self.sentence.split('-')\n end", "def words\n scan(/\\w[\\w'\\-]*/)\n end", "def get_word\n @lettercollection.push(@string_as_array[@i])\n @lettercollection.join('')\nend", "def each &block\n enumerator = Enumerator.new do |words|\n words << as_word if terminal?\n children.each { |child| child.each { |word| words << word } }\n end\n\n block.nil? ? enumerator : enumerator.each(&block)\n end", "def word\n @letters.join\n end", "def get_my_words\n # Words associated with online harassment\n trigger_words = [\"rape\",\"murder\",\"nigger\",\"slut\",\"whore\",\"bitch\",\"cunt\",\"kill\",\"die\",\"testword\"]\n my_words = Word.where(user_id: self.id)\n my_words.each do |word|\n trigger_words << word.word\n end\n return trigger_words\n end", "def word\n @word ||= Word.current_word('a-zA-Z0-9_.', :left).split('.').last\nend", "def query(word)\n node = @the_node\n results = []\n word.split(\"\").each do |letter|\n next_node = node[letter]\n if next_node != nil\n node = next_node\n next\n else\n return ['']\n end\n end\n results << Word.new(word, node.final)\n results += get_childs(node).map{|s| Word.new(word) + s}\n results.select{|r| r.final}.map{|r| r.to_s }\n end", "def [](word1)\n @index[word1]\n end", "def morphword\n @morphword\n end", "def get_word\n word = @word_list[rand(@word_list.length)]\n @word = word.gsub(/\\s+/, \"\").downcase\n end", "def get_word_results(word, label=nil)\n return [word]\n end", "def whisper_words(words)\n\nend", "def next_words_for(word) \n if word.nil? or word.empty?\n generator_names \n else\n name_of_last_generator_inverse = word[-1].swapcase\n generator_names.find_all{|name| name != name_of_last_generator_inverse }.map{|name| word + name }\n end\n end", "def word\n if @sym == SYM_ATOM || @sym == SYM_QTEXT\n save_text\n get\n else\n\t error \"expected word, got #{@sym.inspect}\"\n\tend\n end", "def index_word(word)\n wordArray = word.split('')\n add_child(@root, wordArray, word)\n end", "def morph_words\n words = @query.split(/[^a-zA-Z0-9]/)\n morphed_words = words.map{|word| [word,Text::Metaphone.double_metaphone(word)]}\n morphed_words\n end", "def getword(i)\n self[i,2].unpack('n')[0]\n end", "def words\n []\n end", "def words\n @words ||= (\n word_suggestions = []\n spellcheck = self.response[:spellcheck]\n if spellcheck && spellcheck[:suggestions]\n suggestions = spellcheck[:suggestions]\n unless suggestions.nil?\n # suggestions is an array: \n # (query term)\n # (hash of term info and term suggestion) \n # ...\n # (query term)\n # (hash of term info and term suggestion) \n # 'correctlySpelled'\n # true/false\n # collation\n # (suggestion for collation)\n i_stop = suggestions.index(\"correctlySpelled\")\n # step through array in 2s to get info for each term\n 0.step(i_stop-1, 2) do |i| \n term = suggestions[i]\n term_info = suggestions[i+1]\n # term_info is a hash:\n # numFound =>\n # startOffset =>\n # endOffset =>\n # origFreq =>\n # suggestion => { frequency =>, word => }\n origFreq = term_info['origFreq']\n suggFreq = term_info['suggestion']['frequency'] \n word_suggestions << term_info['suggestion']['word'] if suggFreq > origFreq\n end\n end\n end\n word_suggestions.uniq\n )\n end", "def random_word\n wordpair = nil\n File.foreach(\"wordlist\").each_with_index do |line, number|\n wordpair = line if rand < 1.0/(number+1)\n end\n word = Word.new(wordpair.split(':')[0], wordpair.split(':')[1])\n return word\n end", "def word=(_arg0); end", "def word\n # 1単語返却\n @resource.word\n end", "def words\n @words ||= text.split(/\\s/).delete_if { |word| word.length.zero? }\n end" ]
[ "0.72010344", "0.68452895", "0.68267137", "0.6762287", "0.6762287", "0.6762287", "0.6741771", "0.6721848", "0.6675079", "0.66309434", "0.66185355", "0.6602826", "0.660076", "0.6596457", "0.65897566", "0.65838426", "0.65637046", "0.65538186", "0.65489805", "0.6541548", "0.6541548", "0.6526205", "0.6519383", "0.6514768", "0.6514768", "0.6514768", "0.6514768", "0.6514768", "0.65078306", "0.6473284", "0.6468482", "0.6461182", "0.64349455", "0.6423617", "0.6415726", "0.6374586", "0.63579154", "0.6317154", "0.6310535", "0.6296933", "0.6283411", "0.62754434", "0.6273827", "0.6269104", "0.62599653", "0.6197065", "0.61865765", "0.6181721", "0.61805665", "0.61803865", "0.6133294", "0.61331046", "0.6125498", "0.6125199", "0.6124941", "0.6124941", "0.6119517", "0.6116397", "0.60660547", "0.60572934", "0.60551333", "0.60505354", "0.6024729", "0.6006841", "0.6004008", "0.6002122", "0.5990783", "0.59836036", "0.5972382", "0.59699714", "0.59694886", "0.5959984", "0.59494483", "0.5948722", "0.59425527", "0.5941597", "0.59414256", "0.5939015", "0.59354705", "0.59219456", "0.59019506", "0.5887908", "0.58764404", "0.58680964", "0.58653736", "0.5865072", "0.58650225", "0.5863624", "0.5857802", "0.5855595", "0.5854661", "0.58541614", "0.58438444", "0.58418584", "0.58329964", "0.5824", "0.5819956", "0.58190185", "0.5803075", "0.5799377" ]
0.6928339
1
Filter out all words that don't have the given length
def keep_only_words_of_length(len) change_wordlist(@words.select{|word,letters| word.word.length == len }) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_lengths(strings, length = 5)\n words = []\n strings.each do |word|\n if word.length >= length\n words << word\n end\n end\n return words\nend", "def filter_lengths(strings, length=5)\n big_words = []\n strings.each { |ele| big_words << ele if ele.length >= length }\n return big_words\nend", "def cut_words(length)\n @words = @words.select do |word|\n word.length == length\n end\n end", "def filter_lengths(strings, length=5)\n strings.select { |each| each.length >= length }\nend", "def filter_lengths(strings, length=5)\n strings.select { |string| string.length >= length }\nend", "def narrow_search_by_length\n self.dictionary.select { |word| word.length == self.word_length }\n end", "def filter_long_words(sentence, n)\n #your code here\n words = []\n for word in sentence.split(\" \")\n words << word if word.length > n\n end\n words\nend", "def illegal_words\n @words.select{ |word| word.length > @width }\n end", "def collect_words_of_length\n\t\t@dictionary.select! { |el| el.length == @word_length + 1 }\n\t\tmake_smart_dictionary\n\tend", "def big_words(str)\n # split my string into individual words\n # loop over my words\n # check the length of each word\n # if the length of the word is >= 5, keep it. \n # else delete it.\n # return joined words\n\n words = str.split(' ')\n long_words = []\n i = 0\n while i < words.length\n if words[i].length >= 5 #=> words[i] < 5\n # words.delete_at(i) # be careful of delete_at in loops.\n long_words << words[i]\n end\n i += 1\n end\n return long_words.join(' ')\nend", "def words(init, length)\n @words[init].select { |w| w.size == length }\n end", "def with_only_words_of_size(len)\n other = Dictionary.new\n @dictionary_per_size[len] ||= @words.select{|word| word.word.length == len }\n words = @dictionary_per_size[len] \n other.add_words(words)\n other\n end", "def proper_length_words\n proper_length = lambda { |line| line.length.between?(5, 12) }\n words = @file_contents.select(&proper_length)\n end", "def select_long_words(words)\n i = 0\n newArr = []\n while i < words.length\n if words[i].length > 4\n newArr << words[i]\n end\n i += 1\n end\n return newArr\n end", "def get_word_list\n @word_list = @lines.reject do |line|\n line.length < 5 || line.length > 12\n end\n end", "def strip_stopwords!(stopwords, min_length)\n @body = @body.split.delete_if() do |x| \n t = x.downcase.gsub(/[^a-z]/, '')\n t.length < min_length || stopwords.include?(t)\n end.join(' ')\n end", "def select_long_words(words)\n long_words = []\n \n i = 0\n while i < words.length\n if words[i].length > 4\n long_words << words[i]\n end\n \n i += 1\n end\n \n return long_words\nend", "def scrub_dictionary(dictionary)\n dictionary.each do |word|\n word.downcase\n unless word.length >= 5 && word.length <= 12\n dictionary.delete(word)\n end\n end\n end", "def select_long_words(words)\n\ti = 0\n arry = []\n \twhile i < words.length\n if words[i].length > 4\n arry << words[i]\n end\n i += 1\n end\n return arry\nend", "def strip_stopwords!(stopwords, min_length)\n #noinspection RubyParenthesesAfterMethodCallInspection\n @body = @body.split.delete_if() do |x|\n t = x.downcase.gsub(/[^a-z]/, '')\n t.length < min_length || stopwords.include?(t)\n end.join(' ')\n end", "def select_long_words(words)\n longWords = []\n\tfor i in 0..words.length-1\n word = words[i]\n if word.length > 4\n longWords << word\n end\n end\n return longWords\nend", "def select_long_words(words)\n long = []\n\n i = 0\n\n while i < words.length\n word = words[i]\n if word.length > 4\n long << word\n end\n i += 1\n end\n\n return long\nend", "def select_long_words(words)\n\tnew_array = []\n \n\ti = 0\n\twhile i < words.length\n\t\tif words[i].length > 4\n \t\tnew_array << words[i]\n end\n \ti += 1\n end\n \n return new_array\nend", "def prepare_dictionary(dictionary, length)\n result = IO.readlines(dictionary).map(&:chop)\n result.delete_if { |word| word.length > length }\n result.sort_by!(&:length).reverse!\n end", "def get_words_of_length(x)\n arr = []\n self.each do |w|\n if w.length == x\n arr << w\n end\n end\n return arr\n end", "def words\n @words ||= dictionary.select { |word| word.length > 3 }\n end", "def trim_to_word( max_length )\n string = self\n if string.length > max_length\n string = string[0..max_length-4]\n while string[-1,1] =~ /[\\w]/ && string.length > 1\n string = string[0..string.length-2]\n end\n string += \"...\"\n end\n string\n end", "def get_appropriate_words(dictionary)\n\t\tnew_dictionary = []\n\t\tdictionary.each do |word|\n\t\t\tword.gsub!(\"\\r\\n\",\"\")\n\t\t\tif word.length >= 5 and word.length <= 12\n\t\t\t\tnew_dictionary << word\n\t\t\tend\n\t\tend\n\t\tnew_dictionary\n\tend", "def threshold(text, threshold: false)\n thresh = (word_frequency(text).select { |k, v| v > 4})\n threshold ? thresh.reject {|k,v| k.length < 6} : thresh.reject {|k,v| k.length < 4}\nend", "def select_long_words(words)\n\tlongWords = []\n\n\ti = 0\n\twhile i <= words.length\n\t\ttemp = words[i]\n\n\t\tif temp.length > 4\n\t\t\tlongWords << temp\n\t\tend\n\n\t\ti += 1\n\tend\n\n\treturn longWords\nend", "def select_long_words(words)\n\n new_arr = []\n\n i = 0\n while i < words.length\n if words[i].length > 4\n new_arr << words[i]\n else \n end \n i += 1\n end \n return new_arr\n\nend", "def length\n words.reject { |w| w.rel == 'punct' }.length\n end", "def oompa_loompa(array)\n\t\tarray.reject do |word|\n\t\t\tword.length > 3\n\t\tend\n\tend", "def truncate_without_splitting_words(text, length=50)\n truncated_result = \"\"\n remaining_length = length\n stop = false\n truncated = false\n #lines\n text.split(\"\\n\").each do |l|\n #words\n l.split(\" \").each do |w|\n #If we're going to go over the length, and we've not already\n if (remaining_length - w.length) <= 0 && !stop\n truncated = true\n stop = true\n #Decide if adding or leaving out the last word puts us closer to the desired length\n if (remaining_length-w.length).abs < remaining_length.abs\n truncated_result += (w + \" \")\n end\n elsif !stop\n truncated_result += (w + \" \")\n remaining_length -= (w.length + 1)\n end\n end\n truncated_result += \"\\n\"\n end \n #Need some kind of whitespace before elipses or auto-link breaks\n truncated_result.strip + (truncated ? \"\\n...\" : \"\")\n end", "def pick_a_word(length)\n #remove sandwich code and change into map after it gets working\n words = get_words.split(\" \")\n filtered_wrds_by_length = []\n \n words.each do |wrd| #or select method\n if wrd.size == length.to_i\n filtered_wrds_by_length << wrd\n end\n end\n\n chosen_word = filtered_wrds_by_length.sample\n\nend", "def words_of_length(length)\n @generated_word_lengths ||= [0]\n @words_by_length ||= {0 => ['']}\n\n while @generated_word_lengths[-1] < length \n last_length = @generated_word_lengths[-1] \n next_length = last_length + 1\n @words_by_length[next_length] = @words_by_length[last_length].collect{|word| next_words_for word }.flatten\n @generated_word_lengths << next_length\n end\n\n @words_by_length[length]\n end", "def truncate_without_splitting_words(text, length = 50)\n truncated_result = ''\n remaining_length = length\n stop = false\n truncated = false\n # lines\n text.split(\"\\n\").each do |l|\n # words\n l.split(' ').each do |w|\n # If we're going to go over the length, and we've not already\n if (remaining_length - w.length) <= 0 && !stop\n truncated = true\n stop = true\n # Decide if adding or leaving out the last word puts us closer to the desired length\n if (remaining_length - w.length).abs < remaining_length.abs\n truncated_result += (w + ' ')\n end\n elsif !stop\n truncated_result += (w + ' ')\n remaining_length -= (w.length + 1)\n end\n end\n truncated_result += \"\\n\"\n end\n # Need some kind of whitespace before elipses or auto-link breaks\n html = truncated_result.strip + (truncated ? \"\\n...\" : '')\n html.html_safe\n end", "def long_words(words, length)\n # TODO\nend", "def secret_word(length)\n @nodes.each do |node|\n word = find_word(node, '', length)\n return word if word.length == length\n end\n end", "def dictionary_select(length)\n @dictionary = File.readlines('dictionary.txt').map(&:chomp)\n @new_list = @dictionary.select { |word| word.length == length }\n dictionary_narrow\n end", "def select_long_words(words) # Define method\n i = 0 # Set starting index value\n new_array = [] # Create new empty array to shovel values into\n \n while i < words.length # Length of word argument array must be less than index value of current iteration\n if words[i].length > 4 # Character length of words of index value must be greater than 4\n new_array << words[i] # Words of i value then is allowed to be put into array\n end\n i += 1 # Increase by 1 per iteration til condition no longer logical\n end\n return new_array \n\nend", "def remove_w_words(sentence)\r\n\r\n arr = [] # empty array created\r\n x = sentence.split(\" \")\r\n\r\n i = 0\r\n while i < x.length # iteration starts to check \"w\" in each word\r\n arr << x[i] if x[i][0] != \"w\" # words w/o \"w\" collected\r\n i += 1\r\n end\r\n\r\n arr.join(\" \") # result\r\nend", "def long_word_count(text)\n text.split.select {|word| word.length > 7}.count\nend", "def words( strict = false )\n splits = split( /\\b/ )\n splits.reject! { |w| !(w =~ /\\w/) } if strict\n splits\n end", "def find_words(words, search_letters, max_word_length)\n words.select do |word| \n if word.length > max_word_length\n false\n else\n word_contained_in_letters?(word, search_letters.clone)\n end\n end.flatten.compact.sort {|a,b| a.length <=> b.length }\nend", "def filter_term_list(term_list)\n (term_list.map(&:downcase) - IGNORED_WORDS).reject { |t| t.size < 3 }\n end", "def words_of_same_length(word)\n\treturn $words[word.length]\nend", "def long_planeteer_calls(words)\n words.any? {|word| word.length > 4}\nend", "def longer_than_three(arr)\n arr.select do |name|\n name.chars.count > 3\n end\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 backwards_wording(words)\n words.select { |word| word.size >= 5 }.map { |word| word.reverse }\n end", "def sort_by_length(my_sentence)\n sorted = []\n split_sentence = my_sentence.split(\" \")\n while !split_sentence.empty?\n sorted << split_sentence.delete(split_sentence.min { |a, b| a.length <=> b.length }) #push the word with the min value into sorted then delete it\n end\n return sorted\nend", "def filter_word?(word, values)\n return true unless word\n word = word.strip\n word.length < 4 ||\n word =~ /\\d{3}/ ||\n (values[0] < 5 && values[1] < 5 ) ||\n STOPWORDS.include?(word)\nend", "def long_planeteer_calls(words)\n words.any? { |word| word.length>4}\nend", "def words\n reject { |arg| arg.index('-') == 0 }\n end", "def guess_word(word_length)\n self.sample(dict.select { |word| word.length == word_length } )\n end", "def truncate_words(text, length = 30, end_string = ' ...')\n return if text == nil\n words = text.split\n words[0..(length-1)].join(' ') + (words.length > length ? end_string : '')\n end", "def truncate_words(text, length, end_string = ' ... ')\n unless text.nil?\n \twords = text.split()\n \twords = words[0...length].join(' ') + (words.length > length ? end_string : ' ')\n end\nend", "def strange_words(words)\n i = 0\n new_array = []\n new_string = \"\"\n\n while i < words.length\n\n \tnew_string = words[i]\n\n if (words[i].length < 6 ) && !(new_string[0] == \"e\") || (new_string[0] == \"e\") && !(words[i].length < 6 )\n new_array << words[i] \n end\n i += 1\n end\n return new_array\n\nend", "def long_strings(array)\n array.find_all {|i| i.length > 4}\nend", "def words_by_length(str)\r\n words = str.split\r\n words.sort_by {|word| word.length}\r\nend", "def longest_words(validwords, longest)\n longest_words = []\n validwords.each { |word| longest_words << word if word.length == longest }\n longest_words\nend", "def enough_flippable_words?\n (words - all_excluded_words).size > 1\n end", "def filter new_text\n allowed_length = [LENGTH_LIMIT - text.length, 0].max\n new_text[0, allowed_length]\n end", "def remove_long_quotes(array)\n array.select { |e| e.length <= 140 }\nend", "def selective_tweet_shortener(string)\n if string.length < 140 \n string\n else \n word_substituter(string)\n end\nend", "def scrubWord($string, $length = 0)\n $matches = array();\n\n self::clip($string, $length);\n\n preg_match_all(\"/([A-Z]|[0-9]|[a-z]|\\_|\\-)+/\", $string, $matches);\n return implode($matches[0]);\n end", "def strip_excess_words(content_player_id)\n\t\tself.played_words.each do |value|\n\t\t\tif value.t != self.t - 1 \n\t\t\t\tvalue.t_l.clear \n\t\t\tend\n\t\tend\t\n\tend", "def strip_to_stems\n str = self.sanitize_tags\n terms_a = str.gsub(/[^a-z]+/u, ' ').strip.split(' ')\n terms = terms_a.reject do |term|\n ((term.length < 3 && !SHORT_WORDS.include?(term)) || term.length > 20)\n end\n terms.collect! {|term| term.stem}\n terms = terms.select {|term| term.length > 1}\n terms = terms - STOP_STEMS\n return terms.join(' ')\n end", "def how_many_words(text=\"I'm a cheeky monkey, dude\", num=4)\n x_words = []\n word_array = text.split(\" \")\n word_array.each do |word|\n if word.length == num\n x_words << word\n end\n end\n x_words\nend", "def lengths (arr)\n return arr.map!{|word| word.length}\nend", "def contains_a_word_longer_than?(min_length)\n collection.any? {|word| word.length > min_length}\n end", "def truncate_without_splitting_words(text, length = 50, ellipsis = true)\n truncated_result = ''\n remaining_length = length\n stop = false\n truncated = false\n # lines\n text.split(\"\\n\").each do |l|\n # words\n l.split(' ').each do |w|\n # If we're going to go over the length, and we've not already\n if (remaining_length - w.length) <= 0 && !stop\n truncated = true\n stop = true\n # Decide if adding or leaving out the last word puts us closer to the desired length\n if (remaining_length - w.length).abs < remaining_length.abs\n truncated_result += (w + ' ')\n end\n elsif !stop\n truncated_result += (w + ' ')\n remaining_length -= (w.length + 1)\n end\n end\n truncated_result += \"\\n\"\n end\n # Need some kind of whitespace before elipses or auto-link breaks\n html = truncated_result.strip + (truncated && ellipsis ? \"\\n...\" : '')\n html.html_safe\n end", "def wordMin(word)\n\tword.length >= 5\nend", "def words_from(chars)\n words = Word.where(\"kanji SIMILAR TO ?\", '[' + chars.join('|') +']+' ).\n\t\t\t\treject{|w| has_duplicate_char?(w.kanji)}\n end", "def filter phrase\n\t\twords = phrase.reject{ |word| stopwords_list.include? word }\n\t\twords.reject{ |word| invalid_word? word}\n\tend", "def long_word_count(text)\n text.split(' ').count{|word| word.length > 7}\nend", "def wp_trim_words(text, num_words = 55, more = nil)\n if more.nil?\n more = '&hellip;'\n end\n\n original_text = text\n text = wp_strip_all_tags(text)\n\n if false # no asian...\n else\n words_array = text.split(/[\\n\\r\\t ]+/, num_words + 1)\n sep = ' '\n end\n\n if words_array.length > num_words\n words_array.pop\n text = words_array.join(sep)\n text = text + more\n else\n text = words_array.join(sep)\n end\n\n # Filters the text content after words have been trimmed.\n apply_filters('wp_trim_words', text, num_words, more, original_text)\n end", "def find_long\n array = [\"dog\", \"caterpillar\", \"bee\" ]\n\n array.detect do |word|\n word.length > 3\n end\nend", "def group_words_by_length\n words = [\"alice\", \"tony\", \"steve\", \"carlos\", \"rick\", \"martin\", \"chris\", \"tom\", \"david\", \"megan\", \"sue\"]\n\n #=> {5 => [\"alice\", \"steve\", \"carlos\", \"chris\", \"david\", \"megan\"], 4 => [\"tony\", \"rick\"], 3 => [\"sue\", \"tom\"]}\nend", "def filter_invalid_word(word)\n # Define a string which includes all valid letter\n letters = \"abcdefghijklmnopqrstuvwxyz\"\n # Define return variable and give a default value\n valid = true\n # transfer the word to lowercase and take out off \\r\\n\n word = word.chomp.downcase\n # set return value as false if the length of word not exactly equal 5\n if (word.split(//).size != 5)\n valid = false\n end\n # loop each word\n word.split(//).each do |letter|\n # If the letter occurs more than once in the word, set return value to false\n if (word.count(letter.to_s)) > 1 \n valid = false\n end\n # If the letter does not included in valid letter, set return value to false\n if (letters.include?(letter) == false) \n valid = false\n end\n end\n # return a bool value to method\n return valid\n end", "def selective_tweet_shortener(tweet)\n\n if tweet.length <= 140\n tweet\n else\n word_substituter(tweet)\n end\nend", "def test_words_without_spaces\n @words = @tester.words(number: 1000)\n\n @words.each { |w| refute_match(/\\s/, w) }\n end", "def test_words_without_spaces\n @words = @tester.words(number: 1000)\n\n @words.each { |w| refute_match(/\\s/, w) }\n end", "def selective_tweet_shortener(tweet)\n tweet.length > 140 ? word_substituter(tweet) : tweet\nend", "def spinwords(string,length = 0)\n string.split(' ').map{ |x| x.length > length ? x.reverse : x }.join(' ')\nend", "def remove_w_words(sentence)\n \nend", "def words(length)\n WORDS.sample(length)\nend", "def truncate(input, length)\n if input.length > length && input[0..(length - 1)] =~ /(.+)\\b.+$/im\n $1.strip + '...'\n else\n input\n end\n end", "def four_words(text)\n four_words = []\n word_array = text.split(\" \")\n word_array.each do |word|\n if word.length == 4\n four_words << word\n end\n end\n four_words\nend", "def truncate(length = 30)\n return self if self.length < length\n self[0..length].gsub(/\\s\\w+\\s*$/, '...')\n end", "def timed_reading(max_length, text)\n result = []\n text.split.each do |word|\n word = word.gsub(/\\W/,'')\n if !word.empty?\n result << word if word.count(word) <= max_length\n end\n end\n return result.count\nend", "def trunc(len)\n split(/ /).each_with_object('') do |x, ob|\n break ob unless ob.length + ' '.length + x.length <= len\n\n ob << (\" #{x}\")\n end.strip\n end", "def lex_ignore(length)\n \n return if length.eql?0 #Si no hay nada regresa\n\n word = @input[0..length-1] # Se crea un aux de lo que se quiere ignorar\n lineas = (word + ' ').lines.to_a.length.pred #Se saca el numero de lineas, \n #convirtiendo en arreglo de las palabras separadas \\n y midiendolo\n @line += lineas\n @input = @input[length..@input.length] # Se omite la solicitado\n\n if lineas.eql?0 then\n @column += length #Se suma las columnas omitidas a las que habia\n else\n @column = 1 #Sino se colocan en 1 por salto de linea\n end\n end", "def cleanup!(max_len)\n if self.length >= max_len\n self.clear\n end\n end", "def selective_tweet_shortener(tweet)\n if tweet.length > 140 \n tweet = word_substituter(tweet)\n end\n tweet\nend", "def fivv_buzz(str)\n # array of desired words\n # split string into words (only needed if taking in a string, skip for array.)\n # iterate over words, check that the word starts with e AND is shorter than 6 characters.\n buzzed_words = []\n words = str.split(' ')\n words.each do |word|\n if 'eE'.include?(word[0]) && word.length < 6 \n # (word[0] == 'e' || word[0] == 'E') && word.length < 6\n buzzed_words << word\n end\n end\n return buzzed_words\nend", "def word_unscrambler(str, words)\n return words.keep_if {|word| word.chars.sort == str.chars.sort}\nend", "def double_letters(word)\n str = word.squeeze\n str.size != word.size\nend", "def shortened_tweet_truncator(tweet)\n if tweet.length < 140\n tweet\n else\n word_substituter(tweet)[0...140]\n end\nend" ]
[ "0.8268905", "0.82069004", "0.8036487", "0.77160835", "0.7701686", "0.75003904", "0.7208516", "0.71411645", "0.7057447", "0.7047899", "0.6997992", "0.69461554", "0.6808017", "0.6679938", "0.6667339", "0.66432947", "0.66265607", "0.6538837", "0.65367144", "0.6516269", "0.65061593", "0.6504938", "0.64919174", "0.64815086", "0.6462331", "0.64480275", "0.64169794", "0.6412198", "0.6410774", "0.63872385", "0.6381241", "0.6367567", "0.632498", "0.62669003", "0.6261758", "0.6232292", "0.6170708", "0.6159801", "0.615602", "0.6148154", "0.613711", "0.6124658", "0.6080162", "0.6069375", "0.6059938", "0.60543746", "0.60531867", "0.60527825", "0.6051098", "0.60500866", "0.60472226", "0.60427517", "0.60220367", "0.6010988", "0.5986449", "0.59830683", "0.5981206", "0.59811705", "0.5978624", "0.5947672", "0.59396017", "0.59347725", "0.59330595", "0.59227127", "0.5918438", "0.5916584", "0.5914325", "0.59095067", "0.5904636", "0.58964634", "0.5893795", "0.58748496", "0.58614963", "0.585174", "0.5847623", "0.5839629", "0.5817763", "0.5817409", "0.5812", "0.5811663", "0.5806552", "0.58030105", "0.57903725", "0.57903725", "0.5784216", "0.5783173", "0.5783022", "0.5777581", "0.57624525", "0.5748914", "0.57486033", "0.57480764", "0.5745131", "0.5741817", "0.5740195", "0.5698643", "0.5682957", "0.56817776", "0.5680545", "0.56803805" ]
0.86861956
0
Filter out all words that contain the given letter
def reject_words_that_contain(letter) change_wordlist(@words.select { |word,letters| word.word.index(letter) == nil }) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_words_with_letter array, letter\n array.filter_map{ |value| value if value.include? letter }\nend", "def words_with_letter (array,letter)\n array.select{|word| word.include? letter}\nend", "def letter_checker(array, letter_variable)\n# loop over array and return only words that include a given letter variable\n# Return filtered array \n array.select { |word| word.include? letter_variable}\nend", "def word_with_letter arr, letter\n arr.select { |x| x.include? (letter)}\nend", "def keep_only_words_that_match(hangman_pattern)\n pattern = Regexp.new('^' + hangman_pattern.gsub(/-/,'.') + '$')\n\n change_wordlist(@words.select { |word,letters| word.word =~ pattern })\n end", "def word_parse(letters)\n matching_words = []\n opposite_letters = opposite_letters(letters)\n regex = Regexp.new(\"[#{opposite_letters}]\").freeze\n @words_collection.each do |word|\n matching_words << word unless word =~ regex\n end\n matching_words\nend", "def word_contained_in_letters?(word, letters)\n word.chars.all? do |char|\n if pos = letters.index(char)\n letters.delete_at(pos)\n true\n else\n false\n end\n end\nend", "def filter phrase\n\t\twords = phrase.reject{ |word| stopwords_list.include? word }\n\t\twords.reject{ |word| invalid_word? word}\n\tend", "def filter_invalid_word(word)\n # Define a string which includes all valid letter\n letters = \"abcdefghijklmnopqrstuvwxyz\"\n # Define return variable and give a default value\n valid = true\n # transfer the word to lowercase and take out off \\r\\n\n word = word.chomp.downcase\n # set return value as false if the length of word not exactly equal 5\n if (word.split(//).size != 5)\n valid = false\n end\n # loop each word\n word.split(//).each do |letter|\n # If the letter occurs more than once in the word, set return value to false\n if (word.count(letter.to_s)) > 1 \n valid = false\n end\n # If the letter does not included in valid letter, set return value to false\n if (letters.include?(letter) == false) \n valid = false\n end\n end\n # return a bool value to method\n return valid\n end", "def without_words_not_contributing_to_letter_set(words, new_word)\n words_that_intersect_with_new_word = []\n words.each do |word|\n if letter_set_from_words(word).intersect?(letter_set_from_words(new_word))\n words_that_intersect_with_new_word << word\n end\n end\n\n words_that_intersect_with_new_word.each do |word|\n if letter_set_from_words(words.reject { |w| w == word } + [new_word]) >= letter_set_from_words(word)\n words.delete(word)\n end\n end\nend", "def words_from(chars)\n words = Word.where(\"kanji SIMILAR TO ?\", '[' + chars.join('|') +']+' ).\n\t\t\t\treject{|w| has_duplicate_char?(w.kanji)}\n end", "def remove_letter_a(words)\n new_words = []\n words.each do |word|\n without_a = \"\"\n word.each_char do |c|\n if c != 'a'\n without_a << c\n end\n end\n new_words << without_a\n end\n new_words\nend", "def filter_term_list(term_list)\n (term_list.map(&:downcase) - IGNORED_WORDS).reject { |t| t.size < 3 }\n end", "def basic_letter_parse(letters)\n matching_words = []\n regex = Regexp.new(\"[#{letters}]\").freeze\n @words_collection.each do |word|\n for i in 0..word.length-1 do\n letter = word[i]\n break unless letter =~ regex\n matching_words << word if i == word.length - 1\n end\n end\n matching_words\nend", "def words_to_skip_capitalization_of\n\t\t[ \n\t\t'of','a','the','and','an','or','nor','but','if','then','else','when','up','at','from','by','on',\n\t\t'off','for','in','out','over','to'\n\t\t]\n\tend", "def alphafilter\n self.gsub(/[^a-zA-Z\\s]/, '')\n end", "def only_letters(word)\n word.delete(\"^A-z\")\nend", "def remove_miss_char_words(char)\n pattern = Regexp.new(\"[#{char}]\")\n\n array = @array.reject do |item|\n item.match(pattern) != nil\n end\n end", "def sanitize_alpha(input_word)\n input_word.chars.each do |c|\n input_word.delete!(c) unless $alpha.include?(c)\n end\n return input_word\nend", "def get_letters(game)\n game.letters.split(\"\").reject{|letter| game.word.upcase.include?(letter)}.join(\" \")\nend", "def words_that_contain(letter)\n letter_count(letter)\n end", "def valid_word?(word, inner_letter, outer_letters)\n word.include?(inner_letter) && word.chars.uniq.all? {|l| @all_letters.chars.include?(l) }\n end", "def remove_letter_a(words)\nend", "def words_to_skip_capitalization_of\n [\n 'of','a','the','and','an','or','nor','but','if','then','else','when','up','at','from','by','on',\n 'off','for','in','out','over','to'\n ]\n end", "def filter(keywords)\n keywords.delete_if do |key, value|\n include?(key.downcase)\n end\n end", "def find_a (array)\n new_array=[]\n array.select{|word| \n word.start_with?(\"a\") \n }\nend", "def words( strict = false )\n splits = split( /\\b/ )\n splits.reject! { |w| !(w =~ /\\w/) } if strict\n splits\n end", "def remove_letter_a(words)\n\nend", "def finder array, letter_to_find\n array.select do |word| \n word.include? letter_to_find\n end\nend", "def get_all_letters_in_array_of_words(array)\n result = []\n array.each do |x|\n for a in 0..(x.length-1) do\n result.push(x[a]) if !result.include?(x[a])\n end\n end\n result.sort\nend", "def find_words(words, search_letters, max_word_length)\n words.select do |word| \n if word.length > max_word_length\n false\n else\n word_contained_in_letters?(word, search_letters.clone)\n end\n end.flatten.compact.sort {|a,b| a.length <=> b.length }\nend", "def subwords(word, dictionary)\n arr = substrings(word)\n arr.select { |str| dictionary.include?(str) }\nend", "def elements_ending_in_er\n collection.select {|word| word.end_with?(\"er\")}\n end", "def missing_letters(string)\n alphabet='a'..'z'\n alphabet.reject {|el|string.downcase.include?(el)}\nend", "def remove_w_words(sentence)\r\n\r\n arr = [] # empty array created\r\n x = sentence.split(\" \")\r\n\r\n i = 0\r\n while i < x.length # iteration starts to check \"w\" in each word\r\n arr << x[i] if x[i][0] != \"w\" # words w/o \"w\" collected\r\n i += 1\r\n end\r\n\r\n arr.join(\" \") # result\r\nend", "def find_a(arry)\n\n arry.select do |word|\n \"#{word}\".start_with?(\"a\")\n\n end\n # newlist\n end", "def containLetter(array, letter)\n # Iterate through the array of words\n # Use select to check if that letter is in the word\n selected_array = array.select { |value| value.include?(letter) }\n # Implicity return an array of words that contain that letter with the statement above\nend", "def my_array_finding_method(array, letter)\n array.select {|word| word.to_s.include? letter}\nend", "def check_duplicate_letter(words)\n # The reject method return a new Array without the items defined by its input block.\n return words.reject {\n # The word has each letter counted .chars .count\n # If the word with any repeating characters removed is not the same as the length of the word\n # The uniq method returns a new array by removing duplicate values in self.\n |word| word.chars.uniq.count != word.length\n }\n end", "def contain_a(arr)\n arr.select do |word| \n word.include?(\"a\")\n end\nend", "def all_excluded_words\n (excluded_words + (lazy? ? LAZY_WORDS : [])).map(&:downcase)\n end", "def block_word?(string)\n hash = { 'B' => 'O', 'G' => 'T', 'V' => 'I', \n 'X' => 'K', 'R' => 'E', 'L' => 'Y',\n 'D' => 'Q', 'F' => 'S', 'Z' => 'M',\n 'C' => 'P', 'J' => 'W', 'N' => 'A', 'H' => 'U'}\n\n banned_letters = []\n bool = true\n letters = string.upcase.chars\n letters.each do |letter|\n if hash.has_key?(letter)\n banned_letters << hash[letter]\n elsif hash.has_value?(letter)\n banned_letters << hash.key(letter)\n end\n end\n banned_letters.each do |letter|\n if letters.include?(letter)\n bool = false\n break\n else\n next\n end\n end\n bool\nend", "def alphanumeric_words\n /([a-zA-Z0-9]*\\w)/\n end", "def words\n reject { |arg| arg.index('-') == 0 }\n end", "def words_starting_with_un_and_ending_with_ing(text)\n result = text.scan(/\\bun\\w+/) + text.scan(/ing\\b\\w+/)\n result.uniq\nend", "def valid_words(rack)\n # Load the words\n list_of_words = load_words\n array_of_valid_words = []\n # for each word check if all the letters of word are in rack\n list_of_words.each do |word|\n array_of_valid_words << word if check_word(word, rack)\n end\n array_of_valid_words\nend", "def filter_repeated_character_strings(arr)\n results = []\n\n index = 0\n arr.each do |word|\n char_index = 0\n main_char = \"\"\n other_char = false\n\n word.chars.each do |char|\n char_index += 1\n\n if char_index == 1\n main_char = char\n end\n if main_char != \"\" && char == main_char\n if char_index == word.length && other_char == false\n results.insert(index, word)\n\n index += 1\n end\n else\n other_char = true\n end\n end\n end\n\n return results\nend", "def match(w_array)\n w_array.delete_if {|w| w.split(\"\").sort != word.split(\"\").sort}\n end", "def match(words_to_test)\n words_to_test\n .filter do |word|\n normalize_word(word) != normalized_source_word &&\n sort_letters(word) == source_letters\n end\n end", "def find_a(array)\n a_words = array.select do |word|\n word[0] === \"a\" || word[0] === \"A\"\n end\n \n a_words\nend", "def get_valid_words(word)\n [word, word.downcase, word.capitalize, word.pluralize].uniq\n end", "def get_matches(word)\n cur = self\n word.each_char do |character|\n modified_char = @@vowels.include?(character) ? '*' : character\n return Set.new if not cur.kids.has_key? modified_char\n cur = cur.kids[modified_char]\n end\n cur.words_here\n end", "def letter_in_word?(letter)\n end", "def check_word(word)\n letters = make_letter_array(@tiles)\n w = word.split(\"\")\n for letter in w\n if letters.index(letter)\n letters[letters.index(letter)] = nil\n letters.compact!\n else\n return false\n end\n end\n return true\n end", "def all_alpha_matches(input)\n where(alpha: sort_letters(input)).pluck :text\n end", "def match_title_any_word(match_string, reject = false)\n text = match_string.downcase || \"\"\n words = text.split\n res = words.map { |w| Regexp.new(/\\b#{w}/i) }\n proc = Proc.new { |entry|\n clean_title = entry.title ? entry.title.downcase : \"\"\n res.collect { |re|\n !!(clean_title =~ re)\n }.inject(:|)\n }\n reject ? self.entries.reject(&proc) : self.entries.find_all(&proc)\n end", "def word_unscrambler(str, words)\n return words.keep_if {|word| word.chars.sort == str.chars.sort}\nend", "def word_has?(letter)\n @word.include? letter\n end", "def contain_a(array2)\n # return all elements that contain the letter 'a'\n array2.select{|word| word.include?(\"a\")}\nend", "def include?(word, letters)\n word.upcase.chars.all? { |letter| word.count(letter) <= letters.count(letter) }\n end", "def spec_letter(array, char)\n # select through the array\n array.select do |str|\n # using include to find the substrings\n # if str has specific letter\n str.include? char\n end\nend", "def letter_checker(array, string)\n array.select do |value|\n value.include? string\n end\nend", "def missing_letters(string)\n alphabet = (\"a\"..\"z\").to_a\n alphabet.reject { |x| string.downcase.include?(x) }\nend", "def dedupe(words)\n words.select do |word|\n word.downcase != @word.downcase \n end\n end", "def word_finder (arr, str)\n arr.select do |value|\n value.include? str\n end\nend", "def kill_word(*)\n first_non_letter = current_buffer.index(/\\P{L}/, current_buffer.point) || current_buffer.length\n word_beginning = current_buffer.index(/\\p{L}/, first_non_letter) || current_buffer.length\n current_buffer.slice!(current_buffer.point, word_beginning - current_buffer.point)\n true\nend", "def findWord(query, array_of_strings)\n\t#array_of_strings.select {|str| str.match(query) }\n #array_of_strings.any? {|i| i[query] }\n array_of_strings.reject {|x| x.match (/#{query}/) }\nend", "def word_has?(letter)\n @word.include?(letter)\n end", "def non_opt_words(current)\n output = []\n (0..(current.length-1)).each do |index|\n ('a'..'z').each do |let|\n test_word = current.clone\n test_word[index] = let\n output << test_word if legal_word?(test_word)\n end\n end\n output.uniq\nend", "def find_words(words, dict)\n return nil if words.nil? || dict.nil?\n return [] if words.empty? || dict.empty?\n\n size = -1\n list = Set.new\n\n words.each do |w|\n if dict.include? w.downcase\n break if w.length < size\n\n size = w.length\n list << w\n end\n end\n list\n end", "def known(words)\n return words.find_all {true } #find all words for which condition is true,\n #you need to figure out this condition\n \n end", "def missing_letters(string)\n letters = %w[a b c d e f g h i j k l m n o p q r s t u v w x y z]\n letters.select { |c| c unless string.include?(c) }\nend", "def match_title_all_words(match_string, reject = false)\n text = match_string.downcase || \"\"\n words = text.split\n res = words.map { |w| Regexp.new(/\\b#{w}/i) }\n proc = Proc.new { |entry|\n clean_title = entry.title ? entry.title.downcase : \"\"\n res.collect { |re|\n !!(clean_title =~ re)\n }.inject(:&)\n }\n reject ? self.entries.reject(&proc) : self.entries.find_all(&proc)\n end", "def letter_set_from_words(words)\n words = [words] if words.is_a?(String)\n\n Set.new words.map { |w| w.split('') }.flatten\nend", "def o_words(sentence)\n arr = sentence.split(\" \")\n arr.select {|ele| ele.include?(\"o\")}\nend", "def wrong_guess(letter)\n @possible_letters.delete(letter)\n @dictionary.reject_words_that_contain(letter)\n end", "def words_starting_with_un_and_ending_with_ing(text)\n text.scan(/\\bun\\w+ing\\b/)\nend", "def words (text)\n return text.downcase.scan(/[a-z]+/) #find all matches of this simple regular expression\n end", "def words (text)\n return text.downcase.scan(/[a-z]+/) #find all matches of this simple regular expression\n end", "def words (text)\n return text.downcase.scan(/[a-z]+/) #find all matches of this simple regular expression\n end", "def contains(letter)\r\n @word.include?(letter)\r\n end", "def contain_a(array)\n array.select { |word| word.include?(\"a\") }\nend", "def word_has?(letter)\r\n @word.include?(letter)\r\n end", "def subwords(word, dictionary)\r\n res = []\r\n substrings(word).each do |ele|\r\n res << ele if dictionary.include?(ele)\r\n end\r\n res\r\nend", "def removeBlackList words\n\t\tblacklist = ['a','an','the','then','but','therefore','because','I','he',\n\t\t\t\t\t 'she','it','him','her','his','her','its','they','them','their']\n\t\tblacklist.map!{|w| w.upcase}\n\t\tmodified = words.clone\n\t\tmodified.delete_if{|w| blacklist.include?(w.upcase)}\n\t\treturn modified\n\tend", "def missing_letters(string)\n ('a'..'z').reject { |letter| string.downcase.include? letter }\nend", "def words_starting_with_un_and_ending_with_ing(text)\n text.scan(/\\b[un][a-z]+[ing]/)\nend", "def match choice\n choice.select { |entry| entry if entry.downcase.split(//).sort == self.word.downcase.split(//).sort && entry.downcase != self.word.downcase} \n end", "def word_sort(array, letter)\n array.select do |value|\n value.include?(letter)\n end\nend", "def words\n scan(/\\w[\\w'\\-]*/)\n end", "def missing_letters(string)\n letters = ('a'..'z').to_a\n letters.reject { |char| string.downcase.include?(char) }\nend", "def Scrabble( letters, word )\n\n\n # Intializing arrays/variables\n wrd = word.split( \"\" )\n ltrs = letters.split( \"\" )\n bool = true\n\n\n\n # Make sure that the characters in word are in letters\n wrd.each do | char |\n\n if ltrs.index( char )\n\n # Find and delete at specific index in order to find other characters\n x = ltrs.find_index( char )\n ltrs.delete_at( x )\n\n\n else\n\n # If a characters is not found set bool to false\n # This could also be short circuited to return false\n bool = false\n\n end\n\n end\n\nreturn bool\n\nend", "def missing_letters(string)\n string = string.downcase\n (\"a\"..\"z\").to_a.reject {|letter| string.include?(letter) }\nend", "def words_starting_with_un_and_ending_with_ing(text)\n text.scan(/un+\\w+ing/)\nend", "def o_words(sentence)\n words = sentence.split(' ')\n return words.select { | val | val.include?('o') }\nend", "def filter(text)\n text.upcase.gsub(@filter, '')\n end", "def remove_bad_words(report_model = nil)\n all_words = Word.all_words\n contain_bad_words = false\n res = self.gsub(/\\b\\w+\\b/) do |word|\n if all_words.include?(word.downcase)\n contain_bad_words = true\n '***'\n else\n word\n end\n end.squeeze(' ')\n Report.where(description: 'Contain bad words', target: report_model).first_or_create if contain_bad_words\n res\n end", "def good_guess(pattern)\n merge(pattern)\n @dictionary.keep_only_words_that_match(@solution)\n @possible_letters.delete(letter_in(pattern))\n end", "def words(text)\n text.downcase.scan(/[a-z]+/)\nend", "def unscramble(scramble)\n $word_list.select { |a| a.chars.sort == scramble.chars.sort }\nend" ]
[ "0.8088286", "0.74130577", "0.7368156", "0.7300006", "0.7235947", "0.7066958", "0.66895235", "0.6686267", "0.6682136", "0.6672857", "0.6629614", "0.65127003", "0.6464307", "0.64636683", "0.646075", "0.6435366", "0.64256155", "0.64143544", "0.63935244", "0.6380838", "0.6379877", "0.6378379", "0.6369404", "0.6352157", "0.63200486", "0.6294542", "0.6291679", "0.62688625", "0.6243776", "0.62244684", "0.620284", "0.6201591", "0.6189437", "0.6147007", "0.6146926", "0.61401033", "0.6121848", "0.61159", "0.61063254", "0.60805684", "0.60795695", "0.607771", "0.607018", "0.6064647", "0.6051795", "0.6049274", "0.60442305", "0.6034973", "0.6023216", "0.6020599", "0.6011054", "0.60085016", "0.6006695", "0.6003072", "0.5993426", "0.59807986", "0.59760404", "0.59632045", "0.596067", "0.5958706", "0.5958586", "0.5957589", "0.59563416", "0.59410816", "0.59404427", "0.5929449", "0.5925629", "0.5925318", "0.59187263", "0.59173983", "0.5909581", "0.59072816", "0.5905754", "0.59052676", "0.59038424", "0.58979434", "0.5896604", "0.5884319", "0.5884319", "0.5884319", "0.588211", "0.58806205", "0.58754516", "0.58738583", "0.58737594", "0.5872626", "0.58645046", "0.58627784", "0.58622205", "0.5858322", "0.5854488", "0.5849802", "0.5848531", "0.5843963", "0.58394307", "0.5831474", "0.5829512", "0.58292425", "0.5818103", "0.58175474" ]
0.8102956
0
Keep only the words that match the partial solution
def keep_only_words_that_match(hangman_pattern) pattern = Regexp.new('^' + hangman_pattern.gsub(/-/,'.') + '$') change_wordlist(@words.select { |word,letters| word.word =~ pattern }) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_results_of_partial_phrases(results)\n cleaned_results = []\n results.each do |current_result|\n current_result_phrase = current_result[0]\n\n cleaned_results << current_result unless results.any? do |other_result|\n other_result_phrase = other_result[0]\n is_a_partial_string?(other_result_phrase, current_result_phrase)\n end\n end\n cleaned_results \n end", "def without_words_not_contributing_to_letter_set(words, new_word)\n words_that_intersect_with_new_word = []\n words.each do |word|\n if letter_set_from_words(word).intersect?(letter_set_from_words(new_word))\n words_that_intersect_with_new_word << word\n end\n end\n\n words_that_intersect_with_new_word.each do |word|\n if letter_set_from_words(words.reject { |w| w == word } + [new_word]) >= letter_set_from_words(word)\n words.delete(word)\n end\n end\nend", "def string_matching(words)\n result_words = []\n\n words.each_with_index do |possible_substring, index|\n (0..words.size - 1).each do |index_w|\n next if index_w == index || words[index_w].size < possible_substring.size\n \n result_words << possible_substring if words[index_w].index(possible_substring)\n end\n end\n \n result_words.uniq\nend", "def reject_words_that_contain(letter)\n change_wordlist(@words.select { |word,letters| word.word.index(letter) == nil })\n end", "def words_starting_with_un_and_ending_with_ing(text)\n result = text.scan(/\\bun\\w+/) + text.scan(/ing\\b\\w+/)\n result.uniq\nend", "def known(words)\n return words.find_all {true } #find all words for which condition is true,\n #you need to figure out this condition\n \n end", "def _search_text\n [_concatenated_brand,\n _concatenated_description,\n _concatenated_sell_unit,\n classic_mbid\n ].compact.map { |w| w.hanize.split(' ') }.flatten.uniq.reject { |w| w.size < 3 || self.class.stop_words.include?(w) }.join(' ')\nend", "def filter_term_list(term_list)\n (term_list.map(&:downcase) - IGNORED_WORDS).reject { |t| t.size < 3 }\n end", "def matched_words\n _matched_words\n end", "def words( strict = false )\n splits = split( /\\b/ )\n splits.reject! { |w| !(w =~ /\\w/) } if strict\n splits\n end", "def match(words_to_test)\n words_to_test\n .filter do |word|\n normalize_word(word) != normalized_source_word &&\n sort_letters(word) == source_letters\n end\n end", "def match(w_array)\n w_array.delete_if {|w| w.split(\"\").sort != word.split(\"\").sort}\n end", "def partial_matches_for(input_string)\n # [\"aardvark\", \"apple\"]\n @word_list.select do |word|\n word.start_with?(input_string)\n end\n end", "def findWord(query, array_of_strings)\n\t#array_of_strings.select {|str| str.match(query) }\n #array_of_strings.any? {|i| i[query] }\n array_of_strings.reject {|x| x.match (/#{query}/) }\nend", "def filter phrase\n\t\twords = phrase.reject{ |word| stopwords_list.include? word }\n\t\twords.reject{ |word| invalid_word? word}\n\tend", "def get_all_matched_words(combination, dictionary)\n all_matched_words = []\n combination.map { |pattern| all_matched_words.push(find_matches(pattern, dictionary)) unless pattern.empty? }\n all_matched_words\n end", "def words_with_unapproved_synonyms\n return Keyword.joins(:synonyms).where(\"synonyms.approved\" => false).all\n end", "def non_opt_words(current)\n output = []\n (0..(current.length-1)).each do |index|\n ('a'..'z').each do |let|\n test_word = current.clone\n test_word[index] = let\n output << test_word if legal_word?(test_word)\n end\n end\n output.uniq\nend", "def find_potential_matches\n comp_words.each_with_object([]) do |comp_word, collection|\n next if comp_word == word\n\n tokenized_comp_word = tokenize_string(comp_word)\n common_token_count = (tokenized_word & tokenized_comp_word).count\n similarity = (2 * common_token_count) / (word.length + comp_word.length).to_f\n collection << comp_word if similarity > PRECISION\n end\n end", "def articlePartialMatchNames\n names = []\n if partial_name_match #If partial name matches are allowed for this place\n #Add any words required for a match before each trimmed name\n if before_name_article_accept_strings.length != 0\n\ttrimmed_names.uniq.each do |name|\n\t before_name_article_accept_strings.each do |string|\n\t names << string + \" \" + name\n\t end\n\tend\n else\n\tnames += trimmed_names\n end\n end\n names\n end", "def all_excluded_words\n (excluded_words + (lazy? ? LAZY_WORDS : [])).map(&:downcase)\n end", "def find_relevant(sentences, input)\n relevant = []\n slightly_relevant = []\n\n tokenized = NLP.tokenize(input).map(&:downcase)\n\n sentences.each do |sent|\n tokenized.each do |token|\n if sent.map { |tiki| @tokens[tiki].downcase }.include?(token)\n relevant << sent unless NLP.stopword?(token)\n slightly_relevant << sent\n end\n end\n end\n\n [relevant, slightly_relevant]\n end", "def match(array)\n array.delete_if {|w| w.split(\"\").sort != word.split(\"\").sort}\n end", "def subwords(word, dictionary)\n arr = substrings(word)\n arr.select { |str| dictionary.include?(str) }\nend", "def dedupe(words)\n words.select do |word|\n word.downcase != @word.downcase \n end\n end", "def find_words(words, search_letters, max_word_length)\n words.select do |word| \n if word.length > max_word_length\n false\n else\n word_contained_in_letters?(word, search_letters.clone)\n end\n end.flatten.compact.sort {|a,b| a.length <=> b.length }\nend", "def find_relevant(sentences, input)\n relevant = []\n slightly_relevant = []\n\n tokenized = NLP.tokenize(input).map(&:downcase)\n\n sentences.each do |sent|\n tokenized.each do |token|\n if sent.map { |tiki| @tokens[tiki].downcase }.include?(token)\n relevant << sent unless NLP.stopword?(token)\n slightly_relevant << sent\n end\n end\n end\n\n [relevant, slightly_relevant]\n end", "def real_words(permutations, wordlist)\n validwords = []\n wordlist = wordlist.to_set\n permutations.each { |x| validwords << x if wordlist.include?(x) }\n validwords\nend", "def find_relevant(sentences, input)\n relevant = []\n slightly_relevant = []\n\n tokenized = NLP.tokenize(input).map(&:downcase)\n\n sentences.each do |sent|\n tokenized.each do |token|\n if sent.map(&:downcase).include?(token)\n relevant << sent unless NLP.stopword?(token)\n slightly_relevant << sent\n end\n end\n end\n\n [relevant, slightly_relevant]\n end", "def possible_words\n\t\t\t@dictionary.grep to_r\n\t\tend", "def prep_text_for_match_query(text,exclude_dblquote=false,remove_weak_terms=true)\r\n result = text.dup\r\n result.downcase! # downcase for stop_words removal\r\n result.gsub!(\"'s\",'')\r\n remove_punctuation_proper!(result,exclude_dblquote)\r\n # result.gsub!(/([^\\s]+)/) { |word|\r\n # weak_term?(word) ? '' : word\r\n # } if remove_weak_terms\r\n # result\r\n # #!? check terms as adverbs?\r\n words = result.split(/\\W/)\r\n if remove_weak_terms\r\n words = words.select {|w| !weak_term?(w) }\r\n end\r\n words.compact!\r\n words.join(\" \")\r\n end", "def one_off_words(str,word_list)\n result = []\n better_list = word_list.select{|word| word.size == str.size}\n better_list.each do |word|\n i = 0\n count = 0\n while i < word.size\n count += 1 if word[i] == str[i]\n i += 1\n end\n result << word if word.size - count == 1\n end\n result\nend", "def find_words(words, dict)\n return nil if words.nil? || dict.nil?\n return [] if words.empty? || dict.empty?\n\n size = -1\n list = Set.new\n\n words.each do |w|\n if dict.include? w.downcase\n break if w.length < size\n\n size = w.length\n list << w\n end\n end\n list\n end", "def complex_words\n @complex_words ||= unique_words.select { |word| syllables_in(word) >= 3 }\n end", "def correct_words\n self.student_responses.select { |x| x.correct }.collect { |x| x.word_id }.uniq\n end", "def word_unscrambler(str, words)\n return words.keep_if {|word| word.chars.sort == str.chars.sort}\nend", "def match(words)\n words.select {|word| word.split(\"\").sort == @word.split(\"\").sort}\n end", "def word_parse(letters)\n matching_words = []\n opposite_letters = opposite_letters(letters)\n regex = Regexp.new(\"[#{opposite_letters}]\").freeze\n @words_collection.each do |word|\n matching_words << word unless word =~ regex\n end\n matching_words\nend", "def good_guess(pattern)\n merge(pattern)\n @dictionary.keep_only_words_that_match(@solution)\n @possible_letters.delete(letter_in(pattern))\n end", "def words_from(chars)\n words = Word.where(\"kanji SIMILAR TO ?\", '[' + chars.join('|') +']+' ).\n\t\t\t\treject{|w| has_duplicate_char?(w.kanji)}\n end", "def remove_errant_matches_from(pot_ex_array)\n correct_match_arr = []\n pot_ex_array.each do |example|\n constituents = example.construct_constituents_array\n constituents.each do |const_array|\n if const_array[0] == self.word && const_array[1] == self.hiragana && const_array[3] == self.reading # For this to work, the constituents have to be normalized to dictionary_forms.\n correct_match_arr << example\n end\n end\n end\n return correct_match_arr\n end", "def subwords(word, dictionary)\r\n res = []\r\n substrings(word).each do |ele|\r\n res << ele if dictionary.include?(ele)\r\n end\r\n res\r\nend", "def mispelled_words\n Spellchecker.check(@text, LANG).reject do |word|\n word[:correct]\n end\n end", "def find_words(words)\n search_results = SearchResults.new\n \n general = Vector.new\n must_match = Vector.new\n must_not_match = Vector.new\n not_found = false\n \n extract_words_for_searcher(words.join(' ')) do |word|\n case word[0]\n when ?+\n word = word[1,99]\n vector = must_match\n when ?-\n \t word = word[1,99]\n vector = must_not_match\n else\n \t vector = general\n end\n \n index = @dict.find(word.downcase)\n if index\n vector.add_word_index(index)\n else\n not_found = true\n \t search_results.add_warning \"'#{word}' does not occur in the documents\"\n end\n end\n \n if (general.num_bits + must_match.num_bits).zero? \n search_results.add_warning \"No valid search terms given\"\n elsif not not_found\n res = []\n @document_vectors.each do |entry, (dvec, mtime)|\n score = dvec.score_against(must_match, must_not_match, general)\n res << [ entry, score ] if score > 0\n end\n \n res.sort {|a,b| b[1] <=> a[1] }.each {|name, score|\n search_results.add_result(name, score)\n }\n \n search_results.add_warning \"No matches\" unless search_results.contains_matches\n end\n search_results\n end", "def query_wo_exact_phrases(txt)\n self.query_without_exact_phrases ||= txt.gsub(Awesome::Definitions::Stopwords::QUOTED_REGEX, '')\n end", "def match(word_array)\n results = []\n word_array.each do |word|\n results << word if word.split(\"\").sort == @word.split(\"\").sort\n end\n results\n end", "def get_all_letters_in_array_of_words(array)\n result = []\n array.each do |x|\n for a in 0..(x.length-1) do\n result.push(x[a]) if !result.include?(x[a])\n end\n end\n result.sort\nend", "def find_not_uniq_words(in_array)\n all_words = []\n counter = {}\n result = []\n in_array.compact.each do |url_desc_cont|\n next unless url_desc_cont[1][0]\n url_desc_cont[1][0].scan(/\\w+/).each do |word|\n all_words << word\n end\n end\n all_words.each do |word|\n if counter[word]\n counter[word] += 1\n else\n counter[word] = 1\n end\n end\n counter.each_pair do |word, number|\n result << word if number > 1\n end\n result.uniq\n end", "def match_title_all_words(match_string, reject = false)\n text = match_string.downcase || \"\"\n words = text.split\n res = words.map { |w| Regexp.new(/\\b#{w}/i) }\n proc = Proc.new { |entry|\n clean_title = entry.title ? entry.title.downcase : \"\"\n res.collect { |re|\n !!(clean_title =~ re)\n }.inject(:&)\n }\n reject ? self.entries.reject(&proc) : self.entries.find_all(&proc)\n end", "def search_values_without_quotes_and_filters\n search_string.gsub(Regexp.union(FILTER_WORD_REGEX, REGEX_WORD_IN_QUOTES), '').split(' ')\n end", "def missingWords(s, t)\n res = []\n s_words = s.split(\" \")\n t_words = t.split(\" \")\n i = 0\n j = 0\n while i < s_words.length\n if s_words[i] != t_words[j]\n res.push(s_words[i])\n else \n j += 1\n end\n i += 1\n end\n res\nend", "def remove_bad_words(report_model = nil)\n all_words = Word.all_words\n contain_bad_words = false\n res = self.gsub(/\\b\\w+\\b/) do |word|\n if all_words.include?(word.downcase)\n contain_bad_words = true\n '***'\n else\n word\n end\n end.squeeze(' ')\n Report.where(description: 'Contain bad words', target: report_model).first_or_create if contain_bad_words\n res\n end", "def no_indices(guess)\n @candidate_words.reject! { |word| word.include?(guess) }\n end", "def narrow_search_by_length\n self.dictionary.select { |word| word.length == self.word_length }\n end", "def get_valid_words(word)\n [word, word.downcase, word.capitalize, word.pluralize].uniq\n end", "def known(words)\n #find all words for which condition is true,you need to figure out this condition\n known_words = words.find_all {|w| @dictionary.has_key?(w)} \n return known_words\n end", "def find_regex(words)\n Array(words).map do |w|\n regexes_for_word = []\n\n possible_regexes(w).each do |regex|\n #puts \"Word: #{w} against #{regex} -> #{w =~ regex}\"\n if w =~ regex\n regexes_for_word << regex\n end\n end\n\n regexes_for_word.uniq\n end\n end", "def remove_w_words(sentence)\r\n\r\n arr = [] # empty array created\r\n x = sentence.split(\" \")\r\n\r\n i = 0\r\n while i < x.length # iteration starts to check \"w\" in each word\r\n arr << x[i] if x[i][0] != \"w\" # words w/o \"w\" collected\r\n i += 1\r\n end\r\n\r\n arr.join(\" \") # result\r\nend", "def does_not_include_badwords\n\n badwords = %w(\n aloha!\n href=\n -online\n 1freewebspace.com\n 4u\n 5gighost.com\n accutane\n adipex\n adultsex\n advicer\n alprazolam\n amoxil\n arcadepages\n arimidex\n associations.missouristate.edu\n ativan\n augmentin\n baccarrat\n baclofen\n beaver\n blackjack\n bllogspot\n blogs.blackmarble.co.uk\n blowjob\n booker\n buspar\n byob\n car-rental-e-site\n car-rentals-e-site\n carisoprodol\n casino\n casinos\n chatroom\n cialis\n cipro\n citalopram\n clomid\n clonazepam\n comment1\n comment2\n comment3\n comment4\n comment5\n comment6\n coolcoolhu\n coolhu\n credit-card-debt\n credit-report-4u\n creditonlinepersonalloans\n cwas\n cyclen\n cyclobenzaprine\n dating-e-site\n day-trading\n debt-consolidation\n debt-consolidation-consultant\n diazepam\n diovan\n discreetordering\n dostinex\n duty-free\n dutyfree\n dvxuser.com\n equityloans\n fanreach.com\n fioricet\n flagyl\n flowers-leading-site\n fosamax\n freenet\n freenet-shopping\n gambling-\n hair-loss\n health-insurancedeals-4u\n hi5.com\n holdem\n holdempoker\n holdemsoftware\n holdemtexasturbowilson\n homeequityloans\n homefinance\n hotel-dealse-site\n hotele-site\n hotelse-site\n hydrocodone\n hyves.mn\n incest\n insurance-quotesdeals-4u\n insurancedeals-4u\n isuzuforums.com\n jestmaster\n jizz\n jrcreations\n kaboodle.com\n kamagra\n klonopin\n lamictal\n lesbian\n levaquin\n levitra\n lezbian\n loans\n lorazepam\n lycos\n macinstruct\n metformin\n metronidazole\n mortgage-4-u\n mortgagequotes\n musicstation\n nojazzfest\n nolvadex\n online-gambling\n onlinegambling-4u\n ottawavalleyag\n ownsthis\n palm-texas-holdem-game\n paxil\n paydal\n penguinforum\n penis\n personalloansbad\n pharmacy\n phenergan\n phentermine\n poker-chip\n porn\n poze\n profiles.friendster.com\n propecia\n proscar\n pussy\n remeron\n rental-car-e-site\n ringtone\n ringtones\n roulette\n shemale\n shoes\n slot-machine\n Staphcillin\n tamiflu\n tegretol\n texas-holdem\n thorcarlson\n top-e-site\n top-site\n toprol\n toradol\n tramadol\n tramodal\n tramodol\n trim-spa\n ultram\n valeofglamorganconservatives\n valium\n viagra\n vibramycin\n vicodin\n vioxx\n voltaren\n vytorin\n xanax\n zantac\n zithromax\n zofran\n zolpidem\n zolus\n )\n badwords.each do |bw|\n if !comment.nil? && comment.downcase.include?(bw) \n errors.add_to_base(\"Comment Rejected\") \n break\n end\n end\n end", "def find_reg_ex_matches( reg_ex )\n match_set = Set.new\n @words_set.to_a.each do |word|\n match_set.add word if word.downcase.match(reg_ex)\n end\n match_set\n end", "def possible_words?(q)\n\tresults = $wordnik.search_words_new(q)[\"searchResults\"]\n\tresults.map { |w| w[\"word\"] }\nend", "def variation_words word\n ( deletions(word) + transpositions(word) + replacements(word) + insertions(word) ).uniq\n end", "def get_matches(word)\n cur = self\n word.each_char do |character|\n modified_char = @@vowels.include?(character) ? '*' : character\n return Set.new if not cur.kids.has_key? modified_char\n cur = cur.kids[modified_char]\n end\n cur.words_here\n end", "def match choice\n choice.select { |entry| entry if entry.downcase.split(//).sort == self.word.downcase.split(//).sort && entry.downcase != self.word.downcase} \n end", "def words\n reject { |arg| arg.index('-') == 0 }\n end", "def test_lookup_all_by_headword_removes_duplicates\n results = Lexeme.lookup_all_by_headword('lit', matchtype: Lexeme::SUBSTRING)\n\n assert results.any? { |lexeme| lexeme.headword_forms.count { |form| form =~ /lit/ } > 1 },\n 'For this test there needs to be a lexeme with multiple headwords matching the pattern'\n\n assert_equal results.collect(&:id), results.distinct.collect(&:id),\n 'lookup_all_by_headword should remove duplicates in substring search'\n end", "def great_matches\n filtered_matches(partial_or_perfect: [:family_name, :first_name], perfect: [:street, :city])\n end", "def check(words:)\n dictionary = Set.new([\"hello\", \"my\", \"name\", \"is\", \"orange\"])\n corrected = []\n words.each do | word |\n dictionary.include?(word) ? corrected.push(word) : corrected.push(\"~#{word}~\")\n end\n corrected\nend", "def o_words(sentence)\n words = sentence.split(' ')\n return words.select { | val | val.include?('o') }\nend", "def shared_words(other_text, min_word_length, distance: 0)\n if (distance > 0) then\n @word_array.each do |word|\n other_text.word_array.each do |other|\n if (damlev(word, other) > distance) then\n intersection << word\n intersection << other\n end\n end\n end\n else\n intersection = (@word_array & other_text.word_array)\n end\n intersection = intersection.reject{ |word| word.length < min_word_length }\n return intersection\n end", "def valid_words(rack)\n # Load the words\n list_of_words = load_words\n array_of_valid_words = []\n # for each word check if all the letters of word are in rack\n list_of_words.each do |word|\n array_of_valid_words << word if check_word(word, rack)\n end\n array_of_valid_words\nend", "def known(words)\n temp = words.find_all {|k| @dictionary.key?(k) } \n res = temp.sort_by do |word|\n @dictionary[word]\n end\n return res.reverse\n #find all words for which condition is true,\n #you need to figure out this condition\n \n end", "def remove_unwanted_duplicates word_pairs\n all_sequences = word_pairs.map{ |pair| pair.first }\n\n duplicate_seqs = identify_duplicate_sequences all_sequences\n\n word_pairs.reject do |seq, original|\n duplicate_seqs.include? seq\n end\n end", "def filter_words_with_letter array, letter\n array.filter_map{ |value| value if value.include? letter }\nend", "def words_starting_with_un_and_ending_with_ing(text)\n text.scan(/\\bun\\w+ing\\b/)\nend", "def search_words\n begin\n regex = Regexp.new(@pattern)\n rescue RegexpError => msg\n error_msg(msg)\n rescue NameError => msg\n error_msg(msg)\n end\n @results = DICT.select do |word|\n regex =~ word\n end\n @num_results = @results.length\n format_results\n display_results\n end", "def word_unscrambler(str, words)\n str = str.split('').sort.join('')\n possible = []\n words.map do |word|\n sort_word = word.split('').sort.join('')\n possible << word if word_c == str\n end\n return possible\nend", "def match(words_array)\n words_array.select do |element|\n element.split(\"\").sort == @word.split(\"\").sort\n\n end\n end", "def get_words\n @sentences.each_index do |i|\n s = @sentences[i]\n words = s.split(' ')\n words.each do |w|\n word = w.gsub(WORD_SANITIZE, '').downcase\n if belongs_to_known_abbreviations? word\n add_word_to_result(word, i)\n else\n add_word_to_result(word.gsub(DOT_SANITIZE, ''), i)\n end\n end\n end\n end", "def words_to_skip_capitalization_of\n\t\t[ \n\t\t'of','a','the','and','an','or','nor','but','if','then','else','when','up','at','from','by','on',\n\t\t'off','for','in','out','over','to'\n\t\t]\n\tend", "def words_to_skip_capitalization_of\n [\n 'of','a','the','and','an','or','nor','but','if','then','else','when','up','at','from','by','on',\n 'off','for','in','out','over','to'\n ]\n end", "def get_word_list\n @word_list = @lines.reject do |line|\n line.length < 5 || line.length > 12\n end\n end", "def next_words(word, data_subsets)\n total_chars = word.length\n last_six = word[(total_chars - CUT_WORD_LENGTH)..(total_chars)]\n exp = Regexp.new(\"^#{last_six}\")\n\n result = []\n\n hash_key = last_six.match(/.../).to_s\n data_subset_for_word = data_subsets[hash_key]\n return [] if data_subset_for_word.nil?\n\n data_subset_for_word.each do |compared_word|\n if compared_word.match(exp)\n if compared_word != word\n result << compared_word\n end\n end\n end\n result\nend", "def match_title_any_word(match_string, reject = false)\n text = match_string.downcase || \"\"\n words = text.split\n res = words.map { |w| Regexp.new(/\\b#{w}/i) }\n proc = Proc.new { |entry|\n clean_title = entry.title ? entry.title.downcase : \"\"\n res.collect { |re|\n !!(clean_title =~ re)\n }.inject(:|)\n }\n reject ? self.entries.reject(&proc) : self.entries.find_all(&proc)\n end", "def find_all_concatenated_words_in_a_dict(words)\n res = []\n words.each do |original_word|\n smaller_words = words.select { |word| word.length < original_word.length }\n next if smaller_words.count < 2\n permutations = create_permutations(smaller_words).map { |perm| perm.join }\n p permutations\n res << original_word if permutations.include?(original_word)\n end\n res\nend", "def words_starting_with_un_and_ending_with_ing(text)\n return text.scan(/\\b[un]\\w+[ing]\\b/)\nend", "def o_words(sentence)\n select_words = sentence.split.select { |word| word.include?(\"o\") }\n return select_words\nend", "def save_unmatched_words # :nodoc:\n tokens = phrase_without_matches.split(' ')\n unmatched_db = Corpus.new(\"unmatched-#{program_name}.db\")\n tokens.each do |token|\n if !complex_token_matches?(token) # token was not transformed earlier\n @to_match << token\n unmatched_db[token] = @processor.original_text\n end\n end\n unmatched_db.close\n end", "def words\n @words ||= (\n word_suggestions = []\n spellcheck = self.response[:spellcheck]\n if spellcheck && spellcheck[:suggestions]\n suggestions = spellcheck[:suggestions]\n unless suggestions.nil?\n # suggestions is an array: \n # (query term)\n # (hash of term info and term suggestion) \n # ...\n # (query term)\n # (hash of term info and term suggestion) \n # 'correctlySpelled'\n # true/false\n # collation\n # (suggestion for collation)\n i_stop = suggestions.index(\"correctlySpelled\")\n # step through array in 2s to get info for each term\n 0.step(i_stop-1, 2) do |i| \n term = suggestions[i]\n term_info = suggestions[i+1]\n # term_info is a hash:\n # numFound =>\n # startOffset =>\n # endOffset =>\n # origFreq =>\n # suggestion => { frequency =>, word => }\n origFreq = term_info['origFreq']\n suggFreq = term_info['suggestion']['frequency'] \n word_suggestions << term_info['suggestion']['word'] if suggFreq > origFreq\n end\n end\n end\n word_suggestions.uniq\n )\n end", "def words_starting_with_un_and_ending_with_ing(text)\n text.scan(/un+\\w+ing/)\nend", "def match(list)\n list.select do |words|\n letters = words.split(\"\").sort \n if letters == word.split(\"\").sort\n words\n end\n end\n end", "def top_scoring_words\n @dictionary.each_with_object([]) do |cur_word, words_found|\n return words_found if words_found.length >= WORDS_TO_FIND\n\n words_found << cur_word if letters_present_for cur_word\n end\n end", "def all_words\n result = []\n tagged_words.each do |word|\n result << word[0] unless is_punctuation([ word[0], word[1] ])\n end\n result\n end", "def extract_keywords\n self.keywords = Alice::Parser::NgramFactory.filtered_grams_from(self.text).flatten.uniq\n end", "def word_unscrambler(word, dictionary)\nresult = []\ndictionary.each do |entry|\n\tif entry.split(\"\").sort.join(\"\") == word.split(\"\").sort.join(\"\")\n\t\tresult << entry\n\tend\nend\nresult \nend", "def match(array_possible_anagrams)\n matching_words=[]\n word_broken=self.word.split(\"\").sort\n array_possible_anagrams.each do |possible_match|\n #possible_match=possible.word\n possible_match_broken=possible_match.split(\"\").sort\n if possible_match_broken == word_broken\n matching_words << possible_match\n else\n end #end of if\n end #end of do\n matching_words\n end", "def existing_words\n draw_current = draw\n p \"The 7 letters drawn are:\"\n p draw_current\n p \"-\"*70\n\n combinations = combine(draw_current).flat_map{ |w| w.permutation.to_a}.uniq.map { |e| e.join }\n combinations.map{|i| search(i, UPPER_BOUND_INI, LOWER_BOUND_INI, NO_ITERATION_INI)}.flatten.reject{|x| x==nil}\nend", "def split(text)\n text.downcase.scan(WORDS).uniq\n end", "def common_ngrams_from_words(words)\n ngrams_from_words(words).select { |ngram| has_ngram?(ngram) }\n end", "def find_concatenated(word)\n [].tap { |a| probe_words(0, word, a) }\n end" ]
[ "0.68372524", "0.67587155", "0.66453785", "0.6633344", "0.66284317", "0.6566852", "0.65604645", "0.65322715", "0.6530867", "0.6521575", "0.64905804", "0.6483015", "0.64492726", "0.6443264", "0.64324", "0.6421518", "0.6417509", "0.63569254", "0.6351105", "0.6314205", "0.6293248", "0.6279646", "0.62445676", "0.6240697", "0.62243", "0.6214789", "0.6200872", "0.6199028", "0.61772466", "0.61440855", "0.613642", "0.61252916", "0.6120196", "0.6119", "0.6117282", "0.61168414", "0.6103978", "0.6097715", "0.6086526", "0.60838056", "0.607924", "0.6077953", "0.60692", "0.6066983", "0.60581756", "0.6026535", "0.60202265", "0.6005381", "0.6004957", "0.60027057", "0.6002239", "0.5978561", "0.59629864", "0.5957145", "0.59266406", "0.5912926", "0.5910183", "0.5906703", "0.5901713", "0.5888078", "0.5868407", "0.5863774", "0.5858661", "0.58545333", "0.58523226", "0.58518726", "0.58492506", "0.58383036", "0.5832957", "0.58239263", "0.5820276", "0.5811303", "0.580151", "0.5800606", "0.57896656", "0.57886535", "0.5783839", "0.5780878", "0.57634157", "0.57563126", "0.57496065", "0.5741528", "0.5730723", "0.5725979", "0.5724436", "0.5716407", "0.57146674", "0.5712638", "0.5712319", "0.5704692", "0.5700595", "0.56938004", "0.5688708", "0.5688389", "0.5687313", "0.5685232", "0.5682058", "0.56783444", "0.56703764", "0.56687117" ]
0.68202984
1
Return the number of words in the dictionary that contain the given letter
def words_that_contain(letter) letter_count(letter) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def word_count_by_letter(letter)\n\t\tputs \"#{@dictionary_analyzer.word_count_by_letter(letter, @dictionary)} words begin with the letter #{letter}\"\n\tend", "def letter_counts(word) =\n word.chars.each_with_object(Hash.new(0)) { |c, counts| counts[c] += 1 }", "def letter_counts(word)\n counter = Hash.new(0)\n word.chars.each do |x|\n counter[x] += 1\n end\n counter\nend", "def letter_counts(word)\n count = Hash.new(0)\n word.each_char { |char| count[char] += 1}\n count\nend", "def count_letters_in_word(word)\n letters = Hash.new(0)\n word.chars.each { |letter| letters[letter] += 1 }\n letters\nend", "def letter_counts(word)\n answer = Hash.new(0)\n word.each_char { |chr| answer[chr] += 1 }\n answer\nend", "def letter_counts(word)\n letter_counts = Hash.new(0)\n\n word.split(\"\").each do |ele| \n letter_counts[ele] += 1\n end\n letter_counts\nend", "def letterCount(word)\n obj = {}\n word.chars.map do |currentLetter|\n if (!!obj[currentLetter])\n obj[currentLetter] += 1\n else\n obj[currentLetter] = 1\n end\n end\n obj\n end", "def letter_counts(word)\n hash = Hash.new(0)\n word.chars {|letter| hash[letter] += 1}\n hash\nend", "def letter_counts(word)\nend", "def count_letters(word)\r\n\r\n end", "def count_letters(word)\n\thashMap = {}\n\tword.each_char do |a|\n\t\tif hashMap.has_key?(a)\n\t\t\thashMap[a] = hashMap[a] + 1\n\t\telse\n\t\t\thashMap[a] = 1\n\t\tend\n\tend\n\t\n\tmax = hashMap[word[0]]\n\thashMap.each do |value,entry|\n\t\tif entry > max\n\t\t\tmax = entry\n\t\tend\n\tend\n\treturn max\n end", "def letter_counts(word)\n hash = Hash.new(0)\n word.each_char do |ch|\n hash[ch] += 1\n end\n hash\nend", "def letter_counts(word)\n letters = word.split(\"\")\n letter_hash = Hash.new(0)\n letters.each {|char| letter_hash[char]+= 1}\n letter_hash\nend", "def count_letters(word)\r\n letter_count = Hash.new(0)\r\n word.chars { |letter| letter_count[letter.to_sym] += 1 }\r\n # Note: a better way to do the following is:\r\n #letter_count.values.max\r\n # but the requrements say to use .each, so...\r\n max = 0\r\n letter_count.each do |key, value|\r\n if value > max\r\n max = value\r\n end\r\n end\r\n max\r\n end", "def letter_counts(word)\n wordArray = word.split(\"\")\n hash = {}\n wordArray.each do |element|\n if hash[element] == nil\n hash[element] = 1\n else\n hash[element] += 1\n end\n end\n return hash\nend", "def count_letters_in_word(word)\n return word.length\n end", "def letter_counts(word)\n hash = {}\n word.chars.uniq.each {|char| hash[char] = word.count(char)}\n hash\nend", "def str_count(word, letter)\n p word.count(letter)\nend", "def letter_counts(word)\n counter = Hash.new(0)\n word.split('').each do |letter| #could also do each_char instead of split\n counter[letter] += 1\n end\n counter\nend", "def letter_counts(word)\n hsh = Hash.new(0)\n\n word.each_char { |ch| hsh[ch] += 1 }\n\n hsh\nend", "def letter_counter(string)\n hash = {}\n string.split.each do |word|\n if hash.has_key?(word.size)\n hash[word.size] += 1\n else \n hash[word.size] = 1\n end\n end\n hash\nend", "def letter_count(str)\n\tletters = {}\n\tletters.default = 0\n\nstr.each_char do |letter| if str.include?(letter) \n\t\tletters[\"#{letter}\"] += 1 unless letter == \" \"\n\tend\nend\nreturn letters\nend", "def letter_counts(word)\n hashed = word.chars.map {|char| [char, word.count(char)]}.flatten\n return Hash[*hashed]\nend", "def word_counter(word, dictionnary)\n\t\thash = {nil} # Resultat initialized nil \n\t\t#check the table dictionnary\n\t\tdictionnary.map{|i|\n\t\t\t# test if word include in the dictionnary\n\t\t\tif word.downcase.include?(i) == true\n\t\t\t\thash[i] = word.downcase.scan(i).count \n\t\t\tend\n\t\t}\n\treturn hash\n\t\n\tend", "def letter_count(letter)\n @letter_counts ||= compute_counts\n @letter_counts[letter[0] - ?a]\n end", "def char_count(list)\n letter_count = {}\n list.each do |word|\n word.split('').each do |letter| \n \n if letter_count[letter]# == nil\n letter_count[letter] += 1 \n else\n letter_count[letter]=1\n end\n end \n end\n # binding.pry\n letter_count\nend", "def LetterCount(str)\n\n \n words = str.split(\" \")\n most = \"\"\n count = 0\n \n words.each do |word|\n hash = Hash.new(0)\n word.split(\"\").each {|letter| hash[letter] += 1} #must split word\n repeats = hash.select {|letter, count| count >= 2}.size\n if repeats > count\n count = repeats\n most = word\n end\n \n end\n \n return most\n \nend", "def count_letter(letter)\n page_text.count(letter)\n end", "def str_count(word, letter)\n # Code here\n word.count(letter)\nend", "def letter_counter2(string)\n string.split.each_with_object({}) do | word, hash| # word (calling on array)\n if hash.has_key?(word.size) \n hash[word.size] += 1\n else\n hash[word.size] = 1\n end\n end\nend", "def letter_case_count(string)\n counter = {}\n\n counter[:lowercase] = string.count('a-z')\n counter[:uppercase] = string.count('A-Z')\n counter[:neither] = string.count('^a-zA-Z')\n\n counter\nend", "def word_sizes(input)\n hash = {}\n input .split.each do |word|\n num_of_letters = word.chars.count\n if hash.has_key?(num_of_letters)\n hash[num_of_letters] += 1\n else\n hash[num_of_letters] = 1\n end\n end\n hash\nend", "def count_words(str)\n\n frase = str.gsub!(/\\W|\\_\\d/,\" \").split(\" \")\n frase.each do |palabra|\n\n veces = frase.count(palabra)\n hash[palabra] = veces\n\n end\n hash\n\n\n\n end", "def letter_count(str)\nletters = {}\nletters.default = 0\n\n\tstr.each_char do |letter| letters[\"#{letter}\"] += 1 unless letter == \" \" end\n\n\t\treturn letters\n\tend", "def letter_count(str)\n counts = {}\n str.each_char do |char|\n next if char==\" \"\n counts[char] =0 unless counts.include?(char)\n counts[char]+=1\t\n end\n counts \nend", "def letter_count(str)\n letters_hash = {}\n letters_array = str.split(\"\")\n \n letters_array.delete(\" \")\n \n letters_array.each {|x| letters_hash[x] = (letters_hash[x] or 0) + 1}\n letters_hash\nend", "def word_count\n words = @input.downcase.scan(/\\b[\\w']+\\b/)\n\n words.each_with_object(Hash.new(0)) do |word, result|\n result[word] += 1\n end\n end", "def letter_case_count(string)\n count = {}\n string.split.each do |word|\n word.chars.each do |char|\n if char == char.downcase\n count[lowercase:] += 1\n elsif char == char.upcase\n count[uppercase:] += 1\n else\n count[neither:] += 1\n end\n end\n end\ncount\nend", "def letter_count(string)\n\tfrequency = Hash.new(0)\n\tstring.each_char do |i|\n\t\tfrequency[i] += 1 unless i == \" \"\n\tend\n\tfrequency\nend", "def count_a(word)\n\tcounter = 0\n \ti = 0\n \twhile i < word.length\n if word[i] == \"a\" || word[i] == \"A\"\n counter += 1\n end\n i += 1\n end\n return counter\nend", "def count_letters(word)\r\n\r\n letters = Hash.new\r\n\r\n word.gsub( /([a-z])/i ) do |letter|\r\n\r\n letter.downcase!\r\n\r\n if letters.key?( letter )\r\n letters[letter] = letters[letter] + 1\r\n else\r\n letters[letter] = 1\r\n end\r\n\r\n end\r\n \r\n return letters\r\n\r\nend", "def letter_count(str)\n\tr = Hash.new\nstr.delete(' ').split('').each {|letter| r[letter] == nil ? r[letter] = 1 : r[letter] += 1}\nr\nend", "def letter_case_count(string)\n result = {}\n result[:lowercase] = string.count('a-z')\n result[:uppercase] = string.count('A-Z')\n result[:neither] = string.length - result.values.inject(:+)\n result\nend", "def letter_case_count(string)\n hash = {}\n hash[:lowercase] = string.count('a-z')\n hash[:uppercase] = string.count('A-Z')\n hash[:neither] = string.count('^a-zA-Z')\n hash\nend", "def letter_case_count(str)\n letter_count = {}\n letter_count[:lowercase] = str.count('a-z')\n letter_count[:uppercase] = str.count('A-Z')\n letter_count[:neither] = str.count('^a-zA-z')\n letter_count\nend", "def count_words(str)\n counts = {} #counts number of elements\n str.downcase.scan(/\\b[a-z]+/).each do |word| #downcase/seperate words for word do\n if counts[word].nil? then #condition if word exists\n counts[word] = 1 #word exists assign 1\n else\n counts[word] += 1 #object summation\n end\n end\n counts #calls counts\nend", "def letter_count(str)\n counts = {}\n\n str.each_char do |char|\n next if char == \" \"\n counts[char] = 0 unless counts.include?(char)\n counts[char] += 1\n end\n\n counts\nend", "def substrings(string, dictionary)\n found_words = Hash.new(0)\n\n words = string.downcase.gsub(/[^a-z\\s]/, '').split(' ') #cut non-alphanumberic chars from string and put words into array\n\n words.each do |word|\n dictionary.each do |dword|\n if word.include?(dword)\n found_words[dword] += 1\n end\n end\n end\n\n puts found_words\nend", "def letterCount(str)\n ans = {}\n i = 0\n while i < str.length do\n if ans[str[i]] == nil\n ans[str[i]] = 1\n else\n ans[str[i]] += 1\n end\n i += 1\n end\n ans\nend", "def count_repeated_letters(word)\n # character: # of occurences\n occurences = Hash.new(0)\n count = 0\n\n word.each_char do |c|\n occurences[c] += 1\n if occurences[c] == 2\n count+=1\n end\n end\n count\nend", "def word_sizes(word_string)\n word_sizes = Hash.new(0)\n array = word_string.split.each { |string| string.slice!(/[^a-zA-Z]/) }\n array.each { |word| word_sizes[word.size] += 1 }\n word_sizes\nend", "def count_e(word)\n puts word.count('e')\nend", "def letter_count(str)\nresult = Hash.new(0)\nstr.each_char do |letter| result[letter] += 1 unless letter == \" \"\nend\nresult\nend", "def letter_count(str)\n\tstr_hash_map = {}\n\tletters = str.delete(\" \")\n\n\tletters.split(\"\").each do |letter|\n\t\tif str_hash_map.has_key?(letter)\n\t\t\tstr_hash_map[letter] += 1\n\t\telse\n\t\t\tstr_hash_map[letter] = 1\n\t\tend\n\tend\n\treturn str_hash_map\nend", "def count_a(word)\n count = 0\n \n i = 0 \n while i < word.length\n char = word[i]\n \n if char == \"a\"\n count += 1\n \n elsif char == \"A\"\n count += 1\n end\n \n i += 1\n end\n \n return count\nend", "def word_count\n word_map = {}\n words.each {|word| word_map[word] = words.count(word) }\n word_map\n end", "def letter_case_count(string)\n counts = {}\n \n counts[:lowercase] = string.count('a-z')\n counts[:uppercase] = string.count('A-Z')\n counts[:neither] = string.count('^a-zA-Z')\n counts\nend", "def frequency(letter)\n\treturn $letter_frequency[:letter]\nend", "def word_sizes(str)\n hsh = {}\n new_str = str.gsub(/[^a-z ]/i, '')\n arry = new_str.split.map(&:size)\n arry.map { |word| hsh[word] = arry.count(word) }\n hsh\nend", "def letter_case_count(string)\n count = { lowercase: 0, uppercase: 0, neither: 0 }\n\n string.chars.each do |char|\n if (\"A\"..\"Z\").include?(char)\n count[:uppercase] += 1\n elsif (\"a\"..\"z\").include?(char)\n count[:lowercase] += 1\n else\n count[:neither] += 1\n end\n end \n count\nend", "def letter_count(str)\n # With default hash\n # counted_letters = Hash.new(0)\n # str.each_char do |char|\n # counted_letters[char.downcase] += 1\n # end\n # return counted_letters\n\n # without default hash\n counted_letters = {}\n str.each_char do |char|\n if counted_letters.has_key?(char.downcase)\n counted_letters[char.downcase] += 1\n else\n counted_letters[char.downcase] = 1\n end\n end\n return counted_letters\nend", "def get_word(word)\n #pattern [\\w']+ matches words and single quotes. Scan returns array based on the pattern given\n words_arr = word.downcase.scan(/[\\w']+/)\n words_count ={}\n words_arr.each do |wrd|\n if words_count.has_key?(wrd)\n words_count[wrd] +=1\n else\n words_count[wrd] =1\n end\n end\n words_count\nend", "def word_sizes(sentence)\n words = Hash.new(0)\n sentence.split.each {|x| words[x.count(\"A-Za-z\")] += 1}\n words\nend", "def count_a(word)\n count = 0\n \n i = 0\n while i < word.length\n char = word[i]\n \n if char == \"a\" || char == \"A\"\n count += 1\n end\n \n i += 1\n end \n \n return count\nend", "def letter_case_count(string)\n letter_count = { lowercase: 0, uppercase: 0, neither: 0 }\n letter_count[:lowercase] = string.count('a-z')\n letter_count[:uppercase] = string.count('A-Z')\n letter_count[:neither] = string.count('^a-z', '^A-Z')\n letter_count\nend", "def count_words\n string = self.squish.downcase.gsub(/[^a-z0-9\\s]/i, '')\n string = string.split(\" \")\n words = Hash.new(0)\n string.each { |x|\n words[x] +=1;\n }\n return words\n end", "def count_a(word)\n counter = 0\n i = 0\n while i < word.length\n if word[i] == 'a' || word[i] == 'A'\n counter += 1\n end\n i += 1\n end\n return counter\nend", "def letter_count(str)\n characters = str.downcase.split(\"\")\n hashes = {}\n \n characters.each do |character|\n \n if character >= \"a\" && character <= \"z\"\n hashes[character] = hashes[character] ? hashes[character] + 1 : 1\n end\n \n end\n \n hashes\nend", "def count_a(word)\n count = 0\n i = 0\n while i < word.length\n char = word[i]\n if char == \"a\" || char == \"A\"\n count += 1\n end\n i += 1\n end\n return count\nend", "def substrings(phrase, dictionary)\n words = phrase.split(/\\W+/)\n \n counts = Hash.new(0)\n \n words.each do |w|\n dictionary.each do |d|\n if w.downcase.include?(d.downcase)\n counts[d] += 1\n end\n end\n end\n \n return counts\nend", "def frequency(word)\n arr = $words.select do |sample|\n word == sample\n end\n arr.size\nend", "def count_words(string)\n words = string.downcase.split(/[^a-zA-Z]/).reject{|e| e.empty?}\n wf = Hash.new(0)\n words.each { |word| wf[word] += 1 }\n return wf\nend", "def count_e(word)\n count = 0\n word.each_char { |char| count += 1 if char == \"e\"}\n count\nend", "def word_sizes(words)\n count_hash = Hash.new(0)\n words.split.each do |word|\n clean_word = word.delete('^a-zA-Z')\n count_hash[clean_word.size] += 1\n end\n count_hash\nend", "def letter_case_count(string)\n counts = {}\n characters = string.chars # breaks up string into array of strings\n counts[:lowercase] = characters.count {|char| char =~ /[a-z]/}\n counts[:uppercase] = characters.count {|char| char =~ /[A-Z]/}\n counts[:neither] = characters.count {|char| char =~ /[^A-Za-z]/}\n counts\nend", "def count_words(string)\n arg = string.downcase.gsub(/[^a-z ]/,\"\")\n words = arg.split(/\\s+/)\n result = Hash.new\n words.each { |word| \n if result[word].nil? then result[word] = 1 else result[word] += 1 end\n }\n result\nend", "def letter_count(str)\n counts = Hash.new(0)\n str.each_char do |char|\n counts[char.downcase] += 1\n end\n return counts\nend", "def letter_case_count(string)\n hash = Hash.new(0)\n string.split('').each do |character|\n if character.match(/[a-z]/)\n hash[:lowercase_letters] += 1\n elsif character.match(/[A-Z]/)\n hash[:uppercase_letters] += 1\n elsif character.match(/\\d/)\n hash[:other_char] += 1\n elsif character.match(/\\W/)\n hash[:other_char] += 1\n end\n end\n hash\nend", "def count_words\n # clean up string\n str = self.downcase.gsub(/[^a-z0-9\\s]/, '') # only keep letters, numbers, and whitespace\n str = str.gsub(/\\s+/m, ' ') # remove excess whitespace\n\n # add each word to the hash\n hash = Hash.new(0)\n str.split.each do |word|\n hash[word] += 1\n end\n\n hash\n end", "def letter_case_count(string)\n result = {}\n arr = string.chars\n \n result[:lowercase] = arr.count { |char| char =~ /[a-z]/ }\n result[:uppercase] = arr.count { |char| char =~ /[A-Z]/ }\n result[:neither] = arr.count { |char| char =~ /[^a-zA-z]/ }\n result\nend", "def letter_case_count(str)\n h = { lowercase: 0, uppercase: 0, neither: 0 }\n str.each_char do |c|\n if c.between?('a', 'z')\n h[:lowercase] += 1\n elsif c.between?('A', 'Z')\n h[:uppercase] += 1\n else\n h[:neither] += 1\n end\n end\n h\nend", "def letter_count(str)\n count = {\"a\"=>0, \"o\"=>0}\n\n str.each_char do |i|\n if (i == \"a\" || i == \"o\")\n count[i] += 1\n end\n end\n\n return count\nend", "def LetterCount(str)\n words = str.split(' ')\n num_repeats = nil\n best_word = nil\n \n idx = 0\n while idx < words.length\n word = words[idx]\n count = 0\n \n word_freq = Hash.new(0)\n word.split('').map {|x| word_freq[x] += 1 }\n if word_freq.select {|x,y| y > 1 }.empty?\n idx += 1\n next\n else\n count += word_freq.select {|x,y| y > 1 }.size\n end\n \n if num_repeats == nil || count > num_repeats\n num_repeats = count\n best_word = word\n end\n \n idx += 1\n end\n \n if num_repeats == nil\n return -1\n else\n return best_word\n end\nend", "def letter_case_count(string)\n counts = {}\n characters = string.chars\n counts[:lowercase] = characters.count { |char| char =~ /[a-z]/ }\n counts[:uppercase] = characters.count { |char| char =~ /[A-Z]/ }\n counts[:neither] = characters.count { |char| char =~ /[^A-Za-z]/ }\n counts\nend", "def letter_case_count(string)\n counts = {}\n characters = string.chars\n counts[:lowercase] = characters.count { |char| char =~ /[a-z]/ }\n counts[:uppercase] = characters.count { |char| char =~ /[A-Z]/ }\n counts[:neither] = characters.count { |char| char =~ /[^A-Za-z]/ }\n counts\nend", "def count_words(str)\n\tcounts = {}\n\tstr.downcase.scan(/\\b[a-z]+/).each do |word|#word is the index here\n\t\tif counts[word].nil? then\n\t\t\tcounts[word]=1\n\t\telse\n\t\t\tcounts[word] +=1\n\t\tend\n\tend\n\tputs counts\nend", "def count_letters (name, counts)\n sum = 0\n $alphabet.each_with_index { |val, index| counts[index] += name.count(val) }\n counts\nend", "def letter_count(str)\n res=Hash.new(0)\n str.each_char do |ch|\n res[ch]+=1 unless ch==' '\n end\n return res\nend", "def substrings(string, dictionary)\r\n\tresult = Hash.new(0)\r\n\tarr = string.downcase.split(\" \")\r\n\tarr.each do |word|\r\n\t\tdictionary.each do |sub|\r\n\t\t\tresult[sub] += 1 if word[sub]\r\n\t\tend\r\n\tend\r\n\tresult\r\nend", "def letter_case_count(str)\n letter_case_hash = {}\n letter_case_hash[:lowercase] = str.count('a-z')\n letter_case_hash[:uppercase] = str.count('A-Z')\n letter_case_hash[:neither] = str.count('^a-zA-z')\n letter_case_hash\nend", "def character_count(string)\n hash = {}\n hash.default = 0\n letters=string.downcase.chars\n letters.each do |letter|\n hash[letter] +=1\n end\n hash\nend", "def word_count(string)\n hash = {}\n splitstring = string.split(\" \")\n splitstring.each {|element| element.downcase.gsub(/[^a-z]/i, \"\")}\n p splitstring\n splitstring.each{|element| if hash[element].nil?\n hash[element]=1\n else\n hash[element]+=1\n end}\n p hash\n return hash\nend", "def letter_case_count(str)\n hsh = { lowercase: 0,\n uppercase: 0,\n neither: 0 }\n str.chars.each do |char|\n if char.ord >= 'a'.ord && char.ord <= 'z'.ord\n hsh[:lowercase] += 1\n elsif char.ord >= 'A'.ord && char.ord <= 'Z'.ord\n hsh[:uppercase] += 1\n else\n hsh[:neither] += 1\n end\n end\n hsh\nend", "def letter_case_count(string)\n h = {lowercase: 0, uppercase: 0, neither: 0}\n \n string.chars.each do |char|\n if char =~ /[a-z]/\n h[:lowercase] += 1\n elsif char =~ /[A-Z]/\n h[:uppercase] += 1\n else\n h[:neither] += 1\n end\n end\n\n h\nend", "def hash_word(word)\n word_count = Hash.new(0)\n word.each_char do |c|\n word_count[c] += 1\n end\n return word_count\nend", "def word_sizes(str)\n counter = Hash.new(0)\n str.split.each do |word|\n counter[word.gsub(/\\W/,'').length] += 1\n end \n counter\nend", "def word_count\n\t\tputs \"There are #{@dictionary_analyzer.word_count(@dictionary)} words in this dictionary.\"\n\tend", "def word_sizes(str)\n word_counts = Hash.new(0)\n str.gsub(/[^a-zA-Z ]/, '').split.each { |word| word_counts[word.length] += 1 }\n word_counts\nend", "def letter_case_count(string)\n hash = { lowercase: 0, uppercase: 0, neither: 0 }\n str_arr = string.chars\n str_arr.each do |char|\n if char =~ /[a-z]/\n hash[:lowercase] += 1\n elsif char =~ /[A-Z]/\n hash[:uppercase] += 1\n else\n hash[:neither] += 1\n end\n end\n hash\nend" ]
[ "0.8189641", "0.7937864", "0.7869434", "0.7787882", "0.77715236", "0.7695184", "0.7650494", "0.7650218", "0.7646654", "0.75720036", "0.75609696", "0.7557417", "0.75205106", "0.7516355", "0.75112134", "0.7421506", "0.7420873", "0.74122286", "0.7393609", "0.7370991", "0.73561895", "0.7302629", "0.7295204", "0.7287448", "0.7272043", "0.7256497", "0.72271204", "0.71959674", "0.71747506", "0.71056086", "0.70860654", "0.7080011", "0.70706207", "0.70683527", "0.70543593", "0.70539933", "0.7045718", "0.70411223", "0.7037205", "0.7036941", "0.7035581", "0.7029174", "0.7026272", "0.7000548", "0.69959986", "0.6991985", "0.698955", "0.69870865", "0.6984893", "0.69848186", "0.6984659", "0.6981506", "0.69738907", "0.6963827", "0.69625205", "0.69596833", "0.6957758", "0.694958", "0.694264", "0.69414127", "0.6939953", "0.6927421", "0.6927073", "0.69127756", "0.69091934", "0.6906072", "0.6904189", "0.6898392", "0.6892126", "0.689164", "0.6889698", "0.6882258", "0.6877727", "0.68775785", "0.6874643", "0.6874339", "0.6871682", "0.6868193", "0.6867268", "0.6865593", "0.6860581", "0.6858202", "0.6854564", "0.6844039", "0.6843528", "0.6843528", "0.68403214", "0.68380857", "0.6822538", "0.68211466", "0.6820617", "0.68199027", "0.68146175", "0.6814388", "0.6812436", "0.68089324", "0.6808752", "0.68081975", "0.6807281", "0.6804617" ]
0.84663004
0
Iterate over each Word
def each(&block) @words.each(&block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def each\n words.each { |word| yield( word ) }\n end", "def each\n words.each { |word| yield(word) }\n end", "def each_v1\n words.each { |word| yield(word) }\n end", "def each_word(data=nil)\n\t\t\tself.words(data).each {|word| yield word }\n\t\tend", "def each\n word_array = words\n index = 0\n while index < word_array.size\n yield( word_array[index] ) # pass parameter to block.\n index+=1\n end\n end", "def each_word(&block)\n @words.each_key(&block)\n end", "def each\n @table.each do |_, word|\n yield(word)\n end\n end", "def each &block\n enumerator = Enumerator.new do |words|\n words << as_word if terminal?\n children.each { |child| child.each { |word| words << word } }\n end\n\n block.nil? ? enumerator : enumerator.each(&block)\n end", "def each # The Enumerable methods we will be calling this\n\t\tstring.split(\" \").each do |word| # split the string into words (split it on space characters) and process each word\n\t\t\tyield word # Yield the current word to the block that was passed to \"each\"\n\t\tend\n\tend", "def each \n\t\tstring.split(\" \").each do |word|\n\t\t\tyield word\n\t\tend\n\tend", "def my_each(words)\n i = 0\n while i < words.length\n yield(words[i])\n i = i + 1\n end\n words \nend", "def my_each(words)\n i = 0\n while i < words.length\n yield(words[i])\n i+=1\n end\n words\nend", "def each\n return enum_for :each unless block_given?\n\n yield as_word if terminal?\n\n children_tree.each_value do |child|\n child.each do |word|\n yield word\n end\n end\n\n self\n end", "def each\n string.split(' ').each do |word|\n yield word\n end\n end", "def each_word opts = {}, &block\n {:whitespace => :attach_before, :delemiters => :attach_before}.merge! opts\n \n # First, we create a two-dimensional array of words with any whitespace or\n # delemiters that should attach to them.\n mapped = []\n attach_before_next = []\n \n self.enumerate do |item|\n case item\n when Delimiter\n case opts[:delemiters]\n when :standalone\n mapped << [item]\n when :attach_after\n attach_before_next << item\n else\n if attach_before_next.empty?\n if mapped.last\n mapped.last << item\n else\n attach_before_next << item\n end\n else\n attach_before_next << item\n end\n end\n \n when Whitespace\n case opts[:whitespace]\n when :standalone\n mapped << [item]\n when :attach_after\n attach_before_next << item\n else\n if attach_before_next.empty?\n if mapped.last\n mapped.last << item\n else\n attach_before_next << item\n end\n else\n attach_before_next << item\n end\n end\n \n when Word\n if not attach_before_next.empty?\n mapped << [attach_before_next, item].flatten\n attach_before_next = []\n else\n mapped << [item]\n end\n \n end\n end\n \n if not attach_before_next.empty?\n mapped << [Word.new] unless mapped.last\n (mapped.last << attach_before_next).flatten!\n end\n \n # Next, we yield each group of (word plus delimiters and whitespace) as a\n # normal string to the block\n mapped.each do |arr|\n yield arr.map{|w|w.to_s}.join\n end\n end", "def each\n @string.split(\" \").each do |word|\n yield word\n end\n end", "def each\n string.split(\" \").each do |word|\n yield word\n end\n end", "def each\n string.split(\" \").each do |word|\n yield word\n end\n end", "def each\n string.split(\" \").each do |word|\n yield word\n end\n end", "def words\n words = @phrase.split(\" \")\n words.each do |word|\n translate(word)\n end\n end", "def words\n grid.words.map {|word| decorate_word(word) }\n end", "def map_words(input)\n results = []\n input.split.each do |word|\n results << yield(word)\n end\n results\nend", "def each_word_pair\n word_array = words\n index = 0\n while index < word_array.size\n yield word_array[index], word_array[index+1]\n index += 1\n end\n end", "def display_words\n words = self.dictionary.map do |dictionary_entry|\n dictionary_entry.word.lexical_item\n end\n words \n end", "def my_each(words)\n x = 0\n while words[x] != nil\n yield(words[x])\n x += 1\n end\n words\nend", "def each_sentence\n ARGF.each(\"\") do |paragraph|\n words = paragraph.split(\"\\n\").map {|line| line.chomp}\n yield words\n end\nend", "def each_word_pair\n words.each_cons(2) { |array| yield(array[0],array[1]) }\n end", "def next_words_for(word) \n if word.nil? or word.empty?\n generator_names \n else\n name_of_last_generator_inverse = word[-1].swapcase\n generator_names.find_all{|name| name != name_of_last_generator_inverse }.map{|name| word + name }\n end\n end", "def get_words\n @sentences.each_index do |i|\n s = @sentences[i]\n words = s.split(' ')\n words.each do |w|\n word = w.gsub(WORD_SANITIZE, '').downcase\n if belongs_to_known_abbreviations? word\n add_word_to_result(word, i)\n else\n add_word_to_result(word.gsub(DOT_SANITIZE, ''), i)\n end\n end\n end\n end", "def words\n self.scan(WORD_PATTERN)\n end", "def each_term\n\t\t\tself.to_terms.each do |term|\n\t\t\t\tyield term.stem\n\t\t\tend\n\t\tend", "def each_word(&block)\n File.open(@path) do |file|\n file.each_line do |line|\n yield line.chomp\n end\n end\n end", "def each_word_pair_v1\n words.each_con(2) {|array| yield array[0],array[1]}\n end", "def process_words\n reset_counts\n # iterate through radlib_array and add counts\n self.each do |w|\n Rails.logger.debug(w.inspect)\n case w[\"type\"]\n when \"word\"\n @num_words += 1\n if w[\"selectable\"] && w[\"selected\"]\n @num_blanks += 1\n # fix for old radlibs\n unless w[\"user_pos\"]\n w[\"user_pos\"] = w[\"predicted_pos\"]\n end\n type = w[\"user_pos\"].gsub(\"-\", \"_\").to_sym\n Rails.logger.debug(type)\n @num_blanks_by_type[type] += 1\n end\n when \"whitespace\"\n # don't need to do anything here\n when \"punc\"\n @num_sentences += 1 if w[\"text\"] == \".\" || w[\"text\"] == \"!\" || w[\"text\"] == \"?\"\n end\n end\n end", "def each \n if @array_words.length < 3\n return \"Length of the input_file is too small to produce trigrams\"\n end\n \n sentence = generate_sentence\n 0.upto(sentence.split.length - 1) do |x|\n yield sentence.split[x]\n end\n return sentence\n end", "def get_words(text) #no!, two methods named get_words, see word_search.rb\n \twords = text.split('')\n \twords.each do |word|\n \t\t#how to check if word is correct or not?\n \t\tWord.new(name: word, ngsl: false, list: self.id )\n \t\t# example = Wordnik.word.get_top_example(word)['text']\n \tend\n end", "def bulk_tweet_shortener(tweets) \n tweets.each do |phrase|\n puts word_substituter(phrase)\n end\nend", "def words(data=nil, &block)\n\t\t\t#\tsequence the phrases\n\t\t\t#\t\t*sigh* verb and a noun\n\t\t\tnodes = sequence(data, &block)\n\n\t\t\t#\tcomposite the words\n\t\t\t#\t\teach node contains an array of words\n\t\t\tnodes.collect {|node| node.words }.flatten\n\t\tend", "def words\n @phrase = @phrase.split(' ')\n end", "def bulk_tweet_shortener(tweets)\n # puts tweets\n tweets.each {|tweet| puts word_substituter(tweet)}\nend", "def words(*args); data(2, *args); end", "def words\n @content.split\n end", "def words\n @content.split\n end", "def words\n scan(/\\w[\\w'\\-]*/)\n end", "def word\n end", "def bulk_tweet_shortener(tweets)\n tweets.each { |x| puts word_substituter(x)}\nend", "def each &block\n @tokens.each &block\n end", "def each_phrase(data=nil, &block)\n\t\t\tself.phrases(data).each {|phrase| yield phrase }\n\t\tend", "def bulk_tweet_shortener(tweets)\n tweets.each do |tweet|\n output = word_substituter(tweet)\n puts output\n end\nend", "def bulk_tweet_shortener(tweets)\n tweets.each do |tweet|\n puts word_substituter(tweet)\n end\nend", "def bulk_tweet_shortener(tweets)\n tweets.each do |tweet|\n puts word_substituter(tweet)\n end\nend", "def e_words(str)\r\n \r\nend", "def bulk_tweet_shortener(tweets)\n tweets.each { |tweet|\n puts word_substituter(tweet)\n }\nend", "def my_map\n array = []\n self.my_each do |word|\n array << yield(word)\n end\n return array\n end", "def stem_each(ary)\n ary.map { |term| @stemmer.stem(term) }\n end", "def words\n sentences.map { |sentence| sentence.words.map { |word| word } } .flatten.each\n end", "def bulk_tweet_shortener (tweets)\n if(tweets.size > 0)\n tweets.each do |tweet_each|\n puts word_substituter(tweet_each)\n end\n end\nend", "def words\n\t\tscan(/\\w[\\w\\'\\-]*/)\n\tend", "def bulk_tweet_shortener(array_tweet)\n array_tweet.each do |tweet|\n puts word_substituter(tweet)\n end\nend", "def words\n scan(/\\S+/)\n end", "def each_word_count(text)\n word_counts = {}\n normalize(text).each do |word|\n word_counts[word] = 0 if !word_counts[word]\n word_counts[word] += 1\n end\n word_counts\nend", "def find_word(lexical_item)\n \n end", "def whisper_words(words)\n\nend", "def each_word tag_word_data\n tag_word_data.each do |tag_id, hash|\n # \"0\"=>{\"tag\"=>\"VB\", \"101\"=>\"run\", \"deleted=>\"\"}, # word.id=101\n # or w/o old_word\n # \"0\"=>{\"tag\"=>\"VB\", \"word\"=>\"run\", \"deleted\"=>\"\"}, # no word.id\n # or with deleted set to true\n # \"4\"=>{\"tag\"=>\"NNS\", \"128\"=>\"palabras\", \"deleted\"=>\"true\"}\n # TODO: no need to iterate?\n hash.each do |num, tw_hash|\n old_word = nil\n if tw_hash.key? Word.label\n # no old word\n word_id = Word.label\n else\n # old_word is set from word.id\n word_id = tw_hash.keys.detect {|k| k =~ /^\\d+$/} #=>101\n old_word = Word.find(word_id) # TODO: what if it was deleted in the meanwhile?\n end\n\n if tw_hash[\"deleted\"].to_s.downcase =~ /^(1|true)/\n # if the word+tag is marked for deletion, we do not need the new word\n # the new word being equal to nil will signal the old word needs to be deleted\n new_word = nil\n else\n # new_word is set from submitted values of the keys \"tag\" and 101/\"word\"\n # or is retrieved from db if it is already there and has not yet been taken to a pdg\n word_text = tw_hash[word_id].strip\n attrs = {text: word_text, tag_id: nil, paradigm_id: nil}\n new_word = Word.where(attrs).first_or_initialize\n new_word.tag = Tag.find_by(name: tw_hash[\"tag\"])\n end\n\n yield tag_id, old_word, new_word\n end\n end\n end", "def words\n terms.collect { |t| t.word }\n end", "def test_words\n @words = @tester.words(number: 1000)\n\n @words.each { |w| assert_includes @standard_wordlist, w }\n end", "def whisper_words(words)\nreturn words.map{ |elem| elem.downcase + \"...\"}\nend", "def word_instances(text)\n instances = Hash.new(0)\n normalize(text).each do |word|\n instances[word] += 1\n end\n instances\nend", "def possible_words\n\t\t\t@dictionary.grep to_r\n\t\tend", "def words(text)\n text.downcase.scan(/[a-z]+/)\nend", "def bulk_tweet_shortener(tweets)\n tweets.collect do |tweet|\n puts word_substituter(tweet)\n end\nend", "def test_words\n @words = @tester.words(number: 1000)\n\n @words.each { |w| assert_includes @wordlist, w }\n end", "def in_a_word\n WORDS[self]\n end", "def each_element\n @sentences.each { |s| s.each { |e| yield e } }\n end", "def say(words)\n yield\n puts words\nend", "def bulk_tweet_shortener(array)\t\n\t array.map {|a| puts word_substituter(a)}\nend", "def idx_get_word(i)\n @tparses[i][:word]\n end", "def each\n\t\tyield \"piaza\"\n\t\tyield \"spaghetti\"\n\t\tyield \"salad\"\n\t\tyield \"water\"\n\tend", "def word; end", "def word; end", "def word; end", "def word; end", "def word; end", "def capitalize_each_word(phrase)\r\n\r\nend", "def word_substituter(string)\ntweet=string.split(\" \")\ni = 0 \nwhile i < tweet.length \nif dictionary.keys.include?(tweet[i].downcase)\ntweet[i] = dictionary[tweet[i].downcase]\nend \ni+=1\nend\ntweet.join(\" \")\nend", "def words\n @words_array = @phrase.split(' ')\n end", "def insertions\n new_words = []\n @words.each do |word|\n @word = word || '' \n (length + 1).times do |i|\n ('a'..'z').each { |c| new_words << \"#{@word[0...i]}#{c}#{@word[i..-1]}\" }\n end\n end\n new_words\n end", "def words (text)\n return text.downcase.scan(/[a-z]+/) #find all matches of this simple regular expression\n end", "def words (text)\n return text.downcase.scan(/[a-z]+/) #find all matches of this simple regular expression\n end", "def words (text)\n return text.downcase.scan(/[a-z]+/) #find all matches of this simple regular expression\n end", "def text(text)\n (0..text.length).each do |x|\n \n end\nend", "def output_word\n end", "def bulk_tweet_shortener(tweet_array)\n tweet_array.each do |tweet|\n puts word_substituter(tweet)\n # each element in tweet_array is the tweet string which\n # the word_substituter method can work on\n end\nend", "def processed_content\n scan(/[a-z]/i).join.downcase\n\n # self.letters.downcase\n end", "def words\n @words ||= Array(@grpc.words).map do |b|\n Word.from_grpc b\n end\n end", "def morph_words\n words = @query.split(/[^a-zA-Z0-9]/)\n morphed_words = words.map{|word| [word,Text::Metaphone.double_metaphone(word)]}\n morphed_words\n end", "def words\n return @words if @words\n @words = []\n charno = self.charno\n text.scan(/(\\s*)(\\S*)/)[0..-2].each { |spaces, word|\n charno += spaces.size\n @words << [charno, word] if word != \"\"\n charno += word.size\n }\n @words\n end", "def bulk_tweet_shortener(tweet_array)\n tweet_array.each do |tweet|\n puts word_substituter(tweet)\n end\nend", "def bulk_tweet_shortener(tweet_array)\n tweet_array.each do |tweet|\n puts word_substituter(tweet)\n end\nend", "def bulk_tweet_shortener(array)\n array.each do |tweet|\n puts word_substituter(tweet)\n end\n #binding.pry\nend" ]
[ "0.80814636", "0.803478", "0.7768043", "0.7676784", "0.7528286", "0.7179631", "0.7112211", "0.7099856", "0.7093306", "0.70314497", "0.70074385", "0.69655263", "0.69551146", "0.68131745", "0.6710978", "0.6708269", "0.6625018", "0.6625018", "0.6625018", "0.66104347", "0.65764034", "0.6573324", "0.6553616", "0.65226704", "0.6516977", "0.65085775", "0.6493959", "0.6469042", "0.64581764", "0.64460397", "0.6353866", "0.63346136", "0.6327143", "0.6312132", "0.6212664", "0.6199397", "0.61947495", "0.6138397", "0.612953", "0.60939837", "0.6092613", "0.60706955", "0.60706955", "0.6069496", "0.60660416", "0.60608244", "0.6054562", "0.60248286", "0.602376", "0.60174674", "0.60174674", "0.60060227", "0.59997976", "0.59765834", "0.59741366", "0.59717524", "0.5957711", "0.59499025", "0.5946097", "0.59451747", "0.59439003", "0.59429777", "0.5931525", "0.59166676", "0.591532", "0.5887505", "0.5882728", "0.588201", "0.5880394", "0.5877642", "0.5874829", "0.5866021", "0.5847628", "0.5843298", "0.5827514", "0.5827504", "0.58169705", "0.5816819", "0.5799927", "0.5799927", "0.5799927", "0.5799927", "0.5799927", "0.57940876", "0.57901096", "0.5780989", "0.57728755", "0.5758909", "0.5758909", "0.5758909", "0.57504386", "0.57428294", "0.5742512", "0.57300675", "0.5723195", "0.57229203", "0.57211006", "0.5720317", "0.5720317", "0.5712663" ]
0.7526428
5